From 370c301697516102c8b677a3cb10a63b7a1011f1 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Thu, 12 Oct 2023 10:06:25 -0700 Subject: [PATCH] address cmt --- v4-client-py/.gitignore | 3 +++ v4-client-py/v4_client_py/chain/aerial/client/utils.py | 6 +++--- v4-client-py/v4_client_py/clients/constants.py | 3 +++ v4-client-py/v4_client_py/clients/modules/post.py | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/v4-client-py/.gitignore b/v4-client-py/.gitignore index b6e47617..3efd499f 100644 --- a/v4-client-py/.gitignore +++ b/v4-client-py/.gitignore @@ -127,3 +127,6 @@ dmypy.json # Pyre type checker .pyre/ + +# IDE +.idea/ diff --git a/v4-client-py/v4_client_py/chain/aerial/client/utils.py b/v4-client-py/v4_client_py/chain/aerial/client/utils.py index ce6886f2..cffb8f7f 100644 --- a/v4-client-py/v4_client_py/chain/aerial/client/utils.py +++ b/v4-client-py/v4_client_py/chain/aerial/client/utils.py @@ -3,7 +3,7 @@ from datetime import timedelta from typing import Any, Callable, List, Optional, Union -from v4_client_py.clients.constants import BroadcastMode +from v4_client_py.clients.constants import BroadcastMode, DEFAULT_TOKEN from v4_proto.cosmos.base.query.v1beta1.pagination_pb2 import PageRequest @@ -18,7 +18,7 @@ def prepare_and_broadcast_basic_transaction( gas_limit: Optional[int] = None, memo: Optional[str] = None, broadcast_mode: BroadcastMode = None, - fee: Optional[str] = "5000dv4tnt", + fee: Optional[int] = 5000, ) -> SubmittedTx: """Prepare and broadcast basic transaction. @@ -53,7 +53,7 @@ def prepare_and_broadcast_basic_transaction( # finally, build the final transaction that will be executed with the correct gas and fee values tx.seal( SigningCfg.direct(sender.public_key(), account.sequence), - fee=fee, + fee=f"{fee}{DEFAULT_TOKEN}", gas_limit=gas_limit, memo=memo, ) diff --git a/v4-client-py/v4_client_py/clients/constants.py b/v4-client-py/v4_client_py/clients/constants.py index 4a1ba0ba..e8bb4543 100644 --- a/v4-client-py/v4_client_py/clients/constants.py +++ b/v4-client-py/v4_client_py/clients/constants.py @@ -96,6 +96,9 @@ BECH32_PREFIX = 'dydx' +# ------------ DEFAULT TOKEN ------------ +DEFAULT_TOKEN = "dv4tnt" + class BroadcastMode(Enum): BroadcastTxSync = 0 BroadcastTxCommit = 1 diff --git a/v4-client-py/v4_client_py/clients/modules/post.py b/v4-client-py/v4_client_py/clients/modules/post.py index c78d7ec5..f77a91bb 100644 --- a/v4-client-py/v4_client_py/clients/modules/post.py +++ b/v4-client-py/v4_client_py/clients/modules/post.py @@ -57,7 +57,7 @@ def send_message( gas_limit=gas_limit, memo=None, broadcast_mode=broadcast_mode if (broadcast_mode != None) else self.default_broadcast_mode(msg), - fee="0dv4tnt" if zeroFee else "5000dv4tnt", + fee=0 if zeroFee else 5000, ) def place_order(