aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/src/marshaller.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-21 23:43:36 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-21 23:43:36 +0800
commitfc123871ad9b1e791b8156d069c503e8d869139c (patch)
treef31546c91d6936432f18d2a2c224549c7f65c9c9 /packages/web3-wrapper/src/marshaller.ts
parentb62fbd0b13dbef67d8df1177b1ca6b4d082faaa9 (diff)
parentf27fef0295243eeb85498ee09810a2f56afd88bd (diff)
downloaddexon-0x-contracts-fc123871ad9b1e791b8156d069c503e8d869139c.tar.gz
dexon-0x-contracts-fc123871ad9b1e791b8156d069c503e8d869139c.tar.zst
dexon-0x-contracts-fc123871ad9b1e791b8156d069c503e8d869139c.zip
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/push-to-history
Diffstat (limited to 'packages/web3-wrapper/src/marshaller.ts')
-rw-r--r--packages/web3-wrapper/src/marshaller.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts
index 299c6a64c..7bd274c85 100644
--- a/packages/web3-wrapper/src/marshaller.ts
+++ b/packages/web3-wrapper/src/marshaller.ts
@@ -9,6 +9,7 @@ import {
LogEntry,
RawLogEntry,
Transaction,
+ TransactionReceipt,
TxData,
} from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
@@ -21,6 +22,7 @@ import {
BlockWithTransactionDataRPC,
CallDataRPC,
CallTxDataBaseRPC,
+ TransactionReceiptRPC,
TransactionRPC,
TxDataRPC,
} from './types';
@@ -92,6 +94,22 @@ export const marshaller = {
return tx;
},
/**
+ * Unmarshall transaction receipt
+ * @param txReceiptRpc transaction receipt to unmarshall
+ * @return unmarshalled transaction receipt
+ */
+ unmarshalTransactionReceipt(txReceiptRpc: TransactionReceiptRPC): TransactionReceipt {
+ const txReceipt = {
+ ...txReceiptRpc,
+ blockNumber: utils.convertHexToNumber(txReceiptRpc.blockNumber),
+ transactionIndex: utils.convertHexToNumber(txReceiptRpc.transactionIndex),
+ cumulativeGasUsed: utils.convertHexToNumber(txReceiptRpc.cumulativeGasUsed),
+ gasUsed: utils.convertHexToNumber(txReceiptRpc.gasUsed),
+ logs: _.map(txReceiptRpc.logs, marshaller.unmarshalLog.bind(marshaller)),
+ };
+ return txReceipt;
+ },
+ /**
* Unmarshall transaction data
* @param txDataRpc transaction data to unmarshall
* @return unmarshalled transaction data