frequency
frequency copied to clipboard
[Feature]: Get all my staking targets and what I have staked with them, in one call
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 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' }