Move 'from' check to sendTransaction

This commit is contained in:
Fabio Berger
2018-07-05 12:03:34 +02:00
parent b0daec8384
commit 3d67f122a5
2 changed files with 3 additions and 3 deletions

View File

@@ -74,9 +74,6 @@ export const marshaller = {
return tx;
},
marshalTxData(txData: Partial<TxData>): Partial<TxDataRPC> {
if (_.isUndefined(txData.from)) {
throw new Error(`txData is missing required "from" address.`);
}
const callTxDataBase = {
...txData,
};

View File

@@ -483,6 +483,9 @@ export class Web3Wrapper {
* @returns Transaction hash
*/
public async sendTransactionAsync(txData: TxData): Promise<string> {
if (_.isUndefined(txData.from)) {
throw new Error(`txData is missing required "from" address.`);
}
const txDataHex = marshaller.marshalTxData(txData);
const txHash = await this._sendRawPayloadAsync<string>({ method: 'eth_sendTransaction', params: [txDataHex] });
return txHash;