aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/src/marshaller.ts
diff options
context:
space:
mode:
authorAugust Skare <post@augustskare.no>2018-11-21 15:19:29 +0800
committerAugust Skare <post@augustskare.no>2018-11-21 15:19:29 +0800
commit592e1a3e6ff974d357aff02f1c170d6624895b7e (patch)
tree8b8c519206b8921356b4491ca3fa6bf9d82d222d /packages/web3-wrapper/src/marshaller.ts
parent99176c2d5482b6eb2d2e223ac6cbdae5fc3e42ce (diff)
parent15f05733be45e05974972c80c4fa8437a62633e2 (diff)
downloaddexon-sol-tools-592e1a3e6ff974d357aff02f1c170d6624895b7e.tar
dexon-sol-tools-592e1a3e6ff974d357aff02f1c170d6624895b7e.tar.gz
dexon-sol-tools-592e1a3e6ff974d357aff02f1c170d6624895b7e.tar.bz2
dexon-sol-tools-592e1a3e6ff974d357aff02f1c170d6624895b7e.tar.lz
dexon-sol-tools-592e1a3e6ff974d357aff02f1c170d6624895b7e.tar.xz
dexon-sol-tools-592e1a3e6ff974d357aff02f1c170d6624895b7e.tar.zst
dexon-sol-tools-592e1a3e6ff974d357aff02f1c170d6624895b7e.zip
Merge branch 'development' into dev-tools-pages
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