-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move cost and instruction to Args struct and apply the instruct…
…ions if present
- Loading branch information
1 parent
4febbe2
commit 6a602e2
Showing
8 changed files
with
56 additions
and
29 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,16 +1,38 @@ | ||
use crate::commands::HEADING_RPC; | ||
use clap::arg; | ||
use soroban_rpc::Assembled; | ||
|
||
use crate::commands::HEADING_RPC; | ||
|
||
#[derive(Debug, clap::Args, Clone)] | ||
#[group(skip)] | ||
pub struct Args { | ||
/// fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm | ||
#[arg(long, default_value = "100", env = "SOROBAN_FEE", help_heading = HEADING_RPC)] | ||
pub fee: u32, | ||
/// Output the cost execution to stderr | ||
#[arg(long = "cost", help_heading = HEADING_RPC)] | ||
pub cost: bool, | ||
/// Number of instructions to simulate | ||
#[arg(long, help_heading = HEADING_RPC)] | ||
pub instructions: Option<u32>, | ||
} | ||
|
||
impl Args { | ||
pub fn apply_to_assembled_txn(&self, txn: Assembled) -> Assembled { | ||
if let Some(instructions) = self.instructions { | ||
txn.set_max_instructions(instructions) | ||
} else { | ||
txn | ||
} | ||
} | ||
} | ||
|
||
impl Default for Args { | ||
fn default() -> Self { | ||
Self { fee: 100 } | ||
Self { | ||
fee: 100, | ||
cost: false, | ||
instructions: None, | ||
} | ||
} | ||
} |
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