style: style
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
use clap::{ArgMatches, App};
|
use clap::{ArgMatches, App};
|
||||||
use rust_util::XResult;
|
use rust_util::XResult;
|
||||||
pub type CommandError = XResult<()>;
|
pub type CommandError = XResult<()>;
|
||||||
|
|
||||||
pub trait Command {
|
pub trait Command {
|
||||||
fn name(&self) -> &str;
|
fn name(&self) -> &str;
|
||||||
fn subcommand<'a>(&self) -> App<'a, 'a>;
|
fn subcommand<'a>(&self) -> App<'a, 'a>;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||||
use rust_util::information;
|
use crate::cmd::{Command, CommandError};
|
||||||
use crate::{cmd::{Command, CommandError}, engine_credit::CreditContractCreateParameters};
|
|
||||||
use crate::engine::ContractEngine;
|
|
||||||
use crate::tx::{Transaction, TransactionBody};
|
|
||||||
use crate::util::JsonKeyPair;
|
use crate::util::JsonKeyPair;
|
||||||
|
use crate::tx::{Transaction, TransactionBody};
|
||||||
|
use crate::engine::ContractEngine;
|
||||||
|
use crate::engine_plugin_credit::CreditContractCreateParameters;
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
impl Command for CommandImpl {
|
impl Command for CommandImpl {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||||
use rust_util::information;
|
use crate::cmd::{Command, CommandError};
|
||||||
use crate::{cmd::{Command, CommandError}, engine_credit::CreditContractIssueParameters};
|
|
||||||
use crate::engine::ContractEngine;
|
|
||||||
use crate::tx::{Transaction, TransactionBody};
|
|
||||||
use crate::util::JsonKeyPair;
|
use crate::util::JsonKeyPair;
|
||||||
|
use crate::tx::{Transaction, TransactionBody};
|
||||||
|
use crate::engine::ContractEngine;
|
||||||
|
use crate::engine_plugin_credit::CreditContractIssueParameters;
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
impl Command for CommandImpl {
|
impl Command for CommandImpl {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||||
use rust_util::information;
|
use crate::cmd::{Command, CommandError};
|
||||||
use crate::{cmd::{Command, CommandError}, engine_credit::CreditContractQueryParameters};
|
|
||||||
use crate::engine::ContractEngine;
|
|
||||||
use crate::tx::{Transaction, TransactionBody};
|
|
||||||
use crate::util::JsonKeyPair;
|
use crate::util::JsonKeyPair;
|
||||||
|
use crate::tx::{Transaction, TransactionBody};
|
||||||
|
use crate::engine::ContractEngine;
|
||||||
|
use crate::engine_plugin_credit::CreditContractQueryParameters;
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
impl Command for CommandImpl {
|
impl Command for CommandImpl {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||||
use rust_util::information;
|
use crate::cmd::{Command, CommandError};
|
||||||
use crate::{cmd::{Command, CommandError}, engine_credit::CreditContractQueryAllParameters};
|
|
||||||
use crate::engine::ContractEngine;
|
|
||||||
use crate::tx::{Transaction, TransactionBody};
|
|
||||||
use crate::util::JsonKeyPair;
|
use crate::util::JsonKeyPair;
|
||||||
|
use crate::tx::{Transaction, TransactionBody};
|
||||||
|
use crate::engine::ContractEngine;
|
||||||
|
use crate::engine_plugin_credit::CreditContractQueryAllParameters;
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
impl Command for CommandImpl {
|
impl Command for CommandImpl {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||||
use rust_util::information;
|
use crate::cmd::{Command, CommandError};
|
||||||
use crate::{cmd::{Command, CommandError}, engine_credit::CreditContractTransferParameters};
|
|
||||||
use crate::engine::ContractEngine;
|
|
||||||
use crate::tx::{Transaction, TransactionBody};
|
|
||||||
use crate::util::JsonKeyPair;
|
use crate::util::JsonKeyPair;
|
||||||
|
use crate::tx::{Transaction, TransactionBody};
|
||||||
|
use crate::engine::ContractEngine;
|
||||||
|
use crate::engine_plugin_credit::CreditContractTransferParameters;
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
impl Command for CommandImpl {
|
impl Command for CommandImpl {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use clap::{App, Arg, ArgMatches};
|
use clap::{App, Arg, ArgMatches};
|
||||||
use rust_util::information;
|
|
||||||
use crate::cmd::CommandError;
|
use crate::cmd::CommandError;
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
impl CommandImpl {
|
impl CommandImpl {
|
||||||
pub fn process_command<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
pub fn process_command<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||||
use rust_util::failure;
|
use crate::cmd::{Command, CommandError};
|
||||||
use crate::{cmd::{Command, CommandError}, util::{JsonKeyPair, make_key_pair}};
|
use crate::util::{JsonKeyPair, make_key_pair};
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
impl Command for CommandImpl {
|
impl Command for CommandImpl {
|
||||||
fn name(&self) -> &str { "genkey" }
|
fn name(&self) -> &str { "genkey" }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use std::{collections::HashMap, fs, fs::File};
|
use std::{collections::HashMap, fs, fs::File};
|
||||||
use rust_util::{XResult, information, simple_error};
|
use rust_util::XResult;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use crate::tx::Transaction;
|
use crate::tx::Transaction;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use rust_util::{XResult, simple_error};
|
use rust_util::XResult;
|
||||||
use crate::{engine_credit::ContractEngineCredit, tx::Transaction};
|
use crate::tx::Transaction;
|
||||||
|
use crate::engine_plugin_credit::ContractEngineCredit;
|
||||||
|
|
||||||
pub struct ContractEngine {
|
pub struct ContractEngine {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use rust_util::{XResult, debugging, information, simple_error};
|
use rust_util::XResult;
|
||||||
use crate::{credit::CreditContract, tx::{Transaction, TransactionBody}};
|
use crate::credit::CreditContract;
|
||||||
|
use crate::tx::{Transaction, TransactionBody};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct CreditContractCreateParameters {
|
pub struct CreditContractCreateParameters {
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
|
#[macro_use] extern crate rust_util;
|
||||||
|
|
||||||
pub mod util;
|
pub mod util;
|
||||||
pub mod tx;
|
pub mod tx;
|
||||||
pub mod credit;
|
pub mod credit;
|
||||||
pub mod engine;
|
pub mod engine;
|
||||||
pub mod engine_credit;
|
pub mod engine_plugin_credit;
|
||||||
|
|
||||||
mod cmd;
|
mod cmd;
|
||||||
mod cmd_default;
|
mod cmd_default;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use rust_util::{XResult, simple_error};
|
use std::str::FromStr;
|
||||||
|
use rust_util::XResult;
|
||||||
use secp256k1::{Message, PublicKey, Secp256k1, SecretKey, Signature};
|
use secp256k1::{Message, PublicKey, Secp256k1, SecretKey, Signature};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use std::str::FromStr;
|
|
||||||
use crate::util::{calc_sha256, make_btc_address};
|
use crate::util::{calc_sha256, make_btc_address};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
@@ -61,4 +61,4 @@ impl Transaction {
|
|||||||
fn get_body_message(body: &str) -> XResult<Message> {
|
fn get_body_message(body: &str) -> XResult<Message> {
|
||||||
let digest= calc_sha256(body.as_bytes());
|
let digest= calc_sha256(body.as_bytes());
|
||||||
Message::from_slice(&digest).map_err(|e| e.into())
|
Message::from_slice(&digest).map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user