From cdef96c83c3f25a8f3fcbe26a3d034a3d346ea26 Mon Sep 17 00:00:00 2001 From: dydxwill <119354122+dydxwill@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:55:40 -0400 Subject: [PATCH] update fee denom, url, use dydx testnet network config in posting txns (#65) --- v4-client-py/pyproject.toml | 2 +- v4-client-py/v4_client_py/chain/aerial/client/utils.py | 5 +++-- v4-client-py/v4_client_py/chain/aerial/config.py | 8 ++++---- v4-client-py/v4_client_py/clients/modules/post.py | 5 ++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/v4-client-py/pyproject.toml b/v4-client-py/pyproject.toml index 231678c5..9ca171a1 100644 --- a/v4-client-py/pyproject.toml +++ b/v4-client-py/pyproject.toml @@ -5,7 +5,7 @@ package-dir = {"" = "v4_client_py"} [tool.poetry] name = "v4-client-py" -version = "0.6.9" +version = "0.7.0" description = "dYdX v4 Client" authors = ["John Huang "] license = "BSL-1.1" 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 a4ed6ebc..09622770 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 @@ -18,7 +18,7 @@ def prepare_and_broadcast_basic_transaction( gas_limit: Optional[int] = None, memo: Optional[str] = None, broadcast_mode: BroadcastMode = None, - fee: int = 5000, + fee: Optional[int] = None, ) -> SubmittedTx: """Prepare and broadcast basic transaction. @@ -36,7 +36,8 @@ def prepare_and_broadcast_basic_transaction( # query the account information for the sender if account is None: account = client.query_account(sender.address()) - + if fee is None: + fee = client.network_config.fee_minimum_gas_price if gas_limit is None: # we need to build up a representative transaction so that we can accurately simulate it diff --git a/v4-client-py/v4_client_py/chain/aerial/config.py b/v4-client-py/v4_client_py/chain/aerial/config.py index 18732289..97c6b2b4 100644 --- a/v4-client-py/v4_client_py/chain/aerial/config.py +++ b/v4-client-py/v4_client_py/chain/aerial/config.py @@ -78,10 +78,10 @@ def fetch_dydx_testnet(cls) -> "NetworkConfig": :return: Network configuration """ return NetworkConfig( - chain_id="dydx", - url="grpc+https://v4.testnet.dydx.exchange", - fee_minimum_gas_price=5000000000, - fee_denomination="dv4tnt", + chain_id="dydx-testnet-4", + url="grpc+https://dydx-testnet-archive.allthatnode.com:9090", + fee_minimum_gas_price=4630550000000000, + fee_denomination="adv4tnt", staking_denomination="dv4tnt", faucet_url="http://faucet.v4testnet.dydx.exchange", ) 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 f77a91bb..7fc1bc7f 100644 --- a/v4-client-py/v4_client_py/clients/modules/post.py +++ b/v4-client-py/v4_client_py/clients/modules/post.py @@ -43,8 +43,7 @@ def send_message( ''' wallet = subaccount.wallet - url = ('grpc+https://' if self.config.ssl_enabled else 'grpc+http://') + self.config.grpc_endpoint - network = NetworkConfig(self.config.chain_id, 0, None, None, url, None) + network = NetworkConfig.fetch_dydx_testnet() ledger = LedgerClient(network) tx = Transaction() tx.add_message(msg) @@ -57,7 +56,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=0 if zeroFee else 5000, + fee=0 if zeroFee else None, ) def place_order(