From bf8662607696f99a3870fac288875f87e02c3647 Mon Sep 17 00:00:00 2001 From: Edward Alvarado Date: Fri, 22 Sep 2023 11:14:42 -0300 Subject: [PATCH] Added switchChain after adding chain. --- engine/paima-mw-core/src/wallets/evm.ts | 3 +++ engine/paima-providers/src/evm.ts | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/engine/paima-mw-core/src/wallets/evm.ts b/engine/paima-mw-core/src/wallets/evm.ts index 1628bc9f9..f23429096 100644 --- a/engine/paima-mw-core/src/wallets/evm.ts +++ b/engine/paima-mw-core/src/wallets/evm.ts @@ -51,6 +51,9 @@ async function switchChain(): Promise { // blockExplorerUrls: Chain not added with empty string. blockExplorerUrls: getChainExplorerUri() ? [getChainExplorerUri()] : undefined, }); + await EvmConnector.instance() + .getOrThrowProvider() + .switchChain(hexChainId); return await verifyWalletChain(); } catch (addError) { errorFxn(PaimaMiddlewareErrorCode.ERROR_ADDING_CHAIN, addError); diff --git a/engine/paima-providers/src/evm.ts b/engine/paima-providers/src/evm.ts index 62586f86a..b41748c4f 100644 --- a/engine/paima-providers/src/evm.ts +++ b/engine/paima-providers/src/evm.ts @@ -195,15 +195,15 @@ export class EvmProvider implements IProvider { params: [tx], }); if (typeof hash !== 'string') { - console.log('[sendWalletTransaction] invalid signature:', hash); + console.log('[sendTransaction] invalid signature:', hash); throw new ProviderApiError( - `[sendWalletTransaction] Received "hash" of type ${typeof hash}` + `[sendTransaction] Received "hash" of type ${typeof hash}` ); } return hash; } catch (e: any) { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - throw new ProviderApiError(`[switchChain] error: ${e?.message}`, e?.code); + throw new ProviderApiError(`[sendTransaction] error: ${e?.message}`, e?.code); } }; }