permissionless 0.3.5 → 0.3.7
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/index.js +8 -0
- package/_cjs/accounts/biconomy/index.js.map +1 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js +9 -5
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/etherspot/index.js +8 -0
- package/_cjs/accounts/etherspot/index.js.map +1 -0
- package/_cjs/accounts/kernel/index.js +18 -0
- package/_cjs/accounts/kernel/index.js.map +1 -0
- package/_cjs/accounts/kernel/toKernelSmartAccount.js +10 -6
- package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/signMessage.js +9 -7
- package/_cjs/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_cjs/accounts/kernel/utils/signTypedData.js +7 -6
- package/_cjs/accounts/kernel/utils/signTypedData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/wrapMessageHash.js +3 -3
- package/_cjs/accounts/kernel/utils/wrapMessageHash.js.map +1 -1
- package/_cjs/accounts/light/index.js +8 -0
- package/_cjs/accounts/light/index.js.map +1 -0
- package/_cjs/accounts/light/toLightSmartAccount.js +9 -5
- package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_cjs/accounts/nexus/index.js +8 -0
- package/_cjs/accounts/nexus/index.js.map +1 -0
- package/_cjs/accounts/safe/signUserOperation.js +3 -0
- package/_cjs/accounts/safe/signUserOperation.js.map +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js +4 -3
- package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/index.js +10 -0
- package/_cjs/accounts/simple/index.js.map +1 -0
- package/_cjs/accounts/simple/toSimpleSmartAccount.js +15 -10
- package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/index.js +8 -0
- package/_cjs/accounts/thirdweb/index.js.map +1 -0
- package/_cjs/accounts/thirdweb/utils/decodeCallData.js +7 -5
- package/_cjs/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
- package/_cjs/accounts/trust/index.js +8 -0
- package/_cjs/accounts/trust/index.js.map +1 -0
- package/_cjs/accounts/trust/utils/decodeCallData.js +7 -5
- package/_cjs/accounts/trust/utils/decodeCallData.js.map +1 -1
- package/_cjs/actions/{erc7579.js → erc7579/index.js} +9 -9
- package/_cjs/actions/erc7579/index.js.map +1 -0
- package/_cjs/actions/{etherspot.js → etherspot/index.js} +2 -2
- package/_cjs/actions/etherspot/index.js.map +1 -0
- package/_cjs/actions/{passkeyServer.js → passkeyServer/index.js} +4 -4
- package/_cjs/actions/passkeyServer/index.js.map +1 -0
- package/_cjs/actions/pimlico/estimateErc20PaymasterCost.js +7 -3
- package/_cjs/actions/pimlico/estimateErc20PaymasterCost.js.map +1 -1
- package/_cjs/actions/{pimlico.js → pimlico/index.js} +8 -8
- package/_cjs/actions/pimlico/index.js.map +1 -0
- package/_cjs/actions/{smartAccount.js → smartAccount/index.js} +5 -5
- package/_cjs/actions/smartAccount/index.js.map +1 -0
- package/_cjs/clients/createSmartAccountClient.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js +4 -4
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/{passkeyServer.js → passkeyServer/index.js} +2 -2
- package/_cjs/clients/passkeyServer/index.js.map +1 -0
- package/_cjs/clients/{pimlico.js → pimlico/index.js} +2 -2
- package/_cjs/clients/pimlico/index.js.map +1 -0
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +6 -5
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_esm/accounts/biconomy/index.js +5 -0
- package/_esm/accounts/biconomy/index.js.map +1 -0
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js +9 -5
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/etherspot/index.js +5 -0
- package/_esm/accounts/etherspot/index.js.map +1 -0
- package/_esm/accounts/kernel/index.js +15 -0
- package/_esm/accounts/kernel/index.js.map +1 -0
- package/_esm/accounts/kernel/toKernelSmartAccount.js +10 -6
- package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/signMessage.js +9 -7
- package/_esm/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_esm/accounts/kernel/utils/signTypedData.js +7 -6
- package/_esm/accounts/kernel/utils/signTypedData.js.map +1 -1
- package/_esm/accounts/kernel/utils/wrapMessageHash.js +3 -3
- package/_esm/accounts/kernel/utils/wrapMessageHash.js.map +1 -1
- package/_esm/accounts/light/index.js +5 -0
- package/_esm/accounts/light/index.js.map +1 -0
- package/_esm/accounts/light/toLightSmartAccount.js +9 -5
- package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_esm/accounts/nexus/index.js +5 -0
- package/_esm/accounts/nexus/index.js.map +1 -0
- package/_esm/accounts/safe/signUserOperation.js +3 -0
- package/_esm/accounts/safe/signUserOperation.js.map +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js +4 -3
- package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/index.js +7 -0
- package/_esm/accounts/simple/index.js.map +1 -0
- package/_esm/accounts/simple/toSimpleSmartAccount.js +15 -10
- package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/index.js +5 -0
- package/_esm/accounts/thirdweb/index.js.map +1 -0
- package/_esm/accounts/thirdweb/utils/decodeCallData.js +7 -5
- package/_esm/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
- package/_esm/accounts/trust/index.js +5 -0
- package/_esm/accounts/trust/index.js.map +1 -0
- package/_esm/accounts/trust/utils/decodeCallData.js +7 -5
- package/_esm/accounts/trust/utils/decodeCallData.js.map +1 -1
- package/_esm/actions/{erc7579.js → erc7579/index.js} +9 -9
- package/_esm/actions/erc7579/index.js.map +1 -0
- package/_esm/actions/etherspot/index.js +2 -0
- package/_esm/actions/etherspot/index.js.map +1 -0
- package/_esm/actions/passkeyServer/index.js +4 -0
- package/_esm/actions/passkeyServer/index.js.map +1 -0
- package/_esm/actions/pimlico/estimateErc20PaymasterCost.js +7 -3
- package/_esm/actions/pimlico/estimateErc20PaymasterCost.js.map +1 -1
- package/_esm/actions/pimlico/index.js +8 -0
- package/_esm/actions/pimlico/index.js.map +1 -0
- package/_esm/actions/smartAccount/index.js +5 -0
- package/_esm/actions/smartAccount/index.js.map +1 -0
- package/_esm/clients/createSmartAccountClient.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js +1 -1
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/{passkeyServer.js → passkeyServer/index.js} +2 -2
- package/_esm/clients/passkeyServer/index.js.map +1 -0
- package/_esm/clients/{pimlico.js → pimlico/index.js} +2 -2
- package/_esm/clients/pimlico/index.js.map +1 -0
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +5 -4
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_types/accounts/biconomy/index.d.ts +6 -0
- package/_types/accounts/biconomy/index.d.ts.map +1 -0
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/etherspot/index.d.ts +6 -0
- package/_types/accounts/etherspot/index.d.ts.map +1 -0
- package/_types/accounts/kernel/index.d.ts +22 -0
- package/_types/accounts/kernel/index.d.ts.map +1 -0
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/signMessage.d.ts +4 -5
- package/_types/accounts/kernel/utils/signMessage.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/signTypedData.d.ts +4 -4
- package/_types/accounts/kernel/utils/signTypedData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts +8 -3
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts.map +1 -1
- package/_types/accounts/light/index.d.ts +6 -0
- package/_types/accounts/light/index.d.ts.map +1 -0
- package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
- package/_types/accounts/nexus/index.d.ts +6 -0
- package/_types/accounts/nexus/index.d.ts.map +1 -0
- package/_types/accounts/safe/signUserOperation.d.ts.map +1 -1
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/index.d.ts +9 -0
- package/_types/accounts/simple/index.d.ts.map +1 -0
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/index.d.ts +6 -0
- package/_types/accounts/thirdweb/index.d.ts.map +1 -0
- package/_types/accounts/thirdweb/utils/decodeCallData.d.ts.map +1 -1
- package/_types/accounts/trust/index.d.ts +6 -0
- package/_types/accounts/trust/index.d.ts.map +1 -0
- package/_types/accounts/trust/utils/decodeCallData.d.ts.map +1 -1
- package/_types/actions/{erc7579.d.ts → erc7579/index.d.ts} +11 -11
- package/_types/actions/erc7579/index.d.ts.map +1 -0
- package/_types/actions/etherspot/index.d.ts +2 -0
- package/_types/actions/etherspot/index.d.ts.map +1 -0
- package/_types/actions/passkeyServer/index.d.ts +4 -0
- package/_types/actions/passkeyServer/index.d.ts.map +1 -0
- package/_types/actions/pimlico/estimateErc20PaymasterCost.d.ts.map +1 -1
- package/_types/actions/pimlico/index.d.ts +8 -0
- package/_types/actions/pimlico/index.d.ts.map +1 -0
- package/_types/actions/smartAccount/index.d.ts +5 -0
- package/_types/actions/smartAccount/index.d.ts.map +1 -0
- package/_types/clients/createSmartAccountClient.d.ts +9 -1
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +1 -1
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/{passkeyServer.d.ts → passkeyServer/index.d.ts} +8 -4
- package/_types/clients/passkeyServer/index.d.ts.map +1 -0
- package/_types/clients/pimlico/index.d.ts +21 -0
- package/_types/clients/pimlico/index.d.ts.map +1 -0
- package/_types/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.d.ts.map +1 -1
- package/accounts/biconomy/index.ts +11 -0
- package/accounts/biconomy/package.json +6 -0
- package/accounts/biconomy/toBiconomySmartAccount.ts +13 -5
- package/accounts/etherspot/index.ts +11 -0
- package/accounts/etherspot/package.json +6 -0
- package/accounts/kernel/index.ts +33 -0
- package/accounts/kernel/package.json +6 -0
- package/accounts/kernel/toKernelSmartAccount.ts +13 -6
- package/accounts/kernel/utils/signMessage.ts +19 -15
- package/accounts/kernel/utils/signTypedData.ts +14 -11
- package/accounts/kernel/utils/wrapMessageHash.ts +11 -8
- package/accounts/light/index.ts +12 -0
- package/accounts/light/package.json +6 -0
- package/accounts/light/toLightSmartAccount.ts +13 -5
- package/accounts/nexus/index.ts +11 -0
- package/accounts/nexus/package.json +6 -0
- package/accounts/package.json +6 -0
- package/accounts/safe/package.json +6 -0
- package/accounts/safe/signUserOperation.ts +4 -0
- package/accounts/safe/toSafeSmartAccount.ts +5 -3
- package/accounts/simple/index.ts +18 -0
- package/accounts/simple/package.json +6 -0
- package/accounts/simple/toSimpleSmartAccount.ts +21 -10
- package/accounts/thirdweb/index.ts +11 -0
- package/accounts/thirdweb/package.json +6 -0
- package/accounts/thirdweb/utils/decodeCallData.ts +9 -5
- package/accounts/trust/index.ts +11 -0
- package/accounts/trust/package.json +6 -0
- package/accounts/trust/utils/decodeCallData.ts +9 -5
- package/actions/{erc7579.ts → erc7579/index.ts} +10 -16
- package/actions/erc7579/package.json +6 -0
- package/actions/{etherspot.ts → etherspot/index.ts} +1 -1
- package/actions/etherspot/package.json +6 -0
- package/actions/{passkeyServer.ts → passkeyServer/index.ts} +3 -3
- package/actions/passkeyServer/package.json +6 -0
- package/actions/pimlico/estimateErc20PaymasterCost.ts +9 -3
- package/actions/{pimlico.ts → pimlico/index.ts} +7 -7
- package/actions/pimlico/package.json +6 -0
- package/actions/smartAccount/index.ts +7 -0
- package/actions/smartAccount/package.json +6 -0
- package/clients/createSmartAccountClient.ts +45 -20
- package/clients/decorators/pimlico.ts +10 -10
- package/clients/package.json +6 -0
- package/clients/{passkeyServer.ts → passkeyServer/index.ts} +15 -13
- package/clients/passkeyServer/package.json +6 -0
- package/clients/{pimlico.ts → pimlico/index.ts} +50 -23
- package/clients/pimlico/package.json +6 -0
- package/errors/package.json +6 -0
- package/experimental/pimlico/package.json +6 -0
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +6 -4
- package/package.json +74 -29
- package/utils/package.json +6 -0
- package/_cjs/actions/erc7579.js.map +0 -1
- package/_cjs/actions/etherspot.js.map +0 -1
- package/_cjs/actions/passkeyServer.js.map +0 -1
- package/_cjs/actions/pimlico.js.map +0 -1
- package/_cjs/actions/smartAccount.js.map +0 -1
- package/_cjs/clients/passkeyServer.js.map +0 -1
- package/_cjs/clients/pimlico.js.map +0 -1
- package/_esm/actions/erc7579.js.map +0 -1
- package/_esm/actions/etherspot.js +0 -2
- package/_esm/actions/etherspot.js.map +0 -1
- package/_esm/actions/passkeyServer.js +0 -4
- package/_esm/actions/passkeyServer.js.map +0 -1
- package/_esm/actions/pimlico.js +0 -8
- package/_esm/actions/pimlico.js.map +0 -1
- package/_esm/actions/smartAccount.js +0 -5
- package/_esm/actions/smartAccount.js.map +0 -1
- package/_esm/clients/passkeyServer.js.map +0 -1
- package/_esm/clients/pimlico.js.map +0 -1
- package/_types/actions/erc7579.d.ts.map +0 -1
- package/_types/actions/etherspot.d.ts +0 -2
- package/_types/actions/etherspot.d.ts.map +0 -1
- package/_types/actions/passkeyServer.d.ts +0 -4
- package/_types/actions/passkeyServer.d.ts.map +0 -1
- package/_types/actions/pimlico.d.ts +0 -8
- package/_types/actions/pimlico.d.ts.map +0 -1
- package/_types/actions/smartAccount.d.ts +0 -5
- package/_types/actions/smartAccount.d.ts.map +0 -1
- package/_types/clients/passkeyServer.d.ts.map +0 -1
- package/_types/clients/pimlico.d.ts +0 -13
- package/_types/clients/pimlico.d.ts.map +0 -1
- package/accounts/decodeCalls.test.ts +0 -505
- package/accounts/safe/signUserOperation.test.ts +0 -275
- package/actions/erc7579/accountId.test.ts +0 -39
- package/actions/erc7579/installModule.test.ts +0 -216
- package/actions/erc7579/installModules.test.ts +0 -237
- package/actions/erc7579/isModuleInstalled.test.ts +0 -72
- package/actions/erc7579/supportsExecutionMode.test.ts +0 -108
- package/actions/erc7579/supportsModule.test.ts +0 -35
- package/actions/erc7579/uninstallModule.test.ts +0 -129
- package/actions/erc7579/uninstallModules.test.ts +0 -117
- package/actions/pimlico/getTokenQuotes.test.ts +0 -90
- package/actions/pimlico/getUserOperationGasPrice.test.ts +0 -82
- package/actions/pimlico/getUserOperationStatus.test.ts +0 -199
- package/actions/pimlico/sponsorUserOperation.test.ts +0 -236
- package/actions/pimlico/validateSponsorshipPolicies.test.ts +0 -153
- package/actions/public/getAccountNonce.test.ts +0 -96
- package/actions/public/getSenderAddress.test.ts +0 -154
- package/actions/smartAccount/getCallsStatus.test.ts +0 -255
- package/actions/smartAccount/sendCalls.test.ts +0 -571
- package/actions/smartAccount/sendTransaction.test.ts +0 -416
- package/actions/smartAccount/signMessage.test.ts +0 -219
- package/actions/smartAccount/signTypedData.test.ts +0 -228
- package/actions/smartAccount.ts +0 -7
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +0 -523
- package/types/package.json +0 -6
- package/utils/decodeNonce.test.ts +0 -40
- package/utils/deepHexlify.test.ts +0 -57
- package/utils/encode7579Calls.test.ts +0 -69
- package/utils/encodeNonce.test.ts +0 -38
- package/utils/erc20AllowanceOverride.test.ts +0 -59
- package/utils/erc20BalanceOverride.test.ts +0 -57
- package/utils/getAddressFromInitCodeOrPaymasterAndData.test.ts +0 -31
- package/utils/getPackedUserOperation.test.ts +0 -204
- package/utils/getRequiredPrefund.test.ts +0 -90
- package/vitest.config.ts +0 -31
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { toEtherspotSmartAccount } from "./toEtherspotSmartAccount.js"
|
|
2
|
+
|
|
3
|
+
export const EtherspotSmartAccount = {
|
|
4
|
+
toEtherspotSmartAccount
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
EtherspotSmartAccountImplementation,
|
|
9
|
+
ToEtherspotSmartAccountParameters,
|
|
10
|
+
ToEtherspotSmartAccountReturnType
|
|
11
|
+
} from "./toEtherspotSmartAccount.js"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { to7702KernelSmartAccount } from "./to7702KernelSmartAccount.js"
|
|
2
|
+
import { toKernelSmartAccount } from "./toKernelSmartAccount.js"
|
|
3
|
+
import { isKernelV2 } from "./utils/isKernelV2.js"
|
|
4
|
+
import { signMessage } from "./utils/signMessage.js"
|
|
5
|
+
import { signTypedData } from "./utils/signTypedData.js"
|
|
6
|
+
import { wrapMessageHash } from "./utils/wrapMessageHash.js"
|
|
7
|
+
|
|
8
|
+
export const KernelSmartAccount = {
|
|
9
|
+
toKernelSmartAccount,
|
|
10
|
+
to7702KernelSmartAccount,
|
|
11
|
+
wrapMessageHash,
|
|
12
|
+
signMessage,
|
|
13
|
+
signTypedData,
|
|
14
|
+
isKernelV2
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type {
|
|
18
|
+
KernelSmartAccountImplementation,
|
|
19
|
+
KernelVersion,
|
|
20
|
+
ToKernelSmartAccountParameters,
|
|
21
|
+
ToKernelSmartAccountReturnType
|
|
22
|
+
} from "./toKernelSmartAccount.js"
|
|
23
|
+
export type {
|
|
24
|
+
EcdsaKernelSmartAccountImplementation,
|
|
25
|
+
ToEcdsaKernelSmartAccountParameters,
|
|
26
|
+
ToEcdsaKernelSmartAccountReturnType
|
|
27
|
+
} from "./toEcdsaKernelSmartAccount.js"
|
|
28
|
+
export type {
|
|
29
|
+
To7702KernelSmartAccountImplementation,
|
|
30
|
+
To7702KernelSmartAccountParameters,
|
|
31
|
+
To7702KernelSmartAccountReturnType
|
|
32
|
+
} from "./to7702KernelSmartAccount.js"
|
|
33
|
+
export type { WrapMessageHashParams } from "./utils/wrapMessageHash.js"
|
|
@@ -774,6 +774,13 @@ export async function toKernelSmartAccount<
|
|
|
774
774
|
]
|
|
775
775
|
})
|
|
776
776
|
|
|
777
|
+
if (
|
|
778
|
+
installFallbackCall === undefined ||
|
|
779
|
+
uninstallFallbackCall === undefined
|
|
780
|
+
) {
|
|
781
|
+
throw new Error("Failed to encode fallback module calls")
|
|
782
|
+
}
|
|
783
|
+
|
|
777
784
|
const executeCallData = encodeCallData({
|
|
778
785
|
calls,
|
|
779
786
|
kernelVersion
|
|
@@ -901,8 +908,8 @@ export async function toKernelSmartAccount<
|
|
|
901
908
|
const signature = await signMessage({
|
|
902
909
|
owner,
|
|
903
910
|
message,
|
|
904
|
-
|
|
905
|
-
|
|
911
|
+
address: await this.getAddress(),
|
|
912
|
+
version: kernelVersion,
|
|
906
913
|
chainId: await getMemoizedChainId(),
|
|
907
914
|
eip7702: eip7702
|
|
908
915
|
})
|
|
@@ -931,8 +938,8 @@ export async function toKernelSmartAccount<
|
|
|
931
938
|
owner: owner,
|
|
932
939
|
chainId: await getMemoizedChainId(),
|
|
933
940
|
...(typedData as TypedDataDefinition),
|
|
934
|
-
|
|
935
|
-
|
|
941
|
+
address: await this.getAddress(),
|
|
942
|
+
version: kernelVersion,
|
|
936
943
|
eip7702
|
|
937
944
|
})
|
|
938
945
|
|
|
@@ -966,8 +973,8 @@ export async function toKernelSmartAccount<
|
|
|
966
973
|
owner,
|
|
967
974
|
message: { raw: hash },
|
|
968
975
|
chainId,
|
|
969
|
-
|
|
970
|
-
kernelVersion,
|
|
976
|
+
address: await this.getAddress(),
|
|
977
|
+
version: kernelVersion,
|
|
971
978
|
eip7702: false
|
|
972
979
|
})
|
|
973
980
|
: await owner.signMessage({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type Hash,
|
|
3
3
|
type LocalAccount,
|
|
4
|
+
type Prettify,
|
|
4
5
|
type SignMessageReturnType,
|
|
5
6
|
type SignableMessage,
|
|
6
7
|
encodeAbiParameters,
|
|
@@ -18,23 +19,25 @@ import {
|
|
|
18
19
|
export async function signMessage({
|
|
19
20
|
message,
|
|
20
21
|
owner,
|
|
21
|
-
accountAddress,
|
|
22
|
-
|
|
22
|
+
address: accountAddress,
|
|
23
|
+
version: accountVersion,
|
|
23
24
|
chainId,
|
|
24
|
-
eip7702
|
|
25
|
-
}:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} & WrapMessageHashParams
|
|
25
|
+
eip7702 = false
|
|
26
|
+
}: Prettify<
|
|
27
|
+
{
|
|
28
|
+
message: SignableMessage
|
|
29
|
+
owner: LocalAccount | WebAuthnAccount
|
|
30
|
+
eip7702?: boolean
|
|
31
|
+
} & WrapMessageHashParams
|
|
32
|
+
>): Promise<SignMessageReturnType> {
|
|
31
33
|
if (isWebAuthnAccount(owner)) {
|
|
32
34
|
let messageContent: string
|
|
33
35
|
if (typeof message === "string") {
|
|
34
36
|
// message is a string
|
|
35
|
-
messageContent = wrapMessageHash(
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
messageContent = wrapMessageHash({
|
|
38
|
+
hash: hashMessage(message),
|
|
39
|
+
version: accountVersion,
|
|
40
|
+
address: accountAddress,
|
|
38
41
|
chainId
|
|
39
42
|
// chainId: client.chain
|
|
40
43
|
// ? client.chain.id
|
|
@@ -100,9 +103,10 @@ export async function signMessage({
|
|
|
100
103
|
})
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
const wrappedMessageHash = wrapMessageHash(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
const wrappedMessageHash = wrapMessageHash({
|
|
107
|
+
hash: hashMessage(message),
|
|
108
|
+
version: accountVersion,
|
|
109
|
+
address: accountAddress,
|
|
106
110
|
chainId
|
|
107
111
|
// chainId: client.chain
|
|
108
112
|
// ? client.chain.id
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type LocalAccount,
|
|
3
|
+
type Prettify,
|
|
3
4
|
type SignTypedDataReturnType,
|
|
4
5
|
type TypedDataDefinition,
|
|
5
6
|
getTypesForEIP712Domain,
|
|
@@ -15,18 +16,19 @@ import {
|
|
|
15
16
|
} from "./wrapMessageHash.js"
|
|
16
17
|
|
|
17
18
|
export async function signTypedData(
|
|
18
|
-
parameters:
|
|
19
|
+
parameters: Prettify<
|
|
19
20
|
WrapMessageHashParams & {
|
|
20
21
|
owner: LocalAccount | WebAuthnAccount
|
|
21
|
-
eip7702
|
|
22
|
-
}
|
|
22
|
+
eip7702?: boolean
|
|
23
|
+
} & TypedDataDefinition
|
|
24
|
+
>
|
|
23
25
|
): Promise<SignTypedDataReturnType> {
|
|
24
26
|
const {
|
|
25
27
|
owner,
|
|
26
|
-
accountAddress,
|
|
27
|
-
|
|
28
|
+
address: accountAddress,
|
|
29
|
+
version: accountVersion,
|
|
28
30
|
chainId,
|
|
29
|
-
eip7702,
|
|
31
|
+
eip7702 = false,
|
|
30
32
|
...typedData
|
|
31
33
|
} = parameters
|
|
32
34
|
|
|
@@ -74,9 +76,10 @@ export async function signTypedData(
|
|
|
74
76
|
})
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
const wrappedMessageHash = wrapMessageHash(
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
const wrappedMessageHash = wrapMessageHash({
|
|
80
|
+
hash: typedHash,
|
|
81
|
+
version: accountVersion,
|
|
82
|
+
address: accountAddress,
|
|
80
83
|
chainId: chainId
|
|
81
84
|
})
|
|
82
85
|
|
|
@@ -84,8 +87,8 @@ export async function signTypedData(
|
|
|
84
87
|
return signMessage({
|
|
85
88
|
message: { raw: wrappedMessageHash },
|
|
86
89
|
owner,
|
|
87
|
-
accountAddress,
|
|
88
|
-
|
|
90
|
+
address: accountAddress,
|
|
91
|
+
version: accountVersion,
|
|
89
92
|
chainId,
|
|
90
93
|
eip7702: false
|
|
91
94
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type Address,
|
|
3
3
|
type Hex,
|
|
4
|
+
type Prettify,
|
|
4
5
|
concatHex,
|
|
5
6
|
domainSeparator,
|
|
6
7
|
encodeAbiParameters,
|
|
@@ -11,15 +12,17 @@ import type { KernelVersion } from "../toKernelSmartAccount.js"
|
|
|
11
12
|
import { isKernelV2 } from "./isKernelV2.js"
|
|
12
13
|
|
|
13
14
|
export type WrapMessageHashParams = {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
version: KernelVersion<"0.6" | "0.7">
|
|
16
|
+
address: Address
|
|
16
17
|
chainId: number
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export const wrapMessageHash = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
export const wrapMessageHash = ({
|
|
21
|
+
hash,
|
|
22
|
+
address: accountAddress,
|
|
23
|
+
version: kernelVersion,
|
|
24
|
+
chainId
|
|
25
|
+
}: Prettify<{ hash: Hex } & WrapMessageHashParams>) => {
|
|
23
26
|
const _domainSeparator = domainSeparator({
|
|
24
27
|
domain: {
|
|
25
28
|
name: "Kernel",
|
|
@@ -29,11 +32,11 @@ export const wrapMessageHash = (
|
|
|
29
32
|
}
|
|
30
33
|
})
|
|
31
34
|
const wrappedMessageHash = isKernelV2(kernelVersion)
|
|
32
|
-
?
|
|
35
|
+
? hash
|
|
33
36
|
: keccak256(
|
|
34
37
|
encodeAbiParameters(
|
|
35
38
|
[{ type: "bytes32" }, { type: "bytes32" }],
|
|
36
|
-
[keccak256(stringToHex("Kernel(bytes32 hash)")),
|
|
39
|
+
[keccak256(stringToHex("Kernel(bytes32 hash)")), hash]
|
|
37
40
|
)
|
|
38
41
|
)
|
|
39
42
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { toLightSmartAccount } from "./toLightSmartAccount.js"
|
|
2
|
+
|
|
3
|
+
export const LightSmartAccount = {
|
|
4
|
+
toLightSmartAccount
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
LightAccountVersion,
|
|
9
|
+
LightSmartAccountImplementation,
|
|
10
|
+
ToLightSmartAccountParameters,
|
|
11
|
+
ToLightSmartAccountReturnType
|
|
12
|
+
} from "./toLightSmartAccount.js"
|
|
@@ -355,11 +355,19 @@ export async function toLightSmartAccount<
|
|
|
355
355
|
}[] = []
|
|
356
356
|
|
|
357
357
|
for (let i = 0; i < decoded.args[0].length; i++) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
358
|
+
const to = decoded.args[0][i]
|
|
359
|
+
const value = decoded.args[1][i]
|
|
360
|
+
const data = decoded.args[2][i]
|
|
361
|
+
|
|
362
|
+
if (
|
|
363
|
+
to === undefined ||
|
|
364
|
+
value === undefined ||
|
|
365
|
+
data === undefined
|
|
366
|
+
) {
|
|
367
|
+
throw new Error("Invalid batch call data")
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
calls.push({ to, value, data })
|
|
363
371
|
}
|
|
364
372
|
|
|
365
373
|
return calls
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { toNexusSmartAccount } from "./toNexusSmartAccount.js"
|
|
2
|
+
|
|
3
|
+
export const NexusSmartAccount = {
|
|
4
|
+
toNexusSmartAccount
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
NexusSmartAccountImplementation,
|
|
9
|
+
ToNexusSmartAccountParameters,
|
|
10
|
+
ToNexusSmartAccountReturnType
|
|
11
|
+
} from "./toNexusSmartAccount.js"
|
|
@@ -97,6 +97,10 @@ export const getWebAuthnSignature = async ({
|
|
|
97
97
|
|
|
98
98
|
const [, fields] = match
|
|
99
99
|
|
|
100
|
+
if (fields === undefined) {
|
|
101
|
+
throw new Error("challenge not found in client data JSON")
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
return encodeAbiParameters(
|
|
101
105
|
[
|
|
102
106
|
{ name: "authenticatorData", type: "bytes" },
|
|
@@ -904,15 +904,17 @@ const getInitializerCode = async ({
|
|
|
904
904
|
})
|
|
905
905
|
}
|
|
906
906
|
|
|
907
|
-
|
|
907
|
+
const firstMultiCall = multiCalls[0]
|
|
908
|
+
|
|
909
|
+
if (!useMultiSendForSetup && multiCalls.length === 1 && firstMultiCall) {
|
|
908
910
|
return encodeFunctionData({
|
|
909
911
|
abi: setupAbi,
|
|
910
912
|
functionName: "setup",
|
|
911
913
|
args: [
|
|
912
914
|
ownerAddresses,
|
|
913
915
|
threshold,
|
|
914
|
-
|
|
915
|
-
|
|
916
|
+
firstMultiCall.to,
|
|
917
|
+
firstMultiCall.data,
|
|
916
918
|
safe4337ModuleAddress,
|
|
917
919
|
paymentToken,
|
|
918
920
|
payment,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { to7702SimpleSmartAccount } from "./to7702SimpleSmartAccount.js"
|
|
2
|
+
import { toSimpleSmartAccount } from "./toSimpleSmartAccount.js"
|
|
3
|
+
|
|
4
|
+
export const SimpleSmartAccount = {
|
|
5
|
+
toSimpleSmartAccount,
|
|
6
|
+
to7702SimpleSmartAccount
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type {
|
|
10
|
+
SimpleSmartAccountImplementation,
|
|
11
|
+
ToSimpleSmartAccountParameters,
|
|
12
|
+
ToSimpleSmartAccountReturnType
|
|
13
|
+
} from "./toSimpleSmartAccount.js"
|
|
14
|
+
export type {
|
|
15
|
+
To7702SimpleSmartAccountImplementation,
|
|
16
|
+
To7702SimpleSmartAccountParameters,
|
|
17
|
+
To7702SimpleSmartAccountReturnType
|
|
18
|
+
} from "./to7702SimpleSmartAccount.js"
|
|
@@ -374,11 +374,19 @@ export async function toSimpleSmartAccount<
|
|
|
374
374
|
const datas = decodedV7.args[2]
|
|
375
375
|
|
|
376
376
|
for (let i = 0; i < destinations.length; i++) {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
377
|
+
const to = destinations[i]
|
|
378
|
+
const data = datas[i]
|
|
379
|
+
const value = values[i]
|
|
380
|
+
|
|
381
|
+
if (
|
|
382
|
+
to === undefined ||
|
|
383
|
+
data === undefined ||
|
|
384
|
+
value === undefined
|
|
385
|
+
) {
|
|
386
|
+
throw new Error("Invalid batch call data")
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
calls.push({ to, data, value })
|
|
382
390
|
}
|
|
383
391
|
|
|
384
392
|
return calls
|
|
@@ -394,11 +402,14 @@ export async function toSimpleSmartAccount<
|
|
|
394
402
|
const datas = decodedV6.args[1]
|
|
395
403
|
|
|
396
404
|
for (let i = 0; i < destinations.length; i++) {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
405
|
+
const to = destinations[i]
|
|
406
|
+
const data = datas[i]
|
|
407
|
+
|
|
408
|
+
if (to === undefined || data === undefined) {
|
|
409
|
+
throw new Error("Invalid batch call data")
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
calls.push({ to, data, value: 0n })
|
|
402
413
|
}
|
|
403
414
|
|
|
404
415
|
return calls
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { toThirdwebSmartAccount } from "./toThirdwebSmartAccount.js"
|
|
2
|
+
|
|
3
|
+
export const ThirdwebSmartAccount = {
|
|
4
|
+
toThirdwebSmartAccount
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
ThirdwebSmartAccountImplementation,
|
|
9
|
+
ToThirdwebSmartAccountParameters,
|
|
10
|
+
ToThirdwebSmartAccountReturnType
|
|
11
|
+
} from "./toThirdwebSmartAccount.js"
|
|
@@ -38,11 +38,15 @@ export const decodeCallData = async (callData: Hex) => {
|
|
|
38
38
|
}[] = []
|
|
39
39
|
|
|
40
40
|
for (let i = 0; i < decodedBatch.args[0].length; i++) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const to = decodedBatch.args[0][i]
|
|
42
|
+
const value = decodedBatch.args[1][i]
|
|
43
|
+
const data = decodedBatch.args[2][i]
|
|
44
|
+
|
|
45
|
+
if (to === undefined || data === undefined) {
|
|
46
|
+
throw new Error("Invalid batch call data")
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
calls.push({ to, value, data })
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
return calls
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { toTrustSmartAccount } from "./toTrustSmartAccount.js"
|
|
2
|
+
|
|
3
|
+
export const TrustSmartAccount = {
|
|
4
|
+
toTrustSmartAccount
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
ToTrustSmartAccountParameters,
|
|
9
|
+
ToTrustSmartAccountReturnType,
|
|
10
|
+
TrustSmartAccountImplementation
|
|
11
|
+
} from "./toTrustSmartAccount.js"
|
|
@@ -38,11 +38,15 @@ export const decodeCallData = async (callData: Hex) => {
|
|
|
38
38
|
}[] = []
|
|
39
39
|
|
|
40
40
|
for (let i = 0; i < decodedBatch.args[0].length; i++) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const to = decodedBatch.args[0][i]
|
|
42
|
+
const value = decodedBatch.args[1][i]
|
|
43
|
+
const data = decodedBatch.args[2][i]
|
|
44
|
+
|
|
45
|
+
if (to === undefined || data === undefined) {
|
|
46
|
+
throw new Error("Invalid batch call data")
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
calls.push({ to, value, data })
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
return calls
|
|
@@ -3,40 +3,34 @@ import type {
|
|
|
3
3
|
GetSmartAccountParameter,
|
|
4
4
|
SmartAccount
|
|
5
5
|
} from "viem/account-abstraction"
|
|
6
|
-
import { accountId } from "./
|
|
7
|
-
import {
|
|
8
|
-
type InstallModuleParameters,
|
|
9
|
-
installModule
|
|
10
|
-
} from "./erc7579/installModule.js"
|
|
6
|
+
import { accountId } from "./accountId.js"
|
|
7
|
+
import { type InstallModuleParameters, installModule } from "./installModule.js"
|
|
11
8
|
import {
|
|
12
9
|
type InstallModulesParameters,
|
|
13
10
|
installModules
|
|
14
|
-
} from "./
|
|
11
|
+
} from "./installModules.js"
|
|
15
12
|
import {
|
|
16
13
|
type IsModuleInstalledParameters,
|
|
17
14
|
isModuleInstalled
|
|
18
|
-
} from "./
|
|
15
|
+
} from "./isModuleInstalled.js"
|
|
19
16
|
import {
|
|
20
17
|
type SupportsExecutionModeParameters,
|
|
21
18
|
supportsExecutionMode
|
|
22
|
-
} from "./
|
|
23
|
-
import type {
|
|
24
|
-
CallType,
|
|
25
|
-
ExecutionMode
|
|
26
|
-
} from "./erc7579/supportsExecutionMode.js"
|
|
19
|
+
} from "./supportsExecutionMode.js"
|
|
20
|
+
import type { CallType, ExecutionMode } from "./supportsExecutionMode.js"
|
|
27
21
|
import {
|
|
28
22
|
type SupportsModuleParameters,
|
|
29
23
|
supportsModule
|
|
30
|
-
} from "./
|
|
31
|
-
import type { ModuleType } from "./
|
|
24
|
+
} from "./supportsModule.js"
|
|
25
|
+
import type { ModuleType } from "./supportsModule.js"
|
|
32
26
|
import {
|
|
33
27
|
type UninstallModuleParameters,
|
|
34
28
|
uninstallModule
|
|
35
|
-
} from "./
|
|
29
|
+
} from "./uninstallModule.js"
|
|
36
30
|
import {
|
|
37
31
|
type UninstallModulesParameters,
|
|
38
32
|
uninstallModules
|
|
39
|
-
} from "./
|
|
33
|
+
} from "./uninstallModules.js"
|
|
40
34
|
|
|
41
35
|
export type Erc7579Actions<TSmartAccount extends SmartAccount | undefined> = {
|
|
42
36
|
accountId: (
|
|
@@ -2,16 +2,16 @@ export {
|
|
|
2
2
|
type StartRegistrationParameters,
|
|
3
3
|
type StartRegistrationReturnType,
|
|
4
4
|
startRegistration
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./startRegistration.js"
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
8
|
type VerifyRegistrationParameters,
|
|
9
9
|
type VerifyRegistrationReturnType,
|
|
10
10
|
verifyRegistration
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./verifyRegistration.js"
|
|
12
12
|
|
|
13
13
|
export {
|
|
14
14
|
type GetCredentialsParameters,
|
|
15
15
|
type GetCredentialsReturnType,
|
|
16
16
|
getCredentials
|
|
17
|
-
} from "./
|
|
17
|
+
} from "./getCredentials.js"
|