From 3d67f122a501e49a005c4ebdb0a68be0f67fcea8 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 5 Jul 2018 12:03:34 +0200 Subject: Move 'from' check to sendTransaction --- packages/web3-wrapper/src/marshaller.ts | 3 --- packages/web3-wrapper/src/web3_wrapper.ts | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/web3-wrapper') diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts index 84c351387..7af61752d 100644 --- a/packages/web3-wrapper/src/marshaller.ts +++ b/packages/web3-wrapper/src/marshaller.ts @@ -74,9 +74,6 @@ export const marshaller = { return tx; }, marshalTxData(txData: Partial): Partial { - if (_.isUndefined(txData.from)) { - throw new Error(`txData is missing required "from" address.`); - } const callTxDataBase = { ...txData, }; diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index d1e4c1edf..2d7b590b5 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -483,6 +483,9 @@ export class Web3Wrapper { * @returns Transaction hash */ public async sendTransactionAsync(txData: TxData): Promise { + if (_.isUndefined(txData.from)) { + throw new Error(`txData is missing required "from" address.`); + } const txDataHex = marshaller.marshalTxData(txData); const txHash = await this._sendRawPayloadAsync({ method: 'eth_sendTransaction', params: [txDataHex] }); return txHash; -- cgit v1.2.3