Bip44Base.fromSeed constructor

Bip44Base.fromSeed(
  1. List<int> seedBytes,
  2. BipCoinConfig coin
)

Constructor for creating a Bip44Base object from a seed and coin.

Implementation

Bip44Base.fromSeed(List<int> seedBytes, BipCoinConfig coin) {
  Bip32Base bip;
  switch (coin.type) {
    case EllipticCurveTypes.secp256k1:
      bip = Bip32Slip10Secp256k1.fromSeed(seedBytes, coin.keyNetVer);
      break;
    case EllipticCurveTypes.ed25519:
      bip = Bip32Slip10Ed25519.fromSeed(seedBytes, coin.keyNetVer);
      break;
    case EllipticCurveTypes.ed25519Kholaw:
      if (coin.addrParams["is_icarus"] == true) {
        bip = CardanoIcarusBip32.fromSeed(seedBytes, coin.keyNetVer);
        break;
      }
      bip = Bip32KholawEd25519.fromSeed(seedBytes, coin.keyNetVer);
      break;
    case EllipticCurveTypes.ed25519Blake2b:
      bip = Bip32Slip10Ed25519Blake2b.fromSeed(seedBytes, coin.keyNetVer);
      break;
    case EllipticCurveTypes.nist256p1:
      bip = Bip32Slip10Nist256p1.fromSeed(seedBytes, coin.keyNetVer);
      break;
    default:
      throw ArgumentException("Bip44 does not supported ${coin.type}");
  }
  final validate = _validate(bip, coin);
  bip32 = validate.item1;
  coinConf = validate.item2;
}