@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.
- package/README.md +56 -28
- package/dist/accessors.js +1 -3
- package/dist/assets/v1.0.0/gnosis_safe.json +477 -103
- package/dist/assets/v1.0.0/proxy_factory.json +9 -6
- package/dist/assets/v1.1.1/default_callback_handler.json +12 -9
- package/dist/assets/v1.1.1/gnosis_safe.json +12 -9
- package/dist/assets/v1.1.1/multi_send.json +12 -9
- package/dist/assets/v1.1.1/proxy_factory.json +12 -9
- package/dist/assets/v1.2.0/gnosis_safe.json +12 -9
- package/dist/assets/v1.3.0/compatibility_fallback_handler.json +247 -235
- package/dist/assets/v1.3.0/create_call.json +247 -235
- package/dist/assets/v1.3.0/gnosis_safe.json +247 -235
- package/dist/assets/v1.3.0/gnosis_safe_l2.json +247 -235
- package/dist/assets/v1.3.0/multi_send.json +247 -235
- package/dist/assets/v1.3.0/multi_send_call_only.json +247 -235
- package/dist/assets/v1.3.0/proxy_factory.json +247 -235
- package/dist/assets/v1.3.0/sign_message_lib.json +248 -236
- package/dist/assets/v1.3.0/simulate_tx_accessor.json +247 -235
- package/dist/assets/v1.4.1/compatibility_fallback_handler.json +114 -108
- package/dist/assets/v1.4.1/create_call.json +114 -108
- package/dist/assets/v1.4.1/multi_send.json +114 -108
- package/dist/assets/v1.4.1/multi_send_call_only.json +114 -108
- package/dist/assets/v1.4.1/safe.json +114 -108
- package/dist/assets/v1.4.1/safe_l2.json +114 -108
- package/dist/assets/v1.4.1/safe_proxy_factory.json +115 -109
- package/dist/assets/v1.4.1/sign_message_lib.json +115 -109
- package/dist/assets/v1.4.1/simulate_tx_accessor.json +114 -108
- package/dist/factories.js +4 -1
- package/dist/handler.js +6 -5
- package/dist/libs.js +4 -12
- package/dist/safes.d.ts +3 -3
- package/dist/safes.js +6 -4
- package/dist/types.d.ts +28 -2
- package/dist/types.js +11 -0
- package/dist/utils.d.ts +9 -2
- package/dist/utils.js +34 -5
- package/package.json +15 -17
- package/src/__tests__/assets/v1/v1.0.0/gnosis_safe.json +794 -0
- package/src/__tests__/assets/v1/v1.0.0/proxy_factory.json +109 -0
- package/src/__tests__/assets/v1/v1.1.1/create_and_add_modules.json +57 -0
- package/src/__tests__/assets/v1/v1.1.1/create_call.json +88 -0
- package/src/__tests__/assets/v1/v1.1.1/default_callback_handler.json +210 -0
- package/src/__tests__/assets/v1/v1.1.1/gnosis_safe.json +999 -0
- package/src/__tests__/assets/v1/v1.1.1/multi_send.json +43 -0
- package/src/__tests__/assets/v1/v1.1.1/proxy_factory.json +189 -0
- package/src/__tests__/assets/v1/v1.2.0/gnosis_safe.json +1020 -0
- package/src/__tests__/assets/v1/v1.3.0/compatibility_fallback_handler.json +580 -0
- package/src/__tests__/assets/v1/v1.3.0/create_call.json +323 -0
- package/src/__tests__/assets/v1/v1.3.0/gnosis_safe.json +1288 -0
- package/src/__tests__/assets/v1/v1.3.0/gnosis_safe_l2.json +1393 -0
- package/src/__tests__/assets/v1/v1.3.0/multi_send.json +275 -0
- package/src/__tests__/assets/v1/v1.3.0/multi_send_call_only.json +270 -0
- package/src/__tests__/assets/v1/v1.3.0/proxy_factory.json +418 -0
- package/src/__tests__/assets/v1/v1.3.0/sign_message_lib.json +302 -0
- package/src/__tests__/assets/v1/v1.3.0/simulate_tx_accessor.json +306 -0
- package/src/__tests__/assets/v1/v1.4.1/compatibility_fallback_handler.json +445 -0
- package/src/__tests__/assets/v1/v1.4.1/create_call.json +190 -0
- package/src/__tests__/assets/v1/v1.4.1/multi_send.json +142 -0
- package/src/__tests__/assets/v1/v1.4.1/multi_send_call_only.json +137 -0
- package/src/__tests__/assets/v1/v1.4.1/safe.json +1121 -0
- package/src/__tests__/assets/v1/v1.4.1/safe_l2.json +1226 -0
- package/src/__tests__/assets/v1/v1.4.1/safe_proxy_factory.json +261 -0
- package/src/__tests__/assets/v1/v1.4.1/sign_message_lib.json +169 -0
- package/src/__tests__/assets/v1/v1.4.1/simulate_tx_accessor.json +173 -0
- package/src/__tests__/assets.test.ts +101 -38
- package/src/__tests__/factories.test.ts +3 -3
- package/src/__tests__/handler.test.ts +5 -5
- package/src/__tests__/libs.test.ts +9 -9
- package/src/__tests__/safes.test.ts +9 -12
- package/src/__tests__/utils.test.ts +271 -0
- package/src/accessors.ts +5 -7
- package/src/assets/v1.0.0/gnosis_safe.json +477 -103
- package/src/assets/v1.0.0/proxy_factory.json +9 -6
- package/src/assets/v1.1.1/create_and_add_modules.json +17 -10
- package/src/assets/v1.1.1/create_call.json +12 -9
- package/src/assets/v1.1.1/default_callback_handler.json +12 -9
- package/src/assets/v1.1.1/gnosis_safe.json +12 -9
- package/src/assets/v1.1.1/multi_send.json +12 -9
- package/src/assets/v1.1.1/proxy_factory.json +12 -9
- package/src/assets/v1.2.0/gnosis_safe.json +12 -9
- package/src/assets/v1.3.0/compatibility_fallback_handler.json +247 -235
- package/src/assets/v1.3.0/create_call.json +247 -235
- package/src/assets/v1.3.0/gnosis_safe.json +247 -235
- package/src/assets/v1.3.0/gnosis_safe_l2.json +247 -235
- package/src/assets/v1.3.0/multi_send.json +247 -235
- package/src/assets/v1.3.0/multi_send_call_only.json +247 -235
- package/src/assets/v1.3.0/proxy_factory.json +247 -235
- package/src/assets/v1.3.0/sign_message_lib.json +248 -236
- package/src/assets/v1.3.0/simulate_tx_accessor.json +247 -235
- package/src/assets/v1.4.1/compatibility_fallback_handler.json +114 -108
- package/src/assets/v1.4.1/create_call.json +114 -108
- package/src/assets/v1.4.1/multi_send.json +114 -108
- package/src/assets/v1.4.1/multi_send_call_only.json +114 -108
- package/src/assets/v1.4.1/safe.json +114 -108
- package/src/assets/v1.4.1/safe_l2.json +114 -108
- package/src/assets/v1.4.1/safe_proxy_factory.json +115 -109
- package/src/assets/v1.4.1/sign_message_lib.json +115 -109
- package/src/assets/v1.4.1/simulate_tx_accessor.json +114 -108
- package/src/factories.ts +14 -11
- package/src/handler.ts +24 -21
- package/src/index.ts +6 -6
- package/src/libs.ts +23 -31
- package/src/safes.ts +21 -19
- package/src/types.ts +84 -10
- package/src/utils.ts +50 -12
- 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": "
|
|
8
|
-
"5": "
|
|
9
|
-
"10": "
|
|
10
|
-
"25": "
|
|
11
|
-
"31": "
|
|
12
|
-
"40": "
|
|
13
|
-
"41": "
|
|
14
|
-
"56": "
|
|
15
|
-
"71": "
|
|
16
|
-
"97": "
|
|
17
|
-
"100": "
|
|
18
|
-
"137": "
|
|
19
|
-
"155": "
|
|
20
|
-
"169": "
|
|
21
|
-
"250": "
|
|
22
|
-
"252": "
|
|
23
|
-
"255": "
|
|
24
|
-
"336": "
|
|
25
|
-
"338": "
|
|
26
|
-
"369": "
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
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:
|
|
11
|
-
|
|
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
|
-
|
|
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:
|
|
9
|
-
DefaultCallbackHandler130
|
|
10
|
-
]
|
|
8
|
+
const defaultCallbackHandlerDeployments: SingletonDeploymentJSON[] = [DefaultCallbackHandler130];
|
|
11
9
|
|
|
12
10
|
export const getDefaultCallbackHandlerDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
13
|
-
|
|
14
|
-
}
|
|
11
|
+
return findDeployment(filter, defaultCallbackHandlerDeployments);
|
|
12
|
+
};
|
|
15
13
|
|
|
16
14
|
// This is a sorted array (by preference)
|
|
17
|
-
const compatFallbackHandlerDeployments:
|
|
18
|
-
CompatibilityFallbackHandler141,
|
|
19
|
-
|
|
15
|
+
const compatFallbackHandlerDeployments: SingletonDeploymentJSON[] = [
|
|
16
|
+
CompatibilityFallbackHandler141,
|
|
17
|
+
CompatibilityFallbackHandler130,
|
|
18
|
+
];
|
|
20
19
|
|
|
21
|
-
export const getCompatibilityFallbackHandlerDeployment = (
|
|
22
|
-
|
|
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:
|
|
27
|
-
CompatibilityFallbackHandler141,
|
|
28
|
-
|
|
27
|
+
const fallbackHandlerDeployments: SingletonDeploymentJSON[] = [
|
|
28
|
+
CompatibilityFallbackHandler141,
|
|
29
|
+
CompatibilityFallbackHandler130,
|
|
30
|
+
DefaultCallbackHandler130,
|
|
31
|
+
];
|
|
29
32
|
|
|
30
33
|
export const getFallbackHandlerDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
31
|
-
|
|
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:
|
|
15
|
-
MultiSend141, MultiSend130, MultiSend111
|
|
16
|
-
]
|
|
14
|
+
const multiSendDeployments: SingletonDeploymentJSON[] = [MultiSend141, MultiSend130, MultiSend111];
|
|
17
15
|
|
|
18
16
|
export const getMultiSendDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
19
|
-
|
|
20
|
-
}
|
|
17
|
+
return findDeployment(filter, multiSendDeployments);
|
|
18
|
+
};
|
|
21
19
|
|
|
22
20
|
// This is a sorted array (by preference)
|
|
23
|
-
const multiSendCallOnlyDeployments:
|
|
24
|
-
MultiSendCallOnly141, MultiSendCallOnly130
|
|
25
|
-
]
|
|
21
|
+
const multiSendCallOnlyDeployments: SingletonDeploymentJSON[] = [MultiSendCallOnly141, MultiSendCallOnly130];
|
|
26
22
|
|
|
27
23
|
export const getMultiSendCallOnlyDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
28
|
-
|
|
29
|
-
}
|
|
24
|
+
return findDeployment(filter, multiSendCallOnlyDeployments);
|
|
25
|
+
};
|
|
30
26
|
|
|
31
27
|
// This is a sorted array (by preference)
|
|
32
|
-
const createCallDeployments:
|
|
33
|
-
CreateCall141, CreateCall130
|
|
34
|
-
]
|
|
28
|
+
const createCallDeployments: SingletonDeploymentJSON[] = [CreateCall141, CreateCall130];
|
|
35
29
|
|
|
36
30
|
export const getCreateCallDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
37
|
-
|
|
38
|
-
}
|
|
31
|
+
return findDeployment(filter, createCallDeployments);
|
|
32
|
+
};
|
|
39
33
|
|
|
40
|
-
const signMessageLibDeployments:
|
|
41
|
-
SignMessageLib141, SignMessageLib130
|
|
42
|
-
]
|
|
34
|
+
const signMessageLibDeployments: SingletonDeploymentJSON[] = [SignMessageLib141, SignMessageLib130];
|
|
43
35
|
|
|
44
36
|
export const getSignMessageLibDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
45
|
-
|
|
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:
|
|
13
|
-
Safe141,
|
|
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
|
-
|
|
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:
|
|
22
|
-
SafeL2141, GnosisSafeL2130
|
|
23
|
-
]
|
|
25
|
+
export const _safeL2Deployments: SingletonDeploymentJSON[] = [SafeL2141, GnosisSafeL2130];
|
|
24
26
|
|
|
25
27
|
export const getSafeL2SingletonDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
26
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
7
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
+
};
|