ss58 1.1.3 copy "ss58: ^1.1.3" to clipboard
ss58: ^1.1.3 copied to clipboard

Provides encoding and decoding methods for parsing substrate SS58 addresses.

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);
1
likes
160
points
1.08k
downloads

Publisher

verified publisherpolkadart.dev

Weekly Downloads

Provides encoding and decoding methods for parsing substrate SS58 addresses.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

base_x, convert, cryptography, equatable

More

Packages that depend on ss58