bindings/cashu-sdk wallet

This commit is contained in:
thesimplekid
2023-10-01 14:13:28 +01:00
parent 4148ee8365
commit 871dfde171
7 changed files with 28 additions and 13 deletions

View File

@@ -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 }}

View File

@@ -1,5 +1,5 @@
build:
wasm-pack build
build:
pack:
wasm-pack pack

View File

@@ -0,0 +1,6 @@
build:
wasm-pack build
pack:
wasm-pack pack

View File

@@ -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<JsSendProofs> {
let proofs = serde_wasm_bindgen::from_value(proofs).map_err(into_err)?;

View File

@@ -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 }

View File

@@ -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;

View File

@@ -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