permissionless 0.2.14 → 0.2.16
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/CHANGELOG.md +13 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js +11 -11
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/index.js +16 -16
- package/_cjs/accounts/index.js.map +1 -1
- package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js +30 -30
- package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/encodeCallData.js +7 -7
- package/_cjs/accounts/kernel/utils/encodeCallData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/getNonceKey.js +5 -5
- package/_cjs/accounts/kernel/utils/getNonceKey.js.map +1 -1
- package/_cjs/accounts/kernel/utils/signMessage.js +4 -4
- package/_cjs/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_cjs/accounts/kernel/utils/signTypedData.js +4 -4
- package/_cjs/accounts/kernel/utils/signTypedData.js.map +1 -1
- package/_cjs/accounts/light/toLightSmartAccount.js +6 -6
- package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_cjs/accounts/nexus/toNexusSmartAccount.js +6 -6
- package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js +9 -8
- package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/toSimpleSmartAccount.js +6 -6
- package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js +14 -14
- package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_cjs/accounts/trust/toTrustSmartAccount.js +10 -10
- package/_cjs/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_cjs/actions/erc7579/accountId.js +2 -2
- package/_cjs/actions/erc7579/accountId.js.map +1 -1
- package/_cjs/actions/erc7579/installModule.js +4 -4
- package/_cjs/actions/erc7579/installModule.js.map +1 -1
- package/_cjs/actions/erc7579/installModules.js +4 -4
- package/_cjs/actions/erc7579/installModules.js.map +1 -1
- package/_cjs/actions/erc7579/isModuleInstalled.js +5 -5
- package/_cjs/actions/erc7579/isModuleInstalled.js.map +1 -1
- package/_cjs/actions/erc7579/supportsExecutionMode.js +2 -2
- package/_cjs/actions/erc7579/supportsExecutionMode.js.map +1 -1
- package/_cjs/actions/erc7579/supportsModule.js +2 -2
- package/_cjs/actions/erc7579/supportsModule.js.map +1 -1
- package/_cjs/actions/erc7579/uninstallModule.js +4 -4
- package/_cjs/actions/erc7579/uninstallModule.js.map +1 -1
- package/_cjs/actions/erc7579/uninstallModules.js +4 -4
- package/_cjs/actions/erc7579/uninstallModules.js.map +1 -1
- package/_cjs/actions/erc7579.js +24 -24
- package/_cjs/actions/erc7579.js.map +1 -1
- package/_cjs/actions/index.js +5 -5
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js +3 -3
- package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_cjs/actions/pimlico/validateSponsorshipPolicies.js +2 -2
- package/_cjs/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
- package/_cjs/actions/pimlico.js +14 -14
- package/_cjs/actions/pimlico.js.map +1 -1
- package/_cjs/actions/public/getSenderAddress.js +30 -137
- package/_cjs/actions/public/getSenderAddress.js.map +1 -1
- package/_cjs/actions/smartAccount/sendTransaction.js +2 -2
- package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -1
- package/_cjs/actions/smartAccount/signMessage.js +2 -2
- package/_cjs/actions/smartAccount/signMessage.js.map +1 -1
- package/_cjs/actions/smartAccount/signTypedData.js +2 -2
- package/_cjs/actions/smartAccount/signTypedData.js.map +1 -1
- package/_cjs/actions/smartAccount/writeContract.js +2 -2
- package/_cjs/actions/smartAccount/writeContract.js.map +1 -1
- package/_cjs/actions/smartAccount.js +8 -8
- package/_cjs/actions/smartAccount.js.map +1 -1
- package/_cjs/clients/createSmartAccountClient.js +3 -3
- package/_cjs/clients/createSmartAccountClient.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js +10 -10
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/decorators/smartAccount.js +11 -11
- package/_cjs/clients/decorators/smartAccount.js.map +1 -1
- package/_cjs/clients/index.js.map +1 -1
- package/_cjs/clients/pimlico.js +2 -2
- package/_cjs/clients/pimlico.js.map +1 -1
- package/_cjs/experimental/pimlico/index.js +2 -2
- package/_cjs/experimental/pimlico/index.js.map +1 -1
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +6 -5
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/encode7579Calls.js +3 -3
- package/_cjs/utils/encode7579Calls.js.map +1 -1
- package/_cjs/utils/encodeInstallModule.js +4 -4
- package/_cjs/utils/encodeInstallModule.js.map +1 -1
- package/_cjs/utils/encodeUninstallModule.js +4 -4
- package/_cjs/utils/encodeUninstallModule.js.map +1 -1
- package/_cjs/utils/index.js +25 -25
- package/_cjs/utils/index.js.map +1 -1
- package/_cjs/utils/toOwner.js.map +1 -1
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/encodeCallData.js.map +1 -1
- package/_esm/accounts/kernel/utils/getNonceKey.js.map +1 -1
- package/_esm/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_esm/accounts/kernel/utils/signTypedData.js.map +1 -1
- package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_esm/accounts/nexus/toNexusSmartAccount.js +1 -1
- package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js +2 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_esm/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_esm/actions/erc7579/accountId.js.map +1 -1
- package/_esm/actions/erc7579/installModule.js +1 -1
- package/_esm/actions/erc7579/installModule.js.map +1 -1
- package/_esm/actions/erc7579/installModules.js.map +1 -1
- package/_esm/actions/erc7579/isModuleInstalled.js.map +1 -1
- package/_esm/actions/erc7579/supportsExecutionMode.js.map +1 -1
- package/_esm/actions/erc7579/supportsModule.js.map +1 -1
- package/_esm/actions/erc7579/uninstallModule.js.map +1 -1
- package/_esm/actions/erc7579/uninstallModules.js.map +1 -1
- package/_esm/actions/erc7579.js.map +1 -1
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_esm/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
- package/_esm/actions/pimlico.js.map +1 -1
- package/_esm/actions/public/getSenderAddress.js +33 -142
- package/_esm/actions/public/getSenderAddress.js.map +1 -1
- package/_esm/actions/smartAccount/sendTransaction.js.map +1 -1
- package/_esm/actions/smartAccount/signMessage.js.map +1 -1
- package/_esm/actions/smartAccount/signTypedData.js.map +1 -1
- package/_esm/actions/smartAccount/writeContract.js.map +1 -1
- package/_esm/actions/smartAccount.js.map +1 -1
- package/_esm/clients/createSmartAccountClient.js +2 -2
- package/_esm/clients/createSmartAccountClient.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/decorators/smartAccount.js +3 -3
- package/_esm/clients/decorators/smartAccount.js.map +1 -1
- package/_esm/clients/index.js.map +1 -1
- package/_esm/clients/pimlico.js.map +1 -1
- package/_esm/experimental/pimlico/index.js.map +1 -1
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +2 -1
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/utils/encode7579Calls.js.map +1 -1
- package/_esm/utils/encodeInstallModule.js.map +1 -1
- package/_esm/utils/encodeUninstallModule.js.map +1 -1
- package/_esm/utils/index.js.map +1 -1
- package/_esm/utils/toOwner.js.map +1 -1
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts +3 -2
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/index.d.ts +8 -8
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts +3 -2
- package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/encodeCallData.d.ts +1 -1
- package/_types/accounts/kernel/utils/encodeCallData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/getNonceKey.d.ts +1 -1
- package/_types/accounts/kernel/utils/getNonceKey.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/isKernelV2.d.ts +1 -1
- package/_types/accounts/kernel/utils/isKernelV2.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/signMessage.d.ts +1 -1
- package/_types/accounts/kernel/utils/signMessage.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/signTypedData.d.ts +1 -1
- package/_types/accounts/kernel/utils/signTypedData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts +1 -1
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts.map +1 -1
- package/_types/accounts/light/toLightSmartAccount.d.ts +3 -2
- package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts +3 -2
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -1
- package/_types/accounts/safe/toSafeSmartAccount.d.ts +3 -2
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts +3 -2
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts +3 -2
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts.map +1 -1
- package/_types/accounts/trust/toTrustSmartAccount.d.ts +3 -2
- package/_types/accounts/trust/toTrustSmartAccount.d.ts.map +1 -1
- package/_types/actions/erc7579/installModule.d.ts +1 -1
- package/_types/actions/erc7579/installModule.d.ts.map +1 -1
- package/_types/actions/erc7579/installModules.d.ts +1 -1
- package/_types/actions/erc7579/installModules.d.ts.map +1 -1
- package/_types/actions/erc7579/isModuleInstalled.d.ts +1 -1
- package/_types/actions/erc7579/isModuleInstalled.d.ts.map +1 -1
- package/_types/actions/erc7579/uninstallModule.d.ts +1 -1
- package/_types/actions/erc7579/uninstallModule.d.ts.map +1 -1
- package/_types/actions/erc7579/uninstallModules.d.ts +1 -1
- package/_types/actions/erc7579/uninstallModules.d.ts.map +1 -1
- package/_types/actions/erc7579.d.ts +10 -10
- package/_types/actions/erc7579.d.ts.map +1 -1
- package/_types/actions/index.d.ts +4 -4
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/pimlico/getTokenQuotes.d.ts +1 -1
- package/_types/actions/pimlico/getTokenQuotes.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +1 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationStatus.d.ts +1 -1
- package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -1
- package/_types/actions/pimlico/sendCompressedUserOperation.d.ts +1 -1
- package/_types/actions/pimlico/sendCompressedUserOperation.d.ts.map +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
- package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts +1 -1
- package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts.map +1 -1
- package/_types/actions/pimlico.d.ts +8 -8
- package/_types/actions/pimlico.d.ts.map +1 -1
- package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
- package/_types/actions/smartAccount.d.ts +4 -4
- package/_types/actions/smartAccount.d.ts.map +1 -1
- package/_types/clients/createSmartAccountClient.d.ts +1 -1
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +4 -4
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/decorators/smartAccount.d.ts +5 -51
- package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
- package/_types/clients/index.d.ts +2 -2
- package/_types/clients/index.d.ts.map +1 -1
- package/_types/clients/pimlico.d.ts +2 -2
- package/_types/clients/pimlico.d.ts.map +1 -1
- package/_types/experimental/pimlico/index.d.ts +1 -1
- package/_types/experimental/pimlico/index.d.ts.map +1 -1
- package/_types/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.d.ts.map +1 -1
- package/_types/index.d.ts +3 -3
- package/_types/index.d.ts.map +1 -1
- package/_types/utils/encode7579Calls.d.ts +1 -1
- package/_types/utils/encode7579Calls.d.ts.map +1 -1
- package/_types/utils/encodeInstallModule.d.ts +1 -1
- package/_types/utils/encodeInstallModule.d.ts.map +1 -1
- package/_types/utils/encodeUninstallModule.d.ts +1 -1
- package/_types/utils/encodeUninstallModule.d.ts.map +1 -1
- package/_types/utils/index.d.ts +12 -12
- package/_types/utils/index.d.ts.map +1 -1
- package/_types/utils/toOwner.d.ts +6 -3
- package/_types/utils/toOwner.d.ts.map +1 -1
- package/accounts/biconomy/toBiconomySmartAccount.ts +4 -5
- package/accounts/index.ts +8 -8
- package/accounts/kernel/toEcdsaKernelSmartAccount.ts +16 -14
- package/accounts/kernel/utils/encodeCallData.ts +4 -4
- package/accounts/kernel/utils/getNonceKey.ts +3 -3
- package/accounts/kernel/utils/isKernelV2.ts +1 -1
- package/accounts/kernel/utils/signMessage.ts +5 -2
- package/accounts/kernel/utils/signTypedData.ts +5 -2
- package/accounts/kernel/utils/wrapMessageHash.ts +1 -1
- package/accounts/light/toLightSmartAccount.ts +4 -5
- package/accounts/nexus/toNexusSmartAccount.ts +4 -5
- package/accounts/safe/toSafeSmartAccount.ts +5 -5
- package/accounts/simple/toSimpleSmartAccount.ts +4 -5
- package/accounts/thirdweb/toThirdwebSmartAccount.ts +8 -9
- package/accounts/trust/toTrustSmartAccount.ts +6 -7
- package/actions/erc7579/accountId.ts +1 -1
- package/actions/erc7579/installModule.ts +3 -3
- package/actions/erc7579/installModules.ts +2 -2
- package/actions/erc7579/isModuleInstalled.ts +2 -2
- package/actions/erc7579/supportsExecutionMode.ts +1 -1
- package/actions/erc7579/supportsModule.ts +1 -1
- package/actions/erc7579/uninstallModule.ts +3 -3
- package/actions/erc7579/uninstallModules.ts +2 -2
- package/actions/erc7579.ts +13 -10
- package/actions/index.ts +4 -4
- package/actions/pimlico/getTokenQuotes.ts +1 -1
- package/actions/pimlico/getUserOperationGasPrice.ts +1 -1
- package/actions/pimlico/getUserOperationStatus.ts +1 -1
- package/actions/pimlico/sendCompressedUserOperation.ts +1 -1
- package/actions/pimlico/sponsorUserOperation.ts +2 -2
- package/actions/pimlico/validateSponsorshipPolicies.ts +2 -2
- package/actions/pimlico.ts +8 -8
- package/actions/public/getSenderAddress.test.ts +1 -1
- package/actions/public/getSenderAddress.ts +42 -186
- package/actions/smartAccount/sendTransaction.ts +1 -1
- package/actions/smartAccount/signMessage.ts +1 -1
- package/actions/smartAccount/signTypedData.ts +1 -1
- package/actions/smartAccount/writeContract.ts +1 -1
- package/actions/smartAccount.ts +4 -4
- package/clients/createSmartAccountClient.ts +3 -3
- package/clients/decorators/pimlico.ts +4 -4
- package/clients/decorators/smartAccount.ts +12 -14
- package/clients/index.ts +2 -2
- package/clients/pimlico.ts +2 -2
- package/experimental/pimlico/index.ts +1 -1
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +3 -2
- package/index.ts +3 -3
- package/package.json +1 -1
- package/utils/encode7579Calls.ts +1 -1
- package/utils/encodeInstallModule.ts +2 -2
- package/utils/encodeUninstallModule.ts +2 -2
- package/utils/index.ts +15 -12
- package/utils/toOwner.ts +7 -12
|
@@ -4,7 +4,6 @@ import type {
|
|
|
4
4
|
Assign,
|
|
5
5
|
Chain,
|
|
6
6
|
Client,
|
|
7
|
-
EIP1193Provider,
|
|
8
7
|
LocalAccount,
|
|
9
8
|
OneOf,
|
|
10
9
|
Transport,
|
|
@@ -12,7 +11,7 @@ import type {
|
|
|
12
11
|
WalletClient
|
|
13
12
|
} from "viem"
|
|
14
13
|
import { getChainId } from "viem/actions"
|
|
15
|
-
import { getAccountNonce } from "../../actions/public/getAccountNonce"
|
|
14
|
+
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
|
|
16
15
|
|
|
17
16
|
import {
|
|
18
17
|
type SmartAccount,
|
|
@@ -25,12 +24,12 @@ import {
|
|
|
25
24
|
toSmartAccount
|
|
26
25
|
} from "viem/account-abstraction"
|
|
27
26
|
import { getAction, toHex } from "viem/utils"
|
|
28
|
-
import { toOwner } from "../../utils/toOwner"
|
|
29
|
-
import { encodeCallData } from "./utils/encodeCallData"
|
|
30
|
-
import { getAccountAddress } from "./utils/getAccountAddress"
|
|
31
|
-
import { getFactoryData } from "./utils/getFactoryData"
|
|
32
|
-
import { signMessage } from "./utils/signMessage"
|
|
33
|
-
import { signTypedData } from "./utils/signTypedData"
|
|
27
|
+
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"
|
|
28
|
+
import { encodeCallData } from "./utils/encodeCallData.js"
|
|
29
|
+
import { getAccountAddress } from "./utils/getAccountAddress.js"
|
|
30
|
+
import { getFactoryData } from "./utils/getFactoryData.js"
|
|
31
|
+
import { signMessage } from "./utils/signMessage.js"
|
|
32
|
+
import { signTypedData } from "./utils/signTypedData.js"
|
|
34
33
|
|
|
35
34
|
/**
|
|
36
35
|
* Default addresses for Thirdweb Smart Account
|
|
@@ -49,7 +48,7 @@ export type ToThirdwebSmartAccountParameters<
|
|
|
49
48
|
> = {
|
|
50
49
|
client: Client
|
|
51
50
|
owner: OneOf<
|
|
52
|
-
|
|
|
51
|
+
| EthereumProvider
|
|
53
52
|
| WalletClient<Transport, Chain | undefined, Account>
|
|
54
53
|
| LocalAccount
|
|
55
54
|
>
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
type Assign,
|
|
5
5
|
type Chain,
|
|
6
6
|
type Client,
|
|
7
|
-
type EIP1193Provider,
|
|
8
7
|
type Hex,
|
|
9
8
|
type LocalAccount,
|
|
10
9
|
type OneOf,
|
|
@@ -14,7 +13,7 @@ import {
|
|
|
14
13
|
hashTypedData
|
|
15
14
|
} from "viem"
|
|
16
15
|
import { getChainId, signMessage } from "viem/actions"
|
|
17
|
-
import { getAccountNonce } from "../../actions/public/getAccountNonce"
|
|
16
|
+
import { getAccountNonce } from "../../actions/public/getAccountNonce.js"
|
|
18
17
|
|
|
19
18
|
import {
|
|
20
19
|
type SmartAccount,
|
|
@@ -26,10 +25,10 @@ import {
|
|
|
26
25
|
toSmartAccount
|
|
27
26
|
} from "viem/account-abstraction"
|
|
28
27
|
import { getAction } from "viem/utils"
|
|
29
|
-
import { getSenderAddress } from "../../actions/public/getSenderAddress"
|
|
30
|
-
import { toOwner } from "../../utils/toOwner"
|
|
31
|
-
import { encodeCallData } from "./utils/encodeCallData"
|
|
32
|
-
import { getFactoryData } from "./utils/getFactoryData"
|
|
28
|
+
import { getSenderAddress } from "../../actions/public/getSenderAddress.js"
|
|
29
|
+
import { type EthereumProvider, toOwner } from "../../utils/toOwner.js"
|
|
30
|
+
import { encodeCallData } from "./utils/encodeCallData.js"
|
|
31
|
+
import { getFactoryData } from "./utils/getFactoryData.js"
|
|
33
32
|
|
|
34
33
|
async function _signTypedData(
|
|
35
34
|
signer: LocalAccount,
|
|
@@ -69,7 +68,7 @@ export const TRUST_ADDRESSES: {
|
|
|
69
68
|
export type ToTrustSmartAccountParameters = {
|
|
70
69
|
client: Client
|
|
71
70
|
owner: OneOf<
|
|
72
|
-
|
|
|
71
|
+
| EthereumProvider
|
|
73
72
|
| WalletClient<Transport, Chain | undefined, Account>
|
|
74
73
|
| LocalAccount
|
|
75
74
|
>
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
} from "viem/account-abstraction"
|
|
13
13
|
import { call, readContract } from "viem/actions"
|
|
14
14
|
import { getAction } from "viem/utils"
|
|
15
|
-
import { AccountNotFoundError } from "../../errors"
|
|
15
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
16
16
|
|
|
17
17
|
export async function accountId<TSmartAccount extends SmartAccount | undefined>(
|
|
18
18
|
client: Client<Transport, Chain | undefined, TSmartAccount>,
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
sendUserOperation
|
|
8
8
|
} from "viem/account-abstraction"
|
|
9
9
|
import { getAction, parseAccount } from "viem/utils"
|
|
10
|
-
import { AccountNotFoundError } from "../../errors"
|
|
11
|
-
import { encodeInstallModule } from "../../utils"
|
|
12
|
-
import type { ModuleType } from "./supportsModule"
|
|
10
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
11
|
+
import { encodeInstallModule } from "../../utils/encodeInstallModule.js"
|
|
12
|
+
import type { ModuleType } from "./supportsModule.js"
|
|
13
13
|
|
|
14
14
|
export type InstallModuleParameters<
|
|
15
15
|
TSmartAccount extends SmartAccount | undefined,
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
sendUserOperation
|
|
7
7
|
} from "viem/account-abstraction"
|
|
8
8
|
import { getAction, parseAccount } from "viem/utils"
|
|
9
|
-
import { AccountNotFoundError } from "../../errors"
|
|
9
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
10
10
|
import {
|
|
11
11
|
type EncodeInstallModuleParameters,
|
|
12
12
|
encodeInstallModule
|
|
13
|
-
} from "../../utils/encodeInstallModule"
|
|
13
|
+
} from "../../utils/encodeInstallModule.js"
|
|
14
14
|
|
|
15
15
|
export type InstallModulesParameters<
|
|
16
16
|
TSmartAccount extends SmartAccount | undefined,
|
|
@@ -16,8 +16,8 @@ import type {
|
|
|
16
16
|
} from "viem/account-abstraction"
|
|
17
17
|
import { call, readContract } from "viem/actions"
|
|
18
18
|
import { getAction, parseAccount } from "viem/utils"
|
|
19
|
-
import { AccountNotFoundError } from "../../errors"
|
|
20
|
-
import { type ModuleType, parseModuleTypeId } from "./supportsModule"
|
|
19
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
20
|
+
import { type ModuleType, parseModuleTypeId } from "./supportsModule.js"
|
|
21
21
|
|
|
22
22
|
export type IsModuleInstalledParameters<
|
|
23
23
|
TSmartAccount extends SmartAccount | undefined
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
import { call, readContract } from "viem/actions"
|
|
18
18
|
import { getAction } from "viem/utils"
|
|
19
19
|
import { parseAccount } from "viem/utils"
|
|
20
|
-
import { AccountNotFoundError } from "../../errors"
|
|
20
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
21
21
|
|
|
22
22
|
export type CallType = "call" | "delegatecall" | "batchcall"
|
|
23
23
|
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
import { call, readContract } from "viem/actions"
|
|
14
14
|
import { getAction } from "viem/utils"
|
|
15
15
|
import { parseAccount } from "viem/utils"
|
|
16
|
-
import { AccountNotFoundError } from "../../errors"
|
|
16
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
17
17
|
|
|
18
18
|
export type ModuleType = "validator" | "executor" | "fallback" | "hook"
|
|
19
19
|
|
|
@@ -16,9 +16,9 @@ import {
|
|
|
16
16
|
} from "viem/account-abstraction"
|
|
17
17
|
import { getAction } from "viem/utils"
|
|
18
18
|
import { parseAccount } from "viem/utils"
|
|
19
|
-
import { AccountNotFoundError } from "../../errors"
|
|
20
|
-
import { encodeUninstallModule } from "../../utils/encodeUninstallModule"
|
|
21
|
-
import type { ModuleType } from "./supportsModule"
|
|
19
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
20
|
+
import { encodeUninstallModule } from "../../utils/encodeUninstallModule.js"
|
|
21
|
+
import type { ModuleType } from "./supportsModule.js"
|
|
22
22
|
|
|
23
23
|
export type UninstallModuleParameters<
|
|
24
24
|
TSmartAccount extends SmartAccount | undefined,
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
} from "viem/account-abstraction"
|
|
8
8
|
import { getAction } from "viem/utils"
|
|
9
9
|
import { parseAccount } from "viem/utils"
|
|
10
|
-
import { AccountNotFoundError } from "../../errors"
|
|
10
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
11
11
|
import {
|
|
12
12
|
type EncodeUninstallModuleParameters,
|
|
13
13
|
encodeUninstallModule
|
|
14
|
-
} from "../../utils/encodeUninstallModule"
|
|
14
|
+
} from "../../utils/encodeUninstallModule.js"
|
|
15
15
|
|
|
16
16
|
export type UninstallModulesParameters<
|
|
17
17
|
TSmartAccount extends SmartAccount | undefined,
|
package/actions/erc7579.ts
CHANGED
|
@@ -3,37 +3,40 @@ import type {
|
|
|
3
3
|
GetSmartAccountParameter,
|
|
4
4
|
SmartAccount
|
|
5
5
|
} from "viem/account-abstraction"
|
|
6
|
-
import { accountId } from "./erc7579/accountId"
|
|
6
|
+
import { accountId } from "./erc7579/accountId.js"
|
|
7
7
|
import {
|
|
8
8
|
type InstallModuleParameters,
|
|
9
9
|
installModule
|
|
10
|
-
} from "./erc7579/installModule"
|
|
10
|
+
} from "./erc7579/installModule.js"
|
|
11
11
|
import {
|
|
12
12
|
type InstallModulesParameters,
|
|
13
13
|
installModules
|
|
14
|
-
} from "./erc7579/installModules"
|
|
14
|
+
} from "./erc7579/installModules.js"
|
|
15
15
|
import {
|
|
16
16
|
type IsModuleInstalledParameters,
|
|
17
17
|
isModuleInstalled
|
|
18
|
-
} from "./erc7579/isModuleInstalled"
|
|
18
|
+
} from "./erc7579/isModuleInstalled.js"
|
|
19
19
|
import {
|
|
20
20
|
type SupportsExecutionModeParameters,
|
|
21
21
|
supportsExecutionMode
|
|
22
|
-
} from "./erc7579/supportsExecutionMode"
|
|
23
|
-
import type {
|
|
22
|
+
} from "./erc7579/supportsExecutionMode.js"
|
|
23
|
+
import type {
|
|
24
|
+
CallType,
|
|
25
|
+
ExecutionMode
|
|
26
|
+
} from "./erc7579/supportsExecutionMode.js"
|
|
24
27
|
import {
|
|
25
28
|
type SupportsModuleParameters,
|
|
26
29
|
supportsModule
|
|
27
|
-
} from "./erc7579/supportsModule"
|
|
28
|
-
import type { ModuleType } from "./erc7579/supportsModule"
|
|
30
|
+
} from "./erc7579/supportsModule.js"
|
|
31
|
+
import type { ModuleType } from "./erc7579/supportsModule.js"
|
|
29
32
|
import {
|
|
30
33
|
type UninstallModuleParameters,
|
|
31
34
|
uninstallModule
|
|
32
|
-
} from "./erc7579/uninstallModule"
|
|
35
|
+
} from "./erc7579/uninstallModule.js"
|
|
33
36
|
import {
|
|
34
37
|
type UninstallModulesParameters,
|
|
35
38
|
uninstallModules
|
|
36
|
-
} from "./erc7579/uninstallModules"
|
|
39
|
+
} from "./erc7579/uninstallModules.js"
|
|
37
40
|
|
|
38
41
|
export type Erc7579Actions<TSmartAccount extends SmartAccount | undefined> = {
|
|
39
42
|
accountId: (
|
package/actions/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { GetSenderAddressParams } from "./public/getSenderAddress"
|
|
1
|
+
import type { GetSenderAddressParams } from "./public/getSenderAddress.js"
|
|
2
2
|
import {
|
|
3
3
|
InvalidEntryPointError,
|
|
4
4
|
getSenderAddress
|
|
5
|
-
} from "./public/getSenderAddress"
|
|
5
|
+
} from "./public/getSenderAddress.js"
|
|
6
6
|
|
|
7
|
-
import type { GetAccountNonceParams } from "./public/getAccountNonce"
|
|
8
|
-
import { getAccountNonce } from "./public/getAccountNonce"
|
|
7
|
+
import type { GetAccountNonceParams } from "./public/getAccountNonce.js"
|
|
8
|
+
import { getAccountNonce } from "./public/getAccountNonce.js"
|
|
9
9
|
|
|
10
10
|
export type { GetSenderAddressParams, GetAccountNonceParams }
|
|
11
11
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
hexToBigInt,
|
|
10
10
|
numberToHex
|
|
11
11
|
} from "viem"
|
|
12
|
-
import type { PimlicoRpcSchema } from "../../types/pimlico"
|
|
12
|
+
import type { PimlicoRpcSchema } from "../../types/pimlico.js"
|
|
13
13
|
|
|
14
14
|
export type GetTokenQuotesParameters<
|
|
15
15
|
TChain extends Chain | undefined,
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
Hex,
|
|
8
8
|
Transport
|
|
9
9
|
} from "viem"
|
|
10
|
-
import type { PimlicoRpcSchema } from "../../types/pimlico"
|
|
10
|
+
import type { PimlicoRpcSchema } from "../../types/pimlico.js"
|
|
11
11
|
|
|
12
12
|
export type SendCompressedUserOperationParameters = {
|
|
13
13
|
compressedUserOperation: Hex
|
|
@@ -9,8 +9,8 @@ import type {
|
|
|
9
9
|
Transport
|
|
10
10
|
} from "viem"
|
|
11
11
|
import type { UserOperation } from "viem/account-abstraction"
|
|
12
|
-
import type { PimlicoRpcSchema } from "../../types/pimlico"
|
|
13
|
-
import { deepHexlify } from "../../utils/deepHexlify"
|
|
12
|
+
import type { PimlicoRpcSchema } from "../../types/pimlico.js"
|
|
13
|
+
import { deepHexlify } from "../../utils/deepHexlify.js"
|
|
14
14
|
|
|
15
15
|
export type PimlicoSponsorUserOperationParameters<
|
|
16
16
|
entryPointVersion extends "0.6" | "0.7"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Account, Address, Chain, Client, Transport } from "viem"
|
|
2
2
|
import type { UserOperation } from "viem/account-abstraction"
|
|
3
|
-
import type { PimlicoRpcSchema } from "../../types/pimlico"
|
|
4
|
-
import { deepHexlify } from "../../utils/deepHexlify"
|
|
3
|
+
import type { PimlicoRpcSchema } from "../../types/pimlico.js"
|
|
4
|
+
import { deepHexlify } from "../../utils/deepHexlify.js"
|
|
5
5
|
|
|
6
6
|
export type ValidateSponsorshipPoliciesParameters = {
|
|
7
7
|
userOperation: UserOperation
|
package/actions/pimlico.ts
CHANGED
|
@@ -2,34 +2,34 @@ import {
|
|
|
2
2
|
type GetTokenQuotesParameters,
|
|
3
3
|
type GetTokenQuotesReturnType,
|
|
4
4
|
getTokenQuotes
|
|
5
|
-
} from "./pimlico/getTokenQuotes"
|
|
5
|
+
} from "./pimlico/getTokenQuotes.js"
|
|
6
6
|
import {
|
|
7
7
|
type GetUserOperationGasPriceReturnType,
|
|
8
8
|
getUserOperationGasPrice
|
|
9
|
-
} from "./pimlico/getUserOperationGasPrice"
|
|
9
|
+
} from "./pimlico/getUserOperationGasPrice.js"
|
|
10
10
|
import {
|
|
11
11
|
type GetUserOperationStatusParameters,
|
|
12
12
|
type GetUserOperationStatusReturnType,
|
|
13
13
|
getUserOperationStatus
|
|
14
|
-
} from "./pimlico/getUserOperationStatus"
|
|
14
|
+
} from "./pimlico/getUserOperationStatus.js"
|
|
15
15
|
import {
|
|
16
16
|
type SendCompressedUserOperationParameters,
|
|
17
17
|
sendCompressedUserOperation
|
|
18
|
-
} from "./pimlico/sendCompressedUserOperation"
|
|
18
|
+
} from "./pimlico/sendCompressedUserOperation.js"
|
|
19
19
|
import {
|
|
20
20
|
type PimlicoSponsorUserOperationParameters,
|
|
21
21
|
type SponsorUserOperationReturnType,
|
|
22
22
|
sponsorUserOperation
|
|
23
|
-
} from "./pimlico/sponsorUserOperation"
|
|
23
|
+
} from "./pimlico/sponsorUserOperation.js"
|
|
24
24
|
|
|
25
|
-
import type { PimlicoActions } from "../clients/decorators/pimlico"
|
|
26
|
-
import { pimlicoActions } from "../clients/decorators/pimlico"
|
|
25
|
+
import type { PimlicoActions } from "../clients/decorators/pimlico.js"
|
|
26
|
+
import { pimlicoActions } from "../clients/decorators/pimlico.js"
|
|
27
27
|
|
|
28
28
|
import {
|
|
29
29
|
type ValidateSponsorshipPolicies,
|
|
30
30
|
type ValidateSponsorshipPoliciesParameters,
|
|
31
31
|
validateSponsorshipPolicies
|
|
32
|
-
} from "./pimlico/validateSponsorshipPolicies"
|
|
32
|
+
} from "./pimlico/validateSponsorshipPolicies.js"
|
|
33
33
|
|
|
34
34
|
export type {
|
|
35
35
|
GetUserOperationGasPriceReturnType,
|
|
@@ -78,7 +78,7 @@ describe("getSenderAddress", () => {
|
|
|
78
78
|
entryPointAddress: "0x0000000000000000000000000000000000000000",
|
|
79
79
|
initCode: concatHex([factory, factoryData])
|
|
80
80
|
})
|
|
81
|
-
).rejects.toThrowError(
|
|
81
|
+
).rejects.toThrowError()
|
|
82
82
|
})
|
|
83
83
|
testWithRpc("getSenderAddress_V07", async ({ rpc }) => {
|
|
84
84
|
const { anvilRpc, altoRpc } = rpc
|
|
@@ -2,22 +2,40 @@ import {
|
|
|
2
2
|
type Address,
|
|
3
3
|
BaseError,
|
|
4
4
|
type Client,
|
|
5
|
-
type ContractFunctionExecutionErrorType,
|
|
6
|
-
ContractFunctionRevertedError,
|
|
7
5
|
type Hex,
|
|
8
|
-
InvalidInputRpcError,
|
|
9
6
|
type OneOf,
|
|
10
7
|
type Prettify,
|
|
11
|
-
RawContractError,
|
|
12
|
-
RpcRequestError,
|
|
13
|
-
UnknownRpcError,
|
|
14
8
|
concat,
|
|
15
|
-
|
|
9
|
+
encodeDeployData,
|
|
10
|
+
getAddress
|
|
16
11
|
} from "viem"
|
|
17
12
|
|
|
18
|
-
import {
|
|
13
|
+
import { call } from "viem/actions"
|
|
19
14
|
import { getAction } from "viem/utils"
|
|
20
15
|
|
|
16
|
+
// https://github.com/pimlicolabs/entrypoint-estimations/blob/main/src/GetSenderAddressHelper.sol
|
|
17
|
+
const GetSenderAddressHelperByteCode =
|
|
18
|
+
"0x608060405260405161058a38038061058a83398181016040528101906100259190610341565b5f808373ffffffffffffffffffffffffffffffffffffffff16639b249f6960e01b8460405160240161005791906103ed565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516100c19190610447565b5f604051808303815f865af19150503d805f81146100fa576040519150601f19603f3d011682016040523d82523d5f602084013e6100ff565b606091505b50915091505f8261015f576004825111156101245760248201519050805f526014600cf35b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610156906104dd565b60405180910390fd5b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101919061056b565b60405180910390fd5b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101d4826101ab565b9050919050565b6101e4816101ca565b81146101ee575f80fd5b50565b5f815190506101ff816101db565b92915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6102538261020d565b810181811067ffffffffffffffff821117156102725761027161021d565b5b80604052505050565b5f61028461019a565b9050610290828261024a565b919050565b5f67ffffffffffffffff8211156102af576102ae61021d565b5b6102b88261020d565b9050602081019050919050565b8281835e5f83830152505050565b5f6102e56102e084610295565b61027b565b90508281526020810184848401111561030157610300610209565b5b61030c8482856102c5565b509392505050565b5f82601f83011261032857610327610205565b5b81516103388482602086016102d3565b91505092915050565b5f8060408385031215610357576103566101a3565b5b5f610364858286016101f1565b925050602083015167ffffffffffffffff811115610385576103846101a7565b5b61039185828601610314565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f6103bf8261039b565b6103c981856103a5565b93506103d98185602086016102c5565b6103e28161020d565b840191505092915050565b5f6020820190508181035f83015261040581846103b5565b905092915050565b5f81905092915050565b5f6104218261039b565b61042b818561040d565b935061043b8185602086016102c5565b80840191505092915050565b5f6104528284610417565b915081905092915050565b5f82825260208201905092915050565b7f67657453656e64657241646472657373206661696c656420776974686f7574205f8201527f6461746100000000000000000000000000000000000000000000000000000000602082015250565b5f6104c760248361045d565b91506104d28261046d565b604082019050919050565b5f6020820190508181035f8301526104f4816104bb565b9050919050565b7f67657453656e6465724164647265737320646964206e6f7420726576657274205f8201527f6173206578706563746564000000000000000000000000000000000000000000602082015250565b5f610555602b8361045d565b9150610560826104fb565b604082019050919050565b5f6020820190508181035f83015261058281610549565b905091905056fe"
|
|
19
|
+
|
|
20
|
+
const GetSenderAddressHelperAbi = [
|
|
21
|
+
{
|
|
22
|
+
inputs: [
|
|
23
|
+
{
|
|
24
|
+
internalType: "address",
|
|
25
|
+
name: "_entryPoint",
|
|
26
|
+
type: "address"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
internalType: "bytes",
|
|
30
|
+
name: "initCode",
|
|
31
|
+
type: "bytes"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
stateMutability: "payable",
|
|
35
|
+
type: "constructor"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
|
|
21
39
|
export type GetSenderAddressParams = OneOf<
|
|
22
40
|
| {
|
|
23
41
|
initCode: Hex
|
|
@@ -88,186 +106,24 @@ export const getSenderAddress = async (
|
|
|
88
106
|
)
|
|
89
107
|
}
|
|
90
108
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
name: "sender",
|
|
104
|
-
type: "address"
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
name: "SenderAddressResult",
|
|
108
|
-
type: "error"
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
inputs: [
|
|
112
|
-
{
|
|
113
|
-
internalType: "bytes",
|
|
114
|
-
name: "initCode",
|
|
115
|
-
type: "bytes"
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
name: "getSenderAddress",
|
|
119
|
-
outputs: [],
|
|
120
|
-
stateMutability: "nonpayable",
|
|
121
|
-
type: "function"
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
functionName: "getSenderAddress",
|
|
125
|
-
args: [initCode || concat([factory as Hex, factoryData as Hex])]
|
|
109
|
+
const formattedInitCode =
|
|
110
|
+
initCode || concat([factory as Hex, factoryData as Hex])
|
|
111
|
+
|
|
112
|
+
const { data } = await getAction(
|
|
113
|
+
client,
|
|
114
|
+
call,
|
|
115
|
+
"call"
|
|
116
|
+
)({
|
|
117
|
+
data: encodeDeployData({
|
|
118
|
+
abi: GetSenderAddressHelperAbi,
|
|
119
|
+
bytecode: GetSenderAddressHelperByteCode,
|
|
120
|
+
args: [entryPointAddress, formattedInitCode]
|
|
126
121
|
})
|
|
127
|
-
}
|
|
128
|
-
const revertError = (e as ContractFunctionExecutionErrorType).walk(
|
|
129
|
-
(err) =>
|
|
130
|
-
err instanceof ContractFunctionRevertedError ||
|
|
131
|
-
err instanceof RpcRequestError ||
|
|
132
|
-
err instanceof InvalidInputRpcError ||
|
|
133
|
-
err instanceof UnknownRpcError
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
if (!revertError) {
|
|
137
|
-
const cause = (e as ContractFunctionExecutionErrorType).cause as any
|
|
138
|
-
const errorName = cause?.data?.errorName ?? ""
|
|
139
|
-
if (
|
|
140
|
-
errorName === "SenderAddressResult" &&
|
|
141
|
-
cause?.data?.args &&
|
|
142
|
-
cause?.data?.args[0]
|
|
143
|
-
) {
|
|
144
|
-
return cause.data?.args[0] as Address
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (revertError instanceof ContractFunctionRevertedError) {
|
|
149
|
-
const errorName = revertError.data?.errorName ?? ""
|
|
150
|
-
if (
|
|
151
|
-
errorName === "SenderAddressResult" &&
|
|
152
|
-
revertError.data?.args &&
|
|
153
|
-
revertError.data?.args[0]
|
|
154
|
-
) {
|
|
155
|
-
return revertError.data?.args[0] as Address
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (revertError instanceof RpcRequestError) {
|
|
160
|
-
const hexStringRegex = /0x[a-fA-F0-9]+/
|
|
161
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
162
|
-
const match = (revertError as unknown as any).cause.data.match(
|
|
163
|
-
hexStringRegex
|
|
164
|
-
)
|
|
165
|
-
|
|
166
|
-
if (!match) {
|
|
167
|
-
throw new Error(
|
|
168
|
-
"Failed to parse revert bytes from RPC response"
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const data: Hex = match[0]
|
|
173
|
-
|
|
174
|
-
const error = decodeErrorResult({
|
|
175
|
-
abi: [
|
|
176
|
-
{
|
|
177
|
-
inputs: [
|
|
178
|
-
{
|
|
179
|
-
internalType: "address",
|
|
180
|
-
name: "sender",
|
|
181
|
-
type: "address"
|
|
182
|
-
}
|
|
183
|
-
],
|
|
184
|
-
name: "SenderAddressResult",
|
|
185
|
-
type: "error"
|
|
186
|
-
}
|
|
187
|
-
],
|
|
188
|
-
data
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
return error.args[0] as Address
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (revertError instanceof InvalidInputRpcError) {
|
|
195
|
-
const { data: data_ } = (
|
|
196
|
-
e instanceof RawContractError
|
|
197
|
-
? e
|
|
198
|
-
: e instanceof BaseError
|
|
199
|
-
? e.walk((err) => "data" in (err as Error)) || e.walk()
|
|
200
|
-
: {}
|
|
201
|
-
) as RawContractError
|
|
202
|
-
|
|
203
|
-
const data = typeof data_ === "string" ? data_ : data_?.data
|
|
204
|
-
|
|
205
|
-
if (data === undefined) {
|
|
206
|
-
throw new Error(
|
|
207
|
-
"Failed to parse revert bytes from RPC response"
|
|
208
|
-
)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const error = decodeErrorResult({
|
|
212
|
-
abi: [
|
|
213
|
-
{
|
|
214
|
-
inputs: [
|
|
215
|
-
{
|
|
216
|
-
internalType: "address",
|
|
217
|
-
name: "sender",
|
|
218
|
-
type: "address"
|
|
219
|
-
}
|
|
220
|
-
],
|
|
221
|
-
name: "SenderAddressResult",
|
|
222
|
-
type: "error"
|
|
223
|
-
}
|
|
224
|
-
],
|
|
225
|
-
data
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
return error.args[0] as Address
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (revertError instanceof UnknownRpcError) {
|
|
232
|
-
const parsedBody = JSON.parse(
|
|
233
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
234
|
-
(revertError as unknown as any).cause.body
|
|
235
|
-
)
|
|
236
|
-
const revertData = parsedBody.error.data
|
|
237
|
-
|
|
238
|
-
const hexStringRegex = /0x[a-fA-F0-9]+/
|
|
239
|
-
const match = revertData.match(hexStringRegex)
|
|
240
|
-
|
|
241
|
-
if (!match) {
|
|
242
|
-
throw new Error(
|
|
243
|
-
"Failed to parse revert bytes from RPC response"
|
|
244
|
-
)
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const data: Hex = match[0]
|
|
248
|
-
|
|
249
|
-
const error = decodeErrorResult({
|
|
250
|
-
abi: [
|
|
251
|
-
{
|
|
252
|
-
inputs: [
|
|
253
|
-
{
|
|
254
|
-
internalType: "address",
|
|
255
|
-
name: "sender",
|
|
256
|
-
type: "address"
|
|
257
|
-
}
|
|
258
|
-
],
|
|
259
|
-
name: "SenderAddressResult",
|
|
260
|
-
type: "error"
|
|
261
|
-
}
|
|
262
|
-
],
|
|
263
|
-
data
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
return error.args[0] as Address
|
|
267
|
-
}
|
|
122
|
+
})
|
|
268
123
|
|
|
269
|
-
|
|
124
|
+
if (!data) {
|
|
125
|
+
throw new Error("Failed to get sender address")
|
|
270
126
|
}
|
|
271
127
|
|
|
272
|
-
|
|
128
|
+
return getAddress(data)
|
|
273
129
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
waitForUserOperationReceipt
|
|
13
13
|
} from "viem/account-abstraction"
|
|
14
14
|
import { getAction, parseAccount } from "viem/utils"
|
|
15
|
-
import { AccountNotFoundError } from "../../errors"
|
|
15
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Creates, signs, and sends a new transaction to the network.
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from "viem"
|
|
8
8
|
import type { SmartAccount } from "viem/account-abstraction"
|
|
9
9
|
import { parseAccount } from "viem/utils"
|
|
10
|
-
import { AccountNotFoundError } from "../../errors"
|
|
10
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "viem"
|
|
13
13
|
import type { SmartAccount } from "viem/account-abstraction"
|
|
14
14
|
import { parseAccount } from "viem/utils"
|
|
15
|
-
import { AccountNotFoundError } from "../../errors"
|
|
15
|
+
import { AccountNotFoundError } from "../../errors/index.js"
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))`
|