README
@defichain/jellyfish
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.
Installation
Node
npm install @defichain/jellyfish
Browser
<!-- TODO(fuxingloh): WIP -->
<script src="https://unpkg.com/@defichain/jellyfish@latest/dist/jellyfish.umd.js"/>
Getting Started
CJS for Node
const jellyfish = require('@defichain/jellyfish')
const client = new jellyfish.Client('http://localhost:8554', {
timeout: 20000
})
client.mining.getMintingInfo().then((info) => {
console.log(info)
})
ES6 Modules
import {Client} from '@defichain/jellyfish'
const client = new Client('http://localhost:8554')
const info = await client.mining.getMintingInfo()
Providers
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)
Documentation & Community
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
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-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-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/testcontainers |
Provides a lightweight, throw away instances for DeFiD node provisioned automatically in a Docker container. |
Developing & Contributing
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.
We use npm 7
for this project, it's required to set
up npm workspaces.
npm install
Testing
jest.config.js
is set up at the root project level as well as at each sub module. You can run jest at root to test all
modules or individually at each sub module. 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.
Coverage is collected at each pull request to main with codecov
; more testing 🚀 less 🐛 = 😎
jest
Publishing
"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
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.
Security issues
If you discover a security vulnerability in
@defichain/jellyfish
, please see submit it privately.
License & Disclaimer
By using @defichain/jellyfish
(this repo), you (the user) agree to be bound by the terms of this license.