aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/src
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-07-06 08:48:02 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-07-06 08:48:02 +0800
commit30e3afc0fbccd01ef5ce62de4dfb0154fd7b7892 (patch)
tree8e62f46a85c50cf3685d3a02fe63bc56fd3d6028 /packages/web3-wrapper/src
parent51b86742d10a9e73fd017a0d052e0e423685eb69 (diff)
downloaddexon-sol-tools-30e3afc0fbccd01ef5ce62de4dfb0154fd7b7892.tar
dexon-sol-tools-30e3afc0fbccd01ef5ce62de4dfb0154fd7b7892.tar.gz
dexon-sol-tools-30e3afc0fbccd01ef5ce62de4dfb0154fd7b7892.tar.bz2
dexon-sol-tools-30e3afc0fbccd01ef5ce62de4dfb0154fd7b7892.tar.lz
dexon-sol-tools-30e3afc0fbccd01ef5ce62de4dfb0154fd7b7892.tar.xz
dexon-sol-tools-30e3afc0fbccd01ef5ce62de4dfb0154fd7b7892.tar.zst
dexon-sol-tools-30e3afc0fbccd01ef5ce62de4dfb0154fd7b7892.zip
Add unmarshallTxData to marshaller
Diffstat (limited to 'packages/web3-wrapper/src')
-rw-r--r--packages/web3-wrapper/src/marshaller.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts
index e9fd35a11..15384417e 100644
--- a/packages/web3-wrapper/src/marshaller.ts
+++ b/packages/web3-wrapper/src/marshaller.ts
@@ -73,6 +73,19 @@ export const marshaller = {
};
return tx;
},
+ unmarshalTxData(txDataRpc: TxDataRPC): TxData {
+ if (_.isUndefined(txDataRpc.from)) {
+ throw new Error(`txData must include valid 'from' value.`);
+ }
+ const txData = {
+ ...txDataRpc,
+ value: !_.isUndefined(txDataRpc.value) ? utils.convertHexToNumber(txDataRpc.value) : undefined,
+ gas: !_.isUndefined(txDataRpc.gas) ? utils.convertHexToNumber(txDataRpc.gas) : undefined,
+ gasPrice: !_.isUndefined(txDataRpc.gasPrice) ? utils.convertHexToNumber(txDataRpc.gasPrice) : undefined,
+ nonce: !_.isUndefined(txDataRpc.nonce) ? utils.convertHexToNumber(txDataRpc.nonce) : undefined,
+ };
+ return txData;
+ },
marshalTxData(txData: Partial<TxData>): Partial<TxDataRPC> {
if (_.isUndefined(txData.from)) {
throw new Error(`txData must include valid 'from' value.`);