Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ea52319
Support RPC `0.9.0`
ddoktorski Jul 11, 2025
bbfb650
Merge branch 'master' into rpc-0-9-0
ddoktorski Jul 17, 2025
d5b0302
Rename `preconfirmed` to `pre_confirmed`
ddoktorski Jul 17, 2025
a0d4f6a
Update version to `0.9` in node url
ddoktorski Jul 17, 2025
2c20aca
Restore ignored tests
ddoktorski Jul 17, 2025
2c599e1
Add backticks
ddoktorski Jul 17, 2025
3d1c5aa
Update changelog
ddoktorski Jul 17, 2025
802462b
Fix `test_happy_case_deployment_fee_message` test
ddoktorski Jul 17, 2025
764611e
Add dash to pre confirmed
ddoktorski Jul 17, 2025
7dc04ca
Bump devnet to rc.2
ddoktorski Jul 18, 2025
f0bbc6e
Resolve merge conflicts
ddoktorski Jul 21, 2025
808625a
Address PR comments
ddoktorski Jul 21, 2025
d1721df
Use always underscore for pre_confirmed input
ddoktorski Jul 21, 2025
38ce1d5
Revert refactor in `check_if_legacy_contract`
ddoktorski Jul 21, 2025
c8ad731
Resolve merge conflicts
ddoktorski Jul 31, 2025
35ab8a2
Bump starknet-rs to rc.2; bump devnet to rc.4
ddoktorski Jul 31, 2025
8b28a91
Fix changelog
ddoktorski Jul 31, 2025
34bbd0c
Fix e2e::forking::with_cache test
ddoktorski Jul 31, 2025
68329c7
Resolve merge conflicts
ddoktorski Aug 11, 2025
3a0a505
Remove rc from `EXPECTED_RPC_VERSION`
ddoktorski Aug 11, 2025
28915e5
Fix cache test
ddoktorski Aug 11, 2025
dfb1f53
Update free provider url
ddoktorski Aug 11, 2025
bf949ba
Add `--tip` flag
ddoktorski Aug 12, 2025
c58f89b
Add `--estimate-tip` flag
ddoktorski Aug 12, 2025
84e3000
Resolve merge conflicts
ddoktorski Aug 19, 2025
7724174
Resolve merge conflicts
ddoktorski Aug 19, 2025
c4cc818
Update account deploy appendix
ddoktorski Aug 19, 2025
0ef3194
Address PR comments
ddoktorski Aug 19, 2025
0c507d8
Update TODO comment
ddoktorski Aug 19, 2025
a79f9a2
Resolve merge conflicts
ddoktorski Aug 19, 2025
7885d18
Move tip logic to `resolve_tip` method
ddoktorski Aug 19, 2025
9c44d51
Update account deploy appendix
ddoktorski Aug 19, 2025
3b0a6c6
Apply suggestions from code review
ddoktorski Aug 21, 2025
0d35cc4
Fix ci
ddoktorski Aug 21, 2025
e9936e1
Rebase
ddoktorski Aug 22, 2025
23ccd6e
Add conflicts_with to tip docs
ddoktorski Aug 22, 2025
b8b541f
Take self in `with_resolved_tip`
ddoktorski Aug 22, 2025
8a7905f
Fix changelog
ddoktorski Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `--test-files` flag to `verify` command to include test files under src/ for verification (only applies to voyager)
- `--tip` flag to `invoke`, `declare`, `deploy`, `multicall run` and `account deploy` commands to set the transaction tip
- `--estimate-tip` flag which automatically adds an estimated tip to the transaction. The tip is calculated based on the current network conditions and added to the transaction fee

#### Changed

Expand Down
27 changes: 18 additions & 9 deletions crates/sncast/src/helpers/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ pub struct FeeArgs {
#[arg(long)]
pub l1_data_gas_price: Option<u128>,

/// Tip for the transaction. If not provided, it will be set to 0.
#[arg(long)]
/// Tip for the transaction. Defaults to 0 unless `--estimate-tip` is used.
#[arg(long, conflicts_with = "estimate_tip")]
pub tip: Option<u64>,

/// If passed, an estimated tip will be added to pay for the transaction.
#[arg(long)]
pub estimate_tip: bool,
}

