@account-kit/wallet-client 0.1.0-alpha.8 → 4.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/esm/client/actions/formatSign.d.ts +30 -0
- package/dist/esm/client/actions/formatSign.js +32 -0
- package/dist/esm/client/actions/formatSign.js.map +1 -0
- package/dist/esm/client/actions/getCallsStatus.d.ts +6 -3
- package/dist/esm/client/actions/getCallsStatus.js +3 -0
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +10 -11
- package/dist/esm/client/actions/grantPermissions.js +26 -12
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/listAccounts.d.ts +10 -3
- package/dist/esm/client/actions/listAccounts.js +14 -2
- package/dist/esm/client/actions/listAccounts.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +6 -3
- package/dist/esm/client/actions/prepareCalls.js +12 -8
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/prepareSign.d.ts +28 -0
- package/dist/esm/client/actions/prepareSign.js +31 -0
- package/dist/esm/client/actions/prepareSign.js.map +1 -0
- package/dist/esm/client/actions/requestAccount.d.ts +3 -1
- package/dist/esm/client/actions/requestAccount.js +5 -3
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +3 -1
- package/dist/esm/client/actions/sendPreparedCalls.js +2 -0
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signMessage.d.ts +5 -2
- package/dist/esm/client/actions/signMessage.js +5 -2
- package/dist/esm/client/actions/signMessage.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.d.ts +2 -2
- package/dist/esm/client/actions/signPreparedCalls.js +28 -39
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +6 -10
- package/dist/esm/client/actions/signSignatureRequest.js +4 -7
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/actions/signTypedData.d.ts +2 -0
- package/dist/esm/client/actions/signTypedData.js +2 -0
- package/dist/esm/client/actions/signTypedData.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +0 -2
- package/dist/esm/client/decorator.js +1 -3
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/client/index.d.ts +10 -6
- package/dist/esm/client/index.js +18 -21
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/exports/index.d.ts +1 -5
- package/dist/esm/exports/index.js +1 -6
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/internal/account.d.ts +33 -0
- package/dist/esm/{isomorphic/utils/createAccount.js → internal/account.js} +33 -35
- package/dist/esm/internal/account.js.map +1 -0
- package/dist/esm/types.d.ts +5 -11
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils.d.ts +14 -1
- package/dist/esm/utils.js +13 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +4 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/client/actions/formatSign.d.ts +31 -0
- package/dist/types/client/actions/formatSign.d.ts.map +1 -0
- package/dist/types/client/actions/getCallsStatus.d.ts +6 -3
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +10 -11
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/listAccounts.d.ts +10 -3
- package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +6 -3
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/prepareSign.d.ts +29 -0
- package/dist/types/client/actions/prepareSign.d.ts.map +1 -0
- package/dist/types/client/actions/requestAccount.d.ts +3 -1
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +3 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signMessage.d.ts +5 -2
- package/dist/types/client/actions/signMessage.d.ts.map +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts +2 -2
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +6 -10
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/actions/signTypedData.d.ts +2 -0
- package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +0 -2
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +10 -6
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +1 -5
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/internal/account.d.ts +34 -0
- package/dist/types/internal/account.d.ts.map +1 -0
- package/dist/types/types.d.ts +5 -11
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +14 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +2 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +33 -28
- package/src/client/actions/formatSign.ts +55 -0
- package/src/client/actions/getCallsStatus.ts +10 -6
- package/src/client/actions/grantPermissions.ts +46 -18
- package/src/client/actions/listAccounts.ts +22 -5
- package/src/client/actions/prepareCalls.ts +22 -16
- package/src/client/actions/prepareSign.ts +51 -0
- package/src/client/actions/requestAccount.ts +6 -4
- package/src/client/actions/sendPreparedCalls.ts +3 -1
- package/src/client/actions/signMessage.ts +5 -2
- package/src/client/actions/signPreparedCalls.ts +40 -45
- package/src/client/actions/signSignatureRequest.ts +12 -15
- package/src/client/actions/signTypedData.ts +2 -0
- package/src/client/decorator.ts +1 -8
- package/src/client/index.ts +41 -33
- package/src/exports/index.ts +1 -13
- package/src/{isomorphic/utils/createAccount.ts → internal/account.ts} +37 -54
- package/src/types.ts +7 -18
- package/src/utils.ts +15 -1
- package/src/version.ts +3 -0
- package/dist/esm/capabilities/eip7702Auth.d.ts +0 -4
- package/dist/esm/capabilities/eip7702Auth.js +0 -18
- package/dist/esm/capabilities/eip7702Auth.js.map +0 -1
- package/dist/esm/capabilities/index.d.ts +0 -38
- package/dist/esm/capabilities/index.js +0 -12
- package/dist/esm/capabilities/index.js.map +0 -1
- package/dist/esm/capabilities/overrides.d.ts +0 -26
- package/dist/esm/capabilities/overrides.js +0 -14
- package/dist/esm/capabilities/overrides.js.map +0 -1
- package/dist/esm/capabilities/paymaster.d.ts +0 -3
- package/dist/esm/capabilities/paymaster.js +0 -5
- package/dist/esm/capabilities/paymaster.js.map +0 -1
- package/dist/esm/capabilities/permissions/index.d.ts +0 -145
- package/dist/esm/capabilities/permissions/index.js +0 -83
- package/dist/esm/capabilities/permissions/index.js.map +0 -1
- package/dist/esm/capabilities/permissions/mav2.d.ts +0 -36
- package/dist/esm/capabilities/permissions/mav2.js +0 -88
- package/dist/esm/capabilities/permissions/mav2.js.map +0 -1
- package/dist/esm/client/actions/createAccount.d.ts +0 -35
- package/dist/esm/client/actions/createAccount.js +0 -32
- package/dist/esm/client/actions/createAccount.js.map +0 -1
- package/dist/esm/client/client.e2e-test.d.ts +0 -1
- package/dist/esm/client/client.e2e-test.js +0 -375
- package/dist/esm/client/client.e2e-test.js.map +0 -1
- package/dist/esm/exports/internal.d.ts +0 -13
- package/dist/esm/exports/internal.js +0 -15
- package/dist/esm/exports/internal.js.map +0 -1
- package/dist/esm/isomorphic/actions/createSession.d.ts +0 -14
- package/dist/esm/isomorphic/actions/createSession.js +0 -89
- package/dist/esm/isomorphic/actions/createSession.js.map +0 -1
- package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +0 -21
- package/dist/esm/isomorphic/actions/getCallsStatus.js +0 -113
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +0 -1
- package/dist/esm/isomorphic/actions/prepareCalls.d.ts +0 -8
- package/dist/esm/isomorphic/actions/prepareCalls.js +0 -101
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +0 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +0 -8
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +0 -148
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +0 -1
- package/dist/esm/isomorphic/client.d.ts +0 -239
- package/dist/esm/isomorphic/client.js +0 -37
- package/dist/esm/isomorphic/client.js.map +0 -1
- package/dist/esm/isomorphic/utils/7702.d.ts +0 -18
- package/dist/esm/isomorphic/utils/7702.js +0 -74
- package/dist/esm/isomorphic/utils/7702.js.map +0 -1
- package/dist/esm/isomorphic/utils/createAccount.d.ts +0 -23
- package/dist/esm/isomorphic/utils/createAccount.js.map +0 -1
- package/dist/esm/isomorphic/utils/createDummySigner.d.ts +0 -3
- package/dist/esm/isomorphic/utils/createDummySigner.js +0 -17
- package/dist/esm/isomorphic/utils/createDummySigner.js.map +0 -1
- package/dist/esm/isomorphic/utils/decodeSignature.d.ts +0 -3
- package/dist/esm/isomorphic/utils/decodeSignature.js +0 -13
- package/dist/esm/isomorphic/utils/decodeSignature.js.map +0 -1
- package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +0 -21
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js +0 -34
- package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +0 -1
- package/dist/esm/isomorphic/utils/supportsFeature.d.ts +0 -4
- package/dist/esm/isomorphic/utils/supportsFeature.js +0 -21
- package/dist/esm/isomorphic/utils/supportsFeature.js.map +0 -1
- package/dist/esm/local/client.d.ts +0 -3
- package/dist/esm/local/client.js +0 -97
- package/dist/esm/local/client.js.map +0 -1
- package/dist/esm/remote/client.d.ts +0 -9
- package/dist/esm/remote/client.js +0 -41
- package/dist/esm/remote/client.js.map +0 -1
- package/dist/esm/rpc/examples.d.ts +0 -230
- package/dist/esm/rpc/examples.js +0 -314
- package/dist/esm/rpc/examples.js.map +0 -1
- package/dist/esm/rpc/request.d.ts +0 -711
- package/dist/esm/rpc/request.js +0 -213
- package/dist/esm/rpc/request.js.map +0 -1
- package/dist/esm/rpc/schema.d.ts +0 -659
- package/dist/esm/rpc/schema.js +0 -5
- package/dist/esm/rpc/schema.js.map +0 -1
- package/dist/esm/schemas.d.ts +0 -693
- package/dist/esm/schemas.js +0 -419
- package/dist/esm/schemas.js.map +0 -1
- package/dist/types/capabilities/eip7702Auth.d.ts +0 -5
- package/dist/types/capabilities/eip7702Auth.d.ts.map +0 -1
- package/dist/types/capabilities/index.d.ts +0 -39
- package/dist/types/capabilities/index.d.ts.map +0 -1
- package/dist/types/capabilities/overrides.d.ts +0 -27
- package/dist/types/capabilities/overrides.d.ts.map +0 -1
- package/dist/types/capabilities/paymaster.d.ts +0 -4
- package/dist/types/capabilities/paymaster.d.ts.map +0 -1
- package/dist/types/capabilities/permissions/index.d.ts +0 -146
- package/dist/types/capabilities/permissions/index.d.ts.map +0 -1
- package/dist/types/capabilities/permissions/mav2.d.ts +0 -37
- package/dist/types/capabilities/permissions/mav2.d.ts.map +0 -1
- package/dist/types/client/actions/createAccount.d.ts +0 -36
- package/dist/types/client/actions/createAccount.d.ts.map +0 -1
- package/dist/types/client/client.e2e-test.d.ts +0 -2
- package/dist/types/client/client.e2e-test.d.ts.map +0 -1
- package/dist/types/exports/internal.d.ts +0 -14
- package/dist/types/exports/internal.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/createSession.d.ts +0 -15
- package/dist/types/isomorphic/actions/createSession.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts +0 -22
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts +0 -9
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +0 -9
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +0 -1
- package/dist/types/isomorphic/client.d.ts +0 -240
- package/dist/types/isomorphic/client.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/7702.d.ts +0 -19
- package/dist/types/isomorphic/utils/7702.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/createAccount.d.ts +0 -24
- package/dist/types/isomorphic/utils/createAccount.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/createDummySigner.d.ts +0 -4
- package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/decodeSignature.d.ts +0 -4
- package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +0 -22
- package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/supportsFeature.d.ts +0 -5
- package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +0 -1
- package/dist/types/local/client.d.ts +0 -4
- package/dist/types/local/client.d.ts.map +0 -1
- package/dist/types/remote/client.d.ts +0 -10
- package/dist/types/remote/client.d.ts.map +0 -1
- package/dist/types/rpc/examples.d.ts +0 -231
- package/dist/types/rpc/examples.d.ts.map +0 -1
- package/dist/types/rpc/request.d.ts +0 -712
- package/dist/types/rpc/request.d.ts.map +0 -1
- package/dist/types/rpc/schema.d.ts +0 -660
- package/dist/types/rpc/schema.d.ts.map +0 -1
- package/dist/types/schemas.d.ts +0 -694
- package/dist/types/schemas.d.ts.map +0 -1
- package/src/capabilities/eip7702Auth.ts +0 -26
- package/src/capabilities/index.ts +0 -12
- package/src/capabilities/overrides.ts +0 -35
- package/src/capabilities/paymaster.ts +0 -5
- package/src/capabilities/permissions/index.ts +0 -163
- package/src/capabilities/permissions/mav2.ts +0 -138
- package/src/client/actions/createAccount.ts +0 -53
- package/src/client/client.e2e-test.ts +0 -463
- package/src/exports/internal.ts +0 -16
- package/src/isomorphic/actions/createSession.ts +0 -151
- package/src/isomorphic/actions/getCallsStatus.ts +0 -170
- package/src/isomorphic/actions/prepareCalls.ts +0 -152
- package/src/isomorphic/actions/sendPreparedCalls.ts +0 -222
- package/src/isomorphic/client.ts +0 -94
- package/src/isomorphic/utils/7702.ts +0 -132
- package/src/isomorphic/utils/createDummySigner.ts +0 -27
- package/src/isomorphic/utils/decodeSignature.ts +0 -18
- package/src/isomorphic/utils/parsePermissionsContext.ts +0 -49
- package/src/isomorphic/utils/supportsFeature.ts +0 -34
- package/src/local/client.ts +0 -136
- package/src/remote/client.ts +0 -67
- package/src/rpc/examples.ts +0 -342
- package/src/rpc/request.ts +0 -299
- package/src/rpc/schema.ts +0 -40
- package/src/schemas.ts +0 -585
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { type SmartAccountClient, type SmartAccountClientRpcSchema, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import { type Chain, type Transport } from "viem";
|
|
3
|
-
import type { WalletServerViemRpcSchema } from "../rpc/schema.js";
|
|
4
|
-
import { type CreateSessionParams } from "./actions/createSession.js";
|
|
5
|
-
import { type GetCallsStatusParams } from "./actions/getCallsStatus.js";
|
|
6
|
-
import { type PrepareCallsParams } from "./actions/prepareCalls.js";
|
|
7
|
-
import { type SendPreparedCallsParams } from "./actions/sendPreparedCalls.js";
|
|
8
|
-
type ClientParams = {
|
|
9
|
-
chain: Chain;
|
|
10
|
-
transport: Transport;
|
|
11
|
-
policyId?: string;
|
|
12
|
-
useErc7677middleware?: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare function isomorphicClientActions(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>): {
|
|
15
|
-
prepareCalls: (params: PrepareCallsParams) => Promise<{
|
|
16
|
-
type: "array";
|
|
17
|
-
data: ({
|
|
18
|
-
type: "user-operation-v060";
|
|
19
|
-
chainId: `0x${string}`;
|
|
20
|
-
data: {
|
|
21
|
-
sender: `0x${string}`;
|
|
22
|
-
nonce: `0x${string}`;
|
|
23
|
-
initCode: `0x${string}`;
|
|
24
|
-
callData: `0x${string}`;
|
|
25
|
-
callGasLimit: `0x${string}`;
|
|
26
|
-
verificationGasLimit: `0x${string}`;
|
|
27
|
-
preVerificationGas: `0x${string}`;
|
|
28
|
-
maxFeePerGas: `0x${string}`;
|
|
29
|
-
maxPriorityFeePerGas: `0x${string}`;
|
|
30
|
-
paymasterAndData: `0x${string}`;
|
|
31
|
-
};
|
|
32
|
-
signatureRequest: {
|
|
33
|
-
type: "eth_signTypedData_v4";
|
|
34
|
-
data: {
|
|
35
|
-
domain?: {
|
|
36
|
-
chainId?: number | undefined;
|
|
37
|
-
salt?: `0x${string}` | undefined;
|
|
38
|
-
name?: string | undefined;
|
|
39
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
40
|
-
version?: string | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
types: {
|
|
43
|
-
[x: string]: {
|
|
44
|
-
type: string;
|
|
45
|
-
name: string;
|
|
46
|
-
}[];
|
|
47
|
-
};
|
|
48
|
-
primaryType: string;
|
|
49
|
-
message: {
|
|
50
|
-
[x: string]: unknown;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
rawPayload: `0x${string}`;
|
|
54
|
-
} | {
|
|
55
|
-
type: "personal_sign";
|
|
56
|
-
data: string | {
|
|
57
|
-
raw: `0x${string}`;
|
|
58
|
-
};
|
|
59
|
-
rawPayload: `0x${string}`;
|
|
60
|
-
};
|
|
61
|
-
} | {
|
|
62
|
-
type: "user-operation-v070";
|
|
63
|
-
chainId: `0x${string}`;
|
|
64
|
-
data: {
|
|
65
|
-
factory?: `0x${string}` | undefined;
|
|
66
|
-
factoryData?: `0x${string}` | undefined;
|
|
67
|
-
paymaster?: `0x${string}` | undefined;
|
|
68
|
-
paymasterData?: `0x${string}` | undefined;
|
|
69
|
-
paymasterVerificationGasLimit?: `0x${string}` | undefined;
|
|
70
|
-
paymasterPostOpGasLimit?: `0x${string}` | undefined;
|
|
71
|
-
sender: `0x${string}`;
|
|
72
|
-
nonce: `0x${string}`;
|
|
73
|
-
callData: `0x${string}`;
|
|
74
|
-
callGasLimit: `0x${string}`;
|
|
75
|
-
verificationGasLimit: `0x${string}`;
|
|
76
|
-
preVerificationGas: `0x${string}`;
|
|
77
|
-
maxFeePerGas: `0x${string}`;
|
|
78
|
-
maxPriorityFeePerGas: `0x${string}`;
|
|
79
|
-
};
|
|
80
|
-
signatureRequest: {
|
|
81
|
-
type: "eth_signTypedData_v4";
|
|
82
|
-
data: {
|
|
83
|
-
domain?: {
|
|
84
|
-
chainId?: number | undefined;
|
|
85
|
-
salt?: `0x${string}` | undefined;
|
|
86
|
-
name?: string | undefined;
|
|
87
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
88
|
-
version?: string | undefined;
|
|
89
|
-
} | undefined;
|
|
90
|
-
types: {
|
|
91
|
-
[x: string]: {
|
|
92
|
-
type: string;
|
|
93
|
-
name: string;
|
|
94
|
-
}[];
|
|
95
|
-
};
|
|
96
|
-
primaryType: string;
|
|
97
|
-
message: {
|
|
98
|
-
[x: string]: unknown;
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
rawPayload: `0x${string}`;
|
|
102
|
-
} | {
|
|
103
|
-
type: "personal_sign";
|
|
104
|
-
data: string | {
|
|
105
|
-
raw: `0x${string}`;
|
|
106
|
-
};
|
|
107
|
-
rawPayload: `0x${string}`;
|
|
108
|
-
};
|
|
109
|
-
} | {
|
|
110
|
-
type: "authorization";
|
|
111
|
-
chainId: `0x${string}`;
|
|
112
|
-
data: {
|
|
113
|
-
nonce: `0x${string}`;
|
|
114
|
-
address: `0x${string}`;
|
|
115
|
-
};
|
|
116
|
-
signatureRequest: {
|
|
117
|
-
type: "eip7702Auth";
|
|
118
|
-
rawPayload: `0x${string}`;
|
|
119
|
-
};
|
|
120
|
-
})[];
|
|
121
|
-
} | {
|
|
122
|
-
type: "user-operation-v060";
|
|
123
|
-
chainId: `0x${string}`;
|
|
124
|
-
data: {
|
|
125
|
-
sender: `0x${string}`;
|
|
126
|
-
nonce: `0x${string}`;
|
|
127
|
-
initCode: `0x${string}`;
|
|
128
|
-
callData: `0x${string}`;
|
|
129
|
-
callGasLimit: `0x${string}`;
|
|
130
|
-
verificationGasLimit: `0x${string}`;
|
|
131
|
-
preVerificationGas: `0x${string}`;
|
|
132
|
-
maxFeePerGas: `0x${string}`;
|
|
133
|
-
maxPriorityFeePerGas: `0x${string}`;
|
|
134
|
-
paymasterAndData: `0x${string}`;
|
|
135
|
-
};
|
|
136
|
-
signatureRequest: {
|
|
137
|
-
type: "eth_signTypedData_v4";
|
|
138
|
-
data: {
|
|
139
|
-
domain?: {
|
|
140
|
-
chainId?: number | undefined;
|
|
141
|
-
salt?: `0x${string}` | undefined;
|
|
142
|
-
name?: string | undefined;
|
|
143
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
144
|
-
version?: string | undefined;
|
|
145
|
-
} | undefined;
|
|
146
|
-
types: {
|
|
147
|
-
[x: string]: {
|
|
148
|
-
type: string;
|
|
149
|
-
name: string;
|
|
150
|
-
}[];
|
|
151
|
-
};
|
|
152
|
-
primaryType: string;
|
|
153
|
-
message: {
|
|
154
|
-
[x: string]: unknown;
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
rawPayload: `0x${string}`;
|
|
158
|
-
} | {
|
|
159
|
-
type: "personal_sign";
|
|
160
|
-
data: string | {
|
|
161
|
-
raw: `0x${string}`;
|
|
162
|
-
};
|
|
163
|
-
rawPayload: `0x${string}`;
|
|
164
|
-
};
|
|
165
|
-
} | {
|
|
166
|
-
type: "user-operation-v070";
|
|
167
|
-
chainId: `0x${string}`;
|
|
168
|
-
data: {
|
|
169
|
-
factory?: `0x${string}` | undefined;
|
|
170
|
-
factoryData?: `0x${string}` | undefined;
|
|
171
|
-
paymaster?: `0x${string}` | undefined;
|
|
172
|
-
paymasterData?: `0x${string}` | undefined;
|
|
173
|
-
paymasterVerificationGasLimit?: `0x${string}` | undefined;
|
|
174
|
-
paymasterPostOpGasLimit?: `0x${string}` | undefined;
|
|
175
|
-
sender: `0x${string}`;
|
|
176
|
-
nonce: `0x${string}`;
|
|
177
|
-
callData: `0x${string}`;
|
|
178
|
-
callGasLimit: `0x${string}`;
|
|
179
|
-
verificationGasLimit: `0x${string}`;
|
|
180
|
-
preVerificationGas: `0x${string}`;
|
|
181
|
-
maxFeePerGas: `0x${string}`;
|
|
182
|
-
maxPriorityFeePerGas: `0x${string}`;
|
|
183
|
-
};
|
|
184
|
-
signatureRequest: {
|
|
185
|
-
type: "eth_signTypedData_v4";
|
|
186
|
-
data: {
|
|
187
|
-
domain?: {
|
|
188
|
-
chainId?: number | undefined;
|
|
189
|
-
salt?: `0x${string}` | undefined;
|
|
190
|
-
name?: string | undefined;
|
|
191
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
192
|
-
version?: string | undefined;
|
|
193
|
-
} | undefined;
|
|
194
|
-
types: {
|
|
195
|
-
[x: string]: {
|
|
196
|
-
type: string;
|
|
197
|
-
name: string;
|
|
198
|
-
}[];
|
|
199
|
-
};
|
|
200
|
-
primaryType: string;
|
|
201
|
-
message: {
|
|
202
|
-
[x: string]: unknown;
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
rawPayload: `0x${string}`;
|
|
206
|
-
} | {
|
|
207
|
-
type: "personal_sign";
|
|
208
|
-
data: string | {
|
|
209
|
-
raw: `0x${string}`;
|
|
210
|
-
};
|
|
211
|
-
rawPayload: `0x${string}`;
|
|
212
|
-
};
|
|
213
|
-
}>;
|
|
214
|
-
sendPreparedCalls: (params: SendPreparedCallsParams) => Promise<{
|
|
215
|
-
preparedCallIds: `0x${string}`[];
|
|
216
|
-
}>;
|
|
217
|
-
getCallsStatus: (params: GetCallsStatusParams) => Promise<{
|
|
218
|
-
receipts?: {
|
|
219
|
-
status: `0x${string}`;
|
|
220
|
-
logs: {
|
|
221
|
-
address: `0x${string}`;
|
|
222
|
-
data: `0x${string}`;
|
|
223
|
-
topics: `0x${string}`[];
|
|
224
|
-
}[];
|
|
225
|
-
blockHash: `0x${string}`;
|
|
226
|
-
blockNumber: `0x${string}`;
|
|
227
|
-
gasUsed: `0x${string}`;
|
|
228
|
-
transactionHash: `0x${string}`;
|
|
229
|
-
}[] | undefined;
|
|
230
|
-
chainId: `0x${string}`;
|
|
231
|
-
id: `0x${string}`;
|
|
232
|
-
atomic: boolean;
|
|
233
|
-
status: 200 | 100 | 400 | 500 | 600;
|
|
234
|
-
}>;
|
|
235
|
-
createSession: (params: CreateSessionParams) => Promise<import("./actions/createSession.js").CreateSessionResult>;
|
|
236
|
-
};
|
|
237
|
-
export declare function createIsomorphicClient({ chain, transport, policyId, useErc7677middleware, }: ClientParams): SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, ReturnType<typeof isomorphicClientActions>, WalletServerViemRpcSchema & SmartAccountClientRpcSchema>;
|
|
238
|
-
export type IsomorphicClient = ReturnType<typeof createIsomorphicClient>;
|
|
239
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { createSmartAccountClient, } from "@aa-sdk/core";
|
|
2
|
-
import { alchemyFeeEstimator, alchemyGasAndPaymasterAndDataMiddleware, alchemyGasManagerMiddleware, } from "@account-kit/infra";
|
|
3
|
-
import {} from "viem";
|
|
4
|
-
import { createSession, } from "./actions/createSession.js";
|
|
5
|
-
import { getCallsStatus, } from "./actions/getCallsStatus.js";
|
|
6
|
-
import { prepareCalls, } from "./actions/prepareCalls.js";
|
|
7
|
-
import { sendPreparedCalls, } from "./actions/sendPreparedCalls.js";
|
|
8
|
-
export function isomorphicClientActions(client) {
|
|
9
|
-
return {
|
|
10
|
-
prepareCalls: (params) => prepareCalls(client, params),
|
|
11
|
-
sendPreparedCalls: (params) => sendPreparedCalls(client, params),
|
|
12
|
-
getCallsStatus: (params) => getCallsStatus(client, params),
|
|
13
|
-
createSession: (params) => createSession(client, params),
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
// the isomorphic client likely won't be exposed directly. This client contains the business logic that can be run on the wallet server or on the client
|
|
17
|
-
// if the dev chooses to run the client in "local" mode.
|
|
18
|
-
export function createIsomorphicClient({ chain, transport, policyId, useErc7677middleware = true, }) {
|
|
19
|
-
// This must be a smart account client since as of now we use it to build UOs under the hood
|
|
20
|
-
const client = createSmartAccountClient({
|
|
21
|
-
transport,
|
|
22
|
-
chain,
|
|
23
|
-
// TODO: we will want to enforce alchemy transport here probably
|
|
24
|
-
feeEstimator: alchemyFeeEstimator(transport),
|
|
25
|
-
...(policyId
|
|
26
|
-
? useErc7677middleware
|
|
27
|
-
? alchemyGasManagerMiddleware(policyId)
|
|
28
|
-
: // NOTE: DO NOT USE THIS MIDDLEWARE in the server, currently we require using the erc7677 middleware
|
|
29
|
-
alchemyGasAndPaymasterAndDataMiddleware({
|
|
30
|
-
policyId,
|
|
31
|
-
transport: transport,
|
|
32
|
-
})
|
|
33
|
-
: {}),
|
|
34
|
-
}).extend(isomorphicClientActions);
|
|
35
|
-
return client;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/isomorphic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,uCAAuC,EACvC,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA8B,MAAM,MAAM,CAAC;AAElD,OAAO,EACL,aAAa,GAEd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,GAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,YAAY,GAEb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,GAElB,MAAM,gCAAgC,CAAC;AAUxC,MAAM,UAAU,uBAAuB,CACrC,MAMC;IAED,OAAO;QACL,YAAY,EAAE,CAAC,MAA0B,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QAC1E,iBAAiB,EAAE,CAAC,MAA+B,EAAE,EAAE,CACrD,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QACnC,cAAc,EAAE,CAAC,MAA4B,EAAE,EAAE,CAC/C,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;QAChC,aAAa,EAAE,CAAC,MAA2B,EAAE,EAAE,CAC7C,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;KAChC,CAAC;AACJ,CAAC;AAED,wJAAwJ;AACxJ,wDAAwD;AACxD,MAAM,UAAU,sBAAsB,CAAC,EACrC,KAAK,EACL,SAAS,EACT,QAAQ,EACR,oBAAoB,GAAG,IAAI,GACd;IAOb,4FAA4F;IAC5F,MAAM,MAAM,GAAG,wBAAwB,CAAC;QACtC,SAAS;QACT,KAAK;QACL,gEAAgE;QAChE,YAAY,EAAE,mBAAmB,CAAC,SAA6B,CAAC;QAChE,GAAG,CAAC,QAAQ;YACV,CAAC,CAAC,oBAAoB;gBACpB,CAAC,CAAC,2BAA2B,CAAC,QAAQ,CAAC;gBACvC,CAAC,CAAC,oGAAoG;oBACpG,uCAAuC,CAAC;wBACtC,QAAQ;wBACR,SAAS,EAAE,SAA6B;qBACzC,CAAC;YACN,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAEnC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientRpcSchema,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n alchemyFeeEstimator,\n alchemyGasAndPaymasterAndDataMiddleware,\n alchemyGasManagerMiddleware,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\nimport { type Chain, type Transport } from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"../rpc/schema.js\";\nimport {\n createSession,\n type CreateSessionParams,\n} from \"./actions/createSession.js\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n} from \"./actions/getCallsStatus.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n} from \"./actions/prepareCalls.js\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n} from \"./actions/sendPreparedCalls.js\";\n\n// let's start with something that takes in as many params as possible, then we can eliminate them as we don't need them\ntype ClientParams = {\n chain: Chain;\n transport: Transport;\n policyId?: string;\n useErc7677middleware?: boolean;\n};\n\nexport function isomorphicClientActions(\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n) {\n return {\n prepareCalls: (params: PrepareCallsParams) => prepareCalls(client, params),\n sendPreparedCalls: (params: SendPreparedCallsParams) =>\n sendPreparedCalls(client, params),\n getCallsStatus: (params: GetCallsStatusParams) =>\n getCallsStatus(client, params),\n createSession: (params: CreateSessionParams) =>\n createSession(client, params),\n };\n}\n\n// the isomorphic client likely won't be exposed directly. This client contains the business logic that can be run on the wallet server or on the client\n// if the dev chooses to run the client in \"local\" mode.\nexport function createIsomorphicClient({\n chain,\n transport,\n policyId,\n useErc7677middleware = true,\n}: ClientParams): SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n ReturnType<typeof isomorphicClientActions>,\n WalletServerViemRpcSchema & SmartAccountClientRpcSchema\n> {\n // This must be a smart account client since as of now we use it to build UOs under the hood\n const client = createSmartAccountClient({\n transport,\n chain,\n // TODO: we will want to enforce alchemy transport here probably\n feeEstimator: alchemyFeeEstimator(transport as AlchemyTransport),\n ...(policyId\n ? useErc7677middleware\n ? alchemyGasManagerMiddleware(policyId)\n : // NOTE: DO NOT USE THIS MIDDLEWARE in the server, currently we require using the erc7677 middleware\n alchemyGasAndPaymasterAndDataMiddleware({\n policyId,\n transport: transport as AlchemyTransport,\n })\n : {}),\n }).extend(isomorphicClientActions);\n\n return client;\n}\n\nexport type IsomorphicClient = ReturnType<typeof createIsomorphicClient>;\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { SmartAccountClient, SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import { type Address, type Chain, type Transport } from "viem";
|
|
3
|
-
import type { WalletServerViemRpcSchema } from "../../rpc/schema.js";
|
|
4
|
-
import { PreparedCall_Authorization } from "../../schemas.js";
|
|
5
|
-
import type { Eip7702AuthCapability } from "../../capabilities/eip7702Auth.ts";
|
|
6
|
-
import type { Static } from "@sinclair/typebox";
|
|
7
|
-
export declare const createAuthorizationRequest: (client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: {
|
|
8
|
-
address: Address;
|
|
9
|
-
delegation: Address;
|
|
10
|
-
}) => Promise<Static<typeof PreparedCall_Authorization> | undefined>;
|
|
11
|
-
export declare const EIP_7702_ACCOUNT_TYPE: readonly ["ModularAccountV2"];
|
|
12
|
-
type Supported7702AccountType = (typeof EIP_7702_ACCOUNT_TYPE)[number];
|
|
13
|
-
export declare const SUPPORTED_DELEGATION_ADDRESSES: "0x69007702764179f14F51cdce752f4f775d74E139"[];
|
|
14
|
-
export declare const isSupportedDelegationAddress7702: (address: Address) => boolean;
|
|
15
|
-
export declare const getAccountTypeForDelegationAddress7702: (address: Address) => Supported7702AccountType | undefined;
|
|
16
|
-
export declare const parseDelegation: (eip7702AuthCapability: Static<typeof Eip7702AuthCapability>) => "0x69007702764179f14F51cdce752f4f775d74E139";
|
|
17
|
-
export declare const assertValid7702AccountAddress: (fromAddress: Address, eip7702AuthCapability: Static<typeof Eip7702AuthCapability> | undefined) => void;
|
|
18
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { concatHex, numberToHex, isAddress, hexToNumber, } from "viem";
|
|
2
|
-
import { PreparedCall_Authorization } from "../../schemas.js";
|
|
3
|
-
import { InvalidRequestError } from "ox/RpcResponse";
|
|
4
|
-
import { hashAuthorization } from "viem/utils";
|
|
5
|
-
export const createAuthorizationRequest = async (client, params) => {
|
|
6
|
-
const expectedCode = concatHex(["0xef0100", params.delegation]);
|
|
7
|
-
const code = (await client.getCode({ address: params.address })) ?? "0x";
|
|
8
|
-
if (code.toLowerCase() === expectedCode.toLowerCase()) {
|
|
9
|
-
return undefined; // Already authorized.
|
|
10
|
-
}
|
|
11
|
-
const data = {
|
|
12
|
-
address: params.delegation,
|
|
13
|
-
nonce: numberToHex(await client.getTransactionCount({
|
|
14
|
-
address: params.address,
|
|
15
|
-
})),
|
|
16
|
-
};
|
|
17
|
-
return {
|
|
18
|
-
type: "authorization",
|
|
19
|
-
data,
|
|
20
|
-
chainId: numberToHex(client.chain.id),
|
|
21
|
-
signatureRequest: {
|
|
22
|
-
type: "eip7702Auth",
|
|
23
|
-
rawPayload: hashAuthorization({
|
|
24
|
-
chainId: client.chain.id,
|
|
25
|
-
nonce: hexToNumber(data.nonce),
|
|
26
|
-
address: params.delegation,
|
|
27
|
-
}),
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export const EIP_7702_ACCOUNT_TYPE = ["ModularAccountV2"];
|
|
32
|
-
const Eip7702AccountTypeToDelegationAddress = {
|
|
33
|
-
ModularAccountV2: "0x69007702764179f14F51cdce752f4f775d74E139",
|
|
34
|
-
};
|
|
35
|
-
const DelegationAddressToAccountType = Object.fromEntries(Object.entries(Eip7702AccountTypeToDelegationAddress).map(([key, value]) => [
|
|
36
|
-
value,
|
|
37
|
-
key,
|
|
38
|
-
]));
|
|
39
|
-
export const SUPPORTED_DELEGATION_ADDRESSES = Object.values(Eip7702AccountTypeToDelegationAddress);
|
|
40
|
-
export const isSupportedDelegationAddress7702 = (address) => {
|
|
41
|
-
return SUPPORTED_DELEGATION_ADDRESSES.includes(address);
|
|
42
|
-
};
|
|
43
|
-
export const getAccountTypeForDelegationAddress7702 = (address) => {
|
|
44
|
-
return DelegationAddressToAccountType[address];
|
|
45
|
-
};
|
|
46
|
-
const getDelegationAddressForAccountType7702 = (accountType) => {
|
|
47
|
-
return Eip7702AccountTypeToDelegationAddress[accountType];
|
|
48
|
-
};
|
|
49
|
-
const DEFAULT_7702_DELEGATION_ADDR = Eip7702AccountTypeToDelegationAddress["ModularAccountV2"];
|
|
50
|
-
export const parseDelegation = (eip7702AuthCapability) => {
|
|
51
|
-
return eip7702AuthCapability === true
|
|
52
|
-
? DEFAULT_7702_DELEGATION_ADDR
|
|
53
|
-
: isAddress(eip7702AuthCapability.delegation)
|
|
54
|
-
? eip7702AuthCapability.delegation
|
|
55
|
-
: getDelegationAddressForAccountType7702(eip7702AuthCapability.delegation);
|
|
56
|
-
};
|
|
57
|
-
export const assertValid7702AccountAddress = (fromAddress, eip7702AuthCapability) => {
|
|
58
|
-
if (eip7702AuthCapability) {
|
|
59
|
-
if (typeof eip7702AuthCapability === "object" &&
|
|
60
|
-
"account" in eip7702AuthCapability &&
|
|
61
|
-
eip7702AuthCapability?.account !== fromAddress) {
|
|
62
|
-
throw new InvalidRequestError({
|
|
63
|
-
message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
const delegation = parseDelegation(eip7702AuthCapability);
|
|
67
|
-
if (!isSupportedDelegationAddress7702(delegation)) {
|
|
68
|
-
throw new InvalidRequestError({
|
|
69
|
-
message: `Unsupported 7702 delegation address: ${delegation}`,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
//# sourceMappingURL=7702.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"7702.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/7702.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,WAAW,EAIX,SAAS,EACT,WAAW,GACZ,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM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,EAC9C,CAAC;YACD,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,+BAA+B,qBAAqB,CAAC,OAAO,8BAA8B,WAAW,GAAG;aAClH,CAAC,CAAC;QACL,CAAC;QAED,MAAM,UAAU,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAAC;QAE1D,IAAI,CAAC,gCAAgC,CAAC,UAAU,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,wCAAwC,UAAU,EAAE;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { SmartAccountClient, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n concatHex,\n numberToHex,\n type Address,\n type Chain,\n type Transport,\n isAddress,\n hexToNumber,\n} from \"viem\";\nimport type { WalletServerViemRpcSchema } from \"../../rpc/schema.js\";\nimport { PreparedCall_Authorization } from \"../../schemas.js\";\nimport type { Eip7702AuthCapability } from \"../../capabilities/eip7702Auth.ts\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { hashAuthorization } from \"viem/utils\";\n\nexport const createAuthorizationRequest = async (\n client: SmartAccountClient<\n Transport,\n Chain,\n SmartContractAccount | undefined,\n Record<string, unknown>,\n WalletServerViemRpcSchema\n >,\n params: { address: Address; delegation: Address },\n): Promise<Static<typeof PreparedCall_Authorization> | undefined> => {\n const expectedCode = concatHex([\"0xef0100\", params.delegation]);\n const code = (await client.getCode({ address: params.address })) ?? \"0x\";\n if (code.toLowerCase() === expectedCode.toLowerCase()) {\n return undefined; // Already authorized.\n }\n const data = {\n address: params.delegation,\n nonce: numberToHex(\n await client.getTransactionCount({\n address: params.address,\n }),\n ),\n };\n return {\n type: \"authorization\" as const,\n data,\n chainId: numberToHex(client.chain.id),\n signatureRequest: {\n type: \"eip7702Auth\" as const,\n rawPayload: hashAuthorization({\n chainId: client.chain.id,\n nonce: hexToNumber(data.nonce),\n address: params.delegation,\n }),\n },\n };\n};\n\nexport const EIP_7702_ACCOUNT_TYPE = [\"ModularAccountV2\"] as const;\n\ntype Supported7702AccountType = (typeof EIP_7702_ACCOUNT_TYPE)[number];\n\nconst Eip7702AccountTypeToDelegationAddress = {\n ModularAccountV2: \"0x69007702764179f14F51cdce752f4f775d74E139\",\n} as const satisfies Record<Supported7702AccountType, Address>;\n\nconst DelegationAddressToAccountType: Record<\n Address,\n Supported7702AccountType\n> = Object.fromEntries(\n Object.entries(Eip7702AccountTypeToDelegationAddress).map(([key, value]) => [\n value,\n key,\n ]),\n) as Record<Address, Supported7702AccountType>;\n\nexport const SUPPORTED_DELEGATION_ADDRESSES = Object.values(\n Eip7702AccountTypeToDelegationAddress,\n);\n\nexport const isSupportedDelegationAddress7702 = (address: Address): boolean => {\n return (SUPPORTED_DELEGATION_ADDRESSES as Address[]).includes(address);\n};\n\nexport const getAccountTypeForDelegationAddress7702 = (\n address: Address,\n): Supported7702AccountType | undefined => {\n return DelegationAddressToAccountType[address];\n};\n\nconst getDelegationAddressForAccountType7702 = (\n accountType: Supported7702AccountType,\n): (typeof SUPPORTED_DELEGATION_ADDRESSES)[number] => {\n return Eip7702AccountTypeToDelegationAddress[accountType];\n};\n\nconst DEFAULT_7702_DELEGATION_ADDR =\n Eip7702AccountTypeToDelegationAddress[\"ModularAccountV2\"];\n\nexport const parseDelegation = (\n eip7702AuthCapability: Static<typeof Eip7702AuthCapability>,\n) => {\n return eip7702AuthCapability === true\n ? DEFAULT_7702_DELEGATION_ADDR\n : isAddress(eip7702AuthCapability.delegation)\n ? eip7702AuthCapability.delegation\n : getDelegationAddressForAccountType7702(\n eip7702AuthCapability.delegation,\n );\n};\n\nexport const assertValid7702AccountAddress = (\n fromAddress: Address,\n eip7702AuthCapability: Static<typeof Eip7702AuthCapability> | undefined,\n) => {\n if (eip7702AuthCapability) {\n if (\n typeof eip7702AuthCapability === \"object\" &&\n \"account\" in eip7702AuthCapability &&\n eip7702AuthCapability?.account !== fromAddress\n ) {\n throw new InvalidRequestError({\n message: `EIP-7702 delegation account ${eip7702AuthCapability.account} must match 'from' address ${fromAddress}.`,\n });\n }\n\n const delegation = parseDelegation(eip7702AuthCapability);\n\n if (!isSupportedDelegationAddress7702(delegation)) {\n throw new InvalidRequestError({\n message: `Unsupported 7702 delegation address: ${delegation}`,\n });\n }\n }\n};\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import { type ModularAccountV2 } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { StaticDecode } from "@sinclair/typebox";
|
|
4
|
-
import type { Address, Chain, Transport } from "viem";
|
|
5
|
-
import type { TypeSerializedInitcode } from "../../schemas.js";
|
|
6
|
-
import { PermissionsCapability } from "../../capabilities/permissions/index.js";
|
|
7
|
-
type CreateAccountParams = {
|
|
8
|
-
chain: Chain;
|
|
9
|
-
transport: Transport;
|
|
10
|
-
signer: SmartAccountSigner;
|
|
11
|
-
accountAddress: Address;
|
|
12
|
-
counterfactualInfo?: StaticDecode<typeof TypeSerializedInitcode>;
|
|
13
|
-
permissions?: StaticDecode<typeof PermissionsCapability>;
|
|
14
|
-
delegation?: Address;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Creates a smart account instance from the given parameters.
|
|
18
|
-
* @param params - The parameters for creating a smart account.
|
|
19
|
-
* @returns A promise that resolves to the created smart account.
|
|
20
|
-
*/
|
|
21
|
-
export declare function createAccount(params: CreateAccountParams): Promise<SmartContractAccount>;
|
|
22
|
-
export declare function isModularAccountV2(account: SmartContractAccount): account is ModularAccountV2;
|
|
23
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GAEvB,MAAM,8BAA8B,C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QACvB,KAAK,sBAAsB,CAAC;QAC5B,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,MAAM,IAAI,mBAAmB,CAAC;gBAC5B,OAAO,EAAE,uCAAuC,WAAW,EAAE;aAC9D,CAAC,CAAC;QACL;YACE,OAAO,WAAW,CAAC,WAAW,EAAE,0BAA0B,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,OAA6B;IAE7B,OAAO,OAAO,CAAC,MAAM,KAAK,kBAAkB,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport {\n createLightAccount,\n createModularAccountV2,\n type ModularAccountV2,\n} from \"@account-kit/smart-contracts\";\nimport type { StaticDecode } from \"@sinclair/typebox\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport { concatHex, hexToNumber } from \"viem\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport { parsePermissionsContext } from \"./parsePermissionsContext.js\";\nimport { assertNever } from \"../../utils.js\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport { PermissionsCapability } from \"../../capabilities/permissions/index.js\";\nimport { InternalError, InvalidRequestError } from \"ox/RpcResponse\";\n\ntype CreateAccountParams = {\n chain: Chain;\n transport: Transport;\n signer: SmartAccountSigner;\n accountAddress: Address;\n counterfactualInfo?: StaticDecode<typeof TypeSerializedInitcode>; // undefined for 7702 accounts\n permissions?: StaticDecode<typeof PermissionsCapability>;\n delegation?: Address;\n};\n\n/**\n * Creates a smart account instance from the given parameters.\n * @param params - The parameters for creating a smart account.\n * @returns A promise that resolves to the created smart account.\n */\nexport async function createAccount(\n params: CreateAccountParams,\n): Promise<SmartContractAccount> {\n const { counterfactualInfo: ci, ...accountParams } = params;\n\n // This throws if we pass a permission context and the account is not MA-v2\n // TODO: test that this edge case is handled correctly\n const parsedContext = parsePermissionsContext(\n params.permissions,\n ci,\n params.delegation,\n );\n\n const signerEntity =\n parsedContext?.contextVersion === \"NON_DEFERRED_ACTION\"\n ? {\n entityId: hexToNumber(parsedContext.entityId),\n isGlobalValidation: parsedContext.isGlobalValidation,\n }\n : undefined;\n\n const mode = params.delegation ? \"7702\" : \"default\";\n\n if (mode === \"7702\") {\n const accountType = getAccountTypeForDelegationAddress7702(\n params.delegation!,\n );\n if (accountType !== \"ModularAccountV2\") {\n throw new Error(\"7702 mode currently only supports ModularAccountV2\");\n }\n return createModularAccountV2({\n ...accountParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n mode,\n });\n }\n\n if (mode !== \"default\") {\n return assertNever(mode, \"Unexpected mode in createAccount\");\n }\n\n // At this point, we are guaranteed to be in default mode, where ci\n // (counterfactualInfo) must be defined\n\n if (!ci) {\n throw new InternalError({\n message: \"Counterfactual info not found\",\n });\n }\n\n const factoryType = ci.factoryType;\n const commonParams = {\n ...accountParams,\n initCode: concatHex([ci.factoryAddress, ci.factoryData]),\n };\n\n // Return the account created based on the factory type\n switch (factoryType) {\n case \"MAv2.0.0-sma-b\":\n return createModularAccountV2({\n ...commonParams,\n signerEntity,\n deferredAction: parsedContext?.deferredAction,\n mode,\n });\n case \"LightAccountV2.0.0\":\n return createLightAccount({\n ...commonParams,\n version: \"v2.0.0\",\n });\n case \"LightAccountV1.0.1\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.0.1\",\n });\n case \"LightAccountV1.0.2\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.0.2\",\n });\n case \"LightAccountV1.1.0\":\n return createLightAccount({\n ...commonParams,\n version: \"v1.1.0\",\n });\n case \"LightAccountV2.0.0-MultiOwner\":\n case \"MAv1.0.0-MultiOwner\":\n case \"MAv1.0.0-MultiSig\":\n case \"MAv2.0.0-ma-ssv\":\n case \"MAv2.0.0-ma-webauthn\":\n case \"unknown\":\n case undefined:\n throw new InvalidRequestError({\n message: `Account type currently unsupported: ${factoryType}`,\n });\n default:\n return assertNever(factoryType, \"Unsupported factory type\");\n }\n}\n\nexport function isModularAccountV2(\n account: SmartContractAccount,\n): account is ModularAccountV2 {\n return account.source === \"ModularAccountV2\";\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {} from "@aa-sdk/core";
|
|
2
|
-
import { BaseError, } from "viem";
|
|
3
|
-
export const createDummySigner = (address) => ({
|
|
4
|
-
signerType: "",
|
|
5
|
-
inner: undefined,
|
|
6
|
-
getAddress: async function () {
|
|
7
|
-
return address;
|
|
8
|
-
},
|
|
9
|
-
// Not supported on the server
|
|
10
|
-
signMessage: function (_message) {
|
|
11
|
-
throw new BaseError("signMessage not implemented by dummy signer.");
|
|
12
|
-
},
|
|
13
|
-
signTypedData: function (_params) {
|
|
14
|
-
throw new BaseError("signTypedData not implemented by dummy signer.");
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=createDummySigner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDummySigner.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createDummySigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AAEvD,OAAO,EACL,SAAS,GAKV,MAAM,MAAM,CAAC;AAEd,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAgB,EAAsB,EAAE,CAAC,CAAC;IAC1E,UAAU,EAAE,EAAE;IACd,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,KAAK;QACf,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,8BAA8B;IAC9B,WAAW,EAAE,UAAU,QAAyB;QAC9C,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACtE,CAAC;IACD,aAAa,EAAE,UAGb,OAAsD;QACtD,MAAM,IAAI,SAAS,CAAC,gDAAgD,CAAC,CAAC;IACxE,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { TypedData } from \"abitype\";\nimport {\n BaseError,\n type Address,\n type Hex,\n type SignableMessage,\n type TypedDataDefinition,\n} from \"viem\";\n\nexport const createDummySigner = (address: Address): SmartAccountSigner => ({\n signerType: \"\",\n inner: undefined,\n getAddress: async function (): Promise<`0x${string}`> {\n return address;\n },\n // Not supported on the server\n signMessage: function (_message: SignableMessage): Promise<Hex> {\n throw new BaseError(\"signMessage not implemented by dummy signer.\");\n },\n signTypedData: function <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(_params: TypedDataDefinition<TTypedData, TPrimaryType>): Promise<Hex> {\n throw new BaseError(\"signTypedData not implemented by dummy signer.\");\n },\n});\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Value } from "@sinclair/typebox/value";
|
|
2
|
-
import { TypeEcdsaSig } from "../../schemas.js";
|
|
3
|
-
import { assertNever } from "../../utils.js";
|
|
4
|
-
export const decodeSignature = (signature) => {
|
|
5
|
-
switch (signature.type) {
|
|
6
|
-
case "ecdsa":
|
|
7
|
-
case "secp256k1":
|
|
8
|
-
return Value.Decode(TypeEcdsaSig, { signature }).signature;
|
|
9
|
-
default:
|
|
10
|
-
return assertNever(signature, "Unexpected signature type");
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=decodeSignature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decodeSignature.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/decodeSignature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAmD,EACH,EAAE;IAClD,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,OAAO,CAAC;QACb,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,SAAS,EAE5C,CAAC,CAAC,SAAS,CAAC;QACf;YACE,OAAO,WAAW,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { Value } from \"@sinclair/typebox/value\";\nimport type { Static, StaticDecode } from \"@sinclair/typebox\";\nimport { TypeEcdsaSig } from \"../../schemas.js\";\nimport { assertNever } from \"../../utils.js\";\n\nexport const decodeSignature = (\n signature: Static<typeof TypeEcdsaSig>[\"signature\"],\n): StaticDecode<typeof TypeEcdsaSig>[\"signature\"] => {\n switch (signature.type) {\n case \"ecdsa\":\n case \"secp256k1\":\n return Value.Decode(TypeEcdsaSig, { signature } satisfies Static<\n typeof TypeEcdsaSig\n >).signature;\n default:\n return assertNever(signature, \"Unexpected signature type\");\n }\n};\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { StaticDecode } from "@sinclair/typebox";
|
|
2
|
-
import type { TypeSerializedInitcode } from "../../schemas.js";
|
|
3
|
-
import type { Address } from "viem";
|
|
4
|
-
import { PermissionsCapability } from "../../capabilities/permissions/index.js";
|
|
5
|
-
export declare function parsePermissionsContext(permissions?: StaticDecode<typeof PermissionsCapability>, parsedCi?: StaticDecode<typeof TypeSerializedInitcode> | undefined, delegation7702?: Address): ({
|
|
6
|
-
contextVersion: keyof typeof import("../../exports/internal.js").PermissionsContextVersion;
|
|
7
|
-
} & {
|
|
8
|
-
contextVersion: "LOCAL_MODE_DEFERRED_ACTION";
|
|
9
|
-
deferredAction: import("viem").Hex;
|
|
10
|
-
sessionId?: never;
|
|
11
|
-
signature?: never;
|
|
12
|
-
}) | ({
|
|
13
|
-
contextVersion: keyof typeof import("../../exports/internal.js").PermissionsContextVersion;
|
|
14
|
-
} & {
|
|
15
|
-
contextVersion: "NON_DEFERRED_ACTION";
|
|
16
|
-
deferredAction?: never;
|
|
17
|
-
sessionId?: never;
|
|
18
|
-
signature?: never;
|
|
19
|
-
entityId: import("viem").Hex;
|
|
20
|
-
isGlobalValidation: boolean;
|
|
21
|
-
}) | undefined;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { InvalidRequestError } from "ox/RpcResponse";
|
|
2
|
-
import { decodePermissionsContext } from "../../capabilities/permissions/mav2.js";
|
|
3
|
-
import { getAccountTypeForDelegationAddress7702 } from "./7702.js";
|
|
4
|
-
import { PermissionsCapability } from "../../capabilities/permissions/index.js";
|
|
5
|
-
export function parsePermissionsContext(permissions, parsedCi, delegation7702) {
|
|
6
|
-
if (!permissions) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
if ("sessionId" in permissions) {
|
|
10
|
-
throw new InvalidRequestError({
|
|
11
|
-
message: "Remote permissions are not supported in isomorphic client",
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
if (!("context" in permissions)) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
const isMAV2 = (parsedCi && parsedCi.factoryType === "MAv2.0.0-sma-b") ||
|
|
18
|
-
(delegation7702 &&
|
|
19
|
-
getAccountTypeForDelegationAddress7702(delegation7702) ===
|
|
20
|
-
"ModularAccountV2");
|
|
21
|
-
if (!isMAV2) {
|
|
22
|
-
throw new InvalidRequestError({
|
|
23
|
-
message: "Permissions are currently only supported by MAv2 accounts",
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
const context = decodePermissionsContext(permissions);
|
|
27
|
-
if (context?.contextVersion === "REMOTE_MODE_DEFERRED_ACTION") {
|
|
28
|
-
throw new InvalidRequestError({
|
|
29
|
-
message: "Remote mode deferred action not supported in isomorphic client",
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return context;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=parsePermissionsContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsePermissionsContext.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAGlF,OAAO,EAAE,sCAAsC,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,MAAM,UAAU,uBAAuB,CACrC,WAAwD,EACxD,QAAkE,EAClE,cAAwB;IAExB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,CAAC,SAAS,IAAI,WAAW,CAAC,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GACV,CAAC,QAAQ,IAAI,QAAQ,CAAC,WAAW,KAAK,gBAAgB,CAAC;QACvD,CAAC,cAAc;YACb,sCAAsC,CAAC,cAAc,CAAC;gBACpD,kBAAkB,CAAC,CAAC;IAE1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,2DAA2D;SACrE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAEtD,IAAI,OAAO,EAAE,cAAc,KAAK,6BAA6B,EAAE,CAAC;QAC9D,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,gEAAgE;SAC1E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport { InvalidRequestError } from \"ox/RpcResponse\";\nimport { decodePermissionsContext } from \"../../capabilities/permissions/mav2.js\";\nimport type { TypeSerializedInitcode } from \"../../schemas.js\";\nimport type { Address } from \"viem\";\nimport { getAccountTypeForDelegationAddress7702 } from \"./7702.js\";\nimport { PermissionsCapability } from \"../../capabilities/permissions/index.js\";\n\nexport function parsePermissionsContext(\n permissions?: StaticDecode<typeof PermissionsCapability>,\n parsedCi?: StaticDecode<typeof TypeSerializedInitcode> | undefined,\n delegation7702?: Address,\n) {\n if (!permissions) {\n return undefined;\n }\n\n if (\"sessionId\" in permissions) {\n throw new InvalidRequestError({\n message: \"Remote permissions are not supported in isomorphic client\",\n });\n }\n\n if (!(\"context\" in permissions)) {\n return undefined;\n }\n\n const isMAV2 =\n (parsedCi && parsedCi.factoryType === \"MAv2.0.0-sma-b\") ||\n (delegation7702 &&\n getAccountTypeForDelegationAddress7702(delegation7702) ===\n \"ModularAccountV2\");\n\n if (!isMAV2) {\n throw new InvalidRequestError({\n message: \"Permissions are currently only supported by MAv2 accounts\",\n });\n }\n\n const context = decodePermissionsContext(permissions);\n\n if (context?.contextVersion === \"REMOTE_MODE_DEFERRED_ACTION\") {\n throw new InvalidRequestError({\n message: \"Remote mode deferred action not supported in isomorphic client\",\n });\n }\n\n return context;\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { StaticDecode } from "@sinclair/typebox";
|
|
2
|
-
import type { TypeSerializedInitcode } from "../../schemas.ts";
|
|
3
|
-
export type Feature = "permissions";
|
|
4
|
-
export declare function supportsFeature(counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>, feature: Feature): boolean;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const supportedFeatures = {
|
|
2
|
-
"LightAccountV1.0.1": [],
|
|
3
|
-
"LightAccountV1.0.2": [],
|
|
4
|
-
"LightAccountV1.1.0": [],
|
|
5
|
-
"LightAccountV2.0.0": [],
|
|
6
|
-
"LightAccountV2.0.0-MultiOwner": [],
|
|
7
|
-
"MAv1.0.0-MultiOwner": [],
|
|
8
|
-
"MAv1.0.0-MultiSig": [],
|
|
9
|
-
"MAv2.0.0-sma-b": ["permissions"],
|
|
10
|
-
"MAv2.0.0-ma-ssv": ["permissions"],
|
|
11
|
-
"MAv2.0.0-ma-webauthn": [],
|
|
12
|
-
unknown: [],
|
|
13
|
-
};
|
|
14
|
-
export function supportsFeature(counterfactualInfo, feature) {
|
|
15
|
-
const factorySupportedFeatures = supportedFeatures[counterfactualInfo.factoryType];
|
|
16
|
-
if (factorySupportedFeatures === undefined) {
|
|
17
|
-
throw new Error("Unsupported FactoryType: " + counterfactualInfo.factoryType);
|
|
18
|
-
}
|
|
19
|
-
return factorySupportedFeatures.includes(feature);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=supportsFeature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"supportsFeature.js","sourceRoot":"","sources":["../../../../src/isomorphic/utils/supportsFeature.ts"],"names":[],"mappings":"AAOA,MAAM,iBAAiB,GAAmC;IACxD,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,+BAA+B,EAAE,EAAE;IACnC,qBAAqB,EAAE,EAAE;IACzB,mBAAmB,EAAE,EAAE;IACvB,gBAAgB,EAAE,CAAC,aAAa,CAAC;IACjC,iBAAiB,EAAE,CAAC,aAAa,CAAC;IAClC,sBAAsB,EAAE,EAAE;IAC1B,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,UAAU,eAAe,CAC7B,kBAA+D,EAC/D,OAAgB;IAEhB,MAAM,wBAAwB,GAC5B,iBAAiB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,wBAAwB,KAAK,SAAS,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACb,2BAA2B,GAAG,kBAAkB,CAAC,WAAW,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,wBAAwB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { StaticDecode } from \"@sinclair/typebox\";\nimport type { TypeSerializedInitcode } from \"../../schemas.ts\";\n\nexport type Feature = \"permissions\";\n\ntype FactoryType = StaticDecode<typeof TypeSerializedInitcode>[\"factoryType\"];\n\nconst supportedFeatures: Record<FactoryType, Feature[]> = {\n \"LightAccountV1.0.1\": [],\n \"LightAccountV1.0.2\": [],\n \"LightAccountV1.1.0\": [],\n \"LightAccountV2.0.0\": [],\n \"LightAccountV2.0.0-MultiOwner\": [],\n \"MAv1.0.0-MultiOwner\": [],\n \"MAv1.0.0-MultiSig\": [],\n \"MAv2.0.0-sma-b\": [\"permissions\"],\n \"MAv2.0.0-ma-ssv\": [\"permissions\"],\n \"MAv2.0.0-ma-webauthn\": [],\n unknown: [],\n};\n\nexport function supportsFeature(\n counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>,\n feature: Feature,\n): boolean {\n const factorySupportedFeatures =\n supportedFeatures[counterfactualInfo.factoryType];\n if (factorySupportedFeatures === undefined) {\n throw new Error(\n \"Unsupported FactoryType: \" + counterfactualInfo.factoryType,\n );\n }\n return factorySupportedFeatures.includes(feature);\n}\n"]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
|
-
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
|
|
3
|
-
export declare function createLocalClient<TAccount extends Address | undefined = Address | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;
|