Skip to content

Commit eca071a

Browse files
committed
Refactor npm scripts
1 parent 5b56b80 commit eca071a

17 files changed

+290
-69
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ bun satellite:deploy CHAIN_ID
105105
> Note: Addresses of deployed contracts are saved to `deployed_satellites.json`. If contract for chain id, which you want to deploy, already exists in the config, it will fail. If you want to erase data about deployed contracts run
106106
>
107107
> ```
108-
> bun erase_deployed_satellites
108+
> bun detach_satellites
109109
> ```
110110
111111
### Upgrades

abi/11155111.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2438,4 +2438,4 @@
24382438
"stateMutability": "nonpayable",
24392439
"type": "function"
24402440
}
2441-
]
2441+
]

abi/11155420.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,4 +1727,4 @@
17271727
"stateMutability": "nonpayable",
17281728
"type": "function"
17291729
}
1730-
]
1730+
]

abi/300.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,4 +1727,4 @@
17271727
"stateMutability": "nonpayable",
17281728
"type": "function"
17291729
}
1730-
]
1730+
]

abi/33111.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,4 +1727,4 @@
17271727
"stateMutability": "nonpayable",
17281728
"type": "function"
17291729
}
1730-
]
1730+
]

abi/421614.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,4 +1844,4 @@
18441844
"stateMutability": "nonpayable",
18451845
"type": "function"
18461846
}
1847-
]
1847+
]

abi/4801.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,4 +1727,4 @@
17271727
"stateMutability": "nonpayable",
17281728
"type": "function"
17291729
}
1730-
]
1730+
]

