substrate_stellar_sdk/xdr/impls/
signer_key.rs1use crate::{IntoHash, IntoPublicKey, SignerKey, StellarSdkError};
2
3impl SignerKey {
4 pub fn from_ed25519_public_key<T: IntoPublicKey>(public_key: T) -> Result<Self, StellarSdkError> {
5 let public_key = public_key.into_public_key()?.into_binary();
6 Ok(Self::SignerKeyTypeEd25519(public_key))
7 }
8
9 pub fn from_pre_auth_tx<T: IntoHash>(hash: T) -> Result<Self, StellarSdkError> {
10 Ok(Self::SignerKeyTypePreAuthTx(hash.into_hash()?))
11 }
12
13 pub fn from_hash_x<T: IntoHash>(hash: T) -> Result<Self, StellarSdkError> {
14 Ok(Self::SignerKeyTypeHashX(hash.into_hash()?))
15 }
16}