import type { Address } from "abitype"; import type { Chain } from "../../chains/types.js"; import type { ThirdwebClient } from "../../client/client.js"; import type { SupportedFiatCurrency } from "./type.js"; /** * Props for the `convertFiatToCrypto` function * @buyCrypto */ export type ConvertFiatToCryptoParams = { client: ThirdwebClient; /** * The fiat symbol. e.g: "USD" */ from: SupportedFiatCurrency; /** * The total amount of fiat to convert * e.g: If you want to convert 2 cents to USD, enter `0.02` */ fromAmount: number; /** * The token address * For native token, use NATIVE_TOKEN_ADDRESS */ to: Address; /** * The chain that the token is deployed to */ chain: Chain; }; /** * Convert a fiat value to a token. * Currently only USD is supported. * @example * ### Basic usage * ```ts * import { convertFiatToCrypto } from "thirdweb/pay"; * * // Convert 2 cents to ETH * const result = await convertFiatToCrypto({ * from: "USD", * // the token address. For native token, use NATIVE_TOKEN_ADDRESS * to: "0x...", * // the chain (of the chain where the token belong to) * chain: ethereum, * // 2 cents * fromAmount: 0.02, * }); * ``` * Result: `{ result: 0.0000057 }` * @buyCrypto */ export declare function convertFiatToCrypto(options: ConvertFiatToCryptoParams): Promise<{ result: number; }>; //# sourceMappingURL=fiatToCrypto.d.ts.map