-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove substrate-compat
default feature flag
#1078
Changes from 9 commits
6836f9b
4091501
538a55a
e6bdea3
6ebb190
32210d5
78a5e96
1686260
6ddeb74
6f7f7ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,8 +66,8 @@ | |
//! There are two main ways to create a compatible signer instance: | ||
//! 1. The `subxt_signer` crate provides a WASM compatible implementation of [`crate::tx::Signer`] | ||
//! for chains which require sr25519 or ecdsa signatures (requires the `subxt` feature to be enabled). | ||
//! 2. Alternately, Subxt can use instances of Substrate's [`sp_core::Pair`] to sign things by wrapping | ||
//! them in a [`crate::tx::PairSigner`] (requires the `substrate-compat` feature to be enabled). | ||
//! 2. Alternately, Subxt can use instances of Substrate's `sp_core::Pair` to sign things by wrapping | ||
//! them in a `crate::tx::PairSigner` (requires the `substrate-compat` feature to be enabled). | ||
//! | ||
//! Going for 1 leads to fewer dependencies being imported and WASM compatibility out of the box via | ||
//! the `web` feature flag. Going for 2 is useful if you're already using the Substrate dependencies or | ||
|
@@ -77,43 +77,46 @@ | |
//! Let's see how to use each of these approaches: | ||
//! | ||
//! ```rust | ||
//! use subxt::config::PolkadotConfig; | ||
//! use std::str::FromStr; | ||
//! | ||
//! //// 1. Use a `subxt_signer` impl: | ||
//! use subxt_signer::{ SecretUri, sr25519 }; | ||
//! | ||
//! // Get hold of a `Signer` for a test account: | ||
//! let alice = sr25519::dev::alice(); | ||
//! | ||
//! // Or generate a keypair, here from an SURI: | ||
//! let uri = SecretUri::from_str("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password") | ||
//! .expect("valid URI"); | ||
//! let keypair = sr25519::Keypair::from_uri(&uri) | ||
//! .expect("valid keypair"); | ||
//! | ||
//! //// 2. Use the corresponding `sp_core::Pair` impl: | ||
//! use subxt::tx::PairSigner; | ||
//! use sp_core::Pair; | ||
//! | ||
//! // Get hold of a `Signer` for a test account: | ||
//! let alice = sp_keyring::AccountKeyring::Alice.pair(); | ||
//! let alice = PairSigner::<PolkadotConfig,_>::new(alice); | ||
//! | ||
//! // Or generate a keypair, here from an SURI: | ||
//! let keypair = sp_core::sr25519::Pair::from_string("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password", None) | ||
//! .expect("valid URI"); | ||
//! let keypair = PairSigner::<PolkadotConfig,_>::new(keypair); | ||
//! # | ||
//! # // Test that these all impl Signer trait while we're here: | ||
//! # | ||
//! # fn is_subxt_signer(_signer: impl subxt::tx::Signer<PolkadotConfig>) {} | ||
//! # is_subxt_signer(subxt_signer::sr25519::dev::alice()); | ||
//! # is_subxt_signer(subxt_signer::ecdsa::dev::alice()); | ||
//! # is_subxt_signer(PairSigner::<PolkadotConfig,_>::new(sp_keyring::AccountKeyring::Alice.pair())); | ||
//! #[cfg(feature = "substrate-compat")] | ||
//! { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ooh, putting the feature on a block is much cleaner than my suggesiton; good idea! I'd suggest hiding these lines though (with a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tadeohepperle this is the only thing left that I'd like to see done :) |
||
//! use subxt::config::PolkadotConfig; | ||
//! use std::str::FromStr; | ||
//! | ||
//! //// 1. Use a `subxt_signer` impl: | ||
//! use subxt_signer::{ SecretUri, sr25519 }; | ||
//! | ||
//! // Get hold of a `Signer` for a test account: | ||
//! let alice = sr25519::dev::alice(); | ||
//! | ||
//! // Or generate a keypair, here from an SURI: | ||
//! let uri = SecretUri::from_str("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password") | ||
//! .expect("valid URI"); | ||
//! let keypair = sr25519::Keypair::from_uri(&uri) | ||
//! .expect("valid keypair"); | ||
//! | ||
//! //// 2. Use the corresponding `sp_core::Pair` impl: | ||
//! use subxt::tx::PairSigner; | ||
//! use sp_core::Pair; | ||
//! | ||
//! // Get hold of a `Signer` for a test account: | ||
//! let alice = sp_keyring::AccountKeyring::Alice.pair(); | ||
//! let alice = PairSigner::<PolkadotConfig,_>::new(alice); | ||
//! | ||
//! // Or generate a keypair, here from an SURI: | ||
//! let keypair = sp_core::sr25519::Pair::from_string("vessel ladder alter error federal sibling chat ability sun glass valve picture/0/1///Password", None) | ||
//! .expect("valid URI"); | ||
//! let keypair = PairSigner::<PolkadotConfig,_>::new(keypair); | ||
//! # | ||
//! # // Test that these all impl Signer trait while we're here: | ||
//! # | ||
//! # fn is_subxt_signer(_signer: impl subxt::tx::Signer<PolkadotConfig>) {} | ||
//! # is_subxt_signer(subxt_signer::sr25519::dev::alice()); | ||
//! # is_subxt_signer(subxt_signer::ecdsa::dev::alice()); | ||
//! # is_subxt_signer(PairSigner::<PolkadotConfig,_>::new(sp_keyring::AccountKeyring::Alice.pair())); | ||
//! } | ||
jsdw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//! ``` | ||
//! | ||
//! See the `subxt_signer` crate or the [`sp_core::Pair`] docs for more ways to construct | ||
//! See the `subxt_signer` crate or the `sp_core::Pair` docs for more ways to construct | ||
//! and work with key pairs. | ||
//! | ||
//! If this isn't suitable/available, you can either implement [`crate::tx::Signer`] yourself to use | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