substrate-stellar-sdk 0.3.0

A Substrate compatible SDK for Stellar
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{IntoHash, IntoPublicKey, SignerKey, StellarSdkError};

impl SignerKey {
    pub fn from_ed25519_public_key<T: IntoPublicKey>(public_key: T) -> Result<Self, StellarSdkError> {
        let public_key = public_key.into_public_key()?.into_binary();
        Ok(Self::SignerKeyTypeEd25519(public_key))
    }

    pub fn from_pre_auth_tx<T: IntoHash>(hash: T) -> Result<Self, StellarSdkError> {
        Ok(Self::SignerKeyTypePreAuthTx(hash.into_hash()?))
    }

    pub fn from_hash_x<T: IntoHash>(hash: T) -> Result<Self, StellarSdkError> {
        Ok(Self::SignerKeyTypeHashX(hash.into_hash()?))
    }
}