LocalizedReceipt

This commit is contained in:
debris
2016-03-20 17:29:39 +01:00
parent f1f421af76
commit 2a3e695f8a
8 changed files with 115 additions and 8 deletions

View File

@@ -293,6 +293,12 @@ impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM>
.and_then(|(number, index)| self.transaction(TransactionId::Location(number.into(), index.value())))
}
fn transaction_receipt(&self, params: Params) -> Result<Value, Error> {
unimplemented!();
//from_params::<(H256,)>(params)
//.and_then(|(hash,)| self.transaction_receipt(TransactionId::Hash(hash)))
}
fn uncle_by_block_hash_and_index(&self, params: Params) -> Result<Value, Error> {
from_params::<(H256, Index)>(params)
.and_then(|(hash, index)| self.uncle(BlockId::Hash(hash), index.value()))

View File

@@ -24,6 +24,7 @@ mod optionals;
mod sync;
mod transaction;
mod transaction_request;
mod receipt;
pub use self::block::{Block, BlockTransactions};
pub use self::block_number::BlockNumber;
@@ -35,4 +36,5 @@ pub use self::optionals::OptionalValue;
pub use self::sync::{SyncStatus, SyncInfo};
pub use self::transaction::Transaction;
pub use self::transaction_request::TransactionRequest;
pub use self::receipt::Receipt;

View File

@@ -0,0 +1,56 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use util::numbers::U256;
use util::hash::{Address, H256};
use v1::types::Log;
use ethcore::receipt::LocalizedReceipt;
#[derive(Debug, Serialize)]
pub struct Receipt {
#[serde(rename="transactionHash")]
pub transaction_hash: H256,
#[serde(rename="transactionIndex")]
pub transaction_index: U256,
#[serde(rename="blockHash")]
pub block_hash: H256,
#[serde(rename="blockNumber")]
pub block_number: U256,
#[serde(rename="cumulativeGasUsed")]
pub cumulative_gas_used: U256,
#[serde(rename="gasUsed")]
pub gas_used: U256,
#[serde(rename="contractAddress")]
pub contract_address: Option<Address>,
pub logs: Vec<Log>,
}
impl From<LocalizedReceipt> for Receipt {
fn from(r: LocalizedReceipt) -> Self {
Receipt {
transaction_hash: r.transaction_hash,
transaction_index: U256::from(r.transaction_index),
block_hash: r.block_hash,
block_number: U256::from(r.block_number),
cumulative_gas_used: r.cumulative_gas_used,
gas_used: r.gas_used,
contract_address: r.contract_address,
logs: r.logs.into_iter().map(From::from).collect(),
}
}
}