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 Solana SOL address.

This method decodes a Solana SOL address from the given Base58-encoded input string. It expects an optional map of keyword arguments. It decodes the address, validates its byte length, and returns the decoded address as a List

Parameters:

  • addr: The Base58-encoded Solana SOL address to be decoded.
  • kwargs: Optional keyword arguments for customization (not used in this implementation).

Returns: A List

Throws:

  • FormatException if the decoded address has an incorrect byte length.

Implementation

@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
  /// Decode the Solana SOL address from Base58.
  final addrDecBytes = Base58Decoder.decode(addr);

  /// Validate the byte length of the decoded address.
  AddrDecUtils.validateBytesLength(
      addrDecBytes, Ed25519KeysConst.pubKeyByteLen);

  /// Return the decoded address as a List<int>.
  return List<int>.from(addrDecBytes);
}