sendSignedTransaction

Mexa supports signed transactions out of the box

Create a raw transaction interacting with smart contract functions and sign transaction using web3.eth.accounts.signTransaction(<raw transaction>, <private key> and Mexa will handle the transaction out of the box and execute the transaction without letting user pay any gas fee.

No need to sign any extra messages, no extra popups, no gas required in account corresponding to the <private key>

Example Code

let address = <wallet public address>;
let privateKey = <0x address private key>;
let txParams = {
"from": address,
"gasPrice": web3js.utils.toHex(20 * 1e9),
"gasLimit": web3js.utils.toHex(210000),
"to": contractAddress,
"value": "0x0",
"data": contract.methods.addRating(1, 5).encodeABI()
};
txParams.nonce = await web3.eth.getTransactionCount(address);
let signedTx = web3.eth.accounts.signTransaction(txParams, privateKey);
web3.eth.sendSignedTransaction(signedTx.rawTransaction);