@0xsequence/catapult 1.3.8 → 1.3.9
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 +1 -0
- package/dist/index.js +0 -0
- package/dist/lib/network-match.d.ts +3 -0
- package/dist/lib/network-match.d.ts.map +1 -0
- package/dist/lib/network-match.js +62 -0
- package/dist/lib/network-match.js.map +1 -0
- package/dist/lib/std/templates/arachnid-deterministic-deployment-proxy.yaml +68 -0
- package/package.json +12 -13
- package/src/lib/std/templates/arachnid-deterministic-deployment-proxy.yaml +68 -0
package/README.md
CHANGED
|
@@ -743,6 +743,7 @@ Catapult includes several standard templates:
|
|
|
743
743
|
|
|
744
744
|
- **`sequence-universal-deployer-2`**: Deploy contracts using Sequence's Universal Deployer v2
|
|
745
745
|
- **`nano-universal-deployer`**: Deploy contracts using the Nano Universal Deployer
|
|
746
|
+
- **`arachnid-deterministic-deployment-proxy`**: Deploy contracts via Arachnid's CREATE2 proxy at `0x4e59…`, with automatic factory bootstrapping
|
|
746
747
|
- **`erc-2470`** and raw variant: CREATE2 Deployer (singleton factory)
|
|
747
748
|
- **`assured-deployment`**: Helper to ensure a contract is deployed at a specific address
|
|
748
749
|
- **`min-balance`**: Ensure minimum balance for any given address
|
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-match.d.ts","sourceRoot":"","sources":["../../src/lib/network-match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AA8BjC,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAyC1F"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRequestedNetworks = resolveRequestedNetworks;
|
|
4
|
+
function normalize(input) {
|
|
5
|
+
return input
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
.replace(/[^a-z0-9]+/g, ' ')
|
|
8
|
+
.replace(/\s+/g, ' ')
|
|
9
|
+
.trim();
|
|
10
|
+
}
|
|
11
|
+
function scoreNameMatch(candidateName, query) {
|
|
12
|
+
const c = normalize(candidateName);
|
|
13
|
+
const q = normalize(query);
|
|
14
|
+
if (!q || !c)
|
|
15
|
+
return 0;
|
|
16
|
+
if (c === q)
|
|
17
|
+
return 100;
|
|
18
|
+
if (c.startsWith(q))
|
|
19
|
+
return 90;
|
|
20
|
+
if (c.includes(q))
|
|
21
|
+
return 75;
|
|
22
|
+
const qTokens = q.split(' ');
|
|
23
|
+
const allTokensPresent = qTokens.every(t => c.includes(t));
|
|
24
|
+
if (allTokensPresent)
|
|
25
|
+
return 70;
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
function resolveRequestedNetworks(requests, networks) {
|
|
29
|
+
const chainIds = [];
|
|
30
|
+
for (const req of requests) {
|
|
31
|
+
const asNumber = Number(req);
|
|
32
|
+
if (!Number.isNaN(asNumber)) {
|
|
33
|
+
const found = networks.find(n => n.chainId === asNumber);
|
|
34
|
+
if (found) {
|
|
35
|
+
chainIds.push(found.chainId);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let bestScore = -1;
|
|
40
|
+
let bestMatches = [];
|
|
41
|
+
for (const n of networks) {
|
|
42
|
+
const s = scoreNameMatch(n.name, req);
|
|
43
|
+
if (s > bestScore) {
|
|
44
|
+
bestScore = s;
|
|
45
|
+
bestMatches = [n];
|
|
46
|
+
}
|
|
47
|
+
else if (s === bestScore && s > 0) {
|
|
48
|
+
bestMatches.push(n);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (bestScore < 60 || bestMatches.length === 0) {
|
|
52
|
+
throw new Error(`No network matched "${req}". Available: ${networks.map(n => `${n.name} (${n.chainId})`).join(', ')}`);
|
|
53
|
+
}
|
|
54
|
+
if (bestMatches.length > 1) {
|
|
55
|
+
const candidates = bestMatches.map(n => `${n.name} (${n.chainId})`).join(', ');
|
|
56
|
+
throw new Error(`Ambiguous network "${req}". Possible matches: ${candidates}`);
|
|
57
|
+
}
|
|
58
|
+
chainIds.push(bestMatches[0].chainId);
|
|
59
|
+
}
|
|
60
|
+
return chainIds;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=network-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-match.js","sourceRoot":"","sources":["../../src/lib/network-match.ts"],"names":[],"mappings":";;AA8BA,4DAyCC;AArED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK;SACT,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAA;AACX,CAAC;AAED,SAAS,cAAc,CAAC,aAAqB,EAAE,KAAa;IAC1D,MAAM,CAAC,GAAG,SAAS,CAAC,aAAa,CAAC,CAAA;IAClC,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;IAE1B,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAA;IACtB,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,GAAG,CAAA;IACvB,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAA;IAC9B,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAA;IAE5B,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1D,IAAI,gBAAgB;QAAE,OAAO,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AAI,KAAK,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACxH,CAAC;QACD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC9E,MAAM,IAAI,KAAK,CAAC,sBAAsB,GAAG,wBAAwB,UAAU,EAAE,CAAC,CAAA;QAChF,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Similar to "nano-universal-deployer" but targets Arachnid's Deterministic Deployment Proxy
|
|
2
|
+
# (a CREATE2 deployer available at 0x4e59… on every chain). The proxy call reverts when the
|
|
3
|
+
# inner CREATE2 fails, so no additional assurance wrapper is needed.
|
|
4
|
+
name: "arachnid-deterministic-deployment-proxy"
|
|
5
|
+
type: "template"
|
|
6
|
+
description: "Deploy contracts through Arachnid's Deterministic Deployment Proxy"
|
|
7
|
+
|
|
8
|
+
arguments:
|
|
9
|
+
creationCode:
|
|
10
|
+
type: "bytes"
|
|
11
|
+
description: "Creation code of the contract to deploy"
|
|
12
|
+
salt:
|
|
13
|
+
type: "bytes32"
|
|
14
|
+
description: "Salt supplied to the proxy for CREATE2"
|
|
15
|
+
|
|
16
|
+
returns:
|
|
17
|
+
address:
|
|
18
|
+
type: "address"
|
|
19
|
+
description: "Address of the deployed contract"
|
|
20
|
+
|
|
21
|
+
setup:
|
|
22
|
+
skip_condition:
|
|
23
|
+
- type: "contract-exists"
|
|
24
|
+
arguments:
|
|
25
|
+
address: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
|
|
26
|
+
actions:
|
|
27
|
+
- type: "test-nicks-method"
|
|
28
|
+
- type: "min-balance"
|
|
29
|
+
arguments:
|
|
30
|
+
address: "0x3fab184622dc19b6109349b94811493bf2a45362"
|
|
31
|
+
balance: "10000000000000000"
|
|
32
|
+
- type: "send-signed-transaction"
|
|
33
|
+
arguments:
|
|
34
|
+
transaction: |
|
|
35
|
+
0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222
|
|
36
|
+
|
|
37
|
+
actions:
|
|
38
|
+
- type: "send-transaction"
|
|
39
|
+
arguments:
|
|
40
|
+
to: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
|
|
41
|
+
data:
|
|
42
|
+
type: "abi-pack"
|
|
43
|
+
arguments:
|
|
44
|
+
types:
|
|
45
|
+
- "bytes32"
|
|
46
|
+
- "bytes"
|
|
47
|
+
values:
|
|
48
|
+
- "{{salt}}"
|
|
49
|
+
- "{{creationCode}}"
|
|
50
|
+
gasMultiplier: 1.6
|
|
51
|
+
|
|
52
|
+
skip_condition:
|
|
53
|
+
- type: "contract-exists"
|
|
54
|
+
arguments:
|
|
55
|
+
address:
|
|
56
|
+
type: "compute-create2"
|
|
57
|
+
arguments:
|
|
58
|
+
deployerAddress: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
|
|
59
|
+
salt: "{{salt}}"
|
|
60
|
+
initCode: "{{creationCode}}"
|
|
61
|
+
|
|
62
|
+
outputs:
|
|
63
|
+
address:
|
|
64
|
+
type: "compute-create2"
|
|
65
|
+
arguments:
|
|
66
|
+
deployerAddress: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
|
|
67
|
+
salt: "{{salt}}"
|
|
68
|
+
initCode: "{{creationCode}}"
|
package/package.json
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/catapult",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"description": "Ethereum contract deployment CLI tool",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"catapult": "dist/index.js"
|
|
8
8
|
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsc && cp -r src/lib/std dist/lib/",
|
|
11
|
-
"dev": "ts-node src/index.ts",
|
|
12
|
-
"start": "node dist/index.js",
|
|
13
|
-
"start:dev": "npm run build && npm run start",
|
|
14
|
-
"watch": "tsc --watch",
|
|
15
|
-
"clean": "rm -rf dist",
|
|
16
|
-
"prepare": "npm run build",
|
|
17
|
-
"test": "jest --runInBand --detectOpenHandles",
|
|
18
|
-
"lint": "eslint src/**/*.ts",
|
|
19
|
-
"lint:fix": "eslint src/**/*.ts --fix"
|
|
20
|
-
},
|
|
21
9
|
"keywords": [
|
|
22
10
|
"ethereum",
|
|
23
11
|
"deployment",
|
|
@@ -64,5 +52,16 @@
|
|
|
64
52
|
},
|
|
65
53
|
"engines": {
|
|
66
54
|
"node": ">=16.0.0"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc && cp -r src/lib/std dist/lib/",
|
|
58
|
+
"dev": "ts-node src/index.ts",
|
|
59
|
+
"start": "node dist/index.js",
|
|
60
|
+
"start:dev": "npm run build && npm run start",
|
|
61
|
+
"watch": "tsc --watch",
|
|
62
|
+
"clean": "rm -rf dist",
|
|
63
|
+
"test": "jest --runInBand --detectOpenHandles",
|
|
64
|
+
"lint": "eslint src/**/*.ts",
|
|
65
|
+
"lint:fix": "eslint src/**/*.ts --fix"
|
|
67
66
|
}
|
|
68
67
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Similar to "nano-universal-deployer" but targets Arachnid's Deterministic Deployment Proxy
|
|
2
|
+
# (a CREATE2 deployer available at 0x4e59… on every chain). The proxy call reverts when the
|
|
3
|
+
# inner CREATE2 fails, so no additional assurance wrapper is needed.
|
|
4
|
+
name: "arachnid-deterministic-deployment-proxy"
|
|
5
|
+
type: "template"
|
|
6
|
+
description: "Deploy contracts through Arachnid's Deterministic Deployment Proxy"
|
|
7
|
+
|
|
8
|
+
arguments:
|
|
9
|
+
creationCode:
|
|
10
|
+
type: "bytes"
|
|
11
|
+
description: "Creation code of the contract to deploy"
|
|
12
|
+
salt:
|
|
13
|
+
type: "bytes32"
|
|
14
|
+
description: "Salt supplied to the proxy for CREATE2"
|
|
15
|
+
|
|
16
|
+
returns:
|
|
17
|
+
address:
|
|
18
|
+
type: "address"
|
|
19
|
+
description: "Address of the deployed contract"
|
|
20
|
+
|
|
21
|
+
setup:
|
|
22
|
+
skip_condition:
|
|
23
|
+
- type: "contract-exists"
|
|
24
|
+
arguments:
|
|
25
|
+
address: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
|
|
26
|
+
actions:
|
|
27
|
+
- type: "test-nicks-method"
|
|
28
|
+
- type: "min-balance"
|
|
29
|
+
arguments:
|
|
30
|
+
address: "0x3fab184622dc19b6109349b94811493bf2a45362"
|
|
31
|
+
balance: "10000000000000000"
|
|
32
|
+
- type: "send-signed-transaction"
|
|
33
|
+
arguments:
|
|
34
|
+
transaction: |
|
|
35
|
+
0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222
|
|
36
|
+
|
|
37
|
+
actions:
|
|
38
|
+
- type: "send-transaction"
|
|
39
|
+
arguments:
|
|
40
|
+
to: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
|
|
41
|
+
data:
|
|
42
|
+
type: "abi-pack"
|
|
43
|
+
arguments:
|
|
44
|
+
types:
|
|
45
|
+
- "bytes32"
|
|
46
|
+
- "bytes"
|
|
47
|
+
values:
|
|
48
|
+
- "{{salt}}"
|
|
49
|
+
- "{{creationCode}}"
|
|
50
|
+
gasMultiplier: 1.6
|
|
51
|
+
|
|
52
|
+
skip_condition:
|
|
53
|
+
- type: "contract-exists"
|
|
54
|
+
arguments:
|
|
55
|
+
address:
|
|
56
|
+
type: "compute-create2"
|
|
57
|
+
arguments:
|
|
58
|
+
deployerAddress: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
|
|
59
|
+
salt: "{{salt}}"
|
|
60
|
+
initCode: "{{creationCode}}"
|
|
61
|
+
|
|
62
|
+
outputs:
|
|
63
|
+
address:
|
|
64
|
+
type: "compute-create2"
|
|
65
|
+
arguments:
|
|
66
|
+
deployerAddress: "0x4e59b44847b379578588920ca78fbf26c0b4956c"
|
|
67
|
+
salt: "{{salt}}"
|
|
68
|
+
initCode: "{{creationCode}}"
|