Crates.io | crw-types |
lib.rs | crw-types |
version | 0.1.0 |
source | src |
created_at | 2021-03-24 16:56:31.617137 |
updated_at | 2021-03-24 16:56:31.617137 |
description | Collection of types used by cosmos-rust-wallet packages and modules |
homepage | |
repository | https://github.com/forbole/cosmos-rust-wallet |
max_upload_size | |
id | 372980 |
size | 4,169 |
The types package contains all the common types used by modules
and packages
.
Message type is the representation of a transaction's message already encoded from protobuf.
It's a wrapper of the Any
types and can be converted from and to it.
pub struct Msg(pub Any);
/// From protobuf definition
pub struct Any {
pub type_url: String,
pub value: Vec<u8>,
}
fn example() {
let proto_msg = Msg(Any {
type_url: "/cosmos.bank.v1beta1.Msg/Send".to_string(),
value: msg_bytes,
});
}
Error is the representation of any kind of error that could happen during the execution of wallet's operations.
Any function that return a Result<T,E>
can return an error to the above function as follow:
fn example() {
let mnemonic = Mnemonic::from_phrase(mnemonic_words, Language::English)
.map_err(|err| Error::Mnemonic(err.to_string()))?;
}