@0xsequence/api 0.0.0-20220825190100 → 0.0.0-20230217200148
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.
- package/LICENSE +219 -0
- package/dist/0xsequence-api.cjs.dev.js +110 -82
- package/dist/0xsequence-api.cjs.prod.js +110 -82
- package/dist/0xsequence-api.esm.js +111 -79
- package/dist/declarations/src/api.gen.d.ts +106 -18
- package/dist/declarations/src/index.d.ts +3 -3
- package/package.json +8 -10
- package/src/api.gen.ts +224 -25
- package/src/index.ts +4 -6
|
@@ -2,46 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var fetch = require('cross-fetch');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var fetch__default = /*#__PURE__*/_interopDefault(fetch);
|
|
10
|
-
|
|
11
5
|
function _extends() {
|
|
12
|
-
_extends = Object.assign
|
|
6
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
13
7
|
for (var i = 1; i < arguments.length; i++) {
|
|
14
8
|
var source = arguments[i];
|
|
15
|
-
|
|
16
9
|
for (var key in source) {
|
|
17
10
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
18
11
|
target[key] = source[key];
|
|
19
12
|
}
|
|
20
13
|
}
|
|
21
14
|
}
|
|
22
|
-
|
|
23
15
|
return target;
|
|
24
16
|
};
|
|
25
|
-
|
|
26
17
|
return _extends.apply(this, arguments);
|
|
27
18
|
}
|
|
28
19
|
|
|
29
20
|
/* eslint-disable */
|
|
30
|
-
// sequence-api v0.4.0
|
|
21
|
+
// sequence-api v0.4.0 698db8d7b44b6d14f6a8a70e6bd50ac3ecda9be3
|
|
31
22
|
// --
|
|
32
|
-
//
|
|
33
|
-
//
|
|
23
|
+
// Code generated by webrpc-gen@v0.10.x-dev with typescript generator. DO NOT EDIT.
|
|
24
|
+
//
|
|
25
|
+
// webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/api.gen.ts
|
|
26
|
+
|
|
34
27
|
// WebRPC description and code-gen version
|
|
35
|
-
const WebRPCVersion = "v1";
|
|
28
|
+
const WebRPCVersion = "v1";
|
|
29
|
+
|
|
30
|
+
// Schema version of your RIDL schema
|
|
31
|
+
const WebRPCSchemaVersion = "v0.4.0";
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
// Schema hash generated from your RIDL schema
|
|
34
|
+
const WebRPCSchemaHash = "698db8d7b44b6d14f6a8a70e6bd50ac3ecda9be3";
|
|
38
35
|
|
|
39
|
-
|
|
36
|
+
//
|
|
40
37
|
// Types
|
|
41
38
|
//
|
|
42
39
|
|
|
43
40
|
exports.SmartRampOrderStatus = void 0;
|
|
44
|
-
|
|
45
41
|
(function (SmartRampOrderStatus) {
|
|
46
42
|
SmartRampOrderStatus["UNKNOWN"] = "UNKNOWN";
|
|
47
43
|
SmartRampOrderStatus["RUNNING_CHECKS"] = "RUNNING_CHECKS";
|
|
@@ -49,14 +45,17 @@ exports.SmartRampOrderStatus = void 0;
|
|
|
49
45
|
SmartRampOrderStatus["FAILED"] = "FAILED";
|
|
50
46
|
SmartRampOrderStatus["COMPLETE"] = "COMPLETE";
|
|
51
47
|
})(exports.SmartRampOrderStatus || (exports.SmartRampOrderStatus = {}));
|
|
52
|
-
|
|
48
|
+
exports.SmartRampTxnStatus = void 0;
|
|
49
|
+
(function (SmartRampTxnStatus) {
|
|
50
|
+
SmartRampTxnStatus["UNKNOWN"] = "UNKNOWN";
|
|
51
|
+
SmartRampTxnStatus["SUCCESSFUL"] = "SUCCESSFUL";
|
|
52
|
+
SmartRampTxnStatus["FAILED"] = "FAILED";
|
|
53
|
+
})(exports.SmartRampTxnStatus || (exports.SmartRampTxnStatus = {}));
|
|
53
54
|
exports.SortOrder = void 0;
|
|
54
|
-
|
|
55
55
|
(function (SortOrder) {
|
|
56
56
|
SortOrder["DESC"] = "DESC";
|
|
57
57
|
SortOrder["ASC"] = "ASC";
|
|
58
58
|
})(exports.SortOrder || (exports.SortOrder = {}));
|
|
59
|
-
|
|
60
59
|
//
|
|
61
60
|
// Client
|
|
62
61
|
//
|
|
@@ -65,7 +64,6 @@ class API {
|
|
|
65
64
|
this.hostname = void 0;
|
|
66
65
|
this.fetch = void 0;
|
|
67
66
|
this.path = '/rpc/API/';
|
|
68
|
-
|
|
69
67
|
this.ping = headers => {
|
|
70
68
|
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
71
69
|
return buildResponse(res).then(_data => {
|
|
@@ -75,7 +73,6 @@ class API {
|
|
|
75
73
|
});
|
|
76
74
|
});
|
|
77
75
|
};
|
|
78
|
-
|
|
79
76
|
this.version = headers => {
|
|
80
77
|
return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
|
|
81
78
|
return buildResponse(res).then(_data => {
|
|
@@ -85,7 +82,6 @@ class API {
|
|
|
85
82
|
});
|
|
86
83
|
});
|
|
87
84
|
};
|
|
88
|
-
|
|
89
85
|
this.runtimeStatus = headers => {
|
|
90
86
|
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
|
|
91
87
|
return buildResponse(res).then(_data => {
|
|
@@ -95,7 +91,6 @@ class API {
|
|
|
95
91
|
});
|
|
96
92
|
});
|
|
97
93
|
};
|
|
98
|
-
|
|
99
94
|
this.getSequenceContext = headers => {
|
|
100
95
|
return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
|
|
101
96
|
return buildResponse(res).then(_data => {
|
|
@@ -105,7 +100,6 @@ class API {
|
|
|
105
100
|
});
|
|
106
101
|
});
|
|
107
102
|
};
|
|
108
|
-
|
|
109
103
|
this.getAuthToken = (args, headers) => {
|
|
110
104
|
return this.fetch(this.url('GetAuthToken'), createHTTPRequest(args, headers)).then(res => {
|
|
111
105
|
return buildResponse(res).then(_data => {
|
|
@@ -118,7 +112,6 @@ class API {
|
|
|
118
112
|
});
|
|
119
113
|
});
|
|
120
114
|
};
|
|
121
|
-
|
|
122
115
|
this.sendPasswordlessLink = (args, headers) => {
|
|
123
116
|
return this.fetch(this.url('SendPasswordlessLink'), createHTTPRequest(args, headers)).then(res => {
|
|
124
117
|
return buildResponse(res).then(_data => {
|
|
@@ -128,7 +121,6 @@ class API {
|
|
|
128
121
|
});
|
|
129
122
|
});
|
|
130
123
|
};
|
|
131
|
-
|
|
132
124
|
this.friendList = (args, headers) => {
|
|
133
125
|
return this.fetch(this.url('FriendList'), createHTTPRequest(args, headers)).then(res => {
|
|
134
126
|
return buildResponse(res).then(_data => {
|
|
@@ -139,7 +131,6 @@ class API {
|
|
|
139
131
|
});
|
|
140
132
|
});
|
|
141
133
|
};
|
|
142
|
-
|
|
143
134
|
this.getFriendByAddress = (args, headers) => {
|
|
144
135
|
return this.fetch(this.url('GetFriendByAddress'), createHTTPRequest(args, headers)).then(res => {
|
|
145
136
|
return buildResponse(res).then(_data => {
|
|
@@ -150,7 +141,6 @@ class API {
|
|
|
150
141
|
});
|
|
151
142
|
});
|
|
152
143
|
};
|
|
153
|
-
|
|
154
144
|
this.searchFriends = (args, headers) => {
|
|
155
145
|
return this.fetch(this.url('SearchFriends'), createHTTPRequest(args, headers)).then(res => {
|
|
156
146
|
return buildResponse(res).then(_data => {
|
|
@@ -160,7 +150,6 @@ class API {
|
|
|
160
150
|
});
|
|
161
151
|
});
|
|
162
152
|
};
|
|
163
|
-
|
|
164
153
|
this.addFriend = (args, headers) => {
|
|
165
154
|
return this.fetch(this.url('AddFriend'), createHTTPRequest(args, headers)).then(res => {
|
|
166
155
|
return buildResponse(res).then(_data => {
|
|
@@ -171,7 +160,6 @@ class API {
|
|
|
171
160
|
});
|
|
172
161
|
});
|
|
173
162
|
};
|
|
174
|
-
|
|
175
163
|
this.updateFriendNickname = (args, headers) => {
|
|
176
164
|
return this.fetch(this.url('UpdateFriendNickname'), createHTTPRequest(args, headers)).then(res => {
|
|
177
165
|
return buildResponse(res).then(_data => {
|
|
@@ -182,7 +170,6 @@ class API {
|
|
|
182
170
|
});
|
|
183
171
|
});
|
|
184
172
|
};
|
|
185
|
-
|
|
186
173
|
this.removeFriend = (args, headers) => {
|
|
187
174
|
return this.fetch(this.url('RemoveFriend'), createHTTPRequest(args, headers)).then(res => {
|
|
188
175
|
return buildResponse(res).then(_data => {
|
|
@@ -192,7 +179,6 @@ class API {
|
|
|
192
179
|
});
|
|
193
180
|
});
|
|
194
181
|
};
|
|
195
|
-
|
|
196
182
|
this.contractCall = (args, headers) => {
|
|
197
183
|
return this.fetch(this.url('ContractCall'), createHTTPRequest(args, headers)).then(res => {
|
|
198
184
|
return buildResponse(res).then(_data => {
|
|
@@ -202,7 +188,6 @@ class API {
|
|
|
202
188
|
});
|
|
203
189
|
});
|
|
204
190
|
};
|
|
205
|
-
|
|
206
191
|
this.decodeContractCall = (args, headers) => {
|
|
207
192
|
return this.fetch(this.url('DecodeContractCall'), createHTTPRequest(args, headers)).then(res => {
|
|
208
193
|
return buildResponse(res).then(_data => {
|
|
@@ -212,7 +197,6 @@ class API {
|
|
|
212
197
|
});
|
|
213
198
|
});
|
|
214
199
|
};
|
|
215
|
-
|
|
216
200
|
this.lookupContractCallSelectors = (args, headers) => {
|
|
217
201
|
return this.fetch(this.url('LookupContractCallSelectors'), createHTTPRequest(args, headers)).then(res => {
|
|
218
202
|
return buildResponse(res).then(_data => {
|
|
@@ -222,7 +206,6 @@ class API {
|
|
|
222
206
|
});
|
|
223
207
|
});
|
|
224
208
|
};
|
|
225
|
-
|
|
226
209
|
this.userStorageFetch = (args, headers) => {
|
|
227
210
|
return this.fetch(this.url('UserStorageFetch'), createHTTPRequest(args, headers)).then(res => {
|
|
228
211
|
return buildResponse(res).then(_data => {
|
|
@@ -232,7 +215,6 @@ class API {
|
|
|
232
215
|
});
|
|
233
216
|
});
|
|
234
217
|
};
|
|
235
|
-
|
|
236
218
|
this.userStorageSave = (args, headers) => {
|
|
237
219
|
return this.fetch(this.url('UserStorageSave'), createHTTPRequest(args, headers)).then(res => {
|
|
238
220
|
return buildResponse(res).then(_data => {
|
|
@@ -242,7 +224,6 @@ class API {
|
|
|
242
224
|
});
|
|
243
225
|
});
|
|
244
226
|
};
|
|
245
|
-
|
|
246
227
|
this.userStorageDelete = (args, headers) => {
|
|
247
228
|
return this.fetch(this.url('UserStorageDelete'), createHTTPRequest(args, headers)).then(res => {
|
|
248
229
|
return buildResponse(res).then(_data => {
|
|
@@ -252,7 +233,6 @@ class API {
|
|
|
252
233
|
});
|
|
253
234
|
});
|
|
254
235
|
};
|
|
255
|
-
|
|
256
236
|
this.userStorageFetchAll = (args, headers) => {
|
|
257
237
|
return this.fetch(this.url('UserStorageFetchAll'), createHTTPRequest(args, headers)).then(res => {
|
|
258
238
|
return buildResponse(res).then(_data => {
|
|
@@ -262,7 +242,6 @@ class API {
|
|
|
262
242
|
});
|
|
263
243
|
});
|
|
264
244
|
};
|
|
265
|
-
|
|
266
245
|
this.getMoonpayLink = (args, headers) => {
|
|
267
246
|
return this.fetch(this.url('GetMoonpayLink'), createHTTPRequest(args, headers)).then(res => {
|
|
268
247
|
return buildResponse(res).then(_data => {
|
|
@@ -272,7 +251,15 @@ class API {
|
|
|
272
251
|
});
|
|
273
252
|
});
|
|
274
253
|
};
|
|
275
|
-
|
|
254
|
+
this.getSardineClientToken = headers => {
|
|
255
|
+
return this.fetch(this.url('GetSardineClientToken'), createHTTPRequest({}, headers)).then(res => {
|
|
256
|
+
return buildResponse(res).then(_data => {
|
|
257
|
+
return {
|
|
258
|
+
token: _data.token
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
};
|
|
276
263
|
this.isUsingGoogleMail = (args, headers) => {
|
|
277
264
|
return this.fetch(this.url('IsUsingGoogleMail'), createHTTPRequest(args, headers)).then(res => {
|
|
278
265
|
return buildResponse(res).then(_data => {
|
|
@@ -282,7 +269,16 @@ class API {
|
|
|
282
269
|
});
|
|
283
270
|
});
|
|
284
271
|
};
|
|
285
|
-
|
|
272
|
+
this.resolveENSAddress = (args, headers) => {
|
|
273
|
+
return this.fetch(this.url('ResolveENSAddress'), createHTTPRequest(args, headers)).then(res => {
|
|
274
|
+
return buildResponse(res).then(_data => {
|
|
275
|
+
return {
|
|
276
|
+
address: _data.address,
|
|
277
|
+
ok: _data.ok
|
|
278
|
+
};
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
};
|
|
286
282
|
this.isValidSignature = (args, headers) => {
|
|
287
283
|
return this.fetch(this.url('IsValidSignature'), createHTTPRequest(args, headers)).then(res => {
|
|
288
284
|
return buildResponse(res).then(_data => {
|
|
@@ -292,7 +288,6 @@ class API {
|
|
|
292
288
|
});
|
|
293
289
|
});
|
|
294
290
|
};
|
|
295
|
-
|
|
296
291
|
this.isValidMessageSignature = (args, headers) => {
|
|
297
292
|
return this.fetch(this.url('IsValidMessageSignature'), createHTTPRequest(args, headers)).then(res => {
|
|
298
293
|
return buildResponse(res).then(_data => {
|
|
@@ -302,7 +297,6 @@ class API {
|
|
|
302
297
|
});
|
|
303
298
|
});
|
|
304
299
|
};
|
|
305
|
-
|
|
306
300
|
this.isValidTypedDataSignature = (args, headers) => {
|
|
307
301
|
return this.fetch(this.url('IsValidTypedDataSignature'), createHTTPRequest(args, headers)).then(res => {
|
|
308
302
|
return buildResponse(res).then(_data => {
|
|
@@ -312,7 +306,6 @@ class API {
|
|
|
312
306
|
});
|
|
313
307
|
});
|
|
314
308
|
};
|
|
315
|
-
|
|
316
309
|
this.isValidETHAuthProof = (args, headers) => {
|
|
317
310
|
return this.fetch(this.url('IsValidETHAuthProof'), createHTTPRequest(args, headers)).then(res => {
|
|
318
311
|
return buildResponse(res).then(_data => {
|
|
@@ -322,7 +315,6 @@ class API {
|
|
|
322
315
|
});
|
|
323
316
|
});
|
|
324
317
|
};
|
|
325
|
-
|
|
326
318
|
this.getCoinPrices = (args, headers) => {
|
|
327
319
|
return this.fetch(this.url('GetCoinPrices'), createHTTPRequest(args, headers)).then(res => {
|
|
328
320
|
return buildResponse(res).then(_data => {
|
|
@@ -332,7 +324,6 @@ class API {
|
|
|
332
324
|
});
|
|
333
325
|
});
|
|
334
326
|
};
|
|
335
|
-
|
|
336
327
|
this.getCollectiblePrices = (args, headers) => {
|
|
337
328
|
return this.fetch(this.url('GetCollectiblePrices'), createHTTPRequest(args, headers)).then(res => {
|
|
338
329
|
return buildResponse(res).then(_data => {
|
|
@@ -342,7 +333,6 @@ class API {
|
|
|
342
333
|
});
|
|
343
334
|
});
|
|
344
335
|
};
|
|
345
|
-
|
|
346
336
|
this.getExchangeRate = (args, headers) => {
|
|
347
337
|
return this.fetch(this.url('GetExchangeRate'), createHTTPRequest(args, headers)).then(res => {
|
|
348
338
|
return buildResponse(res).then(_data => {
|
|
@@ -352,7 +342,24 @@ class API {
|
|
|
352
342
|
});
|
|
353
343
|
});
|
|
354
344
|
};
|
|
355
|
-
|
|
345
|
+
this.memoryStore = (args, headers) => {
|
|
346
|
+
return this.fetch(this.url('MemoryStore'), createHTTPRequest(args, headers)).then(res => {
|
|
347
|
+
return buildResponse(res).then(_data => {
|
|
348
|
+
return {
|
|
349
|
+
ok: _data.ok
|
|
350
|
+
};
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
this.memoryLoad = (args, headers) => {
|
|
355
|
+
return this.fetch(this.url('MemoryLoad'), createHTTPRequest(args, headers)).then(res => {
|
|
356
|
+
return buildResponse(res).then(_data => {
|
|
357
|
+
return {
|
|
358
|
+
value: _data.value
|
|
359
|
+
};
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
};
|
|
356
363
|
this.listPayCardsOnFile = headers => {
|
|
357
364
|
return this.fetch(this.url('ListPayCardsOnFile'), createHTTPRequest({}, headers)).then(res => {
|
|
358
365
|
return buildResponse(res).then(_data => {
|
|
@@ -362,7 +369,6 @@ class API {
|
|
|
362
369
|
});
|
|
363
370
|
});
|
|
364
371
|
};
|
|
365
|
-
|
|
366
372
|
this.savePayCard = (args, headers) => {
|
|
367
373
|
return this.fetch(this.url('SavePayCard'), createHTTPRequest(args, headers)).then(res => {
|
|
368
374
|
return buildResponse(res).then(_data => {
|
|
@@ -373,7 +379,6 @@ class API {
|
|
|
373
379
|
});
|
|
374
380
|
});
|
|
375
381
|
};
|
|
376
|
-
|
|
377
382
|
this.updatePayCardCVC = (args, headers) => {
|
|
378
383
|
return this.fetch(this.url('UpdatePayCardCVC'), createHTTPRequest(args, headers)).then(res => {
|
|
379
384
|
return buildResponse(res).then(_data => {
|
|
@@ -383,7 +388,6 @@ class API {
|
|
|
383
388
|
});
|
|
384
389
|
});
|
|
385
390
|
};
|
|
386
|
-
|
|
387
391
|
this.deletePayCard = (args, headers) => {
|
|
388
392
|
return this.fetch(this.url('DeletePayCard'), createHTTPRequest(args, headers)).then(res => {
|
|
389
393
|
return buildResponse(res).then(_data => {
|
|
@@ -393,7 +397,6 @@ class API {
|
|
|
393
397
|
});
|
|
394
398
|
});
|
|
395
399
|
};
|
|
396
|
-
|
|
397
400
|
this.smartRampQuote = (args, headers) => {
|
|
398
401
|
return this.fetch(this.url('SmartRampQuote'), createHTTPRequest(args, headers)).then(res => {
|
|
399
402
|
return buildResponse(res).then(_data => {
|
|
@@ -404,7 +407,6 @@ class API {
|
|
|
404
407
|
});
|
|
405
408
|
});
|
|
406
409
|
};
|
|
407
|
-
|
|
408
410
|
this.smartRampPurchase = (args, headers) => {
|
|
409
411
|
return this.fetch(this.url('SmartRampPurchase'), createHTTPRequest(args, headers)).then(res => {
|
|
410
412
|
return buildResponse(res).then(_data => {
|
|
@@ -415,7 +417,6 @@ class API {
|
|
|
415
417
|
});
|
|
416
418
|
});
|
|
417
419
|
};
|
|
418
|
-
|
|
419
420
|
this.smartRampWaitOrderConfirmation = (args, headers) => {
|
|
420
421
|
return this.fetch(this.url('SmartRampWaitOrderConfirmation'), createHTTPRequest(args, headers)).then(res => {
|
|
421
422
|
return buildResponse(res).then(_data => {
|
|
@@ -426,7 +427,6 @@ class API {
|
|
|
426
427
|
});
|
|
427
428
|
});
|
|
428
429
|
};
|
|
429
|
-
|
|
430
430
|
this.smartRampGetOrder = (args, headers) => {
|
|
431
431
|
return this.fetch(this.url('SmartRampGetOrder'), createHTTPRequest(args, headers)).then(res => {
|
|
432
432
|
return buildResponse(res).then(_data => {
|
|
@@ -436,7 +436,6 @@ class API {
|
|
|
436
436
|
});
|
|
437
437
|
});
|
|
438
438
|
};
|
|
439
|
-
|
|
440
439
|
this.smartRampCheckCardAuthorization = (args, headers) => {
|
|
441
440
|
return this.fetch(this.url('SmartRampCheckCardAuthorization'), createHTTPRequest(args, headers)).then(res => {
|
|
442
441
|
return buildResponse(res).then(_data => {
|
|
@@ -446,7 +445,26 @@ class API {
|
|
|
446
445
|
});
|
|
447
446
|
});
|
|
448
447
|
};
|
|
449
|
-
|
|
448
|
+
this.smartRampOrdersList = (args, headers) => {
|
|
449
|
+
return this.fetch(this.url('SmartRampOrdersList'), createHTTPRequest(args, headers)).then(res => {
|
|
450
|
+
return buildResponse(res).then(_data => {
|
|
451
|
+
return {
|
|
452
|
+
page: _data.page,
|
|
453
|
+
orders: _data.orders
|
|
454
|
+
};
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
this.smartRampGetOrderTxnHash = (args, headers) => {
|
|
459
|
+
return this.fetch(this.url('SmartRampGetOrderTxnHash'), createHTTPRequest(args, headers)).then(res => {
|
|
460
|
+
return buildResponse(res).then(_data => {
|
|
461
|
+
return {
|
|
462
|
+
txnHash: _data.txnHash,
|
|
463
|
+
txnSuccessful: _data.txnSuccessful
|
|
464
|
+
};
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
};
|
|
450
468
|
this.smartRampSubmitCardAuthorization = (args, headers) => {
|
|
451
469
|
return this.fetch(this.url('SmartRampSubmitCardAuthorization'), createHTTPRequest(args, headers)).then(res => {
|
|
452
470
|
return buildResponse(res).then(_data => {
|
|
@@ -456,18 +474,33 @@ class API {
|
|
|
456
474
|
});
|
|
457
475
|
});
|
|
458
476
|
};
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
477
|
+
this.adminSmartRampGetOrder = (args, headers) => {
|
|
478
|
+
return this.fetch(this.url('AdminSmartRampGetOrder'), createHTTPRequest(args, headers)).then(res => {
|
|
479
|
+
return buildResponse(res).then(_data => {
|
|
480
|
+
return {
|
|
481
|
+
order: _data.order
|
|
482
|
+
};
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
};
|
|
486
|
+
this.adminSmartRampListCompletedOrders = (args, headers) => {
|
|
487
|
+
return this.fetch(this.url('AdminSmartRampListCompletedOrders'), createHTTPRequest(args, headers)).then(res => {
|
|
462
488
|
return buildResponse(res).then(_data => {
|
|
463
489
|
return {
|
|
464
|
-
page: _data.page,
|
|
465
490
|
orders: _data.orders
|
|
466
491
|
};
|
|
467
492
|
});
|
|
468
493
|
});
|
|
469
494
|
};
|
|
470
|
-
|
|
495
|
+
this.adminSmartRampListPendingOrders = (args, headers) => {
|
|
496
|
+
return this.fetch(this.url('AdminSmartRampListPendingOrders'), createHTTPRequest(args, headers)).then(res => {
|
|
497
|
+
return buildResponse(res).then(_data => {
|
|
498
|
+
return {
|
|
499
|
+
pendingOrders: _data.pendingOrders
|
|
500
|
+
};
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
};
|
|
471
504
|
this.getInviteInfo = headers => {
|
|
472
505
|
return this.fetch(this.url('GetInviteInfo'), createHTTPRequest({}, headers)).then(res => {
|
|
473
506
|
return buildResponse(res).then(_data => {
|
|
@@ -477,7 +510,6 @@ class API {
|
|
|
477
510
|
});
|
|
478
511
|
});
|
|
479
512
|
};
|
|
480
|
-
|
|
481
513
|
this.isValidAccessCode = (args, headers) => {
|
|
482
514
|
return this.fetch(this.url('IsValidAccessCode'), createHTTPRequest(args, headers)).then(res => {
|
|
483
515
|
return buildResponse(res).then(_data => {
|
|
@@ -487,7 +519,6 @@ class API {
|
|
|
487
519
|
});
|
|
488
520
|
});
|
|
489
521
|
};
|
|
490
|
-
|
|
491
522
|
this.internalClaimAccessCode = (args, headers) => {
|
|
492
523
|
return this.fetch(this.url('InternalClaimAccessCode'), createHTTPRequest(args, headers)).then(res => {
|
|
493
524
|
return buildResponse(res).then(_data => {
|
|
@@ -497,7 +528,6 @@ class API {
|
|
|
497
528
|
});
|
|
498
529
|
});
|
|
499
530
|
};
|
|
500
|
-
|
|
501
531
|
this.walletRecover = (args, headers) => {
|
|
502
532
|
return this.fetch(this.url('WalletRecover'), createHTTPRequest(args, headers)).then(res => {
|
|
503
533
|
return buildResponse(res).then(_data => {
|
|
@@ -507,17 +537,22 @@ class API {
|
|
|
507
537
|
});
|
|
508
538
|
});
|
|
509
539
|
};
|
|
510
|
-
|
|
540
|
+
this.blockNumberAtTime = (args, headers) => {
|
|
541
|
+
return this.fetch(this.url('BlockNumberAtTime'), createHTTPRequest(args, headers)).then(res => {
|
|
542
|
+
return buildResponse(res).then(_data => {
|
|
543
|
+
return {
|
|
544
|
+
blocks: _data.blocks
|
|
545
|
+
};
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
};
|
|
511
549
|
this.hostname = hostname;
|
|
512
|
-
this.fetch = fetch;
|
|
550
|
+
this.fetch = (input, init) => fetch(input, init);
|
|
513
551
|
}
|
|
514
|
-
|
|
515
552
|
url(name) {
|
|
516
553
|
return this.hostname + this.path + name;
|
|
517
554
|
}
|
|
518
|
-
|
|
519
555
|
}
|
|
520
|
-
|
|
521
556
|
const createHTTPRequest = (body = {}, headers = {}) => {
|
|
522
557
|
return {
|
|
523
558
|
method: 'POST',
|
|
@@ -527,11 +562,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
|
|
|
527
562
|
body: JSON.stringify(body || {})
|
|
528
563
|
};
|
|
529
564
|
};
|
|
530
|
-
|
|
531
565
|
const buildResponse = res => {
|
|
532
566
|
return res.text().then(text => {
|
|
533
567
|
let data;
|
|
534
|
-
|
|
535
568
|
try {
|
|
536
569
|
data = JSON.parse(text);
|
|
537
570
|
} catch (err) {
|
|
@@ -541,7 +574,6 @@ const buildResponse = res => {
|
|
|
541
574
|
status: res.status
|
|
542
575
|
};
|
|
543
576
|
}
|
|
544
|
-
|
|
545
577
|
if (!res.ok) {
|
|
546
578
|
throw data; // webrpc error response
|
|
547
579
|
}
|
|
@@ -552,26 +584,22 @@ const buildResponse = res => {
|
|
|
552
584
|
|
|
553
585
|
class SequenceAPIClient extends API {
|
|
554
586
|
constructor(hostname, jwtAuth) {
|
|
555
|
-
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname,
|
|
587
|
+
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
|
|
556
588
|
this.jwtAuth = jwtAuth;
|
|
557
|
-
|
|
558
589
|
this._fetch = (input, init) => {
|
|
559
590
|
// automatically include jwt auth header to requests
|
|
560
591
|
// if its been set on the api client
|
|
561
592
|
const headers = {};
|
|
562
|
-
|
|
563
593
|
if (this.jwtAuth && this.jwtAuth.length > 0) {
|
|
564
594
|
headers['Authorization'] = `BEARER ${this.jwtAuth}`;
|
|
565
|
-
}
|
|
566
|
-
|
|
595
|
+
}
|
|
567
596
|
|
|
597
|
+
// before the request is made
|
|
568
598
|
init.headers = _extends({}, init.headers, headers);
|
|
569
|
-
return
|
|
599
|
+
return global.fetch(input, init);
|
|
570
600
|
};
|
|
571
|
-
|
|
572
601
|
this.fetch = this._fetch;
|
|
573
602
|
}
|
|
574
|
-
|
|
575
603
|
}
|
|
576
604
|
|
|
577
605
|
exports.API = API;
|