GetBuyWithFiatQuoteParams
Parameters for getBuyWithFiatQuote
function
type GetBuyWithFiatQuoteParams = { fromAddress: string; fromAmount?: string; fromCurrencySymbol: "USD" | "CAD" | "GBP" | "EUR"; isTestMode?: boolean; maxSlippageBPS?: number; purchaseData?: object; toAddress: string; toAmount?: string; toChainId: number; toTokenAddress: string;};
A client is the entry point to the thirdweb SDK. It is required for all other actions.
You can create a client using the createThirdwebClient
function.
Refer to the Creating a Client documentation for more information.
The address of the wallet which will be used to buy the token.
type fromAddress = string;
The amount of fiat currency to spend to buy the token. This is useful if you want to buy whatever amount of token you can get for a certain amount of fiat currency.
If you want a certain amount of token, you can provide toAmount
instead of fromAmount
.
type fromAmount = string;
Symbol of the fiat currency to buy the token with.
type fromCurrencySymbol = "USD" | "CAD" | "GBP" | "EUR";
Whether to use on-ramp provider in test mode for testing purpose or not.
Defaults to false
type isTestMode = boolean;
The maximum slippage in basis points (bps) allowed for the transaction.
For example, if you want to allow a maximum slippage of 0.5%, you should specify 50
bps.
type maxSlippageBPS = number;
Extra details to store with the purchase.
This details will be stored with the purchase and can be retrieved later via the status API or Webhook
type purchaseData = object;
The address of the wallet where the tokens will be sent.
type toAddress = string;
The amount of token to buy This is useful if you want to get a certain amount of token.
If you want to buy however much token you can get for a certain amount of fiat currency, you can provide fromAmount
instead of toAmount
.
type toAmount = string;
Chain id of the token to buy.
type toChainId = number;
Token address of the token to buy.
type toTokenAddress = string;