From 871dfde17130ab0158a1edd7f0b38736130a0dfb Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Sun, 1 Oct 2023 14:13:28 +0100 Subject: [PATCH] `bindings/cashu-sdk` wallet --- .github/workflows/test.yml | 22 +++++++++++++++++++--- bindings/cashu-js/justfile | 2 +- bindings/cashu-sdk-js/justfile | 6 ++++++ bindings/cashu-sdk-js/src/wallet.rs | 2 +- crates/cashu-sdk/Cargo.toml | 7 ------- crates/cashu-sdk/src/lib.rs | 1 + justfile | 1 - 7 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 bindings/cashu-sdk-js/justfile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33922921..248217ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,13 +12,29 @@ env: jobs: test: runs-on: ubuntu-latest + strategy: + matrix: + rust: + - version: stable + build-args: + [ + -p cashu, + -p cashu --no-default-features, + -p cashu --no-default-features --features wallet, + -p cashu --no-default-features --features mint, + -p cashu-sdk, + -p cashu-sdk --no-default-features, + -p cashu-sdk --features blocking, + ] steps: - name: Checkout Crate uses: actions/checkout@v3 - name: Set Toolchain # https://github.com/dtolnay/rust-toolchain uses: dtolnay/rust-toolchain@stable - - name: Run tests + - name: Set default toolchain + run: rustup default ${{ matrix.rust.version }} + - name: Test run: | - rustup update - cargo test + rustup + cargo test ${{ matrix.build-arfgs }} diff --git a/bindings/cashu-js/justfile b/bindings/cashu-js/justfile index b933472c..fa614e35 100644 --- a/bindings/cashu-js/justfile +++ b/bindings/cashu-js/justfile @@ -1,5 +1,5 @@ build: wasm-pack build -build: +pack: wasm-pack pack diff --git a/bindings/cashu-sdk-js/justfile b/bindings/cashu-sdk-js/justfile new file mode 100644 index 00000000..119e1e58 --- /dev/null +++ b/bindings/cashu-sdk-js/justfile @@ -0,0 +1,6 @@ +build: + wasm-pack build + +pack: + wasm-pack pack + diff --git a/bindings/cashu-sdk-js/src/wallet.rs b/bindings/cashu-sdk-js/src/wallet.rs index 27f4af5b..b313a96b 100644 --- a/bindings/cashu-sdk-js/src/wallet.rs +++ b/bindings/cashu-sdk-js/src/wallet.rs @@ -125,7 +125,7 @@ impl JsWallet { } /// Send - #[wasm_bindgen(js_name = processSplitResponse)] + #[wasm_bindgen(js_name = send)] pub async fn send(&self, amount: JsAmount, proofs: JsValue) -> Result { let proofs = serde_wasm_bindgen::from_value(proofs).map_err(into_err)?; diff --git a/crates/cashu-sdk/Cargo.toml b/crates/cashu-sdk/Cargo.toml index e2299ca6..adfcf797 100644 --- a/crates/cashu-sdk/Cargo.toml +++ b/crates/cashu-sdk/Cargo.toml @@ -16,13 +16,6 @@ blocking = ["dep:once_cell"] wallet = ["cashu/wallet", "dep:minreq", "dep:once_cell"] -# Fix: Should be minreq or gloo -# [target.'cfg(not(target_arch = "wasm32"))'.features] -# wallet = ["cashu/wallet", "minreq", "once_cell"] - -# [target.'cfg(target_arch = "wasm32")'.features] -# wallet = ["cashu/wallet", "gloo", "once_cell"] - [dependencies] cashu = { path = "../cashu" } serde = { workspace = true } diff --git a/crates/cashu-sdk/src/lib.rs b/crates/cashu-sdk/src/lib.rs index 9914c783..fd9ac8f9 100644 --- a/crates/cashu-sdk/src/lib.rs +++ b/crates/cashu-sdk/src/lib.rs @@ -3,6 +3,7 @@ compile_error!("`blocking` feature can't be enabled for WASM targets"); #[cfg(feature = "blocking")] use once_cell::sync::Lazy; + #[cfg(feature = "blocking")] use tokio::runtime::Runtime; diff --git a/justfile b/justfile index 5fa27ca4..3b0598bf 100644 --- a/justfile +++ b/justfile @@ -8,7 +8,6 @@ precommit: typos cargo test -p cashu cargo test -p cashu-sdk - cargo clippy cargo clippy --target wasm32-unknown-unknown -p cashu cargo clippy --target wasm32-unknown-unknown -p cashu-sdk rustup default 1.70.0