import { ApiPromise } from "@polkadot/api"; import { AddressOrPair } from "@polkadot/api/types"; import Big from "big.js"; import BN from "bn.js"; import { DefaultTransactionAPI, TransactionAPI } from "./transaction"; export declare type BtcTxFees = { fast: number; half: number; hour: number; }; /** * @category PolkaBTC Bridge * The type Big represents DOT or PolkaBTC denominations, * while the type BN represents Planck or Satoshi denominations. */ export interface OracleAPI extends TransactionAPI { /** * @returns The DOT/BTC exchange rate */ getExchangeRate(): Promise; /** * Obtains the current fees for BTC transactions, in satoshi/byte. * @returns An object with the values `fast` (estimated fee for inclusion * in the next block - about 10 minutes), `half` (fee for the next 3 blocks or ~30 minutes) * and `hour` (fee for inclusion in the next 6 blocks, or ~60 minutes). */ getBtcTxFeesPerByte(): Promise; /** * @returns The feed name (such as "DOT/BTC") */ getFeed(): Promise; /** * @returns Last exchange rate time */ getLastExchangeRateTime(): Promise; /** * @returns A map from the oracle's account id to its name */ getSourcesById(): Promise>; /** * @returns Boolean value indicating whether the oracle is online */ isOnline(): Promise; /** * Send a transaction to set the DOT/BTC exchange rate * @param exchangeRate The rate to set */ setExchangeRate(exchangeRate: string): Promise; /** * Send a transaction to set the current fee rates for BTC transactions * @param fees.fast Estimated Satoshis per bytes to get included in the next block (~10 min) * @param fees.half Estimated Satoshis per bytes to get included in the next 3 blocks (~half hour) * @param fees.hour Estimated Satoshis per bytes to get included in the next 6 blocks (~hour) */ setBtcTxFeesPerByte(fees: BtcTxFees): Promise; /** * @returns The Planck/Satoshi exchange rate */ getRawExchangeRate(): Promise; /** * @returns Convert a Satoshi amount to Planck */ convertSatoshiToPlanck(amount: BN): Promise; /** * @returns Convert a Bitcoin amount to Dot */ convertBitcoinToDot(amount: Big): Promise; /** * @returns The period of time (in milliseconds) after an oracle's last submission * during which it is considered online */ getOnlineTimeout(): Promise; } export declare class DefaultOracleAPI extends DefaultTransactionAPI implements OracleAPI { constructor(api: ApiPromise, account?: AddressOrPair); convertSatoshiToPlanck(amount: BN): Promise; convertBitcoinToDot(amount: Big): Promise; getExchangeRate(): Promise; getOnlineTimeout(): Promise; getRawExchangeRate(): Promise; setExchangeRate(dotPerBtc: string): Promise; getBtcTxFeesPerByte(): Promise; setBtcTxFeesPerByte({ fast, half, hour }: BtcTxFees): Promise; getSourcesById(): Promise>; getFeed(): Promise; getLastExchangeRateTime(): Promise; isOnline(): Promise; private hasOracleError; private convertMoment; private convertFromRawExchangeRate; }