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