encodeKey method
Overrides the base class method to encode a public key as a P2SH (Pay-to-Script-Hash) address.
Implementation
@override
String encodeKey(List<int> pubKey, {List<int>? netVersion, String? hrp}) {
hrp = AddrKeyValidator.getAddrArg<String>(hrp, "hrp");
netVersion = AddrKeyValidator.getAddrArg<List<int>>(
netVersion,
"netVersion",
);
/// Validate and process the public key as a Secp256k1 key.
final IPublicKey pubKeyObj = AddrKeyValidator.validateAndGetSecp256k1Key(
pubKey,
);
/// Encode the P2SH address using Bech32 encoding.
return BchBech32Encoder.encode(
hrp,
netVersion,
_P2SHAddrUtils.addScriptSig(pubKeyObj),
);
}