Skip to content

Commit

Permalink
fix chain filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalaji committed Feb 12, 2024
1 parent 851a035 commit bd1e2df
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
15 changes: 14 additions & 1 deletion typescript/sdk/src/contracts/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,26 @@ export async function filterOwnableContracts(
}

export function appFromAddressesMapHelper<F extends HyperlaneFactories>(
addressesMap: HyperlaneAddressesMap<any>,
unfilteredAddressesMap: HyperlaneAddressesMap<any>,
factories: F,
multiProvider: MultiProvider,
supportedChainNames?: string[],
): {
contractsMap: HyperlaneContractsMap<F>;
multiProvider: MultiProvider;
} {
let addressesMap;
if (supportedChainNames) {
addressesMap = objFilter(
unfilteredAddressesMap,
(chain, _): _ is HyperlaneAddresses<any> => {
return supportedChainNames.includes(chain);
},
);
} else {
addressesMap = unfilteredAddressesMap;
}

// Hack to accommodate non-Ethereum artifacts, while still retaining their
// presence in the addressesMap so that they are included in the list of chains
// on the MultiProvider (needed for getting metadata). A non-Ethereum-style address
Expand Down
1 change: 1 addition & 0 deletions typescript/sdk/src/core/HyperlaneCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class HyperlaneCore extends HyperlaneApp<CoreFactories> {
addressesMap,
coreFactories,
multiProvider,
supportedChainNames,
);
return new HyperlaneCore(
helper.contractsMap,
Expand Down
1 change: 1 addition & 0 deletions typescript/sdk/src/gas/HyperlaneIgp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class HyperlaneIgp extends HyperlaneApp<IgpFactories> {
addressesMap,
igpFactories,
multiProvider,
supportedChainNames,
);
return new HyperlaneIgp(
helper.contractsMap,
Expand Down
1 change: 1 addition & 0 deletions typescript/sdk/src/ism/HyperlaneIsmFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class HyperlaneIsmFactory extends HyperlaneApp<ProxyFactoryFactories> {
addressesMap,
proxyFactoryFactories,
multiProvider,
supportedChainNames,
);
return new HyperlaneIsmFactory(
helper.contractsMap,
Expand Down

0 comments on commit bd1e2df

Please sign in to comment.