@gitmyabi/relayadapt7702 1.0.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/README.md +108 -0
- package/contracts/RelayAdapt7702_json.d.ts +1154 -0
- package/contracts/RelayAdapt7702_json.js +1207 -0
- package/contracts/RelayAdapt7702_json.ts +1504 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
|
@@ -0,0 +1,1504 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Transaction struct type
|
|
7
|
+
*/
|
|
8
|
+
export type Transaction = {
|
|
9
|
+
proof: SnarkProof;
|
|
10
|
+
merkleRoot: `0x${string}`;
|
|
11
|
+
nullifiers: `0x${string}`[];
|
|
12
|
+
commitments: `0x${string}`[];
|
|
13
|
+
boundParams: BoundParams;
|
|
14
|
+
unshieldPreimage: CommitmentPreimage;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* SnarkProof struct type
|
|
19
|
+
*/
|
|
20
|
+
export type SnarkProof = {
|
|
21
|
+
a: G1Point;
|
|
22
|
+
b: G2Point;
|
|
23
|
+
c: G1Point;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* G1Point struct type
|
|
28
|
+
*/
|
|
29
|
+
export type G1Point = {
|
|
30
|
+
x: bigint;
|
|
31
|
+
y: bigint;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* G2Point struct type
|
|
36
|
+
*/
|
|
37
|
+
export type G2Point = {
|
|
38
|
+
x: bigint[];
|
|
39
|
+
y: bigint[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* BoundParams struct type
|
|
44
|
+
*/
|
|
45
|
+
export type BoundParams = {
|
|
46
|
+
treeNumber: bigint;
|
|
47
|
+
minGasPrice: bigint;
|
|
48
|
+
unshield: bigint;
|
|
49
|
+
chainID: bigint;
|
|
50
|
+
adaptContract: `0x${string}`;
|
|
51
|
+
adaptParams: `0x${string}`;
|
|
52
|
+
commitmentCiphertext: CommitmentCiphertext[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* CommitmentCiphertext struct type
|
|
57
|
+
*/
|
|
58
|
+
export type CommitmentCiphertext = {
|
|
59
|
+
ciphertext: `0x${string}`[];
|
|
60
|
+
blindedSenderViewingKey: `0x${string}`;
|
|
61
|
+
blindedReceiverViewingKey: `0x${string}`;
|
|
62
|
+
annotationData: `0x${string}`;
|
|
63
|
+
memo: `0x${string}`;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* CommitmentPreimage struct type
|
|
68
|
+
*/
|
|
69
|
+
export type CommitmentPreimage = {
|
|
70
|
+
npk: `0x${string}`;
|
|
71
|
+
token: TokenData;
|
|
72
|
+
value: bigint;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* TokenData struct type
|
|
77
|
+
*/
|
|
78
|
+
export type TokenData = {
|
|
79
|
+
tokenType: bigint;
|
|
80
|
+
tokenAddress: `0x${string}`;
|
|
81
|
+
tokenSubID: bigint;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* RelayAdapt7702.ActionData struct type
|
|
86
|
+
*/
|
|
87
|
+
export type RelayAdapt7702_ActionData = {
|
|
88
|
+
requireSuccess: boolean;
|
|
89
|
+
minGasLimit: bigint;
|
|
90
|
+
calls: RelayAdapt7702_Call[];
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* RelayAdapt7702.Call struct type
|
|
95
|
+
*/
|
|
96
|
+
export type RelayAdapt7702_Call = {
|
|
97
|
+
to: `0x${string}`;
|
|
98
|
+
data: `0x${string}`;
|
|
99
|
+
value: bigint;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* ShieldRequest struct type
|
|
104
|
+
*/
|
|
105
|
+
export type ShieldRequest = {
|
|
106
|
+
preimage: CommitmentPreimage;
|
|
107
|
+
ciphertext: ShieldCiphertext;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* ShieldCiphertext struct type
|
|
112
|
+
*/
|
|
113
|
+
export type ShieldCiphertext = {
|
|
114
|
+
encryptedBundle: `0x${string}`[];
|
|
115
|
+
shieldKey: `0x${string}`;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* RelayAdapt7702.TokenTransfer struct type
|
|
120
|
+
*/
|
|
121
|
+
export type RelayAdapt7702_TokenTransfer = {
|
|
122
|
+
token: TokenData;
|
|
123
|
+
to: `0x${string}`;
|
|
124
|
+
value: bigint;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* RelayAdapt7702_json ABI
|
|
128
|
+
*
|
|
129
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
130
|
+
*/
|
|
131
|
+
export const RelayAdapt7702_jsonAbi = [
|
|
132
|
+
{
|
|
133
|
+
"inputs": [
|
|
134
|
+
{
|
|
135
|
+
"internalType": "address",
|
|
136
|
+
"name": "_railgun",
|
|
137
|
+
"type": "address"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"internalType": "address",
|
|
141
|
+
"name": "_wBase",
|
|
142
|
+
"type": "address"
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"stateMutability": "nonpayable",
|
|
146
|
+
"type": "constructor"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"inputs": [
|
|
150
|
+
{
|
|
151
|
+
"internalType": "uint256",
|
|
152
|
+
"name": "callIndex",
|
|
153
|
+
"type": "uint256"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"internalType": "bytes",
|
|
157
|
+
"name": "revertReason",
|
|
158
|
+
"type": "bytes"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"name": "CallFailed",
|
|
162
|
+
"type": "error"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"inputs": [],
|
|
166
|
+
"name": "ECDSAInvalidSignature",
|
|
167
|
+
"type": "error"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"inputs": [
|
|
171
|
+
{
|
|
172
|
+
"internalType": "uint256",
|
|
173
|
+
"name": "length",
|
|
174
|
+
"type": "uint256"
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"name": "ECDSAInvalidSignatureLength",
|
|
178
|
+
"type": "error"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"inputs": [
|
|
182
|
+
{
|
|
183
|
+
"internalType": "bytes32",
|
|
184
|
+
"name": "s",
|
|
185
|
+
"type": "bytes32"
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"name": "ECDSAInvalidSignatureS",
|
|
189
|
+
"type": "error"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"inputs": [
|
|
193
|
+
{
|
|
194
|
+
"internalType": "address",
|
|
195
|
+
"name": "token",
|
|
196
|
+
"type": "address"
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
"name": "SafeERC20FailedOperation",
|
|
200
|
+
"type": "error"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"anonymous": false,
|
|
204
|
+
"inputs": [
|
|
205
|
+
{
|
|
206
|
+
"indexed": false,
|
|
207
|
+
"internalType": "uint256",
|
|
208
|
+
"name": "callIndex",
|
|
209
|
+
"type": "uint256"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"indexed": false,
|
|
213
|
+
"internalType": "bytes",
|
|
214
|
+
"name": "revertReason",
|
|
215
|
+
"type": "bytes"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"name": "CallError",
|
|
219
|
+
"type": "event"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"inputs": [],
|
|
223
|
+
"name": "DOMAIN_SEPARATOR",
|
|
224
|
+
"outputs": [
|
|
225
|
+
{
|
|
226
|
+
"internalType": "bytes32",
|
|
227
|
+
"name": "",
|
|
228
|
+
"type": "bytes32"
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"stateMutability": "view",
|
|
232
|
+
"type": "function"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"inputs": [],
|
|
236
|
+
"name": "EXECUTE_TYPEHASH",
|
|
237
|
+
"outputs": [
|
|
238
|
+
{
|
|
239
|
+
"internalType": "bytes32",
|
|
240
|
+
"name": "",
|
|
241
|
+
"type": "bytes32"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"stateMutability": "view",
|
|
245
|
+
"type": "function"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"inputs": [],
|
|
249
|
+
"name": "MULTICALL_TYPEHASH",
|
|
250
|
+
"outputs": [
|
|
251
|
+
{
|
|
252
|
+
"internalType": "bytes32",
|
|
253
|
+
"name": "",
|
|
254
|
+
"type": "bytes32"
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"stateMutability": "view",
|
|
258
|
+
"type": "function"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"inputs": [],
|
|
262
|
+
"name": "adaptImplementation",
|
|
263
|
+
"outputs": [
|
|
264
|
+
{
|
|
265
|
+
"internalType": "address",
|
|
266
|
+
"name": "",
|
|
267
|
+
"type": "address"
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
"stateMutability": "view",
|
|
271
|
+
"type": "function"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"inputs": [
|
|
275
|
+
{
|
|
276
|
+
"components": [
|
|
277
|
+
{
|
|
278
|
+
"components": [
|
|
279
|
+
{
|
|
280
|
+
"components": [
|
|
281
|
+
{
|
|
282
|
+
"internalType": "uint256",
|
|
283
|
+
"name": "x",
|
|
284
|
+
"type": "uint256"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"internalType": "uint256",
|
|
288
|
+
"name": "y",
|
|
289
|
+
"type": "uint256"
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"internalType": "struct G1Point",
|
|
293
|
+
"name": "a",
|
|
294
|
+
"type": "tuple"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"components": [
|
|
298
|
+
{
|
|
299
|
+
"internalType": "uint256[2]",
|
|
300
|
+
"name": "x",
|
|
301
|
+
"type": "uint256[2]"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"internalType": "uint256[2]",
|
|
305
|
+
"name": "y",
|
|
306
|
+
"type": "uint256[2]"
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"internalType": "struct G2Point",
|
|
310
|
+
"name": "b",
|
|
311
|
+
"type": "tuple"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"components": [
|
|
315
|
+
{
|
|
316
|
+
"internalType": "uint256",
|
|
317
|
+
"name": "x",
|
|
318
|
+
"type": "uint256"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"internalType": "uint256",
|
|
322
|
+
"name": "y",
|
|
323
|
+
"type": "uint256"
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
"internalType": "struct G1Point",
|
|
327
|
+
"name": "c",
|
|
328
|
+
"type": "tuple"
|
|
329
|
+
}
|
|
330
|
+
],
|
|
331
|
+
"internalType": "struct SnarkProof",
|
|
332
|
+
"name": "proof",
|
|
333
|
+
"type": "tuple"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"internalType": "bytes32",
|
|
337
|
+
"name": "merkleRoot",
|
|
338
|
+
"type": "bytes32"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"internalType": "bytes32[]",
|
|
342
|
+
"name": "nullifiers",
|
|
343
|
+
"type": "bytes32[]"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"internalType": "bytes32[]",
|
|
347
|
+
"name": "commitments",
|
|
348
|
+
"type": "bytes32[]"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"components": [
|
|
352
|
+
{
|
|
353
|
+
"internalType": "uint16",
|
|
354
|
+
"name": "treeNumber",
|
|
355
|
+
"type": "uint16"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"internalType": "uint72",
|
|
359
|
+
"name": "minGasPrice",
|
|
360
|
+
"type": "uint72"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"internalType": "enum UnshieldType",
|
|
364
|
+
"name": "unshield",
|
|
365
|
+
"type": "uint8"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"internalType": "uint64",
|
|
369
|
+
"name": "chainID",
|
|
370
|
+
"type": "uint64"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"internalType": "address",
|
|
374
|
+
"name": "adaptContract",
|
|
375
|
+
"type": "address"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"internalType": "bytes32",
|
|
379
|
+
"name": "adaptParams",
|
|
380
|
+
"type": "bytes32"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"components": [
|
|
384
|
+
{
|
|
385
|
+
"internalType": "bytes32[4]",
|
|
386
|
+
"name": "ciphertext",
|
|
387
|
+
"type": "bytes32[4]"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"internalType": "bytes32",
|
|
391
|
+
"name": "blindedSenderViewingKey",
|
|
392
|
+
"type": "bytes32"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"internalType": "bytes32",
|
|
396
|
+
"name": "blindedReceiverViewingKey",
|
|
397
|
+
"type": "bytes32"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"internalType": "bytes",
|
|
401
|
+
"name": "annotationData",
|
|
402
|
+
"type": "bytes"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"internalType": "bytes",
|
|
406
|
+
"name": "memo",
|
|
407
|
+
"type": "bytes"
|
|
408
|
+
}
|
|
409
|
+
],
|
|
410
|
+
"internalType": "struct CommitmentCiphertext[]",
|
|
411
|
+
"name": "commitmentCiphertext",
|
|
412
|
+
"type": "tuple[]"
|
|
413
|
+
}
|
|
414
|
+
],
|
|
415
|
+
"internalType": "struct BoundParams",
|
|
416
|
+
"name": "boundParams",
|
|
417
|
+
"type": "tuple"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"components": [
|
|
421
|
+
{
|
|
422
|
+
"internalType": "bytes32",
|
|
423
|
+
"name": "npk",
|
|
424
|
+
"type": "bytes32"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"components": [
|
|
428
|
+
{
|
|
429
|
+
"internalType": "enum TokenType",
|
|
430
|
+
"name": "tokenType",
|
|
431
|
+
"type": "uint8"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"internalType": "address",
|
|
435
|
+
"name": "tokenAddress",
|
|
436
|
+
"type": "address"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"internalType": "uint256",
|
|
440
|
+
"name": "tokenSubID",
|
|
441
|
+
"type": "uint256"
|
|
442
|
+
}
|
|
443
|
+
],
|
|
444
|
+
"internalType": "struct TokenData",
|
|
445
|
+
"name": "token",
|
|
446
|
+
"type": "tuple"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"internalType": "uint120",
|
|
450
|
+
"name": "value",
|
|
451
|
+
"type": "uint120"
|
|
452
|
+
}
|
|
453
|
+
],
|
|
454
|
+
"internalType": "struct CommitmentPreimage",
|
|
455
|
+
"name": "unshieldPreimage",
|
|
456
|
+
"type": "tuple"
|
|
457
|
+
}
|
|
458
|
+
],
|
|
459
|
+
"internalType": "struct Transaction[]",
|
|
460
|
+
"name": "_transactions",
|
|
461
|
+
"type": "tuple[]"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"components": [
|
|
465
|
+
{
|
|
466
|
+
"internalType": "bool",
|
|
467
|
+
"name": "requireSuccess",
|
|
468
|
+
"type": "bool"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"internalType": "uint256",
|
|
472
|
+
"name": "minGasLimit",
|
|
473
|
+
"type": "uint256"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"components": [
|
|
477
|
+
{
|
|
478
|
+
"internalType": "address",
|
|
479
|
+
"name": "to",
|
|
480
|
+
"type": "address"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"internalType": "bytes",
|
|
484
|
+
"name": "data",
|
|
485
|
+
"type": "bytes"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"internalType": "uint256",
|
|
489
|
+
"name": "value",
|
|
490
|
+
"type": "uint256"
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
"internalType": "struct RelayAdapt7702.Call[]",
|
|
494
|
+
"name": "calls",
|
|
495
|
+
"type": "tuple[]"
|
|
496
|
+
}
|
|
497
|
+
],
|
|
498
|
+
"internalType": "struct RelayAdapt7702.ActionData",
|
|
499
|
+
"name": "_actionData",
|
|
500
|
+
"type": "tuple"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"internalType": "uint256",
|
|
504
|
+
"name": "_nonce",
|
|
505
|
+
"type": "uint256"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"internalType": "bytes",
|
|
509
|
+
"name": "_signature",
|
|
510
|
+
"type": "bytes"
|
|
511
|
+
}
|
|
512
|
+
],
|
|
513
|
+
"name": "execute",
|
|
514
|
+
"outputs": [],
|
|
515
|
+
"stateMutability": "payable",
|
|
516
|
+
"type": "function"
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"inputs": [
|
|
520
|
+
{
|
|
521
|
+
"components": [
|
|
522
|
+
{
|
|
523
|
+
"components": [
|
|
524
|
+
{
|
|
525
|
+
"components": [
|
|
526
|
+
{
|
|
527
|
+
"internalType": "uint256",
|
|
528
|
+
"name": "x",
|
|
529
|
+
"type": "uint256"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"internalType": "uint256",
|
|
533
|
+
"name": "y",
|
|
534
|
+
"type": "uint256"
|
|
535
|
+
}
|
|
536
|
+
],
|
|
537
|
+
"internalType": "struct G1Point",
|
|
538
|
+
"name": "a",
|
|
539
|
+
"type": "tuple"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"components": [
|
|
543
|
+
{
|
|
544
|
+
"internalType": "uint256[2]",
|
|
545
|
+
"name": "x",
|
|
546
|
+
"type": "uint256[2]"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"internalType": "uint256[2]",
|
|
550
|
+
"name": "y",
|
|
551
|
+
"type": "uint256[2]"
|
|
552
|
+
}
|
|
553
|
+
],
|
|
554
|
+
"internalType": "struct G2Point",
|
|
555
|
+
"name": "b",
|
|
556
|
+
"type": "tuple"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"components": [
|
|
560
|
+
{
|
|
561
|
+
"internalType": "uint256",
|
|
562
|
+
"name": "x",
|
|
563
|
+
"type": "uint256"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"internalType": "uint256",
|
|
567
|
+
"name": "y",
|
|
568
|
+
"type": "uint256"
|
|
569
|
+
}
|
|
570
|
+
],
|
|
571
|
+
"internalType": "struct G1Point",
|
|
572
|
+
"name": "c",
|
|
573
|
+
"type": "tuple"
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
"internalType": "struct SnarkProof",
|
|
577
|
+
"name": "proof",
|
|
578
|
+
"type": "tuple"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"internalType": "bytes32",
|
|
582
|
+
"name": "merkleRoot",
|
|
583
|
+
"type": "bytes32"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"internalType": "bytes32[]",
|
|
587
|
+
"name": "nullifiers",
|
|
588
|
+
"type": "bytes32[]"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"internalType": "bytes32[]",
|
|
592
|
+
"name": "commitments",
|
|
593
|
+
"type": "bytes32[]"
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
"components": [
|
|
597
|
+
{
|
|
598
|
+
"internalType": "uint16",
|
|
599
|
+
"name": "treeNumber",
|
|
600
|
+
"type": "uint16"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
"internalType": "uint72",
|
|
604
|
+
"name": "minGasPrice",
|
|
605
|
+
"type": "uint72"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"internalType": "enum UnshieldType",
|
|
609
|
+
"name": "unshield",
|
|
610
|
+
"type": "uint8"
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"internalType": "uint64",
|
|
614
|
+
"name": "chainID",
|
|
615
|
+
"type": "uint64"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"internalType": "address",
|
|
619
|
+
"name": "adaptContract",
|
|
620
|
+
"type": "address"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
"internalType": "bytes32",
|
|
624
|
+
"name": "adaptParams",
|
|
625
|
+
"type": "bytes32"
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"components": [
|
|
629
|
+
{
|
|
630
|
+
"internalType": "bytes32[4]",
|
|
631
|
+
"name": "ciphertext",
|
|
632
|
+
"type": "bytes32[4]"
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
"internalType": "bytes32",
|
|
636
|
+
"name": "blindedSenderViewingKey",
|
|
637
|
+
"type": "bytes32"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"internalType": "bytes32",
|
|
641
|
+
"name": "blindedReceiverViewingKey",
|
|
642
|
+
"type": "bytes32"
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
"internalType": "bytes",
|
|
646
|
+
"name": "annotationData",
|
|
647
|
+
"type": "bytes"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
"internalType": "bytes",
|
|
651
|
+
"name": "memo",
|
|
652
|
+
"type": "bytes"
|
|
653
|
+
}
|
|
654
|
+
],
|
|
655
|
+
"internalType": "struct CommitmentCiphertext[]",
|
|
656
|
+
"name": "commitmentCiphertext",
|
|
657
|
+
"type": "tuple[]"
|
|
658
|
+
}
|
|
659
|
+
],
|
|
660
|
+
"internalType": "struct BoundParams",
|
|
661
|
+
"name": "boundParams",
|
|
662
|
+
"type": "tuple"
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
"components": [
|
|
666
|
+
{
|
|
667
|
+
"internalType": "bytes32",
|
|
668
|
+
"name": "npk",
|
|
669
|
+
"type": "bytes32"
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
"components": [
|
|
673
|
+
{
|
|
674
|
+
"internalType": "enum TokenType",
|
|
675
|
+
"name": "tokenType",
|
|
676
|
+
"type": "uint8"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"internalType": "address",
|
|
680
|
+
"name": "tokenAddress",
|
|
681
|
+
"type": "address"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"internalType": "uint256",
|
|
685
|
+
"name": "tokenSubID",
|
|
686
|
+
"type": "uint256"
|
|
687
|
+
}
|
|
688
|
+
],
|
|
689
|
+
"internalType": "struct TokenData",
|
|
690
|
+
"name": "token",
|
|
691
|
+
"type": "tuple"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"internalType": "uint120",
|
|
695
|
+
"name": "value",
|
|
696
|
+
"type": "uint120"
|
|
697
|
+
}
|
|
698
|
+
],
|
|
699
|
+
"internalType": "struct CommitmentPreimage",
|
|
700
|
+
"name": "unshieldPreimage",
|
|
701
|
+
"type": "tuple"
|
|
702
|
+
}
|
|
703
|
+
],
|
|
704
|
+
"internalType": "struct Transaction[]",
|
|
705
|
+
"name": "_transactions",
|
|
706
|
+
"type": "tuple[]"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"components": [
|
|
710
|
+
{
|
|
711
|
+
"internalType": "bool",
|
|
712
|
+
"name": "requireSuccess",
|
|
713
|
+
"type": "bool"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
"internalType": "uint256",
|
|
717
|
+
"name": "minGasLimit",
|
|
718
|
+
"type": "uint256"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"components": [
|
|
722
|
+
{
|
|
723
|
+
"internalType": "address",
|
|
724
|
+
"name": "to",
|
|
725
|
+
"type": "address"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"internalType": "bytes",
|
|
729
|
+
"name": "data",
|
|
730
|
+
"type": "bytes"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"internalType": "uint256",
|
|
734
|
+
"name": "value",
|
|
735
|
+
"type": "uint256"
|
|
736
|
+
}
|
|
737
|
+
],
|
|
738
|
+
"internalType": "struct RelayAdapt7702.Call[]",
|
|
739
|
+
"name": "calls",
|
|
740
|
+
"type": "tuple[]"
|
|
741
|
+
}
|
|
742
|
+
],
|
|
743
|
+
"internalType": "struct RelayAdapt7702.ActionData",
|
|
744
|
+
"name": "_actionData",
|
|
745
|
+
"type": "tuple"
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
"internalType": "uint256",
|
|
749
|
+
"name": "_nonce",
|
|
750
|
+
"type": "uint256"
|
|
751
|
+
}
|
|
752
|
+
],
|
|
753
|
+
"name": "getExecutePayloadHash",
|
|
754
|
+
"outputs": [
|
|
755
|
+
{
|
|
756
|
+
"internalType": "bytes32",
|
|
757
|
+
"name": "",
|
|
758
|
+
"type": "bytes32"
|
|
759
|
+
}
|
|
760
|
+
],
|
|
761
|
+
"stateMutability": "pure",
|
|
762
|
+
"type": "function"
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
"inputs": [
|
|
766
|
+
{
|
|
767
|
+
"internalType": "bool",
|
|
768
|
+
"name": "_requireSuccess",
|
|
769
|
+
"type": "bool"
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
"components": [
|
|
773
|
+
{
|
|
774
|
+
"internalType": "address",
|
|
775
|
+
"name": "to",
|
|
776
|
+
"type": "address"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"internalType": "bytes",
|
|
780
|
+
"name": "data",
|
|
781
|
+
"type": "bytes"
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"internalType": "uint256",
|
|
785
|
+
"name": "value",
|
|
786
|
+
"type": "uint256"
|
|
787
|
+
}
|
|
788
|
+
],
|
|
789
|
+
"internalType": "struct RelayAdapt7702.Call[]",
|
|
790
|
+
"name": "_calls",
|
|
791
|
+
"type": "tuple[]"
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
"internalType": "uint256",
|
|
795
|
+
"name": "_nonce",
|
|
796
|
+
"type": "uint256"
|
|
797
|
+
}
|
|
798
|
+
],
|
|
799
|
+
"name": "getMulticallPayloadHash",
|
|
800
|
+
"outputs": [
|
|
801
|
+
{
|
|
802
|
+
"internalType": "bytes32",
|
|
803
|
+
"name": "",
|
|
804
|
+
"type": "bytes32"
|
|
805
|
+
}
|
|
806
|
+
],
|
|
807
|
+
"stateMutability": "pure",
|
|
808
|
+
"type": "function"
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
"inputs": [
|
|
812
|
+
{
|
|
813
|
+
"internalType": "bool",
|
|
814
|
+
"name": "_requireSuccess",
|
|
815
|
+
"type": "bool"
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"components": [
|
|
819
|
+
{
|
|
820
|
+
"internalType": "address",
|
|
821
|
+
"name": "to",
|
|
822
|
+
"type": "address"
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
"internalType": "bytes",
|
|
826
|
+
"name": "data",
|
|
827
|
+
"type": "bytes"
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
"internalType": "uint256",
|
|
831
|
+
"name": "value",
|
|
832
|
+
"type": "uint256"
|
|
833
|
+
}
|
|
834
|
+
],
|
|
835
|
+
"internalType": "struct RelayAdapt7702.Call[]",
|
|
836
|
+
"name": "_calls",
|
|
837
|
+
"type": "tuple[]"
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
"internalType": "uint256",
|
|
841
|
+
"name": "_nonce",
|
|
842
|
+
"type": "uint256"
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
"internalType": "bytes",
|
|
846
|
+
"name": "_signature",
|
|
847
|
+
"type": "bytes"
|
|
848
|
+
}
|
|
849
|
+
],
|
|
850
|
+
"name": "multicall",
|
|
851
|
+
"outputs": [],
|
|
852
|
+
"stateMutability": "payable",
|
|
853
|
+
"type": "function"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"inputs": [],
|
|
857
|
+
"name": "nonce",
|
|
858
|
+
"outputs": [
|
|
859
|
+
{
|
|
860
|
+
"internalType": "uint256",
|
|
861
|
+
"name": "",
|
|
862
|
+
"type": "uint256"
|
|
863
|
+
}
|
|
864
|
+
],
|
|
865
|
+
"stateMutability": "view",
|
|
866
|
+
"type": "function"
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"inputs": [],
|
|
870
|
+
"name": "railgun",
|
|
871
|
+
"outputs": [
|
|
872
|
+
{
|
|
873
|
+
"internalType": "contract RailgunSmartWallet",
|
|
874
|
+
"name": "",
|
|
875
|
+
"type": "address"
|
|
876
|
+
}
|
|
877
|
+
],
|
|
878
|
+
"stateMutability": "view",
|
|
879
|
+
"type": "function"
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"inputs": [
|
|
883
|
+
{
|
|
884
|
+
"components": [
|
|
885
|
+
{
|
|
886
|
+
"components": [
|
|
887
|
+
{
|
|
888
|
+
"internalType": "bytes32",
|
|
889
|
+
"name": "npk",
|
|
890
|
+
"type": "bytes32"
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
"components": [
|
|
894
|
+
{
|
|
895
|
+
"internalType": "enum TokenType",
|
|
896
|
+
"name": "tokenType",
|
|
897
|
+
"type": "uint8"
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
"internalType": "address",
|
|
901
|
+
"name": "tokenAddress",
|
|
902
|
+
"type": "address"
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
"internalType": "uint256",
|
|
906
|
+
"name": "tokenSubID",
|
|
907
|
+
"type": "uint256"
|
|
908
|
+
}
|
|
909
|
+
],
|
|
910
|
+
"internalType": "struct TokenData",
|
|
911
|
+
"name": "token",
|
|
912
|
+
"type": "tuple"
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"internalType": "uint120",
|
|
916
|
+
"name": "value",
|
|
917
|
+
"type": "uint120"
|
|
918
|
+
}
|
|
919
|
+
],
|
|
920
|
+
"internalType": "struct CommitmentPreimage",
|
|
921
|
+
"name": "preimage",
|
|
922
|
+
"type": "tuple"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"components": [
|
|
926
|
+
{
|
|
927
|
+
"internalType": "bytes32[3]",
|
|
928
|
+
"name": "encryptedBundle",
|
|
929
|
+
"type": "bytes32[3]"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
"internalType": "bytes32",
|
|
933
|
+
"name": "shieldKey",
|
|
934
|
+
"type": "bytes32"
|
|
935
|
+
}
|
|
936
|
+
],
|
|
937
|
+
"internalType": "struct ShieldCiphertext",
|
|
938
|
+
"name": "ciphertext",
|
|
939
|
+
"type": "tuple"
|
|
940
|
+
}
|
|
941
|
+
],
|
|
942
|
+
"internalType": "struct ShieldRequest[]",
|
|
943
|
+
"name": "_shieldRequests",
|
|
944
|
+
"type": "tuple[]"
|
|
945
|
+
}
|
|
946
|
+
],
|
|
947
|
+
"name": "shield",
|
|
948
|
+
"outputs": [],
|
|
949
|
+
"stateMutability": "nonpayable",
|
|
950
|
+
"type": "function"
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
"inputs": [
|
|
954
|
+
{
|
|
955
|
+
"components": [
|
|
956
|
+
{
|
|
957
|
+
"components": [
|
|
958
|
+
{
|
|
959
|
+
"internalType": "enum TokenType",
|
|
960
|
+
"name": "tokenType",
|
|
961
|
+
"type": "uint8"
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
"internalType": "address",
|
|
965
|
+
"name": "tokenAddress",
|
|
966
|
+
"type": "address"
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
"internalType": "uint256",
|
|
970
|
+
"name": "tokenSubID",
|
|
971
|
+
"type": "uint256"
|
|
972
|
+
}
|
|
973
|
+
],
|
|
974
|
+
"internalType": "struct TokenData",
|
|
975
|
+
"name": "token",
|
|
976
|
+
"type": "tuple"
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
"internalType": "address",
|
|
980
|
+
"name": "to",
|
|
981
|
+
"type": "address"
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
"internalType": "uint256",
|
|
985
|
+
"name": "value",
|
|
986
|
+
"type": "uint256"
|
|
987
|
+
}
|
|
988
|
+
],
|
|
989
|
+
"internalType": "struct RelayAdapt7702.TokenTransfer[]",
|
|
990
|
+
"name": "_transfers",
|
|
991
|
+
"type": "tuple[]"
|
|
992
|
+
}
|
|
993
|
+
],
|
|
994
|
+
"name": "transfer",
|
|
995
|
+
"outputs": [],
|
|
996
|
+
"stateMutability": "nonpayable",
|
|
997
|
+
"type": "function"
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
"inputs": [
|
|
1001
|
+
{
|
|
1002
|
+
"internalType": "uint256",
|
|
1003
|
+
"name": "_amount",
|
|
1004
|
+
"type": "uint256"
|
|
1005
|
+
}
|
|
1006
|
+
],
|
|
1007
|
+
"name": "unwrapBase",
|
|
1008
|
+
"outputs": [],
|
|
1009
|
+
"stateMutability": "nonpayable",
|
|
1010
|
+
"type": "function"
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
"inputs": [],
|
|
1014
|
+
"name": "wBase",
|
|
1015
|
+
"outputs": [
|
|
1016
|
+
{
|
|
1017
|
+
"internalType": "contract IWBase",
|
|
1018
|
+
"name": "",
|
|
1019
|
+
"type": "address"
|
|
1020
|
+
}
|
|
1021
|
+
],
|
|
1022
|
+
"stateMutability": "view",
|
|
1023
|
+
"type": "function"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
"inputs": [
|
|
1027
|
+
{
|
|
1028
|
+
"internalType": "uint256",
|
|
1029
|
+
"name": "_amount",
|
|
1030
|
+
"type": "uint256"
|
|
1031
|
+
}
|
|
1032
|
+
],
|
|
1033
|
+
"name": "wrapBase",
|
|
1034
|
+
"outputs": [],
|
|
1035
|
+
"stateMutability": "nonpayable",
|
|
1036
|
+
"type": "function"
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
"stateMutability": "payable",
|
|
1040
|
+
"type": "receive"
|
|
1041
|
+
}
|
|
1042
|
+
] as const satisfies Abi;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Type-safe ABI for RelayAdapt7702_json
|
|
1046
|
+
*/
|
|
1047
|
+
export type RelayAdapt7702_jsonAbi = typeof RelayAdapt7702_jsonAbi;
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Contract instance type for RelayAdapt7702_json
|
|
1051
|
+
*/
|
|
1052
|
+
// Use any for contract type to avoid complex viem type issues
|
|
1053
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
1054
|
+
export type RelayAdapt7702_jsonContract = any;
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* RelayAdapt7702_json Contract Class
|
|
1058
|
+
*
|
|
1059
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```typescript
|
|
1063
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
1064
|
+
* import { mainnet } from 'viem/chains';
|
|
1065
|
+
* import { RelayAdapt7702_json } from 'RelayAdapt7702_json';
|
|
1066
|
+
*
|
|
1067
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
1068
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
1069
|
+
*
|
|
1070
|
+
* const contract = new RelayAdapt7702_json('0x...', { publicClient, walletClient });
|
|
1071
|
+
*
|
|
1072
|
+
* // Read functions
|
|
1073
|
+
* const result = await contract.balanceOf('0x...');
|
|
1074
|
+
*
|
|
1075
|
+
* // Write functions
|
|
1076
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
1077
|
+
*
|
|
1078
|
+
* // Simulate transactions (dry-run)
|
|
1079
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
1080
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
1081
|
+
*
|
|
1082
|
+
* // Watch events
|
|
1083
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1084
|
+
* console.log('Transfer event:', event);
|
|
1085
|
+
* });
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
export class RelayAdapt7702_json {
|
|
1089
|
+
private contract: RelayAdapt7702_jsonContract;
|
|
1090
|
+
private contractAddress: Address;
|
|
1091
|
+
private publicClient: PublicClient;
|
|
1092
|
+
|
|
1093
|
+
constructor(
|
|
1094
|
+
address: Address,
|
|
1095
|
+
clients: {
|
|
1096
|
+
publicClient: PublicClient;
|
|
1097
|
+
walletClient?: WalletClient;
|
|
1098
|
+
}
|
|
1099
|
+
) {
|
|
1100
|
+
this.contractAddress = address;
|
|
1101
|
+
this.publicClient = clients.publicClient;
|
|
1102
|
+
this.contract = getContract({
|
|
1103
|
+
address,
|
|
1104
|
+
abi: RelayAdapt7702_jsonAbi,
|
|
1105
|
+
client: {
|
|
1106
|
+
public: clients.publicClient,
|
|
1107
|
+
wallet: clients.walletClient,
|
|
1108
|
+
},
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Get the contract address
|
|
1114
|
+
*/
|
|
1115
|
+
get address(): Address {
|
|
1116
|
+
return this.contractAddress;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Get the underlying viem contract instance
|
|
1121
|
+
*/
|
|
1122
|
+
getContract(): RelayAdapt7702_jsonContract {
|
|
1123
|
+
return this.contract;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* DOMAIN_SEPARATOR
|
|
1128
|
+
* view
|
|
1129
|
+
*/
|
|
1130
|
+
async DOMAIN_SEPARATOR(): Promise<`0x${string}`> {
|
|
1131
|
+
return this.contract.read.DOMAIN_SEPARATOR() as Promise<`0x${string}`>;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* EXECUTE_TYPEHASH
|
|
1136
|
+
* view
|
|
1137
|
+
*/
|
|
1138
|
+
async EXECUTE_TYPEHASH(): Promise<`0x${string}`> {
|
|
1139
|
+
return this.contract.read.EXECUTE_TYPEHASH() as Promise<`0x${string}`>;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* MULTICALL_TYPEHASH
|
|
1144
|
+
* view
|
|
1145
|
+
*/
|
|
1146
|
+
async MULTICALL_TYPEHASH(): Promise<`0x${string}`> {
|
|
1147
|
+
return this.contract.read.MULTICALL_TYPEHASH() as Promise<`0x${string}`>;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* adaptImplementation
|
|
1152
|
+
* view
|
|
1153
|
+
*/
|
|
1154
|
+
async adaptImplementation(): Promise<`0x${string}`> {
|
|
1155
|
+
return this.contract.read.adaptImplementation() as Promise<`0x${string}`>;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* getExecutePayloadHash
|
|
1160
|
+
* pure
|
|
1161
|
+
*/
|
|
1162
|
+
async getExecutePayloadHash(_transactions: Transaction[], _actionData: RelayAdapt7702_ActionData, _nonce: bigint): Promise<`0x${string}`> {
|
|
1163
|
+
return this.contract.read.getExecutePayloadHash([_transactions, _actionData, _nonce] as const) as Promise<`0x${string}`>;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* getMulticallPayloadHash
|
|
1168
|
+
* pure
|
|
1169
|
+
*/
|
|
1170
|
+
async getMulticallPayloadHash(_requireSuccess: boolean, _calls: RelayAdapt7702_Call[], _nonce: bigint): Promise<`0x${string}`> {
|
|
1171
|
+
return this.contract.read.getMulticallPayloadHash([_requireSuccess, _calls, _nonce] as const) as Promise<`0x${string}`>;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* nonce
|
|
1176
|
+
* view
|
|
1177
|
+
*/
|
|
1178
|
+
async nonce(): Promise<bigint> {
|
|
1179
|
+
return this.contract.read.nonce() as Promise<bigint>;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* railgun
|
|
1184
|
+
* view
|
|
1185
|
+
*/
|
|
1186
|
+
async railgun(): Promise<`0x${string}`> {
|
|
1187
|
+
return this.contract.read.railgun() as Promise<`0x${string}`>;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* wBase
|
|
1192
|
+
* view
|
|
1193
|
+
*/
|
|
1194
|
+
async wBase(): Promise<`0x${string}`> {
|
|
1195
|
+
return this.contract.read.wBase() as Promise<`0x${string}`>;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* execute
|
|
1200
|
+
* payable
|
|
1201
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1202
|
+
*/
|
|
1203
|
+
async execute(_transactions: Transaction[], _actionData: RelayAdapt7702_ActionData, _nonce: bigint, _signature: `0x${string}`, options?: {
|
|
1204
|
+
accessList?: import('viem').AccessList;
|
|
1205
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1206
|
+
chain?: import('viem').Chain | null;
|
|
1207
|
+
dataSuffix?: `0x${string}`;
|
|
1208
|
+
gas?: bigint;
|
|
1209
|
+
gasPrice?: bigint;
|
|
1210
|
+
maxFeePerGas?: bigint;
|
|
1211
|
+
maxPriorityFeePerGas?: bigint;
|
|
1212
|
+
nonce?: number;
|
|
1213
|
+
value?: bigint;
|
|
1214
|
+
}): Promise<`0x${string}`> {
|
|
1215
|
+
if (!this.contract.write) {
|
|
1216
|
+
throw new Error('Wallet client is required for write operations');
|
|
1217
|
+
}
|
|
1218
|
+
return this.contract.write.execute([_transactions, _actionData, _nonce, _signature] as const, options) as Promise<`0x${string}`>;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* multicall
|
|
1223
|
+
* payable
|
|
1224
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1225
|
+
*/
|
|
1226
|
+
async multicall(_requireSuccess: boolean, _calls: RelayAdapt7702_Call[], _nonce: bigint, _signature: `0x${string}`, options?: {
|
|
1227
|
+
accessList?: import('viem').AccessList;
|
|
1228
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1229
|
+
chain?: import('viem').Chain | null;
|
|
1230
|
+
dataSuffix?: `0x${string}`;
|
|
1231
|
+
gas?: bigint;
|
|
1232
|
+
gasPrice?: bigint;
|
|
1233
|
+
maxFeePerGas?: bigint;
|
|
1234
|
+
maxPriorityFeePerGas?: bigint;
|
|
1235
|
+
nonce?: number;
|
|
1236
|
+
value?: bigint;
|
|
1237
|
+
}): Promise<`0x${string}`> {
|
|
1238
|
+
if (!this.contract.write) {
|
|
1239
|
+
throw new Error('Wallet client is required for write operations');
|
|
1240
|
+
}
|
|
1241
|
+
return this.contract.write.multicall([_requireSuccess, _calls, _nonce, _signature] as const, options) as Promise<`0x${string}`>;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* shield
|
|
1246
|
+
* nonpayable
|
|
1247
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1248
|
+
*/
|
|
1249
|
+
async shield(_shieldRequests: ShieldRequest[], options?: {
|
|
1250
|
+
accessList?: import('viem').AccessList;
|
|
1251
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1252
|
+
chain?: import('viem').Chain | null;
|
|
1253
|
+
dataSuffix?: `0x${string}`;
|
|
1254
|
+
gas?: bigint;
|
|
1255
|
+
gasPrice?: bigint;
|
|
1256
|
+
maxFeePerGas?: bigint;
|
|
1257
|
+
maxPriorityFeePerGas?: bigint;
|
|
1258
|
+
nonce?: number;
|
|
1259
|
+
value?: bigint;
|
|
1260
|
+
}): Promise<`0x${string}`> {
|
|
1261
|
+
if (!this.contract.write) {
|
|
1262
|
+
throw new Error('Wallet client is required for write operations');
|
|
1263
|
+
}
|
|
1264
|
+
return this.contract.write.shield([_shieldRequests] as const, options) as Promise<`0x${string}`>;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* transfer
|
|
1269
|
+
* nonpayable
|
|
1270
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1271
|
+
*/
|
|
1272
|
+
async transfer(_transfers: RelayAdapt7702_TokenTransfer[], options?: {
|
|
1273
|
+
accessList?: import('viem').AccessList;
|
|
1274
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1275
|
+
chain?: import('viem').Chain | null;
|
|
1276
|
+
dataSuffix?: `0x${string}`;
|
|
1277
|
+
gas?: bigint;
|
|
1278
|
+
gasPrice?: bigint;
|
|
1279
|
+
maxFeePerGas?: bigint;
|
|
1280
|
+
maxPriorityFeePerGas?: bigint;
|
|
1281
|
+
nonce?: number;
|
|
1282
|
+
value?: bigint;
|
|
1283
|
+
}): Promise<`0x${string}`> {
|
|
1284
|
+
if (!this.contract.write) {
|
|
1285
|
+
throw new Error('Wallet client is required for write operations');
|
|
1286
|
+
}
|
|
1287
|
+
return this.contract.write.transfer([_transfers] as const, options) as Promise<`0x${string}`>;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* unwrapBase
|
|
1292
|
+
* nonpayable
|
|
1293
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1294
|
+
*/
|
|
1295
|
+
async unwrapBase(_amount: bigint, options?: {
|
|
1296
|
+
accessList?: import('viem').AccessList;
|
|
1297
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1298
|
+
chain?: import('viem').Chain | null;
|
|
1299
|
+
dataSuffix?: `0x${string}`;
|
|
1300
|
+
gas?: bigint;
|
|
1301
|
+
gasPrice?: bigint;
|
|
1302
|
+
maxFeePerGas?: bigint;
|
|
1303
|
+
maxPriorityFeePerGas?: bigint;
|
|
1304
|
+
nonce?: number;
|
|
1305
|
+
value?: bigint;
|
|
1306
|
+
}): Promise<`0x${string}`> {
|
|
1307
|
+
if (!this.contract.write) {
|
|
1308
|
+
throw new Error('Wallet client is required for write operations');
|
|
1309
|
+
}
|
|
1310
|
+
return this.contract.write.unwrapBase([_amount] as const, options) as Promise<`0x${string}`>;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* wrapBase
|
|
1315
|
+
* nonpayable
|
|
1316
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1317
|
+
*/
|
|
1318
|
+
async wrapBase(_amount: bigint, options?: {
|
|
1319
|
+
accessList?: import('viem').AccessList;
|
|
1320
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1321
|
+
chain?: import('viem').Chain | null;
|
|
1322
|
+
dataSuffix?: `0x${string}`;
|
|
1323
|
+
gas?: bigint;
|
|
1324
|
+
gasPrice?: bigint;
|
|
1325
|
+
maxFeePerGas?: bigint;
|
|
1326
|
+
maxPriorityFeePerGas?: bigint;
|
|
1327
|
+
nonce?: number;
|
|
1328
|
+
value?: bigint;
|
|
1329
|
+
}): Promise<`0x${string}`> {
|
|
1330
|
+
if (!this.contract.write) {
|
|
1331
|
+
throw new Error('Wallet client is required for write operations');
|
|
1332
|
+
}
|
|
1333
|
+
return this.contract.write.wrapBase([_amount] as const, options) as Promise<`0x${string}`>;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1340
|
+
*
|
|
1341
|
+
* @example
|
|
1342
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1343
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1344
|
+
* console.log('Would succeed:', result.result);
|
|
1345
|
+
*/
|
|
1346
|
+
get simulate() {
|
|
1347
|
+
const contract = this.contract;
|
|
1348
|
+
if (!contract.simulate) {
|
|
1349
|
+
throw new Error('Public client is required for simulation');
|
|
1350
|
+
}
|
|
1351
|
+
return {
|
|
1352
|
+
/**
|
|
1353
|
+
* Simulate execute
|
|
1354
|
+
* Returns gas estimate and result without sending transaction
|
|
1355
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1356
|
+
*/
|
|
1357
|
+
async execute(_transactions: Transaction[], _actionData: RelayAdapt7702_ActionData, _nonce: bigint, _signature: `0x${string}`, options?: {
|
|
1358
|
+
accessList?: import('viem').AccessList;
|
|
1359
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1360
|
+
chain?: import('viem').Chain | null;
|
|
1361
|
+
dataSuffix?: `0x${string}`;
|
|
1362
|
+
gas?: bigint;
|
|
1363
|
+
gasPrice?: bigint;
|
|
1364
|
+
maxFeePerGas?: bigint;
|
|
1365
|
+
maxPriorityFeePerGas?: bigint;
|
|
1366
|
+
nonce?: number;
|
|
1367
|
+
value?: bigint;
|
|
1368
|
+
}): Promise<void> {
|
|
1369
|
+
return contract.simulate.execute([_transactions, _actionData, _nonce, _signature] as const, options) as Promise<void>;
|
|
1370
|
+
},
|
|
1371
|
+
/**
|
|
1372
|
+
* Simulate multicall
|
|
1373
|
+
* Returns gas estimate and result without sending transaction
|
|
1374
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1375
|
+
*/
|
|
1376
|
+
async multicall(_requireSuccess: boolean, _calls: RelayAdapt7702_Call[], _nonce: bigint, _signature: `0x${string}`, options?: {
|
|
1377
|
+
accessList?: import('viem').AccessList;
|
|
1378
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1379
|
+
chain?: import('viem').Chain | null;
|
|
1380
|
+
dataSuffix?: `0x${string}`;
|
|
1381
|
+
gas?: bigint;
|
|
1382
|
+
gasPrice?: bigint;
|
|
1383
|
+
maxFeePerGas?: bigint;
|
|
1384
|
+
maxPriorityFeePerGas?: bigint;
|
|
1385
|
+
nonce?: number;
|
|
1386
|
+
value?: bigint;
|
|
1387
|
+
}): Promise<void> {
|
|
1388
|
+
return contract.simulate.multicall([_requireSuccess, _calls, _nonce, _signature] as const, options) as Promise<void>;
|
|
1389
|
+
},
|
|
1390
|
+
/**
|
|
1391
|
+
* Simulate shield
|
|
1392
|
+
* Returns gas estimate and result without sending transaction
|
|
1393
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1394
|
+
*/
|
|
1395
|
+
async shield(_shieldRequests: ShieldRequest[], options?: {
|
|
1396
|
+
accessList?: import('viem').AccessList;
|
|
1397
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1398
|
+
chain?: import('viem').Chain | null;
|
|
1399
|
+
dataSuffix?: `0x${string}`;
|
|
1400
|
+
gas?: bigint;
|
|
1401
|
+
gasPrice?: bigint;
|
|
1402
|
+
maxFeePerGas?: bigint;
|
|
1403
|
+
maxPriorityFeePerGas?: bigint;
|
|
1404
|
+
nonce?: number;
|
|
1405
|
+
value?: bigint;
|
|
1406
|
+
}): Promise<void> {
|
|
1407
|
+
return contract.simulate.shield([_shieldRequests] as const, options) as Promise<void>;
|
|
1408
|
+
},
|
|
1409
|
+
/**
|
|
1410
|
+
* Simulate transfer
|
|
1411
|
+
* Returns gas estimate and result without sending transaction
|
|
1412
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1413
|
+
*/
|
|
1414
|
+
async transfer(_transfers: RelayAdapt7702_TokenTransfer[], options?: {
|
|
1415
|
+
accessList?: import('viem').AccessList;
|
|
1416
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1417
|
+
chain?: import('viem').Chain | null;
|
|
1418
|
+
dataSuffix?: `0x${string}`;
|
|
1419
|
+
gas?: bigint;
|
|
1420
|
+
gasPrice?: bigint;
|
|
1421
|
+
maxFeePerGas?: bigint;
|
|
1422
|
+
maxPriorityFeePerGas?: bigint;
|
|
1423
|
+
nonce?: number;
|
|
1424
|
+
value?: bigint;
|
|
1425
|
+
}): Promise<void> {
|
|
1426
|
+
return contract.simulate.transfer([_transfers] as const, options) as Promise<void>;
|
|
1427
|
+
},
|
|
1428
|
+
/**
|
|
1429
|
+
* Simulate unwrapBase
|
|
1430
|
+
* Returns gas estimate and result without sending transaction
|
|
1431
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1432
|
+
*/
|
|
1433
|
+
async unwrapBase(_amount: bigint, options?: {
|
|
1434
|
+
accessList?: import('viem').AccessList;
|
|
1435
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1436
|
+
chain?: import('viem').Chain | null;
|
|
1437
|
+
dataSuffix?: `0x${string}`;
|
|
1438
|
+
gas?: bigint;
|
|
1439
|
+
gasPrice?: bigint;
|
|
1440
|
+
maxFeePerGas?: bigint;
|
|
1441
|
+
maxPriorityFeePerGas?: bigint;
|
|
1442
|
+
nonce?: number;
|
|
1443
|
+
value?: bigint;
|
|
1444
|
+
}): Promise<void> {
|
|
1445
|
+
return contract.simulate.unwrapBase([_amount] as const, options) as Promise<void>;
|
|
1446
|
+
},
|
|
1447
|
+
/**
|
|
1448
|
+
* Simulate wrapBase
|
|
1449
|
+
* Returns gas estimate and result without sending transaction
|
|
1450
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1451
|
+
*/
|
|
1452
|
+
async wrapBase(_amount: bigint, options?: {
|
|
1453
|
+
accessList?: import('viem').AccessList;
|
|
1454
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1455
|
+
chain?: import('viem').Chain | null;
|
|
1456
|
+
dataSuffix?: `0x${string}`;
|
|
1457
|
+
gas?: bigint;
|
|
1458
|
+
gasPrice?: bigint;
|
|
1459
|
+
maxFeePerGas?: bigint;
|
|
1460
|
+
maxPriorityFeePerGas?: bigint;
|
|
1461
|
+
nonce?: number;
|
|
1462
|
+
value?: bigint;
|
|
1463
|
+
}): Promise<void> {
|
|
1464
|
+
return contract.simulate.wrapBase([_amount] as const, options) as Promise<void>;
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Watch contract events
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* // Watch all Transfer events
|
|
1474
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1475
|
+
* console.log('Transfer:', event);
|
|
1476
|
+
* });
|
|
1477
|
+
*
|
|
1478
|
+
* // Stop watching
|
|
1479
|
+
* unwatch();
|
|
1480
|
+
*/
|
|
1481
|
+
get watch() {
|
|
1482
|
+
return {
|
|
1483
|
+
/**
|
|
1484
|
+
* Watch CallError events
|
|
1485
|
+
* @param callback Function to call when event is emitted
|
|
1486
|
+
* @param filter Optional filter for indexed parameters
|
|
1487
|
+
* @returns Unwatch function to stop listening
|
|
1488
|
+
*/
|
|
1489
|
+
CallError: (callback: (event: { callIndex: bigint; revertReason: `0x${string}` }) => void) => {
|
|
1490
|
+
return this.publicClient.watchContractEvent({
|
|
1491
|
+
address: this.contractAddress,
|
|
1492
|
+
abi: RelayAdapt7702_jsonAbi,
|
|
1493
|
+
eventName: 'CallError',
|
|
1494
|
+
|
|
1495
|
+
onLogs: (logs: any[]) => {
|
|
1496
|
+
logs.forEach((log: any) => {
|
|
1497
|
+
callback(log.args as any);
|
|
1498
|
+
});
|
|
1499
|
+
},
|
|
1500
|
+
}) as () => void;
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
}
|
|
1504
|
+
}
|