forked from svk31/steem-rpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
45 lines (38 loc) · 1.46 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
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div>Hello SteemRPC</div>
<div style="padding-top: 20px" id="success"></div>
<div style="padding-top: 20px">
<table>
<tbody id="dynamic_global"></tbody>
</table>
</div>
<script src="../build/steem-rpc.min.js"></script>
<script type="text/javascript">
var Api = new window.steemRPC();
Api.get().initPromise.then(response => {
console.log("Api ready:", response);
var sucessDiv = document.getElementById("success");
sucessDiv.innerText = "Successfully connected to the Steemit API, now fetching the global properties:"
Api.get().dbApi().exec("get_dynamic_global_properties", []).then(response => {
console.log("get_dynamic_global_properties", response);
var globalTable = document.getElementById("dynamic_global");
for (var key in response) {
var tr = document.createElement("tr");
var keyTd = document.createElement("td");
keyTd.innerText = key;
var definitionTd = document.createElement("td");
definitionTd.innerText = response[key];
tr.appendChild(keyTd);
tr.appendChild(definitionTd);
globalTable.appendChild(tr);
}
})
});
</script>
</body>
</html>