@safe-global/safe-deployments 1.37.0 → 1.37.1

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.
Files changed (106) hide show
  1. package/README.md +56 -28
  2. package/dist/accessors.js +1 -3
  3. package/dist/assets/v1.0.0/gnosis_safe.json +477 -103
  4. package/dist/assets/v1.0.0/proxy_factory.json +9 -6
  5. package/dist/assets/v1.1.1/default_callback_handler.json +12 -9
  6. package/dist/assets/v1.1.1/gnosis_safe.json +12 -9
  7. package/dist/assets/v1.1.1/multi_send.json +12 -9
  8. package/dist/assets/v1.1.1/proxy_factory.json +12 -9
  9. package/dist/assets/v1.2.0/gnosis_safe.json +12 -9
  10. package/dist/assets/v1.3.0/compatibility_fallback_handler.json +247 -235
  11. package/dist/assets/v1.3.0/create_call.json +247 -235
  12. package/dist/assets/v1.3.0/gnosis_safe.json +247 -235
  13. package/dist/assets/v1.3.0/gnosis_safe_l2.json +247 -235
  14. package/dist/assets/v1.3.0/multi_send.json +247 -235
  15. package/dist/assets/v1.3.0/multi_send_call_only.json +247 -235
  16. package/dist/assets/v1.3.0/proxy_factory.json +247 -235
  17. package/dist/assets/v1.3.0/sign_message_lib.json +248 -236
  18. package/dist/assets/v1.3.0/simulate_tx_accessor.json +247 -235
  19. package/dist/assets/v1.4.1/compatibility_fallback_handler.json +114 -108
  20. package/dist/assets/v1.4.1/create_call.json +114 -108
  21. package/dist/assets/v1.4.1/multi_send.json +114 -108
  22. package/dist/assets/v1.4.1/multi_send_call_only.json +114 -108
  23. package/dist/assets/v1.4.1/safe.json +114 -108
  24. package/dist/assets/v1.4.1/safe_l2.json +114 -108
  25. package/dist/assets/v1.4.1/safe_proxy_factory.json +115 -109
  26. package/dist/assets/v1.4.1/sign_message_lib.json +115 -109
  27. package/dist/assets/v1.4.1/simulate_tx_accessor.json +114 -108
  28. package/dist/factories.js +4 -1
  29. package/dist/handler.js +6 -5
  30. package/dist/libs.js +4 -12
  31. package/dist/safes.d.ts +3 -3
  32. package/dist/safes.js +6 -4
  33. package/dist/types.d.ts +28 -2
  34. package/dist/types.js +11 -0
  35. package/dist/utils.d.ts +9 -2
  36. package/dist/utils.js +34 -5
  37. package/package.json +15 -17
  38. package/src/__tests__/assets/v1/v1.0.0/gnosis_safe.json +794 -0
  39. package/src/__tests__/assets/v1/v1.0.0/proxy_factory.json +109 -0
  40. package/src/__tests__/assets/v1/v1.1.1/create_and_add_modules.json +57 -0
  41. package/src/__tests__/assets/v1/v1.1.1/create_call.json +88 -0
  42. package/src/__tests__/assets/v1/v1.1.1/default_callback_handler.json +210 -0
  43. package/src/__tests__/assets/v1/v1.1.1/gnosis_safe.json +999 -0
  44. package/src/__tests__/assets/v1/v1.1.1/multi_send.json +43 -0
  45. package/src/__tests__/assets/v1/v1.1.1/proxy_factory.json +189 -0
  46. package/src/__tests__/assets/v1/v1.2.0/gnosis_safe.json +1020 -0
  47. package/src/__tests__/assets/v1/v1.3.0/compatibility_fallback_handler.json +580 -0
  48. package/src/__tests__/assets/v1/v1.3.0/create_call.json +323 -0
  49. package/src/__tests__/assets/v1/v1.3.0/gnosis_safe.json +1288 -0
  50. package/src/__tests__/assets/v1/v1.3.0/gnosis_safe_l2.json +1393 -0
  51. package/src/__tests__/assets/v1/v1.3.0/multi_send.json +275 -0
  52. package/src/__tests__/assets/v1/v1.3.0/multi_send_call_only.json +270 -0
  53. package/src/__tests__/assets/v1/v1.3.0/proxy_factory.json +418 -0
  54. package/src/__tests__/assets/v1/v1.3.0/sign_message_lib.json +302 -0
  55. package/src/__tests__/assets/v1/v1.3.0/simulate_tx_accessor.json +306 -0
  56. package/src/__tests__/assets/v1/v1.4.1/compatibility_fallback_handler.json +445 -0
  57. package/src/__tests__/assets/v1/v1.4.1/create_call.json +190 -0
  58. package/src/__tests__/assets/v1/v1.4.1/multi_send.json +142 -0
  59. package/src/__tests__/assets/v1/v1.4.1/multi_send_call_only.json +137 -0
  60. package/src/__tests__/assets/v1/v1.4.1/safe.json +1121 -0
  61. package/src/__tests__/assets/v1/v1.4.1/safe_l2.json +1226 -0
  62. package/src/__tests__/assets/v1/v1.4.1/safe_proxy_factory.json +261 -0
  63. package/src/__tests__/assets/v1/v1.4.1/sign_message_lib.json +169 -0
  64. package/src/__tests__/assets/v1/v1.4.1/simulate_tx_accessor.json +173 -0
  65. package/src/__tests__/assets.test.ts +101 -38
  66. package/src/__tests__/factories.test.ts +3 -3
  67. package/src/__tests__/handler.test.ts +5 -5
  68. package/src/__tests__/libs.test.ts +9 -9
  69. package/src/__tests__/safes.test.ts +9 -12
  70. package/src/__tests__/utils.test.ts +271 -0
  71. package/src/accessors.ts +5 -7
  72. package/src/assets/v1.0.0/gnosis_safe.json +477 -103
  73. package/src/assets/v1.0.0/proxy_factory.json +9 -6
  74. package/src/assets/v1.1.1/create_and_add_modules.json +17 -10
  75. package/src/assets/v1.1.1/create_call.json +12 -9
  76. package/src/assets/v1.1.1/default_callback_handler.json +12 -9
  77. package/src/assets/v1.1.1/gnosis_safe.json +12 -9
  78. package/src/assets/v1.1.1/multi_send.json +12 -9
  79. package/src/assets/v1.1.1/proxy_factory.json +12 -9
  80. package/src/assets/v1.2.0/gnosis_safe.json +12 -9
  81. package/src/assets/v1.3.0/compatibility_fallback_handler.json +247 -235
  82. package/src/assets/v1.3.0/create_call.json +247 -235
  83. package/src/assets/v1.3.0/gnosis_safe.json +247 -235
  84. package/src/assets/v1.3.0/gnosis_safe_l2.json +247 -235
  85. package/src/assets/v1.3.0/multi_send.json +247 -235
  86. package/src/assets/v1.3.0/multi_send_call_only.json +247 -235
  87. package/src/assets/v1.3.0/proxy_factory.json +247 -235
  88. package/src/assets/v1.3.0/sign_message_lib.json +248 -236
  89. package/src/assets/v1.3.0/simulate_tx_accessor.json +247 -235
  90. package/src/assets/v1.4.1/compatibility_fallback_handler.json +114 -108
  91. package/src/assets/v1.4.1/create_call.json +114 -108
  92. package/src/assets/v1.4.1/multi_send.json +114 -108
  93. package/src/assets/v1.4.1/multi_send_call_only.json +114 -108
  94. package/src/assets/v1.4.1/safe.json +114 -108
  95. package/src/assets/v1.4.1/safe_l2.json +114 -108
  96. package/src/assets/v1.4.1/safe_proxy_factory.json +115 -109
  97. package/src/assets/v1.4.1/sign_message_lib.json +115 -109
  98. package/src/assets/v1.4.1/simulate_tx_accessor.json +114 -108
  99. package/src/factories.ts +14 -11
  100. package/src/handler.ts +24 -21
  101. package/src/index.ts +6 -6
  102. package/src/libs.ts +23 -31
  103. package/src/safes.ts +21 -19
  104. package/src/types.ts +84 -10
  105. package/src/utils.ts +50 -12
  106. package/src/__tests__/utilts.test.ts +0 -385
