nebulasio / neb.js

GNU Lesser General Public License v3.0
83 stars 46 forks source link

Always response: Error: invalid argument(s) . when call sendRawTranscation on nodejs side #36

Closed flyonce closed 6 years ago

flyonce commented 6 years ago

Hey when i try to send transaction by api 'sendRawTransaction' on nodejs side, it always result in error like below:

Error: invalid argument(s)
    at /Users/jazz/Desktop/个人/NAS钱包/proj/nodeserver/node_modules/nebulas/lib/httprequest.js:48:19
    at <anonymous>
    at process._tickCallback `(internal/process/next_tick.js:188:7)

may anyone has ideals, i test it on testnet: https://testnet.nebulas.io/ and my code is:

var callContract = function(params) {
    neb.api.getAccountState(params.from).then(function (resp) {
        params.nonce = parseInt(resp.nonce) + 1;
        var gTx = new nebulas.Transaction(globalParams.chainId,
        globalParams.account,params.to, params.value, params.nonce, params.gasPrice, params.gasLimit, params.contract);

        console.log(gTx);

        gTx.signTransaction();

        console.log(gTx);

        neb.api.sendRawTransaction(gTx.toProtoString()).then(function (resp) {
            console.log(JSON.stringify(resp));
        })
        .catch(function (err) {
            console.log(err);
        });
    });
};
yupnano commented 6 years ago

it should be the problem of your params. Please show more information about it.

ChengOrangeJu commented 6 years ago

Issue closed for now. If there still pending issues, please reopen this ticket, thanks @flyonce