import { ApiClient } from '../.'; import BigNumber from 'bignumber.js'; export declare enum OracleRawPriceState { LIVE = "live", EXPIRED = "expired" } /** * Oracle RPCs for DeFi Blockchain */ export declare class Oracle { private readonly client; constructor(client: ApiClient); /** * Creates a price oracle for rely of real time price data. * * @param {string} address * @param {OraclePriceFeed[]} priceFeeds * @param {AppointOracleOptions} [options] * @param {number} options.weightage * @param {UTXO[]} [options.utxos = []] * @param {string} [options.utxos.txid] * @param {number} [options.utxos.vout] * @return {Promise} oracleId, also the txn id for txn created to appoint oracle */ appointOracle(address: string, priceFeeds: OraclePriceFeed[], options?: AppointOracleOptions): Promise; /** * Removes oracle. * * @param {string} oracleId * @param {UTXO[]} [utxos = []] * @param {string} [utxos.txid] * @param {number} [utxos.vout] * @return {Promise} txid */ removeOracle(oracleId: string, utxos?: UTXO[]): Promise; /** * Update a price oracle for rely of real time price data. * * @param {string} oracleId * @param {string} address * @param {UpdateOracleOptions} [options] * @param {OraclePriceFeed[]} options.priceFeeds * @param {number} options.weightage * @param {UTXO[]} [options.utxos = []] * @param {string} [options.utxos.txid] * @param {number} [options.utxos.vout] * @return {Promise} txid */ updateOracle(oracleId: string, address: string, options?: UpdateOracleOptions): Promise; /** * Set oracle data transaction. * * @param {string} oracleId * @param {number} timestamp timestamp in seconds * @param {SetOracleDataOptions} [options] * @param {OraclePrice[]} options.prices * @param {UTXO[]} [options.utxos = []] * @param {string} [options.utxos.txid] * @param {number} [options.utxos.vout] * @return {Promise} txid */ setOracleData(oracleId: string, timestamp: number, options?: SetOracleDataOptions): Promise; /** * Returns oracle data. * * @param {string} oracleId * @return {Promise} */ getOracleData(oracleId: string): Promise; /** * Returns array of oracle ids. * * @return {Promise} */ listOracles(): Promise; /** * Returns latest raw price updates from oracles. * * @param {OraclePriceFeed} [priceFeed] * @return {Promise} */ listLatestRawPrices(priceFeed?: OraclePriceFeed): Promise; /** * Returns aggregated price from oracles. * * @param {OraclePriceFeed} priceFeed * @return {Promise} */ getPrice(priceFeed: OraclePriceFeed): Promise; /** * List all aggregated prices. * * @param {string} [startIndex] Optional first key to iterate from, in lexicographical order. * @param {string} [includingStart] If true, then iterate including starting position. False by default * @param {string} [limit] Maximum number of orders to return, 100 by default * @return {Promise} Array of list price data objects */ listPrices(startIndex?: number, includingStart?: boolean, limit?: number): Promise; /** * Get fixed interval price. * * @param {string} id Price feed id * @return {Promsie} */ getFixedIntervalPrice(id: string): Promise; /** * List all fixed interval prices. * * @param {FixedIntervalPricePagination} pagination * @param {string} [pagination.start] * @param {string} [pagination.limit = 100] Maximum number of orders to return. * @return {Promise; /** * Get the next block that futures will execute and update on. * * @return {Promise} */ getFutureSwapBlock(): Promise; } export interface AppointOracleOptions { weightage?: number; utxos?: UTXO[]; } export interface UpdateOracleOptions { priceFeeds?: OraclePriceFeed[]; weightage?: number; utxos?: UTXO[]; } export interface SetOracleDataOptions { prices?: OraclePrice[]; utxos?: UTXO[]; } export interface OracleData { oracleid: string; address: string; priceFeeds: OraclePriceFeed[]; tokenPrices: OracleTokenPrice[]; weightage: number; } export interface OracleRawPrice { oracleid: string; priceFeeds: OraclePriceFeed; rawprice: BigNumber; weightage: BigNumber; state: OracleRawPriceState; timestamp: BigNumber; } export interface OraclePriceFeed { token: string; currency: string; } export interface OraclePrice { tokenAmount: string; currency: string; } export interface UTXO { txid: string; vout: number; } export interface OracleTokenPrice { token: string; currency: string; /** * @example 0.5 */ amount: number; /** * @example 1623161076 is an Epoch time which every digit represents a second. */ timestamp: number; } export interface ListPricesData { token: string; currency: string; /** * @example new BigNumber(0.83333333000000) */ price?: BigNumber; /** * @example true or display error msg if false */ ok: boolean | string; } export interface FixedIntervalPrice { activePriceBlock: number; nextPriceBlock: number; fixedIntervalPriceId: string; activePrice: BigNumber; nextPrice: BigNumber; timestamp: number; isLive: boolean; } export interface ListFixedIntervalPrice { priceFeedId: string; activePrice: BigNumber; nextPrice: BigNumber; timestamp: number; isLive: boolean; } export interface FixedIntervalPricePagination { start?: string; limit?: number; } //# sourceMappingURL=oracle.d.ts.map