decodeAddr method
Decode a Stellar (XLM) address and return the public key.
This method decodes a Stellar address and extracts the public key part, returning it as a List<int>
.
addr
: The Stellar address to decode.kwargs
: A map of optional keyword arguments.addr_type
: The address type, either XlmAddrTypes.pubKey or XlmAddrTypes.privKey.
Throws an AddressConverterException if the address type is not valid or if there's a validation error.
Example usage:
final decoder = XlmAddrDecoder();
final addr = 'GC2Z66U3A3I5VGM3S5INUT4FVC3VGCUJ7ALDCTF6WLYBMXNO5KNOHWZL';
final publicKey = decoder.decodeAddr(addr, {'addr_type': XlmAddrTypes.pubKey});
Implementation
@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
final decodeAddress = decode(addr, kwargs);
return decodeAddress.pubKeyBytes;
}