Skip to content

Commit

Permalink
chore: add some checks for setupAndExport
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Jul 6, 2024
1 parent e3dfc3f commit 5422ee2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/axelar-local-dev/src/exportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ export async function setupAndExport(options: SetupLocalOptions) {
throw Error('At least 2 chains are required to setup and export');
}

for (const chain of chains) {
// check if given rpc url is valid using ethers.js to get latest block
const provider = new ethers.providers.JsonRpcProvider(chain.rpcUrl);
await provider.getBlockNumber().catch((e) => {
throw Error(`Please check if the ${chain.name} chain is running on ${chain.rpcUrl}`)
});
}

const _options = {
chainOutputPath: chainOutputPath || './local.json',
chains,
Expand Down

0 comments on commit 5422ee2

Please sign in to comment.