@@ -1,116 +1,122 @@
1
1
  {
2
- "defaultAddress": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
3
2
  "released": true,
4
3
  "contractName": "SimulateTxAccessor",
5
4
  "version": "1.4.1",
5
+ "codeHash": "0x91f82615581fc73b190b83d72e883608b25e392f72322035df1b13d51766cf8d",
6
+ "addresses": {
7
+ "canonical": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199"
8
+ },
6
9
  "networkAddresses": {
7
- "1": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
8
- "5": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
9
- "10": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
10
- "25": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
11
- "31": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
12
- "40": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
13
- "41": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
14
- "56": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
15
- "71": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
16
- "97": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
17
- "100": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
18
- "137": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
19
- "155": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
20
- "169": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
21
- "250": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
22
- "252": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
23
- "255": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
24
- "336": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
25
- "338": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
26
- "369": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
27
- "690": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
28
- "919": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
29
- "1030": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
30
- "1101": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
31
- "1111": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
32
- "1112": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
33
- "1135": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
34
- "1284": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
35
- "1285": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
36
- "1287": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
37
- "1329": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
38
- "1442": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
39
- "1625": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
40
- "1729": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
41
- "2000": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
42
- "2039": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
43
- "2358": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
44
- "2810": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
45
- "3636": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
46
- "3776": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
47
- "4002": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
48
- "4157": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
49
- "4202": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
50
- "4337": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
51
- "4653": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
52
- "5000": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
53
- "5003": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
54
- "6001": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
55
- "7000": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
56
- "7001": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
57
- "7171": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
58
- "7560": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
59
- "7771": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
60
- "8192": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
61
- "8194": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
62
- "8453": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
63
- "9001": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
64
- "10242": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
65
- "10243": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
66
- "11235": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
67
- "13337": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
68
- "17000": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
69
- "17069": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
70
- "18233": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
71
- "23294": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
72
- "23295": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
73
- "32769": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
74
- "33101": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
75
- "34443": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
76
- "42161": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
77
- "42220": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
78
- "43114": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
79
- "54211": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
80
- "59140": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
81
- "59141": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
82
- "59144": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
83
- "80001": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
84
- "80085": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
85
- "81457": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
86
- "84531": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
87
- "84532": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
88
- "105105": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
89
- "111188": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
90
- "167000": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
91
- "167009": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
92
- "205205": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
93
- "444444": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
94
- "534351": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
95
- "534352": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
96
- "555666": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
97
- "713715": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
98
- "6038361": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
99
- "7225878": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
100
- "7777777": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
101
- "11155111": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
102
- "11155420": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
103
- "94204209": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
104
- "111557560": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
105
- "123420111": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
106
- "168587773": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
107
- "666666666": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
108
- "999999999": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
109
- "1313161554": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
110
- "1313161555": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
111
- "1666600000": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
112
- "1666700000": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
113
- "88153591557": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199"
10
+ "1": "canonical",
11
+ "5": "canonical",
12
+ "10": "canonical",
13
+ "25": "canonical",
14
+ "31": "canonical",
15
+ "40": "canonical",
16
+ "41": "canonical",
17
+ "56": "canonical",
18
+ "71": "canonical",
19
+ "97": "canonical",
20
+ "100": "canonical",
21
+ "137": "canonical",
22
+ "155": "canonical",
23
+ "169": "canonical",
24
+ "250": "canonical",
25
+ "252": "canonical",
26
+ "255": "canonical",
27
+ "336": "canonical",
28
+ "338": "canonical",
29
+ "369": "canonical",
30
+ "530": "canonical",
31
+ "690": "canonical",
32
+ "919": "canonical",
33
+ "1030": "canonical",
34
+ "1101": "canonical",
35
+ "1111": "canonical",
36
+ "1112": "canonical",
37
+ "1135": "canonical",
38
+ "1284": "canonical",
39
+ "1285": "canonical",
40
+ "1287": "canonical",
41
+ "1329": "canonical",
42
+ "1337": "canonical",
43
+ "1442": "canonical",
44
+ "1625": "canonical",
45
+ "1729": "canonical",
46
+ "2000": "canonical",
47
+ "2039": "canonical",
48
+ "2358": "canonical",
49
+ "2810": "canonical",
50
+ "3636": "canonical",
51
+ "3776": "canonical",
52
+ "4002": "canonical",
53
+ "4157": "canonical",
54
+ "4202": "canonical",
55
+ "4337": "canonical",
56
+ "4653": "canonical",
57
+ "5000": "canonical",
58
+ "5003": "canonical",
59
+ "6001": "canonical",
60
+ "7000": "canonical",
61
+ "7001": "canonical",
62
+ "7171": "canonical",
63
+ "7560": "canonical",
64
+ "7771": "canonical",
65
+ "8192": "canonical",
66
+ "8194": "canonical",
67
+ "8453": "canonical",
68
+ "9001": "canonical",
69
+ "10242": "canonical",
70
+ "10243": "canonical",
71
+ "11235": "canonical",
72
+ "13337": "canonical",
73
+ "17000": "canonical",
74
+ "17069": "canonical",
75
+ "18233": "canonical",
76
+ "23294": "canonical",
77
+ "23295": "canonical",
78
+ "32769": "canonical",
79
+ "33101": "canonical",
80
+ "34443": "canonical",
81
+ "42161": "canonical",
82
+ "42220": "canonical",
83
+ "43114": "canonical",
84
+ "54211": "canonical",
85
+ "59140": "canonical",
86
+ "59141": "canonical",
87
+ "59144": "canonical",
88
+ "80001": "canonical",
89
+ "80085": "canonical",
90
+ "81457": "canonical",
91
+ "84531": "canonical",
92
+ "84532": "canonical",
93
+ "90001": "canonical",
94
+ "105105": "canonical",
95
+ "111188": "canonical",
96
+ "167000": "canonical",
97
+ "167009": "canonical",
98
+ "205205": "canonical",
99
+ "444444": "canonical",
100
+ "534351": "canonical",
101
+ "534352": "canonical",
102
+ "555666": "canonical",
103
+ "713715": "canonical",
104
+ "6038361": "canonical",
105
+ "7225878": "canonical",
106
+ "7777777": "canonical",
107
+ "11155111": "canonical",
108
+ "11155420": "canonical",
109
+ "94204209": "canonical",
110
+ "111557560": "canonical",
111
+ "123420111": "canonical",
112
+ "168587773": "canonical",
113
+ "666666666": "canonical",
114
+ "999999999": "canonical",
115
+ "1313161554": "canonical",
116
+ "1313161555": "canonical",
117
+ "1666600000": "canonical",
118
+ "1666700000": "canonical",
119
+ "88153591557": "canonical"
114
120
  },
115
121
  "abi": [
116
122
  {
package/src/factories.ts CHANGED
@@ -1,16 +1,19 @@
1
- import ProxyFactory100 from './assets/v1.0.0/proxy_factory.json'
2
- import ProxyFactory111 from './assets/v1.1.1/proxy_factory.json'
3
- import ProxyFactory130 from './assets/v1.3.0/proxy_factory.json'
4
- import SafeProxyFactory141 from './assets/v1.4.1/safe_proxy_factory.json'
1
+ import ProxyFactory100 from './assets/v1.0.0/proxy_factory.json';
2
+ import ProxyFactory111 from './assets/v1.1.1/proxy_factory.json';
3
+ import ProxyFactory130 from './assets/v1.3.0/proxy_factory.json';
4
+ import SafeProxyFactory141 from './assets/v1.4.1/safe_proxy_factory.json';
5
5
 
6
- import { DeploymentFilter, SingletonDeployment } from './types'
7
- import { findDeployment } from './utils'
6
+ import { DeploymentFilter, SingletonDeployment, SingletonDeploymentJSON } from './types';
7
+ import { findDeployment } from './utils';
8
8
 
9
9
  // This is a sorted array (newest to oldest)
10
- const factoryDeployments: SingletonDeployment[] = [
11
- SafeProxyFactory141, ProxyFactory130, ProxyFactory111, ProxyFactory100
12
- ]
10
+ const factoryDeployments: SingletonDeploymentJSON[] = [
11
+ SafeProxyFactory141,
12
+ ProxyFactory130,
13
+ ProxyFactory111,
14
+ ProxyFactory100,
15
+ ];
13
16
 
14
17
  export const getProxyFactoryDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
15
- return findDeployment(filter, factoryDeployments)
16
- }
18
+ return findDeployment(filter, factoryDeployments);
19
+ };
package/src/handler.ts CHANGED
@@ -1,32 +1,35 @@
1
- import DefaultCallbackHandler130 from './assets/v1.1.1/default_callback_handler.json'
2
- import CompatibilityFallbackHandler130 from './assets/v1.3.0/compatibility_fallback_handler.json'
3
- import CompatibilityFallbackHandler141 from './assets/v1.4.1/compatibility_fallback_handler.json'
4
- import { DeploymentFilter, SingletonDeployment } from './types'
5
- import { findDeployment } from './utils'
1
+ import DefaultCallbackHandler130 from './assets/v1.1.1/default_callback_handler.json';
2
+ import CompatibilityFallbackHandler130 from './assets/v1.3.0/compatibility_fallback_handler.json';
3
+ import CompatibilityFallbackHandler141 from './assets/v1.4.1/compatibility_fallback_handler.json';
4
+ import { DeploymentFilter, SingletonDeployment, SingletonDeploymentJSON } from './types';
5
+ import { findDeployment } from './utils';
6
6
 
7
7
  // This is a sorted array (by preference)
8
- const defaultCallbackHandlerDeployments: SingletonDeployment[] = [
9
- DefaultCallbackHandler130
10
- ]
8
+ const defaultCallbackHandlerDeployments: SingletonDeploymentJSON[] = [DefaultCallbackHandler130];
11
9
 
12
10
  export const getDefaultCallbackHandlerDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
13
- return findDeployment(filter, defaultCallbackHandlerDeployments)
14
- }
11
+ return findDeployment(filter, defaultCallbackHandlerDeployments);
12
+ };
15
13
 
