30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import { ITornadoPriceOracle, Token, TokenPrices } from './types';
|
|
import { ChainId } from './config';
|
|
export declare class TokenPriceOracle implements ITornadoPriceOracle {
|
|
private tokens;
|
|
private defaultTokenPrices;
|
|
private oracle;
|
|
private multiCall;
|
|
private provider;
|
|
/**
|
|
* Constructs TokenPriceOracle class instance
|
|
* @param {string} rpcUrl http RPC (Ethereum Mainnet) url to fetch token prices from contract
|
|
* @param {Token[]} [tokens] Array of tokens
|
|
* @param {TokenPrices} [defaultTokenPrices] Default token prices, fallback if nothing loaded from contract
|
|
*/
|
|
constructor(rpcUrl: string, tokens?: Token[], defaultTokenPrices?: TokenPrices, chainId?: ChainId);
|
|
get defaultPrices(): TokenPrices;
|
|
/**
|
|
* Prepare data for MultiCall contract
|
|
* @param {Token[]} [tokens] Tokens array
|
|
* @returns Valid structure to provide to MultiCall contract
|
|
*/
|
|
private prepareCallData;
|
|
/**
|
|
* Fetch actual tokens price rate to ETH from offchain oracles
|
|
* @param {Token[]} [tokens] Token array
|
|
* @returns {TokenPrices} Object with token price rate to ETH in WEI
|
|
*/
|
|
fetchPrices(tokens?: Token[]): Promise<TokenPrices>;
|
|
}
|