1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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<types::Error> 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);
- }
- }
|