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 executing client.query_staking_summary(some_address), I expect to receive a dict containing accurate total_rewards value and relevant current_positions.
Because the reward_amount is being divided by 10**18, the resultant output is 0 since 10**18 is greater than the base unit of the cosmoshub blockchain.
I think the // COSMOS_SDK_DEC_COIN_PRECISION may be unnecessary in this line of code, but I don't know the full context of how this is used across all blockchains.
A possible fix is to rewrite this line to simply be: int(float(reward.amount))
without any division
To Reproduce
No response
Context
I instantiated a aerial client using the cosmoshub blockchain and requested staking details of an address that has > 1uatom of staking rewards.
Failure Logs
No response
The text was updated successfully, but these errors were encountered:
I've also encountered the same issue. The current solution is to use the following code to set this constant and make the method return the correct result.
Prerequisites
Expected Behavior
When executing
client.query_staking_summary(some_address)
, I expect to receive a dict containing accuratetotal_rewards
value and relevantcurrent_positions
.Current Behavior
The
total_rewards
is 0.When stepping through the code at https://github.com/fetchai/cosmpy/blob/master/cosmpy/aerial/client/__init__.py#L396 I identify that the
reward_amount
is accurate, however the// COSMOS_SDK_DEC_COIN_PRECISION
floor division results in a value of0.0
.Because the
reward_amount
is being divided by10**18
, the resultant output is0
since10**18
is greater than the base unit of thecosmoshub
blockchain.I think the
// COSMOS_SDK_DEC_COIN_PRECISION
may be unnecessary in this line of code, but I don't know the full context of how this is used across all blockchains.A possible fix is to rewrite this line to simply be:
int(float(reward.amount))
without any division
To Reproduce
No response
Context
I instantiated a aerial client using the
cosmoshub
blockchain and requested staking details of an address that has >1uatom
of staking rewards.Failure Logs
No response
The text was updated successfully, but these errors were encountered: