-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
59 lines (42 loc) · 2.29 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
49
50
51
52
53
54
55
56
57
58
59
<script src="/src/content/OrdJS.js" ></script>
<script>
/**
* OrdJS Library Usage Example
*
* Demonstrates importing and utilizing the OrdJS Library for interacting with the Ordinals Recursive Endpoints.
* It showcases initializing OrdJS, fetching inscription data, block information, and more.
* `loadAllScripts` dynamically loads the OrdJS script and initializes the library.
*/
const ord = new OrdJS('https://testnet.ordinals.com');
async function main() {
try {
const inscriptionId = await ord.getInscriptionId();
console.log('Current InscriptionId', inscriptionId);
const blockhash = await ord.getBlockhash();
console.log('Latest blockhash:', blockhash);
const blockhash2 = await ord.getBlockhash(0);
console.log('Blockhash 0:', blockhash2);
const blockheight = await ord.getBlockheight();
console.log('Latest blockheight:', blockheight);
const blocktime = await ord.getBlocktime();
console.log('Latest blocktime:', blocktime);
const children = await ord.getChildren('eb204796f838b8c56c0e899cea56f35d24467c3055115560233a5d1cc9c79ec5i0');
console.log('Childrens', children);
const metadata = await ord.getMetadata('eb204796f838b8c56c0e899cea56f35d24467c3055115560233a5d1cc9c79ec5i0');
console.log('Metadata', metadata);
const metadataDecoded = await ord.getDecodedMetadata('eb204796f838b8c56c0e899cea56f35d24467c3055115560233a5d1cc9c79ec5i0')
console.log('Decoded metadata', metadataDecoded);
const satInscriptions = await ord.getSatInscriptions(1415569498239777);
console.log('Sat Inscriptions', satInscriptions);
const inscriptionContent = await ord.getInscriptionContent('eb204796f838b8c56c0e899cea56f35d24467c3055115560233a5d1cc9c79ec5i0');
console.log('Inscription content', inscriptionContent);
const satLastInscriptions = await ord.getSatLastInscription(1415569498239777);
console.log('Sat Last Inscription', satLastInscriptions);
const satLastInscriptionContent = await ord.getSatLastInscriptionContent(1415569498239777);
console.log('Sat Last Inscription Content', satLastInscriptionContent);
} catch (error) {
console.error('Error:', error);
}
}
main();
</script>