Repository navigation
fix(wallet): network-aware wallet balance + address prefix (closes #148) - #181
Merged
Merged
Conversation
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.
This was referenced Oct 26, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #148.
Picks up the two items that were still open on #148, following the approach @sharmis-tp proposed in the issue (thank you!):
wallet balanceis network-aware. It now asks the running daemon for the selected network viadaemonRPCand the admin token (same path aswallet send), instead of building an offline ChainAPI against the hardcoded mainnet gateway. On a calibration or devnet node it previously reported mainnet balances.cmdWalletcallsapplyAddressNetwork(cliWalletNetwork)once, so every wallet subcommand prints t-prefixed addresses on calibration/devnet and f-prefixed on mainnet.Tests:
TestApplyAddressNetworkPrefix(mainnet/calibration/devnet prefixes) andTestParseAttoFIL.go build ./...,go vet ./cmd/lanternandgo test ./cmd/lanternare green.Verified against a calibration daemon:
lantern wallet --network calibration balance t410f...returned the same balance as a public calibration RPC, to the attoFIL.