You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you call StargateClient.getBalance/CosmWasmClient.getBalance, the response does not contain staked amounts. It would be good to have a simple method that does this.
An implementation I tested looks like this:
exportfunctionaddCoins(lhs: Coin,rhs: Coin): Coin{if(lhs.denom!==rhs.denom)thrownewError("Trying to add two coins with different demoms");return{amount: Decimal.fromAtomics(lhs.amount,0).plus(Decimal.fromAtomics(rhs.amount,0)).atomics,denom: lhs.denom,};}const{ delegationResponses, pagination }=awaitqueryClient.staking.delegatorDelegations(address,);assert(pagination?.nextKey?.length===0);// TODO: support multiple pagesconststaked=delegationResponses.reduce((acc: Coin|null,resp)=>{// console.log(resp.balance);assert(resp.balance);if(acc){returnaddCoins(acc,resp.balance);}else{returnresp.balance;}},null);returnstaked;
The text was updated successfully, but these errors were encountered:
When you call
StargateClient.getBalance
/CosmWasmClient.getBalance
, the response does not contain staked amounts. It would be good to have a simple method that does this.An implementation I tested looks like this:
The text was updated successfully, but these errors were encountered: