interbtc-api

@interlay/interbtc-api / Exports / OracleAPI

Interface: OracleAPI

Implemented by

Table of contents

Methods

Methods

convertCollateralToWrapped

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

Parameters

Name Type Description
amount MonetaryAmount<CollateralCurrencyExt> The amount of collateral tokens to convert

Returns

Promise<MonetaryAmount<Currency>>

Converted value

Defined in

src/parachain/oracle.ts:81


convertWrappedToCurrency

convertWrappedToCurrency(amount, currency): Promise<MonetaryAmount<CurrencyExt>>

Parameters

Name Type Description
amount MonetaryAmount<Currency> The amount of wrapped tokens to convert
currency CurrencyExt A Monetary.js object

Returns

Promise<MonetaryAmount<CurrencyExt>>

Converted value

Defined in

src/parachain/oracle.ts:73


getBitcoinFees

getBitcoinFees(): Promise<Big>

Obtains the current fees for BTC transactions, in satoshi/byte.

Returns

Promise<Big>

Big value for the current inclusion fees.

Defined in

src/parachain/oracle.ts:42


getExchangeRate

getExchangeRate(collateralCurrency, wrappedCurrency?): Promise<ExchangeRate<Currency, CurrencyExt>>

Parameters

Name Type Description
collateralCurrency CurrencyExt -
wrappedCurrency? Currency The wrapped currency to use in the returned exchange rate type, defaults to Bitcoin

Returns

Promise<ExchangeRate<Currency, CurrencyExt>>

The exchange rate between Bitcoin and the provided collateral currency

Defined in

src/parachain/oracle.ts:34


getOnlineTimeout

getOnlineTimeout(): Promise<number>

Returns

Promise<number>

The period of time (in milliseconds) after an oracle’s last submission during which it is considered online

Defined in

src/parachain/oracle.ts:86


getRawValuesUpdated

getRawValuesUpdated(key): Promise<boolean>

Parameters

Name Type Description
key InterbtcPrimitivesOracleKey A key defining an exchange rate or a BTC network fee estimate

Returns

Promise<boolean>

Whether the oracle entr for the given key has been updated

Defined in

src/parachain/oracle.ts:91


getSourcesById

getSourcesById(): Promise<Map<string, string>>

Returns

Promise<Map<string, string>>

A map from the oracle’s account id to its name

Defined in

src/parachain/oracle.ts:50


getValidUntil

getValidUntil(counterCurrency): Promise<Date>

Parameters

Name Type
counterCurrency CurrencyExt

Returns

Promise<Date>

Last exchange rate time

Defined in

src/parachain/oracle.ts:46


isOnline

isOnline(currency): Promise<boolean>

Parameters

Name Type Description
currency CurrencyExt Currency for which we check status of oracle.

Returns

Promise<boolean>

Boolean value indicating whether the oracle is online for currency

Defined in

src/parachain/oracle.ts:55


setBitcoinFees

setBitcoinFees(fees): ExtrinsicData

Create a transaction to set the current fee estimate for BTC transactions

Parameters

Name Type Description
fees Big Estimated Satoshis per bytes to get a transaction included

Returns

ExtrinsicData

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

Defined in

src/parachain/oracle.ts:67


setExchangeRate

setExchangeRate(exchangeRate): ExtrinsicData

Create a transaction to set the exchange rate between Bitcoin and a collateral currency

Parameters

Name Type Description
exchangeRate ExchangeRate<Currency, CurrencyExt> The rate to set

Returns

ExtrinsicData

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

Defined in

src/parachain/oracle.ts:61