import Big, { BigSource } from "big.js"; import { Bitcoin, Currency, ExchangeRate, MonetaryAmount } from "@interlay/monetary-js"; import { u32 } from "@polkadot/types"; import { InterbtcPrimitivesOracleKey } from "@polkadot/types/lookup"; import { GovernanceCurrency, CurrencyExt, ForeignAsset, CollateralCurrencyExt, LendToken, CurrencyIdentifier, StandardLpToken, StableLpToken } from "../types/currency"; import { ApiPromise } from "@polkadot/api"; import { InterbtcPrimitivesCurrencyId, InterbtcPrimitivesTokenSymbol } from "../interfaces"; export declare const ATOMIC_UNIT = 0; export declare function computeLazyDistribution(stake: Big, perToken: Big, tally: Big): Big; export declare function atomicToBaseAmount(atomicAmount: BigSource, currency: Currency): Big; export declare function newMonetaryAmount(amount: BigSource, currency: CurrencyT, base?: boolean): MonetaryAmount; export declare function newCollateralBTCExchangeRate(rate: Big, counterCurrency: Currency, useBaseUnits?: boolean): ExchangeRate; export declare function createFeeEstimationOracleKey(api: ApiPromise): InterbtcPrimitivesOracleKey; export declare function createExchangeRateOracleKey(api: ApiPromise, collateralCurrency: CurrencyExt): InterbtcPrimitivesOracleKey; export declare function toVoting(governanceCurrency: GovernanceCurrency): Currency; /** * Get all collateral currencies (tokens as well as foreign assets). * * Will return all collateral currencies for which the parachain has a system collateral ceiling value * greater than zero. * @param api ApiPromise instance to query the parachain * @returns An array of collateral currencies. */ export declare function getCollateralCurrencies(api: ApiPromise): Promise>; export declare function isForeignAsset(currencyExt: CurrencyExt): currencyExt is ForeignAsset; export declare function isLendToken(currencyExt: CurrencyExt): currencyExt is LendToken; export declare function isStandardLpToken(currencyExt: CurrencyExt): currencyExt is StandardLpToken; export declare function isStableLpToken(currencyExt: CurrencyExt): currencyExt is StableLpToken; export declare function isCurrency(currencyExt: CurrencyExt): currencyExt is Currency; export declare function isCurrencyEqual(currency: CurrencyExt, otherCurrency: CurrencyExt): boolean; export declare function getCurrencyIdentifier(currency: CurrencyExt): CurrencyIdentifier; export declare function currencyIdToMonetaryCurrency(api: ApiPromise, currencyId: InterbtcPrimitivesCurrencyId): Promise; /** * A method that will only try to find a hard-coded currencies. * Only for use when we are certain the currency is not a foreign asset. * @param tokenSymbol the InterbtcPrimitivesTokenSymbol to look up */ export declare function tokenSymbolToCurrency(tokenSymbol: InterbtcPrimitivesTokenSymbol): Currency; /** * Get foreign asset by its id. * @param id The id of the foreign asset. * @returns The foreign asset. */ export declare function getForeignAssetFromId(api: ApiPromise, id: number | u32): Promise; /** * Get underlying currency of lend token id, * * @param lendTokenId Currency id of the lend token to get currency from * @returns Underlying CurrencyExt for provided lend token */ export declare function getUnderlyingCurrencyFromLendTokenId(api: ApiPromise, lendTokenId: InterbtcPrimitivesCurrencyId): Promise; /** * Get standard LP token currency lib type from currencyId primitive. * * @param currencyId Id of standard LP token. * @returns {StandardLpToken} Lib type currency object for standard LP token. */ export declare function getStandardLpTokenFromCurrencyId(api: ApiPromise, currencyId: InterbtcPrimitivesCurrencyId): Promise; /** * Get stable LP token currency lib type from currencyId primitive. * * @param currencyId Id of stable LP token. * @returns {StableLpToken} Lib type currency object for stable LP token. */ export declare function getStableLpTokenFromCurrencyId(api: ApiPromise, currencyId: InterbtcPrimitivesCurrencyId): Promise;