Skip to content

[etherscan] multi-chain support, merchants, Arbitrum One#959

Open
dudkitt wants to merge 1 commit into
zenmoney:masterfrom
dudkitt:etherscan-APIv2
Open

[etherscan] multi-chain support, merchants, Arbitrum One#959
dudkitt wants to merge 1 commit into
zenmoney:masterfrom
dudkitt:etherscan-APIv2

Conversation

@dudkitt
Copy link
Copy Markdown
Contributor

@dudkitt dudkitt commented Mar 9, 2026

Summary

Follow-up to discussion in PR #942

Extends the etherscan plugin to support multiple EVM chains simultaneously via Etherscan APIv2. Adds Arbitrum One alongside existing Ethereum and BSC support. Introduces known contract merchant resolution.

Changes

Multi-chain architecture

  • Replace single-chain ListPreference with per-chain CheckBoxPreference (Ethereum enabled by default)
  • Scrape loop iterates over all selected chains, fetching balances and transactions independently per chain
  • Pass chain explicitly through all API and converter functions instead of reading from preferences.chain
  • Preserve legacy fallback: old single-chain configs still work via parseChains()

Arbitrum One

  • Add chain config (chainid=42161), native instrument (μETH), and ChainMinTimestamp to prevent "No closest block found" errors
  • Add USDT/USDC token configs for Arbitrum One

Account ID namespacing

  • Prefix account id and syncIds with chainId ({chainId}-{address}) to avoid collisions when the same wallet is tracked across multiple networks

Merchants

  • Add common/merchants.ts with per-chain known contract dictionaries (DEX routers, bridges, lending protocols)
    normalizeMerchant() resolves contract addresses to human-readable names, marks self-transfers as "Self", and formats unknown contracts as Contract 0x1234…5678
  • Applied in both ether and token transaction converters

Bug fix

  • mergeTransferTransactions: prevent merging two movements with the same account.id into a transfer (ZenMoney rejects transfers where incomeAccount == outcomeAccount)

Other

  • Translate all preference dialogs and manifest description to English
  • Update tests and mocks for new multi-chain structure
  • Bump build to 5

Risks

⚠️ Breaking change for existing users: account id and syncIds format changed from {address} to {chainId}-{address}. Users who configured the plugin in a previous version will lose account matching — ZenMoney may create duplicate accounts or fail to link transactions to existing accounts. Manual re-linking of accounts in ZenMoney settings may be required after update.

Add Arbitrum One (chainid=42161) support alongside Ethereum and BSC
Replace single-chain ListPreference with per-chain CheckBoxPreferences (Ethereum enabled by default)
Iterate over all selected chains in scrape loop, fetching balances and transactions for each
Add chain prefix to account id and syncIds ({chainId}-{address}) to avoid collisions across networks
Add ChainMinTimestamp config to prevent "No closest block found" errors for networks with later launch dates
Add common/merchants.ts with per-chain known contract dictionaries (DEX, bridges, lending) and normalizeMerchant helper
Use normalizeMerchant in ether and token converters instead of raw addresses
Add USDT/USDC token configs for Arbitrum One
Fix mergeTransferTransactions: prevent merging movements with the same account id into a transfer
Pass chain explicitly through all API and converter functions instead of reading from preferences.chain
Preserve legacy fallback: old single-chain configs still work via parseChains
Translate all preference dialogs and manifest description to English
Update tests and mocks for new multi-chain structure
Bump build to 5
@skvav
Copy link
Copy Markdown
Member

skvav commented Mar 26, 2026

@dudkitt It’s better to preserve the previous architecture, which supports selecting a chain and multiple wallet addresses - just add support for the new chain.

@dudkitt
Copy link
Copy Markdown
Contributor Author

dudkitt commented Mar 26, 2026

@dudkitt It’s better to preserve the previous architecture, which supports selecting a chain and multiple wallet addresses - just add support for the new chain.

EVM Wallet: 1 address on multiple blockchains. According to the logic of the previous architecture, I need to create multiple syncs for the required number of blockchains, each with the same address and the same API key. This leads to syncing issues due to overlapping addresses (account numbers) currently generated from the wallet address. There is also an issue with the free API plan limitation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants