encodeKey method
Blockchain address encoder for Ada Shelley staking addresses. This encoder is used to create staking addresses based on the network tag and public key.
Implementation
@override
String encodeKey(
List<int> pubKey, {
ADANetwork network = ADANetwork.mainnet,
}) {
/// Validate and get the Ed25519 public key object from the provided bytes.
final pubKeyObj = AddrKeyValidator.validateAndGetEd25519Key(pubKey);
/// Compute the public key hash based on the compressed key bytes.
final pubKeyHash = AdaShelleyAddrUtils.keyHash(
pubKeyObj.compressed.sublist(1),
);
return AdaShelleyAddrUtils.encode(
credential: AdaStakeCredential(
hash: pubKeyHash,
type: AdaStakeCredType.key,
),
network: network,
hrp: AdaShelleyAddrUtils.getRewardAddressHrp(network),
type: ADAAddressType.reward,
);
}