first commit

This commit is contained in:
mfahampshire
2023-07-03 15:50:22 +00:00
parent 4b13a5cf61
commit a519658432
4 changed files with 80 additions and 0 deletions
+1
View File
@@ -73,6 +73,7 @@ members = [
"common/topology",
"common/types",
"common/wasm-utils",
"demos/rust-cosmos-broadcaster-client",
"explorer-api",
"gateway",
"gateway/gateway-requests",
@@ -0,0 +1,21 @@
[package]
name = "rust-cosmos-broadcaster-client"
version = "0.1.0"
authors.workspace = true
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "4.0", features = ["derive"] }
nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] }
nym-network-defaults = { path = "../../common/network-defaults" }
async-trait = { workspace = true, optional = true }
bip39 = { workspace = true, features = ["rand"], optional = true }
cosmrs = { git = "https://github.com/neacsu/cosmos-rust", branch = "neacsu/feegrant_support", features = ["rpc", "bip32", "cosmwasm"], optional = true }
[dev-dependencies]
bip39 = { workspace = true }
cosmrs = { git = "https://github.com/neacsu/cosmos-rust", branch = "neacsu/feegrant_support", features = ["rpc", "bip32"] }
tokio = { version = "1.24.1", features = ["rt-multi-thread", "macros"] }
ts-rs = "6.1.2"
@@ -0,0 +1,13 @@
Plan:
* rewrite ts cosmos broadcaster SP in rust
* create simple rust binary for client cli use with 2 functions:
* use standard CLI method - cf. NymCLI
* getSequence() for offline signing
* submitTx() for sending tx thru mixnet to SP for broadcasting
* rust server code - communicates with chain
* sdk
* nym validator client - broadcast client, gets sequence + submits tx
* rust client code - communicates with server via mixnet
* sdk
* nym validator client - offline signer
@@ -0,0 +1,45 @@
use clap::{CommandFactory, Parser, Subcommand, Args};
use nym_validator_client::nyxd::CosmWasmClient;
use nym_validator_client::signing::direct_wallet::DirectSecp256k1HdWallet;
use nym_validator_client::signing::tx_signer::TxSigner;
use nym_validator_client::signing::SignerData;
/* use cosmrs::bank::MsgSend;
use cosmrs::rpc::{self, HttpClient};
use cosmrs::tx::Msg;
use cosmrs::{tx, AccountId, Coin, Denom};
*/
#[derive(Debug, Parser)]
#[clap(name = "cosmos tx broadcaster ")]
#[clap(about = "binary which accepts pre-signed txs from the mixnet and broadcasts them to a cosmos sdk chain ")]
struct Cli {
#[clap(subcommand)]
command: Option<Commands>,
}
#[derive(Debug, Subcommand)]
enum Commands {
/// Reverses a string
Reverse(Reverse),
/// Inspects a string
Inspect(Inspect),
}
#[derive(Debug, Args)]
struct Reverse {
/// The string to reverse
string: Option<String>,
}
#[derive(Debug, Args)]
struct Inspect {
/// The string to inspect
string: Option<String>,
#[arg(short = 'd', long = "digits")]
only_digits: bool,
}
fn main() {
println!("Hello, world!");
}