Remove serum-common dependency from cli (#1667)

This commit is contained in:
Italo Casas 2022-03-22 00:48:01 +01:00 committed by GitHub
parent d2233d6163
commit 811a4cb318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 111 deletions

123
Cargo.lock generated
View File

@ -27,12 +27,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e"
[[package]]
name = "ahash"
version = "0.7.6"
@ -174,7 +168,6 @@ dependencies = [
"semver 1.0.6",
"serde",
"serde_json",
"serum-common",
"shellexpand",
"solana-cli-config",
"solana-client",
@ -243,7 +236,7 @@ dependencies = [
"serum_dex",
"solana-program",
"spl-associated-token-account",
"spl-token 3.2.0",
"spl-token",
]
[[package]]
@ -454,21 +447,8 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa"
dependencies = [
"borsh-derive 0.9.3",
"hashbrown 0.11.2",
]
[[package]]
name = "borsh-derive"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "307f3740906bac2c118a8122fe22681232b244f1369273e45f1156b45c43d2dd"
dependencies = [
"borsh-derive-internal 0.8.2",
"borsh-schema-derive-internal 0.8.2",
"proc-macro-crate 0.1.5",
"proc-macro2 1.0.36",
"syn 1.0.88",
"borsh-derive",
"hashbrown",
]
[[package]]
@ -477,24 +457,13 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775"
dependencies = [
"borsh-derive-internal 0.9.3",
"borsh-schema-derive-internal 0.9.3",
"borsh-derive-internal",
"borsh-schema-derive-internal",
"proc-macro-crate 0.1.5",
"proc-macro2 1.0.36",
"syn 1.0.88",
]
[[package]]
name = "borsh-derive-internal"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2104c73179359431cc98e016998f2f23bc7a05bc53e79741bcba705f30047bc"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.15",
"syn 1.0.88",
]
[[package]]
name = "borsh-derive-internal"
version = "0.9.3"
@ -506,17 +475,6 @@ dependencies = [
"syn 1.0.88",
]
[[package]]
name = "borsh-schema-derive-internal"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae29eb8418fcd46f723f8691a2ac06857d31179d33d2f2d91eb13967de97c728"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.15",
"syn 1.0.88",
]
[[package]]
name = "borsh-schema-derive-internal"
version = "0.9.3"
@ -1486,22 +1444,13 @@ dependencies = [
"tracing",
]
[[package]]
name = "hashbrown"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
dependencies = [
"ahash 0.4.7",
]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
dependencies = [
"ahash 0.7.6",
"ahash",
]
[[package]]
@ -1694,7 +1643,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [
"autocfg",
"hashbrown 0.11.2",
"hashbrown",
]
[[package]]
@ -2870,35 +2819,6 @@ dependencies = [
"yaml-rust",
]
[[package]]
name = "serum-borsh"
version = "0.8.1-serum.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4fed3f601b23f15dc890f6e52ffdbfe2dcf16418a41e0aa016b5f10cf30c892"
dependencies = [
"borsh-derive 0.8.2",
"hashbrown 0.9.1",
"solana-program",
]
[[package]]
name = "serum-common"
version = "0.1.0"
source = "git+https://github.com/project-serum/serum-dex#5b43fe1455470de59233e434f979082092ebb28d"
dependencies = [
"anyhow",
"arrayref",
"bincode",
"bs58 0.3.1",
"rand",
"serde",
"serde_json",
"serum-borsh",
"solana-client",
"solana-sdk",
"spl-token 2.0.8",
]
[[package]]
name = "serum_dex"
version = "0.4.0"
@ -2916,7 +2836,7 @@ dependencies = [
"safe-transmute",
"serde",
"solana-program",
"spl-token 3.2.0",
"spl-token",
"static_assertions",
"thiserror",
"without-alloc",
@ -3034,7 +2954,7 @@ dependencies = [
"solana-config-program",
"solana-sdk",
"solana-vote-program",
"spl-token 3.2.0",
"spl-token",
"thiserror",
"zstd",
]
@ -3300,7 +3220,7 @@ version = "1.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3aaa73acee6e4ced74f607ef53b3bbac0b8598bff06c95c790e8068d9c5a948"
dependencies = [
"ahash 0.7.6",
"ahash",
"bincode",
"caps",
"curve25519-dalek 2.1.3",
@ -3331,7 +3251,7 @@ dependencies = [
"bincode",
"blake3",
"borsh",
"borsh-derive 0.9.3",
"borsh-derive",
"bs58 0.3.1",
"bv",
"bytemuck",
@ -3453,7 +3373,7 @@ dependencies = [
"base64 0.13.0",
"bincode",
"borsh",
"borsh-derive 0.9.3",
"borsh-derive",
"bs58 0.4.0",
"bv",
"bytemuck",
@ -3563,7 +3483,7 @@ dependencies = [
"solana-vote-program",
"spl-associated-token-account",
"spl-memo",
"spl-token 3.2.0",
"spl-token",
"thiserror",
]
@ -3617,7 +3537,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "393e2240d521c3dd770806bff25c2c00d761ac962be106e14e22dd912007f428"
dependencies = [
"solana-program",
"spl-token 3.2.0",
"spl-token",
]
[[package]]
@ -3629,21 +3549,6 @@ dependencies = [
"solana-program",
]
[[package]]
name = "spl-token"
version = "2.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eaa27ab75067c63b8804d9fff30bd2e8bfb5be448bea8067ed768381e70ca181"
dependencies = [
"arrayref",
"num-derive",
"num-traits",
"num_enum",
"remove_dir_all",
"solana-sdk",
"thiserror",
]
[[package]]
name = "spl-token"
version = "3.2.0"

View File

@ -29,7 +29,6 @@ solana-sdk = "~1.8.14"
solana-program = "~1.8.14"
solana-client = "~1.8.14"
solana-cli-config = "~1.8.14"
serum-common = { git = "https://github.com/project-serum/serum-dex", features = ["client"] }
dirs = "3.0"
heck = "0.3.1"
flate2 = "1.0.19"

View File

@ -732,4 +732,4 @@ impl AnchorPackage {
}
}
serum_common::home_path!(WalletPath, ".config/solana/id.json");
crate::home_path!(WalletPath, ".config/solana/id.json");

View File

@ -44,6 +44,7 @@ use std::string::ToString;
use tar::Archive;
pub mod config;
mod path;
pub mod template;
// Version of the docker image.

36
cli/src/path.rs Normal file
View File

@ -0,0 +1,36 @@
#[macro_export]
macro_rules! home_path {
($my_struct:ident, $path:literal) => {
#[derive(Clone, Debug)]
pub struct $my_struct(String);
impl Default for $my_struct {
fn default() -> Self {
match dirs::home_dir() {
None => {
println!("$HOME doesn't exist. This probably won't do what you want.");
$my_struct(".".to_string())
}
Some(mut path) => {
path.push($path);
$my_struct(path.as_path().display().to_string())
}
}
}
}
impl ToString for $my_struct {
fn to_string(&self) -> String {
self.0.clone()
}
}
impl FromStr for $my_struct {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self(s.to_string()))
}
}
};
}