@acala-network/subql-utils 中文文档教程
@acala-subql/utils
支持一些有用的功能
Token
- isTokenEqual
/**
* @name isTokenEqual
* @param token1 {any}
* @param token2 {any}
* @return boolean
**/
const isEqual = isTokenEqual('KAR', 'KUSD')
- getTokenName
/**
* @name getTokenName
* @descriptions get string token name, { LiquidCrowdloan: 13 } will be lc://13
* @param token {any}
* @return string
**/
const name = getTokenName(token)
- getTokenDecimals
/**
* @name getTokenDecimals
* @descriptions get token decimals support Token, DexShare, ForeignAssets, LiquidCrowdloanToken
* @param api {[ApiPromise,ApiAt]}
* @param token {any}
* @return number
**/
const decimals = await getTokenDecimals(api, token)
Date
- getEndOfDay
/**
* @name getEndOfDay
* @descriptions get end date of params
* @param date {Date}
* @return Date
**/
const endOfDay = getEndOfDay(date)
- getStartOfDay
/**
* @name getStartOfDay
* @descriptions get start date of params
* @param date {Date}
* @return Date
**/
const startOfDay = getStartOfDay(date)
- getEndOfHour
/**
* @name getEndOfHour
* @descriptions get end hour date of params
* @param date {Date}
* @return Date
**/
const endOfHour = getEndOfHour(date)
- getStartOfHour
/**
* @name getStartOfHour
* @descriptions get end hour date of params
* @param date {Date}
* @return Date
**/
const startOfHour = getStartOfHour(date)
Price
- getOraclePrice
/**
* @name queryPriceFromOracle
* @descriptions get price form oracle, support normal oracle token, liquid token, liquidcrowdloan token
* @param api {[ApiPromise,ApiAt]}
* @params block {SubstrateBlock}
* @params token {string | CurrencyId | Token}
* @return FixedPointNumber (include decimals information)
**/
const price = await queryPriceFromOracle(api, block, token)
@acala-subql/utils
support some helpful functions
Token
- isTokenEqual
/**
* @name isTokenEqual
* @param token1 {any}
* @param token2 {any}
* @return boolean
**/
const isEqual = isTokenEqual('KAR', 'KUSD')
- getTokenName
/**
* @name getTokenName
* @descriptions get string token name, { LiquidCrowdloan: 13 } will be lc://13
* @param token {any}
* @return string
**/
const name = getTokenName(token)
- getTokenDecimals
/**
* @name getTokenDecimals
* @descriptions get token decimals support Token, DexShare, ForeignAssets, LiquidCrowdloanToken
* @param api {[ApiPromise,ApiAt]}
* @param token {any}
* @return number
**/
const decimals = await getTokenDecimals(api, token)
Date
- getEndOfDay
/**
* @name getEndOfDay
* @descriptions get end date of params
* @param date {Date}
* @return Date
**/
const endOfDay = getEndOfDay(date)
- getStartOfDay
/**
* @name getStartOfDay
* @descriptions get start date of params
* @param date {Date}
* @return Date
**/
const startOfDay = getStartOfDay(date)
- getEndOfHour
/**
* @name getEndOfHour
* @descriptions get end hour date of params
* @param date {Date}
* @return Date
**/
const endOfHour = getEndOfHour(date)
- getStartOfHour
/**
* @name getStartOfHour
* @descriptions get end hour date of params
* @param date {Date}
* @return Date
**/
const startOfHour = getStartOfHour(date)
Price
- getOraclePrice
/**
* @name queryPriceFromOracle
* @descriptions get price form oracle, support normal oracle token, liquid token, liquidcrowdloan token
* @param api {[ApiPromise,ApiAt]}
* @params block {SubstrateBlock}
* @params token {string | CurrencyId | Token}
* @return FixedPointNumber (include decimals information)
**/
const price = await queryPriceFromOracle(api, block, token)
更多
你可能也喜欢
- 4square-venues 中文文档教程
- 77-node-logger 中文文档教程
- @0x-jerry/utils 中文文档教程
- @0x-klaytn/asset-swapper 中文文档教程
- @10play/icons 中文文档教程
- @11ty/eleventy-plugin-inclusive-language 中文文档教程
- @11ty/eleventy-plugin-rss 中文文档教程
- @11ty/eleventy-plugin-syntaxhighlight 中文文档教程
- @11ty/eleventy-plugin-vue 中文文档教程
- @128technology/netconfetti 中文文档教程