Skip to content

Commit

Permalink
Merge pull request #4 from ComposableFi/dz/5
Browse files Browse the repository at this point in the history
feat: so we get block and account. nice.
  • Loading branch information
dzmitry-lahoda authored Nov 19, 2023
2 parents 32f96b4 + 8807176 commit 434dd0e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.env
.ssh/**
.secrets/**
8 changes: 4 additions & 4 deletions devnet.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
(
cd node || exit
clear && cargo run --bin mantis -- --centauri "http://localhost:26657" --osmosis "localhost:36657" --neutron "localhost:46657" --cvm-contract "centauri1" --wallet "mnemonic" --order-contract "centauri1"
)
#clear && cargo run --bin mantis -- --centauri "http://localhost:26657" --osmosis "localhost:36657" --neutron "localhost:46657" --cvm-contract "centauri1" --wallet "mnemonic" --order-contract "centauri1"


RUST_TRACE=trace cargo run --bin mantis -- --rpc-centauri "https://composable-rpc.polkachu.com:443" --grpc-centauri "https://composable-grpc.polkachu.com:22290" --osmosis "todo" --neutron "todo" --cvm-contract "centauri1wpf2szs4uazej8pe7g8vlck34u24cvxx7ys0esfq6tuw8yxygzuqpjsn0d" --wallet "$WALLET" --order-contract "centauri1lnyecncq9akyk8nk0qlppgrq6yxktr68483ahryn457x9ap4ty2sthjcyt"
28 changes: 20 additions & 8 deletions mantis/node/src/bin/mantis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,47 @@ use mantis_node::{
#[tokio::main]
async fn main() {
let args = MantisArgs::parsed();
let wasm_read_client = create_wasm_query_client(&args.centauri).await;
let mut cosmos_query_client = create_cosmos_query_client(&args.centauri).await;
println!("args: {:?}", args);
let wasm_read_client = create_wasm_query_client(&args.rpc_centauri).await;

let signer = mantis_node::mantis::beaker::cli::support::signer::from_mnemonic(
args.wallet.as_str(),
"centauri",
"m/44'/118'/0'/0/0",
)
.expect("mnemonic");

let mut write_client = create_wasm_write_client(&args.centauri).await;
loop {
let acc = query_cosmos_account(
&args.centauri,
let rpc_client: cosmrs::rpc::HttpClient =
cosmrs::rpc::HttpClient::new(args.rpc_centauri.as_ref()).unwrap();
let status = rpc_client.status().await.expect("status").sync_info;
println!("status: {:?}", status);

let account = query_cosmos_account(
&args.grpc_centauri,
signer
.public_key()
.account_id("centauri")
.expect("key")
.to_string(),
)
.await;
println!("account: {:?}", account);

let mut cosmos_query_client = create_cosmos_query_client(&args.rpc_centauri).await;
print!("client 1");
let mut write_client = create_wasm_write_client(&args.rpc_centauri).await;
print!("client 2");

println!("acc: {:?}", account);
if let Some(assets) = args.simulate.clone() {
simulate_order(
&mut write_client,
&mut cosmos_query_client,
args.order_contract.clone(),
assets,
&signer,
acc,
&args.centauri,
account,
&args.rpc_centauri,
)
.await;
};
Expand Down
8 changes: 6 additions & 2 deletions mantis/node/src/mantis/args.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#[derive(clap::Parser)]
#[derive(clap::Parser, Debug)]
pub struct MantisArgs {
/// the node hosting order contract
#[arg(long)]
pub centauri: String,
pub rpc_centauri: String,

#[arg(long)]
pub grpc_centauri: String,

/// the node with pools
#[arg(long)]
pub osmosis: String,
Expand Down
1 change: 1 addition & 0 deletions mantis/node/src/mantis/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub type CosmosQueryClient =
pub async fn create_cosmos_query_client(rpc: &str) -> CosmosQueryClient {
use cosmos_sdk_proto::cosmos::auth::v1beta1::query_client::*;
use cosmos_sdk_proto::cosmos::auth::v1beta1::*;

let url = tonic::transport::Endpoint::from_str(rpc).expect("url");
QueryClient::connect(url).await.expect("connected")
}
Expand Down

0 comments on commit 434dd0e

Please sign in to comment.