Web3WalletSendTransactionExample.cs 752 B

123456789101112131415161718192021222324
  1. using UnityEngine;
  2. using Web3Unity.Scripts.Library.Web3Wallet;
  3. public class Web3WalletSendTransactionExample : MonoBehaviour
  4. {
  5. async public void OnSendTransaction()
  6. {
  7. // https://chainlist.org/
  8. string chainId = "5"; // goerli
  9. // account to send to
  10. string to = "0xdD4c825203f97984e7867F11eeCc813A036089D1";
  11. // value in wei
  12. string value = "12300000000000000";
  13. // data OPTIONAL
  14. string data = "";
  15. // gas limit OPTIONAL
  16. string gasLimit = "";
  17. // gas price OPTIONAL
  18. string gasPrice = "";
  19. // send transaction
  20. string response = await Web3Wallet.SendTransaction(chainId, to, value, data, gasLimit, gasPrice);
  21. print(response);
  22. }
  23. }