decodeAddr method

  1. @override
List<int> decodeAddr(
  1. String addr, [
  2. Map<String, dynamic> kwargs = const {}
])
override

Overrides the base class method to decode a Substrate address.

This method decodes a Substrate address from the given input string. It expects a map of optional keyword arguments, with the 'ss58_format' key specifying the expected SS58 format for the address. It validates the arguments, decodes the address, and returns the decoded address as a List

Parameters:

  • addr: The address to be decoded.
  • kwargs: Optional keyword arguments (e.g., 'ss58_format') for customization.

Returns: A List

Throws:

  • FormatException if the provided address is not in the expected SS58 format.

Implementation

@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
  final int? ss58Format =
      AddrKeyValidator.nullOrValidateAddressArgs<int>(kwargs, "ss58_format");
  final pubkeyBytes = _SubstrateAddrUtils.decodeAddr(addr, ss58Format).item1;
  AddrKeyValidator.validateAndGetSr25519Key(pubkeyBytes);
  return pubkeyBytes;
}