Bip44Base.fromPrivateKey constructor
Bip44Base.fromPrivateKey(
- List<
int> privateKeyBytes, - BipCoinConfig coin, {
- Bip32KeyData? keyData,
Constructor for creating a Bip44Base object from a private key and coin.
Implementation
Bip44Base.fromPrivateKey(List<int> privateKeyBytes, BipCoinConfig coin,
{Bip32KeyData? keyData}) {
Bip32Base bip;
switch (coin.type) {
case EllipticCurveTypes.secp256k1:
bip = Bip32Slip10Secp256k1.fromPrivateKey(privateKeyBytes,
keyData: keyData, keyNetVer: coin.keyNetVer);
break;
case EllipticCurveTypes.ed25519:
bip = Bip32Slip10Ed25519.fromPrivateKey(privateKeyBytes,
keyData: keyData, keyNetVer: coin.keyNetVer);
break;
case EllipticCurveTypes.ed25519Kholaw:
if (coin.addrParams["is_icarus"] == true) {
bip = CardanoIcarusBip32.fromPrivateKey(privateKeyBytes,
keyData: keyData, keyNetVer: coin.keyNetVer);
break;
}
bip = Bip32KholawEd25519.fromPrivateKey(privateKeyBytes,
keyData: keyData, keyNetVer: coin.keyNetVer);
break;
case EllipticCurveTypes.ed25519Blake2b:
bip = Bip32Slip10Ed25519Blake2b.fromPrivateKey(privateKeyBytes,
keyData: keyData, keyNetVer: coin.keyNetVer);
break;
case EllipticCurveTypes.nist256p1:
bip = Bip32Slip10Nist256p1.fromPrivateKey(privateKeyBytes,
keyData: keyData, keyNetVer: coin.keyNetVer);
break;
default:
throw const ArgumentException("invaid type");
}
final validate = _validate(bip, coin);
bip32 = validate.item1;
coinConf = validate.item2;
}