diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-11-20 21:48:32 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-11-20 22:22:06 +0800 |
commit | 22cfdd9f0b5cd2b8d53384e16defc956570ccd6a (patch) | |
tree | e6b22283ae8855476ff6f372c106a7bee54e351c /packages/web3-wrapper/src/marshaller.ts | |
parent | 953f8c119b561eeb3463194494e6725869a68bec (diff) | |
download | dexon-sol-tools-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar dexon-sol-tools-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.gz dexon-sol-tools-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.bz2 dexon-sol-tools-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.lz dexon-sol-tools-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.xz dexon-sol-tools-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.tar.zst dexon-sol-tools-22cfdd9f0b5cd2b8d53384e16defc956570ccd6a.zip |
Properly unmarshall TransactionReceiptRPC to TransactionReceipt
Diffstat (limited to 'packages/web3-wrapper/src/marshaller.ts')
-rw-r--r-- | packages/web3-wrapper/src/marshaller.ts | 18 |
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 |