createCkdChild method

HdCkdItem createCkdChild(
  1. String currentIndex,
  2. String currentPath,
  3. String parentPath,
  4. String pathFragment,
)

Implementation

HdCkdItem createCkdChild(String currentIndex, String currentPath, String parentPath, String pathFragment) {
  if (parentPath.toLowerCase() == Wallet.BIP0044_STANDARD_MASTER) {
    if (isHardenedChild(pathFragment)) {
      return HdCkdItem.hardenedDerivation(privateKey, chainCode, int.parse(currentIndex), currentPath, NullAdapter());
    }

    return HdCkdItem.derivation(publicKey, chainCode, int.parse(currentIndex), currentPath, NullAdapter());
  }

  var parentCkd = ckdChilds[parentPath];
  var adapter = getAdapter(currentIndex, parentPath, parentCkd!);

  if (isHardenedChild(pathFragment)) {
    return HdCkdItem.hardenedDerivation(parentCkd.privateKey, parentCkd.chainCode, int.parse(currentIndex), currentPath, adapter);
  }

  return HdCkdItem.derivation(parentCkd.publicKey, parentCkd.chainCode, int.parse(currentIndex), currentPath, adapter);

}