SS58
Provides encoding and decoding methods for parsing substrate addresses.
SS58 account examples can be finded in ss58-Registry.
Lets Get Started
Decoding a Polkadot Address Object
final address = Address.decode('1zugcag7cJVBtVRnFxv5Qftn7xKAnR6YJ9x4x3XLgGgmNnS');
Registry Info by Prefix
// get registry info of given `prefix`
final polkadotRegistry = Codec.registry.getByPrefix(0);
print('polkadot registry: $polkadotRegistry');
Decoding Substrate Address
// decoding substrate address
final String originalEncodedAddress = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
final List<int> decodedBytes = Codec.fromNetwork('substrate').decode(originalEncodedAddress);
print('Substrate address bytes: $decodedBytes');
Encoding bytes to produce address
// Encoding the decodedBytes to produce back encodedAddress.
final int substrateAddressPrefix = 42;
final encodedAddress = Codec(substrateAddressPrefix).encode(decodedBytes);
print(encodedAddress);