1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SendRawTransaction not working as expected

Discussion in 'Finance' started by stackdisplay, Oct 8, 2018.

  1. stackdisplay

    stackdisplay Guest

    I have a solidity function as follow, where I send directly via web3@1.0 with unlock accounts it works correctly. But it is not when i sendRawTransaction with web3@0.2. I can interact with the contract but the function does not work properly.

    I am thinking that I did something wrong in data string (eg: I supposed to convert the param to certain format before passing in to data)

    transferPreSigned(bytes _signature, address _from, address _to, uint256 _value, uint256 _gasPrice, uint256 _nonce)


    web3@1.0 call (working)

    let transferPreSigned = await contract.methods.transferPreSigned(
    signatureRPC,
    from,
    to,
    value,
    gasPrice,
    nonce
    ).send({
    from: accounts[1],
    gas: '1000000'
    });


    web3@0.2 send raw transaction (not working)

    var dataString = token.transferPreSigned.getData(
    signatureRPC,
    from,
    to,
    value,
    gasPrice,
    nonce
    );

    var rawTransaction = {
    ...
    ...
    data: dataString
    };

    Login To add answer/comment
     

Share This Page