Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preferredProvider option for thirdweb pay #103

Merged
merged 4 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Thirdweb.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@
// Console.WriteLine($"Supported currencies: {JsonConvert.SerializeObject(supportedCurrencies, Formatting.Indented)}");

// // Get a Buy with Fiat quote
// var fiatQuoteParamsWithProvider = new BuyWithFiatQuoteParams(fromCurrencySymbol: "USD", toAddress: walletAddress, toChainId: "137", toTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, toAmount: "20", preferredProvider: "STRIPE");
// var fiatQuoteParams = new BuyWithFiatQuoteParams(fromCurrencySymbol: "USD", toAddress: walletAddress, toChainId: "137", toTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, toAmount: "20");
// var fiatOnrampQuote = await ThirdwebPay.GetBuyWithFiatQuote(client, fiatQuoteParams);
// Console.WriteLine($"Fiat onramp quote: {JsonConvert.SerializeObject(fiatOnrampQuote, Formatting.Indented)}");
Expand Down
1 change: 1 addition & 0 deletions Thirdweb/Thirdweb.Pay/ThirdwebPay.GetBuyWithFiatQuote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static async Task<BuyWithFiatQuoteResult> GetBuyWithFiatQuote(ThirdwebCli
{ "toTokenAddress", buyWithFiatParams.ToTokenAddress },
{ "toAmount", buyWithFiatParams.ToAmount },
{ "toAmountWei", buyWithFiatParams.ToAmountWei },
{ "preferredProvider", buyWithFiatParams.PreferredProvider },
{ "maxSlippageBPS", buyWithFiatParams.MaxSlippageBPS?.ToString() }
};

Expand Down
8 changes: 7 additions & 1 deletion Thirdweb/Thirdweb.Pay/Types.GetBuyWithFiatQuote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class BuyWithFiatQuoteParams(
string toAmount = null,
string toAmountWei = null,
double? maxSlippageBPS = null,
bool isTestMode = false
bool isTestMode = false,
string preferredProvider = null
)
{
/// <summary>
Expand All @@ -39,6 +40,11 @@ public class BuyWithFiatQuoteParams(
[JsonProperty("fromAmountUnits")]
public string FromAmountUnits { get; set; } = fromAmountUnits;

/// <summary>
/// The provider to use on the application for thirdweb pay
/// </summary>
[JsonProperty("preferredProvider")]
public string PreferredProvider { get; set; } = preferredProvider;
/// <summary>
/// The address to receive the purchased tokens.
/// </summary>
Expand Down
Loading