import { ApiPromise } from "@polkadot/api"; import Big from "big.js"; import { Bitcoin, ExchangeRate, MonetaryAmount } from "@interlay/monetary-js"; import { InterbtcPrimitivesOracleKey } from "@polkadot/types/lookup"; import { CollateralCurrencyExt, CurrencyExt, WrappedCurrency } from "../types/currency"; import { ExtrinsicData } from "../types"; /** * @category BTC Bridge */ export interface OracleAPI { /** * @param currency The collateral currency as a `Monetary.js` object * @param wrappedCurrency The wrapped currency to use in the returned exchange rate type, defaults to `Bitcoin` * @returns The exchange rate between Bitcoin and the provided collateral currency */ getExchangeRate(collateralCurrency: CurrencyExt, wrappedCurrency?: Bitcoin): Promise>; /** * Obtains the current fees for BTC transactions, in satoshi/byte. * @returns Big value for the current inclusion fees. */ getBitcoinFees(): Promise; /** * @returns Last exchange rate time */ getValidUntil(counterCurrency: CurrencyExt): Promise; /** * @returns A map from the oracle's account id to its name */ getSourcesById(): Promise>; /** * @returns Boolean value indicating whether the oracle is online for currency * @param currency Currency for which we check status of oracle. */ isOnline(currency: CurrencyExt): Promise; /** * Create a transaction to set the exchange rate between Bitcoin and a collateral currency * @param exchangeRate The rate to set * @returns {ExtrinsicData} A submittable extrinsic and an event that is emitted when extrinsic is submitted. */ setExchangeRate(exchangeRate: ExchangeRate): ExtrinsicData; /** * Create a transaction to set the current fee estimate for BTC transactions * @param fees Estimated Satoshis per bytes to get a transaction included * @returns {ExtrinsicData} A submittable extrinsic and an event that is emitted when extrinsic is submitted. */ setBitcoinFees(fees: Big): ExtrinsicData; /** * @param amount The amount of wrapped tokens to convert * @param currency A `Monetary.js` object * @returns Converted value */ convertWrappedToCurrency(amount: MonetaryAmount, currency: CurrencyExt): Promise>; /** * @param amount The amount of collateral tokens to convert * @returns Converted value */ convertCollateralToWrapped(amount: MonetaryAmount): Promise>; /** * @returns The period of time (in milliseconds) after an oracle's last submission * during which it is considered online */ getOnlineTimeout(): Promise; /** * @param key A key defining an exchange rate or a BTC network fee estimate * @returns Whether the oracle entr for the given key has been updated */ getRawValuesUpdated(key: InterbtcPrimitivesOracleKey): Promise; } export declare class DefaultOracleAPI implements OracleAPI { private api; private wrappedCurrency; constructor(api: ApiPromise, wrappedCurrency: WrappedCurrency); getExchangeRate(currency: CurrencyExt): Promise>; convertWrappedToCurrency(amount: MonetaryAmount, currency: CurrencyExt): Promise>; convertCollateralToWrapped(amount: MonetaryAmount): Promise>; getOnlineTimeout(): Promise; setExchangeRate(exchangeRate: ExchangeRate): ExtrinsicData; getBitcoinFees(): Promise; setBitcoinFees(fees: Big): ExtrinsicData; getSourcesById(): Promise>; getValidUntil(counterCurrency: CurrencyExt): Promise; isOnline(currency: CurrencyExt): Promise; getRawValuesUpdated(key: InterbtcPrimitivesOracleKey): Promise; }