thirdweb 5.32.0 → 5.32.1

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 (252) hide show
  1. package/dist/cjs/chains/utils.js +9 -7
  2. package/dist/cjs/chains/utils.js.map +1 -1
  3. package/dist/cjs/exports/react.js +3 -0
  4. package/dist/cjs/exports/react.js.map +1 -1
  5. package/dist/cjs/exports/wallets/smart.js +3 -1
  6. package/dist/cjs/exports/wallets/smart.js.map +1 -1
  7. package/dist/cjs/react/core/hooks/others/useChainQuery.js +104 -33
  8. package/dist/cjs/react/core/hooks/others/useChainQuery.js.map +1 -1
  9. package/dist/cjs/react/native/ui/components/ChainIcon.js +2 -3
  10. package/dist/cjs/react/native/ui/components/ChainIcon.js.map +1 -1
  11. package/dist/cjs/react/native/ui/connect/ConnectedModal.js +2 -2
  12. package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
  13. package/dist/cjs/react/native/ui/connect/SendScreen.js +2 -2
  14. package/dist/cjs/react/native/ui/connect/SendScreen.js.map +1 -1
  15. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +6 -5
  16. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  17. package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js +217 -188
  18. package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
  19. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +2 -4
  20. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  21. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +12 -10
  22. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
  23. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +2 -2
  24. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
  25. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js +2 -2
  26. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js.map +1 -1
  27. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +2 -2
  28. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +2 -2
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
  31. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +2 -2
  32. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
  33. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js +8 -6
  34. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js.map +1 -1
  35. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js +2 -2
  36. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js.map +1 -1
  37. package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js +3 -2
  38. package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
  39. package/dist/cjs/react/web/ui/components/ChainIcon.js +1 -1
  40. package/dist/cjs/react/web/ui/components/ChainIcon.js.map +1 -1
  41. package/dist/cjs/react/web/ui/components/ChainName.js +3 -5
  42. package/dist/cjs/react/web/ui/components/ChainName.js.map +1 -1
  43. package/dist/cjs/react/web/ui/components/TokenIcon.js +3 -3
  44. package/dist/cjs/react/web/ui/components/TokenIcon.js.map +1 -1
  45. package/dist/cjs/react/web/ui/components/token/TokenSymbol.js +3 -3
  46. package/dist/cjs/react/web/ui/components/token/TokenSymbol.js.map +1 -1
  47. package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletFormUI.js +1 -1
  48. package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletFormUI.js.map +1 -1
  49. package/dist/cjs/utils/extensions/drops/get-claim-params.js +3 -2
  50. package/dist/cjs/utils/extensions/drops/get-claim-params.js.map +1 -1
  51. package/dist/cjs/version.js +1 -1
  52. package/dist/cjs/wallets/in-app/web/ecosystem.js +3 -14
  53. package/dist/cjs/wallets/in-app/web/ecosystem.js.map +1 -1
  54. package/dist/cjs/wallets/smart/index.js +3 -17
  55. package/dist/cjs/wallets/smart/index.js.map +1 -1
  56. package/dist/cjs/wallets/smart/lib/bundler.js +1 -1
  57. package/dist/cjs/wallets/smart/lib/bundler.js.map +1 -1
  58. package/dist/cjs/wallets/smart/lib/userop.js +63 -8
  59. package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
  60. package/dist/esm/chains/utils.js +9 -7
  61. package/dist/esm/chains/utils.js.map +1 -1
  62. package/dist/esm/exports/react.js +1 -0
  63. package/dist/esm/exports/react.js.map +1 -1
  64. package/dist/esm/exports/wallets/smart.js +1 -0
  65. package/dist/esm/exports/wallets/smart.js.map +1 -1
  66. package/dist/esm/react/core/hooks/others/useChainQuery.js +101 -33
  67. package/dist/esm/react/core/hooks/others/useChainQuery.js.map +1 -1
  68. package/dist/esm/react/native/ui/components/ChainIcon.js +3 -4
  69. package/dist/esm/react/native/ui/components/ChainIcon.js.map +1 -1
  70. package/dist/esm/react/native/ui/connect/ConnectedModal.js +3 -3
  71. package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
  72. package/dist/esm/react/native/ui/connect/SendScreen.js +3 -3
  73. package/dist/esm/react/native/ui/connect/SendScreen.js.map +1 -1
  74. package/dist/esm/react/web/ui/ConnectWallet/Details.js +7 -6
  75. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  76. package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js +219 -191
  77. package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
  78. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +3 -5
  79. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  80. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +13 -11
  81. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
  82. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +3 -3
  83. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
  84. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js +3 -3
  85. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js.map +1 -1
  86. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +3 -3
  87. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
  88. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +3 -3
  89. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
  90. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +3 -3
  91. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
  92. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js +9 -7
  93. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js.map +1 -1
  94. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js +3 -3
  95. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js.map +1 -1
  96. package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js +4 -3
  97. package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
  98. package/dist/esm/react/web/ui/components/ChainIcon.js +1 -1
  99. package/dist/esm/react/web/ui/components/ChainIcon.js.map +1 -1
  100. package/dist/esm/react/web/ui/components/ChainName.js +4 -6
  101. package/dist/esm/react/web/ui/components/ChainName.js.map +1 -1
  102. package/dist/esm/react/web/ui/components/TokenIcon.js +4 -4
  103. package/dist/esm/react/web/ui/components/TokenIcon.js.map +1 -1
  104. package/dist/esm/react/web/ui/components/token/TokenSymbol.js +4 -4
  105. package/dist/esm/react/web/ui/components/token/TokenSymbol.js.map +1 -1
  106. package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletFormUI.js +2 -2
  107. package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletFormUI.js.map +1 -1
  108. package/dist/esm/utils/extensions/drops/get-claim-params.js +3 -2
  109. package/dist/esm/utils/extensions/drops/get-claim-params.js.map +1 -1
  110. package/dist/esm/version.js +1 -1
  111. package/dist/esm/wallets/in-app/web/ecosystem.js +3 -14
  112. package/dist/esm/wallets/in-app/web/ecosystem.js.map +1 -1
  113. package/dist/esm/wallets/smart/index.js +4 -18
  114. package/dist/esm/wallets/smart/index.js.map +1 -1
  115. package/dist/esm/wallets/smart/lib/bundler.js +1 -1
  116. package/dist/esm/wallets/smart/lib/bundler.js.map +1 -1
  117. package/dist/esm/wallets/smart/lib/userop.js +63 -9
  118. package/dist/esm/wallets/smart/lib/userop.js.map +1 -1
  119. package/dist/types/chains/chain-definitions/anvil.d.ts +1 -0
  120. package/dist/types/chains/chain-definitions/anvil.d.ts.map +1 -1
  121. package/dist/types/chains/chain-definitions/arbitrum-nova.d.ts +1 -0
  122. package/dist/types/chains/chain-definitions/arbitrum-nova.d.ts.map +1 -1
  123. package/dist/types/chains/chain-definitions/arbitrum-sepolia.d.ts +1 -0
  124. package/dist/types/chains/chain-definitions/arbitrum-sepolia.d.ts.map +1 -1
  125. package/dist/types/chains/chain-definitions/arbitrum.d.ts +1 -0
  126. package/dist/types/chains/chain-definitions/arbitrum.d.ts.map +1 -1
  127. package/dist/types/chains/chain-definitions/avalanche-fuji.d.ts +1 -0
  128. package/dist/types/chains/chain-definitions/avalanche-fuji.d.ts.map +1 -1
  129. package/dist/types/chains/chain-definitions/avalanche.d.ts +1 -0
  130. package/dist/types/chains/chain-definitions/avalanche.d.ts.map +1 -1
  131. package/dist/types/chains/chain-definitions/base-sepolia.d.ts +1 -0
  132. package/dist/types/chains/chain-definitions/base-sepolia.d.ts.map +1 -1
  133. package/dist/types/chains/chain-definitions/base.d.ts +1 -0
  134. package/dist/types/chains/chain-definitions/base.d.ts.map +1 -1
  135. package/dist/types/chains/chain-definitions/bsc-testnet.d.ts +1 -0
  136. package/dist/types/chains/chain-definitions/bsc-testnet.d.ts.map +1 -1
  137. package/dist/types/chains/chain-definitions/bsc.d.ts +1 -0
  138. package/dist/types/chains/chain-definitions/bsc.d.ts.map +1 -1
  139. package/dist/types/chains/chain-definitions/ethereum.d.ts +2 -0
  140. package/dist/types/chains/chain-definitions/ethereum.d.ts.map +1 -1
  141. package/dist/types/chains/chain-definitions/hardhat.d.ts +1 -0
  142. package/dist/types/chains/chain-definitions/hardhat.d.ts.map +1 -1
  143. package/dist/types/chains/chain-definitions/linea-sepolia.d.ts +1 -0
  144. package/dist/types/chains/chain-definitions/linea-sepolia.d.ts.map +1 -1
  145. package/dist/types/chains/chain-definitions/linea.d.ts +1 -0
  146. package/dist/types/chains/chain-definitions/linea.d.ts.map +1 -1
  147. package/dist/types/chains/chain-definitions/optimism-sepolia.d.ts +1 -0
  148. package/dist/types/chains/chain-definitions/optimism-sepolia.d.ts.map +1 -1
  149. package/dist/types/chains/chain-definitions/optimism.d.ts +1 -0
  150. package/dist/types/chains/chain-definitions/optimism.d.ts.map +1 -1
  151. package/dist/types/chains/chain-definitions/polygon-amoy.d.ts +1 -0
  152. package/dist/types/chains/chain-definitions/polygon-amoy.d.ts.map +1 -1
  153. package/dist/types/chains/chain-definitions/polygon-mumbai.d.ts +2 -0
  154. package/dist/types/chains/chain-definitions/polygon-mumbai.d.ts.map +1 -1
  155. package/dist/types/chains/chain-definitions/polygon.d.ts +1 -0
  156. package/dist/types/chains/chain-definitions/polygon.d.ts.map +1 -1
  157. package/dist/types/chains/chain-definitions/sepolia.d.ts +1 -0
  158. package/dist/types/chains/chain-definitions/sepolia.d.ts.map +1 -1
  159. package/dist/types/chains/chain-definitions/zksync-sepolia.d.ts +1 -0
  160. package/dist/types/chains/chain-definitions/zksync-sepolia.d.ts.map +1 -1
  161. package/dist/types/chains/chain-definitions/zksync.d.ts +1 -0
  162. package/dist/types/chains/chain-definitions/zksync.d.ts.map +1 -1
  163. package/dist/types/chains/chain-definitions/zora-sepolia.d.ts +1 -0
  164. package/dist/types/chains/chain-definitions/zora-sepolia.d.ts.map +1 -1
  165. package/dist/types/chains/chain-definitions/zora.d.ts +1 -0
  166. package/dist/types/chains/chain-definitions/zora.d.ts.map +1 -1
  167. package/dist/types/chains/types.d.ts +1 -0
  168. package/dist/types/chains/types.d.ts.map +1 -1
  169. package/dist/types/chains/utils.d.ts +1 -0
  170. package/dist/types/chains/utils.d.ts.map +1 -1
  171. package/dist/types/exports/react.d.ts +1 -0
  172. package/dist/types/exports/react.d.ts.map +1 -1
  173. package/dist/types/exports/wallets/smart.d.ts +1 -0
  174. package/dist/types/exports/wallets/smart.d.ts.map +1 -1
  175. package/dist/types/react/core/connectionManager.d.ts +1 -0
  176. package/dist/types/react/core/connectionManager.d.ts.map +1 -1
  177. package/dist/types/react/core/hooks/others/useChainQuery.d.ts +24 -10
  178. package/dist/types/react/core/hooks/others/useChainQuery.d.ts.map +1 -1
  179. package/dist/types/react/core/hooks/wallets/useActiveWalletChain.d.ts +1 -0
  180. package/dist/types/react/core/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
  181. package/dist/types/react/native/hooks/wallets/useActiveWalletChain.d.ts +1 -0
  182. package/dist/types/react/native/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
  183. package/dist/types/react/native/index.d.ts +1 -0
  184. package/dist/types/react/native/index.d.ts.map +1 -1
  185. package/dist/types/react/native/ui/components/ChainIcon.d.ts.map +1 -1
  186. package/dist/types/react/web/hooks/wallets/useActiveWalletChain.d.ts +1 -0
  187. package/dist/types/react/web/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
  188. package/dist/types/react/web/index.d.ts +1 -0
  189. package/dist/types/react/web/index.d.ts.map +1 -1
  190. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  191. package/dist/types/react/web/ui/ConnectWallet/NetworkSelector.d.ts +142 -0
  192. package/dist/types/react/web/ui/ConnectWallet/NetworkSelector.d.ts.map +1 -1
  193. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
  194. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +1 -1
  195. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts.map +1 -1
  196. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +4 -0
  197. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
  198. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts +1 -0
  199. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
  200. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.d.ts.map +1 -1
  201. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.d.ts.map +1 -1
  202. package/dist/types/react/web/ui/ConnectWallet/screens/TokenSelector.d.ts.map +1 -1
  203. package/dist/types/react/web/ui/components/ChainIcon.d.ts +1 -2
  204. package/dist/types/react/web/ui/components/ChainIcon.d.ts.map +1 -1
  205. package/dist/types/react/web/ui/components/ChainName.d.ts.map +1 -1
  206. package/dist/types/react/web/wallets/ecosystem/EcosystemWalletFormUI.d.ts.map +1 -1
  207. package/dist/types/utils/extensions/drops/get-claim-params.d.ts.map +1 -1
  208. package/dist/types/version.d.ts +1 -1
  209. package/dist/types/wallets/in-app/web/ecosystem.d.ts +3 -14
  210. package/dist/types/wallets/in-app/web/ecosystem.d.ts.map +1 -1
  211. package/dist/types/wallets/manager/index.d.ts +1 -0
  212. package/dist/types/wallets/manager/index.d.ts.map +1 -1
  213. package/dist/types/wallets/smart/index.d.ts.map +1 -1
  214. package/dist/types/wallets/smart/lib/bundler.d.ts +1 -2
  215. package/dist/types/wallets/smart/lib/bundler.d.ts.map +1 -1
  216. package/dist/types/wallets/smart/lib/userop.d.ts +53 -8
  217. package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
  218. package/package.json +1 -1
  219. package/src/chains/types.ts +1 -1
  220. package/src/chains/utils.ts +9 -7
  221. package/src/exports/react.ts +5 -0
  222. package/src/exports/wallets/smart.ts +2 -0
  223. package/src/extensions/erc1155/drop1155.test.ts +7 -0
  224. package/src/extensions/erc20/drop20.test.ts +55 -0
  225. package/src/extensions/erc721/drop721.test.ts +28 -0
  226. package/src/react/core/hooks/others/useChainQuery.ts +116 -35
  227. package/src/react/native/ui/components/ChainIcon.tsx +3 -4
  228. package/src/react/native/ui/connect/ConnectedModal.tsx +4 -4
  229. package/src/react/native/ui/connect/SendScreen.tsx +3 -3
  230. package/src/react/web/ui/ConnectWallet/Details.tsx +13 -12
  231. package/src/react/web/ui/ConnectWallet/NetworkSelector.tsx +421 -323
  232. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +4 -10
  233. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +17 -15
  234. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +6 -4
  235. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.tsx +4 -4
  236. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +4 -4
  237. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +4 -4
  238. package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.tsx +3 -3
  239. package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.tsx +14 -9
  240. package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.tsx +3 -4
  241. package/src/react/web/ui/ConnectWallet/screens/TokenSelector.tsx +10 -6
  242. package/src/react/web/ui/components/ChainIcon.tsx +2 -3
  243. package/src/react/web/ui/components/ChainName.tsx +4 -6
  244. package/src/react/web/ui/components/TokenIcon.tsx +4 -4
  245. package/src/react/web/ui/components/token/TokenSymbol.tsx +4 -4
  246. package/src/react/web/wallets/ecosystem/EcosystemWalletFormUI.tsx +6 -10
  247. package/src/utils/extensions/drops/get-claim-params.ts +4 -2
  248. package/src/version.ts +1 -1
  249. package/src/wallets/in-app/web/ecosystem.ts +3 -14
  250. package/src/wallets/smart/index.ts +7 -24
  251. package/src/wallets/smart/lib/bundler.ts +6 -5
  252. package/src/wallets/smart/lib/userop.ts +81 -11
