【问题标题】:How can I get a `PairSigner` for my Polkadot account from a Rust client using substrate-subxt?如何使用 subxt 从 Rust 客户端为我的 Polkadot 帐户获取“PairSigner”?
【发布时间】:2021-07-14 04:50:59
【问题描述】:

我有一个 Rust CLI,我使用此代码 https://github.com/paritytech/substrate-subxt/blob/master/examples/submit_and_watch.rs 将余额从一个帐户转移到另一个帐户。

PairSigner 是用let signer = PairSigner::new(AccountKeyring::Alice.pair()); 生成的。我如何使用我的个人 Polkadot 钱包帐户来签署交易,而不是使用 Alic 的这个测试钥匙串?

【问题讨论】:

    标签: substrate rust-ink


    【解决方案1】:

    使用sp-core,可以使用Phase::from_phrase 来完成此操作。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-19
      • 2020-05-22
      • 1970-01-01
      • 2021-04-26
      • 2017-10-24
      • 2013-11-28
      • 2017-03-10
      • 2019-04-03
      相关资源
      最近更新 更多