-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
115 lines (89 loc) · 3.54 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
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html>
<head>
<title>demo eosjs-name</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/css/bootstrap-grid.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@100;300&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/monokai-sublime.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/eosjs-account-name@2.3.0/lib/index.js" id="id-sc-include-js"></script>
<!-- <script src="../lib/index.js" id="id-sc-include-js"></script> -->
<style>
body {
font-family: 'Lato', sans-serif;
}
</style>
</head>
<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<h1>Hello <i>eosjsName</i></h1>
<h2>Import the script</h2>
<pre><code id="id-code-include-js" class="lang-html"></code></pre>
<p>After import, the library name is <b>eosjsName</b>.</p>
<h2>Convert <i>eosio</i> to <i>uint64</i></h2>
<p><b>uint64</b> value of <i>eosio</i> is: <b id="id-nameToUint64"></b></p>
<pre><code id="id-code-nameToUint64" class="lang-javascript"></code></pre>
<h2>Convert <i>uint64</i> to <i>eosio</i></h2>
<p><b>eosio name</b> value of <i>6138663577826885632</i> is: <b id="id-uint64ToName"></b></p>
<pre><code id="id-code-uint64ToName" class="lang-javascript"></code></pre>
<h2>The library also support to get representation of symbol</h2>
<p>
Suppose that we want to know what is value of <strong><i>........ehbo5</i></strong> in the following query:
<pre>
<code class="lang-bash">
cleos -u https://eos.greymass.com get scope eosio.token -t stat
{
"rows": [{
"code": "eosio.token",
"scope": "........ehbo5",
"table": "stat",
"payer": "eosio.token",
"count": 1
}
],
"more": "12345zzxxxxx"
}
</code>
</pre>
</p>
<p>Its value is: <b id="id-symbol.toName"></b></p>
<pre>
<code id="id-code-symbol.toName" class="lang-javascript"></code>
</pre>
</div>
</div>
</div>
<script id="id-sc-nameToUint64">
document.getElementById('id-nameToUint64').innerHTML = eosjsName.nameToUint64('eosio');
</script>
<script id="id-sc-uint64ToName">
document.getElementById('id-uint64ToName').innerHTML = eosjsName.uint64ToName(
'6138663577826885632',
);
</script>
<script id="id-sc-symbol.toName">
document.getElementById('id-symbol.toName').innerHTML = eosjsName.symbol.toName(
eosjsName.nameToUint64('........ehbo5'),
);
</script>
<script>
// show highlighted code snippets
document.getElementById('id-code-include-js').innerText = document.getElementById(
'id-sc-include-js',
).outerHTML;
document.getElementById('id-code-nameToUint64').innerText = document.getElementById(
'id-sc-nameToUint64',
).innerText;
document.getElementById('id-code-uint64ToName').innerText = document.getElementById(
'id-sc-uint64ToName',
).innerText;
document.getElementById('id-code-symbol.toName').innerText = document.getElementById(
'id-sc-symbol.toName',
).innerText;
hljs.initHighlightingOnLoad();
</script>
</body>
</html>