Bip44Base<BIP44 extends Bip44Base<BIP44> >.fromExtendedKey constructor
Bip44Base<BIP44 extends Bip44Base<BIP44> >.fromExtendedKey (
- String extendedKey,
- BaseBipCoinConfig<
BaseCoinConfig> coin
Constructor for creating a Bip44Base object from a extended key and coin.
Implementation
Bip44Base.fromExtendedKey(String extendedKey, BaseBipCoinConfig 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.defaultHdKeyDerivator == DefaultHdKeyDerivator.icarus) {
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;
case EllipticCurveTypes.nist256p1Hybrid:
bip = Bip32Slip10Nist256p1Hybrid.fromExtendedKey(
extendedKey,
coin.keyNetVer,
);
break;
default:
throw ArgumentException.invalidOperationArguments(
"Bip44",
name: "coin",
reason: "Unsupported coin key algorithm",
details: {"algorithm": coin.type.name},
);
}
final validate = _validate(bip, coin);
bip32 = validate.$1;
coinConf = validate.$2;
}