Skip to content

bitwindow: give FreeBank its settings button and running state - #2393

Closed
mblowes wants to merge 2 commits into
LayerTwo-Labs:masterfrom
mblowes:mb/freebank-gear
Closed

mblowes wants to merge 2 commits into
LayerTwo-Labs:masterfrom
mblowes:mb/freebank-gear

Conversation

@mblowes

@mblowes mblowes commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Branch mb/freebank-gear (two commits, b9fa087 and 1245ff6, on origin/master 882de28). Dart only: no proto, no chains_config, no Go.

The settings button. Each row of the Sidechains table ends with a cog (SailSVGAsset.settings). It opens ChainSettingsModal: the version (the orchestrator runs --version), repository, release and install dates, download file, hash check, paths, and "Wipe and reinstall".

Why FreeBank has none (and Elements Alpha and BBC have none either). The cog renders only when SidechainsViewModel.rpcForSlot(slot) returns an RPCConnection. That switch lists the L1 daemons and the seven L2L chains, then _ => null. FreeBank (slot 130), Elements Alpha (slot 24) and BBC (slot 1) have no connection registered in BitWindow, so their cell stays an empty 32 px box.

The missing connection hides more than the cog. BinaryProvider.isConnected / isInitializing / isStopping / connectionError and BackendStateProvider's mirror of ListBinaries all look the chain's connection up the same way. So while freebankd ran, the FreeBank row still showed Start, with no status dot, no Stop, no sync bar and no "Your balance".

What this adds.

  • sidechain_core/lib/rpcs/freebank_rpc.dart: abstract class FreeBankRPC extends SidechainRPC and class FreeBankLive extends FreeBankRPC, the same shape as the other chains. FreeBankLive has no client of its own and only talks to the orchestrator:
    • balance through GetSidechainBalance(BINARY_TYPE_FREEBANK)
    • height and headers through the FreeBank entry of GetSyncStatus
    • stop through StopBinary("freebank")
    • connection state mirrored from ListBinaries by BackendStateProvider, like every other chain
  • Calls the orchestrator does not serve for FreeBank throw UnsupportedError, as BbcRPC does: addresses, sends, fees, coins, transactions, mining, withdrawal bundles and raw calls. The deposit modal shows "Unsupported operation: fetching a FreeBank address. Paste one from your FreeBank wallet." and keeps the address field open for a paste. Without this it said "FreeBank is not running" while the node ran. BitWindow therefore cannot hand out a FreeBank deposit address; the orchestrator has no generic sidechain address route.
  • FreeBankLive() is registered in bitwindow/lib/main.dart and added to the BalanceProvider list.
  • FreeBank cases added to rpcForSlot, _sidechainRPC, _sidechainType, the deposit modal's lookup, BackendStateProvider._rpcForBinaryName and BinaryProvider._rpcFor. I checked every other switch that lists the L2L chains and left it alone. Those switches cover sidechain apps, update feeds, CLI names and avatars, and FreeBank has no Flutter app. For the same reason mocks.dart gets no MockFreeBankRPC: its mocks serve each chain's own app tests, and the tests here run FreeBankLive against a fake orchestrator.

When FreeBank is not installed or not running. The row shows Download or Start as before. The cog still opens the settings. BalanceProvider skips a chain that is not connected, so there is no orchestrator call and no log line. A chain that fails to answer logs its error once, as today.

Orchestrator side. The C++ (Core-fork) freebankd needs two orchestrator changes, and #2392 makes both. It removes the BitAssets bitcoin_balance reader for freebank, so the balance comes from freebankd's own wallet through getwalletinfo with cookie auth. It also gives the sidechain sync probe a cookie-authenticated Core path. Land #2392 first, then this PR with it or after it. Under today's Rust entry the row already works, because the Rust node answers the unauthenticated probe and bitcoin_balance.

Seen in a running BitWindow. This was on eCash betanet, with a GUI built from this branch and #2392, and a C++ freebankd running:

  • The FreeBank row showed the status dot, Stop, Sidechain Balance, Your balance and the cog.
  • The cog opened ChainSettingsModal with FreeBank's version (0.2.12), repository, release and install dates, and its paths.

Tests (Flutter 3.44.8 / Dart 3.12.2)

  • New sidechain_core/test/freebank_rpc_test.dart (7 tests) runs against a fake orchestrator. It checks four things:
    • balance comes from GetSidechainBalance for FreeBank, in sats converted to BTC
    • height and info come from the FreeBank sync entry, a sync error surfaces as its reason, and stop goes through StopBinary
    • each call the orchestrator does not serve throws UnsupportedError, and the deposit-address message is exact
    • BinaryProvider reads FreeBank's state, and BalanceProvider makes no orchestrator call for a stopped FreeBank
  • bitwindow/test/sidechains_table_test.dart gets a new FreeBank group (5 tests):
    • the row has the cog, and it opens ChainSettingsModal with the orchestrator's version
    • stopped: Start, the cog, and no balance read
    • not installed: Download and the cog
    • running: Stop, the "Connected" dot, and the balance read through the orchestrator
    • running and behind its headers: the sync bar
  • All five fail on origin/master's switches and pass with this change.
  • bitwindow/test/deposit_modal_test.dart gets one test: with FreeBank running, the address field stays open and the modal shows the exact message above.
  • dart analyze: no issues in sidechain_core, bitwindow or sail_ui. dart format: clean.
  • flutter test --concurrency=2: sidechain_core 196 passed, bitwindow 879 passed, sail_ui 489 passed.

Not in this PR.

  • The modal's "Installation directory" shows the config value .freebank rather than an absolute path, and a Core fork has no "Binary arguments" row, because the orchestrator computes its arguments at launch. Both come from shared modal code.
  • Elements Alpha and BBC would get their cog the same way, from a registered connection (BBC already has BbcRPC). I left them to their owners.
  • "Your balance" shows 0.00000000, not the dash, for a running chain whose balance read has never succeeded, because BalanceProvider.balanceFor defaults to zero. That holds for every chain; showing the dash until a first successful read is a small generic change for a separate PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT

mblowes and others added 2 commits September 25, 2026 02:16
FreeBank had no RPC connection in BitWindow, so its Sidechains row had no
settings button, and never showed Stop, the status dot, the sync bar or
Your balance while the node ran. FreeBankRPC reads all of it through the
orchestrator's generic routes, so any FreeBank build works.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
FreeBankRPC is now an abstract SidechainRPC with a FreeBankLive
implementation, as every other chain has. BitWindow registers
FreeBankLive.

The deposit modal shows "Unsupported operation: fetching a FreeBank
address. Paste one from your FreeBank wallet." The other unsupported
calls no longer name the app. The class doc is one line and no longer
says it works for any FreeBank build: the row reports balance and sync
only where the orchestrator serves them for FreeBank.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
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