Compare commits

...

3 Commits

Author SHA1 Message Date
Mark Sinclair 23f0212a16 Update CHANGELOG 2022-09-02 15:35:06 +01:00
Mark Sinclair cb58a62ff7 wasm-client: fix up dependencies and feature flags so that wasm-pack build works 2022-09-02 15:32:57 +01:00
Mark Sinclair cc8be3bce2 wasm-client: change example to use the mainnet validator API 2022-09-02 15:32:46 +01:00
7 changed files with 22 additions and 48 deletions
+2
View File
@@ -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
-29
View File
@@ -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"
@@ -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"
@@ -4926,12 +4910,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"
@@ -6418,8 +6396,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",
] ]
@@ -6515,15 +6491,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 +6508,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",
] ]
+1 -1
View File
@@ -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" }
+1 -1
View File
@@ -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);
+4 -4
View File
@@ -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
@@ -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;
+1
View File
@@ -5227,6 +5227,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"nymsphinx-addressing", "nymsphinx-addressing",
"ordered-buffer", "ordered-buffer",
"thiserror",
] ]
[[package]] [[package]]