Browse Source

spl, tests: Use feature flag for dex (#985)

Armani Ferrante 3 years ago
parent
commit
62fcd75401

+ 0 - 1
Cargo.lock

@@ -214,7 +214,6 @@ name = "anchor-spl"
 version = "0.18.0"
 dependencies = [
  "anchor-lang",
- "lazy_static",
  "serum_dex",
  "solana-program",
  "spl-associated-token-account",

+ 2 - 1
spl/Cargo.toml

@@ -14,10 +14,11 @@ associated_token = []
 governance = []
 shmem = []
 devnet = []
+dex = ["serum_dex"]
 
 [dependencies]
 anchor-lang = { path = "../lang", version = "0.18.0", features = ["derive"] }
-serum_dex = { git = "https://github.com/project-serum/serum-dex", rev = "1be91f2", version = "0.4.0", features = ["no-entrypoint"], optional = true}
+serum_dex = { git = "https://github.com/project-serum/serum-dex", rev = "1be91f2", version = "0.4.0", features = ["no-entrypoint"], optional = true }
 solana-program = "1.8.0"
 spl-token = { version = "3.1.1", features = ["no-entrypoint"] }
 spl-associated-token-account = { version = "1.0.3", features = ["no-entrypoint"] }

+ 1 - 1
spl/src/lib.rs

@@ -7,7 +7,7 @@ pub mod mint;
 #[cfg(feature = "token")]
 pub mod token;
 
-#[cfg(feature = "serum_dex")]
+#[cfg(feature = "dex")]
 pub mod dex;
 
 #[cfg(feature = "governance")]

+ 1 - 1
tests/cfo/deps/swap

@@ -1 +1 @@
-Subproject commit 0382f2e27db5f95d09aec5e6df7bb01bfc8f0e7f
+Subproject commit 8628dc7edbccafc49e75c21977a2abdde10b0898

+ 1 - 1
tests/permissioned-markets/programs/permissioned-markets-middleware/Cargo.toml

@@ -16,5 +16,5 @@ default = []
 
 [dependencies]
 anchor-lang = { path = "../../../../lang" }
-anchor-spl = { path = "../../../../spl" }
+anchor-spl = { path = "../../../../spl", features = ["dex"] }
 solana-program = "1.8.0"

+ 1 - 2
tests/permissioned-markets/programs/permissioned-markets/Cargo.toml

@@ -16,7 +16,6 @@ default = []
 
 [dependencies]
 anchor-lang = { path = "../../../../lang" }
-anchor-spl = { path = "../../../../spl" }
-serum_dex = { path = "../../deps/serum-dex/dex", features = ["no-entrypoint"] }
+anchor-spl = { path = "../../../../spl", features = ["dex"] }
 solana-program = "1.8.0"
 spl-token = { version = "3.1.1", features = ["no-entrypoint"] }

+ 3 - 3
tests/permissioned-markets/programs/permissioned-markets/src/lib.rs

@@ -2,9 +2,9 @@
 
 use anchor_lang::prelude::*;
 use anchor_spl::dex;
-use serum_dex::instruction::MarketInstruction;
-use serum_dex::matching::Side;
-use serum_dex::state::OpenOrders;
+use anchor_spl::dex::serum_dex::instruction::MarketInstruction;
+use anchor_spl::dex::serum_dex::matching::Side;
+use anchor_spl::dex::serum_dex::state::OpenOrders;
 use solana_program::instruction::Instruction;
 use solana_program::system_program;
 use solana_program::sysvar::rent;

+ 1 - 1
tests/swap/programs/swap/Cargo.toml

@@ -16,4 +16,4 @@ default = []
 
 [dependencies]
 anchor-lang = { path = "../../../../lang" }
-anchor-spl = { path = "../../../../spl" }
+anchor-spl = { path = "../../../../spl", features = ["dex"] }