From 520e1b58b46079f30f6b27011006679cdf29a1ba Mon Sep 17 00:00:00 2001 From: Kevin Peters Date: Thu, 16 Nov 2023 17:33:50 -0600 Subject: [PATCH] clients/js: Fix `maybeUnsupported` function Previously this function would not actually catch an exception and cause the program to crash. This commit fixes that. --- clients/js/src/evm.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/clients/js/src/evm.ts b/clients/js/src/evm.ts index bae4f175d..afe4d8d44 100644 --- a/clients/js/src/evm.ts +++ b/clients/js/src/evm.ts @@ -75,8 +75,8 @@ export async function query_contract_evm( ] = await Promise.all([ core.getGuardianSetExpiry(), core.chainId(), - maybeUnsupported(core.evmChainId()), - maybeUnsupported(core.isFork()), + maybeUnsupported(core.evmChainId), + maybeUnsupported(core.isFork), core.governanceChainId(), core.governanceContract(), core.messageFee(), @@ -140,8 +140,8 @@ export async function query_contract_evm( tb.tokenImplementation(), tb.chainId(), tb.finality(), - maybeUnsupported(tb.evmChainId()), - maybeUnsupported(tb.isFork()), + maybeUnsupported(tb.evmChainId), + maybeUnsupported(tb.isFork), tb.governanceChainId(), tb.governanceContract(), tb.WETH(), @@ -201,8 +201,8 @@ export async function query_contract_evm( nb.tokenImplementation(), nb.chainId(), nb.finality(), - maybeUnsupported(nb.evmChainId()), - maybeUnsupported(nb.isFork()), + maybeUnsupported(nb.isFork), + maybeUnsupported(nb.evmChainId), nb.governanceChainId(), nb.governanceContract(), registrationsPromiseNb, @@ -810,10 +810,10 @@ export async function setStorageAt( } const maybeUnsupported = async ( - query: Promise + query: () => Promise ): Promise => { try { - return query; + return await query(); } catch (e) { if (isUnsupportedError(e)) { return "unsupported";