diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-10 02:08:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 02:08:28 +0800 |
commit | 4b60a3cbab3a97125499cb89d9c253deebfb7d2d (patch) | |
tree | 3cd745f49d55406e95453bf3efac6383fba5f038 /packages/web3-wrapper/src/marshaller.ts | |
parent | 9f08916cf18ad3e2686811933116122eea0890b9 (diff) | |
parent | 17956efe351e3ec0b1e9cdeee8292ebb0b4e563c (diff) | |
download | dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.gz dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.bz2 dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.lz dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.xz dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.zst dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.zip |
Merge branch 'v2-prototype' into abi-gen-ignore-unchanged
Diffstat (limited to 'packages/web3-wrapper/src/marshaller.ts')
-rw-r--r-- | packages/web3-wrapper/src/marshaller.ts | 13 |
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.`); |