Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: event_query_tx is not optional #117

Merged
merged 16 commits into from
Feb 19, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- [#112](https://github.com/crypto-com/pystarport/pull/112) add cmd for migrate keystore.
- [#113](https://github.com/crypto-com/pystarport/pull/113) support ibc related cmd.
- [#115](https://github.com/crypto-com/pystarport/pull/115) avoid cli redundant migrated key log in stdout.
- [#117](https://github.com/crypto-com/pystarport/pull/117) make event_query_tx_for optional.


*Feb 7, 2023*
Expand Down
123 changes: 73 additions & 50 deletions pystarport/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,28 +410,19 @@ def transfer_offline(self, from_, to, coins, sequence, i=0, fees=None):
return self.cosmos_cli(i).transfer_offline(from_, to, coins, sequence, fees)

def transfer(
self,
from_,
to,
coins,
i=0,
generate_only=False,
fees=None,
self, from_, to, coins, i=0, generate_only=False, fees=None,
event_query_tx=True,
):
return self.cosmos_cli(i).transfer(
from_, to, coins, generate_only, fees, event_query_tx,
from_, to, coins, generate_only, fees, event_query_tx=event_query_tx,
)

def transfer_from_ledger(
self, from_, to, coins, i=0, generate_only=False, fees=None
self, from_, to, coins, i=0, generate_only=False, fees=None,
event_query_tx=True,
):
return self.cosmos_cli(i).transfer_from_ledger(
from_,
to,
coins,
generate_only,
fees,
from_, to, coins, generate_only, fees, event_query_tx=event_query_tx,
)

def get_delegated_amount(self, which_addr, i=0):
Expand All @@ -441,27 +432,37 @@ def delegate_amount(
self, to_addr, amount, from_addr, i=0, gas_price=None, event_query_tx=True,
):
return self.cosmos_cli(i).delegate_amount(
to_addr, amount, from_addr, gas_price, event_query_tx,
to_addr, amount, from_addr, gas_price,
event_query_tx=event_query_tx,
)

# to_addr: croclcl1... , from_addr: cro1...
def unbond_amount(self, to_addr, amount, from_addr, i=0):
return self.cosmos_cli(i).unbond_amount(to_addr, amount, from_addr)
def unbond_amount(self, to_addr, amount, from_addr, i=0, event_query_tx=True):
return self.cosmos_cli(i).unbond_amount(
to_addr, amount, from_addr, event_query_tx=event_query_tx,
)

# to_validator_addr: crocncl1... , from_from_validator_addraddr: crocl1...
def redelegate_amount(
self, to_validator_addr, from_validator_addr, amount, from_addr, i=0, **kwargs,
self,
to_validator_addr,
from_validator_addr,
amount,
from_addr,
i=0,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).redelegate_amount(
to_validator_addr,
from_validator_addr,
amount,
from_addr,
to_validator_addr, from_validator_addr, amount, from_addr,
event_query_tx=event_query_tx,
**kwargs,
)

def withdraw_all_rewards(self, from_delegator, i=0):
return self.cosmos_cli(i).withdraw_all_rewards(from_delegator)
def withdraw_all_rewards(self, from_delegator, i=0, event_query_tx=True):
return self.cosmos_cli(i).withdraw_all_rewards(
from_delegator, event_query_tx=event_query_tx,
)

def make_multisig(self, name, signer1, signer2, i=0):
return self.cosmos_cli(i).make_multisig(name, signer1, signer2)
Expand Down Expand Up @@ -503,8 +504,8 @@ def combine_batch_multisig_tx(
def broadcast_tx(self, tx_file, i=0):
return self.cosmos_cli(i).broadcast_tx(tx_file)

def unjail(self, addr, i=0):
return self.cosmos_cli(i).unjail(addr)
def unjail(self, addr, i=0, event_query_tx=True):
return self.cosmos_cli(i).unjail(addr, event_query_tx=event_query_tx)

def create_validator(
self,
Expand All @@ -519,6 +520,7 @@ def create_validator(
website="",
security_contact="",
details="",
event_query_tx=True,
):
"""MsgCreateValidator
create the node with create_node before call this"""
Expand All @@ -533,6 +535,7 @@ def create_validator(
website,
security_contact,
details,
event_query_tx=event_query_tx,
)

def edit_validator(
Expand All @@ -544,26 +547,25 @@ def edit_validator(
website=None,
security_contact=None,
details=None,
event_query_tx=True,
):
"""MsgEditValidator"""
return self.cosmos_cli(i).edit_validator(
commission_rate,
moniker,
identity,
website,
security_contact,
details,
commission_rate, moniker, identity, website, security_contact, details,
event_query_tx=event_query_tx,
)

def gov_propose(self, proposer, kind, proposal, i=0):
return self.cosmos_cli(i).gov_propose(proposer, kind, proposal)

def gov_vote(self, voter, proposal_id, option, i=0, event_query_tx=True):
return self.cosmos_cli(i).gov_vote(voter, proposal_id, option, event_query_tx)
return self.cosmos_cli(i).gov_vote(
voter, proposal_id, option, event_query_tx=event_query_tx,
)

def gov_deposit(self, depositor, proposal_id, amount, i=0, event_query_tx=True):
return self.cosmos_cli(i).gov_deposit(
depositor, proposal_id, amount, event_query_tx,
depositor, proposal_id, amount, event_query_tx=event_query_tx,
)

def query_proposals(self, depositor=None, limit=None, status=None, voter=None, i=0):
Expand All @@ -583,13 +585,10 @@ def ibc_transfer(
channel, # src channel
target_version, # chain version number of target chain
i=0,
event_query_tx=True,
):
return self.cosmos_cli(i).ibc_transfer(
from_,
to,
amount,
channel,
target_version,
from_, to, amount, channel, target_version, event_query_tx=event_query_tx,
)

def create_nft(
Expand All @@ -607,7 +606,7 @@ def create_nft(
event_query_tx=True,
):
return self.cosmos_cli(i).create_nft(
from_addr, denomid, denomname, schema, fees, event_query_tx,
from_addr, denomid, denomname, schema, fees, event_query_tx=event_query_tx,
)

def query_nft(self, denomid="mydenomid", i=0):
Expand All @@ -625,16 +624,27 @@ def create_nft_token(
uri="myuri",
fees=None,
i=0,
event_query_tx=True,
):
return self.cosmos_cli(i).create_nft_token(
from_addr, to_addr, denomid, tokenid, uri, fees
from_addr, to_addr, denomid, tokenid, uri, fees,
event_query_tx=event_query_tx,
)

def query_nft_token(self, denomid="mydenomid", tokenid="mytokenid", i=0):
return self.cosmos_cli(i).query_nft_token(denomid, tokenid)

def burn_nft_token(self, from_addr, denomid="mydenomid", tokenid="mytokenid", i=0):
return self.cosmos_cli(i).burn_nft_token(from_addr, denomid, tokenid)
def burn_nft_token(
self,
from_addr,
denomid="mydenomid",
tokenid="mytokenid",
i=0,
event_query_tx=True,
):
return self.cosmos_cli(i).burn_nft_token(
from_addr, denomid, tokenid, event_query_tx=event_query_tx,
)

def edit_nft_token(
self,
Expand All @@ -644,16 +654,23 @@ def edit_nft_token(
newuri="newuri",
newname="newname",
i=0,
event_query_tx=True,
):
return self.cosmos_cli(i).edit_nft_token(
from_addr, denomid, tokenid, newuri, newname
from_addr, denomid, tokenid, newuri, newname, event_query_tx=event_query_tx,
)

def transfer_nft_token(
self, from_addr, to_addr, denomid="mydenomid", tokenid="mytokenid", i=0
self,
from_addr,
to_addr,
denomid="mydenomid",
tokenid="mytokenid",
i=0,
event_query_tx=True,
):
return self.cosmos_cli(i).transfer_nft_token(
from_addr, to_addr, denomid, tokenid
from_addr, to_addr, denomid, tokenid, event_query_tx=event_query_tx,
)

def event_query_tx_for(self, hash, i=0):
Expand All @@ -665,14 +682,20 @@ def migrate_keystore(self, i=0):
def ibc_query_channels(self, connid, i=0):
return self.cosmos_cli(i).ibc_query_channels(connid)

def icaauth_register_account(self, connid, i=0):
return self.cosmos_cli(i).icaauth_register_account(connid)
def icaauth_register_account(self, connid, i=0, event_query_tx=True):
return self.cosmos_cli(i).icaauth_register_account(
connid, event_query_tx=event_query_tx,
)

def ica_query_account(self, connid, owner, i=0, **kwargs):
return self.cosmos_cli(i).ica_query_account(connid, owner, **kwargs)

def icaauth_submit_tx(self, connid, tx, timeout_duration="1h", i=0):
return self.cosmos_cli(i).icaauth_submit_tx(connid, tx, timeout_duration)
def icaauth_submit_tx(
self, connid, tx, timeout_duration="1h", i=0, event_query_tx=True,
):
return self.cosmos_cli(i).icaauth_submit_tx(
connid, tx, timeout_duration, event_query_tx=event_query_tx,
)


def start_cluster(data_dir):
Expand Down
Loading
Loading