Skip to content

Commit

Permalink
Problem: ica is incompatible with icaauth cmd (#137)
Browse files Browse the repository at this point in the history
* Problem: ica is incompatible with icaauth cmd

* add init

* add missing kwargs

* refactor cmd

* Revert "refactor cmd"

This reverts commit 4d2ff99.

---------

Co-authored-by: huangyi <[email protected]>
  • Loading branch information
mmsqe and yihuang authored Jul 24, 2024
1 parent 25f1334 commit 78d534c
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 53 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [#127](https://github.com/crypto-com/pystarport/pull/127) Support adding new key when patching config
- [#128](https://github.com/crypto-com/pystarport/pull/128) fix wrong description on empty flag when create validator and align flags for edit validator.
- [#129](https://github.com/crypto-com/pystarport/pull/129) create and get validator are incompatible.
- [#137](https://github.com/crypto-com/pystarport/pull/137) support ica and icaauth cmd.

*Feb 7, 2023*

Expand Down
88 changes: 62 additions & 26 deletions pystarport/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def transfer_from_ledger(
generate_only=False,
fees=None,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).transfer_from_ledger(
from_,
Expand All @@ -445,6 +446,7 @@ def transfer_from_ledger(
generate_only,
fees,
event_query_tx=event_query_tx,
**kwargs,
)

def get_delegated_amount(self, which_addr, i=0):
Expand All @@ -458,22 +460,27 @@ def delegate_amount(
i=0,
gas_price=None,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).delegate_amount(
to_addr,
amount,
from_addr,
gas_price,
event_query_tx=event_query_tx,
**kwargs,
)

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

# to_validator_addr: crocncl1... , from_from_validator_addraddr: crocl1...
Expand All @@ -496,54 +503,61 @@ def redelegate_amount(
**kwargs,
)

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

def make_multisig(self, name, signer1, signer2, i=0):
return self.cosmos_cli(i).make_multisig(name, signer1, signer2)

def sign_multisig_tx(self, tx_file, multi_addr, signer_name, i=0):
return self.cosmos_cli(i).sign_multisig_tx(tx_file, multi_addr, signer_name)
def sign_multisig_tx(self, tx_file, multi_addr, signer_name, i=0, **kwargs):
return self.cosmos_cli(i).sign_multisig_tx(
tx_file, multi_addr, signer_name, **kwargs
)

def sign_batch_multisig_tx(
self, tx_file, multi_addr, signer_name, account_num, sequence, i=0
self, tx_file, multi_addr, signer_name, account_num, sequence, i=0, **kwargs
):
return self.cosmos_cli(i).sign_batch_multisig_tx(
tx_file, multi_addr, signer_name, account_num, sequence
tx_file, multi_addr, signer_name, account_num, sequence, **kwargs
)

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

def sign_single_tx(self, tx_file, signer_name, i=0):
return self.cosmos_cli(i).sign_single_tx(tx_file, signer_name)
def sign_single_tx(self, tx_file, signer_name, i=0, **kwargs):
return self.cosmos_cli(i).sign_single_tx(tx_file, signer_name, **kwargs)

def combine_multisig_tx(self, tx_file, multi_name, signer1_file, signer2_file, i=0):
def combine_multisig_tx(
self, tx_file, multi_name, signer1_file, signer2_file, i=0, **kwargs
):
return self.cosmos_cli(i).combine_multisig_tx(
tx_file,
multi_name,
signer1_file,
signer2_file,
**kwargs,
)

def combine_batch_multisig_tx(
self, tx_file, multi_name, signer1_file, signer2_file, i=0
self, tx_file, multi_name, signer1_file, signer2_file, i=0, **kwargs
):
return self.cosmos_cli(i).combine_batch_multisig_tx(
tx_file,
multi_name,
signer1_file,
signer2_file,
**kwargs,
)

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

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

def create_validator(
self,
Expand Down Expand Up @@ -592,23 +606,27 @@ def edit_validator(
**kwargs,
)

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

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

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

def query_proposals(self, depositor=None, limit=None, status=None, voter=None, i=0):
Expand All @@ -630,6 +648,7 @@ def ibc_transfer(
target_version, # chain version number of target chain
i=0,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).ibc_transfer(
from_,
Expand All @@ -638,6 +657,7 @@ def ibc_transfer(
channel,
target_version,
event_query_tx=event_query_tx,
**kwargs,
)

def create_nft(
Expand All @@ -653,6 +673,7 @@ def create_nft(
fees=None,
i=0,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).create_nft(
from_addr,
Expand All @@ -661,6 +682,7 @@ def create_nft(
schema,
fees,
event_query_tx=event_query_tx,
**kwargs,
)

def query_nft(self, denomid="mydenomid", i=0):
Expand All @@ -679,6 +701,7 @@ def create_nft_token(
fees=None,
i=0,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).create_nft_token(
from_addr,
Expand All @@ -688,6 +711,7 @@ def create_nft_token(
uri,
fees,
event_query_tx=event_query_tx,
**kwargs,
)

def query_nft_token(self, denomid="mydenomid", tokenid="mytokenid", i=0):
Expand All @@ -700,12 +724,14 @@ def burn_nft_token(
tokenid="mytokenid",
i=0,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).burn_nft_token(
from_addr,
denomid,
tokenid,
event_query_tx=event_query_tx,
**kwargs,
)

def edit_nft_token(
Expand All @@ -717,6 +743,7 @@ def edit_nft_token(
newname="newname",
i=0,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).edit_nft_token(
from_addr,
Expand All @@ -725,6 +752,7 @@ def edit_nft_token(
newuri,
newname,
event_query_tx=event_query_tx,
**kwargs,
)

def transfer_nft_token(
Expand All @@ -735,13 +763,15 @@ def transfer_nft_token(
tokenid="mytokenid",
i=0,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).transfer_nft_token(
from_addr,
to_addr,
denomid,
tokenid,
event_query_tx=event_query_tx,
**kwargs,
)

def event_query_tx_for(self, hash, i=0):
Expand All @@ -750,33 +780,39 @@ def event_query_tx_for(self, hash, i=0):
def migrate_keystore(self, i=0):
return self.cosmos_cli(i).migrate_keystore()

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

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

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(
def ica_submit_tx(
self,
connid,
tx,
timeout_duration="1h",
i=0,
event_query_tx=True,
**kwargs,
):
return self.cosmos_cli(i).icaauth_submit_tx(
return self.cosmos_cli(i).ica_submit_tx(
connid,
tx,
timeout_duration,
event_query_tx=event_query_tx,
**kwargs,
)

def ica_generate_packet_data(self, tx, memo=None, encoding="proto3", i=0, **kwargs):
return self.cosmos_cli(i).ica_generate_packet_data(memo, encoding, **kwargs)


def start_cluster(data_dir):
cmd = [
Expand Down
Loading

0 comments on commit 78d534c

Please sign in to comment.