@interlay/interbtc-api / Exports / DefaultIssueAPI
• new DefaultIssueAPI(api, btcNetwork, electrsAPI, wrappedCurrency, vaultsAPI, transactionAPI): DefaultIssueAPI
| Name | Type |
|---|---|
api |
ApiPromise |
btcNetwork |
Network |
electrsAPI |
ElectrsAPI |
wrappedCurrency |
Currency |
vaultsAPI |
VaultsAPI |
transactionAPI |
TransactionAPI |
• Private api: ApiPromise
• Private btcNetwork: Network
• Private electrsAPI: ElectrsAPI
• Private transactionAPI: TransactionAPI
• Private vaultsAPI: VaultsAPI
• Private wrappedCurrency: Currency
▸ buildCancelIssueExtrinsic(requestId): SubmittableExtrinsic<"promise", ISubmittableResult>
Build a cancel issue extrinsic (transaction) without sending it.
| Name | Type | Description |
|---|---|---|
requestId |
string |
The ID returned by the issue request transaction |
SubmittableExtrinsic<"promise", ISubmittableResult>
A cancel issue submittable extrinsic.
IssueAPI.buildCancelIssueExtrinsic
▸ buildExecuteIssueExtrinsic(requestId, btcTxId): Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>
Build an issue execution extrinsic (transaction) without sending it.
| Name | Type | Description |
|---|---|---|
requestId |
string |
The ID returned by the issue request transaction |
btcTxId |
string |
Bitcoin transaction ID |
Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>
An execute issue submittable extrinsic.
IssueAPI.buildExecuteIssueExtrinsic
▸ buildRequestIssueExtrinsic(vaultId, amount, griefingCollateralCurrency?): SubmittableExtrinsic<"promise", ISubmittableResult>
Build an issue request extrinsic (transaction) without sending it.
| Name | Type | Description |
|---|---|---|
vaultId |
InterbtcPrimitivesVaultId |
The vault ID of the vault to issue with. |
amount |
MonetaryAmount<Currency> |
wrapped token amount to issue. |
griefingCollateralCurrency? |
CurrencyExt |
(optional) Currency in which griefing collateral will be locked. |
SubmittableExtrinsic<"promise", ISubmittableResult>
An execute issue submittable extrinsic.
IssueAPI.buildRequestIssueExtrinsic
▸ cancel(requestId): ExtrinsicData
Create an issue cancellation transaction. After the issue period has elapsed, the issuance request can be cancelled. As a result, the griefing collateral of the requester will be slashed and sent to the vault that had prepared to issue.
| Name | Type | Description |
|---|---|---|
requestId |
string |
The ID returned by the issue request transaction |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
▸ execute(requestId, btcTxId): Promise<ExtrinsicData>
Create an issue execution transaction
| Name | Type | Description |
|---|---|---|
requestId |
string |
- |
btcTxId |
string |
Bitcoin transaction ID |
Promise<ExtrinsicData>
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
Remarks
If txId is not set, the merkleProof and rawTx must both be set.
▸ getDustValue(): Promise<MonetaryAmount<Currency>>
Promise<MonetaryAmount<Currency>>
The minimum amount of wrapped tokens that is accepted for issue requests; any lower values would risk the bitcoin client to reject the payment
▸ getFeeRate(): Promise<Big>
Promise<Big>
The fee charged for issuing. For instance, “0.005” stands for 0.5%
▸ getFeesToPay(amount): Promise<MonetaryAmount<Currency>>
| Name | Type | Description |
|---|---|---|
amount |
MonetaryAmount<Currency> |
The amount, in BTC, for which to compute the issue fees |
Promise<MonetaryAmount<Currency>>
The fees, in BTC
▸ getIssuePeriod(): Promise<number>
Promise<number>
The time difference in number of blocks between an issue request is created and required completion time by a user. The issue period has an upper limit to prevent griefing of vault collateral.
▸ getRequestById(issueId): Promise<Issue>
| Name | Type | Description |
|---|---|---|
issueId |
string | H256 |
The ID of the issue request to fetch |
Promise<Issue>
An issue request object
▸ getRequestLimits(vaults?): Promise<IssueLimits>
Gets the threshold for issuing with a single vault, and the maximum total issue request size. Additionally passes the list of vaults for caching.
| Name | Type | Description |
|---|---|---|
vaults? |
Map<InterbtcPrimitivesVaultId, MonetaryAmount<Currency>> |
(optional) A list of the vaults available to issue from. If not provided, will fetch from the parachain (incurring an extra request). |
Promise<IssueLimits>
An object of type {singleVault, maxTotal, vaultsCache}
▸ getRequestsByIds(issueIds): Promise<Issue[]>
| Name | Type |
|---|---|
issueIds |
(string | H256)[] |
Promise<Issue[]>
The issue request objects
▸ getVaultIssuableAmount(vaultAccountId, collateralCurrency): Promise<MonetaryAmount<Currency>>
| Name | Type | Description |
|---|---|---|
vaultAccountId |
AccountId |
The vault account ID |
collateralCurrency |
CollateralCurrencyExt |
The currency specification, a Monetary.js object |
Promise<MonetaryAmount<Currency>>
The amount of wrapped tokens issuable by this vault
IssueAPI.getVaultIssuableAmount
▸ list(): Promise<Issue[]>
Promise<Issue[]>
An array containing the issue requests
▸ request(amount, vaultAccountId?, collateralCurrency?, atomic?, cachedVaults?, griefingCollateralCurrency?): Promise<ExtrinsicData>
Request issuing wrapped tokens (e.g. interBTC, kBTC).
| Name | Type | Default value | Description |
|---|---|---|---|
amount |
MonetaryAmount<Currency> |
undefined |
wrapped token amount to issue. |
vaultAccountId? |
AccountId |
undefined |
- |
collateralCurrency? |
CollateralCurrencyExt |
undefined |
(optional) Collateral currency for backing wrapped tokens |
atomic |
boolean |
true |
(optional) Whether the issue request should be handled atomically or not. Only makes a difference if more than one vault is needed to fulfil it. Defaults to false. |
cachedVaults? |
Map<InterbtcPrimitivesVaultId, MonetaryAmount<Currency>> |
undefined |
(optional) A list of all vaults usable for issue. If not provided, will fetch from the parachain. |
griefingCollateralCurrency? |
CurrencyExt |
undefined |
(optional) Currency in which griefing collateral will be locked. |
Promise<ExtrinsicData>
An extrinsic with event.
▸ requestAdvanced(amountsPerVault, atomic, griefingCollateralCurrency?): ExtrinsicData
Create a batch of aggregated issue transactions (to one or more vaults).
| Name | Type | Description |
|---|---|---|
amountsPerVault |
Map<InterbtcPrimitivesVaultId, MonetaryAmount<Currency>> |
A mapping of vaults to issue from, and wrapped token amounts to issue using each vault |
atomic |
boolean |
Whether the issue request should be handled atomically or not. Only makes a difference if more than one vault is needed to fulfil it. |
griefingCollateralCurrency? |
CurrencyExt |
(optional) Currency in which griefing collateral will be locked. |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
▸ setIssuePeriod(blocks): ExtrinsicData
| Name | Type | Description |
|---|---|---|
blocks |
number |
The time difference in number of blocks between an issue request is created and required completion time by a user. The issue period has an upper limit to prevent griefing of vault collateral. |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
Remarks
Testnet utility function