76a61cb3ae
* Import cw3-flex-multisig and cw4-group contracts * Add release_funds to coconut-bandwidth-contract * Create contract.rs file * Add cw multi test and a test that uses it * Use mnemonic for coconut mode too * Stricter access to config file, which contains mnemonic * Update tests * Remove signed deposits dir after merging that into sql db * Clippy nits * More clippy * Remove backtraces features to pass clippy tests * Merge the same mnemonic for rewarding and coconut * Simplify things, letting network monitor use testnet-mode with gateways * Unify the nymd clients * Sqlx common storage for buying/consuming credentials * Link credential storage to credential client * Trigger rewarded_set update on bootstrap error * Fix bug on message signing * Simplify coconut feature in code and set it in validator-api * Update some local consts * Link clients to credential storage * Simplify sql query and change socks5 too * Update attr handling such that public ones are usable * Normalize test addresses * Fix clippy * Merge storages for (non)coconut creds * Fmt miss * Disable wasm client support for now Co-authored-by: durch <durch@users.noreply.github.com>
64 lines
2.1 KiB
Rust
64 lines
2.1 KiB
Rust
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
cfg_if::cfg_if! {
|
|
if #[cfg(feature = "coconut")] {
|
|
|
|
mod client;
|
|
mod commands;
|
|
mod error;
|
|
mod state;
|
|
|
|
use commands::{Commands, Execute};
|
|
use error::Result;
|
|
|
|
use clap::Parser;
|
|
use pickledb::{PickleDb, PickleDbDumpPolicy, SerializationMethod};
|
|
|
|
pub const MNEMONIC: &str = "jazz fatigue diagram account outer wrist slide cherry mother grid network pause wolf pig round answer mail junior better hair dismiss toward access end";
|
|
pub const NYMD_URL: &str = "http://127.0.0.1:26657";
|
|
pub const CONTRACT_ADDRESS: &str = "nymt1nc5tatafv6eyq7llkr2gv50ff9e22mnfp9pc5s";
|
|
pub const SIGNER_AUTHORITIES: [&str; 1] = [
|
|
"http://127.0.0.1:8080",
|
|
];
|
|
|
|
#[derive(Parser)]
|
|
#[clap(author = "Nymtech", version, about)]
|
|
struct Cli {
|
|
#[clap(subcommand)]
|
|
command: Commands,
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
let args = Cli::parse();
|
|
|
|
let shared_storage = credential_storage::initialise_storage(std::path::PathBuf::from("/tmp/credential.db")).await;
|
|
let mut db = match PickleDb::load(
|
|
"credential.db",
|
|
PickleDbDumpPolicy::AutoDump,
|
|
SerializationMethod::Json,
|
|
) {
|
|
Ok(db) => db,
|
|
Err(_) => PickleDb::new(
|
|
"credential.db",
|
|
PickleDbDumpPolicy::AutoDump,
|
|
SerializationMethod::Json,
|
|
),
|
|
};
|
|
|
|
match &args.command {
|
|
Commands::Deposit(m) => m.execute(&mut db, shared_storage).await?,
|
|
Commands::ListDeposits(m) => m.execute(&mut db, shared_storage).await?,
|
|
Commands::GetCredential(m) => m.execute(&mut db, shared_storage).await?,
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
} else {
|
|
fn main() {
|
|
println!("Crate only designed for coconut feature");
|
|
}
|
|
}
|
|
}
|