feat(core): Add `as_*_mut` methods on `TypedTransaction` (#1310)

This commit is contained in:
oblique 2022-05-27 17:11:18 +03:00 committed by GitHub
parent 266b1f4777
commit 526f40e88f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -4,6 +4,8 @@
### Unreleased ### 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 - AWS EIP712 data signing no longer signs with EIP155
- Added Cronos testnet to etherscan options [1276](https://github.com/gakonst/ethers-rs/pull/1276) - Added Cronos testnet to etherscan options [1276](https://github.com/gakonst/ethers-rs/pull/1276)
- Fix parsing of a pending block - Fix parsing of a pending block

View File

@ -417,6 +417,25 @@ impl TypedTransaction {
_ => None, _ => 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 { impl TypedTransaction {