Skip to content

Commit

Permalink
test-wallet: fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Daksh14 committed Sep 9, 2024
1 parent a60cbff commit c0e8a79
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 114 deletions.
66 changes: 0 additions & 66 deletions rusk-wallet/src/bin/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,25 +145,6 @@ pub(crate) enum Command {
gas_price: Lux,
},

/// Start staking DUSK through moonlight
MoonlightStake {
/// Bls Address from which to stake DUSK [default: first address]
#[clap(short = 's', long)]
addr: Option<Address>,

/// Amount of DUSK to stake
#[clap(short, long)]
amt: Dusk,

/// Max amt of gas for this transaction
#[clap(short = 'l', long, default_value_t= DEFAULT_STAKE_GAS_LIMIT)]
gas_limit: u64,

/// Price you're going to pay for each gas unit (in LUX)
#[clap(short = 'p', long, default_value_t= DEFAULT_PRICE)]
gas_price: Lux,
},

/// Check your stake information
StakeInfo {
/// Address used to stake [default: first address]
Expand Down Expand Up @@ -191,22 +172,6 @@ pub(crate) enum Command {
gas_price: Lux,
},

/// Moonlight Unstake a key's stake
MoonlightUnstake {
/// Bls Address from which your DUSK was staked [default: first
/// address]
#[clap(short, long)]
addr: Option<Address>,

/// Max amt of gas for this transaction
#[clap(short = 'l', long, default_value_t= DEFAULT_STAKE_GAS_LIMIT)]
gas_limit: u64,

/// Price you're going to pay for each gas unit (in LUX)
#[clap(short = 'p', long, default_value_t= DEFAULT_PRICE)]
gas_price: Lux,
},

/// Phoenix Withdraw accumulated reward for a stake key
PhoenixWithdraw {
/// Phoenix Address from which your DUSK was staked [default: first
Expand Down Expand Up @@ -346,23 +311,6 @@ impl Command {
let tx = wallet.phoenix_stake(addr, amt, gas).await?;
Ok(RunResult::Tx(tx.hash()))
}
Command::MoonlightStake {
addr,
amt,
gas_limit,
gas_price,
} => {
let addr = match addr {
Some(addr) => wallet.claim_as_address(addr)?,
None => wallet.default_address(),
};

let gas = Gas::new(gas_limit).with_price(gas_price);

let tx = wallet.moonlight_stake(addr, amt, gas)?;

Ok(RunResult::Tx(tx.hash()))
}
Command::StakeInfo { addr, reward } => {
let addr = match addr {
Some(addr) => wallet.claim_as_address(addr)?,
Expand Down Expand Up @@ -391,20 +339,6 @@ impl Command {
let tx = wallet.phoenix_unstake(addr, gas).await?;
Ok(RunResult::Tx(tx.hash()))
}
Command::MoonlightUnstake {
addr,
gas_limit,
gas_price,
} => {
let addr = match addr {
Some(addr) => wallet.claim_as_address(addr)?,
None => wallet.default_address(),
};
let gas = Gas::new(gas_limit).with_price(gas_price);
let tx = wallet.moonlight_unstake(addr, gas).await?;

Ok(RunResult::Tx(tx.hash()))
}
Command::PhoenixWithdraw {
addr,
gas_limit,
Expand Down
43 changes: 0 additions & 43 deletions rusk-wallet/src/bin/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,8 @@ enum CommandMenuItem {
PhoenixTransfer,
MoonlightTransfer,
PhoenixStake,
MoonlightStake,
StakeInfo,
PhoenixUnstake,
MoonlightUnstake,
PhoenixWithdraw,
Export,
Back,
Expand All @@ -233,10 +231,8 @@ fn menu_op(
.add(CMI::PhoenixTransfer, "Phoenix Transfer Dusk")
.add(CMI::MoonlightTransfer, "Moonlight Transfer Dusk")
.add(CMI::PhoenixStake, "Phoenix Stake Dusk")
.add(CMI::MoonlightStake, "Moonlight Stake Dusk")
.add(CMI::StakeInfo, "Check existing stake")
.add(CMI::PhoenixUnstake, "Phoenix Unstake Dusk")
.add(CMI::MoonlightUnstake, "Moonlight Unstake Dusk")
.add(CMI::PhoenixWithdraw, "Phoenix Withdraw staking reward")
.add(CMI::Export, "Export provisioner key-pair")
.separator()
Expand Down Expand Up @@ -278,12 +274,6 @@ fn menu_op(
gas_limit: prompt::request_gas_limit(DEFAULT_STAKE_GAS_LIMIT)?,
gas_price: prompt::request_gas_price()?,
})),
CMI::MoonlightStake => AddrOp::Run(Box::new(Command::MoonlightStake {
addr: Some(addr),
amt: prompt::request_token_amt("stake", balance)?,
gas_limit: prompt::request_gas_limit(DEFAULT_STAKE_GAS_LIMIT)?,
gas_price: prompt::request_gas_price()?,
})),
CMI::StakeInfo => AddrOp::Run(Box::new(Command::StakeInfo {
addr: Some(addr),
reward: false,
Expand All @@ -293,13 +283,6 @@ fn menu_op(
gas_limit: prompt::request_gas_limit(DEFAULT_STAKE_GAS_LIMIT)?,
gas_price: prompt::request_gas_price()?,
})),
CMI::MoonlightUnstake => {
AddrOp::Run(Box::new(Command::MoonlightUnstake {
addr: Some(addr),
gas_limit: prompt::request_gas_limit(DEFAULT_STAKE_GAS_LIMIT)?,
gas_price: prompt::request_gas_price()?,
}))
}
CMI::PhoenixWithdraw => {
AddrOp::Run(Box::new(Command::PhoenixWithdraw {
addr: Some(addr),
Expand Down Expand Up @@ -518,20 +501,6 @@ fn confirm(cmd: &Command) -> anyhow::Result<bool> {
println!(" > Max fee = {} DUSK", Dusk::from(max_fee));
prompt::ask_confirm()
}
Command::MoonlightStake {
addr,
amt,
gas_limit,
gas_price,
} => {
let addr = addr.as_ref().expect("address to be valid");
let max_fee = gas_limit * gas_price;
println!(" > Stake from {}", addr.preview());
println!(" > Amount to stake = {} DUSK", amt);
println!(" > Max fee = {} DUSK", Dusk::from(max_fee));
println!(" > ALERT: THIS IS A PUBLIC TRANSACTION");
prompt::ask_confirm()
}
Command::PhoenixUnstake {
addr,
gas_limit,
Expand All @@ -543,18 +512,6 @@ fn confirm(cmd: &Command) -> anyhow::Result<bool> {
println!(" > Max fee = {} DUSK", Dusk::from(max_fee));
prompt::ask_confirm()
}
Command::MoonlightUnstake {
addr,
gas_limit,
gas_price,
} => {
let addr = addr.as_ref().expect("address to be valid");
let max_fee = gas_limit * gas_price;
println!(" > Unstake from {}", addr.preview());
println!(" > Max fee = {} DUSK", Dusk::from(max_fee));
println!(" > ALERT: THIS IS A PUBLIC TRANSACTION");
prompt::ask_confirm()
}
Command::PhoenixWithdraw {
addr,
gas_limit,
Expand Down
5 changes: 2 additions & 3 deletions test-wallet/src/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ use execution_core::{
use rusk_prover::LocalProver;
use wallet_core::{
keys::{derive_bls_sk, derive_phoenix_sk},
phoenix_balance,
transaction::{
phoenix::{
phoenix as phoenix_transaction, phoenix_stake, phoenix_stake_reward,
phoenix_unstake,
},
BalanceInfo,
phoenix_balance, BalanceInfo,
};

const MAX_INPUT_NOTES: usize = 4;
Expand Down
3 changes: 1 addition & 2 deletions wallet-core/src/phoenix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ use ff::Field;
use zeroize::Zeroize;

use execution_core::{
signatures::bls::{PublicKey as BlsPublicKey, SecretKey as BlsSecretKey},
signatures::bls::SecretKey as BlsSecretKey,
stake::{Stake, Withdraw as StakeWithdraw, STAKE_CONTRACT},
transfer::{
data::{ContractCall, TransactionData},
moonlight::Transaction as MoonlightTransaction,
phoenix::{
Note, NoteOpening, Prove, PublicKey as PhoenixPublicKey,
SecretKey as PhoenixSecretKey, Transaction as PhoenixTransaction,
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit c0e8a79

Please sign in to comment.