Skip to content

Commit 1a4345d

Browse files
committed
Typescript SDK support for zk-nyms
1 parent dff82f9 commit 1a4345d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3375
-82
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ foxyfox.env
4848

4949
.next
5050
ppa-private-key.b64
51-
ppa-private-key.asc
51+
ppa-private-key.asc
52+
53+
yarn-error.log

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ members = [
125125
# "wasm/full-nym-wasm", # If we uncomment this again, remember to also uncomment the profile settings below
126126
"wasm/mix-fetch",
127127
"wasm/node-tester",
128-
"wasm/zknym-lib",
128+
"wasm/zk-nym-lib",
129+
"wasm/zk-nym-faucet-lib",
129130
"tools/internal/testnet-manager",
130131
"tools/internal/testnet-manager/dkg-bypass-contract",
131132
]

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ sdk-wasm-build:
104104
$(MAKE) -C wasm/client
105105
$(MAKE) -C wasm/node-tester
106106
$(MAKE) -C wasm/mix-fetch
107-
$(MAKE) -C wasm/zknym-lib
107+
$(MAKE) -C wasm/zk-nym-lib
108+
$(MAKE) -C wasm/zk-nym-faucet-lib
108109
#$(MAKE) -C wasm/full-nym-wasm
109110

110111
# run this from npm/yarn to ensure tools are in the path, e.g. yarn build:sdk from root of repo

common/client-libs/validator-client/src/nyxd/error.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub enum NyxdError {
5050
#[error("{0} is not a valid tx hash")]
5151
InvalidTxHash(String),
5252

53-
#[error("Tendermint RPC request failed - {0}")]
53+
#[error("Tendermint RPC request failed: {0}")]
5454
TendermintErrorRpc(#[from] TendermintRpcError),
5555

5656
#[error("tendermint library failure: {0}")]
@@ -62,22 +62,22 @@ pub enum NyxdError {
6262
#[error("Failed when attempting to deserialize data ({0})")]
6363
DeserializationError(String),
6464

65-
#[error("Failed when attempting to encode our protobuf data - {0}")]
65+
#[error("Failed when attempting to encode our protobuf data: {0}")]
6666
ProtobufEncodingError(#[from] prost::EncodeError),
6767

68-
#[error("Failed to decode our protobuf data - {0}")]
68+
#[error("Failed to decode our protobuf data: {0}")]
6969
ProtobufDecodingError(#[from] prost::DecodeError),
7070

71-
#[error("Account {0} does not exist on the chain")]
71+
#[error("Account '{0}' does not exist on the chain")]
7272
NonExistentAccountError(AccountId),
7373

74-
#[error("Failed on json serialization/deserialization - {0}")]
74+
#[error("Failed on json serialization/deserialization: {0}")]
7575
SerdeJsonError(#[from] serde_json::Error),
7676

77-
#[error("Account {0} is not a valid account address")]
77+
#[error("Account '{0}' is not a valid account address")]
7878
MalformedAccountAddress(String),
7979

80-
#[error("Account {0} has an invalid associated public key")]
80+
#[error("Account '{0}' has an invalid associated public key")]
8181
InvalidPublicKey(AccountId),
8282

8383
#[error("Queried contract (code_id: {0}) did not have any code information attached")]
@@ -92,7 +92,7 @@ pub enum NyxdError {
9292
#[error("Block has an invalid height (either negative or larger than i64::MAX")]
9393
InvalidHeight,
9494

95-
#[error("Failed to compress provided wasm code - {0}")]
95+
#[error("Failed to compress provided wasm code: {0}")]
9696
WasmCompressionError(io::Error),
9797

9898
#[error("Logs returned from the validator were malformed")]

common/client-libs/validator-client/src/rpc/reqwest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ trait TendermintRpcErrorMap {
109109

110110
impl TendermintRpcErrorMap for reqwest::Error {
111111
fn into_rpc_err(self) -> Error {
112-
todo!()
112+
// that's not the best error converion, but it's better than a panic
113+
Error::client_internal(self.to_string())
113114
}
114115
}
115116

common/network-defaults/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ schemars = { workspace = true, features = ["preserve_order"], optional = true }
1414
serde = { workspace = true, features = ["derive"], optional = true }
1515
url = { workspace = true, optional = true }
1616

17-
# please be extremely careful when adding new dependencies because this crate is imported by the ecash contract,
18-
# so if anything new is added, consider feature-locking it and then just adding it to default feature
17+
# 'wasm-serde-types' feature
18+
tsify = { workspace = true, features = ["js"], optional = true }
19+
wasm-bindgen = { workspace = true, optional = true }
1920

2021
[features]
22+
wasm-serde-types = ["tsify", "wasm-bindgen"]
2123
default = ["env", "network"]
2224
env = ["dotenvy", "log"]
2325
network = ["schemars", "serde", "url"]

common/wasm/client-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ wasm-storage = { path = "../storage" }
4444
console_error_panic_hook = { workspace = true, optional = true }
4545

4646
[features]
47-
default = ["console_error_panic_hook"]
47+
default = ["wasm-utils/console_error_panic_hook"]

common/wasm/utils/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ gloo-utils = { workspace = true }
1717
gloo-net = { workspace = true, features = ["websocket"], optional = true }
1818
#gloo-net = { path = "../../../../gloo/crates/net", features = ["websocket"], optional = true }
1919

20+
# The `console_error_panic_hook` crate provides better debugging of panics by
21+
# logging them with `console.error`. This is great for development, but requires
22+
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
23+
# code size when deploying.
2024
console_error_panic_hook = { workspace = true, optional = true }
2125

2226
# we don't want entire tokio-tungstenite, tungstenite itself is just fine - we just want message and error enums

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@
5454
"node-gyp": "^9.3.1",
5555
"tslog": "3.3.3"
5656
}
57-
}
57+
}

0 commit comments

Comments
 (0)