forked from boringcrypto/BoringFinance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
40 lines (32 loc) · 1.29 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<html>
<body>
<script src="https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js"></script>
<script src="sushiswap.js"></script>
<script>
async function go() {
// Connect to wallet
web3 = new Web3(window.ethereum);
let addresses = await window.ethereum.enable();
// Create SushiSwapJs
let sushiswap = new SushiSwap(web3);
sushiswap.auto_update(async function () {
// Retieve all info for the first wallet address
await sushiswap.getInfo(addresses[0]);
await sushiswap.getMakerInfo();
// Display all info nicely in html
document.getElementById("base").textContent
= JSON.stringify(sushiswap.base, null, 2);
document.getElementById("pools").textContent
= JSON.stringify(sushiswap.pools, null, 2);
document.getElementById("maker").textContent
= JSON.stringify(sushiswap.makerPairs, null, 2);
}, true);
}
</script>
<h1>SushiSwapJs</h1>
<pre id="base"></pre>
<pre id="pools"></pre>
<pre id="maker"></pre>
<button onclick="go()">Go!</button>
</body>
</html>