Skip to content

Commit

Permalink
chore: add is dynamic fee (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 12, 2024
1 parent 98639ef commit 4d2216b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ op-alloy-rpc-jsonrpsee = { version = "0.6.3", path = "crates/rpc-jsonrpsee", def
op-alloy-rpc-types-engine = { version = "0.6.3", path = "crates/rpc-types-engine", default-features = false }

# Alloy
alloy-eips = { version = "0.6.2", default-features = false }
alloy-serde = { version = "0.6.2", default-features = false }
alloy-signer = { version = "0.6.2", default-features = false }
alloy-network = { version = "0.6.2", default-features = false }
alloy-provider = { version = "0.6.2", default-features = false }
alloy-transport = { version = "0.6.2", default-features = false }
alloy-consensus = { version = "0.6.2", default-features = false }
alloy-rpc-types-eth = { version = "0.6.2", default-features = false }
alloy-rpc-types-engine = { version = "0.6.2", default-features = false }
alloy-network-primitives = { version = "0.6.2", default-features = false }
alloy-eips = { version = "0.6.3", default-features = false }
alloy-serde = { version = "0.6.3", default-features = false }
alloy-signer = { version = "0.6.3", default-features = false }
alloy-network = { version = "0.6.3", default-features = false }
alloy-provider = { version = "0.6.3", default-features = false }
alloy-transport = { version = "0.6.3", default-features = false }
alloy-consensus = { version = "0.6.3", default-features = false }
alloy-rpc-types-eth = { version = "0.6.3", default-features = false }
alloy-rpc-types-engine = { version = "0.6.3", default-features = false }
alloy-network-primitives = { version = "0.6.3", default-features = false }

# Alloy RLP
alloy-rlp = { version = "0.3", default-features = false }
Expand Down
4 changes: 4 additions & 0 deletions crates/consensus/src/transaction/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ impl Transaction for TxDeposit {
0
}

fn is_dynamic_fee(&self) -> bool {
false
}

fn kind(&self) -> TxKind {
self.to
}
Expand Down
10 changes: 10 additions & 0 deletions crates/consensus/src/transaction/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,16 @@ impl Transaction for OpTxEnvelope {
Self::Deposit(tx) => tx.authorization_list(),
}
}

fn is_dynamic_fee(&self) -> bool {
match self {
Self::Legacy(tx) => tx.tx().is_dynamic_fee(),
Self::Eip2930(tx) => tx.tx().is_dynamic_fee(),
Self::Eip1559(tx) => tx.tx().is_dynamic_fee(),
Self::Eip7702(tx) => tx.tx().is_dynamic_fee(),
Self::Deposit(tx) => tx.is_dynamic_fee(),
}
}
}

impl OpTxEnvelope {
Expand Down
10 changes: 10 additions & 0 deletions crates/consensus/src/transaction/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ impl Transaction for OpTypedTransaction {
Self::Deposit(tx) => tx.authorization_list(),
}
}

fn is_dynamic_fee(&self) -> bool {
match self {
Self::Legacy(tx) => tx.is_dynamic_fee(),
Self::Eip2930(tx) => tx.is_dynamic_fee(),
Self::Eip1559(tx) => tx.is_dynamic_fee(),
Self::Eip7702(tx) => tx.is_dynamic_fee(),
Self::Deposit(tx) => tx.is_dynamic_fee(),
}
}
}

#[cfg(feature = "serde")]
Expand Down
4 changes: 4 additions & 0 deletions crates/rpc-types/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ impl ConsensusTransaction for Transaction {
fn authorization_list(&self) -> Option<&[SignedAuthorization]> {
self.inner.authorization_list()
}

fn is_dynamic_fee(&self) -> bool {
self.inner.is_dynamic_fee()
}
}

impl alloy_network_primitives::TransactionResponse for Transaction {
Expand Down

0 comments on commit 4d2216b

Please sign in to comment.