Skip to content

Commit

Permalink
feat(core): Add as_*_mut methods on TypedTransaction (gakonst#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
oblique authored and mattsse committed May 28, 2022
1 parent 1a5c8ce commit c087246
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Unreleased

- Add `as_*_mut` methods on `TypedTransaction`
[#1310](https://github.com/gakonst/ethers-rs/pull/1310)
- AWS EIP712 data signing no longer signs with EIP155
- Added Cronos testnet to etherscan options [1276](https://github.com/gakonst/ethers-rs/pull/1276)
- Fix parsing of a pending block
Expand Down
19 changes: 19 additions & 0 deletions ethers-core/src/types/transaction/eip2718.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,25 @@ impl TypedTransaction {
_ => None,
}
}

pub fn as_legacy_mut(&mut self) -> Option<&mut TransactionRequest> {
match self {
Legacy(tx) => Some(tx),
_ => None,
}
}
pub fn as_eip2930_mut(&mut self) -> Option<&mut Eip2930TransactionRequest> {
match self {
Eip2930(tx) => Some(tx),
_ => None,
}
}
pub fn as_eip1559_mut(&mut self) -> Option<&mut Eip1559TransactionRequest> {
match self {
Eip1559(tx) => Some(tx),
_ => None,
}
}
}

impl TypedTransaction {
Expand Down

0 comments on commit c087246

Please sign in to comment.