Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nomination pools Runtime API: Get a pool stash and reward address #6358

Closed
rossbulat opened this issue Nov 5, 2024 · 1 comment · Fixed by #6357
Closed

Nomination pools Runtime API: Get a pool stash and reward address #6358

rossbulat opened this issue Nov 5, 2024 · 1 comment · Fixed by #6357
Labels
I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@rossbulat
Copy link

rossbulat commented Nov 5, 2024

A good use case for a runtime API is to fetch a pool's stash and reward address. E.g. poolAddresses(poolId).

In Dapps we are currently using code similar to the following for determining a pool's stash and reward address, which adds complexity and deals with low level binary operations and magic constants - this is not too Dapp developer friendly:

  const createAccount = (poolId: BigNumber, index: number): string => {

    return api.registry
      .createType(
        'AccountId32',
        u8aConcat(
          ModPrefix,
          poolsPalletId,
          new Uint8Array([index]),
          bnToU8a(new BN(poolId.toString()), U32Opts),
          EmptyH256
        )
      )
      .toString();
  };

This seems to be a low hanging fruit to improve the developer experience for pools.

@kianenigma
Copy link
Contributor

cc @re-gius this can be prototyped on top of #4722

github-merge-queue bot pushed a commit that referenced this issue Nov 6, 2024
… the pool (#6357)

closes #6358

Adds the following runtime api to pallet-nomination-pools.
`pool_accounts(pool_id)`: Returns `(bonded_account, reward_account)`
associated with the `pool_id`.

cc: @rossbulat

---------

Co-authored-by: command-bot <>
Co-authored-by: Branislav Kontur <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
2 participants