Skip to content

fix(wallet): network-aware wallet balance + address prefix (closes #148) - #181

Merged
Reiers merged 1 commit into
mainfrom
fix/wallet-balance-network
Oct 26, 2026
Merged

Reiers merged 1 commit into
mainfrom
fix/wallet-balance-network

Conversation

@Reiers

@Reiers Reiers commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Closes #148.

Picks up the two items that were still open on #148, following the approach @sharmis-tp proposed in the issue (thank you!):

  1. wallet balance is network-aware. It now asks the running daemon for the selected network via daemonRPC and the admin token (same path as wallet send), instead of building an offline ChainAPI against the hardcoded mainnet gateway. On a calibration or devnet node it previously reported mainnet balances.
  2. Address display prefix. cmdWallet calls applyAddressNetwork(cliWalletNetwork) once, so every wallet subcommand prints t-prefixed addresses on calibration/devnet and f-prefixed on mainnet.

Tests: TestApplyAddressNetworkPrefix (mainnet/calibration/devnet prefixes) and TestParseAttoFIL. go build ./..., go vet ./cmd/lantern and go test ./cmd/lantern are green.

Verified against a calibration daemon: lantern wallet --network calibration balance t410f... returned the same balance as a public calibration RPC, to the attoFIL.

wallet balance now asks the running daemon for the selected network
(daemonRPC + admin token, same as wallet send) instead of the hardcoded
mainnet gateway, and cmdWallet applies the network's address prefix once
so calibration/devnet print t-addresses.

Approach proposed by @sharmis-tp in #148.
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.

wallet subcommands are not network-aware (always operate on the default network's keystore)

1 participant