Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var rawTransaction = {
- "from": callerAddress,
- "gasPrice": gasParams[0], //always 0 for SKALE
- "gasLimit": gasParams[1], //always 8MM for SKALE
- "to": contractAddr,
- "data": encodedFunction[1],
- "nonce": web3.utils.toHex(nonce)
- }
- var transaction = new EthereumTx(rawTransaction);
- const privateKeyBuffer = Buffer.from(privateKey, 'hex');
- //signing transaction with private key
- await transaction.sign(privateKeyBuffer);
- console.log("trying to call contract...")
- return new Promise(async (resolve, reject) => {
- //sending transaction via web3js
- web3
- .eth
- .sendSignedTransaction('0x' + transaction.serialize().toString('hex'))
- .on('receipt', (receipt) => {
- resolve({"code": 200, "result": receipt})
- })
- .on('error', (error) => {
- console.log(error)
- resolve({"code": 500, "result": error})
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement