-
Notifications
You must be signed in to change notification settings - Fork 0
/
frontendMock.html
148 lines (137 loc) · 5.95 KB
/
frontendMock.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script src="./dist/index.bundle.js"></script>
<script>
window.addEventListener('load', async function () {
const OT_NODE_HOSTNAME = 'alpha-stella-node-06.origin-trail.network';
const OT_NODE_PORT = '8900';
let options = { endpoint: OT_NODE_HOSTNAME, port: OT_NODE_PORT, useSSL: true, loglevel: 'trace' };
this.dkg = new SemanticWeb3(options);
this.dkg.nodeInfo().then(result => {
console.log('============ Node info results ===================');
console.log(JSON.stringify(result, null, 2));
console.log('===============================');
});
// SET & GET
// options = {
// keywords: ['ETHDenver'],
// visibility: 'public'
// };
//
// const content = {
// "@context": "https://www.schema.org/",
// "@type": "ERC721",
// "asset_data": {
// "properties": {
// "prop1": "value1",
// "prop2": {
// "abc":"ads",
// "abs":"adsb"
// },
// },
//
// "urls": "https://opensea.io/assets/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/8520"
//
// },
// "native_blockchain": "polygon",
// "onchain_data": {
// "contract_address": "0x123",
// "tokenID": "32",
// "tokenURI": "....",
// "owner": "0x12345431",
// "name": "Tracie 101 Updated",
// "symbol": "TRACIE",
// "eventHistory": [{
// "timestamp": "2020-10-12",
// "from": "0x123",
// "to": "0x343",
// "event": "Transfer",
// },
// {
// "timestamp": "2020-09-11",
// "from": "0x123",
// "to": "0x343",
// "event": "Sale",
// "price": "1.23",
// "currency": "ETH",
// }
//
// ]
// },
// "erc721_metadata": {
// "title": "Asset Metadata",
// "type": "object",
// "properties": {
// "name": {
// "type": "string",
// "description": "Identifies the asset to which this NFT represents"
// },
// "description": {
// "type": "string",
// "description": "Describes the asset to which this NFT represents"
// },
// "image": {
// "type": "string",
// "description": "A URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive."
// }
// }
// },
// "linkedTo": [
// "ual1",
// "ual2",
// ]
// }
// let result = await dkg.assets.create(content,options)
// let ual = result.data.metadata.UALs[0];
// console.log(`Created UAL is ${ual}`)
//
// let asset = await dkg.assets.get(ual);
//
// const proof = await asset.data.proof.valueOf;
// console.log(`Proof is ${JSON.stringify(proof)}}`)
// SEARCH
// options = { query: 'ETHDenver', resultType: 'assertions' }; //or entities
// await dkg.search(options).then((result) => {
// console.log('============ Search results ===================');
// console.log(JSON.stringify(result, null, 2));
// console.log('===============================');
// });
// QUERY
// retrieve all connected UALs for given UAL
// ual = 'a44c97e1a27eab0db298f01f1a5d7c9d84caed8c7ce91480acaf92989888fc37';
// options = {
// query: `PREFIX schema: <http://schema.org/>
// construct { ?b2 schema:linkedTo ?linkedAssets }
// WHERE {
// GRAPH ?g {
// ?b1 schema:linkedTo ?linkedAssets .
// }
// ?b2 schema:hasUALs '${ual}'
// FILTER (?g = ?b2)
// }`
// };
//
// // all states for an asset
// ual = 'a44c97e1a27eab0db298f01f1a5d7c9d84caed8c7ce91480acaf92989888fc37';
// options = {
// query: `PREFIX schema: <http://schema.org/>
// construct { ?assertionId schema:hasUALs ?assertionId }
// WHERE {
// ?assertionId schema:hasUALs '${ual}' .
// }`
// };
//
// await dkg.query(options).then((result) => {
// console.log('============ Query results ===================');
// console.log(JSON.stringify(result, null, 2));
// console.log('===============================');
// });
});
</script>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>