'How to call a smart contract function with WalletConnect? (React.js, Node.js)

Is it actually possible to call a smart contract function using WalletConnect?

There is a documentation on official website that explains how to establish connection with the user via WalletConnect. However, when it comes to some actions after connection is established, everyone uses a coins transfer, from one wallet to another:

// Draft transaction
const tx = {
  from: "0xbc28Ea04101F03aA7a94C1379bc3AB32E65e62d3", // Required
  to: "0x89D24A7b4cCB1b6fAA2625Fe562bDd9A23260359", // Required (for non contract deployments)
  data: "0x", // Required
  gasPrice: "0x02540be400", // Optional
  gas: "0x9c40", // Optional
  value: "0x00", // Optional
  nonce: "0x0114", // Optional
};

// Send transaction
walletConnector.sendTransaction(tx);

My question is: instead of making a coins transfer, is it possbile to call a payable function in a smart contract? The function accepts some custom parameters (like string and uint256). Smart contract is deployed. If yes - how?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source