mirror of
https://github.com/luxfi/sdk.git
synced 2026-10-30 15:19:23 +00:00
FetchState asked for an X-Chain context and returned the error when the network had none, so a P-only node -- Quasar-era mainnet registers P and C and no X -- could not build a wallet at all. That contradicts the design it was already documented to have: P required, X and C opt-in. The design had been written. "wallet/primary: decomplect — P required, X/C opt-in" landed FetchPState, AttachXChain and the fail-soft matcher, and four commits later "deps: go.mod refresh" -- a commit whose other 30 files are CI workflows and go.mod -- reverted this one file wholesale, taking all three with it and restoring the hard-failing FetchState. Nothing decided that; a refresh clobbered it. So this restores that shape rather than inventing one. FetchPState fetches P and nothing else, which is what a sovereign-L1 spawn, a validator operation or a CreateChainTx caller needs. AttachXChain is opt-in, idempotent, and fail-soft only on "this network has no X" -- every other RPC error still reaches the caller. FetchState is the P+X convenience that calls both. nil XCTX is how "not attached" reads. The attach also pulls X's UTXOs, which the reverted code left to a comment saying they were fetched separately: an X wallet built over an empty set reports insufficient funds whatever the balance. TestFetchState_XChainNotRegistered went from failing to passing, and it could only fail once the file compiled again. TestIsXChainNotEnabled returns with the matcher it covers. Co-authored-by: Hanzo Dev <[email protected]>