use prelude::TxExecutionError; pub mod client; pub mod rpc; pub mod types; pub mod prelude { pub use super::types::{ self, crypto::{ED25519PublicKey, ED25519Signature, Keypair}, near::TxExecutionError, }; } #[derive(Debug, thiserror::Error)] pub enum Error { #[error("{0}")] Type(types::Error), #[error("Rpc request failed for {method} with {error}")] Rpc { error: rpc::Error, method: &'static str, }, #[error("Couldn't get a previous block hash")] EmptyBlock, #[error("Couldn't serialize function arguments {0}")] ArgsSerialize(serde_json::Error), #[error("Couldn't deserialize tx response {0}")] DeserializeTxResp(serde_json::Error), #[error("Borsh can't serialize transaction {0}")] TransactionSerialize(std::io::Error), #[error("Execution of transaction failed {0:?}")] TransactionExec(TxExecutionError), #[error("Transaction not started yet")] TxNotStarted, #[error("Rpc:")] NoSigner, } impl From for Error { fn from(err: types::Error) -> Self { Self::Type(err) } } pub fn add(left: usize, right: usize) -> usize { left + right } #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { let result = add(2, 2); assert_eq!(result, 4); } }