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