AIOT Payment x402 is in public beta. Install the skill for your AI agent.
ReferencePriceConverter

Class: PriceConverter

Defined in: price/converter.ts:12

Constructors

Constructor

new PriceConverter(logger): PriceConverter

Defined in: price/converter.ts:16

Parameters

logger

Logger

Returns

PriceConverter

Methods

fiatToUsdc()

fiatToUsdc(amount, currency?): Promise<{ rate: number; usdcAmount: string; }>

Defined in: price/converter.ts:24

Convert a fiat amount to USDC smallest unit (6 decimals). Uses ceiling rounding so the merchant never receives less than expected.

Parameters

amount

string

currency?

string = "usd"

Returns

Promise<{ rate: number; usdcAmount: string; }>


formatUsdc()

formatUsdc(usdcAmount): string

Defined in: price/converter.ts:51

Format USDC smallest unit to human-readable string.

Parameters

usdcAmount

string

Returns

string