From cbf0867ea943d3487d08c46c511e064bf2a325da Mon Sep 17 00:00:00 2001 From: Daniel Savu <23065004+daniel-savu@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:40:58 +0100 Subject: [PATCH] partial sdk fix --- typescript/sdk/src/contracts/contracts.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/typescript/sdk/src/contracts/contracts.ts b/typescript/sdk/src/contracts/contracts.ts index a6d8bb4000..aeb57ccebf 100644 --- a/typescript/sdk/src/contracts/contracts.ts +++ b/typescript/sdk/src/contracts/contracts.ts @@ -150,10 +150,15 @@ export function connectContracts( contracts: HyperlaneContracts, connection: Connection, ): HyperlaneContracts { - 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; } export function connectContractsMap(