Skip to content

Commit

Permalink
Update dydxpy -> v4-proto, rename PyPI package (#25)
Browse files Browse the repository at this point in the history
* Update dydxpy -> v4-proto

* dydx4 -> v4_client_py
  • Loading branch information
jiajames authored Sep 8, 2023
1 parent c94bcbf commit cfdc9f2
Show file tree
Hide file tree
Showing 110 changed files with 174 additions and 174 deletions.
6 changes: 3 additions & 3 deletions v4-client-py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Select Venv
Select Python 3.9 as interpreter
Select requirements.txt as the dependencies to install

TODO: Add dydxpy to the requirements.txt
TODO: Add v4-proto to the requirements.txt

Install dydxpy
Install v4-proto
```
pip install -i https://test.pypi.org/simple/ dydxpy==<version>
pip install -i https://test.pypi.org/simple/ v4-proto==<version>
```

VS Code will automatically switch to .venv environment when running example code. Or you can manually switch
Expand Down
10 changes: 0 additions & 10 deletions v4-client-py/dydx4/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions v4-client-py/examples/account_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Usage: python -m examples.private_endpoints
'''

from dydx4.clients import IndexerClient, Subaccount
from dydx4.clients.constants import Network
from v4_client_py.clients import IndexerClient, Subaccount
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/chain_client/Account.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio
import logging

from dydx4.clients import ValidatorClient, Subaccount
from dydx4.clients.constants import Network
from v4_client_py.clients import ValidatorClient, Subaccount
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/chain_client/BankBalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import logging


from dydx4.clients import ValidatorClient, Subaccount
from dydx4.clients.constants import Network
from v4_client_py.clients import ValidatorClient, Subaccount
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/chain_client/BankBalances.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import logging


from dydx4.clients import ValidatorClient, Subaccount
from dydx4.clients.constants import Network
from v4_client_py.clients import ValidatorClient, Subaccount
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/chain_client/GetTx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio
import logging

from dydx4.clients import ValidatorClient, Subaccount
from dydx4.clients.constants import Network
from v4_client_py.clients import ValidatorClient, Subaccount
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
8 changes: 4 additions & 4 deletions v4-client-py/examples/composite_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import asyncio
import logging
from random import randrange
from dydx4.chain.aerial.wallet import LocalWallet
from dydx4.clients import CompositeClient, Subaccount
from dydx4.clients.constants import BECH32_PREFIX, Network
from v4_client_py.chain.aerial.wallet import LocalWallet
from v4_client_py.clients import CompositeClient, Subaccount
from v4_client_py.clients.constants import BECH32_PREFIX, Network

from dydx4.clients.helpers.chain_helpers import (
from v4_client_py.clients.helpers.chain_helpers import (
OrderType,
OrderSide,
OrderTimeInForce,
Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/faucet_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Usage: python -m examples.faucet_endpoint
'''
from dydx4.clients import FaucetClient, Subaccount
from dydx4.clients.constants import Network
from v4_client_py.clients import FaucetClient, Subaccount
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/markets_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Usage: python -m examples.markets_endpoints
'''

from dydx4.clients import IndexerClient
from dydx4.clients.constants import Network, MARKET_BTC_USD
from v4_client_py.clients import IndexerClient
from v4_client_py.clients.constants import Network, MARKET_BTC_USD

client = IndexerClient(
config=Network.staging().indexer_config,
Expand Down
8 changes: 4 additions & 4 deletions v4-client-py/examples/transfer_example_deposit.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import asyncio
import logging
from dydx4.chain.aerial.wallet import LocalWallet
from dydx4.clients.dydx_subaccount import Subaccount
from v4_client_py.chain.aerial.wallet import LocalWallet
from v4_client_py.clients.dydx_subaccount import Subaccount

from dydx4.clients.dydx_validator_client import ValidatorClient
from dydx4.clients.constants import BECH32_PREFIX, Network
from v4_client_py.clients.dydx_validator_client import ValidatorClient
from v4_client_py.clients.constants import BECH32_PREFIX, Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
8 changes: 4 additions & 4 deletions v4-client-py/examples/transfer_example_subaccount_transfer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import asyncio
import logging
from dydx4.chain.aerial.wallet import LocalWallet
from dydx4.clients.dydx_subaccount import Subaccount
from v4_client_py.chain.aerial.wallet import LocalWallet
from v4_client_py.clients.dydx_subaccount import Subaccount

from dydx4.clients.dydx_validator_client import ValidatorClient
from dydx4.clients.constants import BECH32_PREFIX, Network
from v4_client_py.clients.dydx_validator_client import ValidatorClient
from v4_client_py.clients.constants import BECH32_PREFIX, Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
8 changes: 4 additions & 4 deletions v4-client-py/examples/transfer_example_withdraw.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import asyncio
import logging
from dydx4.chain.aerial.wallet import LocalWallet
from dydx4.clients.dydx_subaccount import Subaccount
from v4_client_py.chain.aerial.wallet import LocalWallet
from v4_client_py.clients.dydx_subaccount import Subaccount

from dydx4.clients.dydx_validator_client import ValidatorClient
from dydx4.clients.constants import BECH32_PREFIX, Network
from v4_client_py.clients.dydx_validator_client import ValidatorClient
from v4_client_py.clients.constants import BECH32_PREFIX, Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/validator_get_examples.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio
import logging

from dydx4.clients.dydx_validator_client import ValidatorClient
from dydx4.clients.constants import Network
from v4_client_py.clients.dydx_validator_client import ValidatorClient
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_ADDRESS

Expand Down
12 changes: 6 additions & 6 deletions v4-client-py/examples/validator_post_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import logging
import random
from time import sleep
from dydx4.chain.aerial.wallet import LocalWallet
from dydx4.clients.dydx_subaccount import Subaccount
from dydxpy.proto.dydxprotocol.clob.order_pb2 import Order
from v4_client_py.chain.aerial.wallet import LocalWallet
from v4_client_py.clients.dydx_subaccount import Subaccount
from v4_proto.dydxprotocol.clob.order_pb2 import Order

from dydx4.clients.dydx_validator_client import ValidatorClient
from dydx4.clients.constants import BECH32_PREFIX, Network
from dydx4.clients.helpers.chain_helpers import ORDER_FLAGS_SHORT_TERM
from v4_client_py.clients.dydx_validator_client import ValidatorClient
from v4_client_py.clients.constants import BECH32_PREFIX, Network
from v4_client_py.clients.helpers.chain_helpers import ORDER_FLAGS_SHORT_TERM
from examples.utils import loadJson

from tests.constants import DYDX_TEST_MNEMONIC
Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/wallet_address.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dydx4.chain.aerial.wallet import LocalWallet
from dydx4.clients.constants import BECH32_PREFIX
from v4_client_py.chain.aerial.wallet import LocalWallet
from v4_client_py.clients.constants import BECH32_PREFIX

from tests.constants import DYDX_TEST_ADDRESS, DYDX_TEST_PRIVATE_KEY, DYDX_TEST_MNEMONIC

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/examples/websocket_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import asyncio
import json

from dydx4.clients.dydx_socket_client import SocketClient
from dydx4.clients.constants import Network
from v4_client_py.clients.dydx_socket_client import SocketClient
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_ADDRESS

Expand Down
6 changes: 3 additions & 3 deletions v4-client-py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# pyproject.toml

[tool.setuptools]
package-dir = {"" = "dydx4"}
package-dir = {"" = "v4_client_py"}

[tool.poetry]
name = "dydx4"
version = "0.3.0"
name = "v4-client-py"
version = "0.4.0"
description = "dYdX v4 Client"
authors = ["John Huang <contact@dydx.exchange>"]
license = "BSL-1.1"
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bip_utils>=1.6.0
brownie>=0.5.0
cytoolz>=0.12.1
dateparser>=1.0.0
dydxpy>=0.4.0.post1
v4-proto>=0.2.1
ecdsa>=0.16.0
eth_keys>=0.4.0
eth-account>=0.9.0
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bip_utils>=2.7.0
brownie>=0.5.0
cytoolz>=0.12.1
dateparser>=1.0.0
dydxpy>=0.4.0.post1
v4-proto>=0.2.1
ecdsa>=0.18.0
eth_keys>=0.4.0
eth-account>=0.9.0
Expand Down
6 changes: 3 additions & 3 deletions v4-client-py/tests/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ------------ Constants for Testing ------------
from dydx4.clients.constants import ORDER_SIDE_BUY
from dydx4.clients.helpers.chain_helpers import ORDER_FLAGS_SHORT_TERM
from dydxpy.proto.dydxprotocol.clob.order_pb2 import Order
from v4_client_py.clients.constants import ORDER_SIDE_BUY
from v4_client_py.clients.helpers.chain_helpers import ORDER_FLAGS_SHORT_TERM
from v4_proto.dydxprotocol.clob.order_pb2 import Order


DEFAULT_HOST = 'http://localhost:8080'
Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/tests/test_indexer_account_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

from dydx4.clients import IndexerClient, Subaccount
from dydx4.clients.constants import Network
from v4_client_py.clients import IndexerClient, Subaccount
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/tests/test_indexer_markets_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

from dydx4.clients import IndexerClient
from dydx4.clients.constants import Network, MARKET_BTC_USD
from v4_client_py.clients import IndexerClient
from v4_client_py.clients.constants import Network, MARKET_BTC_USD

client = IndexerClient(
config=Network.staging().indexer_config,
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py/tests/test_request_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dydx4.clients.helpers.request_helpers import generate_query_path
from v4_client_py.clients.helpers.request_helpers import generate_query_path

def test_generate_query_path():
query_path = generate_query_path('https://google.com', {'a': True, 'b': False, 'c': 'TEST'})
Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/tests/test_validator_get_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dydx4.clients.dydx_validator_client import ValidatorClient
from dydx4.clients.constants import Network
from v4_client_py.clients.dydx_validator_client import ValidatorClient
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_ADDRESS

Expand Down
4 changes: 2 additions & 2 deletions v4-client-py/tests_integration/test_faucet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

from dydx4.clients import FaucetClient, Subaccount
from dydx4.clients.constants import Network
from v4_client_py.clients import FaucetClient, Subaccount
from v4_client_py.clients.constants import Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
12 changes: 6 additions & 6 deletions v4-client-py/tests_integration/test_trades.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import datetime
import logging
import random
from dydx4.chain.aerial.wallet import LocalWallet
from dydx4.clients.dydx_subaccount import Subaccount
from dydxpy.proto.dydxprotocol.clob.order_pb2 import Order
from v4_client_py.chain.aerial.wallet import LocalWallet
from v4_client_py.clients.dydx_subaccount import Subaccount
from v4_proto.dydxprotocol.clob.order_pb2 import Order

from dydx4.clients.dydx_validator_client import ValidatorClient
from dydx4.clients.constants import BECH32_PREFIX, Network
from dydx4.clients.helpers.chain_helpers import ORDER_FLAGS_SHORT_TERM
from v4_client_py.clients.dydx_validator_client import ValidatorClient
from v4_client_py.clients.constants import BECH32_PREFIX, Network
from v4_client_py.clients.helpers.chain_helpers import ORDER_FLAGS_SHORT_TERM
from examples.utils import loadJson

from tests.constants import DYDX_TEST_MNEMONIC
Expand Down
8 changes: 4 additions & 4 deletions v4-client-py/tests_integration/test_transfers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import asyncio
import logging
from dydx4.chain.aerial.wallet import LocalWallet
from dydx4.clients.dydx_subaccount import Subaccount
from v4_client_py.chain.aerial.wallet import LocalWallet
from v4_client_py.clients.dydx_subaccount import Subaccount

from dydx4.clients.dydx_validator_client import ValidatorClient
from dydx4.clients.constants import BECH32_PREFIX, Network
from v4_client_py.clients.dydx_validator_client import ValidatorClient
from v4_client_py.clients.constants import BECH32_PREFIX, Network

from tests.constants import DYDX_TEST_MNEMONIC

Expand Down
10 changes: 10 additions & 0 deletions v4-client-py/v4_client_py/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from v4_client_py.clients.dydx_indexer_client import IndexerClient
from v4_client_py.clients.dydx_composite_client import CompositeClient
from v4_client_py.clients.dydx_socket_client import SocketClient
from v4_client_py.clients.dydx_faucet_client import FaucetClient
from v4_client_py.clients.errors import DydxError, DydxApiError, TransactionReverted


# Export useful helper functions and objects.
from v4_client_py.clients.helpers.request_helpers import epoch_seconds_to_iso
from v4_client_py.clients.helpers.request_helpers import iso_to_epoch_seconds
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit cfdc9f2

Please sign in to comment.