@0xsequence/indexer 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,6 +36,7 @@ const WebRPCSchemaHash = 'b53b368f85445da25796f8cc90459c61425c13f4';
|
|
|
36
36
|
//
|
|
37
37
|
// Types
|
|
38
38
|
//
|
|
39
|
+
|
|
39
40
|
let ContractType = /*#__PURE__*/function (ContractType) {
|
|
40
41
|
ContractType["UNKNOWN"] = "UNKNOWN";
|
|
41
42
|
ContractType["ERC20"] = "ERC20";
|
|
@@ -87,6 +88,8 @@ let SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
|
87
88
|
//
|
|
88
89
|
class Indexer {
|
|
89
90
|
constructor(hostname, fetch) {
|
|
91
|
+
this.hostname = void 0;
|
|
92
|
+
this.fetch = void 0;
|
|
90
93
|
this.path = '/rpc/Indexer/';
|
|
91
94
|
this.ping = headers => {
|
|
92
95
|
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
@@ -285,15 +288,16 @@ const buildResponse = res => {
|
|
|
285
288
|
if (!res.ok) {
|
|
286
289
|
throw data; // webrpc error response
|
|
287
290
|
}
|
|
288
|
-
|
|
289
291
|
return data;
|
|
290
292
|
});
|
|
291
293
|
};
|
|
292
294
|
|
|
293
295
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
294
296
|
class SequenceIndexer extends Indexer {
|
|
295
|
-
constructor(hostname,
|
|
297
|
+
constructor(hostname, projectAccessKey, jwtAuth) {
|
|
296
298
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
299
|
+
this.projectAccessKey = projectAccessKey;
|
|
300
|
+
this.jwtAuth = jwtAuth;
|
|
297
301
|
this._fetch = (input, init) => {
|
|
298
302
|
// automatically include jwt and access key auth header to requests
|
|
299
303
|
// if its been set on the api client
|
|
@@ -311,8 +315,6 @@ class SequenceIndexer extends Indexer {
|
|
|
311
315
|
init.headers = _extends({}, init.headers, headers);
|
|
312
316
|
return fetch(input, init);
|
|
313
317
|
};
|
|
314
|
-
this.projectAccessKey = _projectAccessKey;
|
|
315
|
-
this.jwtAuth = _jwtAuth;
|
|
316
318
|
this.fetch = this._fetch;
|
|
317
319
|
}
|
|
318
320
|
}
|
|
@@ -36,6 +36,7 @@ const WebRPCSchemaHash = 'b53b368f85445da25796f8cc90459c61425c13f4';
|
|
|
36
36
|
//
|
|
37
37
|
// Types
|
|
38
38
|
//
|
|
39
|
+
|
|
39
40
|
let ContractType = /*#__PURE__*/function (ContractType) {
|
|
40
41
|
ContractType["UNKNOWN"] = "UNKNOWN";
|
|
41
42
|
ContractType["ERC20"] = "ERC20";
|
|
@@ -87,6 +88,8 @@ let SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
|
87
88
|
//
|
|
88
89
|
class Indexer {
|
|
89
90
|
constructor(hostname, fetch) {
|
|
91
|
+
this.hostname = void 0;
|
|
92
|
+
this.fetch = void 0;
|
|
90
93
|
this.path = '/rpc/Indexer/';
|
|
91
94
|
this.ping = headers => {
|
|
92
95
|
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
@@ -285,15 +288,16 @@ const buildResponse = res => {
|
|
|
285
288
|
if (!res.ok) {
|
|
286
289
|
throw data; // webrpc error response
|
|
287
290
|
}
|
|
288
|
-
|
|
289
291
|
return data;
|
|
290
292
|
});
|
|
291
293
|
};
|
|
292
294
|
|
|
293
295
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
294
296
|
class SequenceIndexer extends Indexer {
|
|
295
|
-
constructor(hostname,
|
|
297
|
+
constructor(hostname, projectAccessKey, jwtAuth) {
|
|
296
298
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
299
|
+
this.projectAccessKey = projectAccessKey;
|
|
300
|
+
this.jwtAuth = jwtAuth;
|
|
297
301
|
this._fetch = (input, init) => {
|
|
298
302
|
// automatically include jwt and access key auth header to requests
|
|
299
303
|
// if its been set on the api client
|
|
@@ -311,8 +315,6 @@ class SequenceIndexer extends Indexer {
|
|
|
311
315
|
init.headers = _extends({}, init.headers, headers);
|
|
312
316
|
return fetch(input, init);
|
|
313
317
|
};
|
|
314
|
-
this.projectAccessKey = _projectAccessKey;
|
|
315
|
-
this.jwtAuth = _jwtAuth;
|
|
316
318
|
this.fetch = this._fetch;
|
|
317
319
|
}
|
|
318
320
|
}
|
|
@@ -32,6 +32,7 @@ const WebRPCSchemaHash = 'b53b368f85445da25796f8cc90459c61425c13f4';
|
|
|
32
32
|
//
|
|
33
33
|
// Types
|
|
34
34
|
//
|
|
35
|
+
|
|
35
36
|
let ContractType = /*#__PURE__*/function (ContractType) {
|
|
36
37
|
ContractType["UNKNOWN"] = "UNKNOWN";
|
|
37
38
|
ContractType["ERC20"] = "ERC20";
|
|
@@ -83,6 +84,8 @@ let SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
|
83
84
|
//
|
|
84
85
|
class Indexer {
|
|
85
86
|
constructor(hostname, fetch) {
|
|
87
|
+
this.hostname = void 0;
|
|
88
|
+
this.fetch = void 0;
|
|
86
89
|
this.path = '/rpc/Indexer/';
|
|
87
90
|
this.ping = headers => {
|
|
88
91
|
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
@@ -281,15 +284,16 @@ const buildResponse = res => {
|
|
|
281
284
|
if (!res.ok) {
|
|
282
285
|
throw data; // webrpc error response
|
|
283
286
|
}
|
|
284
|
-
|
|
285
287
|
return data;
|
|
286
288
|
});
|
|
287
289
|
};
|
|
288
290
|
|
|
289
291
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
290
292
|
class SequenceIndexer extends Indexer {
|
|
291
|
-
constructor(hostname,
|
|
293
|
+
constructor(hostname, projectAccessKey, jwtAuth) {
|
|
292
294
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
295
|
+
this.projectAccessKey = projectAccessKey;
|
|
296
|
+
this.jwtAuth = jwtAuth;
|
|
293
297
|
this._fetch = (input, init) => {
|
|
294
298
|
// automatically include jwt and access key auth header to requests
|
|
295
299
|
// if its been set on the api client
|
|
@@ -307,8 +311,6 @@ class SequenceIndexer extends Indexer {
|
|
|
307
311
|
init.headers = _extends({}, init.headers, headers);
|
|
308
312
|
return fetch(input, init);
|
|
309
313
|
};
|
|
310
|
-
this.projectAccessKey = _projectAccessKey;
|
|
311
|
-
this.jwtAuth = _jwtAuth;
|
|
312
314
|
this.fetch = this._fetch;
|
|
313
315
|
}
|
|
314
316
|
}
|
package/package.json
CHANGED