diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index e00c4ff391..2c0632cf2e 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -12,14 +12,14 @@
/packages/jellyfish/ @fuxingloh
/packages/jellyfish-api-core/ @fuxingloh @canonbrother
/packages/jellyfish-api-jsonrpc/ @fuxingloh
-/packages/jellyfish-api-ocean/ @fuxingloh @canonbrother
+/packages/jellyfish-api-whale/ @fuxingloh @canonbrother
/packages/jellyfish-crypto/ @fuxingloh
/packages/jellyfish-json/ @fuxingloh @canonbrother
/packages/jellyfish-network/ @fuxingloh
/packages/jellyfish-transaction/ @fuxingloh
/packages/jellyfish-wallet/ @fuxingloh
/packages/jellyfish-wallet-mnemonic/ @fuxingloh
-/packages/jellyfish-wallet-ocean/ @fuxingloh
+/packages/jellyfish-wallet-whale/ @fuxingloh
/packages/testcontainers/ @fuxingloh
lerna.json @fuxingloh
diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.md b/.github/ISSUE_TEMPLATE/1-bug-report.md
index f48a281230..71592a58a0 100644
--- a/.github/ISSUE_TEMPLATE/1-bug-report.md
+++ b/.github/ISSUE_TEMPLATE/1-bug-report.md
@@ -1,6 +1,6 @@
---
name: Bug report
-about: Report a bug encountered with using jellyfish
+about: Report a bug encountered with using DeFi Jellyfish
labels: kind/bug
---
diff --git a/.github/ISSUE_TEMPLATE/2-enhancement.md b/.github/ISSUE_TEMPLATE/2-enhancement.md
index 86e9c10d23..e793ceba10 100644
--- a/.github/ISSUE_TEMPLATE/2-enhancement.md
+++ b/.github/ISSUE_TEMPLATE/2-enhancement.md
@@ -1,6 +1,6 @@
---
name: Enhancement request
-about: Suggest an enhancement for jellyfish
+about: Suggest an enhancement for DeFi Jellyfish
labels: kind/feature
---
diff --git a/.github/ISSUE_TEMPLATE/3-general.md b/.github/ISSUE_TEMPLATE/3-general.md
index d3205c1a01..bcf0b3cd88 100644
--- a/.github/ISSUE_TEMPLATE/3-general.md
+++ b/.github/ISSUE_TEMPLATE/3-general.md
@@ -1,6 +1,6 @@
---
name: General question
-about: General question about using jellyfish
+about: General question about using DeFi Jellyfish
labels: kind/question
---
diff --git a/.github/governance.yml b/.github/governance.yml
index 1742d96984..bac278ab91 100644
--- a/.github/governance.yml
+++ b/.github/governance.yml
@@ -36,14 +36,14 @@ issue:
- jellyfish
- jellyfish-api-core
- jellyfish-api-jsonrpc
- - jellyfish-api-ocean
+ - jellyfish-api-whale
- jellyfish-crypto
- jellyfish-json
- jellyfish-network
- jellyfish-transaction
- jellyfish-wallet
- jellyfish-wallet-mnemonic
- - jellyfish-wallet-ocean
+ - jellyfish-wallet-whale
- testcontainers
multiple: true
needs:
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 137a49b26e..97f7356717 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -26,10 +26,10 @@ labels:
matcher:
files: "packages/jellyfish-api-jsonrpc/**"
- - label: area/jellyfish-api-ocean
+ - label: area/jellyfish-api-whale
sync: true
matcher:
- files: "packages/jellyfish-api-ocean/**"
+ files: "packages/jellyfish-api-whale/**"
- label: area/jellyfish-crypto
sync: true
@@ -61,10 +61,10 @@ labels:
matcher:
files: "packages/jellyfish-wallet-mnemonic/**"
- - label: area/jellyfish-wallet-ocean
+ - label: area/jellyfish-wallet-whale
sync: true
matcher:
- files: "packages/jellyfish-wallet-ocean/**"
+ files: "packages/jellyfish-wallet-whale/**"
- label: area/testcontainers
sync: true
diff --git a/.github/labels.yml b/.github/labels.yml
index 12830c5cce..4ba3ffae82 100644
--- a/.github/labels.yml
+++ b/.github/labels.yml
@@ -63,7 +63,7 @@
- color: fbca04
name: area/jellyfish-api-jsonrpc
- color: fbca04
- name: area/jellyfish-api-ocean
+ name: area/jellyfish-api-whale
- color: fbca04
name: area/jellyfish-crypto
- color: fbca04
@@ -75,7 +75,7 @@
- color: fbca04
name: area/jellyfish-wallet
- color: fbca04
- name: area/jellyfish-wallet-ocean
+ name: area/jellyfish-wallet-whale
- color: fbca04
name: area/jellyfish-wallet-mnemonic
- color: fbca04
diff --git a/.github/workflows/ci-size-limit.yml b/.github/workflows/ci-size.yml
similarity index 97%
rename from .github/workflows/ci-size-limit.yml
rename to .github/workflows/ci-size.yml
index 6809a5afe7..4f1e91abee 100644
--- a/.github/workflows/ci-size-limit.yml
+++ b/.github/workflows/ci-size.yml
@@ -1,4 +1,4 @@
-name: CI
+name: CI Size
on:
pull_request:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 96e0f5914a..899dd04016 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,5 +20,5 @@ jobs:
- run: npm run build
- run: npm run standard
- - run: npx --no-install jest --ci --coverage --forceExit
+ - run: npm run test:ci
- run: npx codecov
diff --git a/.idea/jellyfish.iml b/.idea/jellyfish.iml
index b19defd1d2..6f3607dd53 100644
--- a/.idea/jellyfish.iml
+++ b/.idea/jellyfish.iml
@@ -6,8 +6,9 @@
+
-
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 3f729ac88a..ff1f18bd4f 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized
finance on Bitcoin.
-> 🚧 Work in progress, `10/193` rpc completed.
+> 🚧 Work in progress.
## Installation
@@ -77,7 +77,8 @@ Documentation can be found at `https://jellyfish.defichain.com`?
### Packages
-Jellyfish follows a monorepo methodology, all maintained packages are in the same repo and published with the same version tag.
+DeFi Jellyfish follows a monorepo methodology, all maintained packages are in the same repo and published with the same
+version tag.
[![npm](https://img.shields.io/npm/v/@defichain/jellyfish)](https://www.npmjs.com/package/@defichain/jellyfish/v/latest)
[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish/next)](https://www.npmjs.com/package/@defichain/jellyfish/v/next)
@@ -87,9 +88,14 @@ Package | Description
`@defichain/jellyfish` | Library bundled usage entrypoint with conventional defaults for 4 bundles: umd, esm, cjs and d.ts
`@defichain/jellyfish-api-core` | A protocol agnostic DeFi Blockchain client interfaces, with a "foreign function interface" design.
`@defichain/jellyfish-api-jsonrpc` | Implements the [JSON-RPC 1.0](https://www.jsonrpc.org/specification_v1) specification for api-core.
+`@defichain/jellyfish-api-whale` | Implements the DeFi Whale service communication specification for api-core.
+`@defichain/jellyfish-crypto` | Cryptography operations for jellyfish, includes a simple 'secp256k1' EllipticPair.
`@defichain/jellyfish-json` | Allows parsing of JSON with 'lossless', 'bignumber' and 'number' numeric precision.
`@defichain/jellyfish-network` | Contains DeFi blockchain various network configuration for mainnet, testnet and regtest.
`@defichain/jellyfish-transaction` | Dead simple modern stateless raw transaction builder for DeFi.
+`@defichain/jellyfish-wallet` | Jellyfish wallet is a managed wallet, where account can get discovered from an HD seed.
+`@defichain/jellyfish-wallet-mnemonic` | MnemonicHdNode implements the WalletHdNode from jellyfish-wallet; a CoinType-agnostic HD Wallet for noncustodial DeFi.
+`@defichain/jellyfish-wallet-whale` | WhaleWalletAccount implements the WalletAccount from jellyfish-wallet; a stateless account service for DeFi.
`@defichain/testcontainers` | Provides a lightweight, throw away instances for DeFiD node provisioned automatically in a Docker container.
## Developing & Contributing
diff --git a/package-lock.json b/package-lock.json
index 2e0b9df7c6..6e233df971 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "jellyfish",
+ "name": "@defich/jellyfish",
"lockfileVersion": 2,
"requires": true,
"packages": {
@@ -1513,8 +1513,8 @@
"resolved": "packages/jellyfish-wallet-mnemonic",
"link": true
},
- "node_modules/@defichain/jellyfish-wallet-ocean": {
- "resolved": "packages/jellyfish-wallet-ocean",
+ "node_modules/@defichain/jellyfish-wallet-whale": {
+ "resolved": "packages/jellyfish-wallet-whale",
"link": true
},
"node_modules/@defichain/testcontainers": {
@@ -1724,7 +1724,6 @@
"jest-resolve": "^26.6.2",
"jest-util": "^26.6.2",
"jest-worker": "^26.6.2",
- "node-notifier": "^8.0.0",
"slash": "^3.0.0",
"source-map": "^0.6.0",
"string-length": "^4.0.1",
@@ -14706,7 +14705,6 @@
"dependencies": {
"anymatch": "~3.1.1",
"braces": "~3.0.2",
- "fsevents": "~2.3.1",
"glob-parent": "~5.1.0",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
@@ -16760,8 +16758,7 @@
"esprima": "^4.0.1",
"estraverse": "^5.2.0",
"esutils": "^2.0.2",
- "optionator": "^0.8.1",
- "source-map": "~0.6.1"
+ "optionator": "^0.8.1"
},
"bin": {
"escodegen": "bin/escodegen.js",
@@ -17945,7 +17942,6 @@
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
- "@types/yauzl": "^2.9.1",
"debug": "^4.1.1",
"get-stream": "^5.1.0",
"yauzl": "^2.10.0"
@@ -18896,7 +18892,6 @@
"minimist": "^1.2.5",
"neo-async": "^2.6.0",
"source-map": "^0.6.1",
- "uglify-js": "^3.1.4",
"wordwrap": "^1.0.0"
},
"bin": {
@@ -20539,7 +20534,6 @@
"@types/node": "*",
"anymatch": "^3.0.3",
"fb-watchman": "^2.0.0",
- "fsevents": "^2.1.2",
"graceful-fs": "^4.2.4",
"jest-regex-util": "^26.0.0",
"jest-serializer": "^26.6.2",
@@ -21079,7 +21073,6 @@
"dev": true,
"license": "MIT",
"dependencies": {
- "graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
},
"optionalDependencies": {
@@ -21821,7 +21814,6 @@
"dev": true,
"license": "MIT",
"dependencies": {
- "encoding": "^0.1.12",
"minipass": "^3.1.0",
"minipass-sized": "^1.0.3",
"minizlib": "^2.0.0"
@@ -28299,8 +28291,7 @@
"esprima": "^4.0.1",
"estraverse": "^4.2.0",
"esutils": "^2.0.2",
- "optionator": "^0.8.1",
- "source-map": "~0.6.1"
+ "optionator": "^0.8.1"
},
"bin": {
"escodegen": "bin/escodegen.js",
@@ -29416,8 +29407,8 @@
"typescript": ">=4.2.0"
}
},
- "packages/jellyfish-wallet-ocean": {
- "name": "@defichain/jellyfish-wallet-ocean",
+ "packages/jellyfish-wallet-whale": {
+ "name": "@defichain/jellyfish-wallet-whale",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
@@ -30673,8 +30664,8 @@
"typescript": ">=4.2.0"
}
},
- "@defichain/jellyfish-wallet-ocean": {
- "version": "file:packages/jellyfish-wallet-ocean",
+ "@defichain/jellyfish-wallet-whale": {
+ "version": "file:packages/jellyfish-wallet-whale",
"requires": {
"@defichain/jellyfish-crypto": "0.0.0",
"@defichain/jellyfish-network": "0.0.0",
diff --git a/package.json b/package.json
index 706f70a3a8..f99f1a3f71 100644
--- a/package.json
+++ b/package.json
@@ -25,18 +25,9 @@
"publish:latest": "lerna run publish:latest",
"standard": "ts-standard --fix",
"test": "jest",
+ "test:ci": "jest --ci --coverage --forceExit",
"all": "npm run build && npm run standard && npm run test"
},
- "jest": {
- "collectCoverageFrom": [
- "**/*.{ts,js}",
- "!**/__tests__/**",
- "!**/coverage/**",
- "!**/node_modules/**",
- "!**/babel.config.js",
- "!**/jest.setup.js"
- ]
- },
"devDependencies": {
"@size-limit/preset-app": "^4.10.1",
"@types/jest": "^26.0.22",
diff --git a/packages/jellyfish-crypto/package.json b/packages/jellyfish-crypto/package.json
index 6326059071..c51797806d 100644
--- a/packages/jellyfish-crypto/package.json
+++ b/packages/jellyfish-crypto/package.json
@@ -26,8 +26,8 @@
"name": "DeFi Jellyfish Contributors"
}
],
- "main": "dist",
- "types": "dist",
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
"files": [
"dist"
],
diff --git a/packages/jellyfish-wallet-ocean/README.md b/packages/jellyfish-wallet-ocean/README.md
deleted file mode 100644
index d679854983..0000000000
--- a/packages/jellyfish-wallet-ocean/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-[![npm](https://img.shields.io/npm/v/@defichain/jellyfish-wallet-ocean)](https://www.npmjs.com/package/@defichain/jellyfish-wallet-ocean/v/latest)
-[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish-wallet-ocean/next)](https://www.npmjs.com/package/@defichain/jellyfish-wallet-ocean/v/next)
-
-# @defichain/jellyfish-wallet-ocean
-
-OceanWalletAccount implements the WalletAccount from jellyfish-wallet; a stateless account service for DeFi.
-All stateless and stateful node service is provided by DeFi ocean service.
diff --git a/packages/jellyfish-wallet-whale/README.md b/packages/jellyfish-wallet-whale/README.md
new file mode 100644
index 0000000000..b756962b32
--- /dev/null
+++ b/packages/jellyfish-wallet-whale/README.md
@@ -0,0 +1,7 @@
+[![npm](https://img.shields.io/npm/v/@defichain/jellyfish-wallet-whale)](https://www.npmjs.com/package/@defichain/jellyfish-wallet-whale/v/latest)
+[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish-wallet-whale/next)](https://www.npmjs.com/package/@defichain/jellyfish-wallet-whale/v/next)
+
+# @defichain/jellyfish-wallet-whale
+
+WhaleWalletAccount implements the WalletAccount from jellyfish-wallet; a stateless account service for DeFi.
+All stateless and stateful node service is provided by DeFi whale server.
diff --git a/packages/jellyfish-wallet-ocean/jest.config.js b/packages/jellyfish-wallet-whale/jest.config.js
similarity index 100%
rename from packages/jellyfish-wallet-ocean/jest.config.js
rename to packages/jellyfish-wallet-whale/jest.config.js
diff --git a/packages/jellyfish-wallet-ocean/package.json b/packages/jellyfish-wallet-whale/package.json
similarity index 96%
rename from packages/jellyfish-wallet-ocean/package.json
rename to packages/jellyfish-wallet-whale/package.json
index fa59c52c28..c40036e92a 100644
--- a/packages/jellyfish-wallet-ocean/package.json
+++ b/packages/jellyfish-wallet-whale/package.json
@@ -1,6 +1,6 @@
{
"private": false,
- "name": "@defichain/jellyfish-wallet-ocean",
+ "name": "@defichain/jellyfish-wallet-whale",
"version": "0.0.0",
"description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin",
"keywords": [
diff --git a/packages/jellyfish-wallet-ocean/src/index.ts b/packages/jellyfish-wallet-whale/src/index.ts
similarity index 66%
rename from packages/jellyfish-wallet-ocean/src/index.ts
rename to packages/jellyfish-wallet-whale/src/index.ts
index 3a99b40543..46ae5f3e74 100644
--- a/packages/jellyfish-wallet-ocean/src/index.ts
+++ b/packages/jellyfish-wallet-whale/src/index.ts
@@ -3,10 +3,10 @@ import { Network } from '@defichain/jellyfish-network'
import { HRP, toBech32 } from '@defichain/jellyfish-crypto'
/**
- * jellyfish-api-ocean implementation of WalletAccount.
+ * jellyfish-api-whale implementation of WalletAccount.
* All stateless and stateful node service is provided by an ocean instance.
*/
-export class OceanWalletAccount implements WalletAccount {
+export class WhaleWalletAccount implements WalletAccount {
private readonly hdNode: WalletHdNode
private readonly network: Network
@@ -29,18 +29,18 @@ export class OceanWalletAccount implements WalletAccount {
}
/**
- * Provide OceanWalletAccount with upstream to DeFi ocean services.
+ * Provide WhaleWalletAccount with upstream to DeFi whale services.
*/
-export class OceanWalletAccountProvider implements WalletAccountProvider {
+export class WhaleWalletAccountProvider implements WalletAccountProvider {
private readonly network: Network
- // TODO(fuxingloh): to implement after 'jellyfish-api-ocean'
+ // TODO(fuxingloh): to implement after 'jellyfish-api-whale'
constructor (network: Network) {
this.network = network
}
- provide (hdNode: WalletHdNode): OceanWalletAccount {
- return new OceanWalletAccount(hdNode, this.network)
+ provide (hdNode: WalletHdNode): WhaleWalletAccount {
+ return new WhaleWalletAccount(hdNode, this.network)
}
}
diff --git a/packages/jellyfish-wallet-ocean/tsconfig.json b/packages/jellyfish-wallet-whale/tsconfig.json
similarity index 100%
rename from packages/jellyfish-wallet-ocean/tsconfig.json
rename to packages/jellyfish-wallet-whale/tsconfig.json
diff --git a/packages/jellyfish-wallet/jest.config.js b/packages/jellyfish-wallet/jest.config.js
index 11d9802ff4..8aaee4ac28 100644
--- a/packages/jellyfish-wallet/jest.config.js
+++ b/packages/jellyfish-wallet/jest.config.js
@@ -8,5 +8,9 @@ module.exports = {
},
verbose: true,
clearMocks: true,
- testTimeout: 120000
+ testTimeout: 120000,
+ coveragePathIgnorePatterns: [
+ '/node_modules/',
+ '.*/__tests__/.*'
+ ]
}
diff --git a/packages/testcontainers/__tests__/chains/reg_test_container/coinbase.test.ts b/packages/testcontainers/__tests__/chains/reg_test_container/coinbase.test.ts
new file mode 100644
index 0000000000..7c495dc5cf
--- /dev/null
+++ b/packages/testcontainers/__tests__/chains/reg_test_container/coinbase.test.ts
@@ -0,0 +1,87 @@
+import { MasterNodeRegTestContainer } from '../../../src'
+import waitForExpect from 'wait-for-expect'
+
+describe('coinbase maturity', () => {
+ const container = new MasterNodeRegTestContainer()
+
+ beforeAll(async () => {
+ await container.start()
+ await container.waitForReady()
+ await container.waitForWalletCoinbaseMaturity()
+ })
+
+ afterAll(async () => {
+ await container.stop()
+ })
+
+ it('should wait until coinbase maturity with spendable balance', async () => {
+ await waitForExpect(async () => {
+ const info = await container.getMintingInfo()
+ expect(info.blocks).toBeGreaterThan(100)
+ })
+
+ await container.generate(3)
+
+ await waitForExpect(async () => {
+ const balance = await container.call('getbalance')
+ expect(balance).toBeGreaterThan(100)
+ })
+ })
+
+ it('should be able to perform amk rpc feature', async () => {
+ await container.generate(5)
+
+ const address = await container.getNewAddress()
+ const payload: { [key: string]: string } = {}
+ payload[address] = '100@0'
+ await container.call('utxostoaccount', [payload])
+ })
+
+ it('should be able to wait for balance to be gte 200', async () => {
+ await container.waitForWalletBalanceGTE(200)
+
+ const balance = await container.call('getbalance')
+ expect(balance).toBeGreaterThanOrEqual(200)
+ })
+
+ it('should be able to fund an address for testing', async () => {
+ const address = 'bcrt1ql0ys2ahu4e9uhjn2l0mehhh4e0mmh7npyhx0re'
+ const privKey = 'cPuytfxySwc9RVrFpqQ9xheZ6jCmJD6pEe3XUPvev5hBwheivH5C'
+ await container.waitForWalletBalanceGTE(100)
+
+ const { txid, vout } = await container.fundAddress(address, 10)
+ await container.call('importprivkey', [privKey])
+ return await waitForExpect(async () => {
+ const unspent = await container.call('listunspent', [
+ 0, 9999999, [address]
+ ])
+
+ expect(unspent[0].txid).toBe(txid)
+ expect(unspent[0].vout).toBe(vout)
+ expect(unspent[0].address).toBe(address)
+ expect(unspent[0].amount).toBe(10)
+
+ expect(unspent[0].spendable).toBe(true)
+ expect(unspent[0].solvable).toBe(true)
+ })
+ })
+
+ it('should be able to get new address and priv/pub key for testing', async () => {
+ const { address, privKey, pubKey } = await container.newAddressKeys()
+ await container.waitForWalletBalanceGTE(10)
+ const { txid } = await container.fundAddress(address, 1)
+
+ const dumpprivkey = await container.call('dumpprivkey', [address])
+ expect(dumpprivkey).toBe(privKey)
+
+ const getaddressinfo = await container.call('getaddressinfo', [address])
+ expect(getaddressinfo.pubkey).toBe(pubKey)
+
+ return await waitForExpect(async () => {
+ const unspent = await container.call('listunspent', [
+ 0, 9999999, [address]
+ ])
+ expect(unspent[0].txid).toBe(txid)
+ })
+ })
+})
diff --git a/packages/testcontainers/__tests__/chains/reg_test_container/masternode.test.ts b/packages/testcontainers/__tests__/chains/reg_test_container/masternode.test.ts
index 8c03394726..eb7d01666e 100644
--- a/packages/testcontainers/__tests__/chains/reg_test_container/masternode.test.ts
+++ b/packages/testcontainers/__tests__/chains/reg_test_container/masternode.test.ts
@@ -20,88 +20,3 @@ describe('masternode', () => {
})
})
})
-
-describe('coinbase maturity', () => {
- const container = new MasterNodeRegTestContainer()
-
- beforeAll(async () => {
- await container.start()
- await container.waitForReady()
- await container.waitForWalletCoinbaseMaturity()
- })
-
- afterAll(async () => {
- await container.stop()
- })
-
- it('should wait until coinbase maturity with spendable balance', async () => {
- await waitForExpect(async () => {
- const info = await container.getMintingInfo()
- expect(info.blocks).toBeGreaterThan(100)
- })
-
- await container.generate(3)
-
- await waitForExpect(async () => {
- const balance = await container.call('getbalance')
- expect(balance).toBeGreaterThan(100)
- })
- })
-
- it('should be able to perform amk rpc feature', async () => {
- await container.generate(5)
-
- const address = await container.getNewAddress()
- const payload: { [key: string]: string } = {}
- payload[address] = '100@0'
- await container.call('utxostoaccount', [payload])
- })
-
- it('should be able to wait for balance to be gte 200', async () => {
- await container.waitForWalletBalanceGTE(200)
-
- const balance = await container.call('getbalance')
- expect(balance).toBeGreaterThanOrEqual(200)
- })
-
- it('should be able to fund an address for testing', async () => {
- const address = 'bcrt1ql0ys2ahu4e9uhjn2l0mehhh4e0mmh7npyhx0re'
- const privKey = 'cPuytfxySwc9RVrFpqQ9xheZ6jCmJD6pEe3XUPvev5hBwheivH5C'
- await container.waitForWalletBalanceGTE(100)
-
- const { txid, vout } = await container.fundAddress(address, 10)
- await container.call('importprivkey', [privKey])
- return await waitForExpect(async () => {
- const unspent = await container.call('listunspent', [
- 0, 9999999, [address]
- ])
-
- expect(unspent[0].txid).toBe(txid)
- expect(unspent[0].vout).toBe(vout)
- expect(unspent[0].address).toBe(address)
- expect(unspent[0].amount).toBe(10)
-
- expect(unspent[0].spendable).toBe(true)
- expect(unspent[0].solvable).toBe(true)
- })
- })
-
- it('should be able to get new address and priv/pub key for testing', async () => {
- const { address, privKey, pubKey } = await container.newAddressKeys()
- await container.waitForWalletBalanceGTE(10)
- const { txid } = await container.fundAddress(address, 1)
-
- const dumpprivkey = await container.call('dumpprivkey', [address])
- expect(dumpprivkey).toBe(privKey)
-
- const getaddressinfo = await container.call('getaddressinfo', [address])
- expect(getaddressinfo.pubkey).toBe(pubKey)
-
- return await waitForExpect(async () => {
- const unspent = await container.call('listunspent', [
- 0, 9999999, [address]
- ])
- expect(unspent[0].txid).toBe(txid)
- })
- })
-})
diff --git a/packages/testcontainers/src/chains/reg_test_container/index.ts b/packages/testcontainers/src/chains/reg_test_container/index.ts
new file mode 100644
index 0000000000..a3d7c44c53
--- /dev/null
+++ b/packages/testcontainers/src/chains/reg_test_container/index.ts
@@ -0,0 +1,35 @@
+import { DockerOptions } from 'dockerode'
+import { DeFiDContainer, StartOptions } from '../container'
+
+/**
+ * RegTest DeFiD container
+ */
+export class RegTestContainer extends DeFiDContainer {
+ constructor (options?: DockerOptions) {
+ super('regtest', options)
+ }
+
+ protected getCmd (opts: StartOptions): string[] {
+ return [...super.getCmd(opts),
+ '-regtest=1',
+ '-txnotokens=0',
+ '-logtimemicros',
+ '-txindex=1',
+ '-acindex=1',
+ '-amkheight=0',
+ '-bayfrontheight=1',
+ '-bayfrontgardensheight=2',
+ '-clarkequayheight=3',
+ '-dakotaheight=4',
+ '-dakotacrescentheight=5'
+ ]
+ }
+
+ async getNewAddress (label: string = '', addressType: 'legacy' | 'p2sh-segwit' | 'bech32' | string = 'bech32'): Promise {
+ return await this.call('getnewaddress', [label, addressType])
+ }
+
+ async getRpcPort (): Promise {
+ return await this.getPort('19554/tcp')
+ }
+}
diff --git a/packages/testcontainers/src/chains/reg_test_container.ts b/packages/testcontainers/src/chains/reg_test_container/masternode.ts
similarity index 85%
rename from packages/testcontainers/src/chains/reg_test_container.ts
rename to packages/testcontainers/src/chains/reg_test_container/masternode.ts
index dc0740b00d..16c4909a08 100644
--- a/packages/testcontainers/src/chains/reg_test_container.ts
+++ b/packages/testcontainers/src/chains/reg_test_container/masternode.ts
@@ -1,36 +1,7 @@
+import { GenesisKeys, MasterNodeKey } from '../../testkeys'
import { DockerOptions } from 'dockerode'
-import { DeFiDContainer, StartOptions } from './container'
-import { GenesisKeys, MasterNodeKey } from '../testkeys'
-
-export class RegTestContainer extends DeFiDContainer {
- constructor (options?: DockerOptions) {
- super('regtest', options)
- }
-
- protected getCmd (opts: StartOptions): string[] {
- return [...super.getCmd(opts),
- '-regtest=1',
- '-txnotokens=0',
- '-logtimemicros',
- '-txindex=1',
- '-acindex=1',
- '-amkheight=0',
- '-bayfrontheight=1',
- '-bayfrontgardensheight=2',
- '-clarkequayheight=3',
- '-dakotaheight=4',
- '-dakotacrescentheight=5'
- ]
- }
-
- async getNewAddress (label: string = '', addressType: 'legacy' | 'p2sh-segwit' | 'bech32' | string = 'bech32'): Promise {
- return await this.call('getnewaddress', [label, addressType])
- }
-
- async getRpcPort (): Promise {
- return await this.getPort('19554/tcp')
- }
-}
+import { StartOptions } from '../container'
+import { RegTestContainer } from './index'
/**
* RegTest with MasterNode preconfigured
@@ -100,6 +71,11 @@ export class MasterNodeRegTestContainer extends RegTestContainer {
Cmd: ['bash', '-c', `echo "${fileContents}" > ~/.defi/defi.conf`]
})
+ await new Promise((resolve) => {
+ // 1 second delay before stopping due to race conditions
+ setTimeout(_ => resolve(0), 1000)
+ })
+
// restart and wait for ready
await this.container?.stop()
await this.container?.start()
diff --git a/packages/testcontainers/src/index.ts b/packages/testcontainers/src/index.ts
index d7f62b7d95..1c7eb601b9 100644
--- a/packages/testcontainers/src/index.ts
+++ b/packages/testcontainers/src/index.ts
@@ -1,12 +1,9 @@
export { DockerOptions } from 'dockerode'
-export { StartOptions, DeFiDContainer, DeFiDRpcError } from './chains/container'
-export { MainNetContainer } from './chains/main_net_container'
-export { TestNetContainer } from './chains/test_net_container'
-export {
- RegTestContainer, MasterNodeRegTestContainer
-} from './chains/reg_test_container'
+export * from './testkeys'
-export {
- KeyPair, MasterNodeKey, GenesisKeys
-} from './testkeys'
+export * from './chains/container'
+export * from './chains/main_net_container'
+export * from './chains/test_net_container'
+export * from './chains/reg_test_container/index'
+export * from './chains/reg_test_container/masternode'
diff --git a/website/docs/introduction.md b/website/docs/introduction.md
index b1effe5723..6b136b7978 100644
--- a/website/docs/introduction.md
+++ b/website/docs/introduction.md
@@ -30,7 +30,12 @@ Package | Description
`@defichain/jellyfish` | Library bundled usage entrypoint with conventional defaults for 4 bundles: umd, esm, cjs and d.ts
`@defichain/jellyfish-api-core` | A protocol agnostic DeFi Blockchain client interfaces, with a "foreign function interface" design.
`@defichain/jellyfish-api-jsonrpc` | Implements the [JSON-RPC 1.0](https://www.jsonrpc.org/specification_v1) specification for api-core.
+`@defichain/jellyfish-api-whale` | Implements the DeFi Whale service communication specification for api-core.
+`@defichain/jellyfish-crypto` | Cryptography operations for jellyfish, includes a simple 'secp256k1' EllipticPair.
`@defichain/jellyfish-json` | Allows parsing of JSON with 'lossless', 'bignumber' and 'number' numeric precision.
`@defichain/jellyfish-network` | Contains DeFi blockchain various network configuration for mainnet, testnet and regtest.
`@defichain/jellyfish-transaction` | Dead simple modern stateless raw transaction builder for DeFi.
+`@defichain/jellyfish-wallet` | Jellyfish wallet is a managed wallet, where account can get discovered from an HD seed.
+`@defichain/jellyfish-wallet-mnemonic` | MnemonicHdNode implements the WalletHdNode from jellyfish-wallet; a CoinType-agnostic HD Wallet for noncustodial DeFi.
+`@defichain/jellyfish-wallet-whale` | WhaleWalletAccount implements the WalletAccount from jellyfish-wallet; a stateless account service for DeFi.
`@defichain/testcontainers` | Provides a lightweight, throw away instances for DeFiD node provisioned automatically in a Docker container.