16
14
  // This is a sorted array (by preference)
17
- const compatFallbackHandlerDeployments: SingletonDeployment[] = [
18
- CompatibilityFallbackHandler141, CompatibilityFallbackHandler130
19
- ]
15
+ const compatFallbackHandlerDeployments: SingletonDeploymentJSON[] = [
16
+ CompatibilityFallbackHandler141,
17
+ CompatibilityFallbackHandler130,
18
+ ];
20
19
 
21
- export const getCompatibilityFallbackHandlerDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
22
- return findDeployment(filter, compatFallbackHandlerDeployments)
23
- }
20
+ export const getCompatibilityFallbackHandlerDeployment = (
21
+ filter?: DeploymentFilter,
22
+ ): SingletonDeployment | undefined => {
23
+ return findDeployment(filter, compatFallbackHandlerDeployments);
24
+ };
24
25
 
25
26
  // This is a sorted array (by preference)
26
- const fallbackHandlerDeployments: SingletonDeployment[] = [
27
- CompatibilityFallbackHandler141, CompatibilityFallbackHandler130, DefaultCallbackHandler130
28
- ]
27
+ const fallbackHandlerDeployments: SingletonDeploymentJSON[] = [
28
+ CompatibilityFallbackHandler141,
29
+ CompatibilityFallbackHandler130,
30
+ DefaultCallbackHandler130,
31
+ ];
29
32
 
