decodeAddr method
Overrides the base class method to decode a P2SH (Pay-to-Script-Hash) address.
This method decodes a P2SH address from the provided input string using Base58 encoding. It expects an optional map of keyword arguments with 'hrp' specifying the Human-Readable Part (HRP) and 'net_ver' for the network version bytes of the address. It validates the arguments and delegates the decoding process to a specialized P2PKH address decoder (BchP2PKHAddrDecoder).
Parameters:
- addr: The P2SH address to be decoded.
- kwargs: Optional keyword arguments with 'hrp' for HRP and 'net_ver' for network version.
Returns: A List
Implementation
@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
/// Validate HRP and network version arguments.
AddrKeyValidator.validateAddressArgs<String>(kwargs, "hrp");
AddrKeyValidator.validateAddressArgs<List<int>>(kwargs, "net_ver");
final String hrp = kwargs['hrp'];
final List<int> netVerBytes = kwargs['net_ver'];
/// Delegate the decoding process to a specialized P2PKH address decoder with HRP and network version.
return BchP2PKHAddrDecoder()
.decodeAddr(addr, {'hrp': hrp, 'net_ver': netVerBytes});
}