mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 21:17:56 +00:00
Prep to release v0.42.0 (#2003)
* Prep to release v0.42.0 * Remove test_context reference from example * standalone_crate for doc tests because codegen is expensive * fmt
This commit is contained in:
@@ -29,7 +29,7 @@ pub mod rpc {
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// use std::time::Duration;
|
||||
/// use futures::StreamExt;
|
||||
/// use subxt::backend::rpc::reconnecting_rpc_client::{RpcClient, ExponentialBackoff};
|
||||
@@ -541,7 +541,7 @@ mod test {
|
||||
/// - `current_runtime_version`
|
||||
/// - `call`
|
||||
/// The test covers them because they follow the simple pattern of:
|
||||
/// ```no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// async fn THE_THING(&self) -> Result<HashFor<T>, Error> {
|
||||
/// retry(|| <DO THE THING> ).await
|
||||
/// }
|
||||
@@ -572,7 +572,7 @@ mod test {
|
||||
/// - `stream_all_block_headers`
|
||||
/// - `stream_best_block_headers`
|
||||
/// The test covers them because they follow the simple pattern of:
|
||||
/// ```no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// async fn stream_the_thing(
|
||||
/// &self,
|
||||
/// ) -> Result<StreamOfResults<(T::Header, BlockRef<HashFor<T>>)>, Error> {
|
||||
|
||||
@@ -89,7 +89,7 @@ impl<T> Stream for RetrySubscription<T> {
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// use subxt::backend::utils::retry;
|
||||
///
|
||||
/// async fn some_future() -> Result<(), subxt::error::Error> {
|
||||
@@ -149,7 +149,7 @@ where
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// use subxt::backend::{utils::retry_stream, StreamOf};
|
||||
/// use futures::future::FutureExt;
|
||||
///
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//! The most common way to generate the interface is to use the [`#[subxt]`](crate::subxt) macro.
|
||||
//! Using this macro looks something like:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_tiny.scale")]
|
||||
//! pub mod polkadot {}
|
||||
//! ```
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
//! For statemint, the transaction extensions look like
|
||||
//! [this](https://github.com/paritytech/cumulus/blob/d4bb2215bb28ee05159c4c7df1b3435177b5bf4e/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs#L786):
|
||||
//!
|
||||
//! ```rs
|
||||
//! ```rust,ignore
|
||||
//! pub type SignedExtra = (
|
||||
//! frame_system::CheckNonZeroSender<Runtime>,
|
||||
//! frame_system::CheckSpecVersion<Runtime>,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//!
|
||||
//! We can use the statically generated interface to build constant queries:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")]
|
||||
//! pub mod polkadot {}
|
||||
//!
|
||||
@@ -24,7 +24,7 @@
|
||||
//!
|
||||
//! Alternately, we can dynamically construct a constant query:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! use subxt::dynamic::Value;
|
||||
//!
|
||||
//! let storage_query = subxt::dynamic::constant("System", "BlockLength");
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//! by that transaction being executed. We can also access _all_ of the events produced in a single block using one
|
||||
//! of these two interfaces:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! # #[tokio::main]
|
||||
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
//! use subxt::client::OnlineClient;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//!
|
||||
//! We can use the statically generated interface to build runtime calls:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||
//! pub mod polkadot {}
|
||||
//!
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//!
|
||||
//! We can use the statically generated interface to build storage queries:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! use subxt_signer::sr25519::dev;
|
||||
//!
|
||||
//! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||
@@ -28,7 +28,7 @@
|
||||
//! Alternately, we can dynamically construct a storage query. This will not be type checked or
|
||||
//! validated until it's submitted:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! use subxt_signer::sr25519::dev;
|
||||
//! use subxt::dynamic::Value;
|
||||
//!
|
||||
@@ -42,7 +42,7 @@
|
||||
//! the map of account information). To do this, suffix `_iter` onto the query constructor (this
|
||||
//! will only be available on static constructors when iteration is actually possible):
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||
//! pub mod polkadot {}
|
||||
//!
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//!
|
||||
//! We can use the statically generated interface to build transaction payloads:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||
//! pub mod polkadot {}
|
||||
//!
|
||||
@@ -41,7 +41,7 @@
|
||||
//! Alternately, we can dynamically construct a transaction payload. This will not be type checked or
|
||||
//! validated until it's submitted:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! use subxt::dynamic::Value;
|
||||
//!
|
||||
//! let tx_payload = subxt::dynamic::tx("System", "remark", vec![
|
||||
@@ -79,7 +79,7 @@
|
||||
//!
|
||||
//! Let's go through how to create a signer using the `subxt_signer` crate:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```rust,standalone_crate
|
||||
//! use subxt::config::PolkadotConfig;
|
||||
//! use std::str::FromStr;
|
||||
//!
|
||||
@@ -97,7 +97,7 @@
|
||||
//!
|
||||
//! After initializing the signer, let's also go through how to create a transaction and sign it:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```rust,no_run,standalone_crate
|
||||
//! # #[tokio::main]
|
||||
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
//! use subxt::client::OnlineClient;
|
||||
|
||||
@@ -214,7 +214,7 @@ impl<T: Config> OnlineClient<T> {
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// # #[tokio::main]
|
||||
/// # async fn main() {
|
||||
/// use subxt::{ OnlineClient, PolkadotConfig };
|
||||
|
||||
+10
-10
@@ -144,7 +144,7 @@ pub mod ext {
|
||||
///
|
||||
/// Annotate a Rust module with the `subxt` attribute referencing a metadata file like so:
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// )]
|
||||
@@ -157,7 +157,7 @@ pub mod ext {
|
||||
///
|
||||
/// Annotate a Rust module with the `subxt` attribute referencing some runtime WASM like so:
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,ignore
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_path = "../artifacts/westend_runtime.wasm",
|
||||
/// )]
|
||||
@@ -191,7 +191,7 @@ pub mod ext {
|
||||
///
|
||||
/// Use this attribute to specify a custom path to the `subxt_core` crate:
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,standalone_crate
|
||||
/// # pub extern crate subxt_core;
|
||||
/// # pub mod path { pub mod to { pub use subxt_core; } }
|
||||
/// # fn main() {}
|
||||
@@ -210,7 +210,7 @@ pub mod ext {
|
||||
/// This attribute replaces any reference to the generated type at the path given by `path` with a
|
||||
/// reference to the path given by `with`.
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust,standalone_crate
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// substitute_type(path = "sp_arithmetic::per_things::Perbill", with = "crate::Foo")
|
||||
@@ -248,7 +248,7 @@ pub mod ext {
|
||||
/// If the type you're substituting contains generic parameters, you can "pattern match" on those, and
|
||||
/// make use of them in the substituted type, like so:
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// substitute_type(
|
||||
@@ -268,7 +268,7 @@ pub mod ext {
|
||||
/// By default, all generated types derive a small set of traits. This attribute allows you to derive additional
|
||||
/// traits on all generated types:
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// derive_for_all_types = "Eq, PartialEq"
|
||||
@@ -284,7 +284,7 @@ pub mod ext {
|
||||
/// Unlike the above, which derives some trait on every generated type, this attribute allows you to derive traits only
|
||||
/// for specific types. Note that any types which are used inside the specified type may also need to derive the same traits.
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// derive_for_all_types = "Eq, PartialEq",
|
||||
@@ -299,7 +299,7 @@ pub mod ext {
|
||||
/// By default, documentation is not generated via the macro, since IDEs do not typically make use of it. This attribute
|
||||
/// forces documentation to be generated, too.
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// generate_docs
|
||||
@@ -312,7 +312,7 @@ pub mod ext {
|
||||
/// By default, the macro will generate various interfaces to make using Subxt simpler in addition with any types that need
|
||||
/// generating to make this possible. This attribute makes the codegen only generate the types and not the Subxt interface.
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// runtime_types_only
|
||||
@@ -325,7 +325,7 @@ pub mod ext {
|
||||
/// By default, the macro will add all derives necessary for the generated code to play nicely with Subxt. Adding this attribute
|
||||
/// removes all default derives.
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// #[subxt::subxt(
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// runtime_types_only,
|
||||
|
||||
@@ -84,7 +84,7 @@ where
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// use subxt::{ PolkadotConfig, OnlineClient };
|
||||
///
|
||||
/// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")]
|
||||
@@ -161,7 +161,7 @@ where
|
||||
|
||||
/// Returns an iterator of key value pairs.
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```rust,no_run,standalone_crate
|
||||
/// use subxt::{ PolkadotConfig, OnlineClient };
|
||||
///
|
||||
/// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")]
|
||||
|
||||
Reference in New Issue
Block a user