frequency icon indicating copy to clipboard operation
frequency copied to clipboard

[Feature]: Get all my staking targets and what I have staked with them, in one call

Open shannonwells opened this issue 1 year ago • 1 comments

Feature Description

Details

As a staker, I may have staked to a number of different targets over a long period of time, and may have lost track. For that and for convenience, I would like to be able to know how much I have staked and with what Provider in one (RPC) call.

shannonwells avatar Oct 02 '24 21:10 shannonwells

@shannonwells is the idea here that the following is too cumbersome?

          const info = await apiPromise.query.capacity.stakingTargetLedger.entries(
            getUnifiedAddress(stakeKeys)
          );
          info.map(([key, value]) => console.log(key.toHuman(), value.toHuman()));

sample results:

[ '5CPZEZg2A9PMKidzCAoADjjGYJYCwNvM87gnU3uboLbfweTK', '25' ] { amount: '1,000,000', capacity: '20,000' }
[ '5CPZEZg2A9PMKidzCAoADjjGYJYCwNvM87gnU3uboLbfweTK', '26' ] { amount: '1,000,000', capacity: '20,000' }

JoeCap08055 avatar Jul 31 '25 18:07 JoeCap08055