Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 922941f2db | |||
| f334acab99 | |||
| 001c98e544 | |||
| d3eb238d5a | |||
| 23f0212a16 | |||
| cb58a62ff7 | |||
| cc8be3bce2 |
@@ -12,9 +12,11 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https://
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- validator-client: made `fee` argument optional for `execute` and `execute_multiple` ([#1541])
|
- validator-client: made `fee` argument optional for `execute` and `execute_multiple` ([#1541])
|
||||||
|
- wasm-client: fixed build errors on MacOS and changed example JS code to use mainnet ([#1585])
|
||||||
|
|
||||||
[#1541]: https://github.com/nymtech/nym/pull/1541
|
[#1541]: https://github.com/nymtech/nym/pull/1541
|
||||||
[#1558]: https://github.com/nymtech/nym/pull/1558
|
[#1558]: https://github.com/nymtech/nym/pull/1558
|
||||||
|
[#1585]: https://github.com/nymtech/nym/pull/1585
|
||||||
|
|
||||||
|
|
||||||
## [nym-binaries-1.0.2](https://github.com/nymtech/nym/tree/nym-binaries-1.0.2)
|
## [nym-binaries-1.0.2](https://github.com/nymtech/nym/tree/nym-binaries-1.0.2)
|
||||||
|
|||||||
Generated
+98
-52
@@ -1128,7 +1128,7 @@ version = "0.8.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8"
|
checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sct",
|
"sct 0.6.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1904,10 +1904,6 @@ name = "futures-timer"
|
|||||||
version = "3.0.2"
|
version = "3.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
|
checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
|
||||||
dependencies = [
|
|
||||||
"gloo-timers",
|
|
||||||
"send_wrapper",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-util"
|
name = "futures-util"
|
||||||
@@ -1958,8 +1954,8 @@ dependencies = [
|
|||||||
"secp256k1",
|
"secp256k1",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite 0.17.2",
|
||||||
"tungstenite",
|
"tungstenite 0.17.3",
|
||||||
"url",
|
"url",
|
||||||
"validator-client",
|
"validator-client",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@@ -1984,7 +1980,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tungstenite",
|
"tungstenite 0.17.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2092,18 +2088,6 @@ version = "0.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gloo-timers"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e"
|
|
||||||
dependencies = [
|
|
||||||
"futures-channel",
|
|
||||||
"futures-core",
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "group"
|
name = "group"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
@@ -2396,7 +2380,7 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
"tokio-rustls",
|
"tokio-rustls",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"webpki",
|
"webpki 0.21.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2409,12 +2393,12 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"hyper",
|
"hyper",
|
||||||
"log",
|
"log",
|
||||||
"rustls",
|
"rustls 0.19.1",
|
||||||
"rustls-native-certs",
|
"rustls-native-certs",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-rustls",
|
"tokio-rustls",
|
||||||
"webpki",
|
"webpki 0.21.4",
|
||||||
"webpki-roots",
|
"webpki-roots 0.21.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3089,7 +3073,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"sled",
|
"sled",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite 0.17.2",
|
||||||
"topology",
|
"topology",
|
||||||
"url",
|
"url",
|
||||||
"validator-client",
|
"validator-client",
|
||||||
@@ -3136,7 +3120,7 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite 0.17.2",
|
||||||
"tokio-util 0.7.3",
|
"tokio-util 0.7.3",
|
||||||
"url",
|
"url",
|
||||||
"validator-api-requests",
|
"validator-api-requests",
|
||||||
@@ -3210,7 +3194,7 @@ dependencies = [
|
|||||||
"statistics-common",
|
"statistics-common",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite 0.14.0",
|
||||||
"websocket-requests",
|
"websocket-requests",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3227,7 +3211,7 @@ dependencies = [
|
|||||||
"statistics-common",
|
"statistics-common",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite 0.14.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4730,8 +4714,20 @@ dependencies = [
|
|||||||
"base64",
|
"base64",
|
||||||
"log",
|
"log",
|
||||||
"ring",
|
"ring",
|
||||||
"sct",
|
"sct 0.6.1",
|
||||||
"webpki",
|
"webpki 0.21.4",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustls"
|
||||||
|
version = "0.20.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"ring",
|
||||||
|
"sct 0.7.0",
|
||||||
|
"webpki 0.22.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4741,7 +4737,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092"
|
checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"openssl-probe",
|
"openssl-probe",
|
||||||
"rustls",
|
"rustls 0.19.1",
|
||||||
"schannel",
|
"schannel",
|
||||||
"security-framework",
|
"security-framework",
|
||||||
]
|
]
|
||||||
@@ -4833,6 +4829,16 @@ dependencies = [
|
|||||||
"untrusted",
|
"untrusted",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sct"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
|
||||||
|
dependencies = [
|
||||||
|
"ring",
|
||||||
|
"untrusted",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sec1"
|
name = "sec1"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
@@ -4926,12 +4932,6 @@ dependencies = [
|
|||||||
"pest",
|
"pest",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "send_wrapper"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.136"
|
version = "1.0.136"
|
||||||
@@ -5330,7 +5330,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"paste",
|
"paste",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"rustls",
|
"rustls 0.19.1",
|
||||||
"sha2 0.9.9",
|
"sha2 0.9.9",
|
||||||
"smallvec 1.8.0",
|
"smallvec 1.8.0",
|
||||||
"sqlformat",
|
"sqlformat",
|
||||||
@@ -5339,8 +5339,8 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"url",
|
"url",
|
||||||
"webpki",
|
"webpki 0.21.4",
|
||||||
"webpki-roots",
|
"webpki-roots 0.21.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5799,9 +5799,9 @@ version = "0.22.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"
|
checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustls",
|
"rustls 0.19.1",
|
||||||
"tokio",
|
"tokio",
|
||||||
"webpki",
|
"webpki 0.21.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5838,7 +5838,19 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tungstenite",
|
"tungstenite 0.13.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-tungstenite"
|
||||||
|
version = "0.17.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181"
|
||||||
|
dependencies = [
|
||||||
|
"futures-util",
|
||||||
|
"log",
|
||||||
|
"tokio",
|
||||||
|
"tungstenite 0.17.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6106,6 +6118,28 @@ dependencies = [
|
|||||||
"utf-8",
|
"utf-8",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tungstenite"
|
||||||
|
version = "0.17.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0"
|
||||||
|
dependencies = [
|
||||||
|
"base64",
|
||||||
|
"byteorder",
|
||||||
|
"bytes",
|
||||||
|
"http",
|
||||||
|
"httparse",
|
||||||
|
"log",
|
||||||
|
"rand 0.8.5",
|
||||||
|
"rustls 0.20.6",
|
||||||
|
"sha-1 0.10.0",
|
||||||
|
"thiserror",
|
||||||
|
"url",
|
||||||
|
"utf-8",
|
||||||
|
"webpki 0.22.0",
|
||||||
|
"webpki-roots 0.22.4",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.15.0"
|
version = "1.15.0"
|
||||||
@@ -6418,8 +6452,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
|
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"wasm-bindgen-macro",
|
"wasm-bindgen-macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -6485,7 +6517,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"tungstenite",
|
"tungstenite 0.17.3",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
@@ -6515,15 +6547,12 @@ dependencies = [
|
|||||||
"ethereum-types",
|
"ethereum-types",
|
||||||
"futures",
|
"futures",
|
||||||
"futures-timer",
|
"futures-timer",
|
||||||
"getrandom 0.2.6",
|
|
||||||
"headers",
|
"headers",
|
||||||
"hex",
|
"hex",
|
||||||
"js-sys",
|
|
||||||
"jsonrpc-core",
|
"jsonrpc-core",
|
||||||
"log",
|
"log",
|
||||||
"parking_lot 0.11.2",
|
"parking_lot 0.11.2",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"rand 0.8.5",
|
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rlp",
|
"rlp",
|
||||||
"secp256k1",
|
"secp256k1",
|
||||||
@@ -6535,8 +6564,6 @@ dependencies = [
|
|||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-util 0.6.9",
|
"tokio-util 0.6.9",
|
||||||
"url",
|
"url",
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-futures",
|
|
||||||
"web3-async-native-tls",
|
"web3-async-native-tls",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -6562,13 +6589,32 @@ dependencies = [
|
|||||||
"untrusted",
|
"untrusted",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "webpki"
|
||||||
|
version = "0.22.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"
|
||||||
|
dependencies = [
|
||||||
|
"ring",
|
||||||
|
"untrusted",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webpki-roots"
|
name = "webpki-roots"
|
||||||
version = "0.21.1"
|
version = "0.21.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940"
|
checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"webpki",
|
"webpki 0.21.4",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "webpki-roots"
|
||||||
|
version = "0.22.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf"
|
||||||
|
dependencies = [
|
||||||
|
"webpki 0.22.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ rand = { version = "0.7.3", features = ["wasm-bindgen"] } # rng-related traits +
|
|||||||
serde = { version = "1.0.104", features = ["derive"] } # for config serialization/deserialization
|
serde = { version = "1.0.104", features = ["derive"] } # for config serialization/deserialization
|
||||||
sled = "0.34" # for storage of replySURB decryption keys
|
sled = "0.34" # for storage of replySURB decryption keys
|
||||||
tokio = { version = "1.19.1", features = ["rt-multi-thread", "net", "signal"] } # async runtime
|
tokio = { version = "1.19.1", features = ["rt-multi-thread", "net", "signal"] } # async runtime
|
||||||
tokio-tungstenite = "0.14" # websocket
|
tokio-tungstenite = "0.17.2" # websocket
|
||||||
|
|
||||||
## internal
|
## internal
|
||||||
client-core = { path = "../client-core" }
|
client-core = { path = "../client-core" }
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-client-wasm"
|
name = "nym-client-wasm"
|
||||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jedrzej Stuczynski <andrew@nymtech.net>"]
|
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jedrzej Stuczynski <andrew@nymtech.net>"]
|
||||||
version = "1.0.1"
|
version = "1.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
keywords = ["nym", "sphinx", "wasm", "webassembly", "privacy", "client"]
|
keywords = ["nym", "sphinx", "wasm", "webassembly", "privacy", "client"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
@@ -32,7 +32,7 @@ credentials = { path = "../../common/credentials", optional = true }
|
|||||||
crypto = { path = "../../common/crypto" }
|
crypto = { path = "../../common/crypto" }
|
||||||
nymsphinx = { path = "../../common/nymsphinx" }
|
nymsphinx = { path = "../../common/nymsphinx" }
|
||||||
topology = { path = "../../common/topology" }
|
topology = { path = "../../common/topology" }
|
||||||
gateway-client = { path = "../../common/client-libs/gateway-client", default-features = false, features = ["wasm"] }
|
gateway-client = { path = "../../common/client-libs/gateway-client", default-features = false, features = ["wasm", "coconut"] }
|
||||||
validator-client = { path = "../../common/client-libs/validator-client", default-features = false }
|
validator-client = { path = "../../common/client-libs/validator-client", default-features = false }
|
||||||
wasm-utils = { path = "../../common/wasm-utils" }
|
wasm-utils = { path = "../../common/wasm-utils" }
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 318 B |
@@ -25,7 +25,7 @@ async function main() {
|
|||||||
set_panic_hook();
|
set_panic_hook();
|
||||||
|
|
||||||
// validator server we will use to get topology from
|
// validator server we will use to get topology from
|
||||||
const validator = "https://sandbox-validator.nymtech.net/api"; //"http://localhost:8081";
|
const validator = "https://validator.nymtech.net/api"; //"http://localhost:8081";
|
||||||
|
|
||||||
client = new NymClient(validator);
|
client = new NymClient(validator);
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ impl NymClient {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn choose_gateway(&self) -> &gateway::Node {
|
pub(crate) fn choose_gateway(&self) -> gateway::Node {
|
||||||
let topology = self
|
let topology = self
|
||||||
.topology
|
.topology
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@@ -219,7 +219,21 @@ impl NymClient {
|
|||||||
|
|
||||||
// choose the first one available
|
// choose the first one available
|
||||||
assert!(!topology.gateways().is_empty());
|
assert!(!topology.gateways().is_empty());
|
||||||
topology.gateways().first().unwrap()
|
topology.gateways().first().unwrap();
|
||||||
|
|
||||||
|
console_log!("picking nym gateway");
|
||||||
|
|
||||||
|
gateway::Node {
|
||||||
|
owner: "n1kymvkx6vsq7pvn6hfurkpg06h3j4gxj4em7tlg".to_string(),
|
||||||
|
stake: 100000000,
|
||||||
|
location: "PRIVACY HQ".to_string(),
|
||||||
|
host: "gateway1.nymtech.net".parse().unwrap(),
|
||||||
|
mix_host: "213.219.38.119:1789".parse().unwrap(),
|
||||||
|
clients_port: 443,
|
||||||
|
identity_key: identity::PublicKey::from_base58_string("E3mvZTHQCdBvhfr178Swx9g4QG3kkRUun7YnToLMcMbM").unwrap(),
|
||||||
|
sphinx_key: encryption::PublicKey::from_base58_string("CYcrjoJ8GT7Dp54zViUyyRUfegeRCyPifWQZHRgMZrfX").unwrap(),
|
||||||
|
version: "1.0.0-rc.2".to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right now it's impossible to have async exported functions to take `&mut self` rather than mut self
|
// Right now it's impossible to have async exported functions to take `&mut self` rather than mut self
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ log = "0.4"
|
|||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
url = "2.2"
|
url = "2.2"
|
||||||
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
|
||||||
secp256k1 = "0.20.3"
|
secp256k1 = { version = "0.20.3", optional = true }
|
||||||
web3 = { version = "0.17.0", default-features = false }
|
web3 = { version = "0.17.0", default-features = false, optional = true }
|
||||||
async-trait = { version = "0.1.51" }
|
async-trait = { version = "0.1.51" }
|
||||||
|
|
||||||
# internal
|
# internal
|
||||||
@@ -30,8 +30,8 @@ network-defaults = { path = "../../network-defaults" }
|
|||||||
validator-client = { path = "../validator-client", optional = true }
|
validator-client = { path = "../validator-client", optional = true }
|
||||||
|
|
||||||
[dependencies.tungstenite]
|
[dependencies.tungstenite]
|
||||||
version = "0.13"
|
version = "0.17.3"
|
||||||
default-features = false
|
features = ["rustls-tls-webpki-roots"]
|
||||||
|
|
||||||
# non-wasm-only dependencies
|
# non-wasm-only dependencies
|
||||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio]
|
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio]
|
||||||
@@ -39,7 +39,7 @@ version = "1.19.1"
|
|||||||
features = ["macros", "rt", "net", "sync", "time"]
|
features = ["macros", "rt", "net", "sync", "time"]
|
||||||
|
|
||||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio-tungstenite]
|
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio-tungstenite]
|
||||||
version = "0.14"
|
version = "0.17.2"
|
||||||
|
|
||||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.credential-storage]
|
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.credential-storage]
|
||||||
path = "../../credential-storage"
|
path = "../../credential-storage"
|
||||||
@@ -73,5 +73,5 @@ features = ["js"]
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
coconut = ["gateway-requests/coconut", "coconut-interface", "validator-client", "credentials/coconut"]
|
coconut = ["gateway-requests/coconut", "coconut-interface", "validator-client", "credentials/coconut"]
|
||||||
wasm = ["web3/wasm", "web3/http", "web3/signing"]
|
wasm = []
|
||||||
default = ["web3/default"]
|
default = ["web3/default", "secp256k1"]
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
use {
|
use {
|
||||||
credentials::token::bandwidth::TokenCredential,
|
credentials::token::bandwidth::TokenCredential,
|
||||||
crypto::asymmetric::identity,
|
crypto::asymmetric::identity,
|
||||||
@@ -45,7 +45,7 @@ use {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
pub fn eth_contract(web3: Web3<Http>) -> Contract<Http> {
|
pub fn eth_contract(web3: Web3<Http>) -> Contract<Http> {
|
||||||
Contract::from_json(
|
Contract::from_json(
|
||||||
web3.eth(),
|
web3.eth(),
|
||||||
@@ -58,7 +58,7 @@ pub fn eth_contract(web3: Web3<Http>) -> Contract<Http> {
|
|||||||
.expect("Invalid json abi")
|
.expect("Invalid json abi")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
pub fn eth_erc20_contract(web3: Web3<Http>) -> Contract<Http> {
|
pub fn eth_erc20_contract(web3: Web3<Http>) -> Contract<Http> {
|
||||||
Contract::from_json(
|
Contract::from_json(
|
||||||
web3.eth(),
|
web3.eth(),
|
||||||
@@ -76,11 +76,11 @@ pub struct BandwidthController<St: Storage> {
|
|||||||
storage: St,
|
storage: St,
|
||||||
#[cfg(feature = "coconut")]
|
#[cfg(feature = "coconut")]
|
||||||
validator_endpoints: Vec<url::Url>,
|
validator_endpoints: Vec<url::Url>,
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
contract: Contract<Http>,
|
contract: Contract<Http>,
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
erc20_contract: Contract<Http>,
|
erc20_contract: Contract<Http>,
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
eth_private_key: SecretKey,
|
eth_private_key: SecretKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
storage: St,
|
storage: St,
|
||||||
eth_endpoint: String,
|
eth_endpoint: String,
|
||||||
@@ -120,7 +120,7 @@ where
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
async fn backup_keypair(&self, keypair: &identity::KeyPair) -> Result<(), GatewayClientError> {
|
async fn backup_keypair(&self, keypair: &identity::KeyPair) -> Result<(), GatewayClientError> {
|
||||||
self.storage
|
self.storage
|
||||||
.insert_erc20_credential(
|
.insert_erc20_credential(
|
||||||
@@ -132,7 +132,7 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
async fn restore_keypair(&self) -> Result<identity::KeyPair, GatewayClientError> {
|
async fn restore_keypair(&self) -> Result<identity::KeyPair, GatewayClientError> {
|
||||||
let data = self.storage.get_next_erc20_credential().await?;
|
let data = self.storage.get_next_erc20_credential().await?;
|
||||||
let public_key = identity::PublicKey::from_base58_string(data.public_key).unwrap();
|
let public_key = identity::PublicKey::from_base58_string(data.public_key).unwrap();
|
||||||
@@ -141,7 +141,7 @@ where
|
|||||||
Ok(identity::KeyPair::from_keys(private_key, public_key))
|
Ok(identity::KeyPair::from_keys(private_key, public_key))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
async fn mark_keypair_as_spent(
|
async fn mark_keypair_as_spent(
|
||||||
&self,
|
&self,
|
||||||
keypair: &identity::KeyPair,
|
keypair: &identity::KeyPair,
|
||||||
@@ -180,7 +180,7 @@ where
|
|||||||
)?)
|
)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
pub async fn prepare_token_credential(
|
pub async fn prepare_token_credential(
|
||||||
&self,
|
&self,
|
||||||
gateway_identity: identity::PublicKey,
|
gateway_identity: identity::PublicKey,
|
||||||
@@ -219,7 +219,7 @@ where
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
pub async fn buy_token_credential(
|
pub async fn buy_token_credential(
|
||||||
&self,
|
&self,
|
||||||
verification_key: identity::PublicKey,
|
verification_key: identity::PublicKey,
|
||||||
@@ -348,7 +348,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "coconut"))]
|
#[cfg(all(not(target_arch = "wasm32"), not(feature = "coconut")))]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use network_defaults::ETH_EVENT_NAME;
|
use network_defaults::ETH_EVENT_NAME;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ use rand::rngs::OsRng;
|
|||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tungstenite::protocol::Message;
|
use tungstenite::Message;
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use tokio_tungstenite::connect_async;
|
use tokio_tungstenite::connect_async;
|
||||||
@@ -449,7 +449,7 @@ impl GatewayClient {
|
|||||||
.derive_destination_address();
|
.derive_destination_address();
|
||||||
let encrypted_address = EncryptedAddressBytes::new(&self_address, shared_key, &iv);
|
let encrypted_address = EncryptedAddressBytes::new(&self_address, shared_key, &iv);
|
||||||
|
|
||||||
let msg =
|
let msg: tungstenite::Message =
|
||||||
ClientControlRequest::new_authenticate(self_address, encrypted_address, iv).into();
|
ClientControlRequest::new_authenticate(self_address, encrypted_address, iv).into();
|
||||||
|
|
||||||
match self.send_websocket_message(msg).await? {
|
match self.send_websocket_message(msg).await? {
|
||||||
@@ -733,6 +733,8 @@ impl GatewayClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn authenticate_and_start(&mut self) -> Result<Arc<SharedKeys>, GatewayClientError> {
|
pub async fn authenticate_and_start(&mut self) -> Result<Arc<SharedKeys>, GatewayClientError> {
|
||||||
|
println!("About to establish connection to {}", self.gateway_address);
|
||||||
|
|
||||||
if !self.connection.is_established() {
|
if !self.connection.is_established() {
|
||||||
self.establish_connection().await?;
|
self.establish_connection().await?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ impl Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn clients_address(&self) -> String {
|
pub fn clients_address(&self) -> String {
|
||||||
format!("ws://{}:{}", self.host, self.clients_port)
|
format!("wss://{}:{}", self.host, self.clients_port)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ wasm-bindgen-futures = "0.4"
|
|||||||
|
|
||||||
# we don't want entire tokio-tungstenite, tungstenite itself is just fine - we just want message and error enums
|
# we don't want entire tokio-tungstenite, tungstenite itself is just fine - we just want message and error enums
|
||||||
[dependencies.tungstenite]
|
[dependencies.tungstenite]
|
||||||
version = "0.13"
|
version = "0.17.3"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dependencies.web-sys]
|
[dependencies.web-sys]
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ pub struct JSWebsocket {
|
|||||||
|
|
||||||
impl JSWebsocket {
|
impl JSWebsocket {
|
||||||
pub fn new(url: &str) -> Result<Self, JsValue> {
|
pub fn new(url: &str) -> Result<Self, JsValue> {
|
||||||
|
console_log!(
|
||||||
|
"Attempting to establish wasm websocket connection to {}",
|
||||||
|
url
|
||||||
|
);
|
||||||
|
|
||||||
let ws = WebSocket::new(url)?;
|
let ws = WebSocket::new(url)?;
|
||||||
// we don't want to ever have to deal with blobs
|
// we don't want to ever have to deal with blobs
|
||||||
ws.set_binary_type(web_sys::BinaryType::Arraybuffer);
|
ws.set_binary_type(web_sys::BinaryType::Arraybuffer);
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ subtle-encoding = { version = "0.5", features = ["bech32-preview"]}
|
|||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
tokio = { version = "1.19.1", features = [ "rt-multi-thread", "net", "signal", "fs" ] }
|
tokio = { version = "1.19.1", features = [ "rt-multi-thread", "net", "signal", "fs" ] }
|
||||||
tokio-stream = { version = "0.1.9", features = [ "fs" ] }
|
tokio-stream = { version = "0.1.9", features = [ "fs" ] }
|
||||||
tokio-tungstenite = "0.14"
|
tokio-tungstenite = "0.17"
|
||||||
tokio-util = { version = "0.7.3", features = [ "codec" ] }
|
tokio-util = { version = "0.7.3", features = [ "codec" ] }
|
||||||
url = { version = "2.2", features = [ "serde" ] }
|
url = { version = "2.2", features = [ "serde" ] }
|
||||||
web3 = "0.17.0"
|
web3 = "0.17.0"
|
||||||
|
|||||||
@@ -29,6 +29,6 @@ credentials = { path = "../../common/credentials" }
|
|||||||
coconut = ["coconut-interface", "credentials/coconut"]
|
coconut = ["coconut-interface", "credentials/coconut"]
|
||||||
|
|
||||||
[dependencies.tungstenite]
|
[dependencies.tungstenite]
|
||||||
version = "0.13.0"
|
version = "0.17.3"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ pub use self::shared_key::{SharedKeySize, SharedKeys};
|
|||||||
use crypto::asymmetric::identity;
|
use crypto::asymmetric::identity;
|
||||||
use futures::{Sink, Stream};
|
use futures::{Sink, Stream};
|
||||||
use rand::{CryptoRng, RngCore};
|
use rand::{CryptoRng, RngCore};
|
||||||
use tungstenite::{Error as WsError, Message as WsMessage};
|
use tungstenite::error::Error as WsError;
|
||||||
|
use tungstenite::protocol::Message as WsMessage;
|
||||||
|
|
||||||
pub(crate) type WsItem = Result<WsMessage, WsError>;
|
pub(crate) type WsItem = Result<WsMessage, WsError>;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ use std::{
|
|||||||
convert::{TryFrom, TryInto},
|
convert::{TryFrom, TryInto},
|
||||||
fmt::{self, Error, Formatter},
|
fmt::{self, Error, Formatter},
|
||||||
};
|
};
|
||||||
use tungstenite::protocol::Message;
|
|
||||||
|
|
||||||
#[cfg(feature = "coconut")]
|
#[cfg(feature = "coconut")]
|
||||||
use coconut_interface::Credential;
|
use coconut_interface::Credential;
|
||||||
@@ -192,12 +191,12 @@ impl ClientControlRequest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ClientControlRequest> for Message {
|
impl From<ClientControlRequest> for tungstenite::Message {
|
||||||
fn from(req: ClientControlRequest) -> Self {
|
fn from(req: ClientControlRequest) -> Self {
|
||||||
// it should be safe to call `unwrap` here as the message is generated by the server
|
// it should be safe to call `unwrap` here as the message is generated by the server
|
||||||
// so if it fails (and consequently panics) it's a bug that should be resolved
|
// so if it fails (and consequently panics) it's a bug that should be resolved
|
||||||
let str_req = serde_json::to_string(&req).unwrap();
|
let str_req = serde_json::to_string(&req).unwrap();
|
||||||
Message::Text(str_req)
|
tungstenite::Message::Text(str_req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,12 +257,12 @@ impl ServerResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ServerResponse> for Message {
|
impl From<ServerResponse> for tungstenite::Message {
|
||||||
fn from(res: ServerResponse) -> Self {
|
fn from(res: ServerResponse) -> Self {
|
||||||
// it should be safe to call `unwrap` here as the message is generated by the server
|
// it should be safe to call `unwrap` here as the message is generated by the server
|
||||||
// so if it fails (and consequently panics) it's a bug that should be resolved
|
// so if it fails (and consequently panics) it's a bug that should be resolved
|
||||||
let str_res = serde_json::to_string(&res).unwrap();
|
let str_res = serde_json::to_string(&res).unwrap();
|
||||||
Message::Text(str_res)
|
tungstenite::Message::Text(str_res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,8 +313,8 @@ impl BinaryRequest {
|
|||||||
BinaryRequest::ForwardSphinx(mix_packet)
|
BinaryRequest::ForwardSphinx(mix_packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_ws_message(self, shared_key: &SharedKeys) -> Message {
|
pub fn into_ws_message(self, shared_key: &SharedKeys) -> tungstenite::Message {
|
||||||
Message::Binary(self.into_encrypted_tagged_bytes(shared_key))
|
tungstenite::Message::Binary(self.into_encrypted_tagged_bytes(shared_key))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,8 +366,8 @@ impl BinaryResponse {
|
|||||||
BinaryResponse::PushedMixMessage(msg)
|
BinaryResponse::PushedMixMessage(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_ws_message(self, shared_key: &SharedKeys) -> Message {
|
pub fn into_ws_message(self, shared_key: &SharedKeys) -> tungstenite::Message {
|
||||||
Message::Binary(self.into_encrypted_tagged_bytes(shared_key))
|
tungstenite::Message::Binary(self.into_encrypted_tagged_bytes(shared_key))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
+1
@@ -5227,6 +5227,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"nymsphinx-addressing",
|
"nymsphinx-addressing",
|
||||||
"ordered-buffer",
|
"ordered-buffer",
|
||||||
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
Reference in New Issue
Block a user