30
33
  export const getFallbackHandlerDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
31
- return findDeployment(filter, fallbackHandlerDeployments)
32
- }
34
+ return findDeployment(filter, fallbackHandlerDeployments);
35
+ };
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from './types'
2
- export * from './safes'
3
- export * from './factories'
4
- export * from './libs'
5
- export * from './handler'
6
- export * from './accessors'
1
+ export * from './types';
2
+ export * from './safes';
3
+ export * from './factories';
4
+ export * from './libs';
5
+ export * from './handler';
6
+ export * from './accessors';
package/src/libs.ts CHANGED
@@ -1,46 +1,38 @@
1
- import CreateCall130 from './assets/v1.3.0/create_call.json'
2
- import CreateCall141 from './assets/v1.4.1/create_call.json'
3
- import MultiSend111 from './assets/v1.1.1/multi_send.json'
4
- import MultiSend130 from './assets/v1.3.0/multi_send.json'
5
- import MultiSend141 from './assets/v1.4.1/multi_send.json'
6
- import MultiSendCallOnly130 from './assets/v1.3.0/multi_send_call_only.json'
7
- import MultiSendCallOnly141 from './assets/v1.4.1/multi_send_call_only.json'
8
- import SignMessageLib130 from './assets/v1.3.0/sign_message_lib.json'
9
- import SignMessageLib141 from './assets/v1.4.1/sign_message_lib.json'
10
- import { DeploymentFilter, SingletonDeployment } from './types'
11
- import { findDeployment } from './utils'
1
+ import CreateCall130 from './assets/v1.3.0/create_call.json';
2
+ import CreateCall141 from './assets/v1.4.1/create_call.json';
3
+ import MultiSend111 from './assets/v1.1.1/multi_send.json';
4
+ import MultiSend130 from './assets/v1.3.0/multi_send.json';
5
+ import MultiSend141 from './assets/v1.4.1/multi_send.json';
6
+ import MultiSendCallOnly130 from './assets/v1.3.0/multi_send_call_only.json';
7
+ import MultiSendCallOnly141 from './assets/v1.4.1/multi_send_call_only.json';
8
+ import SignMessageLib130 from './assets/v1.3.0/sign_message_lib.json';
9
+ import SignMessageLib141 from './assets/v1.4.1/sign_message_lib.json';
10
+ import { DeploymentFilter, SingletonDeployment, SingletonDeploymentJSON } from './types';
11
+ import { findDeployment } from './utils';
12
12
 
