Skip to content

Commit 984098b

Browse files
committed
tests passing with split packages
1 parent 2e0b971 commit 984098b

File tree

19 files changed

+120
-40
lines changed

19 files changed

+120
-40
lines changed

Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
[workspace]
2+
resolver = "2"
23

34
members = [ "crates/webz-common",
4-
"crates/webz-keys",
5+
"crates/webz-keys", "crates/webz-requests",
56
"crates/webz-wallet",
67
]
78

9+
[profile.release]
10+
# Tell `rustc` to optimize for small code size.
11+
opt-level = 3
12+
lto = true
13+
codegen-units = 1
14+
815
[workspace.dependencies]
916
## Web dependencies
1017
wasm-bindgen = "0.2.93"

crates/webz-common/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ license = "MIT OR Apache-2.0"
66
repository = "https://github.com/ChainSafe/WebZjs"
77
description = "A browser client-side library for generating and manipulating zcash keys"
88
edition = "2021"
9-
resolver = "2"
109

1110
[dependencies]
1211
serde.workspace = true

crates/webz-keys/Cargo.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@ license = "MIT OR Apache-2.0"
66
repository = "https://github.com/ChainSafe/WebZjs"
77
description = "A browser client-side library for generating and manipulating zcash keys"
88
edition = "2021"
9-
resolver = "2"
109

1110
[lib]
1211
crate-type = ["cdylib", "rlib"]
1312

14-
[profile.release]
15-
# Tell `rustc` to optimize for small code size.
16-
opt-level = 3
17-
lto = true
18-
codegen-units = 1
19-
2013
[package.metadata.wasm-pack.profile.release]
2114
wasm-opt = ["-O4", "-O4"]
2215

crates/webz-requests/Cargo.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "webz-requests"
3+
version = "0.1.0"
4+
authors = ["ChainSafe Systems"]
5+
license = "MIT OR Apache-2.0"
6+
repository = "https://github.com/ChainSafe/WebZjs"
7+
description = "A browser client-side library for generating and manipulating zcash keys"
8+
edition = "2021"
9+
10+
[lib]
11+
crate-type = ["cdylib", "rlib"]
12+
13+
[package.metadata.wasm-pack.profile.release]
14+
wasm-opt = ["-O4", "-O4"]
15+
16+
[dependencies]
17+
wasm-bindgen.workspace = true
18+
js-sys.workspace = true
19+
20+
zcash_address.workspace = true
21+
zcash_primitives.workspace = true
22+
zip321.workspace = true
23+
thiserror.workspace = true
24+
serde-wasm-bindgen.workspace = true
25+
26+
# fixes "failed to resolve: use of undeclared crate or module `imp`" error
27+
getrandom = { version = "0.2", features = ["js"] }

crates/webz-requests/src/error.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use wasm_bindgen::JsValue;
2+
3+
#[derive(thiserror::Error, Debug)]
4+
pub enum Error {
5+
#[error("Error parsing zatoshi amount: {0}")]
6+
InvalidAmount(#[from] zcash_primitives::transaction::components::amount::BalanceError),
7+
#[error("Attempted to create a transaction with a memo to an unsupported recipient. Only shielded addresses are supported.")]
8+
UnsupportedMemoRecipient,
9+
#[error("Error constructing ZIP321 transaction request: {0}")]
10+
Zip321(#[from] zip321::Zip321Error),
11+
#[error("Error decoding memo: {0}")]
12+
MemoDecoding(#[from] zcash_primitives::memo::Error),
13+
#[error("Error attempting to decode address: {0}")]
14+
AddressDecoding(#[from] zcash_address::ParseError),
15+
#[error("serde wasm-bindgen error")]
16+
SerdeWasmBindgen(#[from] serde_wasm_bindgen::Error),
17+
}
18+
19+
impl From<Error> for JsValue {
20+
fn from(e: Error) -> Self {
21+
js_sys::Error::new(&e.to_string()).into()
22+
}
23+
}

crates/webz-requests/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mod error;
2+
mod requests;

crates/webz-wallet/Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,10 @@ license = "MIT OR Apache-2.0"
66
repository = "https://github.com/ChainSafe/WebZjs"
77
description = "A browser client-side library for implementing Zcash wallets"
88
edition = "2021"
9-
resolver = "2"
10-
119

1210
[lib]
1311
crate-type = ["cdylib", "rlib"]
1412

15-
[profile.release]
16-
# Tell `rustc` to optimize for small code size.
17-
opt-level = 3
18-
lto = true
19-
codegen-units = 1
20-
2113
[package.metadata.wasm-pack.profile.release]
2214
wasm-opt = ["-O4", "-O4"]
2315

crates/webz-wallet/src/bindgen/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
pub mod proposal;
2-
pub mod tx_requests;
32
pub mod wallet;

0 commit comments

Comments
 (0)