TypeScript SDK
GetBuyWithFiatQuoteParams
Parameters for getBuyWithFiatQuote function
type GetBuyWithFiatQuoteParams = { fromAddress: string; fromAmount?: string; fromCurrencySymbol: CurrencyMeta["shorthand"]; isTestMode?: boolean; maxSlippageBPS?: number; onrampChainId?: number; onrampTokenAddress?: string; paymentLinkId?: string; preferredProvider?: FiatProvider; purchaseData?: PurchaseData; toAddress: string; toAmount?: string; toChainId: number; toGasAmountWei?: string; 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 = CurrencyMeta["shorthand"];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;type onrampChainId = number;type onrampTokenAddress = string;type paymentLinkId = string;Optional parameter to specify the preferred onramp provider.
By default, we choose a recommended provider based on the location of the user, KYC status, and currency.
type preferredProvider = FiatProvider;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 = PurchaseData;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;Optional parameter to onramp gas with the purchase If native token, will onramp extra native token amount If erc20, will onramp native token + erc20
type toGasAmountWei = string;Token address of the token to buy.
type toTokenAddress = string;