@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/dist/libs.js
CHANGED
|
@@ -1,47 +1,77 @@
|
|
|
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.getSignMessageLibDeployment = exports.getCreateCallDeployment = exports.getMultiSendCallOnlyDeployment = exports.getMultiSendDeployment = void 0;
|
|
7
|
-
const
|
|
8
|
-
const create_call_json_2 = __importDefault(require("./assets/v1.4.1/create_call.json"));
|
|
9
|
-
const multi_send_json_1 = __importDefault(require("./assets/v1.1.1/multi_send.json"));
|
|
10
|
-
const multi_send_json_2 = __importDefault(require("./assets/v1.3.0/multi_send.json"));
|
|
11
|
-
const multi_send_json_3 = __importDefault(require("./assets/v1.4.1/multi_send.json"));
|
|
12
|
-
const multi_send_call_only_json_1 = __importDefault(require("./assets/v1.3.0/multi_send_call_only.json"));
|
|
13
|
-
const multi_send_call_only_json_2 = __importDefault(require("./assets/v1.4.1/multi_send_call_only.json"));
|
|
14
|
-
const sign_message_lib_json_1 = __importDefault(require("./assets/v1.3.0/sign_message_lib.json"));
|
|
15
|
-
const sign_message_lib_json_2 = __importDefault(require("./assets/v1.4.1/sign_message_lib.json"));
|
|
3
|
+
exports.getSignMessageLibDeployments = exports.getSignMessageLibDeployment = exports.getCreateCallDeployments = exports.getCreateCallDeployment = exports.getMultiSendCallOnlyDeployments = exports.getMultiSendCallOnlyDeployment = exports.getMultiSendDeployments = exports.getMultiSendDeployment = void 0;
|
|
4
|
+
const deployments_1 = require("./deployments");
|
|
16
5
|
const utils_1 = require("./utils");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Get the MultiSend deployment based on the provided filter.
|
|
8
|
+
* @param {DeploymentFilter} [filter] - The filter criteria for the deployment.
|
|
9
|
+
* @returns {SingletonDeployment | undefined} - The matched deployment or undefined if not found.
|
|
10
|
+
*/
|
|
21
11
|
const getMultiSendDeployment = (filter) => {
|
|
22
|
-
return (0, utils_1.findDeployment)(filter,
|
|
12
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._MULTI_SEND_DEPLOYMENTS);
|
|
23
13
|
};
|
|
24
14
|
exports.getMultiSendDeployment = getMultiSendDeployment;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Get all MultiSend deployments based on the provided filter.
|
|
17
|
+
* @param {DeploymentFilter} [filter] - The filter criteria for the deployments.
|
|
18
|
+
* @returns {SingletonDeploymentV2 | undefined} - The matched deployments or undefined if not found.
|
|
19
|
+
*/
|
|
20
|
+
const getMultiSendDeployments = (filter) => {
|
|
21
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._MULTI_SEND_DEPLOYMENTS, "multiple" /* DeploymentFormats.MULTIPLE */);
|
|
22
|
+
};
|
|
23
|
+
exports.getMultiSendDeployments = getMultiSendDeployments;
|
|
24
|
+
/**
|
|
25
|
+
* Get the MultiSendCallOnly deployment based on the provided filter.
|
|
26
|
+
* @param {DeploymentFilter} [filter] - The filter criteria for the deployment.
|
|
27
|
+
* @returns {SingletonDeployment | undefined} - The matched deployment or undefined if not found.
|
|
28
|
+
*/
|
|
29
29
|
const getMultiSendCallOnlyDeployment = (filter) => {
|
|
30
|
-
return (0, utils_1.findDeployment)(filter,
|
|
30
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._MULTI_SEND_CALL_ONLY_DEPLOYMENTS);
|
|
31
31
|
};
|
|
32
32
|
exports.getMultiSendCallOnlyDeployment = getMultiSendCallOnlyDeployment;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Get all MultiSendCallOnly deployments based on the provided filter.
|
|
35
|
+
* @param {DeploymentFilter} [filter] - The filter criteria for the deployments.
|
|
36
|
+
* @returns {SingletonDeploymentV2 | undefined} - The matched deployments or undefined if not found.
|
|
37
|
+
*/
|
|
38
|
+
const getMultiSendCallOnlyDeployments = (filter) => {
|
|
39
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._MULTI_SEND_CALL_ONLY_DEPLOYMENTS, "multiple" /* DeploymentFormats.MULTIPLE */);
|
|
40
|
+
};
|
|
41
|
+
exports.getMultiSendCallOnlyDeployments = getMultiSendCallOnlyDeployments;
|
|
42
|
+
/**
|
|
43
|
+
* Get the CreateCall deployment based on the provided filter.
|
|
44
|
+
* @param {DeploymentFilter} [filter] - The filter criteria for the deployment.
|
|
45
|
+
* @returns {SingletonDeployment | undefined} - The matched deployment or undefined if not found.
|
|
46
|
+
*/
|
|
37
47
|
const getCreateCallDeployment = (filter) => {
|
|
38
|
-
return (0, utils_1.findDeployment)(filter,
|
|
48
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._CREATE_CALL_DEPLOYMENTS);
|
|
39
49
|
};
|
|
40
50
|
exports.getCreateCallDeployment = getCreateCallDeployment;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
]
|
|
51
|
+
/**
|
|
52
|
+
* Get all CreateCall deployments based on the provided filter.
|
|
53
|
+
* @param {DeploymentFilter} [filter] - The filter criteria for the deployments.
|
|
54
|
+
* @returns {SingletonDeploymentV2 | undefined} - The matched deployments or undefined if not found.
|
|
55
|
+
*/
|
|
56
|
+
const getCreateCallDeployments = (filter) => {
|
|
57
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._CREATE_CALL_DEPLOYMENTS, "multiple" /* DeploymentFormats.MULTIPLE */);
|
|
58
|
+
};
|
|
59
|
+
exports.getCreateCallDeployments = getCreateCallDeployments;
|
|
60
|
+
/**
|
|
61
|
+
* Get the SignMessageLib deployment based on the provided filter.
|
|
62
|
+
* @param {DeploymentFilter} [filter] - The filter criteria for the deployment.
|
|
63
|
+
* @returns {SingletonDeployment | undefined} - The matched deployment or undefined if not found.
|
|
64
|
+
*/
|
|
44
65
|
const getSignMessageLibDeployment = (filter) => {
|
|
45
|
-
return (0, utils_1.findDeployment)(filter,
|
|
66
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._SIGN_MESSAGE_LIB_DEPLOYMENTS);
|
|
46
67
|
};
|
|
47
68
|
exports.getSignMessageLibDeployment = getSignMessageLibDeployment;
|
|
69
|
+
/**
|
|
70
|
+
* Get all SignMessageLib deployments based on the provided filter.
|
|
71
|
+
* @param {DeploymentFilter} [filter] - The filter criteria for the deployments.
|
|
72
|
+
* @returns {SingletonDeploymentV2 | undefined} - The matched deployments or undefined if not found.
|
|
73
|
+
*/
|
|
74
|
+
const getSignMessageLibDeployments = (filter) => {
|
|
75
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._SIGN_MESSAGE_LIB_DEPLOYMENTS, "multiple" /* DeploymentFormats.MULTIPLE */);
|
|
76
|
+
};
|
|
77
|
+
exports.getSignMessageLibDeployments = getSignMessageLibDeployments;
|
package/dist/safes.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
import { DeploymentFilter, SingletonDeployment } from './types';
|
|
2
|
-
|
|
1
|
+
import { DeploymentFilter, SingletonDeployment, SingletonDeploymentV2 } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Finds the latest safe singleton deployment that matches the given filter.
|
|
4
|
+
* @param {DeploymentFilter} [filter] - The filter to apply when searching for the deployment.
|
|
5
|
+
* @returns {SingletonDeployment | undefined} - The found deployment or undefined if no deployment matches the filter.
|
|
6
|
+
*/
|
|
3
7
|
export declare const getSafeSingletonDeployment: (filter?: DeploymentFilter) => SingletonDeployment | undefined;
|
|
4
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Finds all safe singleton deployments that match the given filter.
|
|
10
|
+
* @param {DeploymentFilter} [filter] - The filter to apply when searching for the deployments.
|
|
11
|
+
* @returns {SingletonDeploymentV2 | undefined} - The found deployments or undefined if no deployments match the filter.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getSafeSingletonDeployments: (filter?: DeploymentFilter) => SingletonDeploymentV2 | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Finds the latest safe L2 singleton deployment that matches the given filter.
|
|
16
|
+
* @param {DeploymentFilter} [filter] - The filter to apply when searching for the deployment.
|
|
17
|
+
* @returns {SingletonDeployment | undefined} - The found deployment or undefined if no deployment matches the filter.
|
|
18
|
+
*/
|
|
5
19
|
export declare const getSafeL2SingletonDeployment: (filter?: DeploymentFilter) => SingletonDeployment | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Finds all safe L2 singleton deployments that match the given filter.
|
|
22
|
+
* @param {DeploymentFilter} [filter] - The filter to apply when searching for the deployments.
|
|
23
|
+
* @returns {SingletonDeploymentV2 | undefined} - The found deployments or undefined if no deployments match the filter.
|
|
24
|
+
*/
|
|
25
|
+
export declare const getSafeL2SingletonDeployments: (filter?: DeploymentFilter) => SingletonDeploymentV2 | undefined;
|
package/dist/safes.js
CHANGED
|
@@ -1,30 +1,41 @@
|
|
|
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.
|
|
7
|
-
const
|
|
8
|
-
const safe_json_1 = __importDefault(require("./assets/v1.4.1/safe.json"));
|
|
9
|
-
const gnosis_safe_l2_json_1 = __importDefault(require("./assets/v1.3.0/gnosis_safe_l2.json"));
|
|
10
|
-
const gnosis_safe_json_1 = __importDefault(require("./assets/v1.3.0/gnosis_safe.json"));
|
|
11
|
-
const gnosis_safe_json_2 = __importDefault(require("./assets/v1.2.0/gnosis_safe.json"));
|
|
12
|
-
const gnosis_safe_json_3 = __importDefault(require("./assets/v1.1.1/gnosis_safe.json"));
|
|
13
|
-
const gnosis_safe_json_4 = __importDefault(require("./assets/v1.0.0/gnosis_safe.json"));
|
|
3
|
+
exports.getSafeL2SingletonDeployments = exports.getSafeL2SingletonDeployment = exports.getSafeSingletonDeployments = exports.getSafeSingletonDeployment = void 0;
|
|
4
|
+
const deployments_1 = require("./deployments");
|
|
14
5
|
const utils_1 = require("./utils");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Finds the latest safe singleton deployment that matches the given filter.
|
|
8
|
+
* @param {DeploymentFilter} [filter] - The filter to apply when searching for the deployment.
|
|
9
|
+
* @returns {SingletonDeployment | undefined} - The found deployment or undefined if no deployment matches the filter.
|
|
10
|
+
*/
|
|
19
11
|
const getSafeSingletonDeployment = (filter) => {
|
|
20
|
-
return (0, utils_1.findDeployment)(filter,
|
|
12
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._SAFE_DEPLOYMENTS);
|
|
21
13
|
};
|
|
22
14
|
exports.getSafeSingletonDeployment = getSafeSingletonDeployment;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Finds all safe singleton deployments that match the given filter.
|
|
17
|
+
* @param {DeploymentFilter} [filter] - The filter to apply when searching for the deployments.
|
|
18
|
+
* @returns {SingletonDeploymentV2 | undefined} - The found deployments or undefined if no deployments match the filter.
|
|
19
|
+
*/
|
|
20
|
+
const getSafeSingletonDeployments = (filter) => {
|
|
21
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._SAFE_DEPLOYMENTS, "multiple" /* DeploymentFormats.MULTIPLE */);
|
|
22
|
+
};
|
|
23
|
+
exports.getSafeSingletonDeployments = getSafeSingletonDeployments;
|
|
24
|
+
/**
|
|
25
|
+
* Finds the latest safe L2 singleton deployment that matches the given filter.
|
|
26
|
+
* @param {DeploymentFilter} [filter] - The filter to apply when searching for the deployment.
|
|
27
|
+
* @returns {SingletonDeployment | undefined} - The found deployment or undefined if no deployment matches the filter.
|
|
28
|
+
*/
|
|
27
29
|
const getSafeL2SingletonDeployment = (filter) => {
|
|
28
|
-
return (0, utils_1.findDeployment)(filter,
|
|
30
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._SAFE_L2_DEPLOYMENTS);
|
|
29
31
|
};
|
|
30
32
|
exports.getSafeL2SingletonDeployment = getSafeL2SingletonDeployment;
|
|
33
|
+
/**
|
|
34
|
+
* Finds all safe L2 singleton deployments that match the given filter.
|
|
35
|
+
* @param {DeploymentFilter} [filter] - The filter to apply when searching for the deployments.
|
|
36
|
+
* @returns {SingletonDeploymentV2 | undefined} - The found deployments or undefined if no deployments match the filter.
|
|
37
|
+
*/
|
|
38
|
+
const getSafeL2SingletonDeployments = (filter) => {
|
|
39
|
+
return (0, utils_1.findDeployment)(filter, deployments_1._SAFE_L2_DEPLOYMENTS, "multiple" /* DeploymentFormats.MULTIPLE */);
|
|
40
|
+
};
|
|
41
|
+
exports.getSafeL2SingletonDeployments = getSafeL2SingletonDeployments;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,13 +1,48 @@
|
|
|
1
|
+
export type AddressType = 'canonical' | 'eip155' | 'zksync';
|
|
2
|
+
export declare const enum DeploymentFormats {
|
|
3
|
+
SINGLETON = "singleton",
|
|
4
|
+
MULTIPLE = "multiple"
|
|
5
|
+
}
|
|
6
|
+
type AtLeastOne<T, U = {
|
|
7
|
+
[K in keyof T]: Pick<T, K>;
|
|
8
|
+
}> = Partial<T> & U[keyof U];
|
|
9
|
+
export interface SingletonDeploymentJSON {
|
|
10
|
+
released: boolean;
|
|
11
|
+
contractName: string;
|
|
12
|
+
version: string;
|
|
13
|
+
deployments: AtLeastOne<Record<AddressType, {
|
|
14
|
+
address: string;
|
|
15
|
+
codeHash: string;
|
|
16
|
+
}>>;
|
|
17
|
+
networkAddresses: Record<string, AddressType | AddressType[]>;
|
|
18
|
+
abi: any[];
|
|
19
|
+
}
|
|
1
20
|
export interface SingletonDeployment {
|
|
2
21
|
defaultAddress: string;
|
|
22
|
+
released: boolean;
|
|
23
|
+
contractName: string;
|
|
3
24
|
version: string;
|
|
4
|
-
|
|
25
|
+
deployments: AtLeastOne<Record<AddressType, {
|
|
26
|
+
address: string;
|
|
27
|
+
codeHash: string;
|
|
28
|
+
}>>;
|
|
5
29
|
networkAddresses: Record<string, string>;
|
|
6
|
-
|
|
30
|
+
abi: any[];
|
|
31
|
+
}
|
|
32
|
+
export interface SingletonDeploymentV2 {
|
|
7
33
|
released: boolean;
|
|
34
|
+
contractName: string;
|
|
35
|
+
version: string;
|
|
36
|
+
deployments: AtLeastOne<Record<AddressType, {
|
|
37
|
+
address: string;
|
|
38
|
+
codeHash: string;
|
|
39
|
+
}>>;
|
|
40
|
+
abi: any[];
|
|
41
|
+
networkAddresses: Record<string, string | string[]>;
|
|
8
42
|
}
|
|
9
43
|
export interface DeploymentFilter {
|
|
10
44
|
version?: string;
|
|
11
45
|
released?: boolean;
|
|
12
46
|
network?: string;
|
|
13
47
|
}
|
|
48
|
+
export {};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import { DeploymentFilter, SingletonDeployment } from './types';
|
|
2
|
-
|
|
1
|
+
import { DeploymentFilter, SingletonDeployment, SingletonDeploymentJSON, DeploymentFormats, SingletonDeploymentV2 } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Finds a deployment that matches the given criteria.
|
|
4
|
+
* This function is implemented as a regular function to allow for overloading: https://github.com/microsoft/TypeScript/issues/33482
|
|
5
|
+
*
|
|
6
|
+
* @param {DeploymentFilter} [criteria=DEFAULT_FILTER] - The filter criteria to match deployments.
|
|
7
|
+
* @param {SingletonDeploymentJSON[]} deployments - The list of deployment JSON objects to search.
|
|
8
|
+
* @returns {SingletonDeployment | undefined} - The found deployment object or undefined if no match is found.
|
|
9
|
+
*/
|
|
10
|
+
declare function findDeployment(criteria: DeploymentFilter | undefined, deployments: SingletonDeploymentJSON[], format?: DeploymentFormats.SINGLETON): SingletonDeployment | undefined;
|
|
11
|
+
declare function findDeployment(criteria: DeploymentFilter | undefined, deployments: SingletonDeploymentJSON[], format: DeploymentFormats.MULTIPLE): SingletonDeploymentV2 | undefined;
|
|
12
|
+
export { findDeployment };
|
package/dist/utils.js
CHANGED
|
@@ -3,19 +3,71 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.findDeployment =
|
|
6
|
+
exports.findDeployment = findDeployment;
|
|
7
7
|
const satisfies_1 = __importDefault(require("semver/functions/satisfies"));
|
|
8
8
|
const DEFAULT_FILTER = { released: true };
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
// The older JSON format had a `defaultAddress` field, which became obsolete due to EIP-155 enforcement and non-EVM compatible chains.
|
|
10
|
+
// This led to multiple "default" addresses, sometimes on the same chain ID. To maintain backwards compatibility, we map `defaultAddress`
|
|
11
|
+
// to the address deployed on a chosen default network.
|
|
12
|
+
const DEFAULT_NETWORK_CHAIN_ID = '1';
|
|
13
|
+
/**
|
|
14
|
+
* Maps a SingletonDeploymentJSON object to a SingletonDeployment object.
|
|
15
|
+
*
|
|
16
|
+
* @param {SingletonDeploymentJSON} deployment - The deployment JSON object to map.
|
|
17
|
+
* @returns {SingletonDeployment} - The mapped deployment object.
|
|
18
|
+
*/
|
|
19
|
+
const mapJsonToDeploymentsFormatV1 = (deployment) => {
|
|
20
|
+
const defaultAddressType = Array.isArray(deployment.networkAddresses[DEFAULT_NETWORK_CHAIN_ID])
|
|
21
|
+
? deployment.networkAddresses[DEFAULT_NETWORK_CHAIN_ID][0]
|
|
22
|
+
: deployment.networkAddresses[DEFAULT_NETWORK_CHAIN_ID];
|
|
23
|
+
// The usage of non-null assertion below is safe, because we validate that the asset files are properly formed in tests
|
|
24
|
+
const defaultAddress = deployment.deployments[defaultAddressType].address;
|
|
25
|
+
const networkAddresses = Object.fromEntries(Object.entries(deployment.networkAddresses).map(([chainId, addressTypes]) => [
|
|
26
|
+
chainId,
|
|
27
|
+
Array.isArray(addressTypes)
|
|
28
|
+
? deployment.deployments[addressTypes[0]].address
|
|
29
|
+
: deployment.deployments[addressTypes].address,
|
|
30
|
+
]));
|
|
31
|
+
return Object.assign(Object.assign({}, deployment), { defaultAddress, networkAddresses });
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Maps a SingletonDeploymentJSON object to a SingletonDeploymentV2 object.
|
|
35
|
+
*
|
|
36
|
+
* This function transforms the `networkAddresses` field of the deployment JSON object.
|
|
37
|
+
* It converts each entry in `networkAddresses` to an array of addresses, using the `addresses` field
|
|
38
|
+
* to resolve each address type.
|
|
39
|
+
*
|
|
40
|
+
* @param {SingletonDeploymentJSON} deployment - The deployment JSON object to map.
|
|
41
|
+
* @returns {SingletonDeploymentV2} - The mapped deployment object in V2 format.
|
|
42
|
+
*/
|
|
43
|
+
const mapJsonToDeploymentsFormatV2 = (deployment) => {
|
|
44
|
+
const newJson = Object.assign({}, deployment);
|
|
45
|
+
newJson.networkAddresses = Object.fromEntries(Object.entries(deployment.networkAddresses).map(([chainId, addressTypes]) => [
|
|
46
|
+
chainId,
|
|
47
|
+
(Array.isArray(addressTypes)
|
|
48
|
+
? // The usage of non-null assertion below is safe, because we validate that the asset files are properly formed in tests
|
|
49
|
+
addressTypes.map((addressType) => deployment.deployments[addressType].address)
|
|
50
|
+
: deployment.deployments[addressTypes].address),
|
|
51
|
+
]));
|
|
52
|
+
return newJson;
|
|
53
|
+
};
|
|
54
|
+
function findDeployment(criteria = DEFAULT_FILTER, deployments, format = "singleton" /* DeploymentFormats.SINGLETON */) {
|
|
55
|
+
const { version, released, network } = Object.assign(Object.assign({}, DEFAULT_FILTER), criteria);
|
|
56
|
+
const deploymentJson = deployments.find((deployment) => {
|
|
57
|
+
if (version && !(0, satisfies_1.default)(deployment.version, version))
|
|
13
58
|
return false;
|
|
14
|
-
if (typeof
|
|
59
|
+
if (typeof released === 'boolean' && deployment.released !== released)
|
|
15
60
|
return false;
|
|
16
|
-
if (
|
|
61
|
+
if (network && !deployment.networkAddresses[network])
|
|
17
62
|
return false;
|
|
18
63
|
return true;
|
|
19
64
|
});
|
|
20
|
-
|
|
21
|
-
|
|
65
|
+
if (!deploymentJson)
|
|
66
|
+
return undefined;
|
|
67
|
+
if (format === "multiple" /* DeploymentFormats.MULTIPLE */) {
|
|
68
|
+
return mapJsonToDeploymentsFormatV2(deploymentJson);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return mapJsonToDeploymentsFormatV1(deploymentJson);
|
|
72
|
+
}
|
|
73
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@safe-global/safe-deployments",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.2",
|
|
4
4
|
"description": "Collection of Safe singleton deployments",
|
|
5
5
|
"homepage": "https://github.com/safe-global/safe-deployments/",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,17 +8,18 @@
|
|
|
8
8
|
"typings": "dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
-
"src"
|
|
12
|
-
"test",
|
|
13
|
-
"build"
|
|
11
|
+
"src"
|
|
14
12
|
],
|
|
15
13
|
"scripts": {
|
|
16
|
-
"build": "
|
|
17
|
-
"lint": "
|
|
18
|
-
"lint:ts": "eslint --max-warnings 0
|
|
14
|
+
"build": "rimraf dist && tsc",
|
|
15
|
+
"lint": "npm run lint:ts && npm run lint:json",
|
|
16
|
+
"lint:ts": "eslint --max-warnings 0 src/ scripts/",
|
|
19
17
|
"lint:json": "prettier -c src/assets/*/*.json",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
18
|
+
"lint:fix": "npm run lint:fix:ts && npm run lint:fix:json",
|
|
19
|
+
"lint:fix:ts": "npm run lint:ts -- --fix",
|
|
20
|
+
"lint:fix:json": "prettier -w src/assets/*/*.json",
|
|
21
|
+
"verify": "ts-node scripts/verify.ts",
|
|
22
|
+
"prepack": "npm run build",
|
|
22
23
|
"test": "jest"
|
|
23
24
|
},
|
|
24
25
|
"repository": {
|
|
@@ -35,24 +36,22 @@
|
|
|
35
36
|
"url": "https://github.com/safe-global/safe-deployments/issues"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
39
|
+
"@eslint/js": "^8.57.0",
|
|
38
40
|
"@types/jest": "^29.5.12",
|
|
39
|
-
"@types/node": "^20.
|
|
41
|
+
"@types/node": "^20.14.9",
|
|
40
42
|
"@types/semver": "^7.5.8",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
42
|
-
"@typescript-eslint/parser": "^7.4.0",
|
|
43
43
|
"eslint": "^8.57.0",
|
|
44
44
|
"eslint-config-prettier": "^9.1.0",
|
|
45
|
-
"eslint-plugin-import": "^2.29.1",
|
|
46
|
-
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
47
45
|
"eslint-plugin-prettier": "^5.1.3",
|
|
48
|
-
"
|
|
46
|
+
"ethers": "^6.13.1",
|
|
49
47
|
"jest": "^29.7.0",
|
|
50
|
-
"prettier": "^3.2
|
|
51
|
-
"ts-jest": "^29.1.
|
|
48
|
+
"prettier": "^3.3.2",
|
|
49
|
+
"ts-jest": "^29.1.5",
|
|
52
50
|
"ts-node": "^10.9.2",
|
|
53
|
-
"typescript": "^5.
|
|
51
|
+
"typescript": "^5.5.2",
|
|
52
|
+
"typescript-eslint": "^7.14.1"
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
|
-
"semver": "^7.6.
|
|
55
|
+
"semver": "^7.6.2"
|
|
57
56
|
}
|
|
58
57
|
}
|