coinsFor static method
Coins having at least one claim for kind that is not impossible.
Sorted with ready coins first. Covers every proposal enum
(BIP-44 bitcoin and BIP-84 bitcoin are distinct entries, as they
should be — different purposes, different addresses).
Implementation
static List<CryptoCoins> coinsFor(BuHwKind kind) {
final out = <CryptoCoins>[];
for (final coin in CryptoCoins.values) {
final rows = rowsFor(coin).where((r) => r.device == kind).toList();
if (rows.any((r) => r.readiness != HwReadiness.impossible)) {
out.add(coin);
}
}
out.sort((a, b) {
final ra = hwBest([
for (final r in rowsFor(a))
if (r.device == kind) r,
]);
final rb = hwBest([
for (final r in rowsFor(b))
if (r.device == kind) r,
]);
return rb.index.compareTo(ra.index);
});
return out;
}