Struct PublicKey

Source
pub struct PublicKey {
    pub raw_pub_key: Option<Vec<u8>>,
    pub raw_address: Option<Vec<u8>>,
}
Expand description

The public key we used to generate the cosmos/tendermind/terrad addresses

Fields§

§raw_pub_key: Option<Vec<u8>>

This is optional as we can generate non-pub keys without

§raw_address: Option<Vec<u8>>

The raw bytes used to generate non-pub keys

Implementations§

Source§

impl PublicKey

Source

pub fn from_bitcoin_public_key(bpub: &PublicKey) -> PublicKey

Generate a Cosmos/Tendermint/Terrad Public Key

Source

pub fn from_public_key(bpub: &[u8]) -> PublicKey

Generate from secp256k1 Cosmos/Terrad Public Key

Source

pub fn from_account(acc_address: &str) -> Result<PublicKey, TerraRustAPIError>

Generate a Cosmos/Tendermint/Terrad Account

Source

pub fn from_tendermint_key( tendermint_public_key: &str, ) -> Result<PublicKey, TerraRustAPIError>

build a public key from a tendermint public key

Source

pub fn from_tendermint_address( tendermint_hex_address: &str, ) -> Result<PublicKey, TerraRustAPIError>

build a terravalcons address from a tendermint hex key the tendermint_hex_address should be a hex code of 40 length

Source

pub fn from_operator_address( valoper_address: &str, ) -> Result<PublicKey, TerraRustAPIError>

Generate a Operator address for this public key (used by the validator)

Source

pub fn from_raw_address( raw_address: &str, ) -> Result<PublicKey, TerraRustAPIError>

Generate Public key from raw address

Source

pub fn pubkey_from_public_key(public_key: &[u8]) -> Vec<u8>

Gets a bech32-words pubkey from a compressed bytes Secp256K1 public key.

@param publicKey raw public key

Source

pub fn pubkey_from_ed25519_public_key(public_key: &[u8]) -> Vec<u8>

Gets a bech32-words pubkey from a compressed bytes Ed25519 public key.

@param publicKey raw public key

Source

pub fn public_key_from_pubkey( pub_key: &[u8], ) -> Result<Vec<u8>, TerraRustAPIError>

Translate from a BECH32 prefixed key to a standard public key

Source

pub fn address_from_public_key(public_key: &[u8]) -> Vec<u8>

Gets a raw address from a compressed bytes public key.

@param publicKey raw public key

Source

pub fn address_from_public_ed25519_key( public_key: &[u8], ) -> Result<Vec<u8>, TerraRustAPIError>

Gets a raw address from a ed25519 public key.

@param publicKey raw public key

Source

pub fn account(&self) -> Result<String, TerraRustAPIError>

The main account used in most things

Source

pub fn operator_address(&self) -> Result<String, TerraRustAPIError>

The operator address used for validators

Source

pub fn application_public_key(&self) -> Result<String, TerraRustAPIError>

application public key - Application keys are associated with a public key terrapub- and an address terra-

Source

pub fn operator_address_public_key(&self) -> Result<String, TerraRustAPIError>

The operator address used for validators public key.

Source

pub fn tendermint(&self) -> Result<String, TerraRustAPIError>

This is a unique key used to sign block hashes. It is associated with a public key terravalconspub.

Source

pub fn tendermint_pubkey(&self) -> Result<String, TerraRustAPIError>

This is a unique key used to sign block hashes. It is associated with a public key terravalconspub.

Trait Implementations§

Source§

impl Clone for PublicKey

Source§

fn clone(&self) -> PublicKey

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PublicKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PublicKey

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PublicKey

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,