@safe-global/safe-modules-deployments 1.1.0 → 2.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.
@@ -0,0 +1,595 @@
1
+ {
2
+ "released": true,
3
+ "contractName": "Safe4337Module",
4
+ "version": "0.2.0",
5
+ "networkAddresses": {
6
+ "5": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
7
+ "10": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
8
+ "100": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
9
+ "137": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
10
+ "42161": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
11
+ "42220": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
12
+ "80001": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
13
+ "84532": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
14
+ "421614": "0xa581c4A4DB7175302464fF3C06380BC3270b4037",
15
+ "11155111": "0xa581c4A4DB7175302464fF3C06380BC3270b4037"
16
+ },
17
+ "abi": [
18
+ {
19
+ "inputs": [
20
+ {
21
+ "internalType": "address",
22
+ "name": "entryPoint",
23
+ "type": "address"
24
+ }
25
+ ],
26
+ "stateMutability": "nonpayable",
27
+ "type": "constructor"
28
+ },
29
+ {
30
+ "inputs": [],
31
+ "name": "SUPPORTED_ENTRYPOINT",
32
+ "outputs": [
33
+ {
34
+ "internalType": "address",
35
+ "name": "",
36
+ "type": "address"
37
+ }
38
+ ],
39
+ "stateMutability": "view",
40
+ "type": "function"
41
+ },
42
+ {
43
+ "inputs": [],
44
+ "name": "domainSeparator",
45
+ "outputs": [
46
+ {
47
+ "internalType": "bytes32",
48
+ "name": "",
49
+ "type": "bytes32"
50
+ }
51
+ ],
52
+ "stateMutability": "view",
53
+ "type": "function"
54
+ },
55
+ {
56
+ "inputs": [
57
+ {
58
+ "internalType": "contract Safe",
59
+ "name": "safe",
60
+ "type": "address"
61
+ },
62
+ {
63
+ "internalType": "bytes",
64
+ "name": "message",
65
+ "type": "bytes"
66
+ }
67
+ ],
68
+ "name": "encodeMessageDataForSafe",
69
+ "outputs": [
70
+ {
71
+ "internalType": "bytes",
72
+ "name": "",
73
+ "type": "bytes"
74
+ }
75
+ ],
76
+ "stateMutability": "view",
77
+ "type": "function"
78
+ },
79
+ {
80
+ "inputs": [
81
+ {
82
+ "internalType": "address",
83
+ "name": "to",
84
+ "type": "address"
85
+ },
86
+ {
87
+ "internalType": "uint256",
88
+ "name": "value",
89
+ "type": "uint256"
90
+ },
91
+ {
92
+ "internalType": "bytes",
93
+ "name": "data",
94
+ "type": "bytes"
95
+ },
96
+ {
97
+ "internalType": "uint8",
98
+ "name": "operation",
99
+ "type": "uint8"
100
+ }
101
+ ],
102
+ "name": "executeUserOp",
103
+ "outputs": [],
104
+ "stateMutability": "nonpayable",
105
+ "type": "function"
106
+ },
107
+ {
108
+ "inputs": [
109
+ {
110
+ "internalType": "address",
111
+ "name": "to",
112
+ "type": "address"
113
+ },
114
+ {
115
+ "internalType": "uint256",
116
+ "name": "value",
117
+ "type": "uint256"
118
+ },
119
+ {
120
+ "internalType": "bytes",
121
+ "name": "data",
122
+ "type": "bytes"
123
+ },
124
+ {
125
+ "internalType": "uint8",
126
+ "name": "operation",
127
+ "type": "uint8"
128
+ }
129
+ ],
130
+ "name": "executeUserOpWithErrorString",
131
+ "outputs": [],
132
+ "stateMutability": "nonpayable",
133
+ "type": "function"
134
+ },
135
+ {
136
+ "inputs": [
137
+ {
138
+ "internalType": "bytes",
139
+ "name": "message",
140
+ "type": "bytes"
141
+ }
142
+ ],
143
+ "name": "getMessageHash",
144
+ "outputs": [
145
+ {
146
+ "internalType": "bytes32",
147
+ "name": "",
148
+ "type": "bytes32"
149
+ }
150
+ ],
151
+ "stateMutability": "view",
152
+ "type": "function"
153
+ },
154
+ {
155
+ "inputs": [
156
+ {
157
+ "internalType": "contract Safe",
158
+ "name": "safe",
159
+ "type": "address"
160
+ },
161
+ {
162
+ "internalType": "bytes",
163
+ "name": "message",
164
+ "type": "bytes"
165
+ }
166
+ ],
167
+ "name": "getMessageHashForSafe",
168
+ "outputs": [
169
+ {
170
+ "internalType": "bytes32",
171
+ "name": "",
172
+ "type": "bytes32"
173
+ }
174
+ ],
175
+ "stateMutability": "view",
176
+ "type": "function"
177
+ },
178
+ {
179
+ "inputs": [],
180
+ "name": "getModules",
181
+ "outputs": [
182
+ {
183
+ "internalType": "address[]",
184
+ "name": "",
185
+ "type": "address[]"
186
+ }
187
+ ],
188
+ "stateMutability": "view",
189
+ "type": "function"
190
+ },
191
+ {
192
+ "inputs": [
193
+ {
194
+ "components": [
195
+ {
196
+ "internalType": "address",
197
+ "name": "sender",
198
+ "type": "address"
199
+ },
200
+ {
201
+ "internalType": "uint256",
202
+ "name": "nonce",
203
+ "type": "uint256"
204
+ },
205
+ {
206
+ "internalType": "bytes",
207
+ "name": "initCode",
208
+ "type": "bytes"
209
+ },
210
+ {
211
+ "internalType": "bytes",
212
+ "name": "callData",
213
+ "type": "bytes"
214
+ },
215
+ {
216
+ "internalType": "uint256",
217
+ "name": "callGasLimit",
218
+ "type": "uint256"
219
+ },
220
+ {
221
+ "internalType": "uint256",
222
+ "name": "verificationGasLimit",
223
+ "type": "uint256"
224
+ },
225
+ {
226
+ "internalType": "uint256",
227
+ "name": "preVerificationGas",
228
+ "type": "uint256"
229
+ },
230
+ {
231
+ "internalType": "uint256",
232
+ "name": "maxFeePerGas",
233
+ "type": "uint256"
234
+ },
235
+ {
236
+ "internalType": "uint256",
237
+ "name": "maxPriorityFeePerGas",
238
+ "type": "uint256"
239
+ },
240
+ {
241
+ "internalType": "bytes",
242
+ "name": "paymasterAndData",
243
+ "type": "bytes"
244
+ },
245
+ {
246
+ "internalType": "bytes",
247
+ "name": "signature",
248
+ "type": "bytes"
249
+ }
250
+ ],
251
+ "internalType": "struct UserOperation",
252
+ "name": "userOp",
253
+ "type": "tuple"
254
+ }
255
+ ],
256
+ "name": "getOperationHash",
257
+ "outputs": [
258
+ {
259
+ "internalType": "bytes32",
260
+ "name": "operationHash",
261
+ "type": "bytes32"
262
+ }
263
+ ],
264
+ "stateMutability": "view",
265
+ "type": "function"
266
+ },
267
+ {
268
+ "inputs": [
269
+ {
270
+ "internalType": "bytes32",
271
+ "name": "_dataHash",
272
+ "type": "bytes32"
273
+ },
274
+ {
275
+ "internalType": "bytes",
276
+ "name": "_signature",
277
+ "type": "bytes"
278
+ }
279
+ ],
280
+ "name": "isValidSignature",
281
+ "outputs": [
282
+ {
283
+ "internalType": "bytes4",
284
+ "name": "",
285
+ "type": "bytes4"
286
+ }
287
+ ],
288
+ "stateMutability": "view",
289
+ "type": "function"
290
+ },
291
+ {
292
+ "inputs": [
293
+ {
294
+ "internalType": "bytes",
295
+ "name": "_data",
296
+ "type": "bytes"
297
+ },
298
+ {
299
+ "internalType": "bytes",
300
+ "name": "_signature",
301
+ "type": "bytes"
302
+ }
303
+ ],
304
+ "name": "isValidSignature",
305
+ "outputs": [
306
+ {
307
+ "internalType": "bytes4",
308
+ "name": "",
309
+ "type": "bytes4"
310
+ }
311
+ ],
312
+ "stateMutability": "view",
313
+ "type": "function"
314
+ },
315
+ {
316
+ "inputs": [
317
+ {
318
+ "internalType": "address",
319
+ "name": "",
320
+ "type": "address"
321
+ },
322
+ {
323
+ "internalType": "address",
324
+ "name": "",
325
+ "type": "address"
326
+ },
327
+ {
328
+ "internalType": "uint256[]",
329
+ "name": "",
330
+ "type": "uint256[]"
331
+ },
332
+ {
333
+ "internalType": "uint256[]",
334
+ "name": "",
335
+ "type": "uint256[]"
336
+ },
337
+ {
338
+ "internalType": "bytes",
339
+ "name": "",
340
+ "type": "bytes"
341
+ }
342
+ ],
343
+ "name": "onERC1155BatchReceived",
344
+ "outputs": [
345
+ {
346
+ "internalType": "bytes4",
347
+ "name": "",
348
+ "type": "bytes4"
349
+ }
350
+ ],
351
+ "stateMutability": "pure",
352
+ "type": "function"
353
+ },
354
+ {
355
+ "inputs": [
356
+ {
357
+ "internalType": "address",
358
+ "name": "",
359
+ "type": "address"
360
+ },
361
+ {
362
+ "internalType": "address",
363
+ "name": "",
364
+ "type": "address"
365
+ },
366
+ {
367
+ "internalType": "uint256",
368
+ "name": "",
369
+ "type": "uint256"
370
+ },
371
+ {
372
+ "internalType": "uint256",
373
+ "name": "",
374
+ "type": "uint256"
375
+ },
376
+ {
377
+ "internalType": "bytes",
378
+ "name": "",
379
+ "type": "bytes"
380
+ }
381
+ ],
382
+ "name": "onERC1155Received",
383
+ "outputs": [
384
+ {
385
+ "internalType": "bytes4",
386
+ "name": "",
387
+ "type": "bytes4"
388
+ }
389
+ ],
390
+ "stateMutability": "pure",
391
+ "type": "function"
392
+ },
393
+ {
394
+ "inputs": [
395
+ {
396
+ "internalType": "address",
397
+ "name": "",
398
+ "type": "address"
399
+ },
400
+ {
401
+ "internalType": "address",
402
+ "name": "",
403
+ "type": "address"
404
+ },
405
+ {
406
+ "internalType": "uint256",
407
+ "name": "",
408
+ "type": "uint256"
409
+ },
410
+ {
411
+ "internalType": "bytes",
412
+ "name": "",
413
+ "type": "bytes"
414
+ }
415
+ ],
416
+ "name": "onERC721Received",
417
+ "outputs": [
418
+ {
419
+ "internalType": "bytes4",
420
+ "name": "",
421
+ "type": "bytes4"
422
+ }
423
+ ],
424
+ "stateMutability": "pure",
425
+ "type": "function"
426
+ },
427
+ {
428
+ "inputs": [
429
+ {
430
+ "internalType": "address",
431
+ "name": "targetContract",
432
+ "type": "address"
433
+ },
434
+ {
435
+ "internalType": "bytes",
436
+ "name": "calldataPayload",
437
+ "type": "bytes"
438
+ }
439
+ ],
440
+ "name": "simulate",
441
+ "outputs": [
442
+ {
443
+ "internalType": "bytes",
444
+ "name": "response",
445
+ "type": "bytes"
446
+ }
447
+ ],
448
+ "stateMutability": "nonpayable",
449
+ "type": "function"
450
+ },
451
+ {
452
+ "inputs": [
453
+ {
454
+ "internalType": "bytes4",
455
+ "name": "interfaceId",
456
+ "type": "bytes4"
457
+ }
458
+ ],
459
+ "name": "supportsInterface",
460
+ "outputs": [
461
+ {
462
+ "internalType": "bool",
463
+ "name": "",
464
+ "type": "bool"
465
+ }
466
+ ],
467
+ "stateMutability": "view",
468
+ "type": "function"
469
+ },
470
+ {
471
+ "inputs": [
472
+ {
473
+ "internalType": "address",
474
+ "name": "",
475
+ "type": "address"
476
+ },
477
+ {
478
+ "internalType": "address",
479
+ "name": "",
480
+ "type": "address"
481
+ },
482
+ {
483
+ "internalType": "address",
484
+ "name": "",
485
+ "type": "address"
486
+ },
487
+ {
488
+ "internalType": "uint256",
489
+ "name": "",
490
+ "type": "uint256"
491
+ },
492
+ {
493
+ "internalType": "bytes",
494
+ "name": "",
495
+ "type": "bytes"
496
+ },
497
+ {
498
+ "internalType": "bytes",
499
+ "name": "",
500
+ "type": "bytes"
501
+ }
502
+ ],
503
+ "name": "tokensReceived",
504
+ "outputs": [],
505
+ "stateMutability": "pure",
506
+ "type": "function"
507
+ },
508
+ {
509
+ "inputs": [
510
+ {
511
+ "components": [
512
+ {
513
+ "internalType": "address",
514
+ "name": "sender",
515
+ "type": "address"
516
+ },
517
+ {
518
+ "internalType": "uint256",
519
+ "name": "nonce",
520
+ "type": "uint256"
521
+ },
522
+ {
523
+ "internalType": "bytes",
524
+ "name": "initCode",
525
+ "type": "bytes"
526
+ },
527
+ {
528
+ "internalType": "bytes",
529
+ "name": "callData",
530
+ "type": "bytes"
531
+ },
532
+ {
533
+ "internalType": "uint256",
534
+ "name": "callGasLimit",
535
+ "type": "uint256"
536
+ },
537
+ {
538
+ "internalType": "uint256",
539
+ "name": "verificationGasLimit",
540
+ "type": "uint256"
541
+ },
542
+ {
543
+ "internalType": "uint256",
544
+ "name": "preVerificationGas",
545
+ "type": "uint256"
546
+ },
547
+ {
548
+ "internalType": "uint256",
549
+ "name": "maxFeePerGas",
550
+ "type": "uint256"
551
+ },
552
+ {
553
+ "internalType": "uint256",
554
+ "name": "maxPriorityFeePerGas",
555
+ "type": "uint256"
556
+ },
557
+ {
558
+ "internalType": "bytes",
559
+ "name": "paymasterAndData",
560
+ "type": "bytes"
561
+ },
562
+ {
563
+ "internalType": "bytes",
564
+ "name": "signature",
565
+ "type": "bytes"
566
+ }
567
+ ],
568
+ "internalType": "struct UserOperation",
569
+ "name": "userOp",
570
+ "type": "tuple"
571
+ },
572
+ {
573
+ "internalType": "bytes32",
574
+ "name": "",
575
+ "type": "bytes32"
576
+ },
577
+ {
578
+ "internalType": "uint256",
579
+ "name": "missingAccountFunds",
580
+ "type": "uint256"
581
+ }
582
+ ],
583
+ "name": "validateUserOp",
584
+ "outputs": [
585
+ {
586
+ "internalType": "uint256",
587
+ "name": "validationData",
588
+ "type": "uint256"
589
+ }
590
+ ],
591
+ "stateMutability": "nonpayable",
592
+ "type": "function"
593
+ }
594
+ ]
595
+ }
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './allowance-module';
2
+ export * from './safe-4337-module';
2
3
  export * from './types';
