ss58

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

ss58

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');
copied to clipboard
Registry Info by Prefix #
// get registry info of given `prefix`

final polkadotRegistry = Codec.registry.getByPrefix(0);

print('polkadot registry: $polkadotRegistry');
copied to clipboard
Decoding Substrate Address #
// decoding substrate address

final String originalEncodedAddress = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';

final List<int> decodedBytes = Codec.fromNetwork('substrate').decode(originalEncodedAddress);

print('Substrate address bytes: $decodedBytes');
copied to clipboard
Encoding bytes to produce address #
// Encoding the decodedBytes to produce back encodedAddress.

final int substrateAddressPrefix = 42;

final encodedAddress = Codec(substrateAddressPrefix).encode(decodedBytes);

print(encodedAddress);
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.