use util::*; #[derive(Eq, PartialEq)] pub enum TransactionKind { ContractCreation, MessageCall } /// A set of information describing an externally-originating message call /// or contract creation operation. pub struct Transaction { pub nonce: U256, pub gas_price: U256, pub gas: U256, pub to: Option
, pub value: U256, pub data: Bytes } impl Transaction { pub fn new() -> Self { Transaction { nonce: U256::zero(), gas_price: U256::zero(), gas: U256::zero(), to: None, value: U256::zero(), data: vec![] } } /// Returns sender of the transaction. /// TODO: implement pub fn sender(&self) -> Address { Address::new() } /// Is this transaction meant to create a contract? pub fn is_contract_creation(&self) -> bool { self.kind() == TransactionKind::ContractCreation } /// Is this transaction meant to send a message? pub fn is_message_call(&self) -> bool { self.kind() == TransactionKind::MessageCall } /// Returns transaction type. pub fn kind(&self) -> TransactionKind { match self.to.is_some() { true => TransactionKind::MessageCall, false => TransactionKind::ContractCreation } } /// Get the hash of this transaction. pub fn sha3(&self) -> H256 { unimplemented!(); } } impl Encodable for Transaction { fn encode