interbtc-api

@interlay/interbtc-api / Exports / ReplaceAPI

Interface: ReplaceAPI

Implemented by

Table of contents

Methods

Methods

accept

▸ accept(oldVault, amount, collateral, btcAddress): ExtrinsicData

Accept a replace request

Parameters

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

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Defined in

src/parachain/replace.ts:115


buildAcceptReplaceExtrinsic

▸ buildAcceptReplaceExtrinsic(oldVault, amount, collateral, btcAddress): SubmittableExtrinsic<"promise", ISubmittableResult>

Build an accept replace extrinsic (transaction) without sending it.

Parameters

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

Returns

SubmittableExtrinsic<"promise", ISubmittableResult>

An accept replace submittable extrinsic.

Defined in

src/parachain/replace.ts:100


buildExecuteReplaceExtrinsic

▸ buildExecuteReplaceExtrinsic(requestId, btcTxId): Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>

Build an execute replace extrinsic (transaction) without sending it.

Parameters

Name Type Description
requestId string The ID generated by the replace request transaction
btcTxId string Bitcoin transaction ID

Returns

Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>

An execute replace submittable extrinsic.

Defined in

src/parachain/replace.ts:129


buildRequestReplaceExtrinsic

▸ buildRequestReplaceExtrinsic(amount, collateralCurrency): SubmittableExtrinsic<"promise", ISubmittableResult>

Build a request replace extrinsic (transaction) without sending it.

Parameters

Name Type Description
amount MonetaryAmount<Currency> Wrapped token amount to replace.
collateralCurrency CollateralCurrencyExt Collateral currency to have replaced

Returns

SubmittableExtrinsic<"promise", ISubmittableResult>

A request replace submittable extrinsic.

Defined in

src/parachain/replace.ts:57


buildWithdrawReplaceExtrinsic

▸ buildWithdrawReplaceExtrinsic(amount, collateralCurrency): SubmittableExtrinsic<"promise", ISubmittableResult>

Build a withdraw replace extrinsic (transaction) without sending it.

Parameters

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

Returns

SubmittableExtrinsic<"promise", ISubmittableResult>

A withdraw replace submittable extrinsic.

Defined in

src/parachain/replace.ts:77


execute

▸ execute(requestId, btcTxId): Promise<ExtrinsicData>

Execute a replace request

Parameters

Name Type Description
requestId string The ID generated by the replace request transaction
btcTxId string Bitcoin transaction ID

Returns

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.

Defined in

src/parachain/replace.ts:142


getDustValue

▸ getDustValue(): Promise<MonetaryAmount<Currency>>

Returns

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

Defined in

src/parachain/replace.ts:29


getReplacePeriod

▸ getReplacePeriod(): Promise<BlockNumber>

Returns

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.

Defined in

src/parachain/replace.ts:35


getRequestById

▸ getRequestById(replaceId, atBlock?): Promise<ReplaceRequestExt>

Parameters

Name Type Description
replaceId string | H256 The ID of the replace request to fetch
atBlock? BlockHash -

Returns

Promise<ReplaceRequestExt>

A replace request object

Defined in

src/parachain/replace.ts:48


list

▸ list(): Promise<ReplaceRequestExt[]>

Returns

Promise<ReplaceRequestExt[]>

An array containing the replace requests

Defined in

src/parachain/replace.ts:39


map

▸ map(): Promise<Map<H256, ReplaceRequestExt>>

Returns

Promise<Map<H256, ReplaceRequestExt>>

A mapping from the replace request ID to the replace request object

Defined in

src/parachain/replace.ts:43


mapReplaceRequests

▸ 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.

Parameters

Name Type Description
vaultAccountId AccountId The AccountId of the vault used to filter replace requests

Returns

Promise<ReplaceRequestExt[]>

An array with replace requests involving said vault

Defined in

src/parachain/replace.ts:150


request

▸ request(amount, collateralCurrency): ExtrinsicData

Parameters

Name Type Description
amount MonetaryAmount<Currency> Amount issued, denoted in Bitcoin, to have replaced by another vault
collateralCurrency CollateralCurrencyExt Collateral currency to have replaced

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Defined in

src/parachain/replace.ts:67


withdraw

▸ withdraw(amount, collateralCurrency): ExtrinsicData

Wihdraw a replace request

Parameters

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

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Defined in

src/parachain/replace.ts:89