From c570dd9746c8be3c0b3b8bcdb18eff5fc83487ee Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Thu, 7 Aug 2025 18:43:22 -0700 Subject: [PATCH 1/3] fix: adds onExecuteTransaction to TransactionPayment --- .../src/react/web/ui/Bridge/BridgeOrchestrator.tsx | 4 ++-- .../src/react/web/ui/Bridge/TransactionPayment.tsx | 11 ++++------- 2 files changed, 6 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 5ea34974a3f..d0b2e38a9a5 100644 --- a/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +++ b/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx @@ -63,7 +63,7 @@ export type UIOptions = Prettify< ) >; -export interface BridgeOrchestratorProps { +interface BridgeOrchestratorProps { /** * UI configuration and mode */ @@ -288,7 +288,7 @@ export function BridgeOrchestrator({ client={client} connectOptions={modifiedConnectOptions} onContinue={handleRequirementsResolved} - sendEvent={send} + onExecuteTransaction={() => send({ type: "CONTINUE_TO_TRANSACTION" })} showThirdwebBranding={showThirdwebBranding} uiOptions={uiOptions} /> diff --git a/packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx b/packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx index fbc880ac581..b156ad9e649 100644 --- a/packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx +++ b/packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx @@ -20,7 +20,6 @@ import { useChainMetadata } from "../../../core/hooks/others/useChainQuery.js"; import { useTransactionDetails } from "../../../core/hooks/useTransactionDetails.js"; import { useActiveAccount } from "../../../core/hooks/wallets/useActiveAccount.js"; import { useActiveWallet } from "../../../core/hooks/wallets/useActiveWallet.js"; -import type { PaymentMachineEvent } from "../../../core/machines/paymentMachine.js"; import { ConnectButton } from "../ConnectWallet/ConnectButton.js"; import { PoweredByThirdweb } from "../ConnectWallet/PoweredByTW.js"; import { Container, Line } from "../components/basic.js"; @@ -50,9 +49,9 @@ export interface TransactionPaymentProps { onContinue: (amount: string, token: Token, receiverAddress: Address) => void; /** - * Send arbitrary payment events for UI flow control + * Request to execute the transaction immediately (skips funding flow) */ - sendEvent: (event: PaymentMachineEvent) => void; + onExecuteTransaction: () => void; /** * Connect options for wallet connection @@ -70,7 +69,7 @@ export function TransactionPayment({ uiOptions, client, onContinue, - sendEvent, + onExecuteTransaction, connectOptions, showThirdwebBranding = true, }: TransactionPaymentProps) { @@ -391,9 +390,7 @@ export function TransactionPayment({ Number(userBalance) >= Number(transactionDataQuery.data.totalCost) ) { - sendEvent({ - type: "CONTINUE_TO_TRANSACTION", - }); + onExecuteTransaction(); return; } From 41fe40a3711ad1f91044d90da8b3e981eb74164d Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Thu, 7 Aug 2025 20:17:11 -0700 Subject: [PATCH 2/3] fix build --- .../thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx | 2 +- .../thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx b/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx index d0b2e38a9a5..7caf3ebc3c6 100644 --- a/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx +++ b/packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx @@ -63,7 +63,7 @@ export type UIOptions = Prettify< ) >; -interface BridgeOrchestratorProps { +export interface BridgeOrchestratorProps { /** * UI configuration and mode */ diff --git a/packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx b/packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx index 14d84c297a7..c9613223268 100644 --- a/packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx +++ b/packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx @@ -29,7 +29,7 @@ const TransactionPaymentWithTheme = ( const meta = { args: { client: storyClient, - sendEvent: (_event) => {}, + onExecuteTransaction: () => {}, onContinue: (_amount, _token, _receiverAddress) => {}, theme: "dark", uiOptions: TRANSACTION_UI_OPTIONS.ethTransfer, From 5e3d3876e628004ceaaef7ac1276be04e4ca798f Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Thu, 7 Aug 2025 20:20:59 -0700 Subject: [PATCH 3/3] for the love of god --- packages/thirdweb/src/react/core/machines/paymentMachine.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/thirdweb/src/react/core/machines/paymentMachine.ts b/packages/thirdweb/src/react/core/machines/paymentMachine.ts index b0b1915dcb5..6e4a2e903c7 100644 --- a/packages/thirdweb/src/react/core/machines/paymentMachine.ts +++ b/packages/thirdweb/src/react/core/machines/paymentMachine.ts @@ -70,7 +70,7 @@ export interface PaymentMachineContext { /** * Events that can be sent to the payment machine */ -export type PaymentMachineEvent = +type PaymentMachineEvent = | { type: "DESTINATION_CONFIRMED"; destinationToken: Token;