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