Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 557f0e2

Browse files
authored
Fix: Add brief pause after onramp (#8052)
1 parent f9bbf81 commit 557f0e2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changeset/floppy-clocks-wave.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+
Prevents incorrect failures in widget onramps.

packages/thirdweb/src/react/core/hooks/useStepExecutor.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,11 @@ export function useStepExecutor(
372372

373373
const status = statusResult.status;
374374
if (status === "COMPLETED") {
375+
/*
376+
* The occasional race condition can happen where the onramp provider gives us completed status before the token balance has updated in our RPC.
377+
* We add this pause so the simulation doesn't fail on the next step.
378+
*/
379+
await new Promise((resolve) => setTimeout(resolve, 2000));
375380
setOnrampStatus("completed");
376381
// Add type field for discriminated union
377382
const typedStatusResult = {

0 commit comments

Comments
 (0)