xf00f/web3x

Some Account methods incorrectly receive Tx object

alcuadrado opened this issue · 4 comments

Account.prototype.sendTransaction and Account.prototype.sendTransaction receive Tx objects as their first parameter. They should receive something like:

interface LocalAccountTx {
    nonce?: string | number;
    chainId?: string | number;
    to?: string;
    data?: string;
    value?: string | number;
    gas: string | number;
    gasPrice?: string | number;
}

as the from param doesn't make sense here, and the gas param is required.

xf00f commented

Good call. I suspect gas should not be optional on the Tx type either. I based it off the optional suggestion here but I think the documentation is wrong. https://web3js.readthedocs.io/en/1.0/web3-eth.html#sendtransaction

xf00f commented

On second thoughts the docs there do not specify gas in the examples. Let me dig into that deeper.

xf00f commented

@alcuadrado On branch v2.0.0 I have enforced gas as a necessary property. I'll wait a bit before merging this branch in, so if you spot any other issues let me know.

xf00f commented

This has been merged.