Skip to content

getUsdRate

Returns the estimated UsdRate from OneInch spot aggregator Contract.

Usage

example.ts
import { mintclub } from 'mint.club-v2-sdk'
 
const usdRate = await mintclub.network('ethereum').token('0x...').getUsdRate(100)

Return Value

Promise<
{
	usdRate: null | number,
	stableCoin: null | {
		address: '0x${string}',
		symbol: string,
		decimals: number
	}
}>

The estimated UsdRate and stable coin used from OneInch spot aggregator Contract.

Returns null if the aggregator contract does not exist on the chain.

Parameters

amount (optional)

  • Type: number
  • Default: 1

The amount of the token to be converted to USD. If not provided, the default value is 1.