Skip to content

Commit 5ba44cb

Browse files
committed
use custom func insert
1 parent 471b382 commit 5ba44cb

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

packages/arb-shared-dependencies/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,21 @@ const requireEnvVariables = (envVars) => {
5353
console.log('Environmental variables properly set 👍');
5454
};
5555

56-
const addCustomNetworkFromFile = () => {
56+
const addCustomNetworkFromFile = (registerFn) => {
5757
const pathToCustomNetworkFile = path.join(__dirname, '..', '..', 'customNetwork.json');
5858
if (!fs.existsSync(pathToCustomNetworkFile)) {
5959
return;
6060
}
6161

62+
// Use the provided register function, or fall back to the local one
63+
const register = registerFn || registerCustomArbitrumNetwork;
64+
6265
const customNetworkFileContents = fs.readFileSync(pathToCustomNetworkFile, 'utf8');
6366
const customNetworkInformation = JSON.parse(customNetworkFileContents);
6467
if (customNetworkInformation instanceof Array) {
65-
customNetworkInformation.map((customNetwork) => registerCustomArbitrumNetwork(customNetwork));
68+
customNetworkInformation.map((customNetwork) => register(customNetwork));
6669
} else {
67-
registerCustomArbitrumNetwork(customNetworkInformation);
70+
register(customNetworkInformation);
6871
}
6972
};
7073

packages/block-verification-in-parent-chain-assertion/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"exec": "ts-node scripts/exec.ts"
77
},
88
"dependencies": {
9+
"@arbitrum/sdk": "^v4.0.1",
910
"ts-node": "^10.9.2",
1011
"typescript": "^4.9.5"
1112
}

packages/block-verification-in-parent-chain-assertion/scripts/exec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { providers, Contract } from 'ethers';
2-
import { getArbitrumNetwork } from '@arbitrum/sdk';
2+
import { getArbitrumNetwork, registerCustomArbitrumNetwork } from '@arbitrum/sdk';
33
import { BoldRollupUserLogic__factory } from '@arbitrum/sdk/dist/lib/abi-bold/factories/BoldRollupUserLogic__factory';
44
import { arbLog, requireEnvVariables, addCustomNetworkFromFile } from 'arb-shared-dependencies';
55
require('dotenv').config();
@@ -16,7 +16,7 @@ const main = async (childChainBlockNumberToVerify: number) => {
1616
'Find whether a block of the child chain has been processed as part of an RBlock on the parent chain',
1717
);
1818

19-
addCustomNetworkFromFile();
19+
addCustomNetworkFromFile(registerCustomArbitrumNetwork);
2020

2121
const childChainNetwork = await getArbitrumNetwork(childChainProvider);
2222
const rollupAddress = childChainNetwork.ethBridge.rollup;

0 commit comments

Comments
 (0)