getAddress method

String getAddress(
  1. Bip32KeyIndex firstIndex,
  2. Bip32KeyIndex secondIndex, {
  3. ADANetwork network = ADANetwork.mainnet,
})

Computes and returns a Cardano Byron Legacy address based on two key indices, 'firstIndex' and 'secondIndex'.

Parameters:

  • 'firstIndex': The first key index for address derivation.
  • 'secondIndex': The second key index for address derivation.

Implementation

String getAddress(
  Bip32KeyIndex firstIndex,
  Bip32KeyIndex secondIndex, {
  ADANetwork network = ADANetwork.mainnet,
}) {
  final pubKey = getPublicKey(
    firstIndex: firstIndex,
    secondIndex: secondIndex,
  );
  final hdPath = _getDerivationPath(firstIndex, secondIndex);
  return AdaByronLegacyAddrEncoder().encodeKey(
    pubKey.key.compressed,
    chainCode: pubKey.keyData.chainCode.toBytes(),
    path: hdPath,
    hdPathKey: hdPathKey,
    network: network,
  );
}