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