@@ -0,0 +1,16 @@
1
+ import Safe4337Module020 from './assets/safe-4337-module/v0.2.0/safe-4337-module.json';
2
+ import AddModulesLib020 from './assets/safe-4337-module/v0.2.0/add-modules-lib.json';
3
+ import { DeploymentFilter, Deployment } from './types';
4
+ import { applyFilterDefaults, findDeployment } from './utils';
5
+
6
+ // The array should be sorted from the latest version to the oldest.
7
+ const SAFE_4337_MODULE_DEPLOYMENTS: Deployment[] = [Safe4337Module020];
8
+ const ADD_MODULES_LIB_DEPLOYMENTS: Deployment[] = [AddModulesLib020];
9
+
10
+ export const getSafe4337ModuleDeployment = (filter?: DeploymentFilter): Deployment | undefined => {
11
+ return findDeployment(applyFilterDefaults(filter), SAFE_4337_MODULE_DEPLOYMENTS);
12
+ };
13
+
14
+ export const getAddModulesLibDeployment = (filter?: DeploymentFilter): Deployment | undefined => {
15
+ return findDeployment(applyFilterDefaults(filter), ADD_MODULES_LIB_DEPLOYMENTS);
16
+ };
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface SingletonDeployment {
1
+ export interface Deployment {
2
2
  version: string;
3
3
  abi: any[];
4
4
  networkAddresses: Record<string, string>;
package/src/utils.ts CHANGED
@@ -1,9 +1,6 @@
1
- import { DeploymentFilter, SingletonDeployment } from './types';
1
+ import { DeploymentFilter, Deployment } from './types';
2
2
 
3
- export const findDeployment = (
4
- criteria: DeploymentFilter,
5
- deployments: SingletonDeployment[],
6
- ): SingletonDeployment | undefined =>
3
+ export const findDeployment = (criteria: DeploymentFilter, deployments: Deployment[]): Deployment | undefined =>
7
4
  deployments.find((deployment) => {
8
5
  if (criteria.version && deployment.version !== criteria.version) return false;
9
6
  if (criteria.released && deployment.released != criteria.released) return false;