Skip to content

[SDK] Feature: preferred chan id pay embed #7296

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

Merged
merged 2 commits into from
Jun 6, 2025
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
5 changes: 5 additions & 0 deletions .changeset/hungry-lions-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Allow forcing onramp chain in buyWithFiat options
6 changes: 5 additions & 1 deletion packages/thirdweb/src/pay/buyWithFiat/getQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
* @hidden
*/
paymentLinkId?: string;

onrampChainId?: number;
onrampTokenAddress?: string;
};

/**
Expand Down Expand Up @@ -326,7 +329,8 @@
purchaseData: params.purchaseData,
currency: params.fromCurrencySymbol,
maxSteps: 2,
onrampTokenAddress: NATIVE_TOKEN_ADDRESS, // force onramp to native token to avoid missing gas issues
onrampTokenAddress: params.onrampTokenAddress ?? NATIVE_TOKEN_ADDRESS, // force onramp to native token to avoid missing gas issues
onrampChainId: params.onrampChainId,

Check warning on line 333 in packages/thirdweb/src/pay/buyWithFiat/getQuote.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/pay/buyWithFiat/getQuote.ts#L332-L333

Added lines #L332 - L333 were not covered by tests
paymentLinkId: params.paymentLinkId,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export type PayUIOptions = Prettify<
};
preferredProvider?: FiatProvider;
supportedProviders?: FiatProvider[];
onrampChainId?: number;
onrampTokenAddress?: string;
}
| false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
fromAddress: payer.account.address,
paymentLinkId: paymentLinkId,
preferredProvider: preferredProvider ?? supportedProviders[0],
onrampChainId: buyWithFiatOptions?.onrampChainId,
onrampTokenAddress: buyWithFiatOptions?.onrampTokenAddress,

Check warning on line 116 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx#L115-L116

Added lines #L115 - L116 were not covered by tests
}
: undefined,
);
Expand Down
Loading