13
13
  // This is a sorted array (by preference, currently we use 111 in most cases)
14
- const multiSendDeployments: SingletonDeployment[] = [
15
- MultiSend141, MultiSend130, MultiSend111
16
- ]
14
+ const multiSendDeployments: SingletonDeploymentJSON[] = [MultiSend141, MultiSend130, MultiSend111];
17
15
 
18
16
  export const getMultiSendDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
19
- return findDeployment(filter, multiSendDeployments)
20
- }
17
+ return findDeployment(filter, multiSendDeployments);
18
+ };
21
19
 
22
20
  // This is a sorted array (by preference)
23
- const multiSendCallOnlyDeployments: SingletonDeployment[] = [
24
- MultiSendCallOnly141, MultiSendCallOnly130
25
- ]
21
+ const multiSendCallOnlyDeployments: SingletonDeploymentJSON[] = [MultiSendCallOnly141, MultiSendCallOnly130];
26
22
 
27
23
  export const getMultiSendCallOnlyDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
28
- return findDeployment(filter, multiSendCallOnlyDeployments)
29
- }
24
+ return findDeployment(filter, multiSendCallOnlyDeployments);
25
+ };
30
26
 
31
27
  // This is a sorted array (by preference)
32
- const createCallDeployments: SingletonDeployment[] = [
33
- CreateCall141, CreateCall130
34
- ]
28
+ const createCallDeployments: SingletonDeploymentJSON[] = [CreateCall141, CreateCall130];
35
29
 
