Skip to content

Commit 69bf925

Browse files
authored
[SDK] Feature: preferred chan id pay embed (#7296)
1 parent d4aed43 commit 69bf925

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

.changeset/hungry-lions-boil.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Allow forcing onramp chain in buyWithFiat options

packages/thirdweb/src/pay/buyWithFiat/getQuote.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ export type GetBuyWithFiatQuoteParams = {
100100
* @hidden
101101
*/
102102
paymentLinkId?: string;
103+
104+
onrampChainId?: number;
105+
onrampTokenAddress?: string;
103106
};
104107

105108
/**
@@ -326,7 +329,8 @@ export async function getBuyWithFiatQuote(
326329
purchaseData: params.purchaseData,
327330
currency: params.fromCurrencySymbol,
328331
maxSteps: 2,
329-
onrampTokenAddress: NATIVE_TOKEN_ADDRESS, // force onramp to native token to avoid missing gas issues
332+
onrampTokenAddress: params.onrampTokenAddress ?? NATIVE_TOKEN_ADDRESS, // force onramp to native token to avoid missing gas issues
333+
onrampChainId: params.onrampChainId,
330334
paymentLinkId: params.paymentLinkId,
331335
});
332336

packages/thirdweb/src/react/core/hooks/connection/ConnectButtonProps.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ export type PayUIOptions = Prettify<
9999
};
100100
preferredProvider?: FiatProvider;
101101
supportedProviders?: FiatProvider[];
102+
onrampChainId?: number;
103+
onrampTokenAddress?: string;
102104
}
103105
| false;
104106

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ export function FiatScreenContent(props: {
112112
fromAddress: payer.account.address,
113113
paymentLinkId: paymentLinkId,
114114
preferredProvider: preferredProvider ?? supportedProviders[0],
115+
onrampChainId: buyWithFiatOptions?.onrampChainId,
116+
onrampTokenAddress: buyWithFiatOptions?.onrampTokenAddress,
115117
}
116118
: undefined,
117119
);

0 commit comments

Comments
 (0)