impl From<ScriptFeeSettings> for FeeArgs {
Expand All @@ -59,6 +63,7 @@ impl From<ScriptFeeSettings> for FeeArgs {
l1_data_gas,
l1_data_gas_price,
tip: Some(0),
estimate_tip: false,
}
}
}
Expand All @@ -81,7 +86,7 @@ impl FeeArgs {

let fee_settings = FeeSettings::try_from(fee_estimate.clone())
.expect("Failed to convert FeeEstimate to FeeSettings")
.update_tip(self.tip.unwrap_or(0)); // If a tip is not provided, set it to 0
.with_resolved_tip(self.tip, self.estimate_tip);

Ok(fee_settings)
} else {
Expand Down Expand Up @@ -117,11 +122,14 @@ pub struct FeeSettings {

impl FeeSettings {
#[must_use]
pub fn update_tip(&self, tip: u64) -> FeeSettings {
FeeSettings {
tip: Some(tip),
..*self
}
pub fn with_resolved_tip(self, tip: Option<u64>, estimate_tip: bool) -> FeeSettings {
let tip = if estimate_tip {
None // If we leave it as None, the tip will be estimated before sending the transaction
} else {
Some(tip.unwrap_or(0)) // If a tip is not provided, set it to 0
};

FeeSettings { tip, ..self }
}
}

Expand Down Expand Up @@ -149,8 +157,9 @@ impl From<FeeArgs> for FeeSettings {
l2_gas_price: fee_args.l2_gas_price,
l1_data_gas: fee_args.l1_data_gas,
l1_data_gas_price: fee_args.l1_data_gas_price,
tip: Some(fee_args.tip.unwrap_or(0)),
tip: None,
}
.with_resolved_tip(fee_args.tip, fee_args.estimate_tip)
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/sncast/tests/e2e/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
l2_gas: None,
l2_gas_price: None,
tip: Some(100_000),
estimate_tip: false,
}; "max_fee")]
#[test_case(FeeArgs{
max_fee: None,
Expand All @@ -117,6 +118,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
l2_gas: Some(1_000_000_000),
l2_gas_price: Some(100_000_000_000_000_000_000),
tip: None,
estimate_tip: false,
}; "resource_bounds")]
#[tokio::test]
async fn test_happy_case_different_fees(fee_args: FeeArgs) {
Expand Down
2 changes: 2 additions & 0 deletions crates/sncast/tests/e2e/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
l2_gas: None,
l2_gas_price: None,
tip: None,
estimate_tip: false,
}; "max_fee")]
#[test_case(FeeArgs{
max_fee: None,
Expand All @@ -114,6 +115,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
l2_gas: Some(1_000_000_000),
l2_gas_price: Some(100_000_000_000_000_000_000),
tip: Some(100_000),
estimate_tip: false,
}; "resource_bounds")]
#[tokio::test]
async fn test_happy_case_different_fees(fee_args: FeeArgs) {
Expand Down
2 changes: 2 additions & 0 deletions crates/sncast/tests/e2e/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
l2_gas: None,
l2_gas_price: None,
tip: None,
estimate_tip: false,
}; "max_fee")]
#[test_case(FeeArgs{
max_fee: None,
Expand All @@ -116,6 +117,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
l2_gas: Some(1_000_000_000),
l2_gas_price: Some(100_000_000_000_000_000_000),
tip: Some(100_000_000),
estimate_tip: false,
}; "resource_bounds")]
#[tokio::test]
async fn test_happy_case_different_fees(fee_args: FeeArgs) {
Expand Down
36 changes: 36 additions & 0 deletions crates/sncast/tests/integration/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async fn test_happy_case() {
l1_data_gas: Some(100),
l1_data_gas_price: Some(200),
tip: None,
estimate_tip: false,
};

let settings = args.try_into_fee_settings(None).unwrap();
Expand Down Expand Up @@ -42,6 +43,7 @@ async fn test_max_fee_none() {
l1_data_gas: Some(100),
l1_data_gas_price: Some(100),
tip: Some(100),
estimate_tip: false,
};

let settings = args.try_into_fee_settings(None).unwrap();
Expand Down Expand Up @@ -81,6 +83,7 @@ async fn test_max_fee_set() {
l1_data_gas: None,
l1_data_gas_price: None,
tip: None,
estimate_tip: false,
};

let settings = args
Expand Down Expand Up @@ -122,6 +125,7 @@ async fn test_max_fee_set_and_fee_estimate_higher() {
l1_data_gas: None,
l1_data_gas_price: None,
tip: None,
estimate_tip: false,
};

let err = args
Expand Down Expand Up @@ -150,6 +154,7 @@ async fn test_max_fee_set_and_fee_estimate_none() {
l1_data_gas: None,
l1_data_gas_price: None,
tip: None,
estimate_tip: false,
};

args.try_into_fee_settings(None).unwrap();
Expand All @@ -166,6 +171,7 @@ async fn test_all_args_none() {
l1_data_gas: None,
l1_data_gas_price: None,
tip: None,
estimate_tip: false,
};

let settings = args.try_into_fee_settings(None).unwrap();
Expand All @@ -183,3 +189,33 @@ async fn test_all_args_none() {
}
);
}