36
30
  export const getCreateCallDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
37
- return findDeployment(filter, createCallDeployments)
38
- }
31
+ return findDeployment(filter, createCallDeployments);
32
+ };
39
33
 
40
- const signMessageLibDeployments: SingletonDeployment[] = [
41
- SignMessageLib141, SignMessageLib130
42
- ]
34
+ const signMessageLibDeployments: SingletonDeploymentJSON[] = [SignMessageLib141, SignMessageLib130];
43
35
 
44
36
  export const getSignMessageLibDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
45
- return findDeployment(filter, signMessageLibDeployments)
46
- }
37
+ return findDeployment(filter, signMessageLibDeployments);
38
+ };
package/src/safes.ts CHANGED
@@ -1,27 +1,29 @@
1
- import SafeL2141 from './assets/v1.4.1/safe_l2.json'
2
- import Safe141 from './assets/v1.4.1/safe.json'
3
- import GnosisSafeL2130 from './assets/v1.3.0/gnosis_safe_l2.json'
4
- import GnosisSafe130 from './assets/v1.3.0/gnosis_safe.json'
5
- import GnosisSafe120 from './assets/v1.2.0/gnosis_safe.json'
6
- import GnosisSafe111 from './assets/v1.1.1/gnosis_safe.json'
7
- import GnosisSafe100 from './assets/v1.0.0/gnosis_safe.json'
8
- import { DeploymentFilter, SingletonDeployment } from './types'
9
- import { findDeployment } from './utils'
1
+ import SafeL2141 from './assets/v1.4.1/safe_l2.json';
2
+ import Safe141 from './assets/v1.4.1/safe.json';
3
+ import GnosisSafeL2130 from './assets/v1.3.0/gnosis_safe_l2.json';
4
+ import GnosisSafe130 from './assets/v1.3.0/gnosis_safe.json';
5
+ import GnosisSafe120 from './assets/v1.2.0/gnosis_safe.json';
6
+ import GnosisSafe111 from './assets/v1.1.1/gnosis_safe.json';
7
+ import GnosisSafe100 from './assets/v1.0.0/gnosis_safe.json';
8
+ import { DeploymentFilter, SingletonDeployment, SingletonDeploymentJSON } from './types';
9
+ import { findDeployment } from './utils';
10
10
 
11
11
  // This is a sorted array (newest to oldest), exported for tests
