walletStateFixture function
WalletState
walletStateFixture({})
A complete, neutral WalletState for tests — override only what a case
cares about. PlatformInt64 is int on the host VM (web is out of scope
for this SDK), so plain int literals construct the money fields.
tip defaults to what the core reports: a snapshot read at a completed
pass (UpToDate) carries that pass's own tip; any other status, none.
Pass it explicitly to model a read taken mid-pass (a newer tip recorded).
Implementation
WalletState walletStateFixture({
SyncStatus syncStatus = const SyncStatus.idle(),
TorState tor = const TorState.off(),
BalanceSnapshot? balance,
int? tip,
SyncStamp? lastSynced,
bool everSynced = false,
bool rescanRebuilding = false,
int seq = 0,
}) {
return WalletState(
balance: balance ?? balanceFixture(),
syncStatus: syncStatus,
tor: tor,
tip:
tip ??
switch (syncStatus) {
SyncStatus_UpToDate(:final tip) => tip,
_ => null,
},
lastSynced: lastSynced,
everSynced: everSynced,
rescanRebuilding: rescanRebuilding,
seq: seq,
);
}