get24HoursUsdRate
Returns the current token USD rate, the previous USD rate from ~24 hours ago, and the percentage change. Also returns a stable cache key and the timestamp used for the historical lookup.
Usage
example.ts
import { mintclub } from 'mint.club-v2-sdk'
const { currentUsdRate, previousUsdRate, changePercent, cacheKey, timestamp } = await mintclub
.network('base')
.token('GMFR')
.get24HoursUsdRate()
// cacheKey can be used to memoize results per token/chain/time bucket
Return Value
Promise<{
currentUsdRate: number | null
previousUsdRate: number | null
changePercent: number | null
cacheKey: string
timestamp: number // unix seconds used for the historical quote
}>
Notes
- Uses the same unified pricing as
getUsdRate()
(bond path for Mint Club tokens; 1inch for nonβMint Club tokens). - Historical block is resolved via DefiLlama block API for the rounded timestamp.
- The cache key format is
usd-rate-<chainId>-<tokenAddress>-<timestamp>
.