MCPcopy Index your code
hub / github.com/codeaashu/claude-code / tokenAmountToUSD

Function tokenAmountToUSD

src/services/x402/client.ts:29–31  ·  view source on GitHub ↗

Convert token amount (smallest unit) to USD, assuming 1 USDC = 1 USD

(amount: string)

Source from the content-addressed store, hash-verified

27
28/** Convert token amount (smallest unit) to USD, assuming 1 USDC = 1 USD */
29function tokenAmountToUSD(amount: string): number {
30 return parseInt(amount, 10) / 10 ** USDC_DECIMALS
31}
32
33/**
34 * Parse the X-Payment-Required header from a 402 response.

Callers 2

handlePaymentRequiredFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected