-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.html
48 lines (43 loc) · 1.28 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<title>DashSight Demo</title>
<meta charset="UTF-8" />
</head>
<body>
<h1>Open the Console!</h1>
<script src="./dashsight.js"></script>
<script src="./dashsocket.js"></script>
<script>
(function () {
let address = "XmCyQ6qARLWXap74QubFMunngoiiA1QgCL";
let baseUrl = "https://insight.dash.org";
async function main() {
let dashsight = window.DashSight.create({
baseUrl: baseUrl,
});
dashsight.getInstantBalance(address).then(function (info) {
console.info(`Current balance is: Đ${info.balance}`);
window.alert(
`Current balance of '${address}' is: Đ${info.balance}`,
);
});
await window.DashSocket.listen(
baseUrl,
function finder(evname, data) {
console.log(evname, data);
let json = JSON.stringify(data, null, 2);
window.alert(`Event '${evname}':\n${json}`);
},
{ debug: true },
);
}
console.log("Trying...");
main().catch(function (err) {
console.error("Fail:");
console.error(err.stack || err);
});
})();
</script>
</body>
</html>