@0xsequence/api 0.0.0-20230505164841 → 0.0.0-20230509145455

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