hwCoinIdFor method

int hwCoinIdFor(
  1. CryptoCoins<BaseCoinConfig> coin
)

Connector coin id for coin, or throws BuError when the coin has no HW flow (unknown SLIP44 / unsupported curve variant).

Implementation

int hwCoinIdFor(CryptoCoins coin) {
  final conf = _bipConf(coin, 'hwCoinIdFor');
  final purpose =
      Bip32KeyIndex.unhardenIndex(coin.proposal.purpose.index).index;
  final id = hwCoinIdForSlip44(
    slip44: conf.coinIdx,
    type: conf.type,
    purpose: purpose,
  );
  if (id == null) {
    throw CoreErrors.invalidOperationArguments(
      'hwCoinIdFor',
      name: 'coin',
      reason:
          '${coin.runtimeType}.${coin.coinName} '
          '(slip44=${conf.coinIdx}, type=${conf.type.name}) '
          'has no hardware-wallet flow.',
    );
  }
  return id;
}