Struct terra_rust_api::PublicKey
source · [−]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
sourceimpl PublicKey
impl PublicKey
sourcepub fn from_bitcoin_public_key(bpub: &PublicKey) -> PublicKey
pub fn from_bitcoin_public_key(bpub: &PublicKey) -> PublicKey
Generate a Cosmos/Tendermint/Terrad Public Key
sourcepub fn from_public_key(bpub: &[u8]) -> PublicKey
pub fn from_public_key(bpub: &[u8]) -> PublicKey
Generate from secp256k1 Cosmos/Terrad Public Key
sourcepub fn from_account(acc_address: &str) -> Result<PublicKey, TerraRustAPIError>
pub fn from_account(acc_address: &str) -> Result<PublicKey, TerraRustAPIError>
Generate a Cosmos/Tendermint/Terrad Account
sourcepub fn from_tendermint_key(
tendermint_public_key: &str
) -> Result<PublicKey, TerraRustAPIError>
pub fn from_tendermint_key(
tendermint_public_key: &str
) -> Result<PublicKey, TerraRustAPIError>
build a public key from a tendermint public key
sourcepub fn from_tendermint_address(
tendermint_hex_address: &str
) -> Result<PublicKey, TerraRustAPIError>
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
sourcepub fn from_operator_address(
valoper_address: &str
) -> Result<PublicKey, TerraRustAPIError>
pub fn from_operator_address(
valoper_address: &str
) -> Result<PublicKey, TerraRustAPIError>
Generate a Operator address for this public key (used by the validator)
sourcepub fn from_raw_address(
raw_address: &str
) -> Result<PublicKey, TerraRustAPIError>
pub fn from_raw_address(
raw_address: &str
) -> Result<PublicKey, TerraRustAPIError>
Generate Public key from raw address
sourcepub fn pubkey_from_public_key(public_key: &[u8]) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn pubkey_from_public_key(public_key: &[u8]) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Gets a bech32-words pubkey from a compressed bytes Secp256K1 public key.
@param publicKey raw public key
sourcepub fn pubkey_from_ed25519_public_key(public_key: &[u8]) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn pubkey_from_ed25519_public_key(public_key: &[u8]) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Gets a bech32-words pubkey from a compressed bytes Ed25519 public key.
@param publicKey raw public key
sourcepub fn public_key_from_pubkey(
pub_key: &[u8]
) -> Result<Vec<u8>, TerraRustAPIError>
pub fn public_key_from_pubkey(
pub_key: &[u8]
) -> Result<Vec<u8>, TerraRustAPIError>
Translate from a BECH32 prefixed key to a standard public key
sourcepub fn address_from_public_key(public_key: &[u8]) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn address_from_public_key(public_key: &[u8]) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Gets a raw address from a compressed bytes public key.
@param publicKey raw public key
sourcepub fn address_from_public_ed25519_key(
public_key: &[u8]
) -> Result<Vec<u8>, TerraRustAPIError>
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
sourcepub fn account(&self) -> Result<String, TerraRustAPIError>
pub fn account(&self) -> Result<String, TerraRustAPIError>
The main account used in most things
sourcepub fn operator_address(&self) -> Result<String, TerraRustAPIError>
pub fn operator_address(&self) -> Result<String, TerraRustAPIError>
The operator address used for validators
sourcepub fn application_public_key(&self) -> Result<String, TerraRustAPIError>
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-
sourcepub fn operator_address_public_key(&self) -> Result<String, TerraRustAPIError>
pub fn operator_address_public_key(&self) -> Result<String, TerraRustAPIError>
The operator address used for validators public key.
sourcepub fn tendermint(&self) -> Result<String, TerraRustAPIError>
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.
sourcepub fn tendermint_pubkey(&self) -> Result<String, TerraRustAPIError>
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
sourceimpl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Serialize for T where
T: Serialize + ?Sized,
impl<T> Serialize for T where
T: Serialize + ?Sized,
pub fn erased_serialize(
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more