-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.html
More file actions
70 lines (57 loc) · 2.19 KB
/
index.html
File metadata and controls
70 lines (57 loc) · 2.19 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="./ravencore-lib.js"></script>
</head>
<body>
<h1>ravencore-lib + Insight API</h1>
<script type="text/javascript">
var ravencore = require('ravencore-lib');
console.log(new ravencore.PrivateKey(undefined, 'testnet'));
var insight = ravencore.Insight('https://vinx.mediciventures.com/api');
console.log(insight);
var addr1 = 'n2qLg9ZD295fDpjEMUgqoXfqKC1UfWM3ux';
var asset1 = 'VINX';
var addr2 = 'n4iwgt88k53b6P6KBDGfgs48hvEATbDdG6';
function writeJsonBodyToElement(id) {
return (err, res, body) => {
document.getElementById(id).innerHTML = JSON.stringify(body, null, 4);
};
}
function writeJsonValueToElement(id) {
return (json) => {
document.getElementById(id).innerHTML = JSON.stringify(json, null, 4);
};
}
</script>
<hr/>
<h2>GET Passthrough: get('/status?q=getInfo')</h2>
<p>Pass through any <a href="https://github.com/RavenDevKit/insight-api">Insight</a> URL (the part after "/api").</p>
<pre id="passthrough"></pre>
<script>
insight.passthroughGet("/status?q=getInfo", writeJsonBodyToElement("passthrough"));
</script>
<hr />
<h2>addrAssetUtxo('n2qLg9ZD295fDpjEMUgqoXfqKC1UfWM3ux', 'VINX')</h2>
<p>Get the UTXO set for an address/asset combination.</p>
<pre id="addrAssetUtxo"></pre>
<script>
insight.addrAssetUtxo(addr1, asset1, writeJsonBodyToElement("addrAssetUtxo"));
</script>
<hr />
<h2>addrAssets('n4iwgt88k53b6P6KBDGfgs48hvEATbDdG6')</h2>
<p>Get a summary of all assets owned by an address (currently just total quantity owned).</p>
<pre id="addrAssets"></pre>
<script>
insight.addrAssets(addr2, writeJsonValueToElement("addrAssets"));
</script>
<hr/>
<h2>addrTxs('n4iwgt88k53b6P6KBDGfgs48hvEATbDdG6')</h2>
<p>Get a list of all transactions associated with an address (includes asset information).</p>
<pre id="addrTxs"></pre>
<script>
insight.addrTxs(addr2, writeJsonBodyToElement("addrTxs"));
</script>
</body>
</html>