Bip44Base.fromExtendedKey constructor

Bip44Base.fromExtendedKey(
  1. String extendedKey,
  2. BipCoinConfig coin
)

Constructor for creating a Bip44Base object from a extended key and coin.

Implementation

Bip44Base.fromExtendedKey(String extendedKey, BipCoinConfig coin) {
  Bip32Base bip;

  switch (coin.type) {
    case EllipticCurveTypes.secp256k1:
      bip = Bip32Slip10Secp256k1.fromExtendedKey(extendedKey, coin.keyNetVer);
      break;
    case EllipticCurveTypes.ed25519:
      bip = Bip32Slip10Ed25519.fromExtendedKey(extendedKey, coin.keyNetVer);
      break;
    case EllipticCurveTypes.ed25519Kholaw:
      if (coin.addrParams["is_icarus"] == true) {
        bip = CardanoIcarusBip32.fromExtendedKey(extendedKey, coin.keyNetVer);

        break;
      }
      bip = Bip32KholawEd25519.fromExtendedKey(extendedKey, coin.keyNetVer);
      break;
    case EllipticCurveTypes.ed25519Blake2b:
      bip = Bip32Slip10Ed25519Blake2b.fromExtendedKey(
          extendedKey, coin.keyNetVer);
      break;
    case EllipticCurveTypes.nist256p1:
      bip = Bip32Slip10Nist256p1.fromExtendedKey(extendedKey, coin.keyNetVer);
      break;
    default:
      throw const ArgumentException("invaid type");
  }
  final validate = _validate(bip, coin);
  bip32 = validate.item1;
  coinConf = validate.item2;
}