Skip to content

Commit

Permalink
chore: Change Rust proto dep/client crate names, license reference (#280
Browse files Browse the repository at this point in the history
)

Changes,
- Rust client crate name to `dydx`;
- Use protobufs dep `dydx-proto` from registry;
- Changes license reference to `LicenseRef-dYdX-Custom`.
  • Loading branch information
v0-e authored Oct 28, 2024
1 parent 829e0ee commit fb624ac
Show file tree
Hide file tree
Showing 45 changed files with 145 additions and 151 deletions.
4 changes: 2 additions & 2 deletions v4-client-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
[workspace.package]
version = "0.1.0"
edition = "2021"
license = "AGPL-3.0"
license = "LicenseRef-dYdX-Custom"

[workspace.dependencies]
anyhow = "1"
Expand All @@ -17,4 +17,4 @@ derive_more = { version = "1", features = ["full"] }
log = "0.4"
thiserror = "1"
tokio = { version = "1.39", features = ["full"] }
v4-proto-rs = { git = "https://github.com/therustmonk/v4-chain", rev = "a6265bbf4cd9812382a89d32c9304c08551f7bae" }
dydx-proto = "0.1.0"
4 changes: 2 additions & 2 deletions v4-client-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The following features are implemented:
To add the crate to your project, use the command:

```sh
cargo add dydx-v4-rust
cargo add dydx
```

## Development
Expand Down Expand Up @@ -54,7 +54,7 @@ cargo deny check licenses advisories sources
To generate the documentation, use the command

```sh
cargo doc -p dydx-v4-rust
cargo doc -p dydx
```

## Acknowledgements
Expand Down
7 changes: 3 additions & 4 deletions v4-client-rs/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[package]
name = "dydx-v4-rust"
name = "dydx"
version.workspace = true
edition.workspace = true
license.workspace = true

description = "dYdX v4 asynchronous client."
homepage = "https://github.com/dydxprotocol/v4-clients/v4-client-rs"
repository = "https://github.com/dydxprotocol/v4-clients/v4-clients-rs"
repository = "https://github.com/dydxprotocol/v4-clients/v4-client-rs"
readme = "README.md"

# https://crates.io/categories
Expand Down Expand Up @@ -47,7 +46,7 @@ tokio.workspace = true
tokio-tungstenite = { version = "0.23", features = ["native-tls"] }
toml = "0.8"
tower = "0.4"
v4-proto-rs.workspace = true
dydx-proto.workspace = true

# Telemetry
metrics = { version = "0.23", optional = true }
Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/account_endpoint.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
mod support;

use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{
use dydx::config::ClientConfig;
use dydx::indexer::{
GetAggregationsOpts, GetFillsOpts, GetHistoricalPnlOpts, GetTradingRewardsOpts,
GetTransfersOpts, IndexerClient, ListOrdersOpts, ListPositionsOpts, MarketType, OrderSide,
PerpetualPositionStatus, Ticker, TradingRewardAggregationPeriod,
};
use dydx_v4_rust::node::Wallet;
use dydx::node::Wallet;
use support::constants::TEST_MNEMONIC;

pub struct Rester {
Expand Down
10 changes: 4 additions & 6 deletions v4-client-rs/client/examples/batch_cancel_orders.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
mod support;
use anyhow::{Error, Result};
use bigdecimal::BigDecimal;
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{ClientId, IndexerClient};
use dydx_v4_rust::node::{
NodeClient, OrderBuilder, OrderSide, Wallet, SHORT_TERM_ORDER_MAXIMUM_LIFETIME,
};
use dydx::config::ClientConfig;
use dydx::indexer::{ClientId, IndexerClient};
use dydx::node::{NodeClient, OrderBuilder, OrderSide, Wallet, SHORT_TERM_ORDER_MAXIMUM_LIFETIME};
use dydx_proto::dydxprotocol::clob::{order::TimeInForce, OrderBatch};
use rand::thread_rng;
use std::str::FromStr;
use support::constants::TEST_MNEMONIC;
use tokio::time::{sleep, Duration};
use v4_proto_rs::dydxprotocol::clob::{order::TimeInForce, OrderBatch};

const N_ORDERS: usize = 6;

Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/bot_basic_adder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ mod support;

use anyhow::{anyhow as err, Error, Result};
use bigdecimal::{BigDecimal, One, Signed};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{
use dydx::config::ClientConfig;
use dydx::indexer::{
AnyId, Feed, IndexerClient, ListPerpetualMarketsOpts, PerpetualMarket, Price, Quantity,
SubaccountsMessage, Ticker, TradesMessage,
};
use dydx_v4_rust::node::{Account, NodeClient, OrderBuilder, OrderId, OrderSide, Wallet};
use dydx::node::{Account, NodeClient, OrderBuilder, OrderId, OrderSide, Wallet};
use std::str::FromStr;
use support::constants::TEST_MNEMONIC;
use support::order_book::LiveOrderBook;
Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/bot_trend_follower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ mod support;

use anyhow::{anyhow as err, Error, Result};
use chrono::{TimeDelta, Utc};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{
use dydx::config::ClientConfig;
use dydx::indexer::{
CandleResolution, ClientId, Feed, GetCandlesOpts, IndexerClient, ListPerpetualMarketsOpts,
PerpetualMarket, Price, Quantity, Subaccount, SubaccountsMessage, Ticker, TradesMessage,
};
use dydx_v4_rust::node::{
use dydx::node::{
Account, NodeClient, OrderBuilder, OrderId, OrderSide, Wallet,
SHORT_TERM_ORDER_MAXIMUM_LIFETIME,
};
Expand Down
8 changes: 4 additions & 4 deletions v4-client-rs/client/examples/cancel_order.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{AnyId, IndexerClient, Ticker};
use dydx_v4_rust::node::{NodeClient, OrderBuilder, OrderSide, Wallet};
use dydx::config::ClientConfig;
use dydx::indexer::{AnyId, IndexerClient, Ticker};
use dydx::node::{NodeClient, OrderBuilder, OrderSide, Wallet};
use dydx_proto::dydxprotocol::clob::order::TimeInForce;
use support::constants::TEST_MNEMONIC;
use tokio::time::{sleep, Duration};
use v4_proto_rs::dydxprotocol::clob::order::TimeInForce;

const ETH_USD_TICKER: &str = "ETH-USD";

Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/close_all_positions.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{
use dydx::config::ClientConfig;
use dydx::indexer::{
ClientId, IndexerClient, ListPositionsOpts,
PerpetualPositionResponseObject as PerpetualPosition, PerpetualPositionStatus, Subaccount,
};
use dydx_v4_rust::node::{NodeClient, Wallet};
use dydx::node::{NodeClient, Wallet};
use support::constants::TEST_MNEMONIC;

pub struct OrderPlacer {
Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/close_position.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
mod support;
use anyhow::{Error, Result};
use bigdecimal::BigDecimal;
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{
use dydx::config::ClientConfig;
use dydx::indexer::{
ClientId, IndexerClient, ListPositionsOpts,
PerpetualPositionResponseObject as PerpetualPosition, PerpetualPositionStatus, Subaccount,
Ticker,
};
use dydx_v4_rust::node::{NodeClient, Wallet};
use dydx::node::{NodeClient, Wallet};
use std::str::FromStr;
use support::constants::TEST_MNEMONIC;
use tokio::time::{sleep, Duration};
Expand Down
4 changes: 2 additions & 2 deletions v4-client-rs/client/examples/deposit.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::node::{NodeClient, Wallet};
use dydx::config::ClientConfig;
use dydx::node::{NodeClient, Wallet};
use support::constants::TEST_MNEMONIC;

pub struct Transferor {
Expand Down
8 changes: 4 additions & 4 deletions v4-client-rs/client/examples/faucet_endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use anyhow::Result;
mod faucet_endpoint_example {
use super::support::constants::TEST_MNEMONIC;
use anyhow::{anyhow as err, Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::faucet::FaucetClient;
use dydx_v4_rust::indexer::Usdc;
use dydx_v4_rust::node::Wallet;
use dydx::config::ClientConfig;
use dydx::faucet::FaucetClient;
use dydx::indexer::Usdc;
use dydx::node::Wallet;
pub struct FaucetRequester {
faucet: FaucetClient,
wallet: Wallet,
Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/live_price.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{Feed, IndexerClient, MarketsMessage, Ticker};
use dydx_v4_rust::node::{OrderBuilder, Wallet};
use dydx::config::ClientConfig;
use dydx::indexer::{Feed, IndexerClient, MarketsMessage, Ticker};
use dydx::node::{OrderBuilder, Wallet};
use support::constants::TEST_MNEMONIC;

pub struct Feeder {
Expand Down
4 changes: 2 additions & 2 deletions v4-client-rs/client/examples/market_endpoint.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{
use dydx::config::ClientConfig;
use dydx::indexer::{
CandleResolution, GetCandlesOpts, GetHistoricalFundingOpts, GetTradesOpts, IndexerClient,
ListPerpetualMarketsOpts, SparklineTimePeriod, Ticker,
};
Expand Down
8 changes: 4 additions & 4 deletions v4-client-rs/client/examples/noble_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use anyhow::Result;
mod noble_transfer_example {
use super::*;
use anyhow::{anyhow as err, Error};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::Token;
use dydx_v4_rust::noble::{NobleClient, NobleUsdc};
use dydx_v4_rust::node::{NodeClient, Wallet};
use dydx::config::ClientConfig;
use dydx::indexer::Token;
use dydx::noble::{NobleClient, NobleUsdc};
use dydx::node::{NodeClient, Wallet};
use tokio::time::{sleep, Duration};

const TEST_MNEMONIC: &str = "mirror actor skill push coach wait confirm orchard lunch mobile athlete gossip awake miracle matter bus reopen team ladder lazy list timber render wait";
Expand Down
8 changes: 4 additions & 4 deletions v4-client-rs/client/examples/place_order_long_term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ mod support;
use anyhow::{Error, Result};
use bigdecimal::BigDecimal;
use chrono::{TimeDelta, Utc};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{ClientId, IndexerClient, Ticker};
use dydx_v4_rust::node::{NodeClient, OrderBuilder, OrderSide, Wallet};
use dydx::config::ClientConfig;
use dydx::indexer::{ClientId, IndexerClient, Ticker};
use dydx::node::{NodeClient, OrderBuilder, OrderSide, Wallet};
use dydx_proto::dydxprotocol::clob::order::TimeInForce;
use support::constants::TEST_MNEMONIC;
use v4_proto_rs::dydxprotocol::clob::order::TimeInForce;

const ETH_USD_TICKER: &str = "ETH-USD";

Expand Down
8 changes: 4 additions & 4 deletions v4-client-rs/client/examples/place_order_short_term.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
mod support;
use anyhow::{Error, Result};
use bigdecimal::BigDecimal;
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::IndexerClient;
use dydx_v4_rust::node::{NodeClient, OrderBuilder, OrderSide, Wallet};
use dydx::config::ClientConfig;
use dydx::indexer::IndexerClient;
use dydx::node::{NodeClient, OrderBuilder, OrderSide, Wallet};
use dydx_proto::dydxprotocol::clob::order::TimeInForce;
use std::str::FromStr;
use support::constants::TEST_MNEMONIC;
use v4_proto_rs::dydxprotocol::clob::order::TimeInForce;

const ETH_USD_TICKER: &str = "ETH-USD";

Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/send_token.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::Token;
use dydx_v4_rust::node::{NodeClient, Wallet};
use dydx::config::ClientConfig;
use dydx::indexer::Token;
use dydx::node::{NodeClient, Wallet};
use support::constants::TEST_MNEMONIC;

pub struct Transferor {
Expand Down
10 changes: 4 additions & 6 deletions v4-client-rs/client/examples/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ use anyhow::{Error, Result};
use async_trait::async_trait;
use bigdecimal::BigDecimal;
use chrono::{TimeDelta, Utc};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{
Address, ClientId, IndexerClient, PerpetualMarket, Subaccount, Ticker,
};
use dydx_v4_rust::node::{sequencer::*, Account, NodeClient, OrderBuilder, OrderSide, Wallet};
use dydx::config::ClientConfig;
use dydx::indexer::{Address, ClientId, IndexerClient, PerpetualMarket, Subaccount, Ticker};
use dydx::node::{sequencer::*, Account, NodeClient, OrderBuilder, OrderSide, Wallet};
use dydx_proto::dydxprotocol::clob::order::TimeInForce;
use std::sync::Arc;
use support::constants::TEST_MNEMONIC;
use tokio::sync::Mutex;
use tokio::time::{sleep, Duration};
use v4_proto_rs::dydxprotocol::clob::order::TimeInForce;

const ETH_USD_TICKER: &str = "ETH-USD";

Expand Down
2 changes: 1 addition & 1 deletion v4-client-rs/client/examples/support/order_book.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bigdecimal::Zero;
use derive_more::{Deref, DerefMut};
use dydx_v4_rust::indexer::{
use dydx::indexer::{
Feed, OrderBookResponseObject, OrderbookResponsePriceLevel, OrdersMessage, Price, Quantity,
};
use std::collections::BTreeMap;
Expand Down
4 changes: 2 additions & 2 deletions v4-client-rs/client/examples/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::node::{NodeClient, Wallet};
use dydx::config::ClientConfig;
use dydx::node::{NodeClient, Wallet};
use support::constants::TEST_MNEMONIC;

pub struct Transferor {
Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/utility_endpoint.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::IndexerClient;
use dydx_v4_rust::node::Wallet;
use dydx::config::ClientConfig;
use dydx::indexer::IndexerClient;
use dydx::node::Wallet;
use support::constants::TEST_MNEMONIC;

pub struct Rester {
Expand Down
4 changes: 2 additions & 2 deletions v4-client-rs/client/examples/validator_get.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::node::{NodeClient, Wallet};
use dydx::config::ClientConfig;
use dydx::node::{NodeClient, Wallet};
use support::constants::TEST_MNEMONIC;

const ETH_USD_PAIR_ID: u32 = 1;
Expand Down
14 changes: 7 additions & 7 deletions v4-client-rs/client/examples/validator_post.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::node::{NodeClient, Wallet};
use rand::{thread_rng, Rng};
use support::constants::TEST_MNEMONIC;
use tokio::time::{sleep, Duration};
use v4_proto_rs::dydxprotocol::clob::{
use dydx::config::ClientConfig;
use dydx::node::{NodeClient, Wallet};
use dydx_proto::dydxprotocol::clob::{
order::{ConditionType, GoodTilOneof, Side, TimeInForce},
Order, OrderId,
};
use v4_proto_rs::dydxprotocol::subaccounts::SubaccountId;
use dydx_proto::dydxprotocol::subaccounts::SubaccountId;
use rand::{thread_rng, Rng};
use support::constants::TEST_MNEMONIC;
use tokio::time::{sleep, Duration};

const ETH_USD_PAIR_ID: u32 = 1;
const ETH_USD_QUANTUMS: u64 = 10_000_000; // calculated based on market
Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/wallet.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx::config::ClientConfig;
#[cfg(feature = "noble")]
use dydx_v4_rust::noble::NobleClient;
use dydx_v4_rust::node::{NodeClient, Wallet};
use dydx::noble::NobleClient;
use dydx::node::{NodeClient, Wallet};
use support::constants::TEST_MNEMONIC;

#[tokio::main]
Expand Down
6 changes: 3 additions & 3 deletions v4-client-rs/client/examples/websockets.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
mod support;
use anyhow::{Error, Result};
use dydx_v4_rust::config::ClientConfig;
use dydx_v4_rust::indexer::{
use dydx::config::ClientConfig;
use dydx::indexer::{
BlockHeightMessage, CandleResolution, CandlesMessage, Feed, IndexerClient, MarketsMessage,
OrdersMessage, ParentSubaccountsMessage, SubaccountsMessage, Ticker, TradesMessage,
};
use dydx_v4_rust::node::Wallet;
use dydx::node::Wallet;
use support::constants::TEST_MNEMONIC;
use tokio::select;

Expand Down
Loading

0 comments on commit fb624ac

Please sign in to comment.