thirdweb 5.98.2 → 5.99.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/cjs/exports/react.js +11 -8
  2. package/dist/cjs/exports/react.js.map +1 -1
  3. package/dist/cjs/exports/react.native.js +11 -8
  4. package/dist/cjs/exports/react.native.js.map +1 -1
  5. package/dist/cjs/exports/wallets/eip5792.js +7 -3
  6. package/dist/cjs/exports/wallets/eip5792.js.map +1 -1
  7. package/dist/cjs/react/core/hooks/wallets/useCapabilities.js +5 -6
  8. package/dist/cjs/react/core/hooks/wallets/useCapabilities.js.map +1 -1
  9. package/dist/cjs/react/core/hooks/wallets/useSendAndConfirmCalls.js +99 -0
  10. package/dist/cjs/react/core/hooks/wallets/useSendAndConfirmCalls.js.map +1 -0
  11. package/dist/cjs/react/core/hooks/wallets/useSendCalls.js +32 -40
  12. package/dist/cjs/react/core/hooks/wallets/useSendCalls.js.map +1 -1
  13. package/dist/cjs/react/core/hooks/wallets/useWaitForCallsReceipt.js +38 -0
  14. package/dist/cjs/react/core/hooks/wallets/useWaitForCallsReceipt.js.map +1 -0
  15. package/dist/cjs/react/core/providers/thirdweb-provider.js +4 -3
  16. package/dist/cjs/react/core/providers/thirdweb-provider.js.map +1 -1
  17. package/dist/cjs/version.js +1 -1
  18. package/dist/cjs/wallets/coinbase/coinbase-web.js +2 -85
  19. package/dist/cjs/wallets/coinbase/coinbase-web.js.map +1 -1
  20. package/dist/cjs/wallets/eip5792/get-calls-status.js +54 -15
  21. package/dist/cjs/wallets/eip5792/get-calls-status.js.map +1 -1
  22. package/dist/cjs/wallets/eip5792/get-capabilities.js +21 -8
  23. package/dist/cjs/wallets/eip5792/get-capabilities.js.map +1 -1
  24. package/dist/cjs/wallets/eip5792/send-and-confirm-calls.js +41 -0
  25. package/dist/cjs/wallets/eip5792/send-and-confirm-calls.js.map +1 -0
  26. package/dist/cjs/wallets/eip5792/send-calls.js +27 -14
  27. package/dist/cjs/wallets/eip5792/send-calls.js.map +1 -1
  28. package/dist/cjs/wallets/eip5792/show-calls-status.js +8 -7
  29. package/dist/cjs/wallets/eip5792/show-calls-status.js.map +1 -1
  30. package/dist/cjs/wallets/eip5792/{wait-for-bundle.js → wait-for-calls-receipt.js} +23 -10
  31. package/dist/cjs/wallets/eip5792/wait-for-calls-receipt.js.map +1 -0
  32. package/dist/cjs/wallets/in-app/core/eip5972/in-app-wallet-calls.js +15 -10
  33. package/dist/cjs/wallets/in-app/core/eip5972/in-app-wallet-calls.js.map +1 -1
  34. package/dist/cjs/wallets/in-app/core/eip5972/in-app-wallet-capabilities.js +13 -3
  35. package/dist/cjs/wallets/in-app/core/eip5972/in-app-wallet-capabilities.js.map +1 -1
  36. package/dist/cjs/wallets/smart/lib/smart-wallet-capabilities.js +4 -2
  37. package/dist/cjs/wallets/smart/lib/smart-wallet-capabilities.js.map +1 -1
  38. package/dist/esm/exports/react.js +5 -3
  39. package/dist/esm/exports/react.js.map +1 -1
  40. package/dist/esm/exports/react.native.js +5 -3
  41. package/dist/esm/exports/react.native.js.map +1 -1
  42. package/dist/esm/exports/wallets/eip5792.js +3 -1
  43. package/dist/esm/exports/wallets/eip5792.js.map +1 -1
  44. package/dist/esm/react/core/hooks/wallets/useCapabilities.js +5 -6
  45. package/dist/esm/react/core/hooks/wallets/useCapabilities.js.map +1 -1
  46. package/dist/esm/react/core/hooks/wallets/useSendAndConfirmCalls.js +96 -0
  47. package/dist/esm/react/core/hooks/wallets/useSendAndConfirmCalls.js.map +1 -0
  48. package/dist/esm/react/core/hooks/wallets/useSendCalls.js +32 -40
  49. package/dist/esm/react/core/hooks/wallets/useSendCalls.js.map +1 -1
  50. package/dist/esm/react/core/hooks/wallets/useWaitForCallsReceipt.js +35 -0
  51. package/dist/esm/react/core/hooks/wallets/useWaitForCallsReceipt.js.map +1 -0
  52. package/dist/esm/react/core/providers/thirdweb-provider.js +4 -3
  53. package/dist/esm/react/core/providers/thirdweb-provider.js.map +1 -1
  54. package/dist/esm/version.js +1 -1
  55. package/dist/esm/wallets/coinbase/coinbase-web.js +2 -81
  56. package/dist/esm/wallets/coinbase/coinbase-web.js.map +1 -1
  57. package/dist/esm/wallets/eip5792/get-calls-status.js +54 -15
  58. package/dist/esm/wallets/eip5792/get-calls-status.js.map +1 -1
  59. package/dist/esm/wallets/eip5792/get-capabilities.js +22 -9
  60. package/dist/esm/wallets/eip5792/get-capabilities.js.map +1 -1
  61. package/dist/esm/wallets/eip5792/send-and-confirm-calls.js +38 -0
  62. package/dist/esm/wallets/eip5792/send-and-confirm-calls.js.map +1 -0
  63. package/dist/esm/wallets/eip5792/send-calls.js +28 -15
  64. package/dist/esm/wallets/eip5792/send-calls.js.map +1 -1
  65. package/dist/esm/wallets/eip5792/show-calls-status.js +9 -8
  66. package/dist/esm/wallets/eip5792/show-calls-status.js.map +1 -1
  67. package/dist/esm/wallets/eip5792/{wait-for-bundle.js → wait-for-calls-receipt.js} +22 -9
  68. package/dist/esm/wallets/eip5792/wait-for-calls-receipt.js.map +1 -0
  69. package/dist/esm/wallets/in-app/core/eip5972/in-app-wallet-calls.js +15 -10
  70. package/dist/esm/wallets/in-app/core/eip5972/in-app-wallet-calls.js.map +1 -1
  71. package/dist/esm/wallets/in-app/core/eip5972/in-app-wallet-capabilities.js +13 -3
  72. package/dist/esm/wallets/in-app/core/eip5972/in-app-wallet-capabilities.js.map +1 -1
  73. package/dist/esm/wallets/smart/lib/smart-wallet-capabilities.js +4 -2
  74. package/dist/esm/wallets/smart/lib/smart-wallet-capabilities.js.map +1 -1
  75. package/dist/types/exports/react.d.ts +4 -3
  76. package/dist/types/exports/react.d.ts.map +1 -1
  77. package/dist/types/exports/react.native.d.ts +4 -3
  78. package/dist/types/exports/react.native.d.ts.map +1 -1
  79. package/dist/types/exports/wallets/eip5792.d.ts +3 -1
  80. package/dist/types/exports/wallets/eip5792.d.ts.map +1 -1
  81. package/dist/types/react/core/hooks/wallets/useCapabilities.d.ts +1 -0
  82. package/dist/types/react/core/hooks/wallets/useCapabilities.d.ts.map +1 -1
  83. package/dist/types/react/core/hooks/wallets/useSendAndConfirmCalls.d.ts +66 -0
  84. package/dist/types/react/core/hooks/wallets/useSendAndConfirmCalls.d.ts.map +1 -0
  85. package/dist/types/react/core/hooks/wallets/useSendCalls.d.ts +8 -11
  86. package/dist/types/react/core/hooks/wallets/useSendCalls.d.ts.map +1 -1
  87. package/dist/types/react/core/hooks/wallets/useWaitForCallsReceipt.d.ts +32 -0
  88. package/dist/types/react/core/hooks/wallets/useWaitForCallsReceipt.d.ts.map +1 -0
  89. package/dist/types/react/core/providers/thirdweb-provider.d.ts.map +1 -1
  90. package/dist/types/version.d.ts +1 -1
  91. package/dist/types/wallets/coinbase/coinbase-web.d.ts +2 -30
  92. package/dist/types/wallets/coinbase/coinbase-web.d.ts.map +1 -1
  93. package/dist/types/wallets/eip5792/get-calls-status.d.ts +5 -6
  94. package/dist/types/wallets/eip5792/get-calls-status.d.ts.map +1 -1
  95. package/dist/types/wallets/eip5792/get-capabilities.d.ts +2 -1
  96. package/dist/types/wallets/eip5792/get-capabilities.d.ts.map +1 -1
  97. package/dist/types/wallets/eip5792/send-and-confirm-calls.d.ts +39 -0
  98. package/dist/types/wallets/eip5792/send-and-confirm-calls.d.ts.map +1 -0
  99. package/dist/types/wallets/eip5792/send-calls.d.ts +12 -5
  100. package/dist/types/wallets/eip5792/send-calls.d.ts.map +1 -1
  101. package/dist/types/wallets/eip5792/show-calls-status.d.ts +2 -2
  102. package/dist/types/wallets/eip5792/show-calls-status.d.ts.map +1 -1
  103. package/dist/types/wallets/eip5792/types.d.ts +33 -4
  104. package/dist/types/wallets/eip5792/types.d.ts.map +1 -1
  105. package/dist/types/wallets/eip5792/{wait-for-bundle.d.ts → wait-for-calls-receipt.d.ts} +21 -9
  106. package/dist/types/wallets/eip5792/wait-for-calls-receipt.d.ts.map +1 -0
  107. package/dist/types/wallets/in-app/core/eip5972/in-app-wallet-calls.d.ts +3 -3
  108. package/dist/types/wallets/in-app/core/eip5972/in-app-wallet-calls.d.ts.map +1 -1
  109. package/dist/types/wallets/in-app/core/eip5972/in-app-wallet-capabilities.d.ts +3 -3
  110. package/dist/types/wallets/in-app/core/eip5972/in-app-wallet-capabilities.d.ts.map +1 -1
  111. package/dist/types/wallets/smart/lib/smart-wallet-capabilities.d.ts +2 -2
  112. package/dist/types/wallets/smart/lib/smart-wallet-capabilities.d.ts.map +1 -1
  113. package/package.json +1 -1
  114. package/src/exports/react.native.ts +6 -3
  115. package/src/exports/react.ts +6 -3
  116. package/src/exports/wallets/eip5792.ts +5 -3
  117. package/src/react/core/hooks/wallets/useCapabilities.ts +6 -6
  118. package/src/react/core/hooks/wallets/useSendAndConfirmCalls.ts +114 -0
  119. package/src/react/core/hooks/wallets/useSendCalls.ts +33 -50
  120. package/src/react/core/hooks/wallets/useWaitForCallsReceipt.ts +43 -0
  121. package/src/react/core/providers/thirdweb-provider.tsx +4 -3
  122. package/src/version.ts +1 -1
  123. package/src/wallets/coinbase/coinbase-web.ts +6 -117
  124. package/src/wallets/eip5792/get-calls-status.test.ts +27 -33
  125. package/src/wallets/eip5792/get-calls-status.ts +68 -19
  126. package/src/wallets/eip5792/get-capabilities.test.ts +10 -10
  127. package/src/wallets/eip5792/get-capabilities.ts +33 -11
  128. package/src/wallets/eip5792/send-and-confirm-calls.ts +48 -0
  129. package/src/wallets/eip5792/send-calls.test.ts +7 -7
  130. package/src/wallets/eip5792/send-calls.ts +43 -21
  131. package/src/wallets/eip5792/show-calls-status.test.ts +3 -3
  132. package/src/wallets/eip5792/show-calls-status.ts +13 -12
  133. package/src/wallets/eip5792/types.ts +43 -4
  134. package/src/wallets/eip5792/{wait-for-bundle.test.ts → wait-for-calls-receipt.test.ts} +19 -9
  135. package/src/wallets/eip5792/{wait-for-bundle.ts → wait-for-calls-receipt.ts} +26 -16
  136. package/src/wallets/in-app/core/eip5972/in-app-wallet-calls.ts +17 -16
  137. package/src/wallets/in-app/core/eip5972/in-app-wallet-capabilities.ts +14 -3
  138. package/src/wallets/smart/lib/smart-wallet-capabilities.ts +5 -2
  139. package/dist/cjs/react/core/hooks/wallets/useCallsStatus.js +0 -41
  140. package/dist/cjs/react/core/hooks/wallets/useCallsStatus.js.map +0 -1
  141. package/dist/cjs/wallets/eip5792/wait-for-bundle.js.map +0 -1
  142. package/dist/esm/react/core/hooks/wallets/useCallsStatus.js +0 -38
  143. package/dist/esm/react/core/hooks/wallets/useCallsStatus.js.map +0 -1
  144. package/dist/esm/wallets/eip5792/wait-for-bundle.js.map +0 -1
  145. package/dist/types/react/core/hooks/wallets/useCallsStatus.d.ts +0 -26
  146. package/dist/types/react/core/hooks/wallets/useCallsStatus.d.ts.map +0 -1
  147. package/dist/types/wallets/eip5792/wait-for-bundle.d.ts.map +0 -1
  148. package/src/react/core/hooks/wallets/useCallsStatus.ts +0 -48
