@safe-global/safe-deployments 1.37.0 → 1.37.2
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 +150 -31
- package/dist/accessors.d.ts +14 -1
- package/dist/accessors.js +19 -11
- package/dist/assets/v1.0.0/gnosis_safe.json +479 -103
- package/dist/assets/v1.0.0/proxy_factory.json +11 -6
- package/dist/assets/v1.1.1/default_callback_handler.json +14 -9
- package/dist/assets/v1.1.1/gnosis_safe.json +14 -9
- package/dist/assets/v1.1.1/multi_send.json +14 -9
- package/dist/assets/v1.1.1/proxy_factory.json +14 -9
- package/dist/assets/v1.2.0/gnosis_safe.json +14 -9
- package/dist/assets/v1.3.0/compatibility_fallback_handler.json +259 -235
- package/dist/assets/v1.3.0/create_call.json +259 -235
- package/dist/assets/v1.3.0/gnosis_safe.json +259 -235
- package/dist/assets/v1.3.0/gnosis_safe_l2.json +259 -235
- package/dist/assets/v1.3.0/multi_send.json +259 -235
- package/dist/assets/v1.3.0/multi_send_call_only.json +259 -235
- package/dist/assets/v1.3.0/proxy_factory.json +259 -235
- package/dist/assets/v1.3.0/sign_message_lib.json +260 -236
- package/dist/assets/v1.3.0/simulate_tx_accessor.json +259 -235
- package/dist/assets/v1.4.1/compatibility_fallback_handler.json +119 -108
- package/dist/assets/v1.4.1/create_call.json +119 -108
- package/dist/assets/v1.4.1/multi_send.json +119 -108
- package/dist/assets/v1.4.1/multi_send_call_only.json +119 -108
- package/dist/assets/v1.4.1/safe.json +119 -108
- package/dist/assets/v1.4.1/safe_l2.json +119 -108
- package/dist/assets/v1.4.1/safe_proxy_factory.json +120 -109
- package/dist/assets/v1.4.1/sign_message_lib.json +120 -109
- package/dist/assets/v1.4.1/simulate_tx_accessor.json +119 -108
- package/dist/deployments.d.ts +12 -0
- package/dist/deployments.js +71 -0
- package/dist/factories.d.ts +12 -1
- package/dist/factories.js +17 -13
- package/dist/handler.d.ts +29 -1
- package/dist/handler.js +55 -24
- package/dist/libs.d.ts +45 -1
- package/dist/libs.js +62 -32
- package/dist/safes.d.ts +23 -3
- package/dist/safes.js +32 -21
- package/dist/types.d.ts +37 -2
- package/dist/utils.d.ts +12 -2
- package/dist/utils.js +61 -9
- package/package.json +18 -19
- package/src/__tests__/assets/v1/v1.0.0/gnosis_safe.json +796 -0
- package/src/__tests__/assets/v1/v1.0.0/proxy_factory.json +111 -0
- package/src/__tests__/assets/v1/v1.1.1/create_and_add_modules.json +59 -0
- package/src/__tests__/assets/v1/v1.1.1/create_call.json +90 -0
- package/src/__tests__/assets/v1/v1.1.1/default_callback_handler.json +212 -0
- package/src/__tests__/assets/v1/v1.1.1/gnosis_safe.json +1001 -0
- package/src/__tests__/assets/v1/v1.1.1/multi_send.json +45 -0
- package/src/__tests__/assets/v1/v1.1.1/proxy_factory.json +191 -0
- package/src/__tests__/assets/v1/v1.2.0/gnosis_safe.json +1022 -0
- package/src/__tests__/assets/v1/v1.3.0/compatibility_fallback_handler.json +588 -0
- package/src/__tests__/assets/v1/v1.3.0/create_call.json +331 -0
- package/src/__tests__/assets/v1/v1.3.0/gnosis_safe.json +1296 -0
- package/src/__tests__/assets/v1/v1.3.0/gnosis_safe_l2.json +1401 -0
- package/src/__tests__/assets/v1/v1.3.0/multi_send.json +283 -0
- package/src/__tests__/assets/v1/v1.3.0/multi_send_call_only.json +278 -0
- package/src/__tests__/assets/v1/v1.3.0/proxy_factory.json +426 -0
- package/src/__tests__/assets/v1/v1.3.0/sign_message_lib.json +310 -0
- package/src/__tests__/assets/v1/v1.3.0/simulate_tx_accessor.json +314 -0
- package/src/__tests__/assets/v1/v1.4.1/compatibility_fallback_handler.json +447 -0
- package/src/__tests__/assets/v1/v1.4.1/create_call.json +192 -0
- package/src/__tests__/assets/v1/v1.4.1/multi_send.json +144 -0
- package/src/__tests__/assets/v1/v1.4.1/multi_send_call_only.json +139 -0
- package/src/__tests__/assets/v1/v1.4.1/safe.json +1123 -0
- package/src/__tests__/assets/v1/v1.4.1/safe_l2.json +1228 -0
- package/src/__tests__/assets/v1/v1.4.1/safe_proxy_factory.json +263 -0
- package/src/__tests__/assets/v1/v1.4.1/sign_message_lib.json +171 -0
- package/src/__tests__/assets/v1/v1.4.1/simulate_tx_accessor.json +175 -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 +421 -0
- package/src/accessors.ts +21 -12
- package/src/assets/v1.0.0/gnosis_safe.json +479 -103
- package/src/assets/v1.0.0/proxy_factory.json +11 -6
- package/src/assets/v1.1.1/create_and_add_modules.json +19 -10
- package/src/assets/v1.1.1/create_call.json +14 -9
- package/src/assets/v1.1.1/default_callback_handler.json +14 -9
- package/src/assets/v1.1.1/gnosis_safe.json +14 -9
- package/src/assets/v1.1.1/multi_send.json +14 -9
- package/src/assets/v1.1.1/proxy_factory.json +14 -9
- package/src/assets/v1.2.0/gnosis_safe.json +14 -9
- package/src/assets/v1.3.0/compatibility_fallback_handler.json +259 -235
- package/src/assets/v1.3.0/create_call.json +259 -235
- package/src/assets/v1.3.0/gnosis_safe.json +259 -235
- package/src/assets/v1.3.0/gnosis_safe_l2.json +259 -235
- package/src/assets/v1.3.0/multi_send.json +259 -235
- package/src/assets/v1.3.0/multi_send_call_only.json +259 -235
- package/src/assets/v1.3.0/proxy_factory.json +259 -235
- package/src/assets/v1.3.0/sign_message_lib.json +260 -236
- package/src/assets/v1.3.0/simulate_tx_accessor.json +259 -235
- package/src/assets/v1.4.1/compatibility_fallback_handler.json +119 -108
- package/src/assets/v1.4.1/create_call.json +119 -108
- package/src/assets/v1.4.1/multi_send.json +119 -108
- package/src/assets/v1.4.1/multi_send_call_only.json +119 -108
- package/src/assets/v1.4.1/safe.json +119 -108
- package/src/assets/v1.4.1/safe_l2.json +119 -108
- package/src/assets/v1.4.1/safe_proxy_factory.json +120 -109
- package/src/assets/v1.4.1/sign_message_lib.json +120 -109
- package/src/assets/v1.4.1/simulate_tx_accessor.json +119 -108
- package/src/deployments.ts +90 -0
- package/src/factories.ts +19 -14
- package/src/handler.ts +62 -26
- package/src/index.ts +6 -6
- package/src/libs.ts +69 -35
- package/src/safes.ts +34 -22
- package/src/types.ts +86 -10
- package/src/utils.ts +105 -12
- package/src/__tests__/utilts.test.ts +0 -385
package/README.md
CHANGED
|
@@ -3,87 +3,206 @@
|
|
|
3
3
|
[](https://badge.fury.io/js/%40safe-global%2Fsafe-deployments)
|
|
4
4
|
[](https://github.com/safe-global/safe-deployments/actions/workflows/test.yml)
|
|
5
5
|
|
|
6
|
-
This contract contains a collection of deployments of the contract of the [Safe contracts repository](https://github.com/safe-global/safe-
|
|
6
|
+
This contract contains a collection of deployments of the contract of the [Safe contracts repository](https://github.com/safe-global/safe-smart-account).
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The addresses on the different networks and the abi files are available for each deployment. To get an overview of the available versions, check the available [json assets](./src/assets/).
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Adding additional deployments:
|
|
11
|
+
|
|
12
|
+
1. Follow the [deployment steps in the Safe contract repository](https://github.com/safe-global/safe-smart-contracts#deployments).
|
|
13
|
+
2. Verify that the addresses match the expected address for each contract. You can find them under the "addresses" mapping in the respective JSON file in the [assets folder](./src/assets/).
|
|
14
|
+
3. Create a PR adding the new deployment. Example PR can be found [here](https://github.com/safe-global/safe-deployments/pull/676).
|
|
11
15
|
|
|
12
16
|
## Install
|
|
17
|
+
|
|
13
18
|
- npm - `npm i @safe-global/safe-deployments`
|
|
14
19
|
- yarn - `yarn add @safe-global/safe-deployments`
|
|
15
20
|
|
|
16
21
|
## Usage
|
|
17
22
|
|
|
18
|
-
It is possible to directly use the
|
|
23
|
+
It is possible to directly use the JSON files in the [assets folder](./src/assets/) that contain the addresses and ABI definitions.
|
|
19
24
|
|
|
20
|
-
An alternative is
|
|
25
|
+
An alternative is using JavaScript library methods to query the correct deployment. The library supports different methods to get the deployment of a specific contract.
|
|
21
26
|
|
|
22
|
-
Each of the
|
|
27
|
+
Each of the methods takes an optional `DeploymentFilter` as a parameter.
|
|
23
28
|
|
|
24
29
|
```ts
|
|
25
30
|
interface DeploymentFilter {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
version?: string;
|
|
32
|
+
released?: boolean; // Defaults to true if no filter is specified
|
|
33
|
+
network?: string; // Chain id of the network
|
|
29
34
|
}
|
|
30
35
|
```
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
### V1 Methods (single deployments)
|
|
38
|
+
|
|
39
|
+
Those methods will return a `SingletonDeployment` object or `undefined` if no deployment was found for the specified filter.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
export interface SingletonDeployment {
|
|
43
|
+
// The default address of the deployment.
|
|
44
|
+
defaultAddress: string;
|
|
45
|
+
|
|
46
|
+
// Indicates if the deployment is released.
|
|
47
|
+
released: boolean;
|
|
48
|
+
|
|
49
|
+
// The name of the contract.
|
|
50
|
+
contractName: string;
|
|
51
|
+
|
|
52
|
+
// The version of the deployment.
|
|
53
|
+
version: string;
|
|
54
|
+
|
|
55
|
+
// The address & hash of the contract code, where the key is the deployment type.
|
|
56
|
+
// There could be multiple deployment types: canonical, eip155, zksync
|
|
57
|
+
// Possible addresses per version:
|
|
58
|
+
// 1.0.0: canonical
|
|
59
|
+
// 1.1.1: canonical
|
|
60
|
+
// 1.2.0: canonical
|
|
61
|
+
// 1.3.0: canonical, eip155, zksync
|
|
62
|
+
// 1.4.1: canonical, zksync
|
|
63
|
+
// Ex: deployments: { "canonical": { "codeHash": "0x1234", "address": "0x5678"}}
|
|
64
|
+
deployments: Record<string, { address: string; codeHash: string }>;
|
|
65
|
+
|
|
66
|
+
// A record of network addresses, where the key is the network identifier and the value is the address.
|
|
67
|
+
networkAddresses: Record<string, string>;
|
|
68
|
+
|
|
69
|
+
// The ABI (Application Binary Interface) of the contract.
|
|
70
|
+
abi: any[];
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- Safe
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
const safeSingleton = getSafeSingletonDeployment();
|
|
78
|
+
|
|
79
|
+
// Returns latest contract version, even if not finally released yet
|
|
80
|
+
const safeSingletonNightly = getSafeSingletonDeployment({ released: undefined });
|
|
81
|
+
|
|
82
|
+
// Returns released contract version for specific network
|
|
83
|
+
const safeSingletonGörli = getSafeSingletonDeployment({ network: '5' });
|
|
84
|
+
|
|
85
|
+
// Returns released contract version for specific version
|
|
86
|
+
const safeSingleton100 = getSafeSingletonDeployment({ version: '1.0.0' });
|
|
87
|
+
|
|
88
|
+
// Version with additional events used on L2 networks
|
|
89
|
+
const safeL2Singleton = getSafeL2SingletonDeployment();
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- Factories
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const proxyFactory = getProxyFactoryDeployment();
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- Libraries
|
|
33
99
|
|
|
34
100
|
```ts
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
101
|
+
const multiSendLib = getMultiSendDeployment();
|
|
102
|
+
|
|
103
|
+
const multiSendCallOnlyLib = getMultiSendCallOnlyDeployment();
|
|
104
|
+
|
|
105
|
+
const createCallLib = getCreateCallDeployment();
|
|
106
|
+
|
|
107
|
+
const signMessageLib = getSignMessageLibDeployment();
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- Handler
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
|
|
114
|
+
const callbackHandler = getDefaultCallbackHandlerDeployment();
|
|
115
|
+
|
|
116
|
+
const compatHandler = getCompatibilityFallbackHandlerDeployment();
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### V2 Methods (multiple deployments)
|
|
120
|
+
|
|
121
|
+
We added a new methods that allow multiple deployment addresses for a contract.
|
|
122
|
+
|
|
123
|
+
Those methods will return a `SingletonDeployment` object or `undefined` if no deployment was found for the specified filter. Notice the difference in the `networkAddresses` field.
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
export interface SingletonDeployment {
|
|
127
|
+
// The default address of the deployment.
|
|
128
|
+
defaultAddress: string;
|
|
129
|
+
|
|
130
|
+
// Indicates if the deployment is released.
|
|
131
|
+
released: boolean;
|
|
132
|
+
|
|
133
|
+
// The name of the contract.
|
|
134
|
+
contractName: string;
|
|
135
|
+
|
|
136
|
+
// The version of the deployment.
|
|
137
|
+
version: string;
|
|
138
|
+
|
|
139
|
+
// The address & hash of the contract code, where the key is the deployment type.
|
|
140
|
+
// There could be multiple deployment types: canonical, eip155, zksync
|
|
141
|
+
// Possible addresses per version:
|
|
142
|
+
// 1.0.0: canonical
|
|
143
|
+
// 1.1.1: canonical
|
|
144
|
+
// 1.2.0: canonical
|
|
145
|
+
// 1.3.0: canonical, eip155, zksync
|
|
146
|
+
// 1.4.1: canonical, zksync
|
|
147
|
+
// Ex: deployments: { "canonical": { "codeHash": "0x1234", "address": "0x5678"}}
|
|
148
|
+
deployments: Record<string, { address: string; codeHash: string }>;
|
|
149
|
+
|
|
150
|
+
// A record of network addresses, where the key is the network identifier and the value is the address.
|
|
151
|
+
networkAddresses: Record<string, string | string[]>;
|
|
152
|
+
|
|
153
|
+
// The ABI (Application Binary Interface) of the contract.
|
|
154
|
+
abi: any[];
|
|
42
155
|
}
|
|
43
156
|
```
|
|
44
157
|
|
|
45
158
|
- Safe
|
|
159
|
+
|
|
46
160
|
```ts
|
|
47
|
-
const safeSingleton =
|
|
161
|
+
const safeSingleton = getSafeSingletonDeployments();
|
|
48
162
|
|
|
49
163
|
// Returns latest contract version, even if not finally released yet
|
|
50
|
-
const safeSingletonNightly =
|
|
164
|
+
const safeSingletonNightly = getSafeSingletonDeployments({ released: undefined });
|
|
51
165
|
|
|
52
166
|
// Returns released contract version for specific network
|
|
53
|
-
const safeSingletonGörli =
|
|
167
|
+
const safeSingletonGörli = getSafeSingletonDeployments({ network: '5' });
|
|
54
168
|
|
|
55
169
|
// Returns released contract version for specific version
|
|
56
|
-
const safeSingleton100 =
|
|
170
|
+
const safeSingleton100 = getSafeSingletonDeployments({ version: '1.0.0' });
|
|
57
171
|
|
|
58
172
|
// Version with additional events used on L2 networks
|
|
59
|
-
const safeL2Singleton =
|
|
173
|
+
const safeL2Singleton = getSafeL2SingletonDeployments();
|
|
60
174
|
```
|
|
61
175
|
|
|
62
176
|
- Factories
|
|
177
|
+
|
|
63
178
|
```ts
|
|
64
|
-
const proxyFactory =
|
|
179
|
+
const proxyFactory = getProxyFactoryDeployments();
|
|
65
180
|
```
|
|
66
181
|
|
|
67
182
|
- Libraries
|
|
183
|
+
|
|
68
184
|
```ts
|
|
69
|
-
const multiSendLib =
|
|
185
|
+
const multiSendLib = getMultiSendDeployments();
|
|
186
|
+
|
|
187
|
+
const multiSendCallOnlyLib = getMultiSendCallOnlyDeployments();
|
|
70
188
|
|
|
71
|
-
const
|
|
189
|
+
const createCallLib = getCreateCallDeployments();
|
|
72
190
|
|
|
73
|
-
const
|
|
191
|
+
const signMessageLib = getSignMessageLibDeployments();
|
|
74
192
|
```
|
|
75
193
|
|
|
76
194
|
- Handler
|
|
195
|
+
|
|
77
196
|
```ts
|
|
78
|
-
// Returns recommended handler
|
|
79
|
-
const fallbackHandler = getFallbackHandlerDeployment()
|
|
80
197
|
|
|
81
|
-
const callbackHandler =
|
|
198
|
+
const callbackHandler = getDefaultCallbackHandlerDeployments();
|
|
82
199
|
|
|
83
|
-
const compatHandler =
|
|
200
|
+
const compatHandler = getCompatibilityFallbackHandlerDeployments();
|
|
84
201
|
```
|
|
202
|
+
|
|
85
203
|
## Release cycle
|
|
86
|
-
|
|
204
|
+
|
|
205
|
+
`safe-deployments` release cycle is once per month, except for urgent issues that require immediate attention.
|
|
87
206
|
|
|
88
207
|
## Notes
|
|
89
208
|
|
package/dist/accessors.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import { DeploymentFilter, SingletonDeployment } from './types';
|
|
1
|
+
import { DeploymentFilter, SingletonDeployment, SingletonDeploymentV2 } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves a single simulate transaction accessor deployment based on the provided filter.
|
|
4
|
+
*
|
|
5
|
+
* @param {DeploymentFilter} [filter] - Optional filter to apply when searching for the deployment.
|
|
6
|
+
* @returns {SingletonDeployment | undefined} - The found deployment or undefined if no deployment matches the filter.
|
|
7
|
+
*/
|
|
2
8
|
export declare const getSimulateTxAccessorDeployment: (filter?: DeploymentFilter) => SingletonDeployment | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves multiple simulate transaction accessor deployments based on the provided filter.
|
|
11
|
+
*
|
|
12
|
+
* @param {DeploymentFilter} [filter] - Optional filter to apply when searching for the deployments.
|
|
13
|
+
* @returns {SingletonDeploymentV2 | undefined} - The found deployments in the specified format or undefined if no deployments match the filter.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getSimulateTxAccessorDeployments: (filter?: DeploymentFilter) => SingletonDeploymentV2 | undefined;
|
package/dist/accessors.js
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getSimulateTxAccessorDeployment = void 0;
|
|
7
|
-
const simulate_tx_accessor_json_1 = __importDefault(require("./assets/v1.3.0/simulate_tx_accessor.json"));
|
|
8
|
-
const simulate_tx_accessor_json_2 = __importDefault(require("./assets/v1.4.1/simulate_tx_accessor.json"));
|
|
3
|
+
exports.getSimulateTxAccessorDeployments = exports.getSimulateTxAccessorDeployment = void 0;
|
|
9
4
|
const utils_1 = require("./utils");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const deployments_1 = require("./deployments");
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves a single simulate transaction accessor deployment based on the provided filter.
|
|
8
|
+
*
|
|
9
|
+
* @param {DeploymentFilter} [filter] - Optional filter to apply when searching for the deployment.
|
|
10
|
+
* @returns {SingletonDeployment | undefined} - The found deployment or undefined if no deployment matches the filter.
|
|
11
|
+
*/
|
|
14
12
|
const getSimulateTxAccessorDeployment = (filter) => {
|
|
15
|
-
return (0, utils_1.findDeployment)(filter,
|
|
13
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._ACCESSOR_DEPLOYMENTS);
|
|
16
14
|
};
|
|
17
15
|
exports.getSimulateTxAccessorDeployment = getSimulateTxAccessorDeployment;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves multiple simulate transaction accessor deployments based on the provided filter.
|
|
18
|
+
*
|
|
19
|
+
* @param {DeploymentFilter} [filter] - Optional filter to apply when searching for the deployments.
|
|
20
|
+
* @returns {SingletonDeploymentV2 | undefined} - The found deployments in the specified format or undefined if no deployments match the filter.
|
|
21
|
+
*/
|
|
22
|
+
const getSimulateTxAccessorDeployments = (filter) => {
|
|
23
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._ACCESSOR_DEPLOYMENTS, "multiple" /* DeploymentFormats.MULTIPLE */);
|
|
24
|
+
};
|
|
25
|
+
exports.getSimulateTxAccessorDeployments = getSimulateTxAccessorDeployments;
|