forked from WalletConnect/web3modal-vanilla-js-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
106 lines (78 loc) · 3.44 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<html>
<head>
<title>Web3modal example written in vanilla JavaScript and HTML</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Get some bootstrap default styles -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<!-- Construct a Bootstrap layout -->
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Web3modal example for vanille JavaScript and HTML</h1>
<p>No wallet connected. Connect wallet to show accounts and their ETH balances.</p>
<div class="alert alert-danger" id="alert-error-https" style="display: none">
You can run this example only over HTTPS connection.
</div>
<div id="prepare">
<button class="btn btn-primary" id="btn-connect">
Connect wallet
</button>
</div>
<div id="connected" style="display: none">
<button class="btn btn-primary" id="btn-disconnect">
Disconnect wallet
</button>
<hr>
<div id="network">
<p>
<strong>Connected blockchain:</strong> <span id="network-name"></span>
</p>
<p>
<strong>Selected account:</strong> <span id="selected-account"></span>
</p>
</div>
<hr>
<h3>All account balances</h3>
<table class="table table-listing">
<thead>
<th>Address</th>
<th>ETH balance</th>
</thead>
<tbody id="accounts">
</tbody>
</table>
<p>Please try to switch between different accounts in your wallet if your wallet supports this functonality.</p>
</div>
<br>
<div class="well">
<p class="text-muted">See also the <a href="https://web3modal.com/">TypeScript and React example application</a></p>
</div>
</div>
</div>
</div>
<!-- We use simple <template> templating for the example -->
<div id="templates" style="display: none">
<template id="template-balance">
<tr>
<th class="address"></th>
<td class="balance"></td>
</tr>
</template>
</div>
<!--
Use unpkg CDN to load all NPM packages to vanilla Javascript - read more at http://unpkg.com
On your deployment, you properly either want to use a preprocessing tool like webpack
to include these files, or extract NPM archives and manually host the files inside.
TODO: Pin down all versions.
-->
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/web3.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/index.js"></script>
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/umd/index.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/@walletconnect/[email protected]/dist/umd/index.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/fortmatic.js"></script>
<!-- This is our example code -->
<script type="text/javascript" src="./example.js"></script>
</body>
</html>