feat: use rust_util
This commit is contained in:
@@ -1,32 +1,11 @@
|
||||
use rand::rngs::OsRng;
|
||||
use rust_util::XResult;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use secp256k1::{Secp256k1, SecretKey, key::PublicKey};
|
||||
use sha2::Sha256;
|
||||
use ripemd160::Ripemd160;
|
||||
use digest::{ Input, FixedOutput };
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
use std::error::Error;
|
||||
|
||||
pub type XResult<T> = Result<T, Box<dyn Error>>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SimpleError {
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
impl SimpleError {
|
||||
pub fn new(message: String) -> Self {
|
||||
Self { message }
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for SimpleError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "SimpleErorr, message: {}", self.message)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for SimpleError {}
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
Reference in New Issue
Block a user