Bip44PublicKey constructor

Bip44PublicKey(
  1. Bip32PublicKey pubKey,
  2. BipCoinConfig coinConf
)

Factory constructor to create a Bip44PublicKey from a Bip32PublicKey and a BipCoinConfig. It verifies that the elliptic curve type of the public key matches the coin's configuration.

Implementation

factory Bip44PublicKey(Bip32PublicKey pubKey, BipCoinConfig coinConf) {
  if (pubKey.curveType != coinConf.type) {
    throw ArgumentException(
      'The public key elliptic curve (${pubKey.curveType}) shall match '
      'the coin configuration one (${coinConf.type})',
    );
  }
  return Bip44PublicKey._(pubKey, coinConf);
}