Skip to content

Commit

Permalink
fix(cli): missing single chain resolver (#5156)
Browse files Browse the repository at this point in the history
### Description

- Removed `SingleChainResolver` in favor of a single MultiChainResolver
class
- Fixed chain resolution logic to properly handle:
  - Single chain selection via `argv.chain`
  - Multiple chain selection via `argv.chains`
- Added proper handling for empty chain arrays to prevent unexpected
behavior

### Drive-by changes


### Related issues

None

### Backward compatibility

Yes

### Testing

Manual

---------

Co-authored-by: Morteza Shojaei <[email protected]>
Co-authored-by: mshojaei-txfusion <[email protected]>
  • Loading branch information
3 people authored Jan 15, 2025
1 parent 9574b1b commit aad2c2d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-knives-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Fixing the chain resolver checks and handling for argv.chain
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,20 @@ export class MultiChainResolver implements ChainResolver {
chains.push(argv.destination);
}

if (!argv.chains) {
return Array.from(
new Set([...chains, ...this.getEvmChains(multiProvider)]),
);
if (argv.chain) {
chains.push(argv.chain);
}

if (!argv.chains && chains.length === 0) {
return Array.from(this.getEvmChains(multiProvider));
}

return Array.from(
new Set([
...chains,
...argv.chains.split(',').map((item: string) => item.trim()),
...(argv.chains
? argv.chains.split(',').map((item: string) => item.trim())
: []),
]),
);
}
Expand Down
25 changes: 0 additions & 25 deletions typescript/cli/src/context/strategies/chain/SingleChainResolver.ts

This file was deleted.

0 comments on commit aad2c2d

Please sign in to comment.