Skip to content

Commit

Permalink
Added switchChain after adding chain.
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Alvarado committed Sep 22, 2023
1 parent 5247f4c commit bf86626
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions engine/paima-mw-core/src/wallets/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ async function switchChain(): Promise<boolean> {
// 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);
Expand Down
6 changes: 3 additions & 3 deletions engine/paima-providers/src/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ export class EvmProvider implements IProvider<EvmApi> {
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);
}
};
}

0 comments on commit bf86626

Please sign in to comment.