SaplingExtendedSpendingKey.fromBytes constructor

SaplingExtendedSpendingKey.fromBytes(
  1. List<int> bytes
)

Implementation

factory SaplingExtendedSpendingKey.fromBytes(List<int> bytes) {
  bytes = bytes.exc(
    operation: "SaplingExtendedSpendingKey",
    name: "bytes",
    reason: "Invalid sapling extended spending key bytes length.",
    length: 169,
  );
  return SaplingExtendedSpendingKey(
    sk: SaplingExpandedSpendingKey.fromBytes(
      bytes.sublist(9 + 32, 9 + 32 + 96),
    ),
    keyData: SaplingZip32KeyData(
      depth: Bip32Depth(bytes[0]),
      fingerPrint: Bip32FingerPrint(bytes.sublist(1, 5)),
      index: Bip32KeyIndex.fromBytes(bytes.sublist(5, 9)),
      chainCode: Bip32ChainCode(bytes.sublist(9, 9 + 32)),
      dk: SaplingDiversifierKey(bytes.sublist(9 + 32 + 96)),
    ),
  );
}