A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin.
π§ Work in progress.
npm install @defichain/jellyfish
<!-- TODO(fuxingloh): WIP -->
<script src="https://unpkg.com/@defichain/jellyfish@latest/dist/jellyfish.umd.js"/>
const jellyfish = require('@defichain/jellyfish')
const client = new jellyfish.Client('http://localhost:8554', {
timeout: 20000
})
client.mining.getMintingInfo().then((info) => {
console.log(info)
})
import {Client} from '@defichain/jellyfish'
const client = new Client('http://localhost:8554')
const info = await client.mining.getMintingInfo()
import {Client, HttpProvider, OceanProvider} from '@defichain/jellyfish'
const options = {} // optional
// TODO(fuxingloh): WIP, more coventional default will be introduced with convenience
const localClient = new Client(new HttpProvider('http://localhost:8554'), options)
const oceanClient = new Client(new OceanProvider(), options)
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
DeFi Jellyfish follows a monorepo methodology, all maintained packages are in the same repo and published with the same version tag.
Package | Description |
---|---|
@defichain/jellyfish |
Library bundled usage entrypoint with conventional defaults for 4 bundles: umd, esm, cjs and d.ts |
@defichain/jellyfish-address |
Provide address builder, parser, validator utility library for DeFi Blockchain. |
@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 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 composer for the DeFi Blockchain. |
@defichain/jellyfish-transaction-builder |
Provides a high-high level abstraction for constructing transaction ready to be broadcast for DeFi Blockchain. |
@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/testcontainers |
Provides a lightweight, throw away instances for DeFiD node provisioned automatically in a Docker container. |
@defichain/testing |
Provides rich test fixture setup functions for effective and effortless testing. |
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 merge-able. Here are some of our documented contributing guidelines.
You need node v14
, and npm v7
for this project, it's required to set
up npm workspaces.
npm install
jest.config.js
is set up at the root project level as well as at each submodule. You can run jest at root to test all
modules or individually at each submodule. By default, only regtest chain are used for normal testing. If you use
IntelliJ IDEA, you can right-click any file to test it individually and have it reported to the IDE.
Docker is required to run the tests as @defichain/testcontainers
will automatically spin
up regtest
instances for testing. The number of containers it will spin up concurrently is dependent on your
jest --maxConcurrency
count. Test are known to be flaky due to the usage of multiple Docker containers for test
concurrency. Although testcontainers cleans up after itself, there are cases where the tests fail exceptionally you
might need to occasionally: docker system prune --volumes
.
Coverage is collected at each pull request to main with codecov
; more testing π less π = π
jest
"version": "0.0.0"
is used because publishing will be done automatically
by GitHub releases with connected workflows. On
release types: [ published, prereleased ]
, GitHub Action will automatically build all packages in this repo and
publish it into npm.
- release are tagged as
@latest
- prerelease are tagged as
@next
(please use this cautiously)
IntelliJ IDEA is the IDE of choice for writing and maintaining this library. IntelliJ's files are included for convenience with basic toolchain setup but use of IntelliJ is totally optional.
If you discover a security vulnerability in
@defichain/jellyfish
, please see submit it privately.
By using @defichain/jellyfish
(this repo), you (the user) agree to be bound by the terms of this license.