From 7b1e404feb2e4067bbf0fef0892e2a9e71572d6a Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 24 Jul 2024 09:25:20 +0800 Subject: [PATCH] add missing kwargs --- pystarport/cluster.py | 79 +++++++++++++++++++++++++++++------------ pystarport/cosmoscli.py | 76 +++++++++++++++++++++++++++++++-------- 2 files changed, 117 insertions(+), 38 deletions(-) diff --git a/pystarport/cluster.py b/pystarport/cluster.py index 119b2c3..d717756 100644 --- a/pystarport/cluster.py +++ b/pystarport/cluster.py @@ -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_, @@ -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): @@ -458,6 +460,7 @@ def delegate_amount( i=0, gas_price=None, event_query_tx=True, + **kwargs, ): return self.cosmos_cli(i).delegate_amount( to_addr, @@ -465,15 +468,19 @@ def delegate_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... @@ -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, @@ -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): @@ -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_, @@ -638,6 +657,7 @@ def ibc_transfer( channel, target_version, event_query_tx=event_query_tx, + **kwargs, ) def create_nft( @@ -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, @@ -661,6 +682,7 @@ def create_nft( schema, fees, event_query_tx=event_query_tx, + **kwargs, ) def query_nft(self, denomid="mydenomid", i=0): @@ -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, @@ -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): @@ -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( @@ -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, @@ -725,6 +752,7 @@ def edit_nft_token( newuri, newname, event_query_tx=event_query_tx, + **kwargs, ) def transfer_nft_token( @@ -735,6 +763,7 @@ def transfer_nft_token( tokenid="mytokenid", i=0, event_query_tx=True, + **kwargs, ): return self.cosmos_cli(i).transfer_nft_token( from_addr, @@ -742,6 +771,7 @@ def transfer_nft_token( denomid, tokenid, event_query_tx=event_query_tx, + **kwargs, ) def event_query_tx_for(self, hash, i=0): @@ -750,13 +780,14 @@ 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 ica_register_account(self, connid, i=0, event_query_tx=True): + 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): @@ -769,12 +800,14 @@ def ica_submit_tx( timeout_duration="1h", i=0, event_query_tx=True, + **kwargs, ): 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): diff --git a/pystarport/cosmoscli.py b/pystarport/cosmoscli.py index cd070b2..5d06a29 100644 --- a/pystarport/cosmoscli.py +++ b/pystarport/cosmoscli.py @@ -398,6 +398,7 @@ def transfer_from_ledger( generate_only=False, fees=None, event_query_tx=True, + **kwargs, ): def send_request(): try: @@ -418,6 +419,7 @@ def send_request(): node=self.node_rpc, fees=fees, sign_mode="amino-json", + **kwargs, ) ) if not generate_only and self.output["code"] == 0 and event_query_tx: @@ -457,6 +459,7 @@ def delegate_amount( from_addr, gas_price=None, event_query_tx=True, + **kwargs, ): rsp = json.loads( self.raw( @@ -472,6 +475,7 @@ def delegate_amount( chain_id=self.chain_id, node=self.node_rpc, gas_prices=gas_price, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -479,7 +483,7 @@ def delegate_amount( return rsp # to_addr: croclcl1... , from_addr: cro1... - def unbond_amount(self, to_addr, amount, from_addr, event_query_tx=True): + def unbond_amount(self, to_addr, amount, from_addr, event_query_tx=True, **kwargs): rsp = json.loads( self.raw( "tx", @@ -493,6 +497,7 @@ def unbond_amount(self, to_addr, amount, from_addr, event_query_tx=True): keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -531,7 +536,7 @@ def redelegate_amount( return rsp # from_delegator can be account name or address - def withdraw_all_rewards(self, from_delegator, event_query_tx=True): + def withdraw_all_rewards(self, from_delegator, event_query_tx=True, **kwargs): rsp = json.loads( self.raw( "tx", @@ -543,6 +548,7 @@ def withdraw_all_rewards(self, from_delegator, event_query_tx=True): keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -560,7 +566,7 @@ def make_multisig(self, name, signer1, signer2): keyring_backend="test", ) - def sign_multisig_tx(self, tx_file, multi_addr, signer_name): + def sign_multisig_tx(self, tx_file, multi_addr, signer_name, **kwargs): return json.loads( self.raw( "tx", @@ -572,11 +578,18 @@ def sign_multisig_tx(self, tx_file, multi_addr, signer_name): keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) def sign_batch_multisig_tx( - self, tx_file, multi_addr, signer_name, account_number, sequence_number + self, + tx_file, + multi_addr, + signer_name, + account_number, + sequence_number, + **kwargs, ): r = self.raw( "tx", @@ -591,17 +604,19 @@ def sign_batch_multisig_tx( keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) return r.decode("utf-8") - def encode_signed_tx(self, signed_tx): + def encode_signed_tx(self, signed_tx, **kwargs): return self.raw( "tx", "encode", signed_tx, + **kwargs, ) - def sign_single_tx(self, tx_file, signer_name): + def sign_single_tx(self, tx_file, signer_name, **kwargs): return json.loads( self.raw( "tx", @@ -612,10 +627,13 @@ def sign_single_tx(self, tx_file, signer_name): keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) - def combine_multisig_tx(self, tx_file, multi_name, signer1_file, signer2_file): + def combine_multisig_tx( + self, tx_file, multi_name, signer1_file, signer2_file, **kwargs + ): return json.loads( self.raw( "tx", @@ -628,11 +646,12 @@ def combine_multisig_tx(self, tx_file, multi_name, signer1_file, signer2_file): keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) def combine_batch_multisig_tx( - self, tx_file, multi_name, signer1_file, signer2_file + self, tx_file, multi_name, signer1_file, signer2_file, **kwargs ): r = self.raw( "tx", @@ -645,16 +664,22 @@ def combine_batch_multisig_tx( keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) return r.decode("utf-8") - def broadcast_tx(self, tx_file): + def broadcast_tx(self, tx_file, **kwargs): r = self.raw( - "tx", "broadcast", tx_file, node=self.node_rpc, broadcast_mode="sync" + "tx", + "broadcast", + tx_file, + node=self.node_rpc, + broadcast_mode="sync", + **kwargs, ) return r.decode("utf-8") - def unjail(self, addr, event_query_tx=True): + def unjail(self, addr, event_query_tx=True, **kwargs): rsp = json.loads( self.raw( "tx", @@ -666,6 +691,7 @@ def unjail(self, addr, event_query_tx=True): node=self.node_rpc, keyring_backend="test", chain_id=self.chain_id, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -811,7 +837,7 @@ def edit_validator( rsp = self.event_query_tx_for(rsp["txhash"]) return rsp - def gov_propose(self, proposer, kind, proposal): + def gov_propose(self, proposer, kind, proposal, **kwargs): if kind == "software-upgrade": return json.loads( self.raw( @@ -834,6 +860,7 @@ def gov_propose(self, proposer, kind, proposal): node=self.node_rpc, keyring_backend="test", chain_id=self.chain_id, + **kwargs, ) ) elif kind == "cancel-software-upgrade": @@ -854,6 +881,7 @@ def gov_propose(self, proposer, kind, proposal): node=self.node_rpc, keyring_backend="test", chain_id=self.chain_id, + **kwargs, ) ) else: @@ -874,10 +902,11 @@ def gov_propose(self, proposer, kind, proposal): node=self.node_rpc, keyring_backend="test", chain_id=self.chain_id, + **kwargs, ) ) - def gov_vote(self, voter, proposal_id, option, event_query_tx=True): + def gov_vote(self, voter, proposal_id, option, event_query_tx=True, **kwargs): print(voter) print(proposal_id) print(option) @@ -895,13 +924,16 @@ def gov_vote(self, voter, proposal_id, option, event_query_tx=True): keyring_backend="test", chain_id=self.chain_id, stderr=subprocess.DEVNULL, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: rsp = self.event_query_tx_for(rsp["txhash"]) return rsp - def gov_deposit(self, depositor, proposal_id, amount, event_query_tx=True): + def gov_deposit( + self, depositor, proposal_id, amount, event_query_tx=True, **kwargs + ): rsp = json.loads( self.raw( "tx", @@ -915,6 +947,7 @@ def gov_deposit(self, depositor, proposal_id, amount, event_query_tx=True): node=self.node_rpc, keyring_backend="test", chain_id=self.chain_id, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -970,6 +1003,7 @@ def ibc_transfer( channel, # src channel target_version, # chain version number of target chain event_query_tx=True, + **kwargs, ): rsp = json.loads( self.raw( @@ -990,6 +1024,7 @@ def ibc_transfer( chain_id=self.chain_id, packet_timeout_height=f"{target_version}-10000000000", packet_timeout_timestamp=0, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -1010,6 +1045,7 @@ def create_nft( schema, fees, event_query_tx=True, + **kwargs, ): rsp = json.loads( self.raw( @@ -1026,6 +1062,7 @@ def create_nft( keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -1067,6 +1104,7 @@ def create_nft_token( uri, fees, event_query_tx=True, + **kwargs, ): rsp = json.loads( self.raw( @@ -1083,6 +1121,7 @@ def create_nft_token( keyring_backend="test", chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -1103,7 +1142,9 @@ def query_nft_token(self, denomid, tokenid): ) ) - def burn_nft_token(self, from_addr, denomid, tokenid, event_query_tx=True): + def burn_nft_token( + self, from_addr, denomid, tokenid, event_query_tx=True, **kwargs + ): rsp = json.loads( self.raw( "tx", @@ -1117,6 +1158,7 @@ def burn_nft_token(self, from_addr, denomid, tokenid, event_query_tx=True): home=self.data_dir, chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -1131,6 +1173,7 @@ def edit_nft_token( newuri, newname, event_query_tx=True, + **kwargs, ): rsp = json.loads( self.raw( @@ -1147,6 +1190,7 @@ def edit_nft_token( home=self.data_dir, chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: @@ -1160,6 +1204,7 @@ def transfer_nft_token( denomid, tokenid, event_query_tx=True, + **kwargs, ): rsp = json.loads( self.raw( @@ -1175,6 +1220,7 @@ def transfer_nft_token( home=self.data_dir, chain_id=self.chain_id, node=self.node_rpc, + **kwargs, ) ) if rsp["code"] == 0 and event_query_tx: