GetBuyWithFiatQuote
Get a quote containing an intent id and onramp link for a fiat to crypto swap.
using Thirdweb.Pay;var connectedAddress = await wallet.GetAddress();var fiatQuoteParams = new BuyWithFiatQuoteParams(fromCurrencySymbol: "USD", // US DollartoAddress: connectedAddress, // Receiver addresstoChainId: "137", toTokenAddress: Thirdweb.Constants.NATIVE_TOKEN_ADDRESS, // MATICtoAmount: "20" // I want to buy 20 MATIC);var quote = await ThirdwebPay.GetBuyWithFiatQuote(client, fiatQuoteParams);
ThirdwebClient
: The Thirdweb client instance.
A BuyWithFiatQuoteParams
object (with a helpful constructor) containing the following properties:
string fromCurrencySymbol; // Currency symbol of the from tokenstring toAddress; // Address executing the swapstring toChainId; // Chain ID of the to tokenstring toTokenAddress; // Address of the to tokenstring fromAmount; // Optional, amount of from tokenstring fromAmountUnits; // Optional, amount of from token in unitsstring toAmount; // Optional, amount of to tokenstring toAmountWei; // Optional, amount of to token in weidouble? maxSlippageBPS; // Optional, maximum slippage in basis pointsbool isTestMode; // Optional, enters test mode onramp flow, defaults to false
A BuyWithFiatQuoteResult
object containing the following properties:
string IntentId; // Intent identifier used to track the onramp statusstring ToAddress; // Address to receive the tokensOnRampCurrency FromCurrency; // OnRamp Currency detailsOnRampCurrency FromCurrencyWithFees; // OnRamp Currency details with feesOnRampToken OnRampToken; // OnRamp Token detailsstring Provider; // Onramp providerToken ToToken; // Token details of the to tokenstring EstimatedToAmountMinWei; // Estimated to token amount received min in weistring EstimatedToAmountMin; // Estimated to token amount received minList<OnRampFees> ProcessingFees; // Processing fee detailsstring EstimatedDurationSeconds; // Estimated onramp duration in secondsdouble MaxSlippageBPS; // Maximum slippage in basis pointsstring OnRampLink; // Onramp link that will be used to trigger the onramp flow