Add runtime_metadata_url to pull metadata directly from a node (#689)

* Allow metadata to be pulled directly from a node with runtime_metadata_url

* Update docs

* https too, and abstract out block_on fn

* tweak a comment in the example
This commit is contained in:
James Wilson
2022-10-19 11:07:12 +01:00
committed by GitHub
parent d7546db843
commit d03e599684
14 changed files with 286 additions and 79 deletions
@@ -0,0 +1,4 @@
#[subxt::subxt()]
pub mod node_runtime {}
fn main() {}
@@ -0,0 +1,7 @@
error: One of 'runtime_metadata_path' or 'runtime_metadata_url' must be provided
--> src/incorrect/need_url_or_path.rs:1:1
|
1 | #[subxt::subxt()]
| ^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `subxt::subxt` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -0,0 +1,7 @@
#[subxt::subxt(
runtime_metadata_path = "../../../artifacts/polkadot_metadata.scale",
runtime_metadata_url = "wss://rpc.polkadot.io:443"
)]
pub mod node_runtime {}
fn main() {}
@@ -0,0 +1,10 @@
error: Only one of 'runtime_metadata_path' or 'runtime_metadata_url' can be provided
--> src/incorrect/url_and_path_provided.rs:1:1
|
1 | / #[subxt::subxt(
2 | | runtime_metadata_path = "../../../artifacts/polkadot_metadata.scale",
3 | | runtime_metadata_url = "wss://rpc.polkadot.io:443"
4 | | )]
| |__^
|
= note: this error originates in the attribute macro `subxt::subxt` (in Nightly builds, run with -Z macro-backtrace for more info)