From a83104efff49a2fd40ad4b87cfbcf3ff103ea7da Mon Sep 17 00:00:00 2001 From: MananTank Date: Wed, 24 Sep 2025 21:43:56 +0000 Subject: [PATCH] [MNY-200] SDK: Fix onSuccess callback not called when tx is sent in TransactionWidget (#8119) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR simplifies the `handlePostBuyTransactionComplete` function in the `BridgeOrchestrator` component by removing the `quote` parameter and the associated call to `onComplete`. It streamlines the transaction completion process and adjusts the `closeModal` prop accordingly. ### Detailed summary - Removed the `quote` parameter from the `handlePostBuyTransactionComplete` function. - Eliminated the call to `onComplete?.(quote)` within the `handlePostBuyTransactionComplete` function. - Updated the `closeModal` prop in the `ExecutingTxScreen` component to directly use `handlePostBuyTransactionComplete` without arguments. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../src/react/web/ui/Bridge/BridgeOrchestrator.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx b/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx index f146a0d0eba..f1d5bf9622e 100644 --- a/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +++ b/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx @@ -189,13 +189,9 @@ export function BridgeOrchestrator({ }, [send, uiOptions.mode]); // Handle post-buy transaction completion - const handlePostBuyTransactionComplete = useCallback( - (quote: BridgePrepareResult) => { - onComplete?.(quote); - send({ type: "RESET" }); - }, - [onComplete, send], - ); + const handlePostBuyTransactionComplete = useCallback(() => { + send({ type: "RESET" }); + }, [send]); // Handle errors const handleError = useCallback( @@ -416,9 +412,9 @@ export function BridgeOrchestrator({ quote && uiOptions.transaction && ( handlePostBuyTransactionComplete(quote)} + closeModal={handlePostBuyTransactionComplete} onTxSent={() => { - // Do nothing + onComplete?.(quote); }} tx={uiOptions.transaction} windowAdapter={webWindowAdapter}