How to Use
Installation
yarn add @xchainjs/xchain-utilThe following peer dependencies have to be installed into your project. These are not included in @xchainjs/xchain-util.
yarn add bignumber.jsDevelopment
Build
yarn buildTests
yarn testExample for Asset Helpers
Imports
import {
assetAmount,
baseAmount,
isAssetAmount,
isBaseAmount,
baseToAsset,
assetToBase,
formatAssetAmount,
formatBaseAsAssetAmount,
formatAssetAmountCurrency,
} from '@xchainjs/xchain-util'Convert Between Asset and Base Vice Versa
Use the helper to convert between base amounts and Assets. The Decimal represents the denomination of the asset. i.e BTC_DECIMAL = 8 These are normally a constant exported by the client.
Format Helpers for Assets
Format Assets from and to baseAmount Retrieve symbols using assets
BigNumber Helper Functions
Chain Helper
Async Helper
Last updated