Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failed sync of evm wallets #668

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- fixed: EVM balance sync failure if missing API key for one node type

## 2.11.1 (2023-11-10)

- fixed: Use transaction type 0 (legacy transactions) currencies which do no support EIP-1559
Expand Down
8 changes: 7 additions & 1 deletion src/ethereum/EthereumNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,13 @@ export class EthereumNetwork {

let funcs: Array<() => Promise<any>> = []
rpcServers.forEach(rpcServer => {
const rpcServerWithApiKey = this.addRpcApiKey(rpcServer)
let rpcServerWithApiKey: string
try {
rpcServerWithApiKey = this.addRpcApiKey(rpcServer)
} catch (e) {
// addRpcApiKey can throw if there's a missing apikey. skip this rpcServer
return
}
Comment on lines +1540 to +1546
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if all RPC servers fail on this adding of key step, then this means balance checking via RPC is not possible. There are other methods to get balances which wont be used because of the condition on line 1787. This can surface itself as a bug as well, so this only partly fixes the problem.

const ethProvider = new ethers.providers.JsonRpcProvider(
rpcServerWithApiKey,
chainParams.chainId
Expand Down