Skip to content

Commit

Permalink
Fixes compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
grarco committed Jul 5, 2023
1 parent 9866b2d commit fcd3c27
Show file tree
Hide file tree
Showing 31 changed files with 1,515 additions and 1,268 deletions.
60 changes: 25 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 11 additions & 24 deletions apps/src/bin/namada-client/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ pub async fn main() -> Result<()> {
.unwrap();
let args = args.to_sdk(&mut ctx);
let dry_run = args.tx.dry_run;
tx::submit_custom::<HttpClient>(&client, &mut ctx, args)
.await?;
tx::submit_custom(&client, &mut ctx, args).await?;
if !dry_run {
namada_apps::wallet::save(&ctx.wallet)
.unwrap_or_else(|err| eprintln!("{}", err));
Expand All @@ -52,17 +51,15 @@ pub async fn main() -> Result<()> {
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_ibc_transfer::<HttpClient>(&client, ctx, args)
.await?;
tx::submit_ibc_transfer(&client, ctx, args).await?;
}
Sub::TxUpdateVp(TxUpdateVp(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
let client =
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_update_vp::<HttpClient>(&client, &mut ctx, args)
.await?;
tx::submit_update_vp(&client, &mut ctx, args).await?;
}
Sub::TxInitAccount(TxInitAccount(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
Expand All @@ -71,10 +68,7 @@ pub async fn main() -> Result<()> {
.unwrap();
let args = args.to_sdk(&mut ctx);
let dry_run = args.tx.dry_run;
tx::submit_init_account::<HttpClient>(
&client, &mut ctx, args,
)
.await?;
tx::submit_init_account(&client, &mut ctx, args).await?;
if !dry_run {
namada_apps::wallet::save(&ctx.wallet)
.unwrap_or_else(|err| eprintln!("{}", err));
Expand All @@ -91,62 +85,55 @@ pub async fn main() -> Result<()> {
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_init_validator::<HttpClient>(&client, ctx, args)
.await;
tx::submit_init_validator(&client, ctx, args).await;
}
Sub::TxInitProposal(TxInitProposal(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
let client =
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_init_proposal::<HttpClient>(&client, ctx, args)
.await?;
tx::submit_init_proposal(&client, ctx, args).await?;
}
Sub::TxVoteProposal(TxVoteProposal(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
let client =
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_vote_proposal::<HttpClient>(&client, ctx, args)
.await?;
tx::submit_vote_proposal(&client, ctx, args).await?;
}
Sub::TxRevealPk(TxRevealPk(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
let client =
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_reveal_pk::<HttpClient>(&client, &mut ctx, args)
.await?;
tx::submit_reveal_pk(&client, &mut ctx, args).await?;
}
Sub::Bond(Bond(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
let client =
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_bond::<HttpClient>(&client, &mut ctx, args)
.await?;
tx::submit_bond(&client, &mut ctx, args).await?;
}
Sub::Unbond(Unbond(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
let client =
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_unbond::<HttpClient>(&client, &mut ctx, args)
.await?;
tx::submit_unbond(&client, &mut ctx, args).await?;
}
Sub::Withdraw(Withdraw(args)) => {
wait_until_node_is_synched(&args.tx.ledger_address).await;
let client =
HttpClient::new(args.tx.ledger_address.clone())
.unwrap();
let args = args.to_sdk(&mut ctx);
tx::submit_withdraw::<HttpClient>(&client, ctx, args)
.await?;
tx::submit_withdraw(&client, ctx, args).await?;
}
// Ledger queries
Sub::QueryEpoch(QueryEpoch(args)) => {
Expand Down
13 changes: 8 additions & 5 deletions apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,7 @@ pub mod args {
use namada::types::storage::{self, BlockHeight, Epoch};
use namada::types::time::DateTimeUtc;
use namada::types::token;
use namada::types::transaction::GasLimit;
use rust_decimal::Decimal;

use super::context::*;
Expand Down Expand Up @@ -1835,13 +1836,13 @@ pub mod args {
pub const DUMP_TX: ArgFlag = flag("dump-tx");
pub const EPOCH: ArgOpt<Epoch> = arg_opt("epoch");
pub const EXPIRATION_OPT: ArgOpt<DateTimeUtc> = arg_opt("expiration");
pub const FEE_UNSHIELD_SPENDING_KEY: ArgOpt<ExtendedSpendingKey> =
pub const FEE_UNSHIELD_SPENDING_KEY: ArgOpt<WalletTransferSource> =
arg_opt("fee-spending-key");
pub const FORCE: ArgFlag = flag("force");
pub const DONT_PREFETCH_WASM: ArgFlag = flag("dont-prefetch-wasm");
pub const FEE_AMOUNT: ArgOpt<token::Amount> = arg_opt("fee-amount");
pub const GAS_LIMIT: ArgDefault<token::Amount> =
arg_default("gas-limit", DefaultFn(|| token::Amount::from(0)));
pub const GAS_LIMIT: ArgDefault<GasLimit> =
arg_default("gas-limit", DefaultFn(|| GasLimit::from(1_000_000)));
pub const FEE_TOKEN: ArgDefaultFromCtx<WalletAddress> =
arg_default_from_ctx("fee-token", DefaultFn(|| "NAM".into()));
pub const GENESIS_PATH: Arg<PathBuf> = arg("genesis-path");
Expand Down Expand Up @@ -3299,7 +3300,9 @@ pub mod args {
wallet_alias_force: self.wallet_alias_force,
fee_amount: self.fee_amount,
fee_token: ctx.get(&self.fee_token),
fee_unshield, self.fee_unshield,
fee_unshield: self
.fee_unshield
.map(|ref fee_unshield| ctx.get_cached(fee_unshield)),
gas_limit: self.gas_limit,
signing_key: self.signing_key.map(|x| ctx.get_cached(&x)),
signer: self.signer.map(|x| ctx.get(&x)),
Expand Down Expand Up @@ -3353,10 +3356,10 @@ pub mod args {
.arg(GAS_LIMIT.def().about(
"The multiplier of the gas limit resolution defining the \
maximum amount of gas needed to run transaction.",
))
.arg(WALLET_ALIAS_FORCE.def().about(
"Override the alias without confirmation if it already exists.",
))
))
.arg(EXPIRATION_OPT.def().about(
"The expiration datetime of the transaction, after which the \
tx won't be accepted anymore. All of these examples are \
Expand Down
8 changes: 5 additions & 3 deletions apps/src/lib/cli/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use namada::types::masp::*;

use super::args;
use crate::client::tx::CLIShieldedUtils;
use crate::config::genesis::genesis_config;
use crate::config::genesis;
use crate::config::global::GlobalConfig;
use crate::config::{self, Config};
use crate::wallet::CliWalletUtils;
Expand Down Expand Up @@ -96,6 +96,7 @@ impl Context {
.base_dir
.join(global_config.default_chain_id.as_str());

//FIXME: need this block?
#[cfg(not(feature = "dev"))]
let genesis = genesis::genesis(
&global_args.base_dir,
Expand All @@ -111,8 +112,9 @@ impl Context {
"{}.toml",
global_config.default_chain_id.as_str()
));
let default_genesis =
genesis_config::open_genesis_config(genesis_file_path)?;
let default_genesis = genesis::genesis_config::open_genesis_config(
genesis_file_path,
)?;
crate::wallet::load_or_new_from_genesis(&chain_dir, default_genesis)
};
#[cfg(feature = "dev")]
Expand Down
Loading

0 comments on commit fcd3c27

Please sign in to comment.