0

Can you explain me how I retrieve (from Polkadot JS) :

  1. The nomination pool name (from a given pool Id)
  2. The stash account of nomination pool creator ?

For example, here is the first nomination pool : https://polkadot.subscan.io/nomination_pool/1

enter image description here How can I get the name : Paradox | ParaNodes.io - Nominating hight return ...

And from given creator account address : 12NRTphLWqYK5Tri7V2aVGcXWuJ78NFPPjwSN9ZkUxLhCa78, how do I retrieve 13UVJyLnbVp8c4FQeiGUYwmthuauL7RecwzpKCd3cwgRPCPp address ?

Thanks a lot for you help :)

Regards

1 Answer 1

1

To get the name you have to query the metadata:

const metadata = await api.query.nominationPools.metadata(pool_id);

The result is an hex value: 0x50617261646f78207c20506172614e6f6465732e696f20f09f9a80202d204e6f6d696e6174696e6720686967682072657475726e2c20747275737465642c20696e646570656e64656e742076616c696461746f72732e

You can convert it to String using the utils from the polkadotJS library:

const { hexToString } = require('@polkadot/util');
hexToString(metadata.toHuman()

This will return you the name: Paradox | ParaNodes.io 🚀 - Nominating high return, trusted, independent validators.

1
  • Thanks a lot ! I didn't realized the metadata utility :)
    – Apolixit
    Commented Jan 31, 2023 at 13:01

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.