Search code examples
substraterust-ink

How can I get a `PairSigner` for my Polkadot account from a Rust client using substrate-subxt?


I have a Rust CLI where I make a balance transfer from one account to another using this code https://github.com/paritytech/substrate-subxt/blob/master/examples/submit_and_watch.rs.

The PairSigner is generated with let signer = PairSigner::new(AccountKeyring::Alice.pair());. Instead of using this test Keychain with Alic, how can I use my personal Polkadot wallet account to sign the transaction?


Solution

  • Using sp-core, one can use Phase::from_phrase to accomplish this.

    let pair = Pair::from_phrase(&"menumonic".to_string(), Some("password"))?;