@@ -14,8 +14,6 @@ import {
14
14
  signEip712Transaction,
15
15
  } from "../../transaction/actions/zksync/send-eip712-transaction.js";
16
16
  import type { PreparedTransaction } from "../../transaction/prepare-transaction.js";
17
- import type { TransactionReceipt } from "../../transaction/types.js";
18
- import type { Hex } from "../../utils/encoding/hex.js";
19
17
  import { parseTypedData } from "../../utils/signatures/helpers/parseTypedData.js";
20
18
  import type {
21
19
  Account,
@@ -30,7 +28,6 @@ import type {
30
28
  import {
31
29
  broadcastZkTransaction,
32
30
  bundleUserOp,
33
- getUserOpReceipt,
34
31
  getZkPaymasterData,
35
32
  } from "./lib/bundler.js";
36
33
  import {
@@ -39,7 +36,11 @@ import {
39
36
  prepareExecute,
40
37
  } from "./lib/calls.js";
41
38
  import { DEFAULT_ACCOUNT_FACTORY } from "./lib/constants.js";
42
- import { createUnsignedUserOp, signUserOp } from "./lib/userop.js";
39
+ import {
40
+ createUnsignedUserOp,
41
+ signUserOp,
42
+ waitForUserOpReceipt,
43
+ } from "./lib/userop.js";
43
44
  import { isNativeAAChain } from "./lib/utils.js";
44
45
  import type {
45
46
  SmartAccountOptions,
@@ -472,7 +473,7 @@ async function _sendUserOp(args: {
472
473
  }): Promise<WaitForReceiptOptions> {
473
474
  const { executeTx, options } = args;
474
475
  const unsignedUserOp = await createUnsignedUserOp({
475
- executeTx,
476
+ transaction: executeTx,
476
477
  options,
477
478
  });
478
479
  const signedUserOp = await signUserOp({
@@ -485,7 +486,7 @@ async function _sendUserOp(args: {
485
486
  });
486
487
  // wait for tx receipt rather than return the userOp hash
487
488
  const receipt = await waitForUserOpReceipt({
488
- options,
489
+ ...options,
489
490
  userOpHash,
490
491
  });
491
492
 
@@ -495,21 +496,3 @@ async function _sendUserOp(args: {
495
496
  transactionHash: receipt.transactionHash,
496
497
  };
497
498
  }
498
-
499
- async function waitForUserOpReceipt(args: {
500
- options: SmartAccountOptions;
501
- userOpHash: Hex;
502
- }): Promise<TransactionReceipt> {
503
- const { options, userOpHash } = args;
504
- const timeout = 120000; // 2mins
505
- const interval = 1000;
506
- const endtime = Date.now() + timeout;
507
- while (Date.now() < endtime) {
508
- const userOpReceipt = await getUserOpReceipt({ options, userOpHash });
509
- if (userOpReceipt) {
510
- return userOpReceipt;
511
- }
512
- await new Promise((resolve) => setTimeout(resolve, interval));
513
- }
514
- throw new Error("Timeout waiting for userOp to be mined");
515
- }
@@ -83,12 +83,13 @@ export async function getUserOpGasPrice(args: {
83
83
  /**
84
84
  * @internal
85
85
  */
86
- export async function getUserOpReceipt(args: {
87
- userOpHash: Hex;
88
- options: BundlerOptions;
89
- }): Promise<TransactionReceipt | undefined> {
86
+ export async function getUserOpReceipt(
87
+ args: BundlerOptions & {
88
+ userOpHash: Hex;
89
+ },
90
+ ): Promise<TransactionReceipt | undefined> {
90
91
  const res = await sendBundlerRequest({
91
- ...args,
92
+ options: args,
92
93
  operation: "eth_getUserOperationReceipt",
93
94
  params: [args.userOpHash],
94
95
  });
@@ -2,6 +2,7 @@ import { concat } from "viem";
2
2
  import { getDefaultGasOverrides } from "../../../gas/fee-data.js";
3
3
  import { encode } from "../../../transaction/actions/encode.js";
4
4
  import type { PreparedTransaction } from "../../../transaction/prepare-transaction.js";
5
+ import type { TransactionReceipt } from "../../../transaction/types.js";
5
6
  import { encodeAbiParameters } from "../../../utils/abi/encodeAbiParameters.js";
6
7
  import { isContractDeployed } from "../../../utils/bytecode/is-contract-deployed.js";
7
8
  import type { Hex } from "../../../utils/encoding/hex.js";
@@ -9,8 +10,16 @@ import { hexToBytes } from "../../../utils/encoding/to-bytes.js";
9
10
  import { isThirdwebUrl } from "../../../utils/fetch.js";
10
11
  import { keccak256 } from "../../../utils/hashing/keccak256.js";
11
12
  import { resolvePromisedValue } from "../../../utils/promise/resolve-promised-value.js";
12
- import type { SmartAccountOptions, UserOperation } from "../types.js";
13
- import { estimateUserOpGas, getUserOpGasPrice } from "./bundler.js";
13
+ import type {
14
+ BundlerOptions,
15
+ SmartAccountOptions,
16
+ UserOperation,
17
+ } from "../types.js";
18
+ import {
19
+ estimateUserOpGas,
20
+ getUserOpGasPrice,
21
+ getUserOpReceipt,
22
+ } from "./bundler.js";
14
23
  import { prepareCreateAccount } from "./calls.js";
15
24
  import {
16
25
  DUMMY_SIGNATURE,
@@ -21,18 +30,64 @@ import { getPaymasterAndData } from "./paymaster.js";
21
30
  import { randomNonce } from "./utils.js";
22
31
 
23
32
  /**
24
- * Create an unsigned user operation
25
- * @internal
33
+ * Wait for the user operation to be mined.
34
+ * @param args - The options and user operation hash
35
+ * @returns - The transaction receipt
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { waitForUserOpReceipt } from "thirdweb/wallets/smart";
40
+ *
41
+ * const receipt = await waitForUserOpReceipt({
42
+ * chain,
43
+ * client,
44
+ * userOpHash,
45
+ * });
46
+ * ```
47
+ * @walletUtils
26
48
  */
49
+ export async function waitForUserOpReceipt(
50
+ args: BundlerOptions & {
51
+ userOpHash: Hex;
52
+ timeoutMs?: number;
53
+ intervalMs?: number;
54
+ },
55
+ ): Promise<TransactionReceipt> {
56
+ const timeout = args.timeoutMs || 120000; // 2mins
57
+ const interval = args.intervalMs || 1000; // 1s
58
+ const endtime = Date.now() + timeout;
59
+ while (Date.now() < endtime) {
60
+ const userOpReceipt = await getUserOpReceipt(args);
61
+ if (userOpReceipt) {
62
+ return userOpReceipt;
63
+ }
64
+ await new Promise((resolve) => setTimeout(resolve, interval));
65
+ }
66
+ throw new Error("Timeout waiting for userOp to be mined");
67
+ }
68
+
27
69
  /**
28
- * Creates an unsigned user operation.
29
- * @internal
70
+ * Creates an unsigned user operation from a prepared transaction.
71
+ * @param args - The prepared transaction and options
72
+ * @returns - The unsigned user operation
73
+ * @example
74
+ * ```ts
75
+ * import { createUnsignedUserOp } from "thirdweb/wallets/smart";
76
+ *
77
+ * const transaction = prepareContractCall(...);
78
+ *
79
+ * const userOp = await createUnsignedUserOp({
80
+ * transaction,
81
+ * options,
82
+ * });
83
+ * ```
84
+ * @walletUtils
30
85
  */
31
86
  export async function createUnsignedUserOp(args: {
32
- executeTx: PreparedTransaction;
87
+ transaction: PreparedTransaction;
33
88
  options: SmartAccountOptions;
34
89
  }): Promise<UserOperation> {
35
- const { executeTx, options } = args;
90
+ const { transaction: executeTx, options } = args;
36
91
  const isDeployed = await isContractDeployed(options.accountContract);
37
92
  const initCode = isDeployed ? "0x" : await getAccountInitCode(options);
38
93
  const callData = await encode(executeTx);
@@ -148,9 +203,21 @@ export async function createUnsignedUserOp(args: {
148
203
  }
149
204
 
150
205
  /**
151
- * Sign the filled userOp.
206
+ * Sign a user operation.
152
207
  * @param userOp - The UserOperation to sign (with signature field ignored)
153
- * @internal
208
+ * @returns - The user operation with the signature field populated
209
+ * @example
210
+ * ```ts
211
+ * import { signUserOp } from "thirdweb/wallets/smart";
212
+ *
213
+ * const userOp = createUnsignedUserOp(...);
214
+ *
215
+ * const signedUserOp = await signUserOp({
216
+ * userOp,
217
+ * options,
218
+ * });
219
+ * ```
220
+ * @walletUtils
154
221
  */
155
222
  export async function signUserOp(args: {
156
223
  userOp: UserOperation;
@@ -186,7 +253,10 @@ async function getAccountInitCode(options: SmartAccountOptions): Promise<Hex> {
186
253
  }
187
254
 
188
255
  /**
189
- * @internal
256
+ * Get the hash of a user operation.
257
+ * @param args - The user operation, entrypoint address, and chain ID
258
+ * @returns - The hash of the user operation
259
+ * @walletUtils
190
260
  */
191
261
  function getUserOpHash(args: {
192
262
  userOp: UserOperation;