evm

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package evm reads an Ethereum-compatible wallet (Ledger, MetaMask…) from its public address: native coin and ERC-20 history and balances, on one or more networks. Nothing is signed and no secret is needed.

Data comes from each network's Blockscout instance through its Etherscan-compatible API (module=account: txlist, txlistinternal, tokentx, balance, tokenbalance), or from Etherscan's v2 API (one host, chainid parameter) when an Etherscan key is given.

Limits of this first version:

  • a swap on a DEX shows as its two legs (a Withdrawal of what was sent and a Deposit of what was received), not as a Trade;
  • spam tokens are skipped by heuristics (see spam), and well-known symbols (USDC, USDT, DAI, WETH, WBTC) only count from their canonical contract, so a counterfeit "USDT" airdrop is ignored;
  • the L1 data fee of rollups is added when the API returns it (l1Fee, L1FeesPaid); Blockscout's txlist does not, so ETH on L2s can show a tiny reconciliation gap.

Index

Constants

View Source
const All = "all"

All is the "chains" value that reads every supported network.

Variables

This section is empty.

Functions

func Networks

func Networks() []string

Networks lists the supported networks by name.

func New

func New(cfg source.Config) (source.Source, error)

New builds the connector from its settings.

Types

type Chain

type Chain struct {
	Name    string // as typed in the settings
	ID      int    // EIP-155 chain id (Etherscan v2, Blockscout PRO)
	Native  string // native coin symbol
	Decimal int32
	// Free: an Etherscan-compatible explorer that answers without a key
	// ("" when none does any more).
	Free string
	// Pro: indexed by Blockscout's PRO API, free with a key.
	Pro bool
}

Chain is a supported network.

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source is a configured wallet.

func (*Source) Activities

func (s *Source) Activities(ctx context.Context, f source.Fetch) error

func (*Source) Balances

func (s *Source) Balances(ctx context.Context) ([]model.Balance, error)

func (*Source) State

func (s *Source) State() []byte

func (*Source) Test

func (s *Source) Test(ctx context.Context) error

Test checks the address answers on the first network.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL