diff --git a/lib/web3/function.js b/lib/web3/function.js index a480c86..9857d5b 100644 --- a/lib/web3/function.js +++ b/lib/web3/function.js @@ -65,7 +65,10 @@ SolidityFunction.prototype.extractDefaultBlock = function (args) { SolidityFunction.prototype.validateArgs = function (args) { var inputArgs = args.filter(function (a) { // filter the options object but not arguments that are arrays - return !(utils.isObject(a) === true && utils.isArray(a) === false); + return !( (utils.isObject(a) === true) && + (utils.isArray(a) === false) && + (utils.isBigNumber(a) === false) + ); }); if (inputArgs.length !== this._inputTypes.length) { throw errors.InvalidNumberOfSolidityArgs(); diff --git a/test/contract.js b/test/contract.js index a7e7247..77dbfdf 100644 --- a/test/contract.js +++ b/test/contract.js @@ -478,6 +478,30 @@ describe('contract', function () { contract.send(address, 17, {from: address, gas: 50000, gasPrice: 3000, value: 10000}); }); + it('should sendTransaction with bigNum param and optional params', function () { + var provider = new FakeHttpProvider(); + var web3 = new Web3(provider); + var signature = 'send(address,uint256)'; + var address = '0x1234567890123456789012345678901234567891'; + provider.injectValidation(function (payload) { + assert.equal(payload.method, 'eth_sendTransaction'); + assert.deepEqual(payload.params, [{ + data: '0x' + sha3(signature).slice(0, 8) + + '0000000000000000000000001234567890123456789012345678901234567891' + + '0000000000000000000000000000000000000000000000000000000000000011' , + to: address, + from: address, + gas: '0xc350', + gasPrice: '0xbb8', + value: '0x2710' + }]); + }); + + var contract = web3.eth.contract(desc).at(address); + + contract.send(address, new BigNumber(17), {from: address, gas: 50000, gasPrice: 3000, value: 10000}); + }); + it('should explicitly sendTransaction with optional params', function () { var provider = new FakeHttpProvider(); var web3 = new Web3(provider);