1.0.0 • Published 3 years ago

thorchain-multichain-sdk v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Multichain SDK

License ts code style: prettier

Installation

yarn add @thorchain/multichain-sdk

Usage

import { Client } from '@thorchain/multichain-sdk'

const client = new Client({ network: 'mainnet', phrase: 'xxx' })

// get binance client
getBncClient(): BncClient;

// get midgard v1 client
getMidgard(): MidgardV1;

// get wallet client
getWallet(): Wallet;

// transfer assets on binance chain
transfer(tx: TxParams): Promise<TxHash>;

// multisend assets on binance chain
multiSend(params: MultiSendParams): Promise<TxHash>;

// swap assets
swap(swap: Swap): Promise<TxHash>;

// add liquidity
addLiquidity(params: AddLiquidityParams): Promise<TxHash>;

// withdraw from liquidity
withdraw(params: WithdrawParams): Promise<TxHash>;

Entities

Amount: represent asset/base amount, support calculations, compare, format

Asset: represent any asset in the chain, support sort, format, price, currency

AssetAmount: represent amount of asset, support calculations, unitPrice, totalPrice

Percent: represent percentage of asset

Pool: represent a Pool Information

Price: represent a price of asset, support unit price, amount price, inverted price

Swap: represent all data needed for swap, provide everything for calculations, validation

Liquidity: represent pool liquidity and provide liquidity calculations

Memo: represent a memo and provide get memo utils

TODO

Write unit test