aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/src/marshaller.ts
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-21 05:26:00 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-21 05:26:00 +0800
commiteca63b1a5815c61901453837f9c2b737fa82eb20 (patch)
tree7763d95f1922f6c16848a8b506384e6e9992260b /packages/web3-wrapper/src/marshaller.ts
parent2bda6dd719d748a4bfa5ff8e23e97924e0258af1 (diff)
parentba41fc9275bebe17577f87d72f54b7e7dc420acc (diff)
downloaddexon-sol-tools-eca63b1a5815c61901453837f9c2b737fa82eb20.tar
dexon-sol-tools-eca63b1a5815c61901453837f9c2b737fa82eb20.tar.gz
dexon-sol-tools-eca63b1a5815c61901453837f9c2b737fa82eb20.tar.bz2
dexon-sol-tools-eca63b1a5815c61901453837f9c2b737fa82eb20.tar.lz
dexon-sol-tools-eca63b1a5815c61901453837f9c2b737fa82eb20.tar.xz
dexon-sol-tools-eca63b1a5815c61901453837f9c2b737fa82eb20.tar.zst
dexon-sol-tools-eca63b1a5815c61901453837f9c2b737fa82eb20.zip
Merge branch 'development' into feature/header-tweaks
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