2

I'm trying to get the associated KSM address for a generic address. I was wondering if there was a simple way to do this using polkadot-js library

2 Answers 2

2
const { encodeAddress } = polkadotUtilCrypto;
let kusama_prefix = 2;
let kusama_address = encodeAddress(generic_address, kusama_prefix);

For example:

polkadotUtilCrypto.encodeAddress("5DksjtJER6oLDWkWKCWcL3f1swPWeNNFsS9zHxa2rPa7LsH9", 2)

> "EGVQCe73TpFyAZx5uKfE1222XfkT3BSKozjgcqzLBnc5eYo" 
0

These are not in Polkadot{.js} API, however they are simple to use:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.