Skip to content

Commit

Permalink
partial sdk fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-savu committed Oct 17, 2023
1 parent 21a2ddb commit cbf0867
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions typescript/sdk/src/contracts/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,15 @@ export function connectContracts<F extends HyperlaneFactories>(
contracts: HyperlaneContracts<F>,
connection: Connection,
): HyperlaneContracts<F> {
return objMap(
contracts,
(_, contract) => contract.connect(connection) as typeof contract,
);
const connectedContracts = objMap(contracts, (_, contract) => {
if (!contract.connect) {
return undefined;
}
return contract.connect(connection) as typeof contract;
});
return Object.fromEntries(
Object.entries(connectedContracts).filter(([_, contract]) => !!contract),
) as HyperlaneContracts<F>;
}

export function connectContractsMap<F extends HyperlaneFactories>(
Expand Down

0 comments on commit cbf0867

Please sign in to comment.