package.json

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,17 @@
88
"preinstall": "npx only-allow bun",
99
"prettier": "prettier --write --list-different .",
1010
"prettier:check": "prettier --check .",
11-
"forge:build": "forge build && bun forge:selectors",
12-
"forge:build:zksync": "forge build --zksync && bun forge:selectors",
13-
"forge:test": "forge test",
14-
"forge:anvil": "anvil",
15-
"forge:selectors": "bun ts-helpers/get-all-function-selectors.ts",
16-
"forge:deploy": "source .env && export PRIVATE_KEY=$ANVIL_PRIVATE_KEY && forge script script/deploy/Satellite.s.sol:Deploy -vvv",
17-
"forge:deploy:anvil": "source .env && export PRIVATE_KEY=$ANVIL_PRIVATE_KEY && forge script script/deploy/Satellite.s.sol:Deploy --fork-url $ANVIL_RPC_URL --broadcast -vvv",
18-
"forge:deploy:sepolia": "source .env && forge script --chain sepolia script/deploy/Satellite.s.sol:Deploy --rpc-url $SEPOLIA_RPC_URL --broadcast --verify -vvv",
19-
"test_connection:optimism": "source .env && ETHERSCAN_API_KEY=$L1_ETHERSCAN_API_KEY forge script --chain sepolia script/TestConnectionOptimism.s.sol:TestConnectionOptimism --rpc-url $SEPOLIA_RPC_URL --broadcast -vvvv",
20-
"test_connection:arbitrum": "source .env && ETHERSCAN_API_KEY=$L1_ETHERSCAN_API_KEY forge script --chain sepolia script/TestConnectionArbitrum.s.sol:TestConnectionArbitrum --rpc-url $SEPOLIA_RPC_URL --broadcast -vvvv",
21-
"forge:deploy:update": "source .env && export PRIVATE_KEY=$ANVIL_PRIVATE_KEY && forge script -vvv",
22-
"forge:deploy:update:anvil": "source .env && export PRIVATE_KEY=$ANVIL_PRIVATE_KEY && forge script --fork-url $ANVIL_RPC_URL --broadcast -vvv",
23-
"forge:deploy:update:sepolia": "source .env && forge script --chain sepolia --rpc-url $SEPOLIA_RPC_URL --broadcast --verify -vvv",
2411
"clear": "rm -rf out cache",
2512
"clear:full": "bun run clear && rm -rf node_modules",
2613
"compile": "bun hardhat compile",
2714
"compile:zksync": "bun hardhat compile --network zkSyncSepolia",
28-
"connection:register": "bun run scripts/connect.ts",
29-
"satellite:deploy": "bun run scripts/deploy.ts",
30-
"satellite:upgrade": "bun run compile && bun run scripts/SatelliteUpgrade.ts",
31-
"erase_deployed_satellites": "echo \"{\n\t\\\"satellites\\\": [],\n\t\\\"connections\\\": []\n}\" > deployed_satellites.json",
32-
"generate_abi": "bun run scripts/generate-abi.ts"
15+
"satellite:deploy": "bun run compile && bun run scripts/satelliteDeploy.ts",
16+
"satellite:upgrade": "bun run compile && bun run scripts/satelliteUpgrade.ts",
17+
"satellite:remove": "bun run scripts/satelliteRemove.ts",
18+
"connection:register": "bun run scripts/connectionRegister.ts",
19+
"connection:remove": "bun run scripts/connectionRemove.ts",
20+
"detach_satellites": "echo \"{\n\t\\\"satellites\\\": [],\n\t\\\"connections\\\": []\n}\" > deployed_satellites.json",
21+
"generate_abi": "bun run scripts/generateAbi.ts"
3322
},
3423
"devDependencies": {
3524
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",

scripts/SatelliteUpgrade.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ export async function main() {
473473
getIgnitionModule(modules),
474474
);
475475

476+
// TODO: handle ZkSync
476477
const deployResult = (
477478
await $`bun hardhat ignition deploy ./ignition/modules/_autogenerated_upgrade.ts --network ${networkName} --verify`
478479
).text();
Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,52 @@ async function main() {
2525
const receiverChainId = Bun.argv[3] as keyof typeof settings;
2626

2727
if (!(senderChainId in settings)) {
28-
throw new Error(`No settings found for ${senderChainId}`);
28+
console.error(`No settings found for ${senderChainId}`);
29+
process.exit(1);
2930
}
3031

3132
if (!(receiverChainId in settings)) {
32-
throw new Error(`No settings found for ${receiverChainId}`);
33+
console.error(`No settings found for ${receiverChainId}`);
34+
process.exit(1);
3335
}
3436

3537
const senderSatellite = deployedSatellites.satellites.find(
3638
(s) => s.chainId === senderChainId,
3739
);
3840
if (!senderSatellite) {
39-
throw new Error(`No satellite deployment found for ${senderChainId}`);
41+
console.error(`No satellite deployment found for ${senderChainId}`);
42+
process.exit(1);
4043
}
4144

4245
const receiverSatellite = deployedSatellites.satellites.find(
4346
(s) => s.chainId === receiverChainId,
4447
);
4548
if (!receiverSatellite) {
46-
throw new Error(`No satellite deployment found for ${receiverChainId}`);
49+
console.error(`No satellite deployment found for ${receiverChainId}`);
50+
process.exit(1);
4751
}
4852

4953
if (
50-
deployedSatellites.connections.find(
54+
(deployedSatellites.connections as any[]).find(
5155
(c) =>
5256
parseInt(c.from) === parseInt(senderChainId) &&
5357
parseInt(c.to) === parseInt(receiverChainId),
5458
)
5559
) {
56-
throw new Error(
57-
`Connection already exists for ${senderChainId} -> ${receiverChainId}`,
60+
console.error(
61+
`Connection ${senderChainId} -> ${receiverChainId} already exists`,
5862
);
63+
process.exit(1);
5964
}
6065

6166
const connectionData = settings[senderChainId].connections.find(
6267
(c) => c.to === receiverChainId,
6368
);
6469
if (!connectionData) {
65-
throw new Error(
70+
console.error(
6671
`No connection data found for ${senderChainId} -> ${receiverChainId}`,
6772
);
73+
process.exit(1);
6874
}
6975

7076
const senderArgs = [
@@ -80,7 +86,7 @@ async function main() {
8086
]),
8187
];
8288

83-
await $`PRIVATE_KEY=${PRIVATE_KEY} CONTRACT_ADDRESS=${senderSatellite.contractAddress} ARGS=${senderArgs.join(",")} bun hardhat --network ${settings[senderChainId].network} run scripts/registerSatelliteConnection.ts`;
89+
await $`PRIVATE_KEY=${PRIVATE_KEY} CONTRACT_ADDRESS=${senderSatellite.contractAddress} ARGS=${senderArgs.join(",")} bun hardhat --network ${settings[senderChainId].network} run scripts/connectionRegister_inner.ts`;
8490

8591
// TODO: handle starknet
8692
if (settings[receiverChainId].network != "starknetSepolia") {
@@ -92,10 +98,10 @@ async function main() {
9298
"0x00000000",
9399
];
94100

95-
await $`PRIVATE_KEY=${PRIVATE_KEY} CONTRACT_ADDRESS=${receiverSatellite.contractAddress} ARGS=${receiverArgs.join(",")} bun hardhat --network ${settings[receiverChainId].network} run scripts/registerSatelliteConnection.ts`;
101+
await $`PRIVATE_KEY=${PRIVATE_KEY} CONTRACT_ADDRESS=${receiverSatellite.contractAddress} ARGS=${receiverArgs.join(",")} bun hardhat --network ${settings[receiverChainId].network} run scripts/connectionRegister_inner.ts`;
96102
}
97103

98-
deployedSatellites.connections.push({
104+
(deployedSatellites.connections as any[]).push({
99105
from: senderChainId,
100106
to: receiverChainId,
101107
});

0 commit comments

Comments
 (0)