@interlay/interbtc-api / Exports / DefaultOracleAPI
• new DefaultOracleAPI(api
, wrappedCurrency
): DefaultOracleAPI
Name | Type |
---|---|
api |
ApiPromise |
wrappedCurrency |
Currency |
• Private
api: ApiPromise
• Private
wrappedCurrency: Currency
▸ convertCollateralToWrapped(amount
): Promise
<MonetaryAmount
<Currency
>>
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <CollateralCurrencyExt > |
The amount of collateral tokens to convert |
Promise
<MonetaryAmount
<Currency
>>
Converted value
OracleAPI.convertCollateralToWrapped
▸ convertWrappedToCurrency(amount
, currency
): Promise
<MonetaryAmount
<CurrencyExt
>>
Name | Type | Description |
---|---|---|
amount |
MonetaryAmount <Currency > |
The amount of wrapped tokens to convert |
currency |
CurrencyExt |
A Monetary.js object |
Promise
<MonetaryAmount
<CurrencyExt
>>
Converted value
OracleAPI.convertWrappedToCurrency
▸ getBitcoinFees(): Promise
<Big
>
Obtains the current fees for BTC transactions, in satoshi/byte.
Promise
<Big
>
Big value for the current inclusion fees.
▸ getExchangeRate(currency
): Promise
<ExchangeRate
<Currency
, CurrencyExt
>>
Name | Type |
---|---|
currency |
CurrencyExt |
Promise
<ExchangeRate
<Currency
, CurrencyExt
>>
The exchange rate between Bitcoin and the provided collateral currency
▸ getOnlineTimeout(): Promise
<number
>
Promise
<number
>
The period of time (in milliseconds) after an oracle’s last submission during which it is considered online
▸ getRawValuesUpdated(key
): Promise
<boolean
>
Name | Type | Description |
---|---|---|
key |
InterbtcPrimitivesOracleKey |
A key defining an exchange rate or a BTC network fee estimate |
Promise
<boolean
>
Whether the oracle entr for the given key has been updated
▸ getSourcesById(): Promise
<Map
<string
, string
>>
Promise
<Map
<string
, string
>>
A map from the oracle’s account id to its name
▸ getValidUntil(counterCurrency
): Promise
<Date
>
Name | Type |
---|---|
counterCurrency |
CurrencyExt |
Promise
<Date
>
Last exchange rate time
▸ isOnline(currency
): Promise
<boolean
>
Name | Type | Description |
---|---|---|
currency |
CurrencyExt |
Currency for which we check status of oracle. |
Promise
<boolean
>
Boolean value indicating whether the oracle is online for currency
▸ setBitcoinFees(fees
): ExtrinsicData
Create a transaction to set the current fee estimate for BTC transactions
Name | Type | Description |
---|---|---|
fees |
Big |
Estimated Satoshis per bytes to get a transaction included |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
▸ setExchangeRate(exchangeRate
): ExtrinsicData
Create a transaction to set the exchange rate between Bitcoin and a collateral currency
Name | Type | Description |
---|---|---|
exchangeRate |
ExchangeRate <Currency , CurrencyExt > |
The rate to set |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.