Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- [#141](https://github.com/crypto-com/pystarport/pull/141) make cmd flag support multiple chains.
- [#142](https://github.com/crypto-com/pystarport/pull/142) add coin type when create account.
- [#145](https://github.com/crypto-com/pystarport/pull/145) Backward compatible with binary that don't have event-query-tx-for.
- [#147](https://github.com/crypto-com/pystarport/pull/147) suppport query exposed by the external community pool.

*Feb 7, 2023*

Expand Down
4 changes: 2 additions & 2 deletions pystarport/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ def query_all_txs(self, addr, i=0):
def distribution_commission(self, addr, i=0):
return self.cosmos_cli(i).distribution_commission(addr)

def distribution_community(self, i=0):
return self.cosmos_cli(i).distribution_community()
def distribution_community(self, i=0, **kwargs):
return self.cosmos_cli(i).distribution_community(**kwargs)

def distribution_reward(self, delegator_addr, i=0):
return self.cosmos_cli(i).distribution_reward(delegator_addr)
Expand Down
33 changes: 22 additions & 11 deletions pystarport/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,28 @@ def distribution_commission(self, addr):
res = res["commission"]
return parse_amount(res[0])

def distribution_community(self):
res = json.loads(
self.raw(
"query",
"distribution",
"community-pool",
output="json",
node=self.node_rpc,
)
)
return parse_amount(res["pool"][0])
def distribution_community(self, **kwargs):
for module in ["distribution", "protocolpool"]:
try:
res = json.loads(
self.raw(
"query",
module,
"community-pool",
output="json",
node=self.node_rpc,
**kwargs,
)
)
return parse_amount(res["pool"][0])
except Exception as e:
if (
module == "distribution"
and "CommunityPool query exposed by the external community pool"
in str(e)
):
continue
raise

def distribution_reward(self, delegator_addr):
res = json.loads(
Expand Down
Loading