@@ -0,0 +1,39 @@
1
+ import type { WalletId } from "../wallet-types.js";
2
+ import { type SendCallsOptions } from "./send-calls.js";
3
+ import type { GetCallsStatusResponse } from "./types.js";
4
+ /**
5
+ * Send and confirm calls in a single transaction.
6
+ *
7
+ * This is a convenience function that sends the calls with `sendCalls` and then waits for the receipts with `waitForCallsReceipt`.
8
+ *
9
+ * @param options - The options for sending and confirming calls.
10
+ * @returns The receipts of the calls.
11
+ * @example
12
+ * ```ts
13
+ * const call1 = approve({
14
+ * contract: USDT_CONTRACT,
15
+ * amount: 100,
16
+ * spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
17
+ * });
18
+ * const call2 = transfer({
19
+ * contract: USDT_CONTRACT,
20
+ * to: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
21
+ * amount: 100,
22
+ * });
23
+ * const result = await sendAndConfirmCalls({
24
+ * calls: [call1, call2],
25
+ * wallet: wallet,
26
+ * });
27
+ * console.log("Transaction receipts:", result.receipts);
28
+ * ```
29
+ * @extension EIP5792
30
+ * @beta
31
+ */
32
+ export declare function sendAndConfirmCalls<const ID extends WalletId>(options: SendCallsOptions<ID> & {
33
+ /**
34
+ * The maximum number of blocks to wait for the calls to be confirmed.
35
+ * @defaultValue 100
36
+ */
37
+ maxBlocksWaitTime?: number;
38
+ }): Promise<GetCallsStatusResponse>;
39
+ //# sourceMappingURL=send-and-confirm-calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-and-confirm-calls.d.ts","sourceRoot":"","sources":["../../../../src/wallets/eip5792/send-and-confirm-calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGzD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,CAAC,EAAE,SAAS,QAAQ,EACjE,OAAO,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACA,OAAO,CAAC,sBAAsB,CAAC,CAMjC"}
@@ -4,7 +4,7 @@ import type { ThirdwebClient } from "../../client/client.js";
4
4
  import type { PreparedTransaction } from "../../transaction/prepare-transaction.js";
5
5
  import { type Hex } from "../../utils/encoding/hex.js";
6
6
  import { type PromisedObject } from "../../utils/promise/resolve-promised-value.js";
7
- import type { OneOf } from "../../utils/type-utils.js";
7
+ import type { OneOf, Prettify } from "../../utils/type-utils.js";
8
8
  import type { Wallet } from "../interfaces/wallet.js";
9
9
  import type { WalletId } from "../wallet-types.js";
10
10
  import type { WalletSendCallsId, WalletSendCallsParameters } from "./types.js";
@@ -18,15 +18,20 @@ export type PrepareCallOptions = {
18
18
  chain: Chain;
19
19
  client: ThirdwebClient;
20
20
  } & PromisedObject<WalletCall>;
21
- export type SendCallsOptions<ID extends WalletId = WalletId, abi extends Abi = [], abiFunction extends AbiFunction = AbiFunction> = {
21
+ export type SendCallsOptions<ID extends WalletId = WalletId, abi extends Abi = [], abiFunction extends AbiFunction = AbiFunction> = Prettify<{
22
22
  wallet: Wallet<ID>;
23
23
  calls: PreparedSendCall<abi, abiFunction>[];
24
24
  capabilities?: WalletSendCallsParameters[number]["capabilities"];
25
25
  version?: WalletSendCallsParameters[number]["version"];
26
26
  chain?: Chain;
27
27
  atomicRequired?: boolean;
28
- };
29
- export type SendCallsResult = WalletSendCallsId;
28
+ }>;
29
+ export type SendCallsResult = Prettify<{
30
+ id: WalletSendCallsId;
31
+ client: ThirdwebClient;
32
+ chain: Chain;
33
+ wallet: Wallet;
34
+ }>;
30
35
  /**
31
36
  * Send [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) calls to a wallet.
32
37
  * This function works with all Thirdweb wallets (in-app and smart) and certain injected wallets that already support EIP-5792.
@@ -53,6 +58,7 @@ export type SendCallsResult = WalletSendCallsId;
53
58
  *
54
59
  * const client = createThirdwebClient({ clientId: ... });
55
60
  * const wallet = createWallet("com.coinbase.wallet");
61
+ * await wallet.connect({ client });
56
62
  *
57
63
  * const sendTx1 = approve({
58
64
  contract: USDT_CONTRACT,
@@ -82,8 +88,9 @@ export type SendCallsResult = WalletSendCallsId;
82
88
  * }
83
89
  * }
84
90
  * });
85
- * We recommend proxying any paymaster calls via an API route you setup and control.
86
91
  * ```
92
+ * We recommend proxying any paymaster calls via an API route you setup and control.
93
+ *
87
94
  * @extension EIP5792
88
95
  */
