@interlay/interbtc-api / Exports / ReplaceAPI
▸ accept(oldVault
, amount
, collateral
, btcAddress
): ExtrinsicData
Accept a replace request
Name | Type | Description |
---|---|---|
oldVault |
AccountId |
ID of the old vault that to be (possibly partially) replaced |
amount |
MonetaryAmount <Currency > |
Amount of issued tokens to be replaced |
collateral |
MonetaryAmount <CollateralCurrencyExt > |
The collateral for replacement |
btcAddress |
string |
The address that old-vault should transfer the btc to |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
▸ buildAcceptReplaceExtrinsic(oldVault
, amount
, collateral
, btcAddress
): SubmittableExtrinsic
<"promise"
, ISubmittableResult
>
Build an accept replace extrinsic (transaction) without sending it.
Name | Type | Description |
---|---|---|
oldVault |
AccountId |
account ID of the old vault that to be (possibly partially) replaced |
amount |
MonetaryAmount <Currency > |
Amount of issued tokens to be replaced |
collateral |
MonetaryAmount <CollateralCurrencyExt > |
The collateral for replacement |
btcAddress |
string |
The address that old-vault should transfer the btc to |
SubmittableExtrinsic
<"promise"
, ISubmittableResult
>
An accept replace submittable extrinsic.
▸ buildExecuteReplaceExtrinsic(requestId
, btcTxId
): Promise
<SubmittableExtrinsic
<"promise"
, ISubmittableResult
>>
Build an execute replace extrinsic (transaction) without sending it.
Name | Type | Description |
---|---|---|
requestId |
string |
The ID generated by the replace request transaction |
btcTxId |
string |
Bitcoin transaction ID |
Promise
<SubmittableExtrinsic
<"promise"
, ISubmittableResult
>>
An execute replace submittable extrinsic.
▸ buildRequestReplaceExtrinsic(amount
, collateralCurrency
): SubmittableExtrinsic
<"promise"
, ISubmittableResult
>
Build a request replace extrinsic (transaction) without sending it.
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <Currency > |
Wrapped token amount to replace. |
collateralCurrency |
CollateralCurrencyExt |
Collateral currency to have replaced |
SubmittableExtrinsic
<"promise"
, ISubmittableResult
>
A request replace submittable extrinsic.
▸ buildWithdrawReplaceExtrinsic(amount
, collateralCurrency
): SubmittableExtrinsic
<"promise"
, ISubmittableResult
>
Build a withdraw replace extrinsic (transaction) without sending it.
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <Currency > |
The amount of wrapped tokens to withdraw from the amount requested to have replaced. |
collateralCurrency |
CollateralCurrencyExt |
Collateral currency to have replaced |
SubmittableExtrinsic
<"promise"
, ISubmittableResult
>
A withdraw replace submittable extrinsic.
▸ execute(requestId
, btcTxId
): Promise
<ExtrinsicData
>
Execute a replace request
Name | Type | Description |
---|---|---|
requestId |
string |
The ID generated by the replace request transaction |
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 btc that is accepted for replace requests; any lower values would risk the bitcoin client to reject the payment
▸ getReplacePeriod(): Promise
<BlockNumber
>
Promise
<BlockNumber
>
The time difference in number of blocks between when a replace request is created and required completion time by a vault. The replace period has an upper limit to prevent griefing of vault collateral.
▸ getRequestById(replaceId
, atBlock?
): Promise
<ReplaceRequestExt
>
Name | Type | Description |
---|---|---|
replaceId |
string | H256 |
The ID of the replace request to fetch |
atBlock? |
BlockHash |
- |
Promise
<ReplaceRequestExt
>
A replace request object
▸ list(): Promise
<ReplaceRequestExt
[]>
Promise
<ReplaceRequestExt
[]>
An array containing the replace requests
▸ map(): Promise
<Map
<H256
, ReplaceRequestExt
>>
Promise
<Map
<H256
, ReplaceRequestExt
>>
A mapping from the replace request ID to the replace request object
▸ mapReplaceRequests(vaultAccountId
): Promise
<ReplaceRequestExt
[]>
Fetch the replace requests associated with a vault. In the returned requests, the vault is either the replaced or the replacing one.
Name | Type | Description |
---|---|---|
vaultAccountId |
AccountId |
The AccountId of the vault used to filter replace requests |
Promise
<ReplaceRequestExt
[]>
An array with replace requests involving said vault
▸ request(amount
, collateralCurrency
): ExtrinsicData
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <Currency > |
Amount issued, denoted in Bitcoin, to have replaced by another vault |
collateralCurrency |
CollateralCurrencyExt |
Collateral currency to have replaced |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
▸ withdraw(amount
, collateralCurrency
): ExtrinsicData
Wihdraw a replace request
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <Currency > |
The amount of wrapped tokens to withdraw from the amount requested to have replaced. |
collateralCurrency |
CollateralCurrencyExt |
Collateral currency of the request |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.