From 505f71c4e16856c8330244bce4e812d4787da206 Mon Sep 17 00:00:00 2001 From: Oleg Nikonychev Date: Tue, 26 Sep 2023 21:32:26 +0400 Subject: [PATCH] refactor: got rid of sender parameter in messages --- README.md | 1 - examples/2- My first transaction.ipynb | 1 - examples/colab_notebook.ipynb | 7 --- nibiru/msg/bank.py | 12 ++-- nibiru/msg/perp.py | 79 ++++++++------------------ nibiru/msg/spot.py | 44 +++++--------- nibiru/msg/staking.py | 34 +++-------- nibiru/pytypes/common.py | 4 +- nibiru/query_clients/spot.py | 6 +- nibiru/tx.py | 9 +-- tests/bank_test.py | 3 - tests/broadcast_test.py | 2 - tests/perp_test.py | 7 +-- tests/spot_test.py | 1 - tests/staking_test.py | 2 - tests/utils_test.py | 1 - 16 files changed, 58 insertions(+), 155 deletions(-) diff --git a/README.md b/README.md index 107f0eb..8f58924 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,6 @@ print(client.query.get_bank_balances(client.address)) ```python output = client.tx.execute_msgs( Msg.perp.open_position( - sender=client.address, pair=pair, is_long=True, quote_asset_amount=10, diff --git a/examples/2- My first transaction.ipynb b/examples/2- My first transaction.ipynb index 7f64d6c..ebe7ddc 100644 --- a/examples/2- My first transaction.ipynb +++ b/examples/2- My first transaction.ipynb @@ -123,7 +123,6 @@ "source": [ "output = client.tx.execute_msgs(\n", " Msg.perp.open_position(\n", - " sender=client.address,\n", " pair=pair,\n", " is_long=True,\n", " quote_asset_amount=10,\n", diff --git a/examples/colab_notebook.ipynb b/examples/colab_notebook.ipynb index 2aaa5d7..423e91d 100644 --- a/examples/colab_notebook.ipynb +++ b/examples/colab_notebook.ipynb @@ -76,7 +76,6 @@ "source": [ "output = client.tx.execute_msgs(\n", " Msg.perp.open_position(\n", - " sender=client.address,\n", " pair=pair,\n", " is_long=True,\n", " quote_asset_amount=10,\n", @@ -144,7 +143,6 @@ "source": [ "output = client.tx.execute_msgs(\n", " Msg.perp.add_margin(\n", - " sender=client.address,\n", " pair=pair,\n", " margin=Coin(1, \"unusd\"),\n", " )\n", @@ -167,7 +165,6 @@ "source": [ "output = client.tx.execute_msgs(\n", " Msg.perp.remove_margin(\n", - " sender=client.address,\n", " pair=pair,\n", " margin=Coin(1, \"unusd\")\n", " )\n", @@ -190,7 +187,6 @@ "source": [ "output = client.tx.execute_msgs(\n", " Msg.perp.close_position(\n", - " sender=client.address,\n", " pair=pair,\n", " )\n", ")\n", @@ -232,7 +228,6 @@ "output = client.tx.execute_msgs(\n", " [\n", " Msg.perp.open_position(\n", - " sender=client.address,\n", " pair=pair,\n", " is_long=True,\n", " quote_asset_amount=10,\n", @@ -240,12 +235,10 @@ " base_asset_amount_limit=0,\n", " ),\n", " Msg.perp.add_margin(\n", - " sender=client.address,\n", " pair=pair,\n", " margin=Coin(1, \"unusd\"),\n", " ),\n", " Msg.perp.close_position(\n", - " sender=client.address,\n", " pair=pair,\n", " ),\n", " ]\n", diff --git a/nibiru/msg/bank.py b/nibiru/msg/bank.py index 0636de0..126de00 100644 --- a/nibiru/msg/bank.py +++ b/nibiru/msg/bank.py @@ -15,7 +15,6 @@ class MsgsBank: @staticmethod def send( - from_address: str, to_address: str, coins: Union[Coin, List[Coin]], ) -> 'MsgSend': @@ -23,14 +22,13 @@ def send( Send tokens from one account to another Attributes: - from_address (str): The address of the sender to_address (str): The address of the receiver coins (List[Coin]): The list of coins to send Returns: MsgSend: PythonMsg corresponding to the 'cosmos.bank.v1beta1.MsgSend' message """ - return MsgSend(from_address=from_address, to_address=to_address, coins=coins) + return MsgSend(to_address=to_address, coins=coins) @dataclasses.dataclass @@ -40,16 +38,14 @@ class MsgSend(PythonMsg): 'cosmos.bank.v1beta1.MsgSend' message. Attributes: - from_address (str): The address of the sender to_address (str): The address of the receiver coins (Union[Coin, List[Coin]]): The list of coins to send """ - from_address: str to_address: str coins: Union[Coin, List[Coin]] - def to_pb(self) -> pb.MsgSend: + def to_pb(self, sender: str) -> pb.MsgSend: """ Returns the Message as protobuf object. @@ -62,7 +58,7 @@ def to_pb(self) -> pb.MsgSend: coins = [self.coins] return pb.MsgSend( - from_address=self.from_address, + from_address=sender, to_address=self.to_address, - amount=[coin._generate_proto_object() for coin in coins], + amount=[coin.to_pb() for coin in coins], ) diff --git a/nibiru/msg/perp.py b/nibiru/msg/perp.py index 14bfd99..ad24c40 100644 --- a/nibiru/msg/perp.py +++ b/nibiru/msg/perp.py @@ -30,7 +30,6 @@ class MsgsPerp: @staticmethod def open_position( - sender: str, pair: str, is_long: bool, quote_asset_amount: float, @@ -41,7 +40,6 @@ def open_position( Open a posiiton using the specified parameters. Attributes: - sender (str): The sender address pair (str): The token pair is_long (bool): Determines whether to open with long or short exposure. quote_asset_amount (float): The quote amount you want to use to buy base @@ -51,7 +49,6 @@ def open_position( quote. """ return MsgMarketOrder( - sender=sender, pair=pair, dir=Direction.LONG if is_long else Direction.SHORT, quote_asset_amount=quote_asset_amount, @@ -60,22 +57,17 @@ def open_position( ) @staticmethod - def close_position( - sender: str, - pair: str, - ) -> 'MsgClosePosition': + def close_position(pair: str) -> 'MsgClosePosition': """ Close the position. Attributes: - sender (str): The sender address pair (str): The token pair """ - return MsgClosePosition(sender=sender, pair=pair) + return MsgClosePosition(pair=pair) @staticmethod def add_margin( - sender: str, pair: str, margin: Coin, ) -> 'MsgAddMargin': @@ -83,58 +75,42 @@ def add_margin( Add margin for the position (pair + trader) Attributes: - sender (str): The trader address pair (str): The token pair margin (Coin): The margin to remove in a coin format """ - return MsgAddMargin(sender=sender, pair=pair, margin=margin) + return MsgAddMargin(pair=pair, margin=margin) @staticmethod - def remove_margin( - sender: str, - pair: str, - margin: Coin, - ) -> 'MsgRemoveMargin': + def remove_margin(pair: str, margin: Coin) -> 'MsgRemoveMargin': """ Remove margin for the position (pair + trader) Attributes: - sender (str): The trader address pair (str): The token pair margin (Coin): The margin to remove in a coin format """ - return MsgRemoveMargin(sender=sender, pair=pair, margin=margin) + return MsgRemoveMargin(pair=pair, margin=margin) @staticmethod - def liquidate( - sender: str, - pair: str, - trader: str, - ) -> 'MsgMultiLiquidate': + def liquidate(pair: str, trader: str) -> 'MsgMultiLiquidate': """ Liquidates unhealthy position (pair + trader) Attributes: - sender (str): The liquidator address pair (str): The token pair trader (str): The trader address """ - return MsgMultiLiquidate( - sender=sender, liquidations=[Liquidation(pair=pair, trader=trader)] - ) + return MsgMultiLiquidate(liquidations=[Liquidation(pair=pair, trader=trader)]) @staticmethod - def liquidate_multiple( - sender: str, liquidations: List[Liquidation] - ) -> 'MsgMultiLiquidate': + def liquidate_multiple(liquidations: List[Liquidation]) -> 'MsgMultiLiquidate': """ Liquidates multiple unhealthy positions (pair + trader) Attributes: - sender (str): The liquidator address liquidations (List[Liquidation]): list of pair/traders to liquidate """ - return MsgMultiLiquidate(sender=sender, liquidations=liquidations) + return MsgMultiLiquidate(liquidations=liquidations) @dataclasses.dataclass @@ -143,16 +119,14 @@ class MsgRemoveMargin(PythonMsg): Remove margin for the position (pair + trader) Attributes: - sender (str): The trader address pair (str): The token pair margin (Coin): The margin to remove in a coin format """ - sender: str pair: str margin: Coin - def to_pb(self) -> pb.MsgRemoveMargin: + def to_pb(self, sender: str) -> pb.MsgRemoveMargin: """ Returns the Message as protobuf object. @@ -161,9 +135,9 @@ def to_pb(self) -> pb.MsgRemoveMargin: """ return pb.MsgRemoveMargin( - sender=self.sender, + sender=sender, pair=self.pair, - margin=self.margin._generate_proto_object(), + margin=self.margin.to_pb(), ) @@ -173,16 +147,14 @@ class MsgAddMargin(PythonMsg): Add margin for the position (pair + trader) Attributes: - sender (str): The trader address pair (str): The token pair margin (Coin): The margin to remove in a coin format """ - sender: str pair: str margin: Coin - def to_pb(self) -> pb.MsgAddMargin: + def to_pb(self, sender: str) -> pb.MsgAddMargin: """ Returns the Message as protobuf object. @@ -191,9 +163,9 @@ def to_pb(self) -> pb.MsgAddMargin: """ return pb.MsgAddMargin( - sender=self.sender, + sender=sender, pair=self.pair, - margin=self.margin._generate_proto_object(), + margin=self.margin.to_pb(), ) @@ -203,7 +175,6 @@ class MsgMarketOrder(PythonMsg): Open a position using the specified parameters. Attributes: - sender (str): The sender address pair (str): The token pair side (Side): The side, either Side.BUY or Side.SELL quote_asset_amount (float): The quote amount you want to use to buy base @@ -213,14 +184,13 @@ class MsgMarketOrder(PythonMsg): quote. """ - sender: str pair: str dir: Direction quote_asset_amount: float leverage: float base_asset_amount_limit: float - def to_pb(self) -> pb.MsgMarketOrder: + def to_pb(self, sender: str) -> pb.MsgMarketOrder: """ Returns the Message as protobuf object. @@ -238,7 +208,7 @@ def to_pb(self) -> pb.MsgMarketOrder: leverage_pb = to_sdk_dec(self.leverage) return pb.MsgMarketOrder( - sender=self.sender, + sender=sender, pair=self.pair, side=pb_side, quote_asset_amount=quote_asset_amount_pb, @@ -253,14 +223,12 @@ class MsgClosePosition(PythonMsg): Close the position. Attributes: - sender (str): The sender address pair (str): The token pair """ - sender: str pair: str - def to_pb(self) -> pb.MsgClosePosition: + def to_pb(self, sender: str) -> pb.MsgClosePosition: """ Returns the Message as protobuf object. @@ -269,7 +237,7 @@ def to_pb(self) -> pb.MsgClosePosition: """ return pb.MsgClosePosition( - sender=self.sender, + sender=sender, pair=self.pair, ) @@ -277,17 +245,16 @@ def to_pb(self) -> pb.MsgClosePosition: @dataclasses.dataclass class MsgMultiLiquidate(PythonMsg): """ - Close the position. + Liquidate one or multiple unhealthy positions. + Unhealthy positions are positions with margin_ratio < maintenance_margin_ratio. Attributes: - sender (str): The sender address liquidations (Liquidation): The list of {pair, trader} pairs. """ - sender: str liquidations: List[Liquidation] - def to_pb(self) -> pb.MsgMultiLiquidate: + def to_pb(self, sender: str) -> pb.MsgMultiLiquidate: """ Returns the Message as protobuf object. @@ -296,7 +263,7 @@ def to_pb(self) -> pb.MsgMultiLiquidate: """ return pb.MsgMultiLiquidate( - sender=self.sender, + sender=sender, liquidations=[ pb.MsgMultiLiquidate.Liquidation( pair=liquidation.pair, diff --git a/nibiru/msg/spot.py b/nibiru/msg/spot.py index 5efe690..705c97f 100644 --- a/nibiru/msg/spot.py +++ b/nibiru/msg/spot.py @@ -18,7 +18,6 @@ class MsgsSpot: @staticmethod def create_pool( - creator: str, swap_fee: float, exit_fee: float, a: int, @@ -26,7 +25,6 @@ def create_pool( assets: List[PoolAsset], ) -> 'MsgCreatePool': return MsgCreatePool( - creator=creator, swap_fee=swap_fee, exit_fee=exit_fee, a=a, @@ -36,29 +34,25 @@ def create_pool( @staticmethod def join_pool( - sender: str, pool_id: int, tokens: Union[Coin, List[Coin]], ) -> 'MsgJoinPool': - return MsgJoinPool(sender=sender, pool_id=pool_id, tokens=tokens) + return MsgJoinPool(pool_id=pool_id, tokens=tokens) @staticmethod def exit_pool( - sender: str, pool_id: int, pool_shares: Coin, ) -> 'MsgExitPool': - return MsgExitPool(sender=sender, pool_id=pool_id, pool_shares=pool_shares) + return MsgExitPool(pool_id=pool_id, pool_shares=pool_shares) @staticmethod def swap( - sender: str, pool_id: int, token_in: Coin, token_out_denom: str, ) -> 'MsgSwapAssets': return MsgSwapAssets( - sender=sender, pool_id=pool_id, token_in=token_in, token_out_denom=token_out_denom, @@ -71,20 +65,18 @@ class MsgCreatePool(PythonMsg): Create a pool using the assets specified Attributes: - creator (str): The creator address swap_fee (float): The swap fee required for the pool exit_fee (float): The exit fee required for the pool assets (List[PoolAsset]): The assets to compose the pool """ - creator: str swap_fee: float exit_fee: float a: int pool_type: PoolType assets: List[PoolAsset] - def to_pb(self) -> pb.MsgCreatePool: + def to_pb(self, sender: str) -> pb.MsgCreatePool: """ Returns the Message as protobuf object. @@ -93,9 +85,7 @@ def to_pb(self) -> pb.MsgCreatePool: """ pool_assets = [ - pool_tx_pb.PoolAsset( - token=a.token._generate_proto_object(), weight=str(int(a.weight * 1e6)) - ) + pool_tx_pb.PoolAsset(token=a.token.to_pb(), weight=str(int(a.weight * 1e6))) for a in self.assets ] @@ -103,7 +93,7 @@ def to_pb(self) -> pb.MsgCreatePool: exit_fee_dec = str(int(self.exit_fee * 1e18)) return pb.MsgCreatePool( - creator=self.creator, + creator=sender, pool_params=pool_tx_pb.PoolParams( swap_fee=swap_fee_dec, exit_fee=exit_fee_dec, @@ -120,16 +110,14 @@ class MsgJoinPool(PythonMsg): Join a pool using the specified tokens Attributes: - sender (str): The creator address pool_id (int): The id of the pool to join tokens (List[Coin]): The tokens to be bonded in the pool """ - sender: str pool_id: int tokens: Union[Coin, List[Coin]] - def to_pb(self) -> pb.MsgJoinPool: + def to_pb(self, sender: str) -> pb.MsgJoinPool: """ Returns the Message as protobuf object. @@ -140,9 +128,9 @@ def to_pb(self) -> pb.MsgJoinPool: if isinstance(self.tokens, Coin): self.tokens = [self.tokens] return pb.MsgJoinPool( - sender=self.sender, + sender=sender, pool_id=self.pool_id, - tokens_in=[token._generate_proto_object() for token in self.tokens], + tokens_in=[token.to_pb() for token in self.tokens], ) @@ -152,16 +140,14 @@ class MsgExitPool(PythonMsg): Exit a pool using the specified pool shares Attributes: - sender (str): The creator address pool_id (int): The id of the pool pool_shares (Coin): The tokens as share of the pool to exit with """ - sender: str pool_id: int pool_shares: Coin - def to_pb(self) -> pb.MsgExitPool: + def to_pb(self, sender: str) -> pb.MsgExitPool: """ Returns the Message as protobuf object. @@ -170,9 +156,9 @@ def to_pb(self) -> pb.MsgExitPool: """ return pb.MsgExitPool( - sender=self.sender, + sender=sender, pool_id=self.pool_id, - pool_shares=self.pool_shares._generate_proto_object(), + pool_shares=self.pool_shares.to_pb(), ) @@ -182,18 +168,16 @@ class MsgSwapAssets(PythonMsg): Swap the assets provided for the denom specified Attributes: - sender (str): The creator address pool_id (int): The id of the pool token_in (Coin): The token in we wish to swap with token_out_denom (str): The token we expect out of the pool """ - sender: str pool_id: int token_in: Coin token_out_denom: str - def to_pb(self) -> pb.MsgSwapAssets: + def to_pb(self, sender: str) -> pb.MsgSwapAssets: """ Returns the Message as protobuf object. @@ -202,9 +186,9 @@ def to_pb(self) -> pb.MsgSwapAssets: """ return pb.MsgSwapAssets( - sender=self.sender, + sender=sender, pool_id=self.pool_id, - token_in=self.token_in._generate_proto_object(), + token_in=self.token_in.to_pb(), token_out_denom=self.token_out_denom, ) diff --git a/nibiru/msg/staking.py b/nibiru/msg/staking.py index c984e54..88afc6c 100644 --- a/nibiru/msg/staking.py +++ b/nibiru/msg/staking.py @@ -17,7 +17,6 @@ class MsgsStaking: @staticmethod def delegate( - delegator_address: str, validator_address: str, amount: float, ) -> 'MsgDelegate': @@ -25,7 +24,6 @@ def delegate( Delegate tokens to a validator Attributes: - delegator_address: str validator_address: str amount: float @@ -33,14 +31,12 @@ def delegate( MsgDelegate: PythonMsg for type 'cosmos.staking.v1beta1.MsgDelegate' """ return MsgDelegate( - delegator_address=delegator_address, validator_address=validator_address, amount=amount, ) @staticmethod def undelegate( - delegator_address: str, validator_address: str, amount: float, ) -> 'MsgUndelegate': @@ -48,34 +44,28 @@ def undelegate( Undelegate tokens from a validator Attributes: - delegator_address (str): Bech32 address for the delegator validator_address (str): Bech32 valoper address amount (float): Amount of unibi to undelegate. """ return MsgUndelegate( - delegator_address=delegator_address, validator_address=validator_address, amount=amount, ) @staticmethod def withdraw_delegator_reward( - delegator_address: str, validator_address: str, ) -> 'MsgWithdrawDelegatorReward': """TODO Withdraw the reward from a validator Attributes: - delegator_address (str) validator_address (str) Returns: MsgWithdrawDelegatorReward: _description_ """ - return MsgWithdrawDelegatorReward( - delegator_address=delegator_address, validator_address=validator_address - ) + return MsgWithdrawDelegatorReward(validator_address=validator_address) @dataclasses.dataclass @@ -84,16 +74,14 @@ class MsgDelegate(PythonMsg): Delegate tokens to a validator Attributes: - delegator_address: str validator_address: str amount: float """ - delegator_address: str validator_address: str amount: float - def to_pb(self) -> pb_staking.MsgDelegate: + def to_pb(self, sender: str) -> pb_staking.MsgDelegate: """ Returns the Message as protobuf object. @@ -102,9 +90,9 @@ def to_pb(self) -> pb_staking.MsgDelegate: """ return pb_staking.MsgDelegate( - delegator_address=self.delegator_address, + delegator_address=sender, validator_address=self.validator_address, - amount=Coin(self.amount, "unibi")._generate_proto_object(), + amount=Coin(self.amount, "unibi").to_pb(), ) @@ -114,16 +102,14 @@ class MsgUndelegate(PythonMsg): Undelegate tokens from a validator Attributes: - delegator_address: str validator_address: str amount: float """ - delegator_address: str validator_address: str amount: float - def to_pb(self) -> pb_staking.MsgUndelegate: + def to_pb(self, sender: str) -> pb_staking.MsgUndelegate: """ Returns the Message as protobuf object. @@ -132,9 +118,9 @@ def to_pb(self) -> pb_staking.MsgUndelegate: """ return pb_staking.MsgUndelegate( - delegator_address=self.delegator_address, + delegator_address=sender, validator_address=self.validator_address, - amount=Coin(self.amount, "unibi")._generate_proto_object(), + amount=Coin(self.amount, "unibi").to_pb(), ) @@ -144,14 +130,12 @@ class MsgWithdrawDelegatorReward(PythonMsg): Withdraw the reward from a validator Attributes: - delegator_address (str) validator_address (str) """ - delegator_address: str validator_address: str - def to_pb(self) -> pb_distribution.MsgWithdrawDelegatorReward: + def to_pb(self, sender: str) -> pb_distribution.MsgWithdrawDelegatorReward: """ Returns the Message as protobuf object. @@ -160,6 +144,6 @@ def to_pb(self) -> pb_distribution.MsgWithdrawDelegatorReward: """ return pb_distribution.MsgWithdrawDelegatorReward( - delegator_address=self.delegator_address, + delegator_address=sender, validator_address=self.validator_address, ) diff --git a/nibiru/pytypes/common.py b/nibiru/pytypes/common.py index 1345765..869aab4 100644 --- a/nibiru/pytypes/common.py +++ b/nibiru/pytypes/common.py @@ -53,7 +53,7 @@ class Coin: amount: float denom: str - def _generate_proto_object(self): + def to_pb(self): """ Returns: @@ -103,7 +103,7 @@ class TxConfig: class PythonMsg(abc.ABC): @abc.abstractmethod - def to_pb(self) -> nibiru.ProtobufMessage: + def to_pb(self, sender: str) -> nibiru.ProtobufMessage: """ Generate the protobuf message diff --git a/nibiru/query_clients/spot.py b/nibiru/query_clients/spot.py index 57c527f..3461291 100644 --- a/nibiru/query_clients/spot.py +++ b/nibiru/query_clients/spot.py @@ -273,7 +273,7 @@ def estimate_swap_exact_amount_in( api_callable=self.api.EstimateSwapExactAmountIn, req=spot_type.QuerySwapExactAmountInRequest( pool_id=pool_id, - token_in=token_in._generate_proto_object(), + token_in=token_in.to_pb(), token_out_denom=token_out_denom, ), should_deserialize=False, @@ -310,9 +310,7 @@ def estimate_join_exact_amount_in( api_callable=self.api.EstimateJoinExactAmountIn, req=spot_type.QueryJoinExactAmountInRequest( pool_id=pool_id, - tokens_in=[ - tokens_in._generate_proto_object() for tokens_in in tokens_ins - ], + tokens_in=[tokens_in.to_pb() for tokens_in in tokens_ins], ), should_deserialize=False, ) diff --git a/nibiru/tx.py b/nibiru/tx.py index ac0a858..c3c40b2 100644 --- a/nibiru/tx.py +++ b/nibiru/tx.py @@ -96,17 +96,13 @@ def execute_msgs( """ tx: Transaction - # address: wallet.Address = self.ensure_address_info() - tx, address = self.build_tx( - msgs=msgs, - ) + tx, address = self.build_tx(msgs=msgs) # Validate account sequence if sequence is None: sequence = address.sequence sequence_err: str = "sequence was not given or available on the wallet object." assert address, sequence_err - # assert sequence, sequence_err tx = tx.with_sequence(sequence=sequence) @@ -281,7 +277,6 @@ def build_tx( if not isinstance(msgs, list): msgs = [msgs] - pb_msgs = [msg.to_pb() for msg in msgs] self.client.sync_timeout_height() address: wallet.Address @@ -295,6 +290,8 @@ def build_tx( if sequence is None: sequence = self.address.sequence + pb_msgs = [msg.to_pb(sender=address.to_acc_bech32()) for msg in msgs] + tx = ( Transaction() .with_messages(pb_msgs) diff --git a/tests/bank_test.py b/tests/bank_test.py index 75e8732..a3b034d 100644 --- a/tests/bank_test.py +++ b/tests/bank_test.py @@ -14,12 +14,10 @@ def test_send_multiple_msgs(client_validator, client_new_user): tx_output = client_validator.tx.execute_msgs( msgs=[ nibiru.Msg.bank.send( - client_validator.address, client_new_user.address, [Coin(7, "unibi"), Coin(70, "unusd")], ), nibiru.Msg.bank.send( - client_validator.address, client_new_user.address, [Coin(15, "unibi"), Coin(23, "unusd")], ), @@ -43,7 +41,6 @@ def test_send_single_msg(client_validator, client_new_user): tx_output = client_validator.tx.execute_msgs( [ nibiru.Msg.bank.send( - client_validator.address, client_new_user.address, [Coin(10, "unibi"), Coin(10, "unusd")], ), diff --git a/tests/broadcast_test.py b/tests/broadcast_test.py index cfefed9..abe6704 100644 --- a/tests/broadcast_test.py +++ b/tests/broadcast_test.py @@ -89,12 +89,10 @@ def test_do_BroadcastTxSync(): tx, _ = client_validator.tx.build_tx( msgs=[ bank.MsgsBank.send( - client_validator.address, client_new_user.address, [pytypes.Coin(7, "unibi"), pytypes.Coin(70, "unusd")], ), bank.MsgsBank.send( - client_validator.address, client_new_user.address, [pytypes.Coin(15, "unibi"), pytypes.Coin(23, "unusd")], ), diff --git a/tests/perp_test.py b/tests/perp_test.py index 49ef818..e13b6d2 100644 --- a/tests/perp_test.py +++ b/tests/perp_test.py @@ -25,7 +25,6 @@ def test_open_position(client_validator): try: tx_output: pt.ExecuteTxResp = client_validator.tx.execute_msgs( Msg.perp.open_position( - sender=client_validator.address, pair=PAIR, is_long=False, quote_asset_amount=10, @@ -147,7 +146,6 @@ def test_perp_add_margin(client_validator): # Transaction add_margin must succeed tx_output = client_validator.tx.execute_msgs( Msg.perp.add_margin( - sender=client_validator.address, pair=PAIR, margin=pt.Coin(10, "unusd"), ), @@ -169,7 +167,6 @@ def test_perp_remove_margin(client_validator): try: tx_output = client_validator.tx.execute_msgs( Msg.perp.remove_margin( - sender=client_validator.address, pair=PAIR, margin=pt.Coin(2, "unusd"), ) @@ -189,9 +186,7 @@ def test_perp_close_posititon(client_validator): try: # Transaction close_position must succeed - tx_output = client_validator.tx.execute_msgs( - Msg.perp.close_position(sender=client_validator.address, pair=PAIR) - ) + tx_output = client_validator.tx.execute_msgs(Msg.perp.close_position(pair=PAIR)) tests.broadcast_tx_must_succeed(res=tx_output) out = client_validator.query.perp.position( diff --git a/tests/spot_test.py b/tests/spot_test.py index 38c9b1b..f20bedf 100644 --- a/tests/spot_test.py +++ b/tests/spot_test.py @@ -27,7 +27,6 @@ def test_spot_create_pool(client_validator: ChainClient): try: tx_output = client_validator.tx.execute_msgs( nibiru.Msg.spot.create_pool( - creator=client_validator.address, swap_fee=0.01, exit_fee=0.02, assets=[ diff --git a/tests/staking_test.py b/tests/staking_test.py index 28a4daf..692d5f3 100644 --- a/tests/staking_test.py +++ b/tests/staking_test.py @@ -17,7 +17,6 @@ def delegate(client_validator: ChainClient): return client_validator.tx.execute_msgs( [ Msg.staking.delegate( - delegator_address=client_validator.address, validator_address=get_validator_operator_address(client_validator), amount=1, ), @@ -29,7 +28,6 @@ def undelegate(client_validator: ChainClient): return client_validator.tx.execute_msgs( [ Msg.staking.undelegate( - delegator_address=client_validator.address, validator_address=get_validator_operator_address(client_validator), amount=1, ), diff --git a/tests/utils_test.py b/tests/utils_test.py index 2c00f41..58f6051 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -89,7 +89,6 @@ def test_get_block_messages( ): out: pytypes.ExecuteTxResp = client_validator.tx.execute_msgs( nibiru.Msg.bank.send( - client_validator.address, client_new_user.address, [Coin(10000, "unibi"), Coin(100, "unusd")], )