interbtc-api

@interlay/interbtc-api / Exports / DefaultOracleAPI

Class: DefaultOracleAPI

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DefaultOracleAPI(api, wrappedCurrency): DefaultOracleAPI

Parameters

Name Type
api ApiPromise
wrappedCurrency Currency

Returns

DefaultOracleAPI

Defined in

src/parachain/oracle.ts:95

Properties

api

Private api: ApiPromise

Defined in

src/parachain/oracle.ts:95


wrappedCurrency

Private wrappedCurrency: Currency

Defined in

src/parachain/oracle.ts:95

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

Implementation of

OracleAPI.convertCollateralToWrapped

Defined in

src/parachain/oracle.ts:152


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

Implementation of

OracleAPI.convertWrappedToCurrency

Defined in

src/parachain/oracle.ts:144


getBitcoinFees

getBitcoinFees(): Promise<Big>

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

Returns

Promise<Big>

Big value for the current inclusion fees.

Implementation of

OracleAPI.getBitcoinFees

Defined in

src/parachain/oracle.ts:171


getExchangeRate

getExchangeRate(currency): Promise<ExchangeRate<Currency, CurrencyExt>>

Parameters

Name Type
currency CurrencyExt

Returns

Promise<ExchangeRate<Currency, CurrencyExt>>

The exchange rate between Bitcoin and the provided collateral currency

Implementation of

OracleAPI.getExchangeRate

Defined in

src/parachain/oracle.ts:97


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

Implementation of

OracleAPI.getOnlineTimeout

Defined in

src/parachain/oracle.ts:159


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

Implementation of

OracleAPI.getRawValuesUpdated

Defined in

src/parachain/oracle.ts:220


getSourcesById

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

Returns

Promise<Map<string, string>>

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

Implementation of

OracleAPI.getSourcesById

Defined in

src/parachain/oracle.ts:199


getValidUntil

getValidUntil(counterCurrency): Promise<Date>

Parameters

Name Type
counterCurrency CurrencyExt

Returns

Promise<Date>

Last exchange rate time

Implementation of

OracleAPI.getValidUntil

Defined in

src/parachain/oracle.ts:206


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

Implementation of

OracleAPI.isOnline

Defined in

src/parachain/oracle.ts:212


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.

Implementation of

OracleAPI.setBitcoinFees

Defined in

src/parachain/oracle.ts:186


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.

Implementation of

OracleAPI.setExchangeRate

Defined in

src/parachain/oracle.ts:164