#[tokio::test]
async fn test_estimate_tip() {
let args = FeeArgs {
max_fee: None,
l1_gas: None,
l1_gas_price: None,
l2_gas: None,
l2_gas_price: None,
l1_data_gas: None,
l1_data_gas_price: None,
tip: None,
estimate_tip: true,
};

let settings = args.try_into_fee_settings(None).unwrap();

assert_eq!(
settings,
FeeSettings {
l1_gas: None,
l1_gas_price: None,
l2_gas: None,
l2_gas_price: None,
l1_data_gas: None,
l1_data_gas_price: None,
tip: None,
}
);
}
9 changes: 8 additions & 1 deletion docs/src/appendix/sncast/account/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ Maximum L1 data gas unit price for the `deploy_account` transaction. When not us

## `--tip <TIP>`
Optional.
Conflicts with: [`--estimate-tip`](#--estimate-tip-estimate_tip)

Tip for the transaction. When not provided, defaults to 0.
Tip for the transaction. When not provided, defaults to 0 unless [`--estimate-tip`](#--estimate-tip-estimate_tip) is used.

## `--estimate-tip <ESTIMATE_TIP>`
Optional.
Conflicts with: [`--tip`](#--tip-tip)

If passed, an estimated tip will be added to pay for the transaction. The tip is estimated based on the current network conditions and added to the transaction fee.

## `--silent`
Optional.
Expand Down
9 changes: 8 additions & 1 deletion docs/src/appendix/sncast/declare.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@ Maximum L1 data gas unit price for the `declare` transaction. When not used, def

## `--tip <TIP>`
Optional.
Conflicts with: [`--estimate-tip`](#--estimate-tip-estimate_tip)

Tip for the transaction. When not provided, defaults to 0.
Tip for the transaction. Tip for the transaction. When not provided, defaults to 0 unless [`--estimate-tip`](#--estimate-tip-estimate_tip) is used.

## `--estimate-tip <ESTIMATE_TIP>`
Optional.
Conflicts with: [`--tip`](#--tip-tip)

If passed, an estimated tip will be added to pay for the transaction. The tip is estimated based on the current network conditions and added to the transaction fee.

## `--nonce, -n <NONCE>`
Optional.
Expand Down
9 changes: 8 additions & 1 deletion docs/src/appendix/sncast/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ Maximum L1 data gas unit price for the `deploy` transaction. When not used, defa

## `--tip <TIP>`
Optional.
Conflicts with: [`--estimate-tip`](#--estimate-tip-estimate_tip)

Tip for the transaction. When not provided, defaults to 0.
Tip for the transaction. When not provided, defaults to 0 unless [`--estimate-tip`](#--estimate-tip-estimate_tip) is used.

## `--estimate-tip <ESTIMATE_TIP>`
Optional.
Conflicts with: [`--tip`](#--tip-tip)

If passed, an estimated tip will be added to pay for the transaction. The tip is estimated based on the current network conditions and added to the transaction fee.

## `--nonce, -n <NONCE>`
Optional.
Expand Down
9 changes: 8 additions & 1 deletion docs/src/appendix/sncast/invoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,15 @@ Maximum L1 data gas unit price for the `invoke` transaction. When not used, defa

## `--tip <TIP>`
Optional.
Conflicts with: [`--estimate-tip`](#--estimate-tip-estimate_tip)

Tip for the transaction. When not provided, defaults to 0.
Tip for the transaction. When not provided, defaults to 0 unless [`--estimate-tip`](#--estimate-tip-estimate_tip) is used.

## `--estimate-tip <ESTIMATE_TIP>`
Optional.
Conflicts with: [`--tip`](#--tip-tip)

If passed, an estimated tip will be added to pay for the transaction. The tip is estimated based on the current network conditions and added to the transaction fee.

## `--nonce, -n <NONCE>`
Optional.
Expand Down
9 changes: 8 additions & 1 deletion docs/src/appendix/sncast/multicall/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ Maximum L1 data gas unit price for the `invoke` transaction. When not used, defa

## `--tip <TIP>`
Optional.
Conflicts with: [`--estimate-tip`](#--estimate-tip-estimate_tip)

Tip for the transaction. When not provided, defaults to 0.
Tip for the transaction. When not provided, defaults to 0 unless [`--estimate-tip`](#--estimate-tip-estimate_tip) is used.

## `--estimate-tip <ESTIMATE_TIP>`
Optional.
Conflicts with: [`--tip`](#--tip-tip)

If passed, an estimated tip will be added to pay for the transaction. The tip is estimated based on the current network conditions and added to the transaction fee.

File example:

Expand Down
Loading