89
96
  export declare function sendCalls<const ID extends WalletId>(options: SendCallsOptions<ID>): Promise<SendCallsResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"send-calls.d.ts","sourceRoot":"","sources":["../../../../src/wallets/eip5792/send-calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,wBAAsB,SAAS,CAAC,KAAK,CAAC,EAAE,SAAS,QAAQ,EACvD,OAAO,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAC5B,OAAO,CAAC,eAAe,CAAC,CAyG1B"}
@@ -2,7 +2,7 @@ import type { Wallet } from "../interfaces/wallet.js";
2
2
  import type { WalletSendCallsId } from "./types.js";
3
3
  type ShowCallsStatusOptions = {
4
4
  wallet: Wallet;
5
- bundleId: WalletSendCallsId;
5
+ id: WalletSendCallsId;
6
6
  };
7
7
  /**
8
8
  * Request a wallet to show the status of a bundle of calls.
@@ -28,6 +28,6 @@ type ShowCallsStatusOptions = {
28
28
  * @extension EIP5792
29
29
  * @internal
30
30
  */
31
- export declare function showCallsStatus({ wallet, bundleId, }: ShowCallsStatusOptions): Promise<void>;
31
+ export declare function showCallsStatus({ wallet, id, }: ShowCallsStatusOptions): Promise<void>;
32
32
  export {};
33
33
  //# sourceMappingURL=show-calls-status.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"show-calls-status.d.ts","sourceRoot":"","sources":["../../../../src/wallets/eip5792/show-calls-status.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CAAC,EACpC,MAAM,EACN,QAAQ,GACT,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCxC"}
