diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 89b4c5e2b6..cfb246cde8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ Please follow the guidelines outlined at https://github.com/DeFiCh/.github/blob/ ## Documentation -Each pull request with feature change should have accompanying documentations under the `docs/` folder. +Each pull request with feature change should have accompanying documentations under the `website/` folder. ## Explicit over implicit diff --git a/README.md b/README.md index 8f1bfd4894..a5af59b3d2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ # @defichain/jellyfish -A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin. +A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized +finance on Bitcoin. > 🚧 Work in progress, `3/193` rpc completed. @@ -65,38 +66,35 @@ const oceanClient = new Client(new OceanProvider(), options) [![Netlify Status](https://api.netlify.com/api/v1/badges/c5b7a65e-aeec-4e12-a7b7-300cbc1a8069/deploy-status)](https://app.netlify.com/sites/cranky-franklin-5e59ef/deploys) +Following the idea of everything in main is production ready; all pull request must be accompanied by a documentation +change under the `website/` folder. Hence, the main branch should be treated as a release with documentations. + ``` // TODO(fuxingloh): Documentation can be found at `https://jellyfish.defichain.com`? + Community Links ``` -## Packages - -* `@defichain/jellyfish` bundled usage entrypoint with conventional defaults for 4 bundles: `umd`, `esm`, `cjs` - and `d.ts` -* `@defichain/jellyfish-api-core` is a protocol agnostic DeFiChain 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. -* `@defichain/jellyfish-json` allows parsing of JSON with `'lossless'`, `'bignumber'` and `'number'` numeric precision. -* `@defichain/jellyfish-network` contains DeFi blockchain various network configuration for main, net and regtest. -* `@defichain/testcontainers` provides a lightweight, throw away instances for DeFiD node provisioned automatically in - Docker container. - -### Latest Releases - -|package|@latest|@next| -|---|---|---| -|`@defichain/jellyfish`|[![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)| -|`@defichain/jellyfish-api-core`|[![npm](https://img.shields.io/npm/v/@defichain/jellyfish-api-core)](https://www.npmjs.com/package/@defichain/jellyfish-api-core/v/latest)|[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish-api-core/next)](https://www.npmjs.com/package/@defichain/jellyfish-api-core/v/next)| -|`@defichain/jellyfish-api-jsonrpc`|[![npm](https://img.shields.io/npm/v/@defichain/jellyfish-api-jsonrpc)](https://www.npmjs.com/package/@defichain/jellyfish-api-jsonrpc/v/latest)|[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish-api-jsonrpc/next)](https://www.npmjs.com/package/@defichain/jellyfish-api-jsonrpc/v/next)| -|`@defichain/jellyfish-json`|[![npm](https://img.shields.io/npm/v/@defichain/jellyfish-json)](https://www.npmjs.com/package/@defichain/jellyfish-json/v/latest)|[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish-json/next)](https://www.npmjs.com/package/@defichain/jellyfish-json/v/next)| -|`@defichain/jellyfish-network`|[![npm](https://img.shields.io/npm/v/@defichain/jellyfish-network)](https://www.npmjs.com/package/@defichain/jellyfish-network/v/latest)|[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish-network/next)](https://www.npmjs.com/package/@defichain/jellyfish-network/v/next)| -|`@defichain/testcontainers`|[![npm](https://img.shields.io/npm/v/@defichain/testcontainers)](https://www.npmjs.com/package/@defichain/testcontainers/v/latest)|[![npm@next](https://img.shields.io/npm/v/@defichain/testcontainers/next)](https://www.npmjs.com/package/@defichain/testcontainers/v/next)| +### Packages + +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) + +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. +`@defichain/jellyfish-json` | Allows parsing of JSON with 'lossless', 'bignumber' and 'number' numeric precision. +`@defichain/jellyfish-network` | Contains DeFi blockchain various network configuration for main, net and regtest. +`@defichain/testcontainers` | Provides a lightweight, throw away instances for DeFiD node provisioned automatically in a Docker container. ## Developing & Contributing -Thanks for contributing, here is our [contributing guidelines](CONTRIBUTING.md). +Thanks for contributing, appreciate all the help we can get. Feel free to make a pull-request, we will guide you along +the way to make it mergeable. Here are some of our documented [contributing guidelines](CONTRIBUTING.md). We use `npm 7` for this project, it's required to set up [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces). diff --git a/packages/jellyfish-api-core/package.json b/packages/jellyfish-api-core/package.json index ca00cd8891..a679dc623d 100644 --- a/packages/jellyfish-api-core/package.json +++ b/packages/jellyfish-api-core/package.json @@ -2,10 +2,11 @@ "private": false, "name": "@defichain/jellyfish-api-core", "version": "0.0.0", - "description": "A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin", + "description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin", "keywords": [ "DeFiChain", - "JavaScript", + "DeFi", + "Blockchain", "API", "Bitcoin" ], diff --git a/packages/jellyfish-api-jsonrpc/package.json b/packages/jellyfish-api-jsonrpc/package.json index 71e2e42e41..f5aee5a6b4 100644 --- a/packages/jellyfish-api-jsonrpc/package.json +++ b/packages/jellyfish-api-jsonrpc/package.json @@ -2,10 +2,11 @@ "private": false, "name": "@defichain/jellyfish-api-jsonrpc", "version": "0.0.0", - "description": "A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin", + "description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin", "keywords": [ "DeFiChain", - "JavaScript", + "DeFi", + "Blockchain", "API", "Bitcoin" ], diff --git a/packages/jellyfish-json/package.json b/packages/jellyfish-json/package.json index 8d5e966acd..9cd6d9b386 100644 --- a/packages/jellyfish-json/package.json +++ b/packages/jellyfish-json/package.json @@ -2,10 +2,11 @@ "private": false, "name": "@defichain/jellyfish-json", "version": "0.0.0", - "description": "A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin", + "description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin", "keywords": [ "DeFiChain", - "JavaScript", + "DeFi", + "Blockchain", "API", "Bitcoin" ], diff --git a/packages/jellyfish-network/package.json b/packages/jellyfish-network/package.json index 1705181c2e..ed639b8d0a 100644 --- a/packages/jellyfish-network/package.json +++ b/packages/jellyfish-network/package.json @@ -2,10 +2,11 @@ "private": false, "name": "@defichain/jellyfish-network", "version": "0.0.0", - "description": "A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin", + "description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin", "keywords": [ "DeFiChain", - "JavaScript", + "DeFi", + "Blockchain", "API", "Bitcoin" ], diff --git a/packages/jellyfish/package.json b/packages/jellyfish/package.json index ae80a94914..df16278646 100644 --- a/packages/jellyfish/package.json +++ b/packages/jellyfish/package.json @@ -2,10 +2,11 @@ "private": false, "name": "@defichain/jellyfish", "version": "0.0.0", - "description": "A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin", + "description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin", "keywords": [ "DeFiChain", - "JavaScript", + "DeFi", + "Blockchain", "API", "Bitcoin" ], diff --git a/packages/testcontainers/package.json b/packages/testcontainers/package.json index aded3a7628..03d014ffb3 100644 --- a/packages/testcontainers/package.json +++ b/packages/testcontainers/package.json @@ -2,10 +2,11 @@ "private": false, "name": "@defichain/testcontainers", "version": "0.0.0", - "description": "A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin", + "description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin", "keywords": [ "DeFiChain", - "JavaScript", + "DeFi", + "Blockchain", "API", "Bitcoin" ], diff --git a/website/README.md b/website/README.md index 6a8eba54d4..69a00a16c9 100644 --- a/website/README.md +++ b/website/README.md @@ -1,25 +1,19 @@ # jellyfish/website -> This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. +`/website/*` contains the documentation for jellyfish; built using [Docusaurus 2](https://v2.docusaurus.io/), a modern +static website generator. -## Installation +## Writing documentations -```console -npm i -``` +Following the idea of everything in master is production ready; all pull request should be accompanied by a +documentation change. Hence, the master/main branch should be treated as a release as so are the documentations. -## Local Development +## Local Setup -```console -npm run start -``` - -This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. - -## Build +This command starts a local development server and open up a browser window. Most changes are reflected live without +having to restart the server. ```console -npm run build +npm i +npm run start ``` - -This command generates static content into the `build` directory and can be served using any static contents hosting service. diff --git a/website/docs/introduction.md b/website/docs/introduction.md index d723b25dce..2702c1fae6 100644 --- a/website/docs/introduction.md +++ b/website/docs/introduction.md @@ -5,26 +5,31 @@ sidebar_label: Introduction slug: / --- -A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin. -Consisting of 4 packages with more to be added in the future, the jellyfish project allow DeFiChain developers to build decentralized apps that are modern, easy to use and easy to test. +## What is Jellyfish? -Jellyfish follows a monorepo methodology, all maintained packages are in the same repo and published with the same version tag. +A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized +finance on Bitcoin. Consisting of multiple packages with more to be added in the future, this JS library enable +developers to develop decentralized applications on top of DeFi Blockchain that are modern, easy to use and easy to +test. -## Packages +Written in TypeScript, jellyfish provides first-class citizen support for TypeScript with strongly typed interfaces of +DeFi blockchain rpc exchanges. Built using modern JavaScript approaches, it emphasises a **future-first developer experience** +and backport for compatibility. The protocol-agnostic core enable independent communication protocols, allowing +vendor-agnostic middleware adaptable to any needs. -* `@defichain/jellyfish` bundled usage entrypoint with conventional defaults for 4 bundles: umd, esm, cjs - and d.ts -* `@defichain/jellyfish-api-core` is a protocol agnostic DeFiChain 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. -* `@defichain/testcontainers` provides a lightweight, throw away instances for DeFiD node provisioned automatically in - Docker container. +### Monorepo & packages -### Latest releases +As with all modern JavaScript projects, jellyfish follows a monorepo structure with its concerns separated. All packages +maintained in this repo are published with the same version tag and follows the `DeFiCh/ain` releases. -|package|@latest|@next| -|---|---|---| -|`@defichain/jellyfish`|[![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)| -|`@defichain/jellyfish-api-core`|[![npm](https://img.shields.io/npm/v/@defichain/jellyfish-api-core)](https://www.npmjs.com/package/@defichain/jellyfish-api-core/v/latest)|[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish-api-core/next)](https://www.npmjs.com/package/@defichain/jellyfish-api-core/v/next)| -|`@defichain/jellyfish-api-jsonrpc`|[![npm](https://img.shields.io/npm/v/@defichain/jellyfish-api-jsonrpc)](https://www.npmjs.com/package/@defichain/jellyfish-api-jsonrpc/v/latest)|[![npm@next](https://img.shields.io/npm/v/@defichain/jellyfish-api-jsonrpc/next)](https://www.npmjs.com/package/@defichain/jellyfish-api-jsonrpc/v/next)| -|`@defichain/testcontainers`|[![npm](https://img.shields.io/npm/v/@defichain/testcontainers)](https://www.npmjs.com/package/@defichain/testcontainers/v/latest)|[![npm@next](https://img.shields.io/npm/v/@defichain/testcontainers/next)](https://www.npmjs.com/package/@defichain/testcontainers/v/next)| +[![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) + +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. +`@defichain/jellyfish-json` | Allows parsing of JSON with 'lossless', 'bignumber' and 'number' numeric precision. +`@defichain/jellyfish-network` | Contains DeFi blockchain various network configuration for main, net and regtest. +`@defichain/testcontainers` | Provides a lightweight, throw away instances for DeFiD node provisioned automatically in a Docker container. diff --git a/website/docs/jellyfish/api/mining.md b/website/docs/jellyfish/api/mining.md index d57a1092e1..1a9c96a0dd 100644 --- a/website/docs/jellyfish/api/mining.md +++ b/website/docs/jellyfish/api/mining.md @@ -5,21 +5,37 @@ sidebar_label: Mining API slug: /jellyfish/api/mining --- +```js +import {Client} from '@defichain/jellyfish' +const client = new Client() + +// Using client.mining. +const something = await client.mining.method() +``` + + ## getNetworkHashPerSecond Returns the estimated network hashes per second. - `nblocks` to estimate since last difficulty change. - `height` to estimate at the time of the given height. -```ts -getNetworkHashPerSecond (nblocks: number = 120, height: number = -1): Promise +```ts title="client.mining.getNetworkHashPerSecond()" +interface mining { + getNetworkHashPerSecond (nblocks: number = 120, + height: number = -1): Promise +} ``` ## getMintingInfo Get minting-related information. -```ts +```ts title="client.mining.getMintingInfo()" +interface mining { + getMintingInfo (): Promise +} + interface MintingInfo { blocks: number currentblockweight?: number @@ -36,6 +52,4 @@ interface MintingInfo { chain: 'main' | 'test' | 'regtest' | string warnings: string } - -getMintingInfo (): Promise ``` diff --git a/website/docs/jellyfish/api/wallet.md b/website/docs/jellyfish/api/wallet.md index 536458dff7..b4a06ffdfe 100644 --- a/website/docs/jellyfish/api/wallet.md +++ b/website/docs/jellyfish/api/wallet.md @@ -5,6 +5,14 @@ sidebar_label: Wallet API slug: /jellyfish/api/wallet --- +```js +import {Client} from '@defichain/jellyfish' +const client = new Client() + +// Using client.wallet. +const something = await client.wallet.method() +``` + ## getBalance Returns the total available balance in wallet. @@ -12,6 +20,9 @@ Returns the total available balance in wallet. - `includeWatchOnly` for watch-only wallets, otherwise - Include balance in watch-only addresses (see `importAddress`) -```ts -getBalance (minimumConfirmation: number = 0, includeWatchOnly: boolean = false): Promise +```ts title="client.wallet.getBalance()" +interface wallet { + getBalance (minimumConfirmation: number = 0, + includeWatchOnly: boolean = false): Promise +} ``` diff --git a/website/docs/jellyfish/design.md b/website/docs/jellyfish/design.md index ab2a7b858a..0f667ed4b4 100644 --- a/website/docs/jellyfish/design.md +++ b/website/docs/jellyfish/design.md @@ -1,7 +1,7 @@ --- id: design -title: Design -sidebar_label: Design +title: Jellyfish design +sidebar_label: Jellyfish design slug: /jellyfish/design --- @@ -47,7 +47,7 @@ it('lost precision converting DFI 😥', () => { }); ``` -### `JellyfishJSON` +### JellyfishJSON **api-core** implements `JellyfishJSON` that allows parsing of JSON with `'lossless'`, `'bignumber'` and `'number'` numeric precision. @@ -62,7 +62,7 @@ As not all number parsed are significant in all context, (e.g. `mining.getMintin users to use the `number` for non precision sensitive operation (e.g. `networkhashps`) and BigNumber for precision sensitive operations. -### `ApiClient` +### ApiClient As jellyfish is written in TypeScript, all RPC exchanges with a node are typed. BigNumber precision is used for all wallet or transaction related operations. While IEEE-754 number is used for all other arbitrary operations. diff --git a/website/docs/jellyfish/overview.md b/website/docs/jellyfish/overview.md deleted file mode 100644 index c515dfb42b..0000000000 --- a/website/docs/jellyfish/overview.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: overview -title: Overview -sidebar_label: Overview -slug: /jellyfish ---- - -## What is jellyfish? - -Jellyfish is a JS library written to enable developers to develop decentralized applications on top of DeFiChain. As -with all modern JavaScript projects, jellyfish follows a monorepo structure with its concerns separated. All packages -maintained in this repo are published with the same version tag and follows the `DeFiCh/ain` releases. - -- **jellyfish** is the entrypoint for most dApps developer as it bundles and create 4 types of JavaScript modules: - cjs, esm, umd and d.ts. -- **jellyfish-api-core** represents a protocol agnostic interface of DeFiChain client with APIs separated into their - category. -- **jellyfish-api-jsonrpc** implements the api-core with the JSON-RPC 1.0 specification. - -Written in TypeScript, jellyfish provides first-class citizen support for TypeScript with strongly typed interfaces of -DeFiChain rpc exchanges. Built using modern JavaScript approaches, it emphasises a **future-first developer experience** -and backport for compatibility. The protocol-agnostic core enable independent communication protocols, allowing -vendor-agnostic middleware adaptable to any needs. diff --git a/website/docs/jellyfish/usage.md b/website/docs/jellyfish/usage.md index b939ac5ed4..9f0ff27383 100644 --- a/website/docs/jellyfish/usage.md +++ b/website/docs/jellyfish/usage.md @@ -1,11 +1,11 @@ --- id: usage -title: Usage -sidebar_label: Usage +title: Jellyfish usage +sidebar_label: Jellyfish usage slug: /jellyfish/usage --- -## `@defichain/jellyfish` +## @defichain/jellyfish ### Installation diff --git a/website/docs/testcontainers/jellyfish.md b/website/docs/testcontainers/jellyfish.md new file mode 100644 index 0000000000..4f34f46188 --- /dev/null +++ b/website/docs/testcontainers/jellyfish.md @@ -0,0 +1,21 @@ +--- +id: jellyfish +title: Testcontainers + Jellyfish +sidebar_label: Testcontainers + Jellyfish +slug: /testcontainers/jellyfish +--- + +## Using with Jellyfish + +You can use jellyfish with testcontainers. +Instead of connecting to a mainnet node, you can spin up regtest containers with `@defichain/testcontainers`. +This allows you to run parallelizable and reproducible unit test with the strongly-typed jellyfish APIs. + +```js +import { MasterNodeRegTestContainer } from '@defichain/testcontainers' +import { Client, HttpProvider } from '@defichain/jellyfish' +const container = new RegTestContainer() + +const rpcURL = await container.getCachedRpcUrl() +const client = new Client(new HttpProvider(rpcURL)) +``` diff --git a/website/docs/testcontainers/overview.md b/website/docs/testcontainers/overview.md index 805b1646a0..3609465ca5 100644 --- a/website/docs/testcontainers/overview.md +++ b/website/docs/testcontainers/overview.md @@ -1,7 +1,7 @@ --- id: overview title: Overview -sidebar_label: What is testcontainers? +sidebar_label: Overview slug: /testcontainers --- diff --git a/website/docs/testcontainers/usage.md b/website/docs/testcontainers/usage.md index 3df60c4fed..ad6adec070 100644 --- a/website/docs/testcontainers/usage.md +++ b/website/docs/testcontainers/usage.md @@ -1,7 +1,7 @@ --- id: usage -title: Using @defichain/testcontainers -sidebar_label: Using testcontainers +title: Testcontainers usage +sidebar_label: Testcontainers usage slug: /testcontainers/usage --- @@ -19,10 +19,10 @@ npm i -D @defichain/testcontainers * `MasterNodeRegTestContainer` provides a pre-configured masternode with coins auto minting. * You can use your favourite test runner and set it up as part of the test lifecycle. -### `RegTestContainer` +### RegTest -```js -import { RegTestContainer } from '@defichain/testcontainers' +```ts +import {RegTestContainer} from '@defichain/testcontainers' describe('reg test container', () => { const container = new RegTestContainer() @@ -44,10 +44,14 @@ describe('reg test container', () => { }) ``` -### `MasterNodeRegTestContainer` +### MasterNodeRegTest + +With `MasterNodeRegTestContainer`, you can run a preconfigured masternode with staking enabled to auto mint every +second. Additionally, you can use `waitForWalletCoinbaseMaturity` to wait for coinbase maturity for your minted coins +to be spendable. ```js -import { MasterNodeRegTestContainer } from '@defichain/testcontainers' +import {MasterNodeRegTestContainer} from '@defichain/testcontainers' import waitForExpect from "wait-for-expect"; describe('master node pos minting', () => { @@ -78,9 +82,9 @@ describe('master node pos minting', () => { }) ``` -## Convenience Methods +## Convenience methods -### `getCachedRpcUrl()` +### getCachedRpcUrl ```js const container = new RegTestContainer() @@ -89,13 +93,13 @@ const container = new RegTestContainer() const rpcURL = await container.getCachedRpcUrl() ``` -### `call('method', [])` +### call('method', []) ```js const container = new RegTestContainer() // raw calls -const { blocks } = await container.call('getmintinginfo') +const {blocks} = await container.call('getmintinginfo') const address = await container.call('getnewaddress', ['label', 'legacy']) // basic included methods @@ -103,14 +107,3 @@ const count = await container.getBlockCount() const info = await container.getMintingInfo() const newAddress = await container.getNewAddress() ``` - -## Using with Jellyfish - -```js -import { MasterNodeRegTestContainer } from '@defichain/testcontainers' -import { Client, HttpProvider } from '@defichain/jellyfish' -const container = new RegTestContainer() - -const rpcURL = await container.getCachedRpcUrl() -const client = new Client(new HttpProvider(rpcURL)) -``` diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index e0ca8a633e..ed0638c056 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -1,7 +1,7 @@ /** @type {import('@docusaurus/types').DocusaurusConfig} */ module.exports = { title: 'DeFi Jellyfish', - tagline: 'A collection of TypeScript + JavaScript tools and libraries for DeFiChain developers to build decentralized finance on Bitcoin', + tagline: 'A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin', url: 'https://jellyfish.defichain.io', baseUrl: '/', onBrokenLinks: 'throw', @@ -10,6 +10,22 @@ module.exports = { organizationName: 'DeFiChain', projectName: 'Jellyfish', themeConfig: { + prism: { + theme: require('prism-react-renderer/themes/github'), + darkTheme: require('prism-react-renderer/themes/dracula') + }, + colorMode: { + defaultMode: 'light', + switchConfig: { + darkIcon: '🌙', + lightIcon: '💡' + }, + respectPrefersColorScheme: true + }, + announcementBar: { + id: 'wip-pre-beta', + content: '@defichain/jellyfish is currently being actively developed, pre-alpha.' + }, navbar: { title: 'DeFi Jellyfish', logo: { @@ -18,7 +34,7 @@ module.exports = { }, items: [ { - to: 'docs/jellyfish', + to: 'docs', activeBasePath: 'docs/jellyfish', label: 'Jellyfish', position: 'left' @@ -76,9 +92,38 @@ module.exports = { href: 'https://github.com/DeFiCh' } ] + }, + { + title: 'Legal', + items: [ + { + label: 'Privacy', + to: 'https://defichain.com/privacy-policy/' + }, + { + label: 'MIT License', + to: 'https://github.com/DeFiCh/jellyfish/blob/main/LICENSE' + } + ] + }, + { + items: [ + { + html: ` + + Deploys by Netlify + + ` + } + ] } ], - copyright: `Copyright © ${new Date().getFullYear()} DeFiChain Foundation & Jellyfish Contributors` + logo: { + alt: 'DeFi Blockchain', + src: 'img/defi-blockchain.png', + href: 'https://defichain.com' + }, + copyright: `Copyright © ${new Date().getFullYear()} DeFiChain Foundation & DeFi Jellyfish Contributors` } }, presets: [ diff --git a/website/sidebars.js b/website/sidebars.js index 925eb7066b..8207df783c 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -1,16 +1,8 @@ module.exports = { - sidebar: [ + docs: [ 'introduction', - { - type: 'category', - label: 'Jellyfish', - collapsed: false, - items: [ - 'jellyfish/overview', - 'jellyfish/design', - 'jellyfish/usage' - ] - }, + 'jellyfish/design', + 'jellyfish/usage', { type: 'category', label: 'DeFi APIs', @@ -19,15 +11,11 @@ module.exports = { 'jellyfish/api/mining', 'jellyfish/api/wallet' ] - }, - { - type: 'category', - label: 'Testcontainers', - collapsed: false, - items: [ - 'testcontainers/overview', - 'testcontainers/usage' - ] } + ], + testcontainers: [ + 'testcontainers/overview', + 'testcontainers/usage', + 'testcontainers/jellyfish' ] } diff --git a/website/src/css/custom.css b/website/src/css/custom.css index 10e2d00862..7d91a06494 100644 --- a/website/src/css/custom.css +++ b/website/src/css/custom.css @@ -17,7 +17,7 @@ } .docusaurus-highlight-code-line { - background-color: rgb(72, 77, 91); + background-color: rgba(0, 0, 0, 0.1); display: block; margin: 0 calc(-1 * var(--ifm-pre-padding)); padding: 0 var(--ifm-pre-padding); diff --git a/website/src/pages/index.js b/website/src/pages/index.js index 30368f42a1..0d8fe2fe4d 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -65,7 +65,7 @@ export default function Home () { const { siteConfig = {} } = context return ( diff --git a/website/static/img/defi-blockchain.png b/website/static/img/defi-blockchain.png new file mode 100644 index 0000000000..95032d9a7c Binary files /dev/null and b/website/static/img/defi-blockchain.png differ