UNPKG

@crypto-dex-sdk/parachains-bifrost

Version:

Zenlink Parachains Impl for Bifrost

61 lines (54 loc) 2.7 kB
import { ZenlinkProtocolPrimitivesAssetId } from '@crypto-dex-sdk/format'; import { Type } from '@crypto-dex-sdk/currency'; import { Trade } from '@crypto-dex-sdk/amm'; import { Percent } from '@crypto-dex-sdk/math'; import { ApiPromise } from '@polkadot/api'; import { SubmittableExtrinsic } from '@polkadot/api/types'; interface NodePrimitivesCurrency { [currencyId: string]: string | number | [string, number, string, number]; } type PairPrimitivesAssetId = [ZenlinkProtocolPrimitivesAssetId, ZenlinkProtocolPrimitivesAssetId]; declare const PAIR_ADDRESSES: Record<string, { address: string; account: string; }>; declare const pairAddressToAssets: Record<string, PairPrimitivesAssetId>; declare const NodeCurrencyId: Record<number, string>; declare const NodeCurrencyIdType: Record<string, number>; declare const NodeTokenSymbol: Record<number, string>; declare const NodeTokenSymbolIndex: Record<string, number>; declare const TokenType2: number[]; declare function parseSymbolOrIndexToIndex(symbolIndex: string | number): number; declare function parseNodePrimitivesCurrency(asset: ZenlinkProtocolPrimitivesAssetId): NodePrimitivesCurrency; declare function addressToNodeCurrency(address: string): NodePrimitivesCurrency; declare function nodePrimitiveCurrencyToZenlinkProtocolPrimitivesAssetId(currency: NodePrimitivesCurrency, chainId: number): ZenlinkProtocolPrimitivesAssetId; declare function isNativeCurrency(currency: Type): boolean; interface TradeOptions { api: ApiPromise; /** * How much the execution price is allowed to move unfavorably from the trade execution price. */ allowedSlippage: Percent; /** * The account that should receive the output of the swap. */ recipient: string; } interface TradeOptionsDeadline extends TradeOptions { /** * When the transaction expires. * This is an atlernate to specifying the ttl, for when you do not want to use local time. */ deadline: number; } interface SwapParameters { extrinsic: SubmittableExtrinsic<'promise'>[] | null; } declare abstract class SwapRouter { /** * Cannot be constructed. */ private constructor(); static swapCallParameters(trade: Trade, options: TradeOptionsDeadline): SwapParameters; } export { NodeCurrencyId, NodeCurrencyIdType, type NodePrimitivesCurrency, NodeTokenSymbol, NodeTokenSymbolIndex, PAIR_ADDRESSES, type PairPrimitivesAssetId, type SwapParameters, SwapRouter, TokenType2, type TradeOptions, type TradeOptionsDeadline, addressToNodeCurrency, isNativeCurrency, nodePrimitiveCurrencyToZenlinkProtocolPrimitivesAssetId, pairAddressToAssets, parseNodePrimitivesCurrency, parseSymbolOrIndexToIndex };