UNPKG

fortress-js

Version:

A JavaScript SDK for Binance Smart Chain and the Fortress Protocol.

35 lines (34 loc) 1.11 kB
/** * @file Price Feed * @desc These methods facilitate interactions with the Open Price Feed smart * contracts. */ /** * Gets an asset's price from the Fortress Protocol open price feed. The price * of the asset can be returned in any other supported asset value, including * all fTokens 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 fortress = new Fortress(window.ethereum); * let price; * * (async function () { * * price = await fortress.getPrice(Fortress.BNB); * console.log('BNB in USD', price); * * price = await fortress.getPrice(Fortress.DAI, Fortress.USDC); // supports fTokens too * console.log('DAI in USDC', price); * * })().catch(console.error); * ``` */ export declare function getPrice(asset: string, inAsset?: string): Promise<number>;