Skip to content

Commit cad76df

Browse files
committed
fix: onramp improvements
1 parent efceadd commit cad76df

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

.changeset/puny-breads-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": minor
3+
---
4+
5+
Several onramp embed improvements

apps/playground-web/src/components/pay/embed.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export function StyledPayEmbedPreview() {
1818
<div className="flex flex-col items-center justify-center">
1919
<StyledConnectButton
2020
chains={[base, defineChain(466), arbitrum, treasure, arbitrumNova]}
21+
accountAbstraction={{
22+
sponsorGas: true,
23+
chain: base,
24+
}}
2125
supportedTokens={{
2226
466: [
2327
{

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ function useOnRampScreenState(props: {
426426
} else if (swapQuoteQuery.data && !swapTxHash) {
427427
// Execute swap/bridge
428428
try {
429+
// Pause to handle any free tier rate limit
430+
await new Promise((resolve) => setTimeout(resolve, 1_000));
431+
// The quote is likely stale, so refetch it
432+
await swapQuoteQuery.refetch();
429433
const result = await swapMutation.mutateAsync({
430434
quote: swapQuoteQuery.data,
431435
});
@@ -440,7 +444,7 @@ function useOnRampScreenState(props: {
440444
// retry the quote step
441445
setSwapTxHash(undefined);
442446
swapMutation.reset();
443-
swapQuoteQuery.refetch();
447+
await swapQuoteQuery.refetch();
444448
}
445449
}, [
446450
isDone,

packages/thirdweb/src/utils/promise/resolve-promised-value.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
export async function resolvePromisedValue<V>(
1111
value: V,
1212
): Promise<V extends () => Promise<infer R> ? R : V> {
13-
// @ts-expect-error - this works fine, but TS doesn't like it since 5.8
1413
return typeof value === "function" ? await value() : value;
1514
}
1615

0 commit comments

Comments
 (0)