@0xsequence/api 0.0.0-20220825181818 → 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.
@@ -1,11 +1 @@
1
- // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
- // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
-
4
- // curious why you need to?
5
- // this file exists so that you can import from the entrypoint normally
6
- // except that it points to your source file and you don't need to run build constantly
7
- // which means we need to re-export all of the modules from your source file
8
- // and since export * doesn't include default exports, we need to read your source file
9
- // to check for a default export and re-export it if it exists
10
- // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
- export * from "../src/index";
1
+ export * from "./declarations/src/index";
@@ -0,0 +1,580 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _extends() {
6
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
7
+ for (var i = 1; i < arguments.length; i++) {
8
+ var source = arguments[i];
9
+ for (var key in source) {
10
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11
+ target[key] = source[key];
12
+ }
13
+ }
14
+ }
15
+ return target;
16
+ };
17
+ return _extends.apply(this, arguments);
18
+ }
19
+
20
+ /* eslint-disable */
21
+ // sequence-api v0.4.0 8e34a4b927a5faab07d6558c21251a5218b82ac4
22
+ // --
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
+
27
+ // WebRPC description and code-gen version
28
+ const WebRPCVersion = "v1";
29
+
30
+ // Schema version of your RIDL schema
31
+ const WebRPCSchemaVersion = "v0.4.0";
32
+
33
+ // Schema hash generated from your RIDL schema
34
+ const WebRPCSchemaHash = "8e34a4b927a5faab07d6558c21251a5218b82ac4";
35
+
36
+ //
37
+ // Types
38
+ //
39
+ exports.SmartRampOrderStatus = void 0;
40
+ (function (SmartRampOrderStatus) {
41
+ SmartRampOrderStatus["UNKNOWN"] = "UNKNOWN";
42
+ SmartRampOrderStatus["RUNNING_CHECKS"] = "RUNNING_CHECKS";
43
+ SmartRampOrderStatus["PROCESSING"] = "PROCESSING";
44
+ SmartRampOrderStatus["FAILED"] = "FAILED";
45
+ SmartRampOrderStatus["COMPLETE"] = "COMPLETE";
46
+ })(exports.SmartRampOrderStatus || (exports.SmartRampOrderStatus = {}));
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
+ exports.SortOrder = void 0;
54
+ (function (SortOrder) {
55
+ SortOrder["DESC"] = "DESC";
56
+ SortOrder["ASC"] = "ASC";
57
+ })(exports.SortOrder || (exports.SortOrder = {}));
58
+ //
59
+ // Client
60
+ //
61
+ class API {
62
+ constructor(hostname, fetch) {
63
+ this.hostname = void 0;
64
+ this.fetch = void 0;
65
+ this.path = '/rpc/API/';
66
+ this.ping = headers => {
67
+ return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
68
+ return buildResponse(res).then(_data => {
69
+ return {
70
+ status: _data.status
71
+ };
72
+ });
73
+ });
74
+ };
75
+ this.version = headers => {
76
+ return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
77
+ return buildResponse(res).then(_data => {
78
+ return {
79
+ version: _data.version
80
+ };
81
+ });
82
+ });
83
+ };
84
+ this.runtimeStatus = headers => {
85
+ return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
86
+ return buildResponse(res).then(_data => {
87
+ return {
88
+ status: _data.status
89
+ };
90
+ });
91
+ });
92
+ };
93
+ this.getSequenceContext = headers => {
94
+ return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
95
+ return buildResponse(res).then(_data => {
96
+ return {
97
+ data: _data.data
98
+ };
99
+ });
100
+ });
101
+ };
102
+ this.getAuthToken = (args, headers) => {
103
+ return this.fetch(this.url('GetAuthToken'), createHTTPRequest(args, headers)).then(res => {
104
+ return buildResponse(res).then(_data => {
105
+ return {
106
+ status: _data.status,
107
+ jwtToken: _data.jwtToken,
108
+ address: _data.address,
109
+ user: _data.user
110
+ };
111
+ });
112
+ });
113
+ };
114
+ this.sendPasswordlessLink = (args, headers) => {
115
+ return this.fetch(this.url('SendPasswordlessLink'), createHTTPRequest(args, headers)).then(res => {
116
+ return buildResponse(res).then(_data => {
117
+ return {
118
+ status: _data.status
119
+ };
120
+ });
121
+ });
122
+ };
123
+ this.friendList = (args, headers) => {
124
+ return this.fetch(this.url('FriendList'), createHTTPRequest(args, headers)).then(res => {
125
+ return buildResponse(res).then(_data => {
126
+ return {
127
+ page: _data.page,
128
+ friends: _data.friends
129
+ };
130
+ });
131
+ });
132
+ };
133
+ this.getFriendByAddress = (args, headers) => {
134
+ return this.fetch(this.url('GetFriendByAddress'), createHTTPRequest(args, headers)).then(res => {
135
+ return buildResponse(res).then(_data => {
136
+ return {
137
+ status: _data.status,
138
+ friend: _data.friend
139
+ };
140
+ });
141
+ });
142
+ };
143
+ this.searchFriends = (args, headers) => {
144
+ return this.fetch(this.url('SearchFriends'), createHTTPRequest(args, headers)).then(res => {
145
+ return buildResponse(res).then(_data => {
146
+ return {
147
+ friends: _data.friends
148
+ };
149
+ });
150
+ });
151
+ };
152
+ this.addFriend = (args, headers) => {
153
+ return this.fetch(this.url('AddFriend'), createHTTPRequest(args, headers)).then(res => {
154
+ return buildResponse(res).then(_data => {
155
+ return {
156
+ status: _data.status,
157
+ friend: _data.friend
158
+ };
159
+ });
160
+ });
161
+ };
162
+ this.updateFriendNickname = (args, headers) => {
163
+ return this.fetch(this.url('UpdateFriendNickname'), createHTTPRequest(args, headers)).then(res => {
164
+ return buildResponse(res).then(_data => {
165
+ return {
166
+ status: _data.status,
167
+ friend: _data.friend
168
+ };
169
+ });
170
+ });
171
+ };
172
+ this.removeFriend = (args, headers) => {
173
+ return this.fetch(this.url('RemoveFriend'), createHTTPRequest(args, headers)).then(res => {
174
+ return buildResponse(res).then(_data => {
175
+ return {
176
+ status: _data.status
177
+ };
178
+ });
179
+ });
180
+ };
181
+ this.contractCall = (args, headers) => {
182
+ return this.fetch(this.url('ContractCall'), createHTTPRequest(args, headers)).then(res => {
183
+ return buildResponse(res).then(_data => {
184
+ return {
185
+ returns: _data.returns
186
+ };
187
+ });
188
+ });
189
+ };
190
+ this.decodeContractCall = (args, headers) => {
191
+ return this.fetch(this.url('DecodeContractCall'), createHTTPRequest(args, headers)).then(res => {
192
+ return buildResponse(res).then(_data => {
193
+ return {
194
+ call: _data.call
195
+ };
196
+ });
197
+ });
198
+ };
199
+ this.lookupContractCallSelectors = (args, headers) => {
200
+ return this.fetch(this.url('LookupContractCallSelectors'), createHTTPRequest(args, headers)).then(res => {
201
+ return buildResponse(res).then(_data => {
202
+ return {
203
+ signatures: _data.signatures
204
+ };
205
+ });
206
+ });
207
+ };
208
+ this.userStorageFetch = (args, headers) => {
209
+ return this.fetch(this.url('UserStorageFetch'), createHTTPRequest(args, headers)).then(res => {
210
+ return buildResponse(res).then(_data => {
211
+ return {
212
+ object: _data.object
213
+ };
214
+ });
215
+ });
216
+ };
217
+ this.userStorageSave = (args, headers) => {
218
+ return this.fetch(this.url('UserStorageSave'), createHTTPRequest(args, headers)).then(res => {
219
+ return buildResponse(res).then(_data => {
220
+ return {
221
+ ok: _data.ok
222
+ };
223
+ });
224
+ });
225
+ };
226
+ this.userStorageDelete = (args, headers) => {
227
+ return this.fetch(this.url('UserStorageDelete'), createHTTPRequest(args, headers)).then(res => {
228
+ return buildResponse(res).then(_data => {
229
+ return {
230
+ ok: _data.ok
231
+ };
232
+ });
233
+ });
234
+ };
235
+ this.userStorageFetchAll = (args, headers) => {
236
+ return this.fetch(this.url('UserStorageFetchAll'), createHTTPRequest(args, headers)).then(res => {
237
+ return buildResponse(res).then(_data => {
238
+ return {
239
+ objects: _data.objects
240
+ };
241
+ });
242
+ });
243
+ };
244
+ this.getMoonpayLink = (args, headers) => {
245
+ return this.fetch(this.url('GetMoonpayLink'), createHTTPRequest(args, headers)).then(res => {
246
+ return buildResponse(res).then(_data => {
247
+ return {
248
+ signedUrl: _data.signedUrl
249
+ };
250
+ });
251
+ });
252
+ };
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
+ };
262
+ this.isUsingGoogleMail = (args, headers) => {
263
+ return this.fetch(this.url('IsUsingGoogleMail'), createHTTPRequest(args, headers)).then(res => {
264
+ return buildResponse(res).then(_data => {
265
+ return {
266
+ yes: _data.yes
267
+ };
268
+ });
269
+ });
270
+ };
271
+ this.isValidSignature = (args, headers) => {
272
+ return this.fetch(this.url('IsValidSignature'), createHTTPRequest(args, headers)).then(res => {
273
+ return buildResponse(res).then(_data => {
274
+ return {
275
+ isValid: _data.isValid
276
+ };
277
+ });
278
+ });
279
+ };
280
+ this.isValidMessageSignature = (args, headers) => {
281
+ return this.fetch(this.url('IsValidMessageSignature'), createHTTPRequest(args, headers)).then(res => {
282
+ return buildResponse(res).then(_data => {
283
+ return {
284
+ isValid: _data.isValid
285
+ };
286
+ });
287
+ });
288
+ };
289
+ this.isValidTypedDataSignature = (args, headers) => {
290
+ return this.fetch(this.url('IsValidTypedDataSignature'), createHTTPRequest(args, headers)).then(res => {
291
+ return buildResponse(res).then(_data => {
292
+ return {
293
+ isValid: _data.isValid
294
+ };
295
+ });
296
+ });
297
+ };
298
+ this.isValidETHAuthProof = (args, headers) => {
299
+ return this.fetch(this.url('IsValidETHAuthProof'), createHTTPRequest(args, headers)).then(res => {
300
+ return buildResponse(res).then(_data => {
301
+ return {
302
+ isValid: _data.isValid
303
+ };
304
+ });
305
+ });
306
+ };
307
+ this.getCoinPrices = (args, headers) => {
308
+ return this.fetch(this.url('GetCoinPrices'), createHTTPRequest(args, headers)).then(res => {
309
+ return buildResponse(res).then(_data => {
310
+ return {
311
+ tokenPrices: _data.tokenPrices
312
+ };
313
+ });
314
+ });
315
+ };
316
+ this.getCollectiblePrices = (args, headers) => {
317
+ return this.fetch(this.url('GetCollectiblePrices'), createHTTPRequest(args, headers)).then(res => {
318
+ return buildResponse(res).then(_data => {
319
+ return {
320
+ tokenPrices: _data.tokenPrices
321
+ };
322
+ });
323
+ });
324
+ };
325
+ this.getExchangeRate = (args, headers) => {
326
+ return this.fetch(this.url('GetExchangeRate'), createHTTPRequest(args, headers)).then(res => {
327
+ return buildResponse(res).then(_data => {
328
+ return {
329
+ exchangeRate: _data.exchangeRate
330
+ };
331
+ });
332
+ });
333
+ };
334
+ this.listPayCardsOnFile = headers => {
335
+ return this.fetch(this.url('ListPayCardsOnFile'), createHTTPRequest({}, headers)).then(res => {
336
+ return buildResponse(res).then(_data => {
337
+ return {
338
+ payCards: _data.payCards
339
+ };
340
+ });
341
+ });
342
+ };
343
+ this.savePayCard = (args, headers) => {
344
+ return this.fetch(this.url('SavePayCard'), createHTTPRequest(args, headers)).then(res => {
345
+ return buildResponse(res).then(_data => {
346
+ return {
347
+ ok: _data.ok,
348
+ payCard: _data.payCard
349
+ };
350
+ });
351
+ });
352
+ };
353
+ this.updatePayCardCVC = (args, headers) => {
354
+ return this.fetch(this.url('UpdatePayCardCVC'), createHTTPRequest(args, headers)).then(res => {
355
+ return buildResponse(res).then(_data => {
356
+ return {
357
+ ok: _data.ok
358
+ };
359
+ });
360
+ });
361
+ };
362
+ this.deletePayCard = (args, headers) => {
363
+ return this.fetch(this.url('DeletePayCard'), createHTTPRequest(args, headers)).then(res => {
364
+ return buildResponse(res).then(_data => {
365
+ return {
366
+ ok: _data.ok
367
+ };
368
+ });
369
+ });
370
+ };
371
+ this.smartRampQuote = (args, headers) => {
372
+ return this.fetch(this.url('SmartRampQuote'), createHTTPRequest(args, headers)).then(res => {
373
+ return buildResponse(res).then(_data => {
374
+ return {
375
+ status: _data.status,
376
+ quoteDetails: _data.quoteDetails
377
+ };
378
+ });
379
+ });
380
+ };
381
+ this.smartRampPurchase = (args, headers) => {
382
+ return this.fetch(this.url('SmartRampPurchase'), createHTTPRequest(args, headers)).then(res => {
383
+ return buildResponse(res).then(_data => {
384
+ return {
385
+ processing: _data.processing,
386
+ receipt: _data.receipt
387
+ };
388
+ });
389
+ });
390
+ };
391
+ this.smartRampWaitOrderConfirmation = (args, headers) => {
392
+ return this.fetch(this.url('SmartRampWaitOrderConfirmation'), createHTTPRequest(args, headers)).then(res => {
393
+ return buildResponse(res).then(_data => {
394
+ return {
395
+ done: _data.done,
396
+ receipt: _data.receipt
397
+ };
398
+ });
399
+ });
400
+ };
401
+ this.smartRampGetOrder = (args, headers) => {
402
+ return this.fetch(this.url('SmartRampGetOrder'), createHTTPRequest(args, headers)).then(res => {
403
+ return buildResponse(res).then(_data => {
404
+ return {
405
+ order: _data.order
406
+ };
407
+ });
408
+ });
409
+ };
410
+ this.smartRampCheckCardAuthorization = (args, headers) => {
411
+ return this.fetch(this.url('SmartRampCheckCardAuthorization'), createHTTPRequest(args, headers)).then(res => {
412
+ return buildResponse(res).then(_data => {
413
+ return {
414
+ cardAuth: _data.cardAuth
415
+ };
416
+ });
417
+ });
418
+ };
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
+ };
439
+ this.smartRampSubmitCardAuthorization = (args, headers) => {
440
+ return this.fetch(this.url('SmartRampSubmitCardAuthorization'), createHTTPRequest(args, headers)).then(res => {
441
+ return buildResponse(res).then(_data => {
442
+ return {
443
+ status: _data.status
444
+ };
445
+ });
446
+ });
447
+ };
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
+ };
475
+ this.getInviteInfo = headers => {
476
+ return this.fetch(this.url('GetInviteInfo'), createHTTPRequest({}, headers)).then(res => {
477
+ return buildResponse(res).then(_data => {
478
+ return {
479
+ inviteInfo: _data.inviteInfo
480
+ };
481
+ });
482
+ });
483
+ };
484
+ this.isValidAccessCode = (args, headers) => {
485
+ return this.fetch(this.url('IsValidAccessCode'), createHTTPRequest(args, headers)).then(res => {
486
+ return buildResponse(res).then(_data => {
487
+ return {
488
+ status: _data.status
489
+ };
490
+ });
491
+ });
492
+ };
493
+ this.internalClaimAccessCode = (args, headers) => {
494
+ return this.fetch(this.url('InternalClaimAccessCode'), createHTTPRequest(args, headers)).then(res => {
495
+ return buildResponse(res).then(_data => {
496
+ return {
497
+ status: _data.status
498
+ };
499
+ });
500
+ });
501
+ };
502
+ this.walletRecover = (args, headers) => {
503
+ return this.fetch(this.url('WalletRecover'), createHTTPRequest(args, headers)).then(res => {
504
+ return buildResponse(res).then(_data => {
505
+ return {
506
+ encryptedWallet: _data.encryptedWallet
507
+ };
508
+ });
509
+ });
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
+ };
520
+ this.hostname = hostname;
521
+ this.fetch = (input, init) => fetch(input, init);
522
+ }
523
+ url(name) {
524
+ return this.hostname + this.path + name;
525
+ }
526
+ }
527
+ const createHTTPRequest = (body = {}, headers = {}) => {
528
+ return {
529
+ method: 'POST',
530
+ headers: _extends({}, headers, {
531
+ 'Content-Type': 'application/json'
532
+ }),
533
+ body: JSON.stringify(body || {})
534
+ };
535
+ };
536
+ const buildResponse = res => {
537
+ return res.text().then(text => {
538
+ let data;
539
+ try {
540
+ data = JSON.parse(text);
541
+ } catch (err) {
542
+ throw {
543
+ code: 'unknown',
544
+ msg: `expecting JSON, got: ${text}`,
545
+ status: res.status
546
+ };
547
+ }
548
+ if (!res.ok) {
549
+ throw data; // webrpc error response
550
+ }
551
+
552
+ return data;
553
+ });
554
+ };
555
+
556
+ class SequenceAPIClient extends API {
557
+ constructor(hostname, jwtAuth) {
558
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
559
+ this.jwtAuth = jwtAuth;
560
+ this._fetch = (input, init) => {
561
+ // automatically include jwt auth header to requests
562
+ // if its been set on the api client
563
+ const headers = {};
564
+ if (this.jwtAuth && this.jwtAuth.length > 0) {
565
+ headers['Authorization'] = `BEARER ${this.jwtAuth}`;
566
+ }
567
+
568
+ // before the request is made
569
+ init.headers = _extends({}, init.headers, headers);
570
+ return global.fetch(input, init);
571
+ };
572
+ this.fetch = this._fetch;
573
+ }
574
+ }
575
+
576
+ exports.API = API;
577
+ exports.SequenceAPIClient = SequenceAPIClient;
578
+ exports.WebRPCSchemaHash = WebRPCSchemaHash;
579
+ exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
580
+ exports.WebRPCVersion = WebRPCVersion;
@@ -1,16 +1,7 @@
1
- "use strict";
2
- // this file might look strange and you might be wondering what it's for
3
- // it's lets you import your source files by importing this entrypoint
4
- // as you would import it if it was built with preconstruct build
5
- // this file is slightly different to some others though
6
- // it has a require hook which compiles your code with Babel
7
- // this means that you don't have to set up @babel/register or anything like that
8
- // but you can still require this module and it'll be compiled
1
+ 'use strict';
9
2
 
10
- // this bit of code imports the require hook and registers it
11
- let unregister = require("../../../node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../..", "..");
12
-
13
- // this re-exports the source file
14
- module.exports = require("../src/index.ts");
15
-
16
- unregister();
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./0xsequence-api.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./0xsequence-api.cjs.dev.js");
7
+ }