UNPKG

@swipewallet/venus-js

Version:

A JavaScript SDK for Ethereum and the Venus Protocol.

35 lines (34 loc) 1.08 kB
/** * @file Price Feed * @desc These methods facilitate interactions with the Open Price Feed smart * contracts. */ /** * Gets an asset's price from the Venus Protocol open price feed. The price * of the asset can be returned in any other supported asset value, including * all vTokens and underlyings. * * @param {string} asset A string of a supported asset in which to find the * current price. * @param {string} [inAsset] A string of a supported asset in which to express * the `asset` parameter's price. This defaults to USD. * * @returns {string} Returns a string of the numeric value of the asset. * * @example * ``` * const venus = new Venus(window.ethereum); * let price; * * (async function () { * * price = await venus.getPrice(Venus.BNB); * console.log('BNB in USD', price); * * price = await venus.getPrice(Venus.SXP, Venus.USDC); // supports vTokens too * console.log('SXP in USDC', price); * * })().catch(console.error); * ``` */ export declare function getPrice(asset: string, inAsset?: string): Promise<number>;