diff --git a/Cargo.lock b/Cargo.lock index 0ddaed929..f73265d04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2358,18 +2358,6 @@ name = "radium" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand" version = "0.5.6" @@ -2762,6 +2750,17 @@ dependencies = [ "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sha-1" version = "0.9.1" @@ -2774,11 +2773,6 @@ dependencies = [ "opaque-debug 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "sha2" version = "0.8.1" @@ -3450,7 +3444,7 @@ dependencies = [ [[package]] name = "substrate-api-client" -version = "0.4.9-sub2.0.0" +version = "0.4.10-sub2.0.0" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3475,7 +3469,7 @@ dependencies = [ "sp-version 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ws 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4076,7 +4070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ws" -version = "0.7.9" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4086,10 +4080,10 @@ dependencies = [ "mio 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4376,7 +4370,6 @@ dependencies = [ "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" "checksum radium 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" -"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" @@ -4422,8 +4415,8 @@ dependencies = [ "checksum serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)" = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" "checksum serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)" = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" "checksum serde_json 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)" = "a7894c8ed05b7a3a279aeb79025fdec1d3158080b75b98a08faf2806bb799edd" +"checksum sha-1 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" "checksum sha-1 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" "checksum sha2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" "checksum sha3 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" @@ -4548,7 +4541,7 @@ dependencies = [ "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" +"checksum ws 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a2c47b5798ccc774ffb93ff536aec7c4275d722fd9c740c83cdd1af1f2d94" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" "checksum zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" diff --git a/Cargo.toml b/Cargo.toml index ff1129c3e..437534ce8 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "substrate-api-client" -version = "0.4.9-sub2.0.0" +version = "0.4.10-sub2.0.0" authors = ["Supercomputing Systems AG "] edition = "2018" [dependencies] env_logger = { version = "0.7", optional = true } -ws = { version = "0.7", optional = true, features = ["ssl"] } +ws = { version = "0.9.1", optional = true, features = ["ssl"] } hex = { version = "0.4", default-features = false } log = { version = "0.4", optional = true } serde = { version = "1.0", optional = true, features = ["derive"] } diff --git a/src/examples/cli.yml b/src/examples/cli.yml index c59c34661..9f7ad6f40 100644 --- a/src/examples/cli.yml +++ b/src/examples/cli.yml @@ -9,11 +9,12 @@ settings: args: - node-server: - long: ns - help: Set the node server IP address + short: u + long: url + help: Set the node server IP address including ws:// or wss:// prefix takes_value: true - node-port: short: p - long: node-port + long: port help: Set the websocket port to listen for substrate events takes_value: true diff --git a/src/examples/example_benchmark_bulk_xt.rs b/src/examples/example_benchmark_bulk_xt.rs index e243d9965..4d204eebc 100755 --- a/src/examples/example_benchmark_bulk_xt.rs +++ b/src/examples/example_benchmark_bulk_xt.rs @@ -33,7 +33,7 @@ fn main() { // initialize api and set the signer (sender) that is used to sign the extrinsics let from = AccountKeyring::Alice.pair(); - let api = Api::new(format!("ws://{}", url)).set_signer(from); + let api = Api::new(url).set_signer(from); println!( "[+] Alice's Account Nonce is {}\n", @@ -72,7 +72,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}\n", url); diff --git a/src/examples/example_compose_extrinsic_offline.rs b/src/examples/example_compose_extrinsic_offline.rs index 6b7ad9279..2ab32be4c 100755 --- a/src/examples/example_compose_extrinsic_offline.rs +++ b/src/examples/example_compose_extrinsic_offline.rs @@ -32,7 +32,7 @@ fn main() { // initialize api and set the signer (sender) that is used to sign the extrinsics let from = AccountKeyring::Alice.pair(); - let api = Api::new(format!("ws://{}", url)).set_signer(from); + let api = Api::new(url).set_signer(from); // Information for Era for mortal transactions let head = api.get_finalized_head().unwrap(); @@ -73,7 +73,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}\n", url); diff --git a/src/examples/example_event_callback.rs b/src/examples/example_event_callback.rs index e3c91f6db..9ac915a5c 100755 --- a/src/examples/example_event_callback.rs +++ b/src/examples/example_event_callback.rs @@ -34,7 +34,7 @@ fn main() { env_logger::init(); let url = get_node_url_from_cli(); - let api = Api::::new(format!("ws://{}", url)); + let api = Api::::new(url); println!("Subscribe to events"); let (events_in, events_out) = channel(); @@ -78,7 +78,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}", url); diff --git a/src/examples/example_generic_event_callback.rs b/src/examples/example_generic_event_callback.rs index f031d5456..1235a4499 100644 --- a/src/examples/example_generic_event_callback.rs +++ b/src/examples/example_generic_event_callback.rs @@ -35,7 +35,7 @@ fn main() { env_logger::init(); let url = get_node_url_from_cli(); - let api = Api::::new(format!("ws://{}", url)); + let api = Api::::new(url); println!("Subscribe to events"); let (events_in, events_out) = channel(); @@ -55,7 +55,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}", url); diff --git a/src/examples/example_generic_extrinsic.rs b/src/examples/example_generic_extrinsic.rs index 66b8e0c7f..7264f980b 100755 --- a/src/examples/example_generic_extrinsic.rs +++ b/src/examples/example_generic_extrinsic.rs @@ -30,7 +30,7 @@ fn main() { // initialize api and set the signer (sender) that is used to sign the extrinsics let from = AccountKeyring::Alice.pair(); - let api = Api::new(format!("ws://{}", url)).set_signer(from); + let api = Api::new(url).set_signer(from); // set the recipient let to = AccountKeyring::Bob.to_account_id(); @@ -54,7 +54,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}\n", url); diff --git a/src/examples/example_get_blocks.rs b/src/examples/example_get_blocks.rs index fccccc43c..3e394490b 100644 --- a/src/examples/example_get_blocks.rs +++ b/src/examples/example_get_blocks.rs @@ -31,7 +31,7 @@ fn main() { env_logger::init(); let url = get_node_url_from_cli(); - let api = Api::::new(format!("ws://{}", url)); + let api = Api::::new(url); let head = api.get_finalized_head().unwrap(); @@ -70,7 +70,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}\n", url); diff --git a/src/examples/example_get_storage.rs b/src/examples/example_get_storage.rs index 378cd4fcd..8527e5096 100755 --- a/src/examples/example_get_storage.rs +++ b/src/examples/example_get_storage.rs @@ -23,7 +23,7 @@ fn main() { env_logger::init(); let url = get_node_url_from_cli(); - let mut api = Api::new(format!("ws://{}", url)); + let mut api = Api::new(url); // get some plain storage value let result: u128 = api @@ -64,7 +64,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}\n", url); diff --git a/src/examples/example_print_metadata.rs b/src/examples/example_print_metadata.rs index 54a9b0342..cb9a23b80 100755 --- a/src/examples/example_print_metadata.rs +++ b/src/examples/example_print_metadata.rs @@ -32,7 +32,7 @@ fn main() { env_logger::init(); let url = get_node_url_from_cli(); - let api = Api::::new(format!("ws://{}", url)); + let api = Api::::new(url); let meta = Metadata::try_from(api.get_metadata()).unwrap(); @@ -52,7 +52,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}\n", url); diff --git a/src/examples/example_sudo.rs b/src/examples/example_sudo.rs index 8844fb7a2..8b0390779 100644 --- a/src/examples/example_sudo.rs +++ b/src/examples/example_sudo.rs @@ -30,7 +30,7 @@ fn main() { // initialize api and set the signer (sender) that is used to sign the extrinsics let sudoer = AccountKeyring::Alice.pair(); - let api = Api::new(format!("ws://{}", url)).set_signer(sudoer); + let api = Api::new(url).set_signer(sudoer); // set the recipient of newly issued funds let to = AccountKeyring::Bob.to_account_id(); @@ -59,7 +59,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}\n", url); diff --git a/src/examples/example_transfer.rs b/src/examples/example_transfer.rs index 5f145fdd0..45af3c553 100755 --- a/src/examples/example_transfer.rs +++ b/src/examples/example_transfer.rs @@ -26,7 +26,7 @@ fn main() { // initialize api and set the signer (sender) that is used to sign the extrinsics let from = AccountKeyring::Alice.pair(); - let api = Api::new(format!("ws://{}", url)).set_signer(from.clone()); + let api = Api::new(url).set_signer(from.clone()); let to = AccountKeyring::Bob.to_account_id(); @@ -60,7 +60,7 @@ pub fn get_node_url_from_cli() -> String { let yml = load_yaml!("../../src/examples/cli.yml"); let matches = App::from_yaml(yml).get_matches(); - let node_ip = matches.value_of("node-server").unwrap_or("127.0.0.1"); + let node_ip = matches.value_of("node-server").unwrap_or("ws://127.0.0.1"); let node_port = matches.value_of("node-port").unwrap_or("9944"); let url = format!("{}:{}", node_ip, node_port); println!("Interacting with node on {}\n", url);