benzumbrunn / jellyfish

DeFiChain SDK. A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CI codecov Maintainability TS-Standard npm

@defichain/jellyfish

A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin.

🚧 Work in progress.

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

Netlify Status

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

DeFi Jellyfish follows a monorepo methodology, all maintained packages are in the same repo and published with the same version tag.

npm npm@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 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/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.

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 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

Testing

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

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.

FOSSA Status

About

DeFiChain SDK. A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin.

License:MIT License


Languages

Language:TypeScript 98.0%Language:JavaScript 1.8%Language:CSS 0.2%Language:Shell 0.0%