interbtc-api

@interlay/interbtc-api / Exports / DefaultIssueAPI

Class: DefaultIssueAPI

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DefaultIssueAPI(api, btcNetwork, electrsAPI, wrappedCurrency, vaultsAPI, transactionAPI): DefaultIssueAPI

Parameters

Name Type
api ApiPromise
btcNetwork Network
electrsAPI ElectrsAPI
wrappedCurrency Currency
vaultsAPI VaultsAPI
transactionAPI TransactionAPI

Returns

DefaultIssueAPI

Defined in

src/parachain/issue.ts:188

Properties

api

Private api: ApiPromise

Defined in

src/parachain/issue.ts:189


btcNetwork

Private btcNetwork: Network

Defined in

src/parachain/issue.ts:190


electrsAPI

Private electrsAPI: ElectrsAPI

Defined in

src/parachain/issue.ts:191


transactionAPI

Private transactionAPI: TransactionAPI

Defined in

src/parachain/issue.ts:194


vaultsAPI

Private vaultsAPI: VaultsAPI

Defined in

src/parachain/issue.ts:193


wrappedCurrency

Private wrappedCurrency: Currency

Defined in

src/parachain/issue.ts:192

Methods

buildCancelIssueExtrinsic

buildCancelIssueExtrinsic(requestId): SubmittableExtrinsic<"promise", ISubmittableResult>

Build a cancel issue extrinsic (transaction) without sending it.

Parameters

Name Type Description
requestId string The ID returned by the issue request transaction

Returns

SubmittableExtrinsic<"promise", ISubmittableResult>

A cancel issue submittable extrinsic.

Implementation of

IssueAPI.buildCancelIssueExtrinsic

Defined in

src/parachain/issue.ts:295


buildExecuteIssueExtrinsic

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

Build an issue execution extrinsic (transaction) without sending it.

Parameters

Name Type Description
requestId string The ID returned by the issue request transaction
btcTxId string Bitcoin transaction ID

Returns

Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>

An execute issue submittable extrinsic.

Implementation of

IssueAPI.buildExecuteIssueExtrinsic

Defined in

src/parachain/issue.ts:281


buildRequestIssueExtrinsic

buildRequestIssueExtrinsic(vaultId, amount, griefingCollateralCurrency?): SubmittableExtrinsic<"promise", ISubmittableResult>

Build an issue request extrinsic (transaction) without sending it.

Parameters

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.

Returns

SubmittableExtrinsic<"promise", ISubmittableResult>

An execute issue submittable extrinsic.

Implementation of

IssueAPI.buildRequestIssueExtrinsic

Defined in

src/parachain/issue.ts:256


cancel

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.

Parameters

Name Type Description
requestId string The ID returned by the issue request transaction

Returns

ExtrinsicData

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

Implementation of

IssueAPI.cancel

Defined in

src/parachain/issue.ts:300


execute

execute(requestId, btcTxId): Promise<ExtrinsicData>

Create an issue execution transaction

Parameters

Name Type Description
requestId string -
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.

Implementation of

IssueAPI.execute

Defined in

src/parachain/issue.ts:290


getDustValue

getDustValue(): Promise<MonetaryAmount<Currency>>

Returns

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

Implementation of

IssueAPI.getDustValue

Defined in

src/parachain/issue.ts:333


getFeeRate

getFeeRate(): Promise<Big>

Returns

Promise<Big>

The fee charged for issuing. For instance, “0.005” stands for 0.5%

Implementation of

IssueAPI.getFeeRate

Defined in

src/parachain/issue.ts:338


getFeesToPay

getFeesToPay(amount): Promise<MonetaryAmount<Currency>>

Parameters

Name Type Description
amount MonetaryAmount<Currency> The amount, in BTC, for which to compute the issue fees

Returns

Promise<MonetaryAmount<Currency>>

The fees, in BTC

Implementation of

IssueAPI.getFeesToPay

Defined in

src/parachain/issue.ts:328


getIssuePeriod

getIssuePeriod(): Promise<number>

Returns

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.

Implementation of

IssueAPI.getIssuePeriod

Defined in

src/parachain/issue.ts:311


getRequestById

getRequestById(issueId): Promise<Issue>

Parameters

Name Type Description
issueId string | H256 The ID of the issue request to fetch

Returns

Promise<Issue>

An issue request object

Implementation of

IssueAPI.getRequestById

Defined in

src/parachain/issue.ts:343


getRequestLimits

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.

Parameters

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

Returns

Promise<IssueLimits>

An object of type {singleVault, maxTotal, vaultsCache}

Implementation of

IssueAPI.getRequestLimits

Defined in

src/parachain/issue.ts:197


getRequestsByIds

getRequestsByIds(issueIds): Promise<Issue[]>

Parameters

Name Type
issueIds (string | H256)[]

Returns

Promise<Issue[]>

The issue request objects

Implementation of

IssueAPI.getRequestsByIds

Defined in

src/parachain/issue.ts:347


getVaultIssuableAmount

getVaultIssuableAmount(vaultAccountId, collateralCurrency): Promise<MonetaryAmount<Currency>>

Parameters

Name Type Description
vaultAccountId AccountId The vault account ID
collateralCurrency CollateralCurrencyExt The currency specification, a Monetary.js object

Returns

Promise<MonetaryAmount<Currency>>

The amount of wrapped tokens issuable by this vault

Implementation of

IssueAPI.getVaultIssuableAmount

Defined in

src/parachain/issue.ts:371


list

list(): Promise<Issue[]>

Returns

Promise<Issue[]>

An array containing the issue requests

Implementation of

IssueAPI.list

Defined in

src/parachain/issue.ts:316


request

request(amount, vaultAccountId?, collateralCurrency?, atomic?, cachedVaults?, griefingCollateralCurrency?): Promise<ExtrinsicData>

Request issuing wrapped tokens (e.g. interBTC, kBTC).

Parameters

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.

Returns

Promise<ExtrinsicData>

An extrinsic with event.

Implementation of

IssueAPI.request

Defined in

src/parachain/issue.ts:219


requestAdvanced

requestAdvanced(amountsPerVault, atomic, griefingCollateralCurrency?): ExtrinsicData

Create a batch of aggregated issue transactions (to one or more vaults).

Parameters

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.

Returns

ExtrinsicData

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

Implementation of

IssueAPI.requestAdvanced

Defined in

src/parachain/issue.ts:269


setIssuePeriod

setIssuePeriod(blocks): ExtrinsicData

Parameters

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.

Returns

ExtrinsicData

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

Remarks

Testnet utility function

Implementation of

IssueAPI.setIssuePeriod

Defined in

src/parachain/issue.ts:305