Docs.
This commit is contained in:
parent
cf1e9f24b6
commit
bffbba32d2
14
src/views.rs
14
src/views.rs
@ -3,7 +3,7 @@ use util::*;
|
||||
use header::*;
|
||||
use transaction::*;
|
||||
|
||||
/// View onto block rlp.
|
||||
/// View onto transaction rlp.
|
||||
pub struct TransactionView<'a> {
|
||||
rlp: Rlp<'a>
|
||||
}
|
||||
@ -28,23 +28,31 @@ impl<'a> TransactionView<'a> {
|
||||
&self.rlp
|
||||
}
|
||||
|
||||
/// Get the nonce field of the transaction.
|
||||
pub fn nonce(&self) -> U256 { self.rlp.val_at(0) }
|
||||
|
||||
/// Get the gas_price field of the transaction.
|
||||
pub fn gas_price(&self) -> U256 { self.rlp.val_at(1) }
|
||||
|
||||
/// Get the gas field of the transaction.
|
||||
pub fn gas(&self) -> U256 { self.rlp.val_at(2) }
|
||||
|
||||
// TODO: something like pub fn action(&self) -> Action { self.rlp.val_at(3) }
|
||||
|
||||
/// Get the value field of the transaction.
|
||||
pub fn value(&self) -> U256 { self.rlp.val_at(4) }
|
||||
|
||||
/// Get the data field of the transaction.
|
||||
pub fn data(&self) -> Bytes { self.rlp.val_at(5) }
|
||||
|
||||
/// Get the v field of the transaction.
|
||||
pub fn v(&self) -> u8 { let r: u16 = self.rlp.val_at(6); r as u8 }
|
||||
|
||||
/// Get the r field of the transaction.
|
||||
pub fn r(&self) -> U256 { self.rlp.val_at(7) }
|
||||
|
||||
/// Get the s field of the transaction.
|
||||
pub fn s(&self) -> U256 { self.rlp.val_at(8) }
|
||||
|
||||
// TODO: something like pub fn action(&self) -> Action { self.rlp.val_at(3) }
|
||||
}
|
||||
|
||||
impl<'a> Hashable for TransactionView<'a> {
|
||||
|
Loading…
Reference in New Issue
Block a user