BuyWithFiatQuote
The response object returned by the getBuyWithFiatQuote
function.
This includes various information for buying a token using a fiat currency:
on-ramp provider UI link
The estimated time for the transaction to complete.
The on-ramp and destination token information.
Processing fees
type BuyWithFiatQuote = { estimatedDurationSeconds: number; estimatedToAmountMin: string; estimatedToAmountMinWei: string; fromAddress: string; fromCurrency: { amount: string; amountUnits: string; currencySymbol: string; decimals: number; }; fromCurrencyWithFees: { amount: string; amountUnits: string; currencySymbol: string; decimals: number; }; gasToken?: { amount: string; amountUSDCents: number; amountWei: string; token: { chainId: number; decimals: number; name: string; priceUSDCents: number; symbol: string; tokenAddress: string; }; }; intentId: string; maxSlippageBPS: number; onRampLink: string; onRampToken: { amount: string; amountUSDCents: number; amountWei: string; token: { chainId: number; decimals: number; name: string; priceUSDCents: number; symbol: string; tokenAddress: string; }; }; processingFees: Array<{ amount: string; amountUnits: string; currencySymbol: string; decimals: number; feeType: "ON_RAMP" | "NETWORK"; }>; toAddress: string; toAmountMin: string; toAmountMinWei: string; toToken: { chainId: number; decimals: number; name?: string; priceUSDCents?: number; symbol?: string; tokenAddress: string; };};
Estimated time for the transaction to complete in seconds.
type estimatedDurationSeconds = number;
Minimum amount of token that is expected to be received in units.
type estimatedToAmountMin = string;
Minimum amount of token that is expected to be received in wei.
type estimatedToAmountMinWei = string;
Address of the wallet used for buying the token.
type fromAddress = string;
fiat currency used to buy the token - excluding the fees.
type fromCurrency = { amount: string; amountUnits: string; currencySymbol: string; decimals: number;};
Fiat currency used to buy the token - including the fees.
type fromCurrencyWithFees = { amount: string; amountUnits: string; currencySymbol: string; decimals: number;};
Gas Token that will be sent to the user's wallet address by the on-ramp provider.
Only used for ERC20 + Gas on-ramp flow. This will hold the details of the gas token and amount sent for gas.
In Native Currency case, extra for gas will be added to the output amount of the onramp.
type gasToken = { amount: string; amountUSDCents: number; amountWei: string; token: { chainId: number; decimals: number; name: string; priceUSDCents: number; symbol: string; tokenAddress: string; };};
Id of transaction
type intentId = string;
The maximum slippage in basis points (bps) allowed for the transaction.
type maxSlippageBPS = number;
Token that will be sent to the user's wallet address by the on-ramp provider.
If the token is same as toToken
- the user can directly buy the token from the on-ramp provider.
If not, the user will receive this token and a swap is required to convert it toToken
.
type onRampToken = { amount: string; amountUSDCents: number; amountWei: string; token: { chainId: number; decimals: number; name: string; priceUSDCents: number; symbol: string; tokenAddress: string; };};
Array of processing fees for the transaction.
This includes the processing fees for on-ramp and swap (if required).
type processingFees = Array<{ amount: string; amountUnits: string; currencySymbol: string; decimals: number; feeType: "ON_RAMP" | "NETWORK";}>;
Address of the wallet to which the tokens will be sent.
type toAddress = string;
Amount of token that is expected to be received in wei.
(estimatedToAmountMin - maxSlippageWei)
type toAmountMin = string;
Amount of token that is expected to be received in units.
(estimatedToAmountMinWei - maxSlippageWei)
type toAmountMinWei = string;
Token information for the desired token. (token the user wants to buy)
type toToken = { chainId: number; decimals: number; name?: string; priceUSDCents?: number; symbol?: string; tokenAddress: string;};