@interlay/interbtc-api / Exports
Ƭ AccountLiquidity: Object
The liquidity status of an account, based on the value of its collateral and loans.
liquidity
is max(totalCollateralValueAsWrapped - totalBorrowedValueAsWrapped, 0)
, where each
item in the totalCollateralValueAsWrapped
sum is first scaled down by the collateralization
required by that market (e.g 100 satoshi * 0.75 + 150 satoshi * 0.8
, where 0.75
and 0.8
are the collateralization thresholds).shortfall
is very similar to liquidity: max(totalBorrowedValueAsWrapped - totalCollateralValueAsWrapped, 0)
so it is only positive when the total borrowed amount exceeds what the collateral can cover.Name | Type |
---|---|
liquidity |
MonetaryAmount <WrappedCurrency > |
shortfall |
MonetaryAmount <WrappedCurrency > |
Ƭ AssetKey: StorageKey
<[u32
]>
src/parachain/asset-registry.ts:36
Ƭ AssetRegistryMetadataTuple: [StorageKey
<[u32
]>, Option
<OrmlTraitsAssetRegistryAssetMetadata
>]
src/parachain/asset-registry.ts:38
Ƭ BitcoinNetwork: "mainnet"
| "testnet"
| "regtest"
Ƭ BlockHeader: Object
Name | Type |
---|---|
hashPrevBlock |
HexString |
hash_ |
HexString |
merkleRoot |
HexString |
nonce |
number |
target |
HexString |
timestamp |
number |
version |
number |
Ƭ CollateralCurrencyExt: CollateralCurrency
| ForeignAsset
| LendToken
Ƭ CollateralIdLiteral: DOT
| KSM
| KINT
| INTR
Ƭ CurrencyExt: Currency
| ForeignAsset
| LendToken
| LpCurrency
Ƭ CurrencyIdentifier: NativeCurrencyIdentifier
| ForeignAssetIdentifier
| LendTokenIdentifier
| StableLpTokenIdentifier
| StandardLpTokenIdentifier
Ƭ ForeignAsset: Currency
& { foreignAsset
: { coingeckoId
: string
; id
: number
} }
Ƭ GovernanceCurrency: typeof GovernanceCurrency
[number
]
Ƭ GovernanceIdLiteral: INTR
| KINT
Ƭ HexString: `0x${string}`
Ƭ IssueLimits: Object
Name | Type |
---|---|
singleVaultMaxIssuable |
MonetaryAmount <WrappedCurrency > |
totalMaxIssuable |
MonetaryAmount <WrappedCurrency > |
Ƭ LendToken: Currency
& { lendToken
: { id
: number
} }
Ƭ LiquidityPool: StandardLiquidityPool
| StableLiquidityPool
| StableLiquidityMetaPool
src/parachain/amm/liquidity-pool/types.ts:6
Ƭ LoanAction: "lend"
| "withdraw"
| "borrow"
| "repay"
Ƭ LpCurrency: StandardLpToken
| StableLpToken
Ƭ MerkleProof: Object
Name | Type |
---|---|
blockHeader |
BlockHeader |
flagBits |
boolean [] |
hashes |
HexString [] |
transactionsCount |
number |
Ƭ MultiPath: MultiPathElement
[]
src/parachain/amm/trade/types.ts:57
Ƭ MultiPathElement: MultiPathElementStandard
| MultiPathElementStable
src/parachain/amm/trade/types.ts:46
Ƭ MultiPathElementStable: MultiPathElementStablePlain
| MultiPathElementStableMeta
src/parachain/amm/trade/types.ts:45
Ƭ Nomination: NominationData
& { type
: Parsed
}
src/parachain/nomination.ts:35
Ƭ NominationData: Object
Name | Type |
---|---|
amount |
MonetaryAmount <Currency > |
nominatorId |
AccountId |
nonce |
number |
vaultId |
InterbtcPrimitivesVaultId |
src/parachain/nomination.ts:27
Ƭ NominationReward: NominationData
src/parachain/nomination.ts:36
Ƭ PHANTOM_DEFAULT: "default"
src/interfaces/default/types.ts:153
Ƭ PooledCurrencies: MonetaryAmount
<CurrencyExt
>[]
Ƭ RawNomination: NominationData
& { type
: Raw
}
src/parachain/nomination.ts:34
Ƭ StableLpToken: Currency
& { stableLpToken
: { poolId
: number
} }
Ƭ StakedBalance: Object
Name | Type |
---|---|
amount |
MonetaryAmount <GovernanceCurrency > |
endBlock |
number |
Ƭ StandardLpToken: Currency
& { lpToken
: { token0
: StandardLpUnderlyingToken
; token1
: StandardLpUnderlyingToken
} }
Ƭ StandardPooledTokenIdentifier: NativeCurrencyIdentifier
| ForeignAssetIdentifier
| StableLpTokenIdentifier
Ƭ SystemCollateralCeilingTuple: [StorageKey
<[InterbtcPrimitivesVaultCurrencyPair
]>, Option
<u128
>]
src/parachain/asset-registry.ts:40
Ƭ TickerToData<T
>: Object
Name |
---|
T |
▪ [ticker: string
]: T
Ƭ Transaction: Object
Name | Type |
---|---|
inputs |
TransactionInput [] |
lockAt |
TransactionLocktime |
outputs |
TransactionOutput [] |
version |
number |
Ƭ TransactionInputSource: "coinbase"
| { fromOutput
: [HexString
, number
] }
Ƭ TransactionLocktime: { time
: number
} | { blockHeight
: number
}
Ƭ TxStatus: Object
Name | Type |
---|---|
blockHash? |
string |
blockHeight? |
number |
confirmations |
number |
confirmed |
boolean |
Ƭ UndercollateralizedPosition: Object
Name | Type |
---|---|
accountId |
AccountId |
borrowPositions |
BorrowPosition [] |
collateralPositions |
CollateralPosition [] |
shortfall |
MonetaryAmount <WrappedCurrency > |
Ƭ UnwrappedAssetRegistryMetadataTuple: [StorageKey
<[u32
]>, OrmlTraitsAssetRegistryAssetMetadata
]
src/parachain/asset-registry.ts:39
Ƭ VotingCurrency: typeof VotingCurrency
[number
]
Ƭ WrappedAmount: typeof WrappedAmount
[number
]
Ƭ WrappedCurrency: typeof WrappedCurrency
[number
]
Ƭ WrappedIdLiteral: INTERBTC
| KBTC
• Const
ACCOUNT_NOT_SET_ERROR_MESSAGE: "cannot sign transaction without setting account"
• Const
ATOMIC_UNIT: 0
• Const
BLOCK_TIME_SECONDS: 12
• Const
DEFAULT_STABLE_CONFIRMATIONS: 6
• Const
FIXEDI128_SCALING_FACTOR: 18
• Const
GovernanceCurrency: Currency
[]
• Const
IGNORED_ERROR_MESSAGES: string
[]
• Const
LOANS_REWARD_INDEX_SCALING_FACTOR: number
• Const
MS_PER_YEAR: Big
• Const
NO_LIQUIDATION_VAULT_FOUND_REJECTION: "No liquidation vault found"
• Const
PERMILL_BASE: 1000000
• Const
SLEEP_TIME_MS: 1000
• Const
STABLE_POOLS_APPROXIMATION_PRECISION: Big
• Const
VotingCurrency: Currency
[]
• Const
WrappedAmount: typeof InterBtcAmount
[]
• Const
WrappedCurrency: Currency
[]
▸ addHexPrefix(str
): string
Ensure the 0x
hex prefix is present
Name | Type |
---|---|
str |
string |
string
▸ addressOrPairAsAccountId(api
, addyOrpair
): AccountId
Name | Type |
---|---|
api |
ApiPromise |
addyOrpair |
AddressOrPair |
AccountId
▸ adjustToThreshold(amount
, threshold
): MonetaryAmount
<CurrencyExt
>
Name | Type |
---|---|
amount |
MonetaryAmount <CurrencyExt > |
threshold |
Big |
MonetaryAmount
<CurrencyExt
>
▸ allocateAmountsToVaults(vaultsWithAvailableAmounts
, amountToAllocate
): Map
<InterbtcPrimitivesVaultId
, MonetaryAmount
<WrappedCurrency
>>
Given a list of vaults with availabilities (e.g. collateral for issue, tokens for redeem) and an amount to allocate, selects one or more vaults to fulfil the request. If the amount cannot be allocated by a single vault, greedily selects the vault with highest available amount and tries again for the remainder. If at leaast one vault can fulfil a request alone, a random one among them is selected.
Name | Type |
---|---|
vaultsWithAvailableAmounts |
Map <InterbtcPrimitivesVaultId , MonetaryAmount <Currency >> |
amountToAllocate |
MonetaryAmount <Currency > |
Map
<InterbtcPrimitivesVaultId
, MonetaryAmount
<WrappedCurrency
>>
▸ atomicToBaseAmount(atomicAmount
, currency
): Big
Name | Type |
---|---|
atomicAmount |
BigSource |
currency |
Currency |
Big
▸ bufferToHexString(buffer
): HexString
Name | Type |
---|---|
buffer |
Buffer |
▸ calculateAnnualizedRewardAmount(amountPerBlock
, blockTimeMs
): Big
Name | Type |
---|---|
amountPerBlock |
Big |
blockTimeMs |
number |
Big
▸ calculateBorrowLimit(totalBorrowedAmount
, totalCollateralThresholdAdjustedAmount
): MonetaryAmount
<CurrencyExt
>
Name | Type |
---|---|
totalBorrowedAmount |
MonetaryAmount <CurrencyExt > |
totalCollateralThresholdAdjustedAmount |
MonetaryAmount <CurrencyExt > |
MonetaryAmount
<CurrencyExt
>
▸ calculateBorrowLimitBtcChangeFactory(loanAssets
, totalBorrowedBtc
, totalCollateralThresholdAdjustedCollateralBtc
): (action
: LoanAction
, amount
: MonetaryAmount
<CurrencyExt
>) => MonetaryAmount
<Currency
>
Name | Type |
---|---|
loanAssets |
TickerToData <LoanAsset > |
totalBorrowedBtc |
MonetaryAmount <Currency > |
totalCollateralThresholdAdjustedCollateralBtc |
MonetaryAmount <Currency > |
fn
▸ (action
, amount
): MonetaryAmount
<Currency
>
Name | Type |
---|---|
action |
LoanAction |
amount |
MonetaryAmount <CurrencyExt > |
MonetaryAmount
<Currency
>
▸ calculateCollateralAmountBtc(action
, currentCollateralAmountBtc
, actionAmountBtc
): MonetaryAmount
<Currency
>
Name | Type |
---|---|
action |
LoanAction |
currentCollateralAmountBtc |
MonetaryAmount <Currency > |
actionAmountBtc |
MonetaryAmount <Currency > |
MonetaryAmount
<Currency
>
▸ calculateLtv(collateralAmount
, borrowedAmount
): Big
Name | Type |
---|---|
collateralAmount |
MonetaryAmount <CurrencyExt > |
borrowedAmount |
MonetaryAmount <CurrencyExt > |
Big
▸ calculateLtvAndThresholdsChangeFactory(loanAssets
, totalBorrowedBtc
, totalCollateralBtc
, totalCollateralThresholdAdjustedCollateralBtc
, totalLiquidationThresholdAdjustedCollateralBtc
): (action
: LoanAction
, amount
: MonetaryAmount
<CurrencyExt
>) => { collateralThresholdWeightedAverage
: Big
; liquidationThresholdWeightedAverage
: Big
; ltv
: Big
}
Name | Type |
---|---|
loanAssets |
TickerToData <LoanAsset > |
totalBorrowedBtc |
MonetaryAmount <Currency > |
totalCollateralBtc |
MonetaryAmount <Currency > |
totalCollateralThresholdAdjustedCollateralBtc |
MonetaryAmount <Currency > |
totalLiquidationThresholdAdjustedCollateralBtc |
MonetaryAmount <Currency > |
fn
▸ (action
, amount
): Object
Name | Type |
---|---|
action |
LoanAction |
amount |
MonetaryAmount <CurrencyExt > |
Object
Name | Type |
---|---|
collateralThresholdWeightedAverage |
Big |
liquidationThresholdWeightedAverage |
Big |
ltv |
Big |
▸ calculateThreshold(collateralAmount
, thresholdAdjustedCollateralAmount
): Big
Name | Type |
---|---|
collateralAmount |
MonetaryAmount <CurrencyExt > |
thresholdAdjustedCollateralAmount |
MonetaryAmount <CurrencyExt > |
Big
▸ calculateTotalBorrowedBtcChange(action
, currentTotalBorrowedBtc
, actionAmountBtc
): MonetaryAmount
<Currency
>
Name | Type |
---|---|
action |
LoanAction |
currentTotalBorrowedBtc |
MonetaryAmount <Currency > |
actionAmountBtc |
MonetaryAmount <Currency > |
MonetaryAmount
<Currency
>
▸ computeLazyDistribution(stake
, perToken
, tally
): Big
Name | Type |
---|---|
stake |
Big |
perToken |
Big |
tally |
Big |
Big
▸ computePriceImpact(path
, inputAmount
, outputAmount
): Big
Name | Type |
---|---|
path |
MultiPath |
inputAmount |
MonetaryAmount <CurrencyExt > |
outputAmount |
MonetaryAmount <CurrencyExt > |
Big
src/parachain/amm/trade/utils.ts:64
▸ convertMoment(moment
): Date
Name | Type |
---|---|
moment |
Moment |
Date
▸ createAPIRegistry(): TypeRegistry
TypeRegistry
▸ createExchangeRateOracleKey(api
, collateralCurrency
): InterbtcPrimitivesOracleKey
Name | Type |
---|---|
api |
ApiPromise |
collateralCurrency |
CurrencyExt |
InterbtcPrimitivesOracleKey
▸ createFeeEstimationOracleKey(api
): InterbtcPrimitivesOracleKey
Name | Type |
---|---|
api |
ApiPromise |
InterbtcPrimitivesOracleKey
▸ createInterBtcApi(endpoint
, network?
, account?
, autoConnect?
): Promise
<InterBtcApi
>
Name | Type | Default value |
---|---|---|
endpoint |
string |
undefined |
network |
BitcoinNetwork |
"mainnet" |
account? |
AddressOrPair |
undefined |
autoConnect? |
number | false |
undefined |
Promise
<InterBtcApi
>
▸ createProvider(endpoint
, autoConnect?
): ProviderInterface
Name | Type |
---|---|
endpoint |
string |
autoConnect? |
number | false |
ProviderInterface
▸ createSubstrateAPI(endpoint
, autoConnect?
, noInitWarn?
): Promise
<ApiPromise
>
Name | Type |
---|---|
endpoint |
string |
autoConnect? |
number | false |
noInitWarn? |
boolean |
Promise
<ApiPromise
>
▸ currencyIdToMonetaryCurrency(api
, currencyId
): Promise
<CurrencyExt
>
Name | Type |
---|---|
api |
ApiPromise |
currencyId |
InterbtcPrimitivesCurrencyId |
Promise
<CurrencyExt
>
▸ decodeBtcAddress(address
, network
): { p2pkh
: string
} | { p2sh
: string
} | { p2wpkhv0
: string
} | { p2wshv0
: string
}
Name | Type |
---|---|
address |
string |
network |
Network |
{ p2pkh
: string
} | { p2sh
: string
} | { p2wpkhv0
: string
} | { p2wshv0
: string
}
▸ decodeBytesAsString(bytes
): string
Convert Bytes to a string. Will remove 0x
prefix if present.
Name | Type | Description |
---|---|---|
bytes |
Bytes |
Bytes to decode |
string
the decoded string
▸ decodeFixedPointType(x
): Big
Name | Type |
---|---|
x |
SignedFixedPoint | UnsignedFixedPoint |
Big
▸ decodeNumberOrHex(value
): Big
Name | Type |
---|---|
value |
NumberOrHex |
Big
▸ decodePermill(amount
, inPercentage?
): Big
Name | Type | Default value |
---|---|---|
amount |
Permill |
undefined |
inPercentage |
boolean |
false |
Big
▸ decodeRpcVaultId(api
, vaultId
): Promise
<InterbtcPrimitivesVaultId
>
Name | Type |
---|---|
api |
ApiPromise |
vaultId |
VaultId |
Promise
<InterbtcPrimitivesVaultId
>
▸ encodeBtcAddress(address
, network
): string
Name | Type |
---|---|
address |
BitcoinAddress |
network |
Network |
string
▸ encodeSwapParamsForStandardAndStablePools(api
, trade
, minimumAmountOut
): Object
Name | Type |
---|---|
api |
ApiPromise |
trade |
Trade |
minimumAmountOut |
MonetaryAmount <CurrencyExt > |
Object
Name | Type |
---|---|
amountIn |
string |
amountOutMin |
string |
path |
({ Stable : { basePoolId : number ; fromCurrency : InterbtcPrimitivesCurrencyId ; mode : string ; poolId : number ; toCurrency : InterbtcPrimitivesCurrencyId } } | { Normal : InterbtcPrimitivesCurrencyId [] })[] |
src/parachain/amm/encoding.ts:25
▸ encodeSwapParamsForStandardPoolsOnly(api
, trade
, minimumAmountOut
): Object
Name | Type |
---|---|
api |
ApiPromise |
trade |
Trade |
minimumAmountOut |
MonetaryAmount <CurrencyExt > |
Object
Name | Type |
---|---|
amountIn |
string |
amountOutMin |
string |
path |
InterbtcPrimitivesCurrencyId [] |
src/parachain/amm/encoding.ts:8
▸ encodeUnsignedFixedPoint(api
, x
): UnsignedFixedPoint
Name | Type |
---|---|
api |
ApiPromise |
x |
Big |
▸ encodeVaultId(api
, id
): Promise
<string
>
Name | Type |
---|---|
api |
ApiPromise |
id |
InterbtcPrimitivesVaultId |
Promise
<string
>
▸ ensureHashEncoded(api
, hash
): H256
Ensure a hash value is an encoded H256
Name | Type | Description |
---|---|---|
api |
ApiPromise |
The polkadot API promise used to encode if necessary |
hash |
string | H256 |
The either H256 or string encoded hash |
H256
▸ filterNonEmptyPools(pools
): LiquidityPool
[]
Name | Type |
---|---|
pools |
LiquidityPool [] |
src/parachain/amm/liquidity-pool/utils.ts:16
▸ findBestTradeRecursively(inputAmount
, outputCurrency
, pairs
, hopLimit
, path?
, initialInputAmount?
): null
| Trade
Recursive function to find best trade path for provided trading pairs, input amount, output currencies and limited amount of hops between pools.
Name | Type | Default value | Description |
---|---|---|---|
inputAmount |
MonetaryAmount <CurrencyExt > |
undefined |
Input currency amount to be exchanged. |
outputCurrency |
CurrencyExt |
undefined |
Output currency to be received. |
pairs |
TradingPair [] |
undefined |
Array of all trading pairs to include in search. |
hopLimit |
number |
undefined |
Maximum number of hops between liquidity pools. |
path |
MultiPath |
[] |
Recursively generated parameter containing current trading path. |
initialInputAmount |
MonetaryAmount <CurrencyExt > |
inputAmount |
Initial input amount. |
null
| Trade
▸ getAPITypes(): RegistryTypes
RegistryTypes
▸ getAllTradingPairs(pools
): TradingPair
[]
Get all trading pairs based on provided pools.
Name | Type |
---|---|
pools |
LiquidityPool [] |
All trading pairs.
src/parachain/amm/liquidity-pool/utils.ts:25
▸ getBitcoinNetwork(network?
): Network
Name | Type | Default value |
---|---|---|
network |
BitcoinNetwork |
"mainnet" |
Network
▸ getCollateralCurrencies(api
): Promise
<CollateralCurrencyExt
[]>
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.
Name | Type | Description |
---|---|---|
api |
ApiPromise |
ApiPromise instance to query the parachain |
Promise
<CollateralCurrencyExt
[]>
An array of collateral currencies.
▸ getCurrencyIdentifier(currency
): CurrencyIdentifier
Name | Type |
---|---|
currency |
CurrencyExt |
▸ getForeignAssetFromId(api
, id
): Promise
<ForeignAsset
>
Get foreign asset by its id.
Name | Type | Description |
---|---|---|
api |
ApiPromise |
- |
id |
number | u32 |
The id of the foreign asset. |
Promise
<ForeignAsset
>
The foreign asset.
▸ getIssueRequestsFromExtrinsicResult(interBtcApi
, result
): Promise
<Issue
[]>
Name | Type |
---|---|
interBtcApi |
InterBtcApi |
result |
ISubmittableResult |
Promise
<Issue
[]>
▸ getRPCTypes(): Record
<string
, Record
<string
, DefinitionRpc
| DefinitionRpcSub
>>
Record
<string
, Record
<string
, DefinitionRpc
| DefinitionRpcSub
>>
▸ getRedeemRequestsFromExtrinsicResult(interBtcApi
, result
): Promise
<Redeem
[]>
Name | Type |
---|---|
interBtcApi |
InterBtcApi |
result |
ISubmittableResult |
Promise
<Redeem
[]>
▸ getRequestIdsFromEvents(events
, eventToFind
, api
): Hash
[]
Name | Type | Description |
---|---|---|
events |
EventRecord [] |
The EventRecord array returned after sending a transaction |
eventToFind |
AugmentedEvent <ApiTypes , AnyTuple > |
- |
api |
ApiPromise |
- |
Hash
[]
The id associated with the transaction. If the EventRecord array does not contain required events, the function throws an error.
▸ getSS58Prefix(api
): number
Name | Type |
---|---|
api |
ApiPromise |
number
▸ getStableLpTokenFromCurrencyId(api
, currencyId
): Promise
<StableLpToken
>
Get stable LP token currency lib type from currencyId primitive.
Name | Type | Description |
---|---|---|
api |
ApiPromise |
- |
currencyId |
InterbtcPrimitivesCurrencyId |
Id of stable LP token. |
Promise
<StableLpToken
>
Lib type currency object for stable LP token.
▸ getStableSwapOutputAmount(path
, inputAmount
): MonetaryAmount
<CurrencyExt
>
Name | Type |
---|---|
path |
MultiPathElementStable |
inputAmount |
MonetaryAmount <CurrencyExt > |
MonetaryAmount
<CurrencyExt
>
src/parachain/amm/liquidity-pool/utils.ts:177
▸ getStandardLpTokenFromCurrencyId(api
, currencyId
): Promise
<StandardLpToken
>
Get standard LP token currency lib type from currencyId primitive.
Name | Type | Description |
---|---|---|
api |
ApiPromise |
- |
currencyId |
InterbtcPrimitivesCurrencyId |
Id of standard LP token. |
Promise
<StandardLpToken
>
Lib type currency object for standard LP token.
▸ getTotalAmountBtc(positions
, loanAssets
): MonetaryAmount
<Currency
>
Name | Type |
---|---|
positions |
LoanPosition [] |
loanAssets |
TickerToData <LoanAsset > |
MonetaryAmount
<Currency
>
▸ getTxProof(electrsAPI
, userTxId
): Promise
<{ coinbaseProof
: PartialTxProof
; userTxProof
: PartialTxProof
}>
Name | Type |
---|---|
electrsAPI |
ElectrsAPI |
userTxId |
string |
Promise
<{ coinbaseProof
: PartialTxProof
; userTxProof
: PartialTxProof
}>
▸ getUnderlyingCurrencyFromLendTokenId(api
, lendTokenId
): Promise
<CurrencyExt
>
Get underlying currency of lend token id,
Name | Type | Description |
---|---|---|
api |
ApiPromise |
- |
lendTokenId |
InterbtcPrimitivesCurrencyId |
Currency id of the lend token to get currency from |
Promise
<CurrencyExt
>
Underlying CurrencyExt for provided lend token
▸ intoAccountTruncating(api
, palletId
): AccountId
Name | Type |
---|---|
api |
ApiPromise |
palletId |
Uint8Array |
AccountId
▸ isCurrency(currencyExt
): currencyExt is Currency
Name | Type |
---|---|
currencyExt |
CurrencyExt |
currencyExt is Currency
▸ isCurrencyEqual(currency
, otherCurrency
): boolean
Name | Type |
---|---|
currency |
CurrencyExt |
otherCurrency |
CurrencyExt |
boolean
▸ isForeignAsset(currencyExt
): currencyExt is ForeignAsset
Name | Type |
---|---|
currencyExt |
CurrencyExt |
currencyExt is ForeignAsset
▸ isLendToken(currencyExt
): currencyExt is LendToken
Name | Type |
---|---|
currencyExt |
CurrencyExt |
currencyExt is LendToken
▸ isStableLpToken(currencyExt
): currencyExt is StableLpToken
Name | Type |
---|---|
currencyExt |
CurrencyExt |
currencyExt is StableLpToken
▸ isStableMetaMultiPathElement(pathElement
): pathElement is MultiPathElementStableMeta
Name | Type |
---|---|
pathElement |
MultiPathElement |
pathElement is MultiPathElementStableMeta
src/parachain/amm/trade/types.ts:52
▸ isStableMetaPool(pool
): pool is StableLiquidityMetaPool
Name | Type |
---|---|
pool |
LiquidityPool |
pool is StableLiquidityMetaPool
src/parachain/amm/liquidity-pool/types.ts:11
▸ isStableMultiPathElement(pathElement
): pathElement is MultiPathElementStable
Name | Type |
---|---|
pathElement |
MultiPathElement |
pathElement is MultiPathElementStable
src/parachain/amm/trade/types.ts:50
▸ isStablePlainMultiPathElement(pathElement
): pathElement is MultiPathElementStablePlain
Name | Type |
---|---|
pathElement |
MultiPathElement |
pathElement is MultiPathElementStablePlain
src/parachain/amm/trade/types.ts:54
▸ isStablePool(pool
): pool is StableLiquidityPool | StableLiquidityMetaPool
Name | Type |
---|---|
pool |
LiquidityPool |
pool is StableLiquidityPool | StableLiquidityMetaPool
src/parachain/amm/liquidity-pool/types.ts:9
▸ isStandardLpToken(currencyExt
): currencyExt is StandardLpToken
Name | Type |
---|---|
currencyExt |
CurrencyExt |
currencyExt is StandardLpToken
▸ isStandardMultiPathElement(pathElement
): pathElement is MultiPathElementStandard
Name | Type |
---|---|
pathElement |
MultiPathElement |
pathElement is MultiPathElementStandard
src/parachain/amm/trade/types.ts:48
▸ isStandardPool(pool
): pool is StandardLiquidityPool
Name | Type |
---|---|
pool |
LiquidityPool |
pool is StandardLiquidityPool
src/parachain/amm/liquidity-pool/types.ts:8
▸ monetaryAmountToRawString(amount
): string
Name | Type |
---|---|
amount |
MonetaryAmount <CurrencyExt > |
string
▸ newAccountId(api
, accountId
): AccountId
Name | Type |
---|---|
api |
ApiPromise |
accountId |
string |
AccountId
▸ newCollateralBTCExchangeRate(rate
, counterCurrency
, useBaseUnits?
): ExchangeRate
<Bitcoin
, Currency
>
Name | Type | Default value |
---|---|---|
rate |
Big |
undefined |
counterCurrency |
Currency |
undefined |
useBaseUnits |
boolean |
false |
ExchangeRate
<Bitcoin
, Currency
>
▸ newCurrencyId(api
, currency
): InterbtcPrimitivesCurrencyId
Name | Type |
---|---|
api |
ApiPromise |
currency |
CurrencyExt |
InterbtcPrimitivesCurrencyId
▸ newExtrinsicStatus(api
, type
): ExtrinsicStatus
Name | Type |
---|---|
api |
ApiPromise |
type |
"Ready" | "Future" | "Broadcast" | "InBlock" | "Retracted" | "FinalityTimeout" | "Finalized" | "Usurped" | "Dropped" | "Invalid" |
ExtrinsicStatus
▸ newForeignAssetId(api
, id
): u32
Name | Type |
---|---|
api |
ApiPromise |
id |
number |
u32
▸ newMonetaryAmount<CurrencyT
>(amount
, currency
, base?
): MonetaryAmount
<CurrencyT
>
Name | Type |
---|---|
CurrencyT |
extends CurrencyExt |
Name | Type | Default value |
---|---|---|
amount |
BigSource |
undefined |
currency |
CurrencyT |
undefined |
base |
boolean |
false |
MonetaryAmount
<CurrencyT
>
▸ newVaultCurrencyPair(api
, collateralCurrency
, wrappedCurrency
): InterbtcPrimitivesVaultCurrencyPair
Name | Type |
---|---|
api |
ApiPromise |
collateralCurrency |
CollateralCurrencyExt |
wrappedCurrency |
Currency |
InterbtcPrimitivesVaultCurrencyPair
▸ newVaultId(api
, accountId
, collateralCurrency
, wrappedCurrency
): InterbtcPrimitivesVaultId
Name | Type |
---|---|
api |
ApiPromise |
accountId |
string |
collateralCurrency |
CollateralCurrencyExt |
wrappedCurrency |
Currency |
▸ parseEscrowLockedBalance(governanceCurrency
, escrowLockedBalance
): StakedBalance
Name | Type |
---|---|
governanceCurrency |
Currency |
escrowLockedBalance |
EscrowLockedBalance |
▸ parseIssueRequest(api
, vaultsAPI
, req
, network
, id
): Promise
<Issue
>
Name | Type |
---|---|
api |
ApiPromise |
vaultsAPI |
VaultsAPI |
req |
InterbtcPrimitivesIssueIssueRequest |
network |
Network |
id |
string | H256 |
Promise
<Issue
>
▸ parseOrmlTokensAccountData(data
, currency
): ChainBalance
Name | Type |
---|---|
data |
OrmlTokensAccountData |
currency |
CurrencyExt |
▸ parseRedeemRequest(api
, vaultsAPI
, req
, network
, id
, redeemPeriod
, activeBlockCount
): Promise
<Redeem
>
Name | Type |
---|---|
api |
ApiPromise |
vaultsAPI |
VaultsAPI |
req |
InterbtcPrimitivesRedeemRedeemRequest |
network |
Network |
id |
string | H256 |
redeemPeriod |
number |
activeBlockCount |
number |
Promise
<Redeem
>
▸ parseRedeemRequestStatus(req
, redeemPeriod
, activeBlockCount
): RedeemStatus
Name | Type |
---|---|
req |
InterbtcPrimitivesRedeemRedeemRequest |
redeemPeriod |
number |
activeBlockCount |
number |
▸ parseReplaceRequest(api
, req
, network
, wrappedCurrency
, id
): Promise
<ReplaceRequestExt
>
Name | Type |
---|---|
api |
ApiPromise |
req |
InterbtcPrimitivesReplaceReplaceRequest |
network |
Network |
wrappedCurrency |
Currency |
id |
string | H256 |
Promise
<ReplaceRequestExt
>
▸ parseSystemVault(api
, vault
, wrappedCurrency
, collateralCurrency
): Promise
<SystemVaultExt
>
Name | Type |
---|---|
api |
ApiPromise |
vault |
VaultRegistrySystemVault |
wrappedCurrency |
Currency |
collateralCurrency |
CollateralCurrencyExt |
Promise
<SystemVaultExt
>
▸ queryNominationsMap(api
, map
, vaultId
): Promise
<number
| undefined
>
Name | Type |
---|---|
api |
ApiPromise |
map |
Map <InterbtcPrimitivesVaultId , number > |
vaultId |
InterbtcPrimitivesVaultId |
Promise
<number
| undefined
>
▸ reverseEndianness(bytes
): Uint8Array
Converts endianness of a Uint8Array
Name | Type | Description |
---|---|---|
bytes |
Uint8Array |
Uint8Array, to be converted LE<>BE |
Uint8Array
▸ reverseEndiannessHex(hex
): string
Reverse the endianness of the given hex string
Name | Type |
---|---|
hex |
string |
string
Dev
Will remove 0x
prefix if present
▸ setRawStorage(api
, key
, value
, account
, isLittleEndian?
): Promise
<void
>
Name | Type | Default value |
---|---|---|
api |
ApiPromise |
undefined |
key |
string |
undefined |
value |
Codec |
undefined |
account |
AddressOrPair |
undefined |
isLittleEndian |
boolean |
true |
Promise
<void
>
▸ setStorageAtKey(api
, key
, data
, sudoAccount
): Promise
<void
>
Name | Type |
---|---|
api |
ApiPromise |
key |
string |
data |
`0x${string}` |
sudoAccount |
AddressOrPair |
Promise
<void
>
▸ sleep(ms
): Promise
<void
>
Name | Type |
---|---|
ms |
number |
Promise
<void
>
▸ storageKeyToNthInner<T
>(s
, n?
): T
Name | Type |
---|---|
T |
extends Codec |
Name | Type | Default value |
---|---|---|
s |
StorageKey <T []> |
undefined |
n |
number |
0 |
T
▸ stripHexPrefix(str
): string
Remove the 0x
hex prefix if present
Name | Type |
---|---|
str |
string |
string
▸ toVoting(governanceCurrency
): Currency
Name | Type |
---|---|
governanceCurrency |
Currency |
Currency
▸ tokenSymbolToCurrency(tokenSymbol
): Currency
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.
Name | Type | Description |
---|---|---|
tokenSymbol |
InterbtcPrimitivesTokenSymbol |
the InterbtcPrimitivesTokenSymbol to look up |
Currency
▸ uint8ArrayToString(bytes
): string
Converts a Uint8Array to string
Name | Type |
---|---|
bytes |
Uint8Array |
string
Dev
Will remove 0x
prefix if present
▸ unwrapRawExchangeRate(option
): UnsignedFixedPoint
| undefined
Name | Type |
---|---|
option |
Option <UnsignedFixedPoint > |
UnsignedFixedPoint
| undefined