@0xsequence/api 0.0.0-20230504182418 → 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.
- package/dist/0xsequence-api.cjs.d.ts +11 -1
- package/dist/0xsequence-api.cjs.js +15 -6
- package/package.json +1 -1
- package/dist/0xsequence-api.cjs.dev.js +0 -620
- package/dist/0xsequence-api.cjs.prod.js +0 -620
- package/dist/0xsequence-api.esm.js +0 -609
- package/dist/declarations/src/api.gen.d.ts +0 -727
- package/dist/declarations/src/index.d.ts +0 -7
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export
|
|
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,7 +1,16 @@
|
|
|
1
|
-
|
|
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
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
// this bit of code imports the require hook and registers it
|
|
11
|
+
let unregister = require("../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/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();
|
package/package.json
CHANGED
|
@@ -1,620 +0,0 @@
|
|
|
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 d1f6b3f5d785b3363324bd82228e3efd291664fb
|
|
22
|
-
// --
|
|
23
|
-
// Code generated by webrpc-gen@v0.10.x-dev 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 = "d1f6b3f5d785b3363324bd82228e3efd291664fb";
|
|
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.hostname = hostname;
|
|
557
|
-
this.fetch = (input, init) => fetch(input, init);
|
|
558
|
-
}
|
|
559
|
-
url(name) {
|
|
560
|
-
return this.hostname + this.path + name;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
const createHTTPRequest = (body = {}, headers = {}) => {
|
|
564
|
-
return {
|
|
565
|
-
method: 'POST',
|
|
566
|
-
headers: _extends({}, headers, {
|
|
567
|
-
'Content-Type': 'application/json'
|
|
568
|
-
}),
|
|
569
|
-
body: JSON.stringify(body || {})
|
|
570
|
-
};
|
|
571
|
-
};
|
|
572
|
-
const buildResponse = res => {
|
|
573
|
-
return res.text().then(text => {
|
|
574
|
-
let data;
|
|
575
|
-
try {
|
|
576
|
-
data = JSON.parse(text);
|
|
577
|
-
} catch (err) {
|
|
578
|
-
throw {
|
|
579
|
-
code: 'unknown',
|
|
580
|
-
msg: `expecting JSON, got: ${text}`,
|
|
581
|
-
status: res.status
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
if (!res.ok) {
|
|
585
|
-
throw data; // webrpc error response
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
return data;
|
|
589
|
-
});
|
|
590
|
-
};
|
|
591
|
-
|
|
592
|
-
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
593
|
-
class SequenceAPIClient extends API {
|
|
594
|
-
constructor(hostname, jwtAuth) {
|
|
595
|
-
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
596
|
-
this._fetch = (input, init) => {
|
|
597
|
-
// automatically include jwt auth header to requests
|
|
598
|
-
// if its been set on the api client
|
|
599
|
-
const headers = {};
|
|
600
|
-
if (this.jwtAuth && this.jwtAuth.length > 0) {
|
|
601
|
-
headers['Authorization'] = `BEARER ${this.jwtAuth}`;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
// before the request is made
|
|
605
|
-
init.headers = _extends({}, init.headers, headers);
|
|
606
|
-
return fetch(input, init);
|
|
607
|
-
};
|
|
608
|
-
this.jwtAuth = jwtAuth;
|
|
609
|
-
this.fetch = this._fetch;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
exports.API = API;
|
|
614
|
-
exports.SequenceAPIClient = SequenceAPIClient;
|
|
615
|
-
exports.SmartRampOrderStatus = SmartRampOrderStatus;
|
|
616
|
-
exports.SmartRampTxnStatus = SmartRampTxnStatus;
|
|
617
|
-
exports.SortOrder = SortOrder;
|
|
618
|
-
exports.WebRPCSchemaHash = WebRPCSchemaHash;
|
|
619
|
-
exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
|
|
620
|
-
exports.WebRPCVersion = WebRPCVersion;
|