Skip to content

Commit e029a51

Browse files
authored
Merge pull request #123 from ChainSafe/cronos_template_documentation
Cronos template / standard Web3GL Template / Documentation
2 parents 5d07112 + d6857f6 commit e029a51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+772
-54
lines changed
130 Bytes
Binary file not shown.
130 Bytes
Binary file not shown.

Web3Unity/Documentation/ERC20.pdf

130 Bytes
Binary file not shown.

Web3Unity/Documentation/ERC721.pdf

130 Bytes
Binary file not shown.
130 Bytes
Binary file not shown.
130 Bytes
Binary file not shown.

Web3Unity/Documentation/WebGL.pdf

130 Bytes
Binary file not shown.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Unity ^2020.1.0 Web3GL Template
2+
3+
## Methods in Browser
4+
5+
![](https://user-images.githubusercontent.com/19412160/149653806-b2c4ca54-1986-4481-bd61-721dbd8a7967.png)
6+
7+
Dispay login modal:
8+
9+
```javascript
10+
window.web3gl.connect();
11+
```
12+
13+
Get Network:
14+
15+
```javascript
16+
window.web3gl.networkId;
17+
```
18+
19+
Get Connected Address:
20+
21+
```javascript
22+
window.web3gl.connectAccount;
23+
```
24+
25+
To Send Transaction:
26+
27+
```javascript
28+
const to = "0xdD4c825203f97984e7867F11eeCc813A036089D1";
29+
const value = "12300000000000000";
30+
const gasLimit = "21000"; // gas limit
31+
const gasPrice = "33333333333";
32+
window.web3gl.sendTransaction(to, value, gasLimit, gasPrice);
33+
```
34+
35+
To Interact with Contract:
36+
37+
```javascript
38+
const method = "increment";
39+
const abi = `[ { "inputs": [], "name": "increment", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "x", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" } ]`;
40+
const contract = "0xB6B8bB1e16A6F73f7078108538979336B9B7341C";
41+
const args = "[]";
42+
const value = "0";
43+
const gasLimit = "222222"; // gas limit
44+
const gasPrice = "333333333333";
45+
window.web3gl.sendContract(method, abi, contract, args, value, gasLimit, gasPrice);
46+
```
47+
48+
## Enable Torus
49+
50+
In `web3/index.js`
51+
52+
Uncomment
53+
54+
```javascript
55+
document.body.appendChild(Object.assign(document.createElement("script"), { type: "text/javascript", src: "https://unpkg.com/@toruslabs/torus-embed" }));
56+
```
57+
58+
```javascript
59+
const providerOptions = {
60+
torus: {
61+
package: Torus,
62+
}
63+
};
64+
```
65+
66+
## Enable WalletConnect
67+
68+
In `web3/index.js`
69+
70+
Uncomment
71+
72+
```javascript
73+
document.body.appendChild(Object.assign(document.createElement("script"), { type: "text/javascript", src: "https://unpkg.com/@walletconnect/web3-provider@1.2.1/dist/umd/index.min.js" }));
74+
```
75+
76+
```javascript
77+
const providerOptions = {
78+
walletconnect: {
79+
package: window.WalletConnectProvider.default,
80+
options: {
81+
infuraId: "00000000000000000000000000000000",
82+
},
83+
}
84+
};
85+
```
86+
87+
Replace `infuraId: "00000000000000000000000000000000"`
88+
89+
![](https://user-images.githubusercontent.com/19412160/149654154-3a9a5066-1c8b-42cd-90f9-204014b56154.png)

WebGLTemplates/Cronos_Defi_Wallet/README.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WebGLTemplates/Cronos_Defi_Wallet/TemplateData.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)