encodeKey method
Blockchain address encoder for Ada Shelley addresses. This encoder is used to create addresses based on public and private key pairs.
Implementation
@override
String encodeKey(
List<int> pubKey, {
ADANetwork network = ADANetwork.mainnet,
}) {
/// Validate and retrieve public keys.
final pubKeyObj = AddrKeyValidator.validateAndGetEd25519Key(pubKey);
// Compute key hashes for public spending and public delegation keys.
final pubKeyHash = AdaShelleyAddrUtils.keyHash(
pubKeyObj.compressed.sublist(1),
);
return AdaShelleyAddrUtils.encode(
credential: AdaStakeCredential(
hash: pubKeyHash,
type: AdaStakeCredType.key,
),
network: network,
hrp: AdaShelleyAddrUtils.getAddressHrp(network),
type: ADAAddressType.enterprise,
);
}