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