Skip to content

iamcapote/DOS_UNITYARCADE

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity ^2020.1.0 Web3GL Template

Methods in Browser

Dispay login modal:

window.web3gl.connect();

Get Network:

window.web3gl.networkId;

Get Connected Address:

window.web3gl.connectAccount;

To Send Transaction:

const to = "0xdD4c825203f97984e7867F11eeCc813A036089D1";
const value = "12300000000000000";
const gasLimit = "21000"; // gas limit
const gasPrice = "33333333333";
window.web3gl.sendTransaction(to, value, gasLimit, gasPrice);

To Interact with Contract:

const method = "increment";
const abi = `[ { "inputs": [], "name": "increment", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "x", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ]`;
const contract = "0xB6B8bB1e16A6F73f7078108538979336B9B7341C";
const args = "[]";
const value = "0";
const gasLimit = "222222"; // gas limit
const gasPrice = "333333333333";
window.web3gl.sendContract(method, abi, contract, args, value, gasLimit, gasPrice);

Enable Torus

In web3/index.js

Uncomment

document.body.appendChild(Object.assign(document.createElement("script"), { type: "text/javascript", src: "https://unpkg.com/@toruslabs/torus-embed" }));
  const providerOptions = {
    torus: {
      package: Torus,
    }
  };

Enable WalletConnect

In web3/index.js

Uncomment

document.body.appendChild(Object.assign(document.createElement("script"), { type: "text/javascript", src: "https://unpkg.com/@walletconnect/[email protected]/dist/umd/index.min.js" }));
  const providerOptions = {
    walletconnect: {
      package: window.WalletConnectProvider.default,
      options: {
        infuraId: "00000000000000000000000000000000",
      },
    }
  };

Replace infuraId: "00000000000000000000000000000000"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 60.9%
  • HTML 30.1%
  • CSS 9.0%