@account-kit/wallet-client 0.1.0-alpha.10 → 0.1.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/client/actions/getCallsStatus.d.ts +4 -3
- package/dist/esm/client/actions/getCallsStatus.js +1 -0
- package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +5 -4
- package/dist/esm/client/actions/grantPermissions.js +21 -5
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/prepareCalls.d.ts +4 -3
- package/dist/esm/client/actions/prepareCalls.js +1 -0
- package/dist/esm/client/actions/prepareCalls.js.map +1 -1
- package/dist/esm/client/actions/prepareSign.d.ts +4 -3
- package/dist/esm/client/actions/prepareSign.js +1 -0
- package/dist/esm/client/actions/prepareSign.js.map +1 -1
- package/dist/esm/client/actions/requestAccount.js +3 -3
- package/dist/esm/client/actions/requestAccount.js.map +1 -1
- package/dist/esm/client/actions/signSignatureRequest.d.ts +3 -3
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +190 -329
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/index.d.ts +1 -4
- package/dist/esm/client/index.js +13 -18
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/{isomorphic/utils/createAccount.d.ts → internal/account.d.ts} +3 -7
- package/dist/esm/{isomorphic/utils/createAccount.js → internal/account.js} +9 -33
- package/dist/esm/internal/account.js.map +1 -0
- package/dist/esm/types.d.ts +2 -8
- package/dist/esm/types.js.map +1 -1
- package/dist/types/client/actions/getCallsStatus.d.ts +4 -3
- package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +5 -4
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/prepareCalls.d.ts +4 -3
- package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/client/actions/prepareSign.d.ts +4 -3
- package/dist/types/client/actions/prepareSign.d.ts.map +1 -1
- package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
- package/dist/types/client/actions/signSignatureRequest.d.ts +3 -3
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +1 -4
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/{isomorphic/utils/createAccount.d.ts → internal/account.d.ts} +4 -8
- package/dist/types/internal/account.d.ts.map +1 -0
- package/dist/types/types.d.ts +2 -8
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +3 -8
- package/src/client/actions/getCallsStatus.ts +8 -6
- package/src/client/actions/grantPermissions.ts +41 -10
- package/src/client/actions/prepareCalls.ts +11 -6
- package/src/client/actions/prepareSign.ts +9 -6
- package/src/client/actions/requestAccount.ts +3 -3
- package/src/client/actions/signSignatureRequest.ts +8 -8
- package/src/client/client.e2e-test.ts +143 -298
- package/src/client/index.ts +22 -23
- package/src/{isomorphic/utils/createAccount.ts → internal/account.ts} +11 -51
- package/src/types.ts +4 -15
- package/dist/esm/exports/internal.d.ts +0 -4
- package/dist/esm/exports/internal.js +0 -3
- package/dist/esm/exports/internal.js.map +0 -1
- package/dist/esm/isomorphic/actions/createSession.d.ts +0 -13
- package/dist/esm/isomorphic/actions/createSession.js +0 -94
- package/dist/esm/isomorphic/actions/createSession.js.map +0 -1
- package/dist/esm/isomorphic/actions/formatSign.d.ts +0 -8
- package/dist/esm/isomorphic/actions/formatSign.js +0 -42
- package/dist/esm/isomorphic/actions/formatSign.js.map +0 -1
- package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +0 -7
- package/dist/esm/isomorphic/actions/getCallsStatus.js +0 -71
- package/dist/esm/isomorphic/actions/getCallsStatus.js.map +0 -1
- package/dist/esm/isomorphic/actions/prepareCalls.d.ts +0 -7
- package/dist/esm/isomorphic/actions/prepareCalls.js +0 -116
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +0 -1
- package/dist/esm/isomorphic/actions/prepareSign.d.ts +0 -7
- package/dist/esm/isomorphic/actions/prepareSign.js +0 -49
- package/dist/esm/isomorphic/actions/prepareSign.js.map +0 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +0 -7
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +0 -156
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +0 -1
- package/dist/esm/isomorphic/client.d.ts +0 -275
- package/dist/esm/isomorphic/client.js +0 -41
- package/dist/esm/isomorphic/client.js.map +0 -1
- package/dist/esm/isomorphic/utils/7702.d.ts +0 -19
- package/dist/esm/isomorphic/utils/7702.js +0 -70
- package/dist/esm/isomorphic/utils/7702.js.map +0 -1
- 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 -15
- 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/types/exports/internal.d.ts +0 -5
- package/dist/types/exports/internal.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/createSession.d.ts +0 -14
- package/dist/types/isomorphic/actions/createSession.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/formatSign.d.ts +0 -9
- package/dist/types/isomorphic/actions/formatSign.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts +0 -8
- package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts +0 -8
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/prepareSign.d.ts +0 -8
- package/dist/types/isomorphic/actions/prepareSign.d.ts.map +0 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +0 -8
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +0 -1
- package/dist/types/isomorphic/client.d.ts +0 -276
- package/dist/types/isomorphic/client.d.ts.map +0 -1
- package/dist/types/isomorphic/utils/7702.d.ts +0 -20
- package/dist/types/isomorphic/utils/7702.d.ts.map +0 -1
- 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/src/exports/internal.ts +0 -8
- package/src/isomorphic/actions/createSession.ts +0 -163
- package/src/isomorphic/actions/formatSign.ts +0 -76
- package/src/isomorphic/actions/getCallsStatus.ts +0 -112
- package/src/isomorphic/actions/prepareCalls.ts +0 -172
- package/src/isomorphic/actions/prepareSign.ts +0 -91
- package/src/isomorphic/actions/sendPreparedCalls.ts +0 -234
- package/src/isomorphic/client.ts +0 -102
- package/src/isomorphic/utils/7702.ts +0 -135
- package/src/isomorphic/utils/createDummySigner.ts +0 -27
- package/src/isomorphic/utils/decodeSignature.ts +0 -21
- package/src/isomorphic/utils/parsePermissionsContext.ts +0 -51
- package/src/isomorphic/utils/supportsFeature.ts +0 -34
- package/src/local/client.ts +0 -136
- package/src/remote/client.ts +0 -67
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { type ClientMiddlewareFn, type SmartAccountClient, type SmartAccountClientRpcSchema, type SmartContractAccount } from "@aa-sdk/core";
|
|
2
|
-
import { type Chain, type Transport } from "viem";
|
|
3
|
-
import type { WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
|
|
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
|
-
import { type PrepareSignParams } from "./actions/prepareSign.js";
|
|
9
|
-
import { type FormatSignParams } from "./actions/formatSign.js";
|
|
10
|
-
type ClientParams = {
|
|
11
|
-
chain: Chain;
|
|
12
|
-
transport: Transport;
|
|
13
|
-
policyId?: string;
|
|
14
|
-
useErc7677middleware?: boolean;
|
|
15
|
-
feeEstimator?: ClientMiddlewareFn;
|
|
16
|
-
};
|
|
17
|
-
export declare function isomorphicClientActions(client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>): {
|
|
18
|
-
prepareCalls: (params: PrepareCallsParams) => Promise<{
|
|
19
|
-
type: "array";
|
|
20
|
-
data: ({
|
|
21
|
-
type: "user-operation-v060";
|
|
22
|
-
data: {
|
|
23
|
-
nonce: `0x${string}`;
|
|
24
|
-
initCode: `0x${string}`;
|
|
25
|
-
maxFeePerGas: `0x${string}`;
|
|
26
|
-
maxPriorityFeePerGas: `0x${string}`;
|
|
27
|
-
paymasterAndData: `0x${string}`;
|
|
28
|
-
sender: `0x${string}`;
|
|
29
|
-
callData: `0x${string}`;
|
|
30
|
-
callGasLimit: `0x${string}`;
|
|
31
|
-
verificationGasLimit: `0x${string}`;
|
|
32
|
-
preVerificationGas: `0x${string}`;
|
|
33
|
-
};
|
|
34
|
-
chainId: `0x${string}`;
|
|
35
|
-
signatureRequest: {
|
|
36
|
-
type: "personal_sign";
|
|
37
|
-
data: string | {
|
|
38
|
-
raw: `0x${string}`;
|
|
39
|
-
};
|
|
40
|
-
rawPayload: `0x${string}`;
|
|
41
|
-
} | {
|
|
42
|
-
type: "eth_signTypedData_v4";
|
|
43
|
-
data: {
|
|
44
|
-
domain?: {
|
|
45
|
-
name?: string | undefined;
|
|
46
|
-
chainId?: number | undefined;
|
|
47
|
-
salt?: `0x${string}` | undefined;
|
|
48
|
-
version?: string | undefined;
|
|
49
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
50
|
-
} | undefined;
|
|
51
|
-
message: {
|
|
52
|
-
[x: string]: unknown;
|
|
53
|
-
};
|
|
54
|
-
primaryType: string;
|
|
55
|
-
types: {
|
|
56
|
-
[x: string]: {
|
|
57
|
-
type: string;
|
|
58
|
-
name: string;
|
|
59
|
-
}[];
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
rawPayload: `0x${string}`;
|
|
63
|
-
};
|
|
64
|
-
} | {
|
|
65
|
-
type: "user-operation-v070";
|
|
66
|
-
data: {
|
|
67
|
-
factoryData?: `0x${string}` | undefined;
|
|
68
|
-
paymasterVerificationGasLimit?: `0x${string}` | undefined;
|
|
69
|
-
paymasterPostOpGasLimit?: `0x${string}` | undefined;
|
|
70
|
-
factory?: `0x${string}` | undefined;
|
|
71
|
-
paymaster?: `0x${string}` | undefined;
|
|
72
|
-
paymasterData?: `0x${string}` | undefined;
|
|
73
|
-
nonce: `0x${string}`;
|
|
74
|
-
maxFeePerGas: `0x${string}`;
|
|
75
|
-
maxPriorityFeePerGas: `0x${string}`;
|
|
76
|
-
sender: `0x${string}`;
|
|
77
|
-
callData: `0x${string}`;
|
|
78
|
-
callGasLimit: `0x${string}`;
|
|
79
|
-
verificationGasLimit: `0x${string}`;
|
|
80
|
-
preVerificationGas: `0x${string}`;
|
|
81
|
-
};
|
|
82
|
-
chainId: `0x${string}`;
|
|
83
|
-
signatureRequest: {
|
|
84
|
-
type: "personal_sign";
|
|
85
|
-
data: string | {
|
|
86
|
-
raw: `0x${string}`;
|
|
87
|
-
};
|
|
88
|
-
rawPayload: `0x${string}`;
|
|
89
|
-
} | {
|
|
90
|
-
type: "eth_signTypedData_v4";
|
|
91
|
-
data: {
|
|
92
|
-
domain?: {
|
|
93
|
-
name?: string | undefined;
|
|
94
|
-
chainId?: number | undefined;
|
|
95
|
-
salt?: `0x${string}` | undefined;
|
|
96
|
-
version?: string | undefined;
|
|
97
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
98
|
-
} | undefined;
|
|
99
|
-
message: {
|
|
100
|
-
[x: string]: unknown;
|
|
101
|
-
};
|
|
102
|
-
primaryType: string;
|
|
103
|
-
types: {
|
|
104
|
-
[x: string]: {
|
|
105
|
-
type: string;
|
|
106
|
-
name: string;
|
|
107
|
-
}[];
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
rawPayload: `0x${string}`;
|
|
111
|
-
};
|
|
112
|
-
} | {
|
|
113
|
-
type: "authorization";
|
|
114
|
-
data: {
|
|
115
|
-
address: `0x${string}`;
|
|
116
|
-
nonce: `0x${string}`;
|
|
117
|
-
};
|
|
118
|
-
chainId: `0x${string}`;
|
|
119
|
-
signatureRequest: {
|
|
120
|
-
type: "eip7702Auth";
|
|
121
|
-
rawPayload: `0x${string}`;
|
|
122
|
-
};
|
|
123
|
-
})[];
|
|
124
|
-
} | {
|
|
125
|
-
type: "user-operation-v060";
|
|
126
|
-
data: {
|
|
127
|
-
nonce: `0x${string}`;
|
|
128
|
-
initCode: `0x${string}`;
|
|
129
|
-
maxFeePerGas: `0x${string}`;
|
|
130
|
-
maxPriorityFeePerGas: `0x${string}`;
|
|
131
|
-
paymasterAndData: `0x${string}`;
|
|
132
|
-
sender: `0x${string}`;
|
|
133
|
-
callData: `0x${string}`;
|
|
134
|
-
callGasLimit: `0x${string}`;
|
|
135
|
-
verificationGasLimit: `0x${string}`;
|
|
136
|
-
preVerificationGas: `0x${string}`;
|
|
137
|
-
};
|
|
138
|
-
chainId: `0x${string}`;
|
|
139
|
-
signatureRequest: {
|
|
140
|
-
type: "personal_sign";
|
|
141
|
-
data: string | {
|
|
142
|
-
raw: `0x${string}`;
|
|
143
|
-
};
|
|
144
|
-
rawPayload: `0x${string}`;
|
|
145
|
-
} | {
|
|
146
|
-
type: "eth_signTypedData_v4";
|
|
147
|
-
data: {
|
|
148
|
-
domain?: {
|
|
149
|
-
name?: string | undefined;
|
|
150
|
-
chainId?: number | undefined;
|
|
151
|
-
salt?: `0x${string}` | undefined;
|
|
152
|
-
version?: string | undefined;
|
|
153
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
154
|
-
} | undefined;
|
|
155
|
-
message: {
|
|
156
|
-
[x: string]: unknown;
|
|
157
|
-
};
|
|
158
|
-
primaryType: string;
|
|
159
|
-
types: {
|
|
160
|
-
[x: string]: {
|
|
161
|
-
type: string;
|
|
162
|
-
name: string;
|
|
163
|
-
}[];
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
rawPayload: `0x${string}`;
|
|
167
|
-
};
|
|
168
|
-
} | {
|
|
169
|
-
type: "user-operation-v070";
|
|
170
|
-
data: {
|
|
171
|
-
factoryData?: `0x${string}` | undefined;
|
|
172
|
-
paymasterVerificationGasLimit?: `0x${string}` | undefined;
|
|
173
|
-
paymasterPostOpGasLimit?: `0x${string}` | undefined;
|
|
174
|
-
factory?: `0x${string}` | undefined;
|
|
175
|
-
paymaster?: `0x${string}` | undefined;
|
|
176
|
-
paymasterData?: `0x${string}` | undefined;
|
|
177
|
-
nonce: `0x${string}`;
|
|
178
|
-
maxFeePerGas: `0x${string}`;
|
|
179
|
-
maxPriorityFeePerGas: `0x${string}`;
|
|
180
|
-
sender: `0x${string}`;
|
|
181
|
-
callData: `0x${string}`;
|
|
182
|
-
callGasLimit: `0x${string}`;
|
|
183
|
-
verificationGasLimit: `0x${string}`;
|
|
184
|
-
preVerificationGas: `0x${string}`;
|
|
185
|
-
};
|
|
186
|
-
chainId: `0x${string}`;
|
|
187
|
-
signatureRequest: {
|
|
188
|
-
type: "personal_sign";
|
|
189
|
-
data: string | {
|
|
190
|
-
raw: `0x${string}`;
|
|
191
|
-
};
|
|
192
|
-
rawPayload: `0x${string}`;
|
|
193
|
-
} | {
|
|
194
|
-
type: "eth_signTypedData_v4";
|
|
195
|
-
data: {
|
|
196
|
-
domain?: {
|
|
197
|
-
name?: string | undefined;
|
|
198
|
-
chainId?: number | undefined;
|
|
199
|
-
salt?: `0x${string}` | undefined;
|
|
200
|
-
version?: string | undefined;
|
|
201
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
202
|
-
} | undefined;
|
|
203
|
-
message: {
|
|
204
|
-
[x: string]: unknown;
|
|
205
|
-
};
|
|
206
|
-
primaryType: string;
|
|
207
|
-
types: {
|
|
208
|
-
[x: string]: {
|
|
209
|
-
type: string;
|
|
210
|
-
name: string;
|
|
211
|
-
}[];
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
rawPayload: `0x${string}`;
|
|
215
|
-
};
|
|
216
|
-
}>;
|
|
217
|
-
sendPreparedCalls: (params: SendPreparedCallsParams) => Promise<{
|
|
218
|
-
preparedCallIds: `0x${string}`[];
|
|
219
|
-
}>;
|
|
220
|
-
getCallsStatus: (params: GetCallsStatusParams) => Promise<{
|
|
221
|
-
receipts?: {
|
|
222
|
-
blockHash: `0x${string}`;
|
|
223
|
-
blockNumber: `0x${string}`;
|
|
224
|
-
gasUsed: `0x${string}`;
|
|
225
|
-
status: `0x${string}`;
|
|
226
|
-
logs: {
|
|
227
|
-
address: `0x${string}`;
|
|
228
|
-
data: `0x${string}`;
|
|
229
|
-
topics: `0x${string}`[];
|
|
230
|
-
}[];
|
|
231
|
-
transactionHash: `0x${string}`;
|
|
232
|
-
}[] | undefined;
|
|
233
|
-
chainId: `0x${string}`;
|
|
234
|
-
id: `0x${string}`;
|
|
235
|
-
atomic: boolean;
|
|
236
|
-
status: 200 | 100 | 400 | 500 | 600;
|
|
237
|
-
}>;
|
|
238
|
-
createSession: (params: CreateSessionParams) => Promise<import("./actions/createSession.js").CreateSessionResult>;
|
|
239
|
-
prepareSign: (params: PrepareSignParams) => Promise<{
|
|
240
|
-
chainId: `0x${string}`;
|
|
241
|
-
signatureRequest: {
|
|
242
|
-
type: "personal_sign";
|
|
243
|
-
data: string | {
|
|
244
|
-
raw: `0x${string}`;
|
|
245
|
-
};
|
|
246
|
-
} | {
|
|
247
|
-
type: "eth_signTypedData_v4";
|
|
248
|
-
data: {
|
|
249
|
-
domain?: {
|
|
250
|
-
name?: string | undefined;
|
|
251
|
-
chainId?: number | undefined;
|
|
252
|
-
salt?: `0x${string}` | undefined;
|
|
253
|
-
version?: string | undefined;
|
|
254
|
-
verifyingContract?: `0x${string}` | undefined;
|
|
255
|
-
} | undefined;
|
|
256
|
-
message: {
|
|
257
|
-
[x: string]: unknown;
|
|
258
|
-
};
|
|
259
|
-
primaryType: string;
|
|
260
|
-
types: {
|
|
261
|
-
[x: string]: {
|
|
262
|
-
type: string;
|
|
263
|
-
name: string;
|
|
264
|
-
}[];
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
};
|
|
268
|
-
}>;
|
|
269
|
-
formatSign: (params: FormatSignParams) => Promise<{
|
|
270
|
-
signature: `0x${string}`;
|
|
271
|
-
}>;
|
|
272
|
-
};
|
|
273
|
-
export declare function createIsomorphicClient({ chain, transport, policyId, useErc7677middleware, feeEstimator, }: ClientParams): SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, ReturnType<typeof isomorphicClientActions>, WalletServerViemRpcSchema & SmartAccountClientRpcSchema>;
|
|
274
|
-
export type IsomorphicClient = ReturnType<typeof createIsomorphicClient>;
|
|
275
|
-
export {};
|
|
276
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/isomorphic/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG5E,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B;2BAGwB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCACb,uBAAuB;;;6BAE1B,oBAAoB;;;;;;;;;;;;;;;;;;4BAErB,mBAAmB;0BAErB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAClB,gBAAgB;;;EAExC;AAID,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,SAAS,EACT,QAAQ,EACR,oBAA2B,EAC3B,YAAY,GACb,EAAE,YAAY,GAAG,kBAAkB,CAClC,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,UAAU,CAAC,OAAO,uBAAuB,CAAC,EAC1C,yBAAyB,GAAG,2BAA2B,CACxD,CAoBA;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,20 +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 "@alchemy/wallet-api-types/rpc";
|
|
4
|
-
import { type Supported7702AccountType, type Eip7702AuthCapability } from "@alchemy/wallet-api-types/capabilities";
|
|
5
|
-
import type { PreparedCall_Authorization } from "@alchemy/wallet-api-types";
|
|
6
|
-
/** Checks if an address is actively delegated on-chain. */
|
|
7
|
-
export declare const isDelegated: (client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: {
|
|
8
|
-
address: Address;
|
|
9
|
-
delegation: Address;
|
|
10
|
-
}) => Promise<boolean>;
|
|
11
|
-
export declare const createAuthorizationRequest: (client: SmartAccountClient<Transport, Chain, SmartContractAccount | undefined, Record<string, unknown>, WalletServerViemRpcSchema>, params: {
|
|
12
|
-
address: Address;
|
|
13
|
-
delegation: Address;
|
|
14
|
-
}) => Promise<PreparedCall_Authorization>;
|
|
15
|
-
export declare const DelegationAddressToAccountType: Record<Address, Supported7702AccountType>;
|
|
16
|
-
export declare const isSupportedDelegationAddress7702: (address: Address) => boolean;
|
|
17
|
-
export declare const getAccountTypeForDelegationAddress7702: (address: Address) => Supported7702AccountType | undefined;
|
|
18
|
-
export declare const parseDelegation: (eip7702AuthCapability: Eip7702AuthCapability) => "0x69007702764179f14F51cdce752f4f775d74E139";
|
|
19
|
-
export declare const assertValid7702AccountAddress: (fromAddress: Address, eip7702AuthCapability: Eip7702AuthCapability | undefined) => void;
|
|
20
|
-
//# sourceMappingURL=7702.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"7702.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/utils/7702.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,SAAS,EAGf,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC3B,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAI5E,2DAA2D;AAC3D,eAAO,MAAM,WAAW,GACtB,QAAQ,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B,EACD,QAAQ;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,KAChD,OAAO,CAAC,OAAO,CAIjB,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,QAAQ,kBAAkB,CACxB,SAAS,EACT,KAAK,EACL,oBAAoB,GAAG,SAAS,EAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,yBAAyB,CAC1B,EACD,QAAQ;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,KAChD,OAAO,CAAC,0BAA0B,CAsBpC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,MAAM,CACjD,OAAO,EACP,wBAAwB,CAMoB,CAAC;AAE/C,eAAO,MAAM,gCAAgC,GAAI,SAAS,OAAO,KAAG,OAEnE,CAAC;AAEF,eAAO,MAAM,sCAAsC,GACjD,SAAS,OAAO,KACf,wBAAwB,GAAG,SAE7B,CAAC;AAWF,eAAO,MAAM,eAAe,GAC1B,uBAAuB,qBAAqB,iDAS7C,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,aAAa,OAAO,EACpB,uBAAuB,qBAAqB,GAAG,SAAS,SAqBzD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAKtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAG/E,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,YAAY,CAAC,OAAO,sBAAsB,CAAC,CAAC;IACjE,WAAW,CAAC,EAAE,YAAY,CAAC,OAAO,qBAAqB,CAAC,CAAC;IACzD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,CAwG/B;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,IAAI,gBAAgB,CAE7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDummySigner.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/utils/createDummySigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAEL,KAAK,OAAO,EAIb,MAAM,MAAM,CAAC;AAEd,eAAO,MAAM,iBAAiB,GAAI,SAAS,OAAO,KAAG,kBAgBnD,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { StaticDecode } from "@sinclair/typebox";
|
|
2
|
-
import { TypeEcdsaSig, type TypeEcdsaSig as TypeEcdsaSigType } from "@alchemy/wallet-api-types";
|
|
3
|
-
export declare const decodeSignature: (signature: TypeEcdsaSigType["signature"]) => StaticDecode<typeof TypeEcdsaSig>["signature"];
|
|
4
|
-
//# sourceMappingURL=decodeSignature.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decodeSignature.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/utils/decodeSignature.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,YAAY,EACZ,KAAK,YAAY,IAAI,gBAAgB,EACtC,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,eAAe,GAC1B,WAAW,gBAAgB,CAAC,WAAW,CAAC,KACvC,YAAY,CAAC,OAAO,YAAY,CAAC,CAAC,WAAW,CAU/C,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { StaticDecode } from "@sinclair/typebox";
|
|
2
|
-
import type { Address } from "viem";
|
|
3
|
-
import { PermissionsCapability } from "@alchemy/wallet-api-types/capabilities";
|
|
4
|
-
import { TypeSerializedInitcode } from "@alchemy/wallet-api-types";
|
|
5
|
-
export declare function parsePermissionsContext(permissions?: StaticDecode<typeof PermissionsCapability>, parsedCi?: StaticDecode<typeof TypeSerializedInitcode> | undefined, delegation7702?: Address): ({
|
|
6
|
-
contextVersion: keyof typeof import("@alchemy/wallet-api-types/capabilities").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("@alchemy/wallet-api-types/capabilities").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;
|
|
22
|
-
//# sourceMappingURL=parsePermissionsContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsePermissionsContext.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/utils/parsePermissionsContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAEL,qBAAqB,EACtB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,wBAAgB,uBAAuB,CACrC,WAAW,CAAC,EAAE,YAAY,CAAC,OAAO,qBAAqB,CAAC,EACxD,QAAQ,CAAC,EAAE,YAAY,CAAC,OAAO,sBAAsB,CAAC,GAAG,SAAS,EAClE,cAAc,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;eAqCzB"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { StaticDecode } from "@sinclair/typebox";
|
|
2
|
-
import type { TypeSerializedInitcode } from "@alchemy/wallet-api-types";
|
|
3
|
-
export type Feature = "permissions";
|
|
4
|
-
export declare function supportsFeature(counterfactualInfo: StaticDecode<typeof TypeSerializedInitcode>, feature: Feature): boolean;
|
|
5
|
-
//# sourceMappingURL=supportsFeature.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"supportsFeature.d.ts","sourceRoot":"","sources":["../../../../src/isomorphic/utils/supportsFeature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAExE,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC;AAkBpC,wBAAgB,eAAe,CAC7B,kBAAkB,EAAE,YAAY,CAAC,OAAO,sBAAsB,CAAC,EAC/D,OAAO,EAAE,OAAO,GACf,OAAO,CAST"}
|
|
@@ -1,4 +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;
|
|
4
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/local/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAY1D,OAAO,KAAK,EACV,uBAAuB,EAEvB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAWrB,wBAAgB,iBAAiB,CAC/B,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,oBAAoB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
|
-
import type { CreateInnerClientParams, InnerWalletApiClient } from "../types.ts";
|
|
3
|
-
/**
|
|
4
|
-
* This is a low-level client just used to make RPC requests in remote mode
|
|
5
|
-
* This should be wrapped by a higher-level smart account client that provides actions
|
|
6
|
-
* that uses this client under the hood
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export declare function createRemoteClient<TAccount extends Address | undefined = Address | undefined>(params: CreateInnerClientParams<TAccount>): InnerWalletApiClient;
|
|
10
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/remote/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAK1D,OAAO,KAAK,EACV,uBAAuB,EAEvB,oBAAoB,EAErB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAC1D,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG,oBAAoB,CAAC"}
|
package/src/exports/internal.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// exports from this file are meant to be imported by our packages in the monorepo
|
|
2
|
-
// we will expose this in the package.json as a named export like `this-pkg/internal`
|
|
3
|
-
// TODO: name `this-pkg`
|
|
4
|
-
export type * from "../isomorphic/client.js";
|
|
5
|
-
export { createIsomorphicClient } from "../isomorphic/client.js";
|
|
6
|
-
export { createDummySigner } from "../isomorphic/utils/createDummySigner.js";
|
|
7
|
-
|
|
8
|
-
export type * from "../types.ts";
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createSmartAccountClient,
|
|
3
|
-
type SmartAccountClient,
|
|
4
|
-
type SmartContractAccount,
|
|
5
|
-
} from "@aa-sdk/core";
|
|
6
|
-
import {
|
|
7
|
-
deferralActions,
|
|
8
|
-
PermissionBuilder,
|
|
9
|
-
} from "@account-kit/smart-contracts/experimental";
|
|
10
|
-
import type { Static } from "@sinclair/typebox";
|
|
11
|
-
import { Value } from "@sinclair/typebox/value";
|
|
12
|
-
import {
|
|
13
|
-
ChainNotFoundError,
|
|
14
|
-
custom,
|
|
15
|
-
hashTypedData,
|
|
16
|
-
hexToNumber,
|
|
17
|
-
toHex,
|
|
18
|
-
type Chain,
|
|
19
|
-
type Hex,
|
|
20
|
-
type Transport,
|
|
21
|
-
} from "viem";
|
|
22
|
-
import { InvalidRequestError } from "ox/RpcResponse";
|
|
23
|
-
import {
|
|
24
|
-
TypePermission,
|
|
25
|
-
isGlobalValidation,
|
|
26
|
-
} from "@alchemy/wallet-api-types/capabilities";
|
|
27
|
-
import type {
|
|
28
|
-
wallet_createSession,
|
|
29
|
-
WalletServerViemRpcSchema,
|
|
30
|
-
} from "@alchemy/wallet-api-types/rpc";
|
|
31
|
-
import { createAccount, isModularAccountV2 } from "../utils/createAccount.js";
|
|
32
|
-
import { createDummySigner } from "../utils/createDummySigner.js";
|
|
33
|
-
import { supportsFeature } from "../utils/supportsFeature.js";
|
|
34
|
-
import { isDelegated } from "../utils/7702.js";
|
|
35
|
-
|
|
36
|
-
export type CreateSessionParams = Omit<
|
|
37
|
-
Static<
|
|
38
|
-
(typeof wallet_createSession)["properties"]["Request"]["properties"]["params"]
|
|
39
|
-
>[0],
|
|
40
|
-
"chainId"
|
|
41
|
-
> & {
|
|
42
|
-
entityId?: Hex;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type CreateSessionResult = Omit<
|
|
46
|
-
Static<(typeof wallet_createSession)["properties"]["ReturnType"]>,
|
|
47
|
-
"sessionId"
|
|
48
|
-
> & {
|
|
49
|
-
sessionId: Hex | null;
|
|
50
|
-
entityId: Hex;
|
|
51
|
-
fullPreSignatureDeferredActionDigest: Hex;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export async function createSession(
|
|
55
|
-
client: SmartAccountClient<
|
|
56
|
-
Transport,
|
|
57
|
-
Chain,
|
|
58
|
-
SmartContractAccount | undefined,
|
|
59
|
-
Record<string, unknown>,
|
|
60
|
-
WalletServerViemRpcSchema
|
|
61
|
-
>,
|
|
62
|
-
params: CreateSessionParams,
|
|
63
|
-
): Promise<CreateSessionResult> {
|
|
64
|
-
if (!client.chain) {
|
|
65
|
-
throw new ChainNotFoundError();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const { counterfactualInfo, delegation } = await client.request({
|
|
69
|
-
method: "wallet_requestAccount",
|
|
70
|
-
params: [
|
|
71
|
-
{
|
|
72
|
-
accountAddress: params.account,
|
|
73
|
-
includeCounterfactualInfo: true,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
delegation &&
|
|
80
|
-
!(await isDelegated(client, {
|
|
81
|
-
address: params.account,
|
|
82
|
-
delegation,
|
|
83
|
-
}))
|
|
84
|
-
) {
|
|
85
|
-
throw new InvalidRequestError({
|
|
86
|
-
message:
|
|
87
|
-
"7702 account must be delegated before calling `wallet_createSession`",
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (!delegation && !counterfactualInfo) {
|
|
92
|
-
throw new InvalidRequestError({
|
|
93
|
-
message: "No counterfactual info found.",
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
counterfactualInfo &&
|
|
99
|
-
!supportsFeature(counterfactualInfo, "permissions")
|
|
100
|
-
) {
|
|
101
|
-
throw new InvalidRequestError({
|
|
102
|
-
message: "Account type does not support createSession",
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// At this point we know the account supports the permission feature
|
|
107
|
-
const account = await createAccount({
|
|
108
|
-
chain: client.chain,
|
|
109
|
-
transport: custom(client.transport),
|
|
110
|
-
signer: createDummySigner(params.account),
|
|
111
|
-
accountAddress: params.account,
|
|
112
|
-
counterfactualInfo,
|
|
113
|
-
delegation,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
if (!isModularAccountV2(account)) {
|
|
117
|
-
throw new InvalidRequestError({
|
|
118
|
-
message: "Sessions are currently only supported by MAv2 accounts.",
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const _client = createSmartAccountClient({
|
|
123
|
-
chain: client.chain,
|
|
124
|
-
transport: custom(client.transport),
|
|
125
|
-
account,
|
|
126
|
-
}).extend(deferralActions);
|
|
127
|
-
|
|
128
|
-
const { entityId, nonce } = await _client.getEntityIdAndNonce({
|
|
129
|
-
entityId: params.entityId ? hexToNumber(params.entityId) : undefined,
|
|
130
|
-
isGlobalValidation: isGlobalValidation(params),
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const { typedData, fullPreSignatureDeferredActionDigest } =
|
|
134
|
-
await new PermissionBuilder({
|
|
135
|
-
client: _client,
|
|
136
|
-
key: {
|
|
137
|
-
...params.key,
|
|
138
|
-
// Alias 'ecdsa' to 'secp256k1'
|
|
139
|
-
type: params.key.type === "ecdsa" ? "secp256k1" : params.key.type,
|
|
140
|
-
},
|
|
141
|
-
entityId,
|
|
142
|
-
nonce,
|
|
143
|
-
deadline: params.expirySec,
|
|
144
|
-
})
|
|
145
|
-
.addPermissions({
|
|
146
|
-
permissions: params.permissions.map((permission) =>
|
|
147
|
-
Value.Encode(TypePermission, permission),
|
|
148
|
-
),
|
|
149
|
-
})
|
|
150
|
-
.compileDeferred();
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
sessionId: null, // In remote mode, the server will set this later.
|
|
154
|
-
chainId: toHex(client.chain.id),
|
|
155
|
-
entityId: toHex(entityId),
|
|
156
|
-
signatureRequest: {
|
|
157
|
-
type: "eth_signTypedData_v4" as const,
|
|
158
|
-
data: typedData,
|
|
159
|
-
rawPayload: hashTypedData(typedData),
|
|
160
|
-
},
|
|
161
|
-
fullPreSignatureDeferredActionDigest,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { Static } from "@sinclair/typebox";
|
|
2
|
-
import type { wallet_formatSign } from "@alchemy/wallet-api-types/rpc";
|
|
3
|
-
import type { SmartAccountClient, SmartContractAccount } from "@aa-sdk/core";
|
|
4
|
-
import {
|
|
5
|
-
ChainNotFoundError,
|
|
6
|
-
concat,
|
|
7
|
-
custom,
|
|
8
|
-
encodeAbiParameters,
|
|
9
|
-
parseAbiParameters,
|
|
10
|
-
type Chain,
|
|
11
|
-
type Transport,
|
|
12
|
-
} from "viem";
|
|
13
|
-
import type { WalletServerViemRpcSchema } from "@alchemy/wallet-api-types/rpc";
|
|
14
|
-
import { createAccount } from "../utils/createAccount.js";
|
|
15
|
-
import { createDummySigner } from "../utils/createDummySigner.js";
|
|
16
|
-
import { magicBytes } from "ox/erc6492/WrappedSignature";
|
|
17
|
-
|
|
18
|
-
export type FormatSignParams = Static<
|
|
19
|
-
(typeof wallet_formatSign)["properties"]["Request"]["properties"]["params"]
|
|
20
|
-
>[0];
|
|
21
|
-
|
|
22
|
-
export type FormatSignResult = Static<
|
|
23
|
-
(typeof wallet_formatSign)["properties"]["ReturnType"]
|
|
24
|
-
>;
|
|
25
|
-
|
|
26
|
-
export async function formatSign(
|
|
27
|
-
client: SmartAccountClient<
|
|
28
|
-
Transport,
|
|
29
|
-
Chain,
|
|
30
|
-
SmartContractAccount | undefined,
|
|
31
|
-
Record<string, unknown>,
|
|
32
|
-
WalletServerViemRpcSchema
|
|
33
|
-
>,
|
|
34
|
-
params: FormatSignParams,
|
|
35
|
-
): Promise<FormatSignResult> {
|
|
36
|
-
if (!client.chain) {
|
|
37
|
-
throw new ChainNotFoundError();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const { counterfactualInfo, delegation } = await client.request({
|
|
41
|
-
method: "wallet_requestAccount",
|
|
42
|
-
params: [
|
|
43
|
-
{
|
|
44
|
-
accountAddress: params.from,
|
|
45
|
-
includeCounterfactualInfo: true,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const account = await createAccount({
|
|
51
|
-
chain: client.chain,
|
|
52
|
-
transport: custom(client.transport),
|
|
53
|
-
signer: createDummySigner(params.from),
|
|
54
|
-
accountAddress: params.from,
|
|
55
|
-
counterfactualInfo,
|
|
56
|
-
permissions: params.capabilities?.permissions,
|
|
57
|
-
delegation,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
let formattedSignature = await account.formatSign(params.signature.data);
|
|
61
|
-
|
|
62
|
-
if (counterfactualInfo && !(await account.isAccountDeployed())) {
|
|
63
|
-
formattedSignature = concat([
|
|
64
|
-
encodeAbiParameters(parseAbiParameters("address, bytes, bytes"), [
|
|
65
|
-
counterfactualInfo.factoryAddress,
|
|
66
|
-
counterfactualInfo.factoryData,
|
|
67
|
-
formattedSignature,
|
|
68
|
-
]),
|
|
69
|
-
magicBytes,
|
|
70
|
-
]);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
signature: formattedSignature,
|
|
75
|
-
};
|
|
76
|
-
}
|