When I try to create a PairSigner
, then the Pair
traits are not satisfied.
GitHub repo to check the code
With this code:
let pair = sp_core::sr25519::Pair::from_phrase(mnemonic_phrase.as_str(), None).unwrap();
let signer = PairSigner::<PolkadotConfig, sp_core::sr25519::Pair>::new(pair);
I get this error:
error[E0599]: the function or associated item `new` exists for struct `PairSigner<WithExtrinsicParams<SubstrateConfig, BaseExtrinsicParams<SubstrateConfig, PlainTip>>, Pair>`, but its trait bounds were not satisfied
--> src/main.rs:23:72
|
23 | let signer = PairSigner::<PolkadotConfig, sp_core::sr25519::Pair>::new(pair);
| ^^^ function or associated item cannot be called due to unsatisfied trait bounds
|
::: /Users/martin.jensen/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-core-18.0.0/src/sr25519.rs:83:1
|
83 | pub struct Pair(Keypair);
| ---------------
| |
| doesn't satisfy `_: CryptoType`
| doesn't satisfy `sp_core::sr25519::Pair: sp_core::crypto::Pair`
|
= note: the following trait bounds were not satisfied:
`sp_core::sr25519::Pair: sp_core::crypto::Pair`
`sp_core::sr25519::Pair: sp_core::crypto::CryptoType`
which is required by `sp_core::sr25519::Pair: sp_core::crypto::Pair`
For more information about this error, try `rustc --explain E0599`.
This is my toml dependencies which I followed from the subxt example toml:
[dependencies]
structopt = "0.3.26"
tokio = { version = "1.26", features = ["rt-multi-thread", "macros", "time"] }
sp-keyring = "20.0.0"
sp-core = { version = "18.0.0", default-features = false }
sp-runtime = "20.0.0"
futures = "0.3.27"
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] }
hex = "0.4.3"
tracing-subscriber = "0.3.11"
subxt = "0.27.1"