Skip to content

Commit

Permalink
CLI: Offline-ify remaining stake ops (#8257) (#8259)
Browse files Browse the repository at this point in the history
automerge
  • Loading branch information
mergify[bot] authored Feb 13, 2020
1 parent bbdb412 commit c377d1c
Show file tree
Hide file tree
Showing 3 changed files with 617 additions and 76 deletions.
56 changes: 54 additions & 2 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,19 @@ pub enum CliCommand {
Deploy(String),
// Stake Commands
CreateStakeAccount {
stake_account: KeypairEq,
stake_account: SigningAuthority,
seed: Option<String>,
staker: Option<Pubkey>,
withdrawer: Option<Pubkey>,
lockup: Lockup,
lamports: u64,
sign_only: bool,
signers: Option<Vec<(Pubkey, Signature)>>,
blockhash_query: BlockhashQuery,
nonce_account: Option<Pubkey>,
nonce_authority: Option<SigningAuthority>,
fee_payer: Option<SigningAuthority>,
from: Option<SigningAuthority>,
},
DeactivateStake {
stake_account_pubkey: Pubkey,
Expand Down Expand Up @@ -347,6 +354,12 @@ pub enum CliCommand {
destination_account_pubkey: Pubkey,
lamports: u64,
withdraw_authority: Option<SigningAuthority>,
sign_only: bool,
signers: Option<Vec<(Pubkey, Signature)>>,
blockhash_query: BlockhashQuery,
nonce_account: Option<Pubkey>,
nonce_authority: Option<SigningAuthority>,
fee_payer: Option<SigningAuthority>,
},
// Storage Commands
CreateStorageAccount {
Expand Down Expand Up @@ -1546,12 +1559,19 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {

// Create stake account
CliCommand::CreateStakeAccount {
stake_account,
ref stake_account,
seed,
staker,
withdrawer,
lockup,
lamports,
sign_only,
ref signers,
blockhash_query,
ref nonce_account,
ref nonce_authority,
ref fee_payer,
ref from,
} => process_create_stake_account(
&rpc_client,
config,
Expand All @@ -1561,6 +1581,13 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
withdrawer,
lockup,
*lamports,
*sign_only,
signers.as_ref(),
blockhash_query,
nonce_account.as_ref(),
nonce_authority.as_ref(),
fee_payer.as_ref(),
from.as_ref(),
),
CliCommand::DeactivateStake {
stake_account_pubkey,
Expand Down Expand Up @@ -1700,13 +1727,25 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
destination_account_pubkey,
lamports,
ref withdraw_authority,
sign_only,
ref signers,
blockhash_query,
ref nonce_account,
ref nonce_authority,
ref fee_payer,
} => process_withdraw_stake(
&rpc_client,
config,
&stake_account_pubkey,
&destination_account_pubkey,
*lamports,
withdraw_authority.as_ref(),
*sign_only,
signers.as_ref(),
blockhash_query,
nonce_account.as_ref(),
nonce_authority.as_ref(),
fee_payer.as_ref(),
),

// Storage Commands
Expand Down Expand Up @@ -3037,6 +3076,13 @@ mod tests {
custodian,
},
lamports: 1234,
sign_only: false,
signers: None,
blockhash_query: BlockhashQuery::All,
nonce_account: None,
nonce_authority: None,
fee_payer: None,
from: None,
};
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
Expand All @@ -3048,6 +3094,12 @@ mod tests {
destination_account_pubkey: to_pubkey,
lamports: 100,
withdraw_authority: None,
sign_only: false,
signers: None,
blockhash_query: BlockhashQuery::All,
nonce_account: None,
nonce_authority: None,
fee_payer: None,
};
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
Expand Down
Loading

0 comments on commit c377d1c

Please sign in to comment.