mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(rpc): add txpool namespace (#2591)
This commit is contained in:
@ -302,6 +302,11 @@ impl Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the transaction's nonce.
|
||||
pub fn to(&self) -> Option<Address> {
|
||||
self.kind().to()
|
||||
}
|
||||
|
||||
/// Get transaction type
|
||||
pub fn tx_type(&self) -> TxType {
|
||||
match self {
|
||||
@ -312,8 +317,8 @@ impl Transaction {
|
||||
}
|
||||
|
||||
/// Gets the transaction's value field.
|
||||
pub fn value(&self) -> &u128 {
|
||||
match self {
|
||||
pub fn value(&self) -> u128 {
|
||||
*match self {
|
||||
Transaction::Legacy(TxLegacy { value, .. }) => value,
|
||||
Transaction::Eip2930(TxEip2930 { value, .. }) => value,
|
||||
Transaction::Eip1559(TxEip1559 { value, .. }) => value,
|
||||
@ -678,6 +683,16 @@ pub enum TransactionKind {
|
||||
Call(Address),
|
||||
}
|
||||
|
||||
impl TransactionKind {
|
||||
/// Returns the address of the contract that will be called or will receive the transfer.
|
||||
pub fn to(self) -> Option<Address> {
|
||||
match self {
|
||||
TransactionKind::Create => None,
|
||||
TransactionKind::Call(to) => Some(to),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Compact for TransactionKind {
|
||||
fn to_compact<B>(self, buf: &mut B) -> usize
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user