12
- export const _safeDeployments: SingletonDeployment[] = [
13
- Safe141, GnosisSafe130, GnosisSafe120, GnosisSafe111, GnosisSafe100
14
- ]
12
+ export const _safeDeployments: SingletonDeploymentJSON[] = [
13
+ Safe141,
14
+ GnosisSafe130,
15
+ GnosisSafe120,
16
+ GnosisSafe111,
17
+ GnosisSafe100,
18
+ ];
15
19
 
16
20
  export const getSafeSingletonDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
17
- return findDeployment(filter, _safeDeployments)
18
- }
21
+ return findDeployment(filter, _safeDeployments);
22
+ };
19
23
 
20
24
  // This is a sorted array (newest to oldest), exported for tests
21
- export const _safeL2Deployments: SingletonDeployment[] = [
22
- SafeL2141, GnosisSafeL2130
23
- ]
25
+ export const _safeL2Deployments: SingletonDeploymentJSON[] = [SafeL2141, GnosisSafeL2130];
24
26
 
25
27
  export const getSafeL2SingletonDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
26
- return findDeployment(filter, _safeL2Deployments)
27
- }
28
+ return findDeployment(filter, _safeL2Deployments);
29
+ };
package/src/types.ts CHANGED
@@ -1,14 +1,88 @@
1
+ enum AddressType {
2
+ // The original address the contract was deployed on.
3
+ // Starting with 1.4.1, the contracts are deployed with an EIP155-compatible transaction.
4
+ CANONICAL = 'canonical',
5
+
6
+ // An address that was deployed with a transaction compatible with the EIP155 standard.
7
+ // The type is only used for 1.3.0 deployments.
8
+ EIP155 = 'eip155',
9
+
10
+ // An address that is deployed to the ZkSync VM networks.
11
+ ZKSYNC = 'zksync',
12
+ }
13
+
14
+ export interface SingletonDeploymentJSON {
15
+ // Indicates if the deployment is released.
16
+ released: boolean;
17
+
18
+ // The name of the contract.
19
+ contractName: string;
20
+
21
+ // The version of the deployment.
22
+ version: string;
23
+
24
+ // The hash of the contract code.
25
+ codeHash: string;
26
+
27
+ // A record of network addresses, where the key is the network identifier and the value is either a single address type or an array of address types.
28
+ networkAddresses: Record<string, string | string[]>;
29
+
30
+ // A record of addresses, where the key is the address type and the value is the address.
31
+ // Possible addresses per version:
32
+ // 1.0.0: canonical
33
+ // 1.1.1: canonical
34
+ // 1.2.0: canonical
35
+ // 1.3.0: canonical, eip155, zksync
36
+ // 1.4.1: canonical, zksync
37
+ addresses: Record<string, string>;
38
+
39
+ // The ABI (Application Binary Interface) of the contract.
40
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
41
+ abi: any[];
42
+ }
43
+
44
+ // This is the old type that only allows a single address for each network.
45
+ // It is still used for backwards compatibility.
1
46
  export interface SingletonDeployment {
2
- defaultAddress: string,
3
- version: string,
4
- abi: any[],
5
- networkAddresses: Record<string, string>,
6
- contractName: string,
7
- released: boolean
47
+ // The default address of the deployment.
48
+ defaultAddress: string;
49
+
50
+ // Indicates if the deployment is released.
51
+ released: boolean;
52
+
53
+ // The name of the contract.
54
+ contractName: string;
55
+
56
+ // The version of the deployment.
57
+ version: string;
58
+
59
+ // The hash of the contract code.
60
+ codeHash: string;
61
+
62
+ // A record of addresses, where the key is the address type and the value is the address.
63
+ addresses: Record<string, string>;
64
+
65
+ // A record of network addresses, where the key is the network identifier and the value is the address.
66
+ networkAddresses: Record<string, string>;
67
+
68
+ // The ABI (Application Binary Interface) of the contract.
69
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
70
+ abi: any[];
71
+ }
72
+
73
+ export interface SingletonDeploymentV2 {
74
+ released: boolean;
75
+ contractName: string;
76
+ version: string;
77
+ codeHash: string;
78
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
79
+ abi: any[];
80
+ networkAddresses: Record<string, AddressType | AddressType[]>;
81
+ addresses: Partial<Record<AddressType, string>>;
8
82
  }
9
83
 
