Blockchain 使用web3 0.20.0和Infura发送原始事务

Blockchain 使用web3 0.20.0和Infura发送原始事务,blockchain,smartcontracts,web3js,Blockchain,Smartcontracts,Web3js,我想使用web3 0.20.0和infura发送一个原始事务。这是我的RawTransaction对象: var data = instance.MyMethod(‘123'); var rawTransaction = { "from": myAddress, "nonce": web3js.toHex(count), "gasPrice": web3js.toHex(gasPrice), "gasLimit": web3js.toHex(gasLimit),

我想使用web3 0.20.0和infura发送一个原始事务。这是我的RawTransaction对象:

var data = instance.MyMethod(‘123');

var rawTransaction = {
    "from": myAddress,
    "nonce": web3js.toHex(count),
    "gasPrice": web3js.toHex(gasPrice),
    "gasLimit": web3js.toHex(gasLimit),
    "to": ‘contractAddress,
    "value": "0x1",
    "data": data,
    "chainId": 0x03
};
我对应该写在合同上的“数据”有问题

网络上所有使用web3 1.0版本的示例如下所示:

var data = instance.MyMethod(‘123’).encodeABI();

var rawTransaction = {
    "from": myAddress,
    "nonce": web3js.toHex(count),
    "gasPrice": web3js.toHex(gasPrice),
    "gasLimit": web3js.toHex(gasLimit),
    "to": contractAddress’,
    "value": "0x1",
    "data": data,
    "chainId": 0x03
};
函数encodeABI()在web3 0.20.0中不存在

因此,请帮助我如何使用web3 0.20.0发送原始事务


Tnx

getData()
encodeABI()
的0.20.x版本。谢谢@smarx!