1
+ {"version":3,"file":"show-calls-status.d.ts","sourceRoot":"","sources":["../../../../src/wallets/eip5792/show-calls-status.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,iBAAiB,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CAAC,EACpC,MAAM,EACN,EAAE,GACH,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCxC"}
@@ -1,6 +1,6 @@
1
1
  import type { Address } from "../../utils/address.js";
2
2
  import type { Hex } from "../../utils/encoding/hex.js";
3
- import type { OneOf } from "../../utils/type-utils.js";
3
+ import type { OneOf, Prettify } from "../../utils/type-utils.js";
4
4
  export type WalletCapabilities = {
5
5
  [capability: string]: unknown;
6
6
  };
@@ -27,9 +27,37 @@ export type EIP5792Call = OneOf<{
27
27
  } | {
28
28
  data: Hex;
29
29
  }>;
30
- export type GetCallsStatusResponse = {
31
- status: "PENDING" | "CONFIRMED";
32
- receipts: WalletCallReceipt<bigint, "success" | "reverted">[];
30
+ type WalletGetCallsStatusReturnType<numberType = Hex, bigintType = Hex, receiptStatus = Hex> = Prettify<{
31
+ atomic: boolean;
32
+ chainId: numberType;
33
+ id: string;
34
+ receipts?: WalletCallReceipt<bigintType, receiptStatus>[] | undefined;
35
+ status: number;
36
+ version: string;
37
+ }>;
38
+ export type GetCallsStatusResponse = Prettify<Omit<WalletGetCallsStatusReturnType<number, bigint, "success" | "reverted">, "status"> & {
39
+ statusCode: number;
40
+ status: "pending" | "success" | "failure" | undefined;
41
+ }>;
42
+ export type GetCallsStatusRawResponse = {
43
+ version: string;
44
+ id: `0x${string}`;
45
+ chainId: `0x${string}`;
46
+ status: number;
47
+ atomic: boolean;
48
+ receipts?: {
49
+ logs: {
50
+ address: `0x${string}`;
51
+ data: `0x${string}`;
52
+ topics: `0x${string}`[];
53
+ }[];
54
+ status: `0x${string}`;
55
+ blockHash: `0x${string}`;
56
+ blockNumber: `0x${string}`;
57
+ gasUsed: `0x${string}`;
58
+ transactionHash: `0x${string}`;
59
+ }[];
60
+ capabilities?: Record<string, unknown>;
33
61
  };
34
62
  export type WalletCallReceipt<quantity = Hex, status = Hex> = {
35
63
  logs: {
@@ -43,4 +71,5 @@ export type WalletCallReceipt<quantity = Hex, status = Hex> = {
43
71
  gasUsed: quantity;
44
72
  transactionHash: Hex;
45
73
  };
74
+ export {};
46
75
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/wallets/eip5792/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAClC,YAAY,SAAS,kBAAkB,EACvC,EAAE,SAAS,MAAM,GAAG,MAAM,GAAG,GAAG,IAC9B;KACD,KAAK,IAAI,EAAE,GAAG,YAAY;CAC5B,GAAG;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,yBAAyB,CACnC,YAAY,SAAS,kBAAkB,GAAG,kBAAkB,EAC5D,OAAO,SAAS,GAAG,GAAG,MAAM,GAAG,GAAG,IAChC;IACF;QACE,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EAAE,WAAW,EAAE,CAAC;QACrB,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;QACxC,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,cAAc,EAAE,OAAO,CAAC;KACzB;CAC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tB,CAAC"}
@@ -2,12 +2,12 @@ import type { Chain } from "../../chains/types.js";
2
2
  import type { ThirdwebClient } from "../../client/client.js";
3
3
  import type { Prettify } from "../../utils/type-utils.js";
4
4
  import type { Wallet } from "../interfaces/wallet.js";
5
- import type { GetCallsStatusResponse, WalletSendCallsId } from "./types.js";
6
- export type WaitForBundleOptions = Prettify<{
7
- bundleId: WalletSendCallsId;
8
- wallet: Wallet;
5
+ import type { GetCallsStatusResponse } from "./types.js";
6
+ export type WaitForCallsReceiptOptions = Prettify<{
7
+ id: string;
9
8
  client: ThirdwebClient;
10
9
  chain: Chain;
10
+ wallet: Wallet;
11
11
  maxBlocksWaitTime?: number;
12
12
  }>;
13
13
  /**
@@ -22,15 +22,27 @@ export type WaitForBundleOptions = Prettify<{
22
22
  * @beta
23
23
  * @example
24
24
  * ```ts
25
- * import { waitForBundle } from "thirdweb/wallets/eip5792";
26
- * const result = await waitForBundle({
25
+ * import { waitForCallsReceipt } from "thirdweb/wallets/eip5792";
26
+ * const result = await waitForCallsReceipt({
27
+ * client,
28
+ * chain,
29
+ * wallet,
30
+ * id: "0x123...",
31
+ * });
32
+ * ```
33
+ *
34
+ * Example with useSendCalls:
35
+ * ```ts
36
+ * const sendResult = await sendCalls({
27
37
  * client,
28
38
  * chain,
29
39
  * wallet,
30
- * bundleId: "0x123...",
40
+ * calls: [...],
31
41
  * });
42
+ * const confirmResult = await waitForCallsReceipt(sendResult);
43
+ * console.log("Transaction confirmed: ", confirmResult.receipts?.[0].transactionHash);
32
44
  * ```
33
45
  * @extension EIP5792
34
46
  */
35
- export declare function waitForBundle(options: WaitForBundleOptions): Promise<GetCallsStatusResponse>;
36
- //# sourceMappingURL=wait-for-bundle.d.ts.map
47
+ export declare function waitForCallsReceipt(options: WaitForCallsReceiptOptions): Promise<GetCallsStatusResponse>;
48
+ //# sourceMappingURL=wait-for-calls-receipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-for-calls-receipt.d.ts","sourceRoot":"","sources":["../../../../src/wallets/eip5792/wait-for-calls-receipt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAKzD,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAqDjC"}
@@ -1,6 +1,6 @@
1
1
  import type { ThirdwebClient } from "../../../../client/client.js";
2
2
  import type { PreparedSendCall } from "../../../eip5792/send-calls.js";
3
- import type { GetCallsStatusResponse, WalletSendCallsId } from "../../../eip5792/types.js";
3
+ import type { GetCallsStatusResponse } from "../../../eip5792/types.js";
4
4
  import type { Account, Wallet } from "../../../interfaces/wallet.js";
5
5
  /**
6
6
  * @internal
@@ -8,13 +8,13 @@ import type { Account, Wallet } from "../../../interfaces/wallet.js";
8
8
  export declare function inAppWalletSendCalls(args: {
9
9
  account: Account;
10
10
  calls: PreparedSendCall[];
11
- }): Promise<WalletSendCallsId>;
11
+ }): Promise<string>;
12
12
  /**
13
13
  * @internal
14
14
  */
15
15
  export declare function inAppWalletGetCallsStatus(args: {
16
16
  wallet: Wallet;
17
17
  client: ThirdwebClient;
18
- bundleId: string;
18
+ id: string;
19
19
  }): Promise<GetCallsStatusResponse>;
20
20
  //# sourceMappingURL=in-app-wallet-calls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"in-app-wallet-calls.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/eip5972/in-app-wallet-calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EACV,sBAAsB,EAEtB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAIrE;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyB7B;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA6ClC"}
1
+ {"version":3,"file":"in-app-wallet-calls.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/eip5972/in-app-wallet-calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EACV,sBAAsB,EAEvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAIrE;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA+ClC"}
@@ -9,10 +9,10 @@ export declare function inAppWalletGetCapabilities(args: {
9
9
  } | {
10
10
  [x: number]: {
11
11
  paymasterService: {
12
- supported: boolean;
12
+ supported: boolean | undefined;
13
13
  };
14
- atomicBatch: {
15
- supported: boolean;
14
+ atomic: {
15
+ status: string;
16
16
  };
17
17
  };
18
18
  message?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"in-app-wallet-capabilities.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/eip5972/in-app-wallet-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAE5D;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC;CACtC;;;;;;;;;;;;EA4BA"}
1
+ {"version":3,"file":"in-app-wallet-capabilities.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/eip5972/in-app-wallet-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAE5D;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,CAAC;CACtC;;;;;;;;;;;;EAuCA"}
@@ -11,8 +11,8 @@ export declare function smartWalletGetCapabilities(args: {
11
11
  paymasterService: {
12
12
  supported: boolean;
13
13
  };
14
- atomicBatch: {
15
- supported: boolean;
14
+ atomic: {
15
+ status: string;
16
16
  };
17
17
  };
18
18
  message?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"smart-wallet-capabilities.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/smart-wallet-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;;;;;;;;;;;;EAuBA"}
1
+ {"version":3,"file":"smart-wallet-capabilities.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/smart-wallet-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;;;;;;;;;;;;EA0BA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thirdweb",
3
- "version": "5.98.2",
3
+ "version": "5.99.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -14,21 +14,24 @@ export { useActiveWalletChain } from "../react/core/hooks/wallets/useActiveWalle
14
14
  export { useActiveWalletConnectionStatus } from "../react/core/hooks/wallets/useActiveWalletConnectionStatus.js";
15
15
  export { useActiveAccount } from "../react/core/hooks/wallets/useActiveAccount.js";
16
16
  export { useAutoConnect } from "../react/native/hooks/wallets/useAutoConnect.js";
17
- export { useCapabilities } from "../react/core/hooks/wallets/useCapabilities.js";
18
17
  export { useConnect } from "../react/core/hooks/wallets/useConnect.js";
19
18
  export { useConnectedWallets } from "../react/core/hooks/wallets/useConnectedWallets.js";
20
19
  export { useDisconnect } from "../react/core/hooks/wallets/useDisconnect.js";
21
20
  export { useIsAutoConnecting } from "../react/core/hooks/wallets/useIsAutoConnecting.js";
22
21
  export { useSetActiveWallet } from "../react/core/hooks/wallets/useSetActiveWallet.js";
23
22
  export { useSetActiveWalletConnectionStatus } from "../react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js";
24
- export { useSendCalls } from "../react/core/hooks/wallets/useSendCalls.js";
25
23
  export { useSwitchActiveWalletChain } from "../react/core/hooks/wallets/useSwitchActiveWalletChain.js";
26
- export { useCallsStatus } from "../react/core/hooks/wallets/useCallsStatus.js";
27
24
  export { useWalletBalance } from "../react/core/hooks/others/useWalletBalance.js";
28
25
  export { useProfiles } from "../react/native/hooks/wallets/useProfiles.js";
29
26
  export { useLinkProfile } from "../react/native/hooks/wallets/useLinkProfile.js";
30
27
  export { useUnlinkProfile } from "../react/native/hooks/wallets/useUnlinkProfile.js";
31
28
 
29
+ // eip5792
30
+ export { useCapabilities } from "../react/core/hooks/wallets/useCapabilities.js";
31
+ export { useSendCalls } from "../react/core/hooks/wallets/useSendCalls.js";
32
+ export { useSendAndConfirmCalls } from "../react/core/hooks/wallets/useSendAndConfirmCalls.js";
33
+ export { useWaitForCallsReceipt } from "../react/core/hooks/wallets/useWaitForCallsReceipt.js";
34
+
32
35
  // contract
33
36
  export { useReadContract } from "../react/core/hooks/contract/useReadContract.js";
34
37
  export { useWaitForReceipt } from "../react/core/hooks/contract/useWaitForReceipt.js";
@@ -45,21 +45,24 @@ export { useActiveWalletChain } from "../react/core/hooks/wallets/useActiveWalle
45
45
  export { useActiveWalletConnectionStatus } from "../react/core/hooks/wallets/useActiveWalletConnectionStatus.js";
46
46
  export { useActiveAccount } from "../react/core/hooks/wallets/useActiveAccount.js";
47
47
  export { useAutoConnect } from "../react/web/hooks/wallets/useAutoConnect.js";
48
- export { useCapabilities } from "../react/core/hooks/wallets/useCapabilities.js";
49
48
  export { useConnect } from "../react/core/hooks/wallets/useConnect.js";
50
49
  export { useConnectedWallets } from "../react/core/hooks/wallets/useConnectedWallets.js";
51
50
  export { useDisconnect } from "../react/core/hooks/wallets/useDisconnect.js";
52
51
  export { useIsAutoConnecting } from "../react/core/hooks/wallets/useIsAutoConnecting.js";
53
52
  export { useSetActiveWallet } from "../react/core/hooks/wallets/useSetActiveWallet.js";
54
53
  export { useSetActiveWalletConnectionStatus } from "../react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js";
55
- export { useSendCalls } from "../react/core/hooks/wallets/useSendCalls.js";
56
54
  export { useSwitchActiveWalletChain } from "../react/core/hooks/wallets/useSwitchActiveWalletChain.js";
57
- export { useCallsStatus } from "../react/core/hooks/wallets/useCallsStatus.js";
58
55
  export { useWalletBalance } from "../react/core/hooks/others/useWalletBalance.js";
59
56
  export { useProfiles } from "../react/web/hooks/wallets/useProfiles.js";
60
57
  export { useLinkProfile } from "../react/web/hooks/wallets/useLinkProfile.js";
61
58
  export { useUnlinkProfile } from "../react/web/hooks/wallets/useUnlinkProfile.js";
62
59
 
60
+ // eip5792
61
+ export { useCapabilities } from "../react/core/hooks/wallets/useCapabilities.js";
62
+ export { useSendCalls } from "../react/core/hooks/wallets/useSendCalls.js";
63
+ export { useSendAndConfirmCalls } from "../react/core/hooks/wallets/useSendAndConfirmCalls.js";
64
+ export { useWaitForCallsReceipt } from "../react/core/hooks/wallets/useWaitForCallsReceipt.js";
65
+
63
66
  // chain hooks
64
67
  export { useChainMetadata } from "../react/core/hooks/others/useChainQuery.js";
65
68
 
@@ -4,6 +4,8 @@ export type {
4
4
  GetCapabilitiesResult,
5
5
  } from "../../wallets/eip5792/get-capabilities.js";
6
6
  export { sendCalls } from "../../wallets/eip5792/send-calls.js";
7
+ export { sendAndConfirmCalls } from "../../wallets/eip5792/send-and-confirm-calls.js";
8
+ export { showCallsStatus } from "../../wallets/eip5792/show-calls-status.js";
7
9
  export type {
8
10
  SendCallsOptions,
9
11
  SendCallsResult,
@@ -15,9 +17,9 @@ export {
15
17
  getCallsStatus,
16
18
  } from "../../wallets/eip5792/get-calls-status.js";
17
19
  export {
18
- waitForBundle,
19
- type WaitForBundleOptions,
20
- } from "../../wallets/eip5792/wait-for-bundle.js";
20
+ waitForCallsReceipt,
21
+ type WaitForCallsReceiptOptions,
22
+ } from "../../wallets/eip5792/wait-for-calls-receipt.js";
21
23
  export type {
22
24
  WalletCapabilities,
23
25
  WalletCapabilitiesRecord,
@@ -21,6 +21,7 @@ import { useActiveWallet } from "./useActiveWallet.js";
21
21
  * @extension EIP5792
22
22
  */
23
23
  export function useCapabilities(options?: {
24
+ chainId?: number;
24
25
  queryOptions?: {
25
26
  enabled?: boolean;
26
27
  retry?: number;
@@ -28,18 +29,17 @@ export function useCapabilities(options?: {
28
29
  }): UseQueryResult<GetCapabilitiesResult> {
29
30
  const wallet = useActiveWallet();
30
31
  return useQuery({
31
- queryKey: [
32
- "getCapabilities",
33
- wallet?.getChain()?.id || -1,
34
- wallet?.id,
35
- ] as const,
32
+ queryKey: ["getCapabilities", wallet?.id, options?.chainId] as const,
36
33
  queryFn: async () => {
37
34
  if (!wallet) {
38
35
  return {
39
36
  message: "Can't get capabilities, no wallet connected",
40
37
  } as const;
41
38
  }
42
- return getCapabilities({ wallet });
39
+ return getCapabilities({
40
+ wallet,
41
+ chainId: options?.chainId,
42
+ });
43
43
  },
44
44
  retry: false,
45
45
  ...options?.queryOptions,
@@ -0,0 +1,114 @@
1
+ import {
2
+ type UseMutationResult,
3
+ useMutation,
4
+ useQueryClient,
5
+ } from "@tanstack/react-query";
6
+ import { sendAndConfirmCalls } from "../../../../wallets/eip5792/send-and-confirm-calls.js";
7
+ import type { SendCallsOptions } from "../../../../wallets/eip5792/send-calls.js";
8
+ import type { GetCallsStatusResponse } from "../../../../wallets/eip5792/types.js";
9
+ import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
10
+ import { invalidateWalletBalance } from "../../providers/invalidateWalletBalance.js";
11
+ import { useActiveWallet } from "./useActiveWallet.js";
12
+
13
+ /**
14
+ * A hook to send [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) calls to a wallet.
15
+ * This hook works with all Thirdweb wallets (in-app and smart) and certain injected wallets that already support EIP-5792.
16
+ * Transactions will be batched and sponsored when those capabilities are supported, otherwise they will be sent as individual transactions.
17
+ *
18
+ * When calls are sent, all contracts that are interacted with will have their corresponding reads revalidated via React Query.
19
+ *
20
+ * This hook is dependent on the wallet's support for EIP-5792 and could fail.
21
+ * The mutation function will use your currently connected wallet by default, but you can pass it a specific wallet to use if you'd like.
22
+ *
23
+ * @returns A React Query mutation object to interact with {@link sendAndConfirmCalls}
24
+ * @throws an error if the wallet does not support EIP-5792.
25
+ * @returns The ID of the bundle of the calls.
26
+ *
27
+ * @beta
28
+ * @example
29
+ * ```tsx
30
+ * import { useSendCalls } from "thirdweb/react";
31
+ *
32
+ * const sendTx1 = approve({
33
+ contract: USDT_CONTRACT,
34
+ amount: 100,
35
+ spender: "0x33d9B8BEfE81027E2C859EDc84F5636cbb202Ed6",
36
+ });
37
+ * const sendTx2 = approve({
38
+ contract: USDT_CONTRACT,
39
+ amount: 100,
40
+ spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
41
+ });
42
+ * const { mutate: sendCalls, data: result } = useSendAndConfirmCalls();
43
+ * await sendCalls({
44
+ * client,
45
+ * calls: [sendTx1, sendTx2],
46
+ * });
47
+ *
48
+ * console.log("Transaction hash:", result.receipts?.[0]?.transactionHash);
49
+ * ```
50
+
51
+ * Sponsor transactions with a paymaster:
52
+ * ```ts
53
+ * const { mutate: sendAndConfirmCalls, data: id } = useSendAndConfirmCalls();
54
+ * const result = await sendAndConfirmCalls({
55
+ * client,
56
+ * calls: [sendTx1, sendTx2],
57
+ * capabilities: {
58
+ * paymasterService: {
59
+ * url: `https://${CHAIN.id}.bundler.thirdweb.com/${client.clientId}`
60
+ * }
61
+ * }
62
+ * });
63
+ * console.log("Transaction hash:", result.receipts?.[0]?.transactionHash);
64
+ * ```
65
+ *
66
+ * We recommend proxying any paymaster calls via an API route you setup and control.
67
+ * @extension EIP5792
68
+ */
69
+ export function useSendAndConfirmCalls(args?: {
70
+ maxBlocksWaitTime?: number;
71
+ }): UseMutationResult<
72
+ GetCallsStatusResponse,
73
+ Error,
74
+ Omit<SendCallsOptions, "chain" | "wallet"> & { wallet?: Wallet } // Optional wallet override
75
+ > {
76
+ const activeWallet = useActiveWallet();
77
+ const queryClient = useQueryClient();
78
+
79
+ return useMutation({
80
+ mutationFn: async (options) => {
81
+ const { wallet = activeWallet } = options;
82
+ if (!wallet) {
83
+ throw new Error(
84
+ "Failed to send transactions, no connected wallet found.",
85
+ );
86
+ }
87
+
88
+ return sendAndConfirmCalls({
89
+ ...options,
90
+ wallet,
91
+ maxBlocksWaitTime: args?.maxBlocksWaitTime,
92
+ });
93
+ },
94
+ onSettled: async (_result, _error, variables) => {
95
+ // Attempt to invalidate any reads related to the sent transactions
96
+ const call = variables.calls[0];
97
+ if (!call) {
98
+ return;
99
+ }
100
+ const chain = call.__contract?.chain || call.chain;
101
+
102
+ for (const call of variables.calls) {
103
+ queryClient.invalidateQueries({
104
+ queryKey: [
105
+ "readContract",
106
+ call.__contract?.chain.id || call.chain.id,
107
+ call.__contract?.address || call.to,
108
+ ],
109
+ });
110
+ }
111
+ invalidateWalletBalance(queryClient, chain.id);
112
+ },
113
+ });
114
+ }