-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving get_signer function to parentchain-signer crate
- Loading branch information
Showing
3 changed files
with
29 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
pub mod key_store; | ||
mod signer; | ||
pub use signer::TransactionSigner; | ||
|
||
use executor_core::key_store::KeyStore; | ||
use key_store::SubstrateKeyStore; | ||
use log::{error, info}; | ||
use std::sync::Arc; | ||
use subxt_core::utils::AccountId32; | ||
use subxt_signer::sr25519::Keypair; | ||
|
||
pub fn get_signer(key_store: Arc<SubstrateKeyStore>) -> Keypair { | ||
let secret_key_bytes = key_store | ||
.read() | ||
.map_err(|e| { | ||
error!("Could not unseal key: {:?}", e); | ||
}) | ||
.unwrap(); | ||
let signer = subxt_signer::sr25519::Keypair::from_secret_key(secret_key_bytes) | ||
.map_err(|e| { | ||
error!("Could not create secret key: {:?}", e); | ||
}) | ||
.unwrap(); | ||
|
||
info!("Substrate signer address: {}", AccountId32::from(signer.public_key())); | ||
signer | ||
} |