Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cast): setting transaction opts in call --trace #9642

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tnv1
Copy link

@tnv1 tnv1 commented Jan 8, 2025

Closes #9391

Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a good start but is missing some fields from TransactionOpts we would like to see

Comment on lines +191 to +197
// setting transaction opt
if let Some(gas_price) = tx.gas_price() {
env.tx.gas_price = U256::from(gas_price);
}
if let Some(gas_limit) = tx.gas_limit() {
env.tx.gas_limit = gas_limit;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be incomplete, all options in

Transaction options:
      --gas-limit <GAS_LIMIT>
          Gas limit for the transaction
          
          [env: ETH_GAS_LIMIT=]

      --gas-price <PRICE>
          Gas price for legacy transactions, or max fee per gas for EIP1559 transactions, either specified in wei, or as a string with a unit type.
          
          Examples: 1ether, 10gwei, 0.01ether
          
          [env: ETH_GAS_PRICE=]

      --priority-gas-price <PRICE>
          Max priority fee per gas for EIP1559 transactions
          
          [env: ETH_PRIORITY_GAS_PRICE=]

      --value <VALUE>
          Ether to send in the transaction, either specified in wei, or as a string with a unit type.
          
          Examples: 1ether, 10gwei, 0.01ether

      --nonce <NONCE>
          Nonce for the transaction

      --legacy
          Send a legacy transaction instead of an EIP1559 transaction.
          
          This is automatically enabled for common networks without EIP1559.

      --blob
          Send a EIP-4844 blob transaction

      --blob-gas-price <BLOB_PRICE>
          Gas price for EIP-4844 blob transaction
          
          [env: ETH_BLOB_GAS_PRICE=]

      --auth <AUTH>
          EIP-7702 authorization list.
          
          Can be either a hex-encoded signed authorization or an address.

      --access-list [<ACCESS_LIST>]
          EIP-2930 access list.
          
          Accepts either a JSON-encoded access list or an empty value to create the access list via an RPC call to `eth_createAccessList`. To retrieve
          only the access list portion, use the `cast access-list` command.

should be handled

#[derive(Clone, Debug, Parser)]
#[command(next_help_heading = "Transaction options")]
pub struct TransactionOpts {
/// Gas limit for the transaction.
#[arg(long, env = "ETH_GAS_LIMIT")]
pub gas_limit: Option<U256>,
/// Gas price for legacy transactions, or max fee per gas for EIP1559 transactions, either
/// specified in wei, or as a string with a unit type.
///
/// Examples: 1ether, 10gwei, 0.01ether
#[arg(
long,
env = "ETH_GAS_PRICE",
value_parser = parse_ether_value,
value_name = "PRICE"
)]
pub gas_price: Option<U256>,
/// Max priority fee per gas for EIP1559 transactions.
#[arg(
long,
env = "ETH_PRIORITY_GAS_PRICE",
value_parser = parse_ether_value,
value_name = "PRICE"
)]
pub priority_gas_price: Option<U256>,
/// Ether to send in the transaction, either specified in wei, or as a string with a unit type.
///
///
///
/// Examples: 1ether, 10gwei, 0.01ether
#[arg(long, value_parser = parse_ether_value)]
pub value: Option<U256>,
/// Nonce for the transaction.
#[arg(long)]
pub nonce: Option<U64>,
/// Send a legacy transaction instead of an EIP1559 transaction.
///
/// This is automatically enabled for common networks without EIP1559.
#[arg(long)]
pub legacy: bool,
/// Send a EIP-4844 blob transaction.
#[arg(long, conflicts_with = "legacy")]
pub blob: bool,
/// Gas price for EIP-4844 blob transaction.
#[arg(long, conflicts_with = "legacy", value_parser = parse_ether_value, env = "ETH_BLOB_GAS_PRICE", value_name = "BLOB_PRICE")]
pub blob_gas_price: Option<U256>,
/// EIP-7702 authorization list.
///
/// Can be either a hex-encoded signed authorization or an address.
#[arg(long, conflicts_with_all = &["legacy", "blob"])]
pub auth: Option<CliAuthorizationList>,
/// EIP-2930 access list.
///
/// Accepts either a JSON-encoded access list or an empty value to create the access list
/// via an RPC call to `eth_createAccessList`. To retrieve only the access list portion, use
/// the `cast access-list` command.
#[arg(long, value_parser = parse_json::<AccessList>)]
pub access_list: Option<Option<AccessList>>,
}

@grandizzy grandizzy added T-feature Type: feature C-cast Command: cast labels Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast T-feature Type: feature
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Respect TransactionOpts in cast call --trace
3 participants