Skip to content

Commit

Permalink
fix: remove unused file and switch to single match for fee config
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Nov 7, 2024
1 parent 8da4765 commit 59c159a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 553 deletions.
96 changes: 48 additions & 48 deletions crates/dojo/utils/src/tx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,14 @@ where
mut self,
txn_config: &TxnConfig,
) -> Result<Self::R, AccountError<T::SignError>> {
if let FeeConfig::Eth(EthFeeConfig { fee_estimate_multiplier: Some(fee_est_mul), .. }) =
txn_config.fee_config
{
self = self.fee_estimate_multiplier(fee_est_mul);
}

if let FeeConfig::Eth(EthFeeConfig { max_fee_raw: Some(max_fee_r), .. }) =
txn_config.fee_config
{
self = self.max_fee(max_fee_r);
if let FeeConfig::Eth(c) = txn_config.fee_config {
if let Some(fee_est_mul) = c.fee_estimate_multiplier {
self = self.fee_estimate_multiplier(fee_est_mul);
}

Check warning on line 140 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L138-L140

Added lines #L138 - L140 were not covered by tests

if let Some(max_raw_f) = c.max_fee_raw {
self = self.max_fee(max_raw_f);
}

Check warning on line 144 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L142-L144

Added lines #L142 - L144 were not covered by tests
}

self.send().await
Expand All @@ -161,16 +159,14 @@ where
mut self,
txn_config: &TxnConfig,
) -> Result<Self::R, AccountError<T::SignError>> {
if let FeeConfig::Eth(EthFeeConfig { fee_estimate_multiplier: Some(fee_est_mul), .. }) =
txn_config.fee_config
{
self = self.fee_estimate_multiplier(fee_est_mul);
}

if let FeeConfig::Eth(EthFeeConfig { max_fee_raw: Some(max_raw_f), .. }) =
txn_config.fee_config
{
self = self.max_fee(max_raw_f);
if let FeeConfig::Eth(c) = txn_config.fee_config {
if let Some(fee_est_mul) = c.fee_estimate_multiplier {
self = self.fee_estimate_multiplier(fee_est_mul);
}

Check warning on line 165 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L162-L165

Added lines #L162 - L165 were not covered by tests

if let Some(max_raw_f) = c.max_fee_raw {
self = self.max_fee(max_raw_f);
}

Check warning on line 169 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L167-L169

Added lines #L167 - L169 were not covered by tests
}

self.send().await
Expand All @@ -188,16 +184,14 @@ where
mut self,
txn_config: &TxnConfig,
) -> Result<Self::R, AccountFactoryError<<T>::SignError>> {
if let FeeConfig::Eth(EthFeeConfig { fee_estimate_multiplier: Some(fee_est_mul), .. }) =
txn_config.fee_config
{
self = self.fee_estimate_multiplier(fee_est_mul);
}

if let FeeConfig::Eth(EthFeeConfig { max_fee_raw: Some(max_raw_f), .. }) =
txn_config.fee_config
{
self = self.max_fee(max_raw_f);
if let FeeConfig::Eth(c) = txn_config.fee_config {
if let Some(fee_est_mul) = c.fee_estimate_multiplier {
self = self.fee_estimate_multiplier(fee_est_mul);
}

Check warning on line 190 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L187-L190

Added lines #L187 - L190 were not covered by tests

if let Some(max_raw_f) = c.max_fee_raw {
self = self.max_fee(max_raw_f);
}

Check warning on line 194 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L192-L194

Added lines #L192 - L194 were not covered by tests
}

self.send().await
Expand All @@ -215,12 +209,14 @@ where
mut self,
txn_config: &TxnConfig,
) -> Result<Self::R, AccountError<T::SignError>> {
if let FeeConfig::Strk(StrkFeeConfig { gas: Some(g), .. }) = txn_config.fee_config {
self = self.gas(g);
}

if let FeeConfig::Strk(StrkFeeConfig { gas_price: Some(gp), .. }) = txn_config.fee_config {
self = self.gas_price(gp);
if let FeeConfig::Strk(c) = txn_config.fee_config {
if let Some(g) = c.gas {
self = self.gas(g);

Check warning on line 214 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L214

Added line #L214 was not covered by tests
}

if let Some(gp) = c.gas_price {
self = self.gas_price(gp);

Check warning on line 218 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L218

Added line #L218 was not covered by tests
}
}

Check warning on line 220 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L220

Added line #L220 was not covered by tests

self.send().await
Expand All @@ -238,12 +234,14 @@ where
mut self,
txn_config: &TxnConfig,
) -> Result<Self::R, AccountError<T::SignError>> {
if let FeeConfig::Strk(StrkFeeConfig { gas: Some(g), .. }) = txn_config.fee_config {
self = self.gas(g);
}

if let FeeConfig::Strk(StrkFeeConfig { gas_price: Some(gp), .. }) = txn_config.fee_config {
self = self.gas_price(gp);
if let FeeConfig::Strk(c) = txn_config.fee_config {
if let Some(g) = c.gas {
self = self.gas(g);

Check warning on line 239 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L239

Added line #L239 was not covered by tests
}

if let Some(gp) = c.gas_price {
self = self.gas_price(gp);

Check warning on line 243 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L243

Added line #L243 was not covered by tests
}
}

Check warning on line 245 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L245

Added line #L245 was not covered by tests

self.send().await
Expand All @@ -261,12 +259,14 @@ where
mut self,
txn_config: &TxnConfig,
) -> Result<Self::R, AccountFactoryError<<T>::SignError>> {
if let FeeConfig::Strk(StrkFeeConfig { gas: Some(g), .. }) = txn_config.fee_config {
self = self.gas(g);
}

if let FeeConfig::Strk(StrkFeeConfig { gas_price: Some(gp), .. }) = txn_config.fee_config {
self = self.gas_price(gp);
if let FeeConfig::Strk(c) = txn_config.fee_config {
if let Some(g) = c.gas {
self = self.gas(g);
}

Check warning on line 265 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L258-L265

Added lines #L258 - L265 were not covered by tests

if let Some(gp) = c.gas_price {
self = self.gas_price(gp);
}

Check warning on line 269 in crates/dojo/utils/src/tx/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/dojo/utils/src/tx/mod.rs#L267-L269

Added lines #L267 - L269 were not covered by tests
}

self.send().await
Expand Down
Loading

0 comments on commit 59c159a

Please sign in to comment.