@account-kit/wallet-client 0.1.0-alpha.5 → 0.1.0-alpha.6
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/capabilities/eip7702Auth.js +3 -1
- package/dist/esm/capabilities/eip7702Auth.js.map +1 -1
- package/dist/esm/capabilities/overrides.js +8 -8
- package/dist/esm/capabilities/overrides.js.map +1 -1
- package/dist/esm/capabilities/permissions/index.d.ts +1 -1
- package/dist/esm/capabilities/permissions/index.js +6 -3
- package/dist/esm/capabilities/permissions/index.js.map +1 -1
- package/dist/esm/client/actions/grantPermissions.d.ts +5 -60
- package/dist/esm/client/actions/grantPermissions.js +5 -58
- package/dist/esm/client/actions/grantPermissions.js.map +1 -1
- package/dist/esm/client/actions/sendPreparedCalls.d.ts +6 -14
- package/dist/esm/client/actions/sendPreparedCalls.js +11 -12
- package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/client/actions/signPreparedCalls.d.ts +14 -0
- package/dist/esm/client/actions/signPreparedCalls.js +53 -0
- package/dist/esm/client/actions/signPreparedCalls.js.map +1 -0
- package/dist/esm/client/actions/signSignatureRequest.d.ts +8 -7
- package/dist/esm/client/actions/signSignatureRequest.js +69 -31
- package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
- package/dist/esm/client/client.e2e-test.js +28 -25
- package/dist/esm/client/client.e2e-test.js.map +1 -1
- package/dist/esm/client/decorator.d.ts +3 -1
- package/dist/esm/client/decorator.js +3 -1
- package/dist/esm/client/decorator.js.map +1 -1
- package/dist/esm/exports/index.d.ts +2 -1
- package/dist/esm/exports/index.js +2 -1
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/isomorphic/actions/createSession.js +18 -32
- package/dist/esm/isomorphic/actions/createSession.js.map +1 -1
- package/dist/esm/isomorphic/actions/prepareCalls.js +22 -16
- package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -1
- package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +3 -3
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js +76 -36
- package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -1
- package/dist/esm/isomorphic/client.d.ts +139 -13
- package/dist/esm/isomorphic/utils/7702.d.ts +4 -3
- package/dist/esm/isomorphic/utils/7702.js +14 -6
- package/dist/esm/isomorphic/utils/7702.js.map +1 -1
- package/dist/esm/isomorphic/utils/decodeSignature.d.ts +3 -0
- package/dist/esm/isomorphic/utils/decodeSignature.js +13 -0
- package/dist/esm/isomorphic/utils/decodeSignature.js.map +1 -0
- package/dist/esm/local/client.js +2 -3
- package/dist/esm/local/client.js.map +1 -1
- package/dist/esm/remote/client.js +3 -7
- package/dist/esm/remote/client.js.map +1 -1
- package/dist/esm/rpc/examples.d.ts +3 -3
- package/dist/esm/rpc/examples.js +3 -3
- package/dist/esm/rpc/examples.js.map +1 -1
- package/dist/esm/rpc/request.d.ts +357 -49
- package/dist/esm/rpc/request.js +26 -53
- package/dist/esm/rpc/request.js.map +1 -1
- package/dist/esm/rpc/schema.d.ts +323 -57
- package/dist/esm/rpc/schema.js.map +1 -1
- package/dist/esm/schemas.d.ts +451 -13
- package/dist/esm/schemas.js +165 -52
- package/dist/esm/schemas.js.map +1 -1
- package/dist/esm/types.d.ts +3 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/types/capabilities/eip7702Auth.d.ts.map +1 -1
- package/dist/types/capabilities/permissions/index.d.ts +1 -1
- package/dist/types/capabilities/permissions/index.d.ts.map +1 -1
- package/dist/types/client/actions/grantPermissions.d.ts +5 -60
- package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
- package/dist/types/client/actions/sendPreparedCalls.d.ts +6 -14
- package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/client/actions/signPreparedCalls.d.ts +15 -0
- package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -0
- package/dist/types/client/actions/signSignatureRequest.d.ts +8 -7
- package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
- package/dist/types/client/decorator.d.ts +3 -1
- package/dist/types/client/decorator.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +2 -1
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +3 -3
- package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -1
- package/dist/types/isomorphic/client.d.ts +139 -13
- package/dist/types/isomorphic/client.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/7702.d.ts +4 -3
- package/dist/types/isomorphic/utils/7702.d.ts.map +1 -1
- package/dist/types/isomorphic/utils/decodeSignature.d.ts +4 -0
- package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +1 -0
- package/dist/types/remote/client.d.ts.map +1 -1
- package/dist/types/rpc/examples.d.ts +3 -3
- package/dist/types/rpc/examples.d.ts.map +1 -1
- package/dist/types/rpc/request.d.ts +357 -49
- package/dist/types/rpc/request.d.ts.map +1 -1
- package/dist/types/rpc/schema.d.ts +323 -57
- package/dist/types/rpc/schema.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +451 -13
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/capabilities/eip7702Auth.ts +17 -10
- package/src/capabilities/overrides.ts +8 -8
- package/src/capabilities/permissions/index.ts +8 -3
- package/src/client/actions/grantPermissions.ts +5 -60
- package/src/client/actions/sendPreparedCalls.ts +17 -17
- package/src/client/actions/signPreparedCalls.ts +71 -0
- package/src/client/actions/signSignatureRequest.ts +50 -46
- package/src/client/client.e2e-test.ts +32 -35
- package/src/client/decorator.ts +14 -5
- package/src/exports/index.ts +2 -1
- package/src/isomorphic/actions/createSession.ts +20 -42
- package/src/isomorphic/actions/prepareCalls.ts +25 -17
- package/src/isomorphic/actions/sendPreparedCalls.ts +104 -54
- package/src/isomorphic/utils/7702.ts +18 -8
- package/src/isomorphic/utils/decodeSignature.ts +18 -0
- package/src/local/client.ts +2 -6
- package/src/remote/client.ts +3 -10
- package/src/rpc/examples.ts +3 -4
- package/src/rpc/request.ts +41 -63
- package/src/rpc/schema.ts +2 -2
- package/src/schemas.ts +227 -53
- package/src/types.ts +4 -0
package/src/rpc/schema.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type Static
|
|
1
|
+
import { type Static } from "@sinclair/typebox";
|
|
2
2
|
import { RpcSchema } from "ox";
|
|
3
3
|
import * as Requests from "./request.js";
|
|
4
4
|
|
|
5
5
|
export const WalletServerRpcSchema = RpcSchema.from<
|
|
6
6
|
| Static<typeof Requests.wallet_prepareCalls>
|
|
7
|
-
|
|
|
7
|
+
| Static<typeof Requests.wallet_sendPreparedCalls>
|
|
8
8
|
| Static<typeof Requests.wallet_createAccount>
|
|
9
9
|
| Static<typeof Requests.wallet_requestAccount>
|
|
10
10
|
| Static<typeof Requests.wallet_listAccounts>
|
package/src/schemas.ts
CHANGED
|
@@ -4,7 +4,18 @@ import {
|
|
|
4
4
|
type SchemaOptions,
|
|
5
5
|
type Static,
|
|
6
6
|
} from "@sinclair/typebox";
|
|
7
|
-
import {
|
|
7
|
+
import { yParityToV } from "ox/Signature";
|
|
8
|
+
import {
|
|
9
|
+
toHex,
|
|
10
|
+
slice,
|
|
11
|
+
pad,
|
|
12
|
+
concat,
|
|
13
|
+
hexToBigInt,
|
|
14
|
+
serializeSignature,
|
|
15
|
+
hexToNumber,
|
|
16
|
+
parseSignature,
|
|
17
|
+
numberToHex,
|
|
18
|
+
} from "viem";
|
|
8
19
|
|
|
9
20
|
const UUID_V4_REGEX =
|
|
10
21
|
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -42,10 +53,10 @@ export const TypeUserOperationRequest_v6 = Type.Object({
|
|
|
42
53
|
nonce: TypeHex(),
|
|
43
54
|
initCode: Type.Union([
|
|
44
55
|
TypeHex({
|
|
45
|
-
|
|
56
|
+
description: "Present",
|
|
46
57
|
}),
|
|
47
58
|
Type.Literal("0x", {
|
|
48
|
-
|
|
59
|
+
description: "Absent",
|
|
49
60
|
}),
|
|
50
61
|
]),
|
|
51
62
|
callData: TypeHex(),
|
|
@@ -56,10 +67,10 @@ export const TypeUserOperationRequest_v6 = Type.Object({
|
|
|
56
67
|
maxPriorityFeePerGas: TypeHex(),
|
|
57
68
|
paymasterAndData: Type.Union([
|
|
58
69
|
TypeHex({
|
|
59
|
-
|
|
70
|
+
description: "Present",
|
|
60
71
|
}),
|
|
61
72
|
Type.Literal("0x", {
|
|
62
|
-
|
|
73
|
+
description: "Absent",
|
|
63
74
|
}),
|
|
64
75
|
]),
|
|
65
76
|
signature: TypeHex(),
|
|
@@ -83,21 +94,21 @@ export const TypeUserOperationRequest_v7 = Type.Object({
|
|
|
83
94
|
signature: TypeHex(),
|
|
84
95
|
});
|
|
85
96
|
|
|
86
|
-
export const
|
|
87
|
-
chainId: Type.Integer(),
|
|
88
|
-
address: TypeAddress,
|
|
89
|
-
nonce: Type.Integer(),
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export const TypeEip7702AuthExtendedFields = Type.Object({
|
|
97
|
+
export const TypeEip7702UnsignedAuth = Type.Object({
|
|
93
98
|
chainId: TypeHex(),
|
|
94
|
-
nonce: TypeHex(),
|
|
95
99
|
address: TypeAddress,
|
|
96
|
-
|
|
97
|
-
s: TypeHex(),
|
|
98
|
-
yParity: TypeHex(),
|
|
100
|
+
nonce: TypeHex(),
|
|
99
101
|
});
|
|
100
102
|
|
|
103
|
+
export const TypeEip7702SignedAuth = Type.Intersect([
|
|
104
|
+
TypeEip7702UnsignedAuth,
|
|
105
|
+
Type.Object({
|
|
106
|
+
r: TypeHex(),
|
|
107
|
+
s: TypeHex(),
|
|
108
|
+
yParity: TypeHex(),
|
|
109
|
+
}),
|
|
110
|
+
]);
|
|
111
|
+
|
|
101
112
|
export const TypeWebAuthnPublicKey = Type.Object({
|
|
102
113
|
x: TypeU256,
|
|
103
114
|
y: TypeU256,
|
|
@@ -108,11 +119,13 @@ export const TypePersistedInitcode = Type.Object({
|
|
|
108
119
|
initcode: Type.Union([
|
|
109
120
|
Type.Object(
|
|
110
121
|
{
|
|
111
|
-
factoryType: Type.Literal("unknown", {
|
|
122
|
+
factoryType: Type.Literal("unknown", {
|
|
123
|
+
description: "Unknown factory type",
|
|
124
|
+
}),
|
|
112
125
|
factoryData: TypeHex({}),
|
|
113
126
|
},
|
|
114
127
|
{
|
|
115
|
-
|
|
128
|
+
description: "Unknown factory type",
|
|
116
129
|
},
|
|
117
130
|
),
|
|
118
131
|
Type.Object(
|
|
@@ -127,7 +140,7 @@ export const TypePersistedInitcode = Type.Object({
|
|
|
127
140
|
initialOwner: TypeAddress,
|
|
128
141
|
},
|
|
129
142
|
{
|
|
130
|
-
|
|
143
|
+
description: "Light Account",
|
|
131
144
|
},
|
|
132
145
|
),
|
|
133
146
|
Type.Object(
|
|
@@ -140,7 +153,7 @@ export const TypePersistedInitcode = Type.Object({
|
|
|
140
153
|
initialOwners: Type.Array(TypeAddress),
|
|
141
154
|
},
|
|
142
155
|
{
|
|
143
|
-
|
|
156
|
+
description: "Multi-Owner Modular Account",
|
|
144
157
|
},
|
|
145
158
|
),
|
|
146
159
|
Type.Object(
|
|
@@ -151,7 +164,7 @@ export const TypePersistedInitcode = Type.Object({
|
|
|
151
164
|
threshold: TypeU256,
|
|
152
165
|
},
|
|
153
166
|
{
|
|
154
|
-
|
|
167
|
+
description: "Multi-Sig Modular Account",
|
|
155
168
|
},
|
|
156
169
|
),
|
|
157
170
|
Type.Intersect([
|
|
@@ -167,7 +180,7 @@ export const TypePersistedInitcode = Type.Object({
|
|
|
167
180
|
entityId: TypeU32,
|
|
168
181
|
},
|
|
169
182
|
{
|
|
170
|
-
|
|
183
|
+
description: "Modular Account V2 SSV",
|
|
171
184
|
},
|
|
172
185
|
),
|
|
173
186
|
Type.Object(
|
|
@@ -176,7 +189,7 @@ export const TypePersistedInitcode = Type.Object({
|
|
|
176
189
|
initialOwner: TypeAddress,
|
|
177
190
|
},
|
|
178
191
|
{
|
|
179
|
-
|
|
192
|
+
description: "Modular Account V2 SMA-B",
|
|
180
193
|
},
|
|
181
194
|
),
|
|
182
195
|
Type.Object(
|
|
@@ -186,7 +199,7 @@ export const TypePersistedInitcode = Type.Object({
|
|
|
186
199
|
entityId: TypeU32,
|
|
187
200
|
},
|
|
188
201
|
{
|
|
189
|
-
|
|
202
|
+
description: "Modular Account V2 WebAuthn",
|
|
190
203
|
},
|
|
191
204
|
),
|
|
192
205
|
]),
|
|
@@ -196,29 +209,29 @@ export const TypePersistedInitcode = Type.Object({
|
|
|
196
209
|
|
|
197
210
|
export const TypeSerializedInitcode = Type.Object({
|
|
198
211
|
factoryType: Type.Union([
|
|
199
|
-
Type.Literal("LightAccountV1.0.1", {
|
|
200
|
-
Type.Literal("LightAccountV1.0.2", {
|
|
201
|
-
Type.Literal("LightAccountV1.1.0", {
|
|
202
|
-
Type.Literal("LightAccountV2.0.0", {
|
|
212
|
+
Type.Literal("LightAccountV1.0.1", { description: "Light Account v1.0.1" }),
|
|
213
|
+
Type.Literal("LightAccountV1.0.2", { description: "Light Account v1.0.2" }),
|
|
214
|
+
Type.Literal("LightAccountV1.1.0", { description: "Light Account v1.1.0" }),
|
|
215
|
+
Type.Literal("LightAccountV2.0.0", { description: "Light Account v2.0.0" }),
|
|
203
216
|
Type.Literal("LightAccountV2.0.0-MultiOwner", {
|
|
204
|
-
|
|
217
|
+
description: "Light Account v2.0.0 MultiOwner",
|
|
205
218
|
}),
|
|
206
219
|
Type.Literal("MAv1.0.0-MultiOwner", {
|
|
207
|
-
|
|
220
|
+
description: "Modular Account v1.0.0 MultiOwner",
|
|
208
221
|
}),
|
|
209
222
|
Type.Literal("MAv1.0.0-MultiSig", {
|
|
210
|
-
|
|
223
|
+
description: "Modular Account v1.0.0 MultiSig",
|
|
211
224
|
}),
|
|
212
225
|
Type.Literal("MAv2.0.0-sma-b", {
|
|
213
|
-
|
|
226
|
+
description: "Modular Account v2.0.0 SMA-B",
|
|
214
227
|
}),
|
|
215
228
|
Type.Literal("MAv2.0.0-ma-ssv", {
|
|
216
|
-
|
|
229
|
+
description: "Modular Account v2.0.0 SSV",
|
|
217
230
|
}),
|
|
218
231
|
Type.Literal("MAv2.0.0-ma-webauthn", {
|
|
219
|
-
|
|
232
|
+
description: "Modular Account v2.0.0 WebAuthn",
|
|
220
233
|
}),
|
|
221
|
-
Type.Literal("unknown", {
|
|
234
|
+
Type.Literal("unknown", { description: "Unknown factory type" }),
|
|
222
235
|
]),
|
|
223
236
|
factoryAddress: TypeAddress,
|
|
224
237
|
factoryData: TypeHex({}),
|
|
@@ -237,7 +250,7 @@ export const TypeCounterfactualInfo = Type.Intersect([
|
|
|
237
250
|
TypePersistedInitcode,
|
|
238
251
|
],
|
|
239
252
|
{
|
|
240
|
-
|
|
253
|
+
description: "Smart Contract Account",
|
|
241
254
|
},
|
|
242
255
|
),
|
|
243
256
|
Type.Object(
|
|
@@ -246,7 +259,7 @@ export const TypeCounterfactualInfo = Type.Intersect([
|
|
|
246
259
|
implementationAddress: TypeAddress,
|
|
247
260
|
},
|
|
248
261
|
{
|
|
249
|
-
|
|
262
|
+
description: "7702 Account",
|
|
250
263
|
},
|
|
251
264
|
),
|
|
252
265
|
]),
|
|
@@ -262,7 +275,7 @@ export const TypeCreationOptions = Type.Optional(
|
|
|
262
275
|
salt: Type.Optional(TypeHex()),
|
|
263
276
|
},
|
|
264
277
|
{
|
|
265
|
-
|
|
278
|
+
description: "SMA-B account type",
|
|
266
279
|
},
|
|
267
280
|
),
|
|
268
281
|
Type.Object(
|
|
@@ -275,7 +288,7 @@ export const TypeCreationOptions = Type.Optional(
|
|
|
275
288
|
// delegation: TypeAddress,
|
|
276
289
|
},
|
|
277
290
|
{
|
|
278
|
-
|
|
291
|
+
description: "7702 account type",
|
|
279
292
|
},
|
|
280
293
|
),
|
|
281
294
|
]),
|
|
@@ -288,9 +301,9 @@ export type TypeAccountType = Exclude<
|
|
|
288
301
|
>["accountType"];
|
|
289
302
|
|
|
290
303
|
export const TypeSignatureType = Type.Union([
|
|
291
|
-
Type.Literal("secp256k1", {
|
|
292
|
-
Type.Literal("ecdsa", {
|
|
293
|
-
Type.Literal("contract", {
|
|
304
|
+
Type.Literal("secp256k1", { description: "Secp256k1" }),
|
|
305
|
+
Type.Literal("ecdsa", { description: "ECDSA (alias for secp256k1)" }),
|
|
306
|
+
Type.Literal("contract", { description: "Contract" }),
|
|
294
307
|
]);
|
|
295
308
|
export type TypeSignatureType = Static<typeof TypeSignatureType>;
|
|
296
309
|
|
|
@@ -346,37 +359,40 @@ export const TTypedDataDefinition = Type.Transform(
|
|
|
346
359
|
};
|
|
347
360
|
});
|
|
348
361
|
|
|
349
|
-
const TypePersonalSignSignatureRequest = Type.Object(
|
|
362
|
+
export const TypePersonalSignSignatureRequest = Type.Object(
|
|
350
363
|
{
|
|
351
364
|
type: Type.Literal("personal_sign"),
|
|
352
365
|
data: Type.Union([
|
|
353
|
-
Type.String({ minLength: 1,
|
|
366
|
+
Type.String({ minLength: 1, description: "Message" }),
|
|
354
367
|
Type.Object(
|
|
355
368
|
{
|
|
356
369
|
raw: TypeHex(),
|
|
357
370
|
},
|
|
358
|
-
{
|
|
371
|
+
{ description: "Raw message" },
|
|
359
372
|
),
|
|
360
373
|
]),
|
|
361
374
|
},
|
|
362
|
-
{
|
|
375
|
+
{ description: "Personal sign" },
|
|
363
376
|
);
|
|
364
377
|
|
|
365
|
-
const TypeTypedDataSignatureRequest = Type.Object(
|
|
378
|
+
export const TypeTypedDataSignatureRequest = Type.Object(
|
|
366
379
|
{
|
|
367
380
|
type: Type.Literal("eth_signTypedData_v4"),
|
|
368
381
|
data: TTypedDataDefinition,
|
|
369
382
|
},
|
|
370
383
|
{
|
|
371
|
-
|
|
384
|
+
description: "Typed data",
|
|
372
385
|
},
|
|
373
386
|
);
|
|
374
387
|
|
|
375
|
-
export const
|
|
376
|
-
Type.
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
388
|
+
export const TypeAuthorizationSignatureRequest = Type.Object({
|
|
389
|
+
type: Type.Literal("eip7702Auth"),
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
export const TypeSignatureRequest = Type.Union([
|
|
393
|
+
TypePersonalSignSignatureRequest,
|
|
394
|
+
TypeTypedDataSignatureRequest,
|
|
395
|
+
TypeAuthorizationSignatureRequest,
|
|
380
396
|
]);
|
|
381
397
|
|
|
382
398
|
export const TypeCallId = Type.Transform(TypeHex())
|
|
@@ -390,3 +406,161 @@ export const TypeCallId = Type.Transform(TypeHex())
|
|
|
390
406
|
const chainIdPadded = pad(chainId, { size: 32 });
|
|
391
407
|
return concat([chainIdPadded, hash]);
|
|
392
408
|
});
|
|
409
|
+
|
|
410
|
+
export const PreparedCall_UserOpV060 = Type.Object(
|
|
411
|
+
{
|
|
412
|
+
type: Type.Literal("user-operation-v060", {
|
|
413
|
+
description: "User Operation (Entrypoint v0.6.0)",
|
|
414
|
+
}),
|
|
415
|
+
data: Type.Omit(TypeUserOperationRequest_v6, ["signature"], {
|
|
416
|
+
description: "Unsigned User Operation (Entrypoint v0.6.0)",
|
|
417
|
+
}),
|
|
418
|
+
chainId: TypeHex(),
|
|
419
|
+
signatureRequest: Type.Union([
|
|
420
|
+
TypePersonalSignSignatureRequest,
|
|
421
|
+
TypeTypedDataSignatureRequest,
|
|
422
|
+
]),
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
description: "Prepared User Operation (Entrypoint v0.6.0)",
|
|
426
|
+
},
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
export const PreparedCall_UserOpV070 = Type.Object(
|
|
430
|
+
{
|
|
431
|
+
type: Type.Literal("user-operation-v070", {
|
|
432
|
+
description: "User Operation (Entrypoint v0.7.0)",
|
|
433
|
+
}),
|
|
434
|
+
data: Type.Omit(TypeUserOperationRequest_v7, ["signature"], {
|
|
435
|
+
description: "Unsigned User Operation (Entrypoint v0.7.0)",
|
|
436
|
+
}),
|
|
437
|
+
chainId: TypeHex(),
|
|
438
|
+
signatureRequest: Type.Union([
|
|
439
|
+
TypePersonalSignSignatureRequest,
|
|
440
|
+
TypeTypedDataSignatureRequest,
|
|
441
|
+
]),
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
description: "Prepared User Operation (Entrypoint v0.7.0)",
|
|
445
|
+
},
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
export const PreparedCall_Authorization = Type.Object(
|
|
449
|
+
{
|
|
450
|
+
type: Type.Literal("authorization", {
|
|
451
|
+
description: "EIP-7702 Authorization Request",
|
|
452
|
+
}),
|
|
453
|
+
data: Type.Omit(TypeEip7702UnsignedAuth, ["chainId"]),
|
|
454
|
+
chainId: TypeHex(),
|
|
455
|
+
signatureRequest: TypeAuthorizationSignatureRequest,
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
description: "Prepared EIP-7702 Authorization",
|
|
459
|
+
},
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
export const TypeEdcsaSigData = Type.Union([
|
|
463
|
+
TypeHex({
|
|
464
|
+
description: "Hex-encoded signature",
|
|
465
|
+
}),
|
|
466
|
+
Type.Transform(
|
|
467
|
+
Type.Object(
|
|
468
|
+
{
|
|
469
|
+
r: TypeHex(),
|
|
470
|
+
s: TypeHex(),
|
|
471
|
+
yParity: TypeHex(),
|
|
472
|
+
},
|
|
473
|
+
{ description: "r, s, yParity" },
|
|
474
|
+
),
|
|
475
|
+
)
|
|
476
|
+
.Decode((sig) =>
|
|
477
|
+
serializeSignature({ ...sig, yParity: hexToNumber(sig.yParity) }),
|
|
478
|
+
)
|
|
479
|
+
.Encode((hex) => {
|
|
480
|
+
const parsed = parseSignature(hex);
|
|
481
|
+
return {
|
|
482
|
+
...parsed,
|
|
483
|
+
yParity: numberToHex(parsed.yParity),
|
|
484
|
+
};
|
|
485
|
+
}),
|
|
486
|
+
Type.Transform(
|
|
487
|
+
Type.Object(
|
|
488
|
+
{
|
|
489
|
+
r: TypeHex(),
|
|
490
|
+
s: TypeHex(),
|
|
491
|
+
v: TypeHex(),
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
description: "r, s, v",
|
|
495
|
+
},
|
|
496
|
+
),
|
|
497
|
+
)
|
|
498
|
+
.Decode((sig) => serializeSignature({ ...sig, v: hexToBigInt(sig.v) }))
|
|
499
|
+
.Encode((hex) => {
|
|
500
|
+
const parsed = parseSignature(hex);
|
|
501
|
+
return {
|
|
502
|
+
...parsed,
|
|
503
|
+
v: numberToHex(yParityToV(parsed.yParity)),
|
|
504
|
+
};
|
|
505
|
+
}),
|
|
506
|
+
]);
|
|
507
|
+
|
|
508
|
+
export const TypeEcdsaSig = Type.Object({
|
|
509
|
+
signature: Type.Union([
|
|
510
|
+
Type.Object(
|
|
511
|
+
{
|
|
512
|
+
type: Type.Literal("secp256k1"),
|
|
513
|
+
data: TypeEdcsaSigData,
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
description: "Secp256k1 signature",
|
|
517
|
+
},
|
|
518
|
+
),
|
|
519
|
+
Type.Object(
|
|
520
|
+
{
|
|
521
|
+
type: Type.Literal("ecdsa"),
|
|
522
|
+
data: TypeEdcsaSigData,
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
description: "ECDSA signature (alias for secp256k1)",
|
|
526
|
+
},
|
|
527
|
+
),
|
|
528
|
+
]),
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
export const TypePrepareCall_UserOpV060_Signed = Type.Intersect(
|
|
532
|
+
[Type.Omit(PreparedCall_UserOpV060, ["signatureRequest"]), TypeEcdsaSig],
|
|
533
|
+
{
|
|
534
|
+
description: "Prepared User Operation (Entrypoint v0.6.0) with signature",
|
|
535
|
+
},
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
export const TypePrepareCall_UserOpV070_Signed = Type.Intersect(
|
|
539
|
+
[Type.Omit(PreparedCall_UserOpV070, ["signatureRequest"]), TypeEcdsaSig],
|
|
540
|
+
{
|
|
541
|
+
description: "Prepared User Operation (Entrypoint v0.7.0) with signature",
|
|
542
|
+
},
|
|
543
|
+
);
|
|
544
|
+
|
|
545
|
+
export const TypePrepareCall_Authorization_Signed = Type.Intersect(
|
|
546
|
+
[Type.Omit(PreparedCall_Authorization, ["signatureRequest"]), TypeEcdsaSig],
|
|
547
|
+
{
|
|
548
|
+
description: "Prepared EIP-7702 Authorization with signature",
|
|
549
|
+
},
|
|
550
|
+
);
|
|
551
|
+
|
|
552
|
+
export const TypeCallArray = Type.Object(
|
|
553
|
+
{
|
|
554
|
+
type: Type.Literal("array"),
|
|
555
|
+
data: Type.Array(
|
|
556
|
+
Type.Union([
|
|
557
|
+
TypePrepareCall_UserOpV060_Signed,
|
|
558
|
+
TypePrepareCall_UserOpV070_Signed,
|
|
559
|
+
TypePrepareCall_Authorization_Signed,
|
|
560
|
+
]),
|
|
561
|
+
),
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
description: "Array of prepared calls with signatures",
|
|
565
|
+
},
|
|
566
|
+
);
|
package/src/types.ts
CHANGED