Skip to content

Commit

Permalink
refactor: impl from trait for external tx resource bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadNassar1 committed May 30, 2024
1 parent 8e7cf72 commit bff11bc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/external_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
#[path = "external_transaction_test.rs"]
mod external_transaction_test;

use std::collections::BTreeMap;

use serde::{Deserialize, Serialize};

use crate::core::{ClassHash, CompiledClassHash, ContractAddress, Nonce};
use crate::data_availability::DataAvailabilityMode;
use crate::hash::StarkFelt;
use crate::state::EntryPoint;
use crate::transaction::{
AccountDeploymentData, Calldata, ContractAddressSalt, PaymasterData, ResourceBounds, Tip,
TransactionSignature,
AccountDeploymentData, Calldata, ContractAddressSalt, PaymasterData, Resource, ResourceBounds,
Tip, TransactionSignature,
};

/// Transactions that are ready to be broadcasted to the network through RPC and are not included in
Expand Down Expand Up @@ -166,3 +168,12 @@ pub struct ResourceBoundsMapping {
pub l1_gas: ResourceBounds,
pub l2_gas: ResourceBounds,
}

impl From<ResourceBoundsMapping> for crate::transaction::ResourceBoundsMapping {
fn from(mapping: ResourceBoundsMapping) -> crate::transaction::ResourceBoundsMapping {
let mut map = BTreeMap::new();
map.insert(Resource::L1Gas, mapping.l1_gas);
map.insert(Resource::L2Gas, mapping.l2_gas);
crate::transaction::ResourceBoundsMapping(map)
}
}

0 comments on commit bff11bc

Please sign in to comment.