Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made dependencies of orca_whirlpools_client less strict #472

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions rust-sdk/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ core-types = ["dep:orca_whirlpools_core"]
serde = ["dep:serde", "dep:serde_with"]

[dependencies]
anchor-lang = { version = "^0.30", optional = true }
borsh = { version = "^0.10" }
num-derive = { version = "^0.4" }
num-traits = { version = "^0.2" }
anchor-lang = { version = "^0", optional = true }
borsh = { version = "^0" }
num-derive = { version = "^0" }
num-traits = { version = "^0" }
orca_whirlpools_core = { path = "../core", optional = true }
serde = { version = "^1", features = ["derive"], optional = true }
serde_with = { version = "^3.10", optional = true }
solana-program = { version = "^1.18" }
thiserror = { version = "^1" }
serde_with = { version = "^3", optional = true }
solana-program = { version = "^1" }
thiserror = { version = "^2" }
17 changes: 8 additions & 9 deletions rust-sdk/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ wasm = ["dep:wasm-bindgen", "dep:serde", "dep:serde-big-array", "dep:serde-wasm-
floats = ["dep:libm"]

[dependencies]
ethnum = { version = "^1.5" }
libm = { version = "^0.2", optional = true }
ethnum = { version = "^1" }
libm = { version = "^0", optional = true }
orca_whirlpools_macros = { path = "../macros" }
wasm-bindgen = { version = "^0.2", optional = true }
wasm-bindgen = { version = "^0", optional = true }
serde = { version = "^1", features = ["derive"], optional = true }
serde-big-array = { version = "^0.5", optional = true }
serde-wasm-bindgen = { version = "^0.6", optional = true }
js-sys = { version = "^0.3", optional = true }
tsify = { version = "^0.4", features = ["js"], optional = true }
serde-big-array = { version = "^0", optional = true }
serde-wasm-bindgen = { version = "^0", optional = true }
js-sys = { version = "^0", optional = true }
tsify = { version = "^0", features = ["js"], optional = true }

[dev-dependencies]
print-no-std = { version = "^0.2"}
approx = { version = "^0.5" }
approx = { version = "^0" }
10 changes: 10 additions & 0 deletions rust-sdk/integration/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "orca_whirlpools_integration"
edition = "2021"

[features]
default = []
anchor = ["orca_whirlpools_client/anchor"]

[dependencies]
orca_whirlpools_client = { path = "../client" }
40 changes: 40 additions & 0 deletions rust-sdk/integration/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import assert from "assert";
import { execSync } from "child_process";
import { existsSync, rmSync } from "fs";
import { describe, it, beforeEach } from "vitest";

type RustConfig = {
solana: string;
anchor?: string;
};

// Make sure client package work with a wide range of solana/anchor versions
const versionConfigs: RustConfig[] = [
{ solana: "1.17.11" },
{ solana: "1.18.26" },
{ solana: "1.17.11", anchor: "0.29.0" },
{ solana: "1.18.26", anchor: "0.30.1" },
];

describe("Integration", () => {

beforeEach(() => {
if (existsSync("Cargo.lock")) {
rmSync("Cargo.lock");
}
})

versionConfigs.forEach((config) => {
it(`Build using '${JSON.stringify(config)}'`, () => {
let features = "";
if (config.anchor) {
features = `--features anchor`;
execSync(`cargo update anchor-lang --precise ${config.anchor}`);
}
execSync(`cargo update solana-program --precise ${config.solana}`);

const output = execSync(`cargo run ${features}`).toString();
assert(output.includes("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"));
});
});
});
13 changes: 13 additions & 0 deletions rust-sdk/integration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@orca-so/whirlpools-rust-integration",
"version": "0.0.1",
"type": "module",
"scripts": {
"build": "tsc --noEmit",
"test": "vitest run index.test.ts"
},
"devDependencies": {
"@orca-so/whirlpools-rust-client": "*",
"typescript": "^5.5.4"
}
}
5 changes: 5 additions & 0 deletions rust-sdk/integration/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use orca_whirlpools_client::ID;

fn main() {
println!("{:?}", ID);
}
7 changes: 7 additions & 0 deletions rust-sdk/integration/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["index.test.ts"]
}
13 changes: 11 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4578,6 +4578,15 @@ __metadata:
languageName: unknown
linkType: soft

"@orca-so/whirlpools-rust-integration@workspace:rust-sdk/integration":
version: 0.0.0-use.local
resolution: "@orca-so/whirlpools-rust-integration@workspace:rust-sdk/integration"
dependencies:
"@orca-so/whirlpools-rust-client": "npm:*"
typescript: "npm:^5.5.4"
languageName: unknown
linkType: soft

"@orca-so/whirlpools-rust-macros@npm:*, @orca-so/whirlpools-rust-macros@workspace:rust-sdk/macros":
version: 0.0.0-use.local
resolution: "@orca-so/whirlpools-rust-macros@workspace:rust-sdk/macros"
Expand Down Expand Up @@ -17347,7 +17356,7 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^5.6.3":
"typescript@npm:^5.5.4, typescript@npm:^5.6.3":
version: 5.6.3
resolution: "typescript@npm:5.6.3"
bin:
Expand All @@ -17357,7 +17366,7 @@ __metadata:
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A^5.6.3#optional!builtin<compat/typescript>":
"typescript@patch:typescript@npm%3A^5.5.4#optional!builtin<compat/typescript>, typescript@patch:typescript@npm%3A^5.6.3#optional!builtin<compat/typescript>":
version: 5.6.3
resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin<compat/typescript>::version=5.6.3&hash=8c6c40"
bin:
Expand Down