Skip to content

Commit

Permalink
Refactor estimate fee (keep-starknet-strange#1307)
Browse files Browse the repository at this point in the history
Co-authored-by: Timothée Delabrouille <[email protected]>
  • Loading branch information
lana-shanghai and tdelabro authored Dec 11, 2023
1 parent 04d4b2a commit 4c1eb9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
- chore(data-availability-avail): implement fire and forget, and add ws
reconnection logic
- chore: update `polkadot-sdk` to `release-polkadot-v1.3.0`
- refactor: use `map` in `estimate_fee` to stop computation on error

## v0.5.0

Expand Down
7 changes: 2 additions & 5 deletions crates/client/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,14 +897,11 @@ where
let best_block_hash = self.client.info().best_hash;
let chain_id = Felt252Wrapper(self.chain_id()?.0);

let mut transactions = vec![];
for tx in request {
let tx = tx.try_into().map_err(|e| {
let transactions =
request.into_iter().map(|tx| tx.try_into()).collect::<Result<Vec<UserTransaction>, _>>().map_err(|e| {
error!("Failed to convert BroadcastedTransaction to UserTransaction: {e}");
StarknetRpcApiError::InternalServerError
})?;
transactions.push(tx);
}

let fee_estimates = self
.client
Expand Down

0 comments on commit 4c1eb9e

Please sign in to comment.