-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: aeryz <abdullaheryz@protonmail.com>
- Loading branch information
Showing
6 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "ucli" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
ethers = { workspace = true, features = ["rustls", "ws"] } | ||
clap = { version = "4.3.0", features = ["derive", "env", "error-context"] } | ||
serde_json = "1.0.96" | ||
serde = { version = "1.0.173", features = ["derive"] } | ||
hex = { version = "0.4.3", features = [ "serde" ] } | ||
|
||
unionlabs = { workspace = true, features = ["ethabi"] } | ||
contracts.workspace = true | ||
chain-utils.workspace = true | ||
tendermint-rpc = { workspace = true, features = ["http-client", "websocket-client"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
use std::{collections::BTreeMap, ffi::OsString, str::FromStr}; | ||
|
||
use chain_utils::private_key::PrivateKey; | ||
use clap::{ | ||
error::{ContextKind, ContextValue}, | ||
Args, Parser, Subcommand, | ||
}; | ||
use ethers::{ | ||
prelude::k256::ecdsa, | ||
signers::LocalWallet, | ||
types::{Address, H256}, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
use tendermint_rpc::WebSocketClientUrl; | ||
|
||
#[derive(Debug, Parser)] | ||
#[command(arg_required_else_help = true)] | ||
pub struct AppArgs { | ||
#[arg( | ||
long, | ||
short = 'c', | ||
env, | ||
global = true, | ||
default_value = "~/.config/ucli/config.json" | ||
)] | ||
pub config_file_path: OsString, | ||
#[command(subcommand)] | ||
pub command: Command, | ||
} | ||
|
||
#[derive(Debug, Subcommand)] | ||
pub enum Command { | ||
#[command(subcommand)] | ||
Tx(TxCmd), | ||
} | ||
|
||
#[derive(Debug, Subcommand)] | ||
pub enum TxCmd { | ||
#[command(subcommand)] | ||
Evm(EvmTx), | ||
} | ||
|
||
#[derive(Debug, Subcommand)] | ||
pub enum EvmTx { | ||
Transfer { | ||
#[arg(long)] | ||
on: String, | ||
#[arg(long)] | ||
relay_address: Address, | ||
// #[arg(long)] | ||
// from: Address, | ||
// #[arg(long)] | ||
// to: String, | ||
#[arg(long)] | ||
port_id: String, | ||
#[arg(long)] | ||
channel_id: String, | ||
#[arg(long)] | ||
receiver: String, | ||
#[arg(long)] | ||
amount: u64, | ||
#[arg(long)] | ||
denom: String, | ||
}, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[serde(bound(serialize = "", deserialize = ""))] | ||
pub struct Config { | ||
/// Map of chain name to it's respective config. | ||
pub chain: BTreeMap<String, ChainConfig>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[serde(rename_all = "snake_case", tag = "chain_type")] | ||
pub enum ChainConfig { | ||
Evm(EvmChainConfig), | ||
Union(UnionChainConfig), | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct EvmChainConfig { | ||
/// The address of the `IBCHandler` smart contract. | ||
pub ibc_handler_address: Address, | ||
|
||
/// The signer that will be used to submit transactions by voyager. | ||
pub signers: Vec<PrivateKey<ecdsa::SigningKey>>, | ||
|
||
// TODO(benluelo): Use `Url` or something similar | ||
/// The RPC endpoint for the execution chain. | ||
pub eth_rpc_api: String, | ||
/// The RPC endpoint for the beacon chain. | ||
pub eth_beacon_rpc_api: String, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct UnionChainConfig { | ||
pub signers: Vec<PrivateKey<ecdsa::SigningKey>>, | ||
pub fee_denom: String, | ||
pub ws_url: WebSocketClientUrl, | ||
pub prover_endpoint: String, | ||
pub grpc_url: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mod cli; | ||
|
||
fn main() { | ||
println!("Hello, world!"); | ||
} |