Introduction

If you are building any kind of UI application, you most likely want to show the user the USD amount of tokens they are about to bridge. For this the SDK includes a set of function that can provide this data to you.

Usage

You can fetch a USD prices as follows:

// Fetch the price of a single token
const ethPrice = await sdk.api.usdPrices.getTokenPrice('ETH')
console.log(ethPrice)
// => { token: "ETH", price: 4500, timestamp: '<timestamp>'}

In both cases, the timestamp of a token price will tell you how old this specific price is.