Skip to content

Commit f7ce6be

Browse files
authored
[SDK] Fix: Adds onExecuteTransaction to TransactionPayment (#7816)
1 parent 52d1ba3 commit f7ce6be

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

packages/thirdweb/src/react/core/machines/paymentMachine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export interface PaymentMachineContext {
7070
/**
7171
* Events that can be sent to the payment machine
7272
*/
73-
export type PaymentMachineEvent =
73+
type PaymentMachineEvent =
7474
| {
7575
type: "DESTINATION_CONFIRMED";
7676
destinationToken: Token;

packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export function BridgeOrchestrator({
288288
client={client}
289289
connectOptions={modifiedConnectOptions}
290290
onContinue={handleRequirementsResolved}
291-
sendEvent={send}
291+
onExecuteTransaction={() => send({ type: "CONTINUE_TO_TRANSACTION" })}
292292
showThirdwebBranding={showThirdwebBranding}
293293
uiOptions={uiOptions}
294294
/>

packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { useChainMetadata } from "../../../core/hooks/others/useChainQuery.js";
2020
import { useTransactionDetails } from "../../../core/hooks/useTransactionDetails.js";
2121
import { useActiveAccount } from "../../../core/hooks/wallets/useActiveAccount.js";
2222
import { useActiveWallet } from "../../../core/hooks/wallets/useActiveWallet.js";
23-
import type { PaymentMachineEvent } from "../../../core/machines/paymentMachine.js";
2423
import { ConnectButton } from "../ConnectWallet/ConnectButton.js";
2524
import { PoweredByThirdweb } from "../ConnectWallet/PoweredByTW.js";
2625
import { Container, Line } from "../components/basic.js";
@@ -50,9 +49,9 @@ export interface TransactionPaymentProps {
5049
onContinue: (amount: string, token: Token, receiverAddress: Address) => void;
5150

5251
/**
53-
* Send arbitrary payment events for UI flow control
52+
* Request to execute the transaction immediately (skips funding flow)
5453
*/
55-
sendEvent: (event: PaymentMachineEvent) => void;
54+
onExecuteTransaction: () => void;
5655

5756
/**
5857
* Connect options for wallet connection
@@ -70,7 +69,7 @@ export function TransactionPayment({
7069
uiOptions,
7170
client,
7271
onContinue,
73-
sendEvent,
72+
onExecuteTransaction,
7473
connectOptions,
7574
showThirdwebBranding = true,
7675
}: TransactionPaymentProps) {
@@ -391,9 +390,7 @@ export function TransactionPayment({
391390
Number(userBalance) >=
392391
Number(transactionDataQuery.data.totalCost)
393392
) {
394-
sendEvent({
395-
type: "CONTINUE_TO_TRANSACTION",
396-
});
393+
onExecuteTransaction();
397394
return;
398395
}
399396

packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const TransactionPaymentWithTheme = (
2929
const meta = {
3030
args: {
3131
client: storyClient,
32-
sendEvent: (_event) => {},
32+
onExecuteTransaction: () => {},
3333
onContinue: (_amount, _token, _receiverAddress) => {},
3434
theme: "dark",
3535
uiOptions: TRANSACTION_UI_OPTIONS.ethTransfer,

0 commit comments

Comments
 (0)