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.
- package/dist/cjs/chains/utils.js +9 -7
- package/dist/cjs/chains/utils.js.map +1 -1
- package/dist/cjs/exports/react.js +3 -0
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/exports/wallets/smart.js +3 -1
- package/dist/cjs/exports/wallets/smart.js.map +1 -1
- package/dist/cjs/react/core/hooks/others/useChainQuery.js +104 -33
- package/dist/cjs/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/cjs/react/native/ui/components/ChainIcon.js +2 -3
- package/dist/cjs/react/native/ui/components/ChainIcon.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js +2 -2
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/SendScreen.js +2 -2
- package/dist/cjs/react/native/ui/connect/SendScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +6 -5
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js +217 -188
- package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +2 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +12 -10
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js +8 -6
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js +3 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/components/ChainIcon.js +1 -1
- package/dist/cjs/react/web/ui/components/ChainIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/components/ChainName.js +3 -5
- package/dist/cjs/react/web/ui/components/ChainName.js.map +1 -1
- package/dist/cjs/react/web/ui/components/TokenIcon.js +3 -3
- package/dist/cjs/react/web/ui/components/TokenIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/components/token/TokenSymbol.js +3 -3
- package/dist/cjs/react/web/ui/components/token/TokenSymbol.js.map +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletFormUI.js +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletFormUI.js.map +1 -1
- package/dist/cjs/utils/extensions/drops/get-claim-params.js +3 -2
- package/dist/cjs/utils/extensions/drops/get-claim-params.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/web/ecosystem.js +3 -14
- package/dist/cjs/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/cjs/wallets/smart/index.js +3 -17
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/userop.js +63 -8
- package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
- package/dist/esm/chains/utils.js +9 -7
- package/dist/esm/chains/utils.js.map +1 -1
- package/dist/esm/exports/react.js +1 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/wallets/smart.js +1 -0
- package/dist/esm/exports/wallets/smart.js.map +1 -1
- package/dist/esm/react/core/hooks/others/useChainQuery.js +101 -33
- package/dist/esm/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/esm/react/native/ui/components/ChainIcon.js +3 -4
- package/dist/esm/react/native/ui/components/ChainIcon.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js +3 -3
- package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/SendScreen.js +3 -3
- package/dist/esm/react/native/ui/connect/SendScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +7 -6
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js +219 -191
- package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +3 -5
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +13 -11
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js +9 -7
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js +4 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
- package/dist/esm/react/web/ui/components/ChainIcon.js +1 -1
- package/dist/esm/react/web/ui/components/ChainIcon.js.map +1 -1
- package/dist/esm/react/web/ui/components/ChainName.js +4 -6
- package/dist/esm/react/web/ui/components/ChainName.js.map +1 -1
- package/dist/esm/react/web/ui/components/TokenIcon.js +4 -4
- package/dist/esm/react/web/ui/components/TokenIcon.js.map +1 -1
- package/dist/esm/react/web/ui/components/token/TokenSymbol.js +4 -4
- package/dist/esm/react/web/ui/components/token/TokenSymbol.js.map +1 -1
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletFormUI.js +2 -2
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletFormUI.js.map +1 -1
- package/dist/esm/utils/extensions/drops/get-claim-params.js +3 -2
- package/dist/esm/utils/extensions/drops/get-claim-params.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/web/ecosystem.js +3 -14
- package/dist/esm/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/esm/wallets/smart/index.js +4 -18
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/esm/wallets/smart/lib/userop.js +63 -9
- package/dist/esm/wallets/smart/lib/userop.js.map +1 -1
- package/dist/types/chains/chain-definitions/anvil.d.ts +1 -0
- package/dist/types/chains/chain-definitions/anvil.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/arbitrum-nova.d.ts +1 -0
- package/dist/types/chains/chain-definitions/arbitrum-nova.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/arbitrum-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/arbitrum-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/arbitrum.d.ts +1 -0
- package/dist/types/chains/chain-definitions/arbitrum.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/avalanche-fuji.d.ts +1 -0
- package/dist/types/chains/chain-definitions/avalanche-fuji.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/avalanche.d.ts +1 -0
- package/dist/types/chains/chain-definitions/avalanche.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/base-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/base-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/base.d.ts +1 -0
- package/dist/types/chains/chain-definitions/base.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/bsc-testnet.d.ts +1 -0
- package/dist/types/chains/chain-definitions/bsc-testnet.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/bsc.d.ts +1 -0
- package/dist/types/chains/chain-definitions/bsc.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/ethereum.d.ts +2 -0
- package/dist/types/chains/chain-definitions/ethereum.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/hardhat.d.ts +1 -0
- package/dist/types/chains/chain-definitions/hardhat.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/linea-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/linea-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/linea.d.ts +1 -0
- package/dist/types/chains/chain-definitions/linea.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/optimism-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/optimism-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/optimism.d.ts +1 -0
- package/dist/types/chains/chain-definitions/optimism.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/polygon-amoy.d.ts +1 -0
- package/dist/types/chains/chain-definitions/polygon-amoy.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/polygon-mumbai.d.ts +2 -0
- package/dist/types/chains/chain-definitions/polygon-mumbai.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/polygon.d.ts +1 -0
- package/dist/types/chains/chain-definitions/polygon.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/zksync-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/zksync-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/zksync.d.ts +1 -0
- package/dist/types/chains/chain-definitions/zksync.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/zora-sepolia.d.ts +1 -0
- package/dist/types/chains/chain-definitions/zora-sepolia.d.ts.map +1 -1
- package/dist/types/chains/chain-definitions/zora.d.ts +1 -0
- package/dist/types/chains/chain-definitions/zora.d.ts.map +1 -1
- package/dist/types/chains/types.d.ts +1 -0
- package/dist/types/chains/types.d.ts.map +1 -1
- package/dist/types/chains/utils.d.ts +1 -0
- package/dist/types/chains/utils.d.ts.map +1 -1
- package/dist/types/exports/react.d.ts +1 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/wallets/smart.d.ts +1 -0
- package/dist/types/exports/wallets/smart.d.ts.map +1 -1
- package/dist/types/react/core/connectionManager.d.ts +1 -0
- package/dist/types/react/core/connectionManager.d.ts.map +1 -1
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts +24 -10
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts.map +1 -1
- package/dist/types/react/core/hooks/wallets/useActiveWalletChain.d.ts +1 -0
- package/dist/types/react/core/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
- package/dist/types/react/native/hooks/wallets/useActiveWalletChain.d.ts +1 -0
- package/dist/types/react/native/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
- package/dist/types/react/native/index.d.ts +1 -0
- package/dist/types/react/native/index.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/ChainIcon.d.ts.map +1 -1
- package/dist/types/react/web/hooks/wallets/useActiveWalletChain.d.ts +1 -0
- package/dist/types/react/web/hooks/wallets/useActiveWalletChain.d.ts.map +1 -1
- package/dist/types/react/web/index.d.ts +1 -0
- package/dist/types/react/web/index.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/NetworkSelector.d.ts +142 -0
- package/dist/types/react/web/ui/ConnectWallet/NetworkSelector.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +4 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/TokenSelector.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/ChainIcon.d.ts +1 -2
- package/dist/types/react/web/ui/components/ChainIcon.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/ChainName.d.ts.map +1 -1
- package/dist/types/react/web/wallets/ecosystem/EcosystemWalletFormUI.d.ts.map +1 -1
- package/dist/types/utils/extensions/drops/get-claim-params.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/web/ecosystem.d.ts +3 -14
- package/dist/types/wallets/in-app/web/ecosystem.d.ts.map +1 -1
- package/dist/types/wallets/manager/index.d.ts +1 -0
- package/dist/types/wallets/manager/index.d.ts.map +1 -1
- package/dist/types/wallets/smart/index.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/bundler.d.ts +1 -2
- package/dist/types/wallets/smart/lib/bundler.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/userop.d.ts +53 -8
- package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/chains/types.ts +1 -1
- package/src/chains/utils.ts +9 -7
- package/src/exports/react.ts +5 -0
- package/src/exports/wallets/smart.ts +2 -0
- package/src/extensions/erc1155/drop1155.test.ts +7 -0
- package/src/extensions/erc20/drop20.test.ts +55 -0
- package/src/extensions/erc721/drop721.test.ts +28 -0
- package/src/react/core/hooks/others/useChainQuery.ts +116 -35
- package/src/react/native/ui/components/ChainIcon.tsx +3 -4
- package/src/react/native/ui/connect/ConnectedModal.tsx +4 -4
- package/src/react/native/ui/connect/SendScreen.tsx +3 -3
- package/src/react/web/ui/ConnectWallet/Details.tsx +13 -12
- package/src/react/web/ui/ConnectWallet/NetworkSelector.tsx +421 -323
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +4 -10
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +17 -15
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +6 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.tsx +4 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +4 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +4 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.tsx +3 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.tsx +14 -9
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/TokenInfoRow.tsx +3 -4
- package/src/react/web/ui/ConnectWallet/screens/TokenSelector.tsx +10 -6
- package/src/react/web/ui/components/ChainIcon.tsx +2 -3
- package/src/react/web/ui/components/ChainName.tsx +4 -6
- package/src/react/web/ui/components/TokenIcon.tsx +4 -4
- package/src/react/web/ui/components/token/TokenSymbol.tsx +4 -4
- package/src/react/web/wallets/ecosystem/EcosystemWalletFormUI.tsx +6 -10
- package/src/utils/extensions/drops/get-claim-params.ts +4 -2
- package/src/version.ts +1 -1
- package/src/wallets/in-app/web/ecosystem.ts +3 -14
- package/src/wallets/smart/index.ts +7 -24
- package/src/wallets/smart/lib/bundler.ts +6 -5
- 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 {
|
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(
|
87
|
-
|
88
|
-
|
89
|
-
}
|
86
|
+
export async function getUserOpReceipt(
|
87
|
+
args: BundlerOptions & {
|
88
|
+
userOpHash: Hex;
|
89
|
+
},
|
90
|
+
): Promise<TransactionReceipt | undefined> {
|
90
91
|
const res = await sendBundlerRequest({
|
91
|
-
|
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 {
|
13
|
-
|
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
|
-
*
|
25
|
-
* @
|
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
|
-
* @
|
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
|
-
|
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
|
206
|
+
* Sign a user operation.
|
152
207
|
* @param userOp - The UserOperation to sign (with signature field ignored)
|
153
|
-
* @
|
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
|
-
*
|
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;
|