This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
107 lines (90 loc) · 2.82 KB
/
index.js
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
var esss = require('./es-ss');
module.exports = esss
/* Example Usage below
// Importing into your application
let esss = require("es-ss.js");
let ESSS = esss.ESSS;
//Examples of setting the provider
// Ethereum (ETH) MainNet
let searchEngineProvider = new ESSS('https://ethereum.search.secondstate.io');
// Ethereum Classic (ETC) MainNet
//let searchEngineProvider = new ESSS('https://ethereum-classic.search.secondstate.io');
// CyberMiles (CMT) MainNet
//let searchEngineProvider = new ESSS('https://cmt.search.secondstate.io');
// CyberMiles (CMT) TestNet
//let searchEngineProvider = new ESSS('https://cmt-testnet.search.secondstate.io');
// SecondState DevChain
//let searchEngineProvider = new ESSS('https://devchain-es.secondstate.io/');
// Examples of function calls
// Please note, these examples all use ETH MainNet, you must reference your correct provider for your needs
//getAbiCount
var abiCount = searchEngineProvider.getAbiCount();
abiCount.then(function(result) {
console.log("Result is " + result);
})
.catch(function() {
console.log("Error");
});
//getAllCount
var allCount = searchEngineProvider.getAllCount();
allCount.then(function(result) {
console.log("Result is " + result);
})
.catch(function() {
console.log("Error");
});
//getContractCount
var contractCount = searchEngineProvider.getContractCount();
contractCount.then(function(result) {
console.log("Result is " + result);
})
.catch(function() {
console.log("Error");
});
//submitAbi
var abiSubmission = searchEngineProvider.submitAbi(abi, tx);
abiSubmission.then(function(result) {
console.log("Result is " + result);
})
.catch(function() {
console.log("Error");
});
//shaAbi
var abiSha = searchEngineProvider.shaAbi(abi);
abiSha.then(function(result) {
console.log("Result is " + result);
})
.catch(function() {
console.log("Error");
});
//searchUsingAbi
abiHash = '0x8d167c9d853afbe7638706bf45f613cd7d8b6e8fdb8bab069052105b7bf9b3c4';
var abiSearch = searchEngineProvider.searchUsingAbi(abiHash);
abiSearch.then(function(result) {
console.log("Result is " + result);
})
.catch(function() {
console.log("Error");
});
//searchUsingKeywords
keywords = {};
keywords["keywords"] = ['cybermiles, cmt'];
var keywordSearch = searchEngineProvider.searchUsingKeywords(keywords);
keywordSearch.then(function(result) {
console.log("Result is " + result);
})
.catch(function() {
console.log("Error");
});
// searchUsingKeywordsAndAbi
abiHash = '0x8d167c9d853afbe7638706bf45f613cd7d8b6e8fdb8bab069052105b7bf9b3c4';
keywords = {};
keywords["keywords"] = ['ETHLIUM'];
var keywordAbiSearch = searchEngineProvider.searchUsingKeywordsAndAbi(abiHash, keywords);
keywordAbiSearch.then(function(result) {
console.log("Result is " + result);
})
.catch(function() {
console.log("Error");
});
*/