@safe-global/safe-deployments 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/accessors.d.ts +2 -0
- package/dist/accessors.js +17 -0
- package/dist/assets/v1.3.0/compatibility_fallback_handler.json +2 -0
- package/dist/assets/v1.3.0/create_call.json +2 -0
- package/dist/assets/v1.3.0/gnosis_safe.json +2 -0
- package/dist/assets/v1.3.0/gnosis_safe_l2.json +2 -0
- package/dist/assets/v1.3.0/multi_send.json +2 -0
- package/dist/assets/v1.3.0/multi_send_call_only.json +2 -0
- package/dist/assets/v1.3.0/proxy_factory.json +2 -0
- package/dist/assets/v1.3.0/sign_message_lib.json +2 -0
- package/dist/assets/v1.3.0/simulate_tx_accessor.json +175 -0
- package/dist/assets/v1.4.0/compatibility_fallback_handler.json +334 -0
- package/dist/assets/v1.4.0/create_call.json +79 -0
- package/dist/assets/v1.4.0/multi_send.json +31 -0
- package/dist/assets/v1.4.0/multi_send_call_only.json +26 -0
- package/dist/assets/v1.4.0/safe.json +1010 -0
- package/dist/assets/v1.4.0/safe_l2.json +1115 -0
- package/dist/assets/v1.4.0/safe_proxy_factory.json +150 -0
- package/dist/assets/v1.4.0/sign_message_lib.json +58 -0
- package/dist/assets/v1.4.0/simulate_tx_accessor.json +62 -0
- package/dist/factories.d.ts +1 -1
- package/dist/factories.js +3 -2
- package/dist/handler.d.ts +3 -3
- package/dist/handler.js +6 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -1
- package/dist/libs.d.ts +4 -4
- package/dist/libs.js +12 -8
- package/dist/safes.d.ts +2 -2
- package/dist/safes.js +6 -4
- package/dist/utils.js +12 -9
- package/package.json +2 -2
- package/src/__tests__/utilts.test.ts +60 -17
- package/src/accessors.ts +14 -0
- package/src/assets/v1.3.0/compatibility_fallback_handler.json +2 -0
- package/src/assets/v1.3.0/create_call.json +2 -0
- package/src/assets/v1.3.0/gnosis_safe.json +2 -0
- package/src/assets/v1.3.0/gnosis_safe_l2.json +2 -0
- package/src/assets/v1.3.0/multi_send.json +2 -0
- package/src/assets/v1.3.0/multi_send_call_only.json +2 -0
- package/src/assets/v1.3.0/proxy_factory.json +2 -0
- package/src/assets/v1.3.0/sign_message_lib.json +2 -0
- package/src/assets/v1.3.0/simulate_tx_accessor.json +3 -1
- package/src/assets/v1.4.0/compatibility_fallback_handler.json +334 -0
- package/src/assets/v1.4.0/create_call.json +79 -0
- package/src/assets/v1.4.0/multi_send.json +31 -0
- package/src/assets/v1.4.0/multi_send_call_only.json +26 -0
- package/src/assets/v1.4.0/safe.json +1010 -0
- package/src/assets/v1.4.0/safe_l2.json +1115 -0
- package/src/assets/v1.4.0/safe_proxy_factory.json +150 -0
- package/src/assets/v1.4.0/sign_message_lib.json +58 -0
- package/src/assets/v1.4.0/simulate_tx_accessor.json +62 -0
- package/src/factories.ts +2 -1
- package/src/handler.ts +4 -3
- package/src/index.ts +2 -1
- package/src/libs.ts +8 -4
- package/src/safes.ts +4 -2
- package/src/utils.ts +10 -6
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultAddress": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
|
|
3
|
+
"contractName": "SafeProxyFactory",
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"released": false,
|
|
6
|
+
"networkAddresses": {
|
|
7
|
+
"5": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
|
|
8
|
+
"56": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
|
|
9
|
+
"100": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67"
|
|
10
|
+
},
|
|
11
|
+
"abi": [
|
|
12
|
+
{
|
|
13
|
+
"anonymous": false,
|
|
14
|
+
"inputs": [
|
|
15
|
+
{
|
|
16
|
+
"indexed": true,
|
|
17
|
+
"internalType": "contract SafeProxy",
|
|
18
|
+
"name": "proxy",
|
|
19
|
+
"type": "address"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"indexed": false,
|
|
23
|
+
"internalType": "address",
|
|
24
|
+
"name": "singleton",
|
|
25
|
+
"type": "address"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"name": "ProxyCreation",
|
|
29
|
+
"type": "event"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"inputs": [
|
|
33
|
+
{
|
|
34
|
+
"internalType": "address",
|
|
35
|
+
"name": "_singleton",
|
|
36
|
+
"type": "address"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"internalType": "bytes",
|
|
40
|
+
"name": "initializer",
|
|
41
|
+
"type": "bytes"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"internalType": "uint256",
|
|
45
|
+
"name": "saltNonce",
|
|
46
|
+
"type": "uint256"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"name": "createChainSpecificProxyWithNonce",
|
|
50
|
+
"outputs": [
|
|
51
|
+
{
|
|
52
|
+
"internalType": "contract SafeProxy",
|
|
53
|
+
"name": "proxy",
|
|
54
|
+
"type": "address"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"stateMutability": "nonpayable",
|
|
58
|
+
"type": "function"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"inputs": [
|
|
62
|
+
{
|
|
63
|
+
"internalType": "address",
|
|
64
|
+
"name": "_singleton",
|
|
65
|
+
"type": "address"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"internalType": "bytes",
|
|
69
|
+
"name": "initializer",
|
|
70
|
+
"type": "bytes"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"internalType": "uint256",
|
|
74
|
+
"name": "saltNonce",
|
|
75
|
+
"type": "uint256"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"internalType": "contract IProxyCreationCallback",
|
|
79
|
+
"name": "callback",
|
|
80
|
+
"type": "address"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"name": "createProxyWithCallback",
|
|
84
|
+
"outputs": [
|
|
85
|
+
{
|
|
86
|
+
"internalType": "contract SafeProxy",
|
|
87
|
+
"name": "proxy",
|
|
88
|
+
"type": "address"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"stateMutability": "nonpayable",
|
|
92
|
+
"type": "function"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"inputs": [
|
|
96
|
+
{
|
|
97
|
+
"internalType": "address",
|
|
98
|
+
"name": "_singleton",
|
|
99
|
+
"type": "address"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"internalType": "bytes",
|
|
103
|
+
"name": "initializer",
|
|
104
|
+
"type": "bytes"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"internalType": "uint256",
|
|
108
|
+
"name": "saltNonce",
|
|
109
|
+
"type": "uint256"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"name": "createProxyWithNonce",
|
|
113
|
+
"outputs": [
|
|
114
|
+
{
|
|
115
|
+
"internalType": "contract SafeProxy",
|
|
116
|
+
"name": "proxy",
|
|
117
|
+
"type": "address"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"stateMutability": "nonpayable",
|
|
121
|
+
"type": "function"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"inputs": [],
|
|
125
|
+
"name": "getChainId",
|
|
126
|
+
"outputs": [
|
|
127
|
+
{
|
|
128
|
+
"internalType": "uint256",
|
|
129
|
+
"name": "",
|
|
130
|
+
"type": "uint256"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"stateMutability": "view",
|
|
134
|
+
"type": "function"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"inputs": [],
|
|
138
|
+
"name": "proxyCreationCode",
|
|
139
|
+
"outputs": [
|
|
140
|
+
{
|
|
141
|
+
"internalType": "bytes",
|
|
142
|
+
"name": "",
|
|
143
|
+
"type": "bytes"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"stateMutability": "pure",
|
|
147
|
+
"type": "function"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultAddress": "0x58FCe385Ed16beB4BCE49c8DF34c7d6975807520",
|
|
3
|
+
"contractName": "SignMessageLib",
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"released": false,
|
|
6
|
+
"networkAddresses": {
|
|
7
|
+
"5": "0x58FCe385Ed16beB4BCE49c8DF34c7d6975807520",
|
|
8
|
+
"56": "0x58FCe385Ed16beB4BCE49c8DF34c7d6975807520",
|
|
9
|
+
"100": "0x58FCe385Ed16beB4BCE49c8DF34c7d6975807520"
|
|
10
|
+
},
|
|
11
|
+
"abi": [
|
|
12
|
+
{
|
|
13
|
+
"anonymous": false,
|
|
14
|
+
"inputs": [
|
|
15
|
+
{
|
|
16
|
+
"indexed": true,
|
|
17
|
+
"internalType": "bytes32",
|
|
18
|
+
"name": "msgHash",
|
|
19
|
+
"type": "bytes32"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"name": "SignMsg",
|
|
23
|
+
"type": "event"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"inputs": [
|
|
27
|
+
{
|
|
28
|
+
"internalType": "bytes",
|
|
29
|
+
"name": "message",
|
|
30
|
+
"type": "bytes"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"name": "getMessageHash",
|
|
34
|
+
"outputs": [
|
|
35
|
+
{
|
|
36
|
+
"internalType": "bytes32",
|
|
37
|
+
"name": "",
|
|
38
|
+
"type": "bytes32"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"stateMutability": "view",
|
|
42
|
+
"type": "function"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"inputs": [
|
|
46
|
+
{
|
|
47
|
+
"internalType": "bytes",
|
|
48
|
+
"name": "_data",
|
|
49
|
+
"type": "bytes"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"name": "signMessage",
|
|
53
|
+
"outputs": [],
|
|
54
|
+
"stateMutability": "nonpayable",
|
|
55
|
+
"type": "function"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultAddress": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
|
|
3
|
+
"released": false,
|
|
4
|
+
"contractName": "SimulateTxAccessor",
|
|
5
|
+
"version": "1.4.0",
|
|
6
|
+
"networkAddresses": {
|
|
7
|
+
"5": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
|
|
8
|
+
"56": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199",
|
|
9
|
+
"100": "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199"
|
|
10
|
+
},
|
|
11
|
+
"abi": [
|
|
12
|
+
{
|
|
13
|
+
"inputs": [],
|
|
14
|
+
"stateMutability": "nonpayable",
|
|
15
|
+
"type": "constructor"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"inputs": [
|
|
19
|
+
{
|
|
20
|
+
"internalType": "address",
|
|
21
|
+
"name": "to",
|
|
22
|
+
"type": "address"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"internalType": "uint256",
|
|
26
|
+
"name": "value",
|
|
27
|
+
"type": "uint256"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"internalType": "bytes",
|
|
31
|
+
"name": "data",
|
|
32
|
+
"type": "bytes"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"internalType": "enum Enum.Operation",
|
|
36
|
+
"name": "operation",
|
|
37
|
+
"type": "uint8"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"name": "simulate",
|
|
41
|
+
"outputs": [
|
|
42
|
+
{
|
|
43
|
+
"internalType": "uint256",
|
|
44
|
+
"name": "estimate",
|
|
45
|
+
"type": "uint256"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"internalType": "bool",
|
|
49
|
+
"name": "success",
|
|
50
|
+
"type": "bool"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"internalType": "bytes",
|
|
54
|
+
"name": "returnData",
|
|
55
|
+
"type": "bytes"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"stateMutability": "nonpayable",
|
|
59
|
+
"type": "function"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
package/src/factories.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import ProxyFactory100 from './assets/v1.0.0/proxy_factory.json'
|
|
2
2
|
import ProxyFactory111 from './assets/v1.1.1/proxy_factory.json'
|
|
3
3
|
import ProxyFactory130 from './assets/v1.3.0/proxy_factory.json'
|
|
4
|
+
import SafeProxyFactory140 from './assets/v1.4.0/safe_proxy_factory.json'
|
|
4
5
|
import { DeploymentFilter, SingletonDeployment } from './types'
|
|
5
6
|
import { findDeployment } from './utils'
|
|
6
7
|
|
|
7
8
|
// This is a sorted array (newest to oldest)
|
|
8
9
|
const factoryDeployments: SingletonDeployment[] = [
|
|
9
|
-
ProxyFactory130, ProxyFactory111, ProxyFactory100
|
|
10
|
+
SafeProxyFactory140, ProxyFactory130, ProxyFactory111, ProxyFactory100
|
|
10
11
|
]
|
|
11
12
|
|
|
12
13
|
export const getProxyFactoryDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
package/src/handler.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import DefaultCallbackHandler130 from './assets/v1.1.1/default_callback_handler.json'
|
|
2
|
-
import
|
|
2
|
+
import CompatibilityFallbackHandler130 from './assets/v1.3.0/compatibility_fallback_handler.json'
|
|
3
|
+
import CompatibilityFallbackHandler140 from './assets/v1.4.0/compatibility_fallback_handler.json'
|
|
3
4
|
import { DeploymentFilter, SingletonDeployment } from './types'
|
|
4
5
|
import { findDeployment } from './utils'
|
|
5
6
|
|
|
@@ -14,7 +15,7 @@ export const getDefaultCallbackHandlerDeployment = (filter?: DeploymentFilter):
|
|
|
14
15
|
|
|
15
16
|
// This is a sorted array (by preference)
|
|
16
17
|
const compatFallbackHandlerDeployments: SingletonDeployment[] = [
|
|
17
|
-
|
|
18
|
+
CompatibilityFallbackHandler140, CompatibilityFallbackHandler130
|
|
18
19
|
]
|
|
19
20
|
|
|
20
21
|
export const getCompatibilityFallbackHandlerDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
@@ -23,7 +24,7 @@ export const getCompatibilityFallbackHandlerDeployment = (filter?: DeploymentFil
|
|
|
23
24
|
|
|
24
25
|
// This is a sorted array (by preference)
|
|
25
26
|
const fallbackHandlerDeployments: SingletonDeployment[] = [
|
|
26
|
-
|
|
27
|
+
CompatibilityFallbackHandler140, CompatibilityFallbackHandler130, DefaultCallbackHandler130
|
|
27
28
|
]
|
|
28
29
|
|
|
29
30
|
export const getFallbackHandlerDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
package/src/index.ts
CHANGED
package/src/libs.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import CreateCall130 from './assets/v1.3.0/create_call.json'
|
|
2
|
+
import CreateCall140 from './assets/v1.4.0/create_call.json'
|
|
2
3
|
import MultiSend111 from './assets/v1.1.1/multi_send.json'
|
|
3
4
|
import MultiSend130 from './assets/v1.3.0/multi_send.json'
|
|
5
|
+
import MultiSend140 from './assets/v1.4.0/multi_send.json'
|
|
4
6
|
import MultiSendCallOnly130 from './assets/v1.3.0/multi_send_call_only.json'
|
|
7
|
+
import MultiSendCallOnly140 from './assets/v1.4.0/multi_send_call_only.json'
|
|
5
8
|
import SignMessageLib130 from './assets/v1.3.0/sign_message_lib.json'
|
|
9
|
+
import SignMessageLib140 from './assets/v1.4.0/sign_message_lib.json'
|
|
6
10
|
import { DeploymentFilter, SingletonDeployment } from './types'
|
|
7
11
|
import { findDeployment } from './utils'
|
|
8
12
|
|
|
9
13
|
// This is a sorted array (by preference, currently we use 111 in most cases)
|
|
10
14
|
const multiSendDeployments: SingletonDeployment[] = [
|
|
11
|
-
MultiSend130, MultiSend111
|
|
15
|
+
MultiSend140, MultiSend130, MultiSend111
|
|
12
16
|
]
|
|
13
17
|
|
|
14
18
|
export const getMultiSendDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
@@ -17,7 +21,7 @@ export const getMultiSendDeployment = (filter?: DeploymentFilter): SingletonDepl
|
|
|
17
21
|
|
|
18
22
|
// This is a sorted array (by preference)
|
|
19
23
|
const multiSendCallOnlyDeployments: SingletonDeployment[] = [
|
|
20
|
-
MultiSendCallOnly130
|
|
24
|
+
MultiSendCallOnly140, MultiSendCallOnly130
|
|
21
25
|
]
|
|
22
26
|
|
|
23
27
|
export const getMultiSendCallOnlyDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
@@ -26,7 +30,7 @@ export const getMultiSendCallOnlyDeployment = (filter?: DeploymentFilter): Singl
|
|
|
26
30
|
|
|
27
31
|
// This is a sorted array (by preference)
|
|
28
32
|
const createCallDeployments: SingletonDeployment[] = [
|
|
29
|
-
CreateCall130
|
|
33
|
+
CreateCall140, CreateCall130
|
|
30
34
|
]
|
|
31
35
|
|
|
32
36
|
export const getCreateCallDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
@@ -34,7 +38,7 @@ export const getCreateCallDeployment = (filter?: DeploymentFilter): SingletonDep
|
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
const signMessageLibDeployments: SingletonDeployment[] = [
|
|
37
|
-
SignMessageLib130
|
|
41
|
+
SignMessageLib140, SignMessageLib130
|
|
38
42
|
]
|
|
39
43
|
|
|
40
44
|
export const getSignMessageLibDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
package/src/safes.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import SafeL2140 from './assets/v1.4.0/safe_l2.json'
|
|
2
|
+
import Safe140 from './assets/v1.4.0/safe.json'
|
|
1
3
|
import GnosisSafeL2130 from './assets/v1.3.0/gnosis_safe_l2.json'
|
|
2
4
|
import GnosisSafe130 from './assets/v1.3.0/gnosis_safe.json'
|
|
3
5
|
import GnosisSafe120 from './assets/v1.2.0/gnosis_safe.json'
|
|
@@ -8,7 +10,7 @@ import { findDeployment } from './utils'
|
|
|
8
10
|
|
|
9
11
|
// This is a sorted array (newest to oldest), exported for tests
|
|
10
12
|
export const _safeDeployments: SingletonDeployment[] = [
|
|
11
|
-
GnosisSafe130, GnosisSafe120, GnosisSafe111, GnosisSafe100
|
|
13
|
+
Safe140, GnosisSafe130, GnosisSafe120, GnosisSafe111, GnosisSafe100
|
|
12
14
|
]
|
|
13
15
|
|
|
14
16
|
export const getSafeSingletonDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
|
@@ -17,7 +19,7 @@ export const getSafeSingletonDeployment = (filter?: DeploymentFilter): Singleton
|
|
|
17
19
|
|
|
18
20
|
// This is a sorted array (newest to oldest), exported for tests
|
|
19
21
|
export const _safeL2Deployments: SingletonDeployment[] = [
|
|
20
|
-
GnosisSafeL2130
|
|
22
|
+
SafeL2140, GnosisSafeL2130
|
|
21
23
|
]
|
|
22
24
|
|
|
23
25
|
export const getSafeL2SingletonDeployment = (filter?: DeploymentFilter): SingletonDeployment | undefined => {
|
package/src/utils.ts
CHANGED
|
@@ -3,10 +3,14 @@ import semverSatisfies from 'semver/functions/satisfies'
|
|
|
3
3
|
|
|
4
4
|
const DEFAULT_FILTER: DeploymentFilter = { released: true }
|
|
5
5
|
|
|
6
|
-
export const findDeployment = (criteria: DeploymentFilter = DEFAULT_FILTER, deployments: SingletonDeployment[]): SingletonDeployment | undefined =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (
|
|
6
|
+
export const findDeployment = (criteria: DeploymentFilter = DEFAULT_FILTER, deployments: SingletonDeployment[]): SingletonDeployment | undefined => {
|
|
7
|
+
const criteriaWithDefaults: DeploymentFilter = { ...DEFAULT_FILTER, ...criteria }
|
|
8
|
+
|
|
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
|
|
13
|
+
|
|
11
14
|
return true
|
|
12
|
-
})
|
|
15
|
+
})
|
|
16
|
+
}
|