1

We are trying to achieve staking automation to nominationPool.

Is there any solution to get the number of bonded & unbound (unlocked) funds using the Polakdot-JS API?

We would like to fetch the amount(number) of funds in the nomination pool so that we could withdraw them automatically.

Thank you, The Starfish team

1
  • Just FYI automatic pool compound is on the road-map for Staking. Jan 12 at 14:59

1 Answer 1

1

To get the basic info of the storage of the pool

const bondedPools = await api.query.nominationPools.bondedPools(pool_id);
console.log(`----- Storage for bonded pools: ${bondedPools} -----`);

And to get the rewards accumulated for the pool (When a members payout is claimed, the balance comes out for here):

const rewardPools = await api.query.nominationPools.rewardPools(pool_id);
console.log(`-----  Reward pools: ${rewardPools} -----`);

To get the information for a certain pool member (With their Account ID):

const poolMemberInfo = await api.query.nominationPools.poolMembers("13KTxXt8FnzoraYSkQNddrmb6sTvEY2VKyg8J9c1jRGPzF5D");
console.log(`-----  Member Info: ${poolMemberInfo} -----`);

Then if you want to automate the process to join a pool, nominate, bond tokens.... check the docs about how to call a Extrinsic with PolkadotJS: https://polkadot.js.org/docs/substrate/extrinsics/#nominationpools

2
  • Hi Alex, thank you for your suggestion. Is there a way to get the number of bonded and unbound funds for certain pool member? Jan 12 at 9:28
  • Yes, I have updated the answer
    – Alex Bean
    Jan 12 at 9:34

Your Answer

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

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