10
84
  export interface DeploymentFilter {
11
- version?: string,
12
- released?: boolean,
13
- network?: string
14
- }
85
+ version?: string;
86
+ released?: boolean;
87
+ network?: string;
88
+ }
package/src/utils.ts CHANGED
@@ -1,16 +1,54 @@
1
- import { DeploymentFilter, SingletonDeployment } from './types'
2
- import semverSatisfies from 'semver/functions/satisfies'
1
+ import { DeploymentFilter, SingletonDeployment, SingletonDeploymentJSON } from './types';
2
+ import semverSatisfies from 'semver/functions/satisfies';
3
3
 
4
- const DEFAULT_FILTER: DeploymentFilter = { released: true }
4
+ const DEFAULT_FILTER: DeploymentFilter = { released: true };
5
5
 
6
- export const findDeployment = (criteria: DeploymentFilter = DEFAULT_FILTER, deployments: SingletonDeployment[]): SingletonDeployment | undefined => {
7
- const criteriaWithDefaults: DeploymentFilter = { ...DEFAULT_FILTER, ...criteria }
6
+ // The older JSON format had a `defaultAddress` field, which became obsolete due to EIP-155 enforcement and non-EVM compatible chains.
7
+ // This led to multiple "default" addresses, sometimes on the same chain ID. To maintain backwards compatibility, we map `defaultAddress`
8
+ // to the address deployed on a chosen default network.
9
+ const DEFAULT_NETWORK_CHAIN_ID = '1';
8
10
 
9
- return deployments.find((deployment) => {
10
- if (typeof criteriaWithDefaults.version !== 'undefined' && !semverSatisfies(deployment.version, criteriaWithDefaults.version)) return false
11
- if (typeof criteriaWithDefaults.released === 'boolean' && deployment.released != criteriaWithDefaults.released) return false
12
- if (criteriaWithDefaults.network && !deployment.networkAddresses[criteriaWithDefaults.network]) return false
11
+ /**
12
+ * Maps a SingletonDeploymentJSON object to a SingletonDeployment object.
13
+ *
14
+ * @param {SingletonDeploymentJSON} deployment - The deployment JSON object to map.
15
+ * @returns {SingletonDeployment} - The mapped deployment object.
16
+ */
17
+ const mapJsonToDeploymentsFormatV1 = (deployment: SingletonDeploymentJSON): SingletonDeployment => {
18
+ const defaultAddressType = Array.isArray(deployment.networkAddresses[DEFAULT_NETWORK_CHAIN_ID])
19
+ ? deployment.networkAddresses[DEFAULT_NETWORK_CHAIN_ID][0]
20
+ : deployment.networkAddresses[DEFAULT_NETWORK_CHAIN_ID];
21
+ const defaultAddress = deployment.addresses[defaultAddressType];
22
+ const networkAddresses = Object.fromEntries(
23
+ Object.entries(deployment.networkAddresses).map(([chainId, addressTypes]) => [
24
+ chainId,
25
+ Array.isArray(addressTypes) ? deployment.addresses[addressTypes[0]] : deployment.addresses[addressTypes],
26
+ ]),
27
+ );
13
28
 
14
- return true
15
- })
16
- }
29
+ return { ...deployment, defaultAddress, networkAddresses };
30
+ };
31
+
32
+ /**
33
+ * Finds a deployment that matches the given criteria.
34
+ *
35
+ * @param {DeploymentFilter} [criteria=DEFAULT_FILTER] - The filter criteria to match deployments.
36
+ * @param {SingletonDeploymentJSON[]} deployments - The list of deployment JSON objects to search.
37
+ * @returns {SingletonDeployment | undefined} - The found deployment object or undefined if no match is found.
38
+ */
39
+ export const findDeployment = (
40
+ criteria: DeploymentFilter = DEFAULT_FILTER,
41
+ deployments: SingletonDeploymentJSON[],
42
+ ): SingletonDeployment | undefined => {
43
+ const { version, released, network } = { ...DEFAULT_FILTER, ...criteria };
44
+
45
+ const deploymentJson = deployments.find((deployment) => {
46
+ if (version && !semverSatisfies(deployment.version, version)) return false;
47
+ if (typeof released === 'boolean' && deployment.released !== released) return false;
48
+ if (network && !deployment.networkAddresses[network]) return false;
49
+
50
+ return true;
51
+ });
52
+
53
+ return deploymentJson ? mapJsonToDeploymentsFormatV1(deploymentJson) : undefined;
54
+ };