@0xsequence/api 2.3.35 → 3.0.0-beta.2
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/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +2166 -0
- package/LICENSE +0 -17
- package/README.md +1 -2
- package/dist/api.gen.d.ts +1887 -0
- package/dist/api.gen.d.ts.map +1 -0
- package/dist/api.gen.js +1795 -0
- package/dist/{declarations/src/index.d.ts → index.d.ts} +3 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/package.json +19 -13
- package/src/api.gen.ts +3068 -2429
- package/src/index.ts +1 -1
- package/tsconfig.json +10 -0
- package/dist/0xsequence-api.cjs.d.ts +0 -2
- package/dist/0xsequence-api.cjs.dev.js +0 -1743
- package/dist/0xsequence-api.cjs.js +0 -7
- package/dist/0xsequence-api.cjs.prod.js +0 -1743
- package/dist/0xsequence-api.esm.js +0 -1683
- package/dist/declarations/src/api.gen.d.ts +0 -1795
|
@@ -1,1743 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function _extends() {
|
|
6
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
7
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
8
|
-
var t = arguments[e];
|
|
9
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
10
|
-
}
|
|
11
|
-
return n;
|
|
12
|
-
}, _extends.apply(null, arguments);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/* eslint-disable */
|
|
16
|
-
// sequence-api v0.4.0 d7026da603b2c29baf21c6aceeebc86eada372d8
|
|
17
|
-
// --
|
|
18
|
-
// Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT.
|
|
19
|
-
//
|
|
20
|
-
// webrpc-gen -schema=api.ridl -target=typescript -client -out=./clients/api.gen.ts
|
|
21
|
-
|
|
22
|
-
const WebrpcHeader = 'Webrpc';
|
|
23
|
-
const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-api@v0.4.0';
|
|
24
|
-
|
|
25
|
-
// WebRPC description and code-gen version
|
|
26
|
-
const WebRPCVersion = 'v1';
|
|
27
|
-
|
|
28
|
-
// Schema version of your RIDL schema
|
|
29
|
-
const WebRPCSchemaVersion = 'v0.4.0';
|
|
30
|
-
|
|
31
|
-
// Schema hash generated from your RIDL schema
|
|
32
|
-
const WebRPCSchemaHash = 'd7026da603b2c29baf21c6aceeebc86eada372d8';
|
|
33
|
-
function VersionFromHeader(headers) {
|
|
34
|
-
const headerValue = headers.get(WebrpcHeader);
|
|
35
|
-
if (!headerValue) {
|
|
36
|
-
return {
|
|
37
|
-
webrpcGenVersion: '',
|
|
38
|
-
codeGenName: '',
|
|
39
|
-
codeGenVersion: '',
|
|
40
|
-
schemaName: '',
|
|
41
|
-
schemaVersion: ''
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
return parseWebrpcGenVersions(headerValue);
|
|
45
|
-
}
|
|
46
|
-
function parseWebrpcGenVersions(header) {
|
|
47
|
-
const versions = header.split(';');
|
|
48
|
-
if (versions.length < 3) {
|
|
49
|
-
return {
|
|
50
|
-
webrpcGenVersion: '',
|
|
51
|
-
codeGenName: '',
|
|
52
|
-
codeGenVersion: '',
|
|
53
|
-
schemaName: '',
|
|
54
|
-
schemaVersion: ''
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
const [_, webrpcGenVersion] = versions[0].split('@');
|
|
58
|
-
const [codeGenName, codeGenVersion] = versions[1].split('@');
|
|
59
|
-
const [schemaName, schemaVersion] = versions[2].split('@');
|
|
60
|
-
return {
|
|
61
|
-
webrpcGenVersion: webrpcGenVersion != null ? webrpcGenVersion : '',
|
|
62
|
-
codeGenName: codeGenName != null ? codeGenName : '',
|
|
63
|
-
codeGenVersion: codeGenVersion != null ? codeGenVersion : '',
|
|
64
|
-
schemaName: schemaName != null ? schemaName : '',
|
|
65
|
-
schemaVersion: schemaVersion != null ? schemaVersion : ''
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
// Types
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
let SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
74
|
-
SortOrder["DESC"] = "DESC";
|
|
75
|
-
SortOrder["ASC"] = "ASC";
|
|
76
|
-
return SortOrder;
|
|
77
|
-
}({});
|
|
78
|
-
let GetLifiSwapRouteDirection = /*#__PURE__*/function (GetLifiSwapRouteDirection) {
|
|
79
|
-
GetLifiSwapRouteDirection["to"] = "to";
|
|
80
|
-
GetLifiSwapRouteDirection["from"] = "from";
|
|
81
|
-
return GetLifiSwapRouteDirection;
|
|
82
|
-
}({});
|
|
83
|
-
let TokenType = /*#__PURE__*/function (TokenType) {
|
|
84
|
-
TokenType["ERC20"] = "ERC20";
|
|
85
|
-
TokenType["ERC721"] = "ERC721";
|
|
86
|
-
TokenType["ERC1155"] = "ERC1155";
|
|
87
|
-
return TokenType;
|
|
88
|
-
}({});
|
|
89
|
-
let TransakBuySell = /*#__PURE__*/function (TransakBuySell) {
|
|
90
|
-
TransakBuySell["UNKNOWN"] = "UNKNOWN";
|
|
91
|
-
TransakBuySell["BUY"] = "BUY";
|
|
92
|
-
TransakBuySell["SELL"] = "SELL";
|
|
93
|
-
return TransakBuySell;
|
|
94
|
-
}({});
|
|
95
|
-
let TradeType = /*#__PURE__*/function (TradeType) {
|
|
96
|
-
TradeType["EXACT_INPUT"] = "EXACT_INPUT";
|
|
97
|
-
TradeType["EXACT_OUTPUT"] = "EXACT_OUTPUT";
|
|
98
|
-
return TradeType;
|
|
99
|
-
}({});
|
|
100
|
-
let CheckoutOptionCrypto = /*#__PURE__*/function (CheckoutOptionCrypto) {
|
|
101
|
-
CheckoutOptionCrypto["none"] = "none";
|
|
102
|
-
CheckoutOptionCrypto["partially"] = "partially";
|
|
103
|
-
CheckoutOptionCrypto["all"] = "all";
|
|
104
|
-
return CheckoutOptionCrypto;
|
|
105
|
-
}({});
|
|
106
|
-
let CheckoutOptionNFTCheckoutProvider = /*#__PURE__*/function (CheckoutOptionNFTCheckoutProvider) {
|
|
107
|
-
CheckoutOptionNFTCheckoutProvider["unknown"] = "unknown";
|
|
108
|
-
CheckoutOptionNFTCheckoutProvider["transak"] = "transak";
|
|
109
|
-
return CheckoutOptionNFTCheckoutProvider;
|
|
110
|
-
}({});
|
|
111
|
-
let CheckoutOptionOnRampProvider = /*#__PURE__*/function (CheckoutOptionOnRampProvider) {
|
|
112
|
-
CheckoutOptionOnRampProvider["unknown"] = "unknown";
|
|
113
|
-
CheckoutOptionOnRampProvider["transak"] = "transak";
|
|
114
|
-
return CheckoutOptionOnRampProvider;
|
|
115
|
-
}({});
|
|
116
|
-
let CheckoutOptionSwapProvider = /*#__PURE__*/function (CheckoutOptionSwapProvider) {
|
|
117
|
-
CheckoutOptionSwapProvider["unknown"] = "unknown";
|
|
118
|
-
CheckoutOptionSwapProvider["lifi"] = "lifi";
|
|
119
|
-
return CheckoutOptionSwapProvider;
|
|
120
|
-
}({});
|
|
121
|
-
//
|
|
122
|
-
// Client
|
|
123
|
-
//
|
|
124
|
-
class API {
|
|
125
|
-
constructor(hostname, fetch) {
|
|
126
|
-
this.hostname = void 0;
|
|
127
|
-
this.fetch = void 0;
|
|
128
|
-
this.path = '/rpc/API/';
|
|
129
|
-
this.ping = (headers, signal) => {
|
|
130
|
-
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
131
|
-
return buildResponse(res).then(_data => {
|
|
132
|
-
return {
|
|
133
|
-
status: _data.status
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
}, error => {
|
|
137
|
-
throw WebrpcRequestFailedError.new({
|
|
138
|
-
cause: `fetch(): ${error.message || ''}`
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
this.version = (headers, signal) => {
|
|
143
|
-
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
144
|
-
return buildResponse(res).then(_data => {
|
|
145
|
-
return {
|
|
146
|
-
version: _data.version
|
|
147
|
-
};
|
|
148
|
-
});
|
|
149
|
-
}, error => {
|
|
150
|
-
throw WebrpcRequestFailedError.new({
|
|
151
|
-
cause: `fetch(): ${error.message || ''}`
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
this.runtimeStatus = (headers, signal) => {
|
|
156
|
-
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
157
|
-
return buildResponse(res).then(_data => {
|
|
158
|
-
return {
|
|
159
|
-
status: _data.status
|
|
160
|
-
};
|
|
161
|
-
});
|
|
162
|
-
}, error => {
|
|
163
|
-
throw WebrpcRequestFailedError.new({
|
|
164
|
-
cause: `fetch(): ${error.message || ''}`
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
this.clock = (headers, signal) => {
|
|
169
|
-
return this.fetch(this.url('Clock'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
170
|
-
return buildResponse(res).then(_data => {
|
|
171
|
-
return {
|
|
172
|
-
serverTime: _data.serverTime
|
|
173
|
-
};
|
|
174
|
-
});
|
|
175
|
-
}, error => {
|
|
176
|
-
throw WebrpcRequestFailedError.new({
|
|
177
|
-
cause: `fetch(): ${error.message || ''}`
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
this.getSequenceContext = (headers, signal) => {
|
|
182
|
-
return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
183
|
-
return buildResponse(res).then(_data => {
|
|
184
|
-
return {
|
|
185
|
-
data: _data.data
|
|
186
|
-
};
|
|
187
|
-
});
|
|
188
|
-
}, error => {
|
|
189
|
-
throw WebrpcRequestFailedError.new({
|
|
190
|
-
cause: `fetch(): ${error.message || ''}`
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
this.getAuthToken = (args, headers, signal) => {
|
|
195
|
-
return this.fetch(this.url('GetAuthToken'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
196
|
-
return buildResponse(res).then(_data => {
|
|
197
|
-
return {
|
|
198
|
-
status: _data.status,
|
|
199
|
-
jwtToken: _data.jwtToken,
|
|
200
|
-
address: _data.address,
|
|
201
|
-
user: _data.user
|
|
202
|
-
};
|
|
203
|
-
});
|
|
204
|
-
}, error => {
|
|
205
|
-
throw WebrpcRequestFailedError.new({
|
|
206
|
-
cause: `fetch(): ${error.message || ''}`
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
this.getAuthToken2 = (args, headers, signal) => {
|
|
211
|
-
return this.fetch(this.url('GetAuthToken2'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
212
|
-
return buildResponse(res).then(_data => {
|
|
213
|
-
return {
|
|
214
|
-
status: _data.status,
|
|
215
|
-
jwtToken: _data.jwtToken,
|
|
216
|
-
address: _data.address,
|
|
217
|
-
user: _data.user
|
|
218
|
-
};
|
|
219
|
-
});
|
|
220
|
-
}, error => {
|
|
221
|
-
throw WebrpcRequestFailedError.new({
|
|
222
|
-
cause: `fetch(): ${error.message || ''}`
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
this.sendPasswordlessLink = (args, headers, signal) => {
|
|
227
|
-
return this.fetch(this.url('SendPasswordlessLink'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
228
|
-
return buildResponse(res).then(_data => {
|
|
229
|
-
return {
|
|
230
|
-
status: _data.status
|
|
231
|
-
};
|
|
232
|
-
});
|
|
233
|
-
}, error => {
|
|
234
|
-
throw WebrpcRequestFailedError.new({
|
|
235
|
-
cause: `fetch(): ${error.message || ''}`
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
};
|
|
239
|
-
this.registerPublicKey = (args, headers, signal) => {
|
|
240
|
-
return this.fetch(this.url('RegisterPublicKey'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
241
|
-
return buildResponse(res).then(_data => {
|
|
242
|
-
return {
|
|
243
|
-
status: _data.status
|
|
244
|
-
};
|
|
245
|
-
});
|
|
246
|
-
}, error => {
|
|
247
|
-
throw WebrpcRequestFailedError.new({
|
|
248
|
-
cause: `fetch(): ${error.message || ''}`
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
this.getPublicKey = (args, headers, signal) => {
|
|
253
|
-
return this.fetch(this.url('GetPublicKey'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
254
|
-
return buildResponse(res).then(_data => {
|
|
255
|
-
return {
|
|
256
|
-
publicKey: _data.publicKey
|
|
257
|
-
};
|
|
258
|
-
});
|
|
259
|
-
}, error => {
|
|
260
|
-
throw WebrpcRequestFailedError.new({
|
|
261
|
-
cause: `fetch(): ${error.message || ''}`
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
};
|
|
265
|
-
this.friendList = (args, headers, signal) => {
|
|
266
|
-
return this.fetch(this.url('FriendList'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
267
|
-
return buildResponse(res).then(_data => {
|
|
268
|
-
return {
|
|
269
|
-
page: _data.page,
|
|
270
|
-
friends: _data.friends
|
|
271
|
-
};
|
|
272
|
-
});
|
|
273
|
-
}, error => {
|
|
274
|
-
throw WebrpcRequestFailedError.new({
|
|
275
|
-
cause: `fetch(): ${error.message || ''}`
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
};
|
|
279
|
-
this.getFriendByAddress = (args, headers, signal) => {
|
|
280
|
-
return this.fetch(this.url('GetFriendByAddress'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
281
|
-
return buildResponse(res).then(_data => {
|
|
282
|
-
return {
|
|
283
|
-
status: _data.status,
|
|
284
|
-
friend: _data.friend
|
|
285
|
-
};
|
|
286
|
-
});
|
|
287
|
-
}, error => {
|
|
288
|
-
throw WebrpcRequestFailedError.new({
|
|
289
|
-
cause: `fetch(): ${error.message || ''}`
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
this.searchFriends = (args, headers, signal) => {
|
|
294
|
-
return this.fetch(this.url('SearchFriends'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
295
|
-
return buildResponse(res).then(_data => {
|
|
296
|
-
return {
|
|
297
|
-
friends: _data.friends
|
|
298
|
-
};
|
|
299
|
-
});
|
|
300
|
-
}, error => {
|
|
301
|
-
throw WebrpcRequestFailedError.new({
|
|
302
|
-
cause: `fetch(): ${error.message || ''}`
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
};
|
|
306
|
-
this.addFriend = (args, headers, signal) => {
|
|
307
|
-
return this.fetch(this.url('AddFriend'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
308
|
-
return buildResponse(res).then(_data => {
|
|
309
|
-
return {
|
|
310
|
-
status: _data.status,
|
|
311
|
-
friend: _data.friend
|
|
312
|
-
};
|
|
313
|
-
});
|
|
314
|
-
}, error => {
|
|
315
|
-
throw WebrpcRequestFailedError.new({
|
|
316
|
-
cause: `fetch(): ${error.message || ''}`
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
};
|
|
320
|
-
this.updateFriendNickname = (args, headers, signal) => {
|
|
321
|
-
return this.fetch(this.url('UpdateFriendNickname'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
322
|
-
return buildResponse(res).then(_data => {
|
|
323
|
-
return {
|
|
324
|
-
status: _data.status,
|
|
325
|
-
friend: _data.friend
|
|
326
|
-
};
|
|
327
|
-
});
|
|
328
|
-
}, error => {
|
|
329
|
-
throw WebrpcRequestFailedError.new({
|
|
330
|
-
cause: `fetch(): ${error.message || ''}`
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
};
|
|
334
|
-
this.removeFriend = (args, headers, signal) => {
|
|
335
|
-
return this.fetch(this.url('RemoveFriend'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
336
|
-
return buildResponse(res).then(_data => {
|
|
337
|
-
return {
|
|
338
|
-
status: _data.status
|
|
339
|
-
};
|
|
340
|
-
});
|
|
341
|
-
}, error => {
|
|
342
|
-
throw WebrpcRequestFailedError.new({
|
|
343
|
-
cause: `fetch(): ${error.message || ''}`
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
this.contractCall = (args, headers, signal) => {
|
|
348
|
-
return this.fetch(this.url('ContractCall'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
349
|
-
return buildResponse(res).then(_data => {
|
|
350
|
-
return {
|
|
351
|
-
returns: _data.returns
|
|
352
|
-
};
|
|
353
|
-
});
|
|
354
|
-
}, error => {
|
|
355
|
-
throw WebrpcRequestFailedError.new({
|
|
356
|
-
cause: `fetch(): ${error.message || ''}`
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
this.decodeContractCall = (args, headers, signal) => {
|
|
361
|
-
return this.fetch(this.url('DecodeContractCall'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
362
|
-
return buildResponse(res).then(_data => {
|
|
363
|
-
return {
|
|
364
|
-
call: _data.call
|
|
365
|
-
};
|
|
366
|
-
});
|
|
367
|
-
}, error => {
|
|
368
|
-
throw WebrpcRequestFailedError.new({
|
|
369
|
-
cause: `fetch(): ${error.message || ''}`
|
|
370
|
-
});
|
|
371
|
-
});
|
|
372
|
-
};
|
|
373
|
-
this.lookupContractCallSelectors = (args, headers, signal) => {
|
|
374
|
-
return this.fetch(this.url('LookupContractCallSelectors'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
375
|
-
return buildResponse(res).then(_data => {
|
|
376
|
-
return {
|
|
377
|
-
signatures: _data.signatures
|
|
378
|
-
};
|
|
379
|
-
});
|
|
380
|
-
}, error => {
|
|
381
|
-
throw WebrpcRequestFailedError.new({
|
|
382
|
-
cause: `fetch(): ${error.message || ''}`
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
};
|
|
386
|
-
this.userStorageFetch = (args, headers, signal) => {
|
|
387
|
-
return this.fetch(this.url('UserStorageFetch'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
388
|
-
return buildResponse(res).then(_data => {
|
|
389
|
-
return {
|
|
390
|
-
object: _data.object
|
|
391
|
-
};
|
|
392
|
-
});
|
|
393
|
-
}, error => {
|
|
394
|
-
throw WebrpcRequestFailedError.new({
|
|
395
|
-
cause: `fetch(): ${error.message || ''}`
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
};
|
|
399
|
-
this.userStorageSave = (args, headers, signal) => {
|
|
400
|
-
return this.fetch(this.url('UserStorageSave'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
401
|
-
return buildResponse(res).then(_data => {
|
|
402
|
-
return {
|
|
403
|
-
ok: _data.ok
|
|
404
|
-
};
|
|
405
|
-
});
|
|
406
|
-
}, error => {
|
|
407
|
-
throw WebrpcRequestFailedError.new({
|
|
408
|
-
cause: `fetch(): ${error.message || ''}`
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
};
|
|
412
|
-
this.userStorageDelete = (args, headers, signal) => {
|
|
413
|
-
return this.fetch(this.url('UserStorageDelete'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
414
|
-
return buildResponse(res).then(_data => {
|
|
415
|
-
return {
|
|
416
|
-
ok: _data.ok
|
|
417
|
-
};
|
|
418
|
-
});
|
|
419
|
-
}, error => {
|
|
420
|
-
throw WebrpcRequestFailedError.new({
|
|
421
|
-
cause: `fetch(): ${error.message || ''}`
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
|
-
};
|
|
425
|
-
this.userStorageFetchAll = (args, headers, signal) => {
|
|
426
|
-
return this.fetch(this.url('UserStorageFetchAll'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
427
|
-
return buildResponse(res).then(_data => {
|
|
428
|
-
return {
|
|
429
|
-
objects: _data.objects
|
|
430
|
-
};
|
|
431
|
-
});
|
|
432
|
-
}, error => {
|
|
433
|
-
throw WebrpcRequestFailedError.new({
|
|
434
|
-
cause: `fetch(): ${error.message || ''}`
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
};
|
|
438
|
-
this.getMoonpayLink = (args, headers, signal) => {
|
|
439
|
-
return this.fetch(this.url('GetMoonpayLink'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
440
|
-
return buildResponse(res).then(_data => {
|
|
441
|
-
return {
|
|
442
|
-
signedUrl: _data.signedUrl
|
|
443
|
-
};
|
|
444
|
-
});
|
|
445
|
-
}, error => {
|
|
446
|
-
throw WebrpcRequestFailedError.new({
|
|
447
|
-
cause: `fetch(): ${error.message || ''}`
|
|
448
|
-
});
|
|
449
|
-
});
|
|
450
|
-
};
|
|
451
|
-
this.resolveENSAddress = (args, headers, signal) => {
|
|
452
|
-
return this.fetch(this.url('ResolveENSAddress'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
453
|
-
return buildResponse(res).then(_data => {
|
|
454
|
-
return {
|
|
455
|
-
address: _data.address,
|
|
456
|
-
ok: _data.ok
|
|
457
|
-
};
|
|
458
|
-
});
|
|
459
|
-
}, error => {
|
|
460
|
-
throw WebrpcRequestFailedError.new({
|
|
461
|
-
cause: `fetch(): ${error.message || ''}`
|
|
462
|
-
});
|
|
463
|
-
});
|
|
464
|
-
};
|
|
465
|
-
this.isValidSignature = (args, headers, signal) => {
|
|
466
|
-
return this.fetch(this.url('IsValidSignature'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
467
|
-
return buildResponse(res).then(_data => {
|
|
468
|
-
return {
|
|
469
|
-
isValid: _data.isValid
|
|
470
|
-
};
|
|
471
|
-
});
|
|
472
|
-
}, error => {
|
|
473
|
-
throw WebrpcRequestFailedError.new({
|
|
474
|
-
cause: `fetch(): ${error.message || ''}`
|
|
475
|
-
});
|
|
476
|
-
});
|
|
477
|
-
};
|
|
478
|
-
this.isValidMessageSignature = (args, headers, signal) => {
|
|
479
|
-
return this.fetch(this.url('IsValidMessageSignature'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
480
|
-
return buildResponse(res).then(_data => {
|
|
481
|
-
return {
|
|
482
|
-
isValid: _data.isValid
|
|
483
|
-
};
|
|
484
|
-
});
|
|
485
|
-
}, error => {
|
|
486
|
-
throw WebrpcRequestFailedError.new({
|
|
487
|
-
cause: `fetch(): ${error.message || ''}`
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
};
|
|
491
|
-
this.isValidTypedDataSignature = (args, headers, signal) => {
|
|
492
|
-
return this.fetch(this.url('IsValidTypedDataSignature'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
493
|
-
return buildResponse(res).then(_data => {
|
|
494
|
-
return {
|
|
495
|
-
isValid: _data.isValid
|
|
496
|
-
};
|
|
497
|
-
});
|
|
498
|
-
}, error => {
|
|
499
|
-
throw WebrpcRequestFailedError.new({
|
|
500
|
-
cause: `fetch(): ${error.message || ''}`
|
|
501
|
-
});
|
|
502
|
-
});
|
|
503
|
-
};
|
|
504
|
-
this.isValidETHAuthProof = (args, headers, signal) => {
|
|
505
|
-
return this.fetch(this.url('IsValidETHAuthProof'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
506
|
-
return buildResponse(res).then(_data => {
|
|
507
|
-
return {
|
|
508
|
-
isValid: _data.isValid
|
|
509
|
-
};
|
|
510
|
-
});
|
|
511
|
-
}, error => {
|
|
512
|
-
throw WebrpcRequestFailedError.new({
|
|
513
|
-
cause: `fetch(): ${error.message || ''}`
|
|
514
|
-
});
|
|
515
|
-
});
|
|
516
|
-
};
|
|
517
|
-
this.getOnRampURL = (args, headers, signal) => {
|
|
518
|
-
return this.fetch(this.url('GetOnRampURL'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
519
|
-
return buildResponse(res).then(_data => {
|
|
520
|
-
return {
|
|
521
|
-
url: _data.url
|
|
522
|
-
};
|
|
523
|
-
});
|
|
524
|
-
}, error => {
|
|
525
|
-
throw WebrpcRequestFailedError.new({
|
|
526
|
-
cause: `fetch(): ${error.message || ''}`
|
|
527
|
-
});
|
|
528
|
-
});
|
|
529
|
-
};
|
|
530
|
-
this.transakGetCountries = (headers, signal) => {
|
|
531
|
-
return this.fetch(this.url('TransakGetCountries'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
532
|
-
return buildResponse(res).then(_data => {
|
|
533
|
-
return {
|
|
534
|
-
regions: _data.regions
|
|
535
|
-
};
|
|
536
|
-
});
|
|
537
|
-
}, error => {
|
|
538
|
-
throw WebrpcRequestFailedError.new({
|
|
539
|
-
cause: `fetch(): ${error.message || ''}`
|
|
540
|
-
});
|
|
541
|
-
});
|
|
542
|
-
};
|
|
543
|
-
this.transakGetCryptoCurrencies = (headers, signal) => {
|
|
544
|
-
return this.fetch(this.url('TransakGetCryptoCurrencies'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
545
|
-
return buildResponse(res).then(_data => {
|
|
546
|
-
return {
|
|
547
|
-
currencies: _data.currencies
|
|
548
|
-
};
|
|
549
|
-
});
|
|
550
|
-
}, error => {
|
|
551
|
-
throw WebrpcRequestFailedError.new({
|
|
552
|
-
cause: `fetch(): ${error.message || ''}`
|
|
553
|
-
});
|
|
554
|
-
});
|
|
555
|
-
};
|
|
556
|
-
this.transakGetFiatCurrencies = (headers, signal) => {
|
|
557
|
-
return this.fetch(this.url('TransakGetFiatCurrencies'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
558
|
-
return buildResponse(res).then(_data => {
|
|
559
|
-
return {
|
|
560
|
-
currencies: _data.currencies
|
|
561
|
-
};
|
|
562
|
-
});
|
|
563
|
-
}, error => {
|
|
564
|
-
throw WebrpcRequestFailedError.new({
|
|
565
|
-
cause: `fetch(): ${error.message || ''}`
|
|
566
|
-
});
|
|
567
|
-
});
|
|
568
|
-
};
|
|
569
|
-
this.transakGetPrice = (args, headers, signal) => {
|
|
570
|
-
return this.fetch(this.url('TransakGetPrice'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
571
|
-
return buildResponse(res).then(_data => {
|
|
572
|
-
return {
|
|
573
|
-
price: _data.price
|
|
574
|
-
};
|
|
575
|
-
});
|
|
576
|
-
}, error => {
|
|
577
|
-
throw WebrpcRequestFailedError.new({
|
|
578
|
-
cause: `fetch(): ${error.message || ''}`
|
|
579
|
-
});
|
|
580
|
-
});
|
|
581
|
-
};
|
|
582
|
-
this.transakGetSupportedNFTCheckoutChains = (headers, signal) => {
|
|
583
|
-
return this.fetch(this.url('TransakGetSupportedNFTCheckoutChains'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
584
|
-
return buildResponse(res).then(_data => {
|
|
585
|
-
return {
|
|
586
|
-
chains: _data.chains
|
|
587
|
-
};
|
|
588
|
-
});
|
|
589
|
-
}, error => {
|
|
590
|
-
throw WebrpcRequestFailedError.new({
|
|
591
|
-
cause: `fetch(): ${error.message || ''}`
|
|
592
|
-
});
|
|
593
|
-
});
|
|
594
|
-
};
|
|
595
|
-
this.transakGetWidgetURL = (args, headers, signal) => {
|
|
596
|
-
return this.fetch(this.url('TransakGetWidgetURL'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
597
|
-
return buildResponse(res).then(_data => {
|
|
598
|
-
return {
|
|
599
|
-
url: _data.url
|
|
600
|
-
};
|
|
601
|
-
});
|
|
602
|
-
}, error => {
|
|
603
|
-
throw WebrpcRequestFailedError.new({
|
|
604
|
-
cause: `fetch(): ${error.message || ''}`
|
|
605
|
-
});
|
|
606
|
-
});
|
|
607
|
-
};
|
|
608
|
-
this.getCoinPrices = (args, headers, signal) => {
|
|
609
|
-
return this.fetch(this.url('GetCoinPrices'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
610
|
-
return buildResponse(res).then(_data => {
|
|
611
|
-
return {
|
|
612
|
-
tokenPrices: _data.tokenPrices
|
|
613
|
-
};
|
|
614
|
-
});
|
|
615
|
-
}, error => {
|
|
616
|
-
throw WebrpcRequestFailedError.new({
|
|
617
|
-
cause: `fetch(): ${error.message || ''}`
|
|
618
|
-
});
|
|
619
|
-
});
|
|
620
|
-
};
|
|
621
|
-
this.getCollectiblePrices = (args, headers, signal) => {
|
|
622
|
-
return this.fetch(this.url('GetCollectiblePrices'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
623
|
-
return buildResponse(res).then(_data => {
|
|
624
|
-
return {
|
|
625
|
-
tokenPrices: _data.tokenPrices
|
|
626
|
-
};
|
|
627
|
-
});
|
|
628
|
-
}, error => {
|
|
629
|
-
throw WebrpcRequestFailedError.new({
|
|
630
|
-
cause: `fetch(): ${error.message || ''}`
|
|
631
|
-
});
|
|
632
|
-
});
|
|
633
|
-
};
|
|
634
|
-
this.getExchangeRate = (args, headers, signal) => {
|
|
635
|
-
return this.fetch(this.url('GetExchangeRate'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
636
|
-
return buildResponse(res).then(_data => {
|
|
637
|
-
return {
|
|
638
|
-
exchangeRate: _data.exchangeRate
|
|
639
|
-
};
|
|
640
|
-
});
|
|
641
|
-
}, error => {
|
|
642
|
-
throw WebrpcRequestFailedError.new({
|
|
643
|
-
cause: `fetch(): ${error.message || ''}`
|
|
644
|
-
});
|
|
645
|
-
});
|
|
646
|
-
};
|
|
647
|
-
this.memoryStore = (args, headers, signal) => {
|
|
648
|
-
return this.fetch(this.url('MemoryStore'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
649
|
-
return buildResponse(res).then(_data => {
|
|
650
|
-
return {
|
|
651
|
-
ok: _data.ok
|
|
652
|
-
};
|
|
653
|
-
});
|
|
654
|
-
}, error => {
|
|
655
|
-
throw WebrpcRequestFailedError.new({
|
|
656
|
-
cause: `fetch(): ${error.message || ''}`
|
|
657
|
-
});
|
|
658
|
-
});
|
|
659
|
-
};
|
|
660
|
-
this.memoryLoad = (args, headers, signal) => {
|
|
661
|
-
return this.fetch(this.url('MemoryLoad'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
662
|
-
return buildResponse(res).then(_data => {
|
|
663
|
-
return {
|
|
664
|
-
value: _data.value
|
|
665
|
-
};
|
|
666
|
-
});
|
|
667
|
-
}, error => {
|
|
668
|
-
throw WebrpcRequestFailedError.new({
|
|
669
|
-
cause: `fetch(): ${error.message || ''}`
|
|
670
|
-
});
|
|
671
|
-
});
|
|
672
|
-
};
|
|
673
|
-
this.getInviteInfo = (headers, signal) => {
|
|
674
|
-
return this.fetch(this.url('GetInviteInfo'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
675
|
-
return buildResponse(res).then(_data => {
|
|
676
|
-
return {
|
|
677
|
-
inviteInfo: _data.inviteInfo
|
|
678
|
-
};
|
|
679
|
-
});
|
|
680
|
-
}, error => {
|
|
681
|
-
throw WebrpcRequestFailedError.new({
|
|
682
|
-
cause: `fetch(): ${error.message || ''}`
|
|
683
|
-
});
|
|
684
|
-
});
|
|
685
|
-
};
|
|
686
|
-
this.isValidAccessCode = (args, headers, signal) => {
|
|
687
|
-
return this.fetch(this.url('IsValidAccessCode'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
688
|
-
return buildResponse(res).then(_data => {
|
|
689
|
-
return {
|
|
690
|
-
status: _data.status
|
|
691
|
-
};
|
|
692
|
-
});
|
|
693
|
-
}, error => {
|
|
694
|
-
throw WebrpcRequestFailedError.new({
|
|
695
|
-
cause: `fetch(): ${error.message || ''}`
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
};
|
|
699
|
-
this.internalClaimAccessCode = (args, headers, signal) => {
|
|
700
|
-
return this.fetch(this.url('InternalClaimAccessCode'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
701
|
-
return buildResponse(res).then(_data => {
|
|
702
|
-
return {
|
|
703
|
-
status: _data.status
|
|
704
|
-
};
|
|
705
|
-
});
|
|
706
|
-
}, error => {
|
|
707
|
-
throw WebrpcRequestFailedError.new({
|
|
708
|
-
cause: `fetch(): ${error.message || ''}`
|
|
709
|
-
});
|
|
710
|
-
});
|
|
711
|
-
};
|
|
712
|
-
this.blockNumberAtTime = (args, headers, signal) => {
|
|
713
|
-
return this.fetch(this.url('BlockNumberAtTime'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
714
|
-
return buildResponse(res).then(_data => {
|
|
715
|
-
return {
|
|
716
|
-
blocks: _data.blocks
|
|
717
|
-
};
|
|
718
|
-
});
|
|
719
|
-
}, error => {
|
|
720
|
-
throw WebrpcRequestFailedError.new({
|
|
721
|
-
cause: `fetch(): ${error.message || ''}`
|
|
722
|
-
});
|
|
723
|
-
});
|
|
724
|
-
};
|
|
725
|
-
this.paperSessionSecret = (args, headers, signal) => {
|
|
726
|
-
return this.fetch(this.url('PaperSessionSecret'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
727
|
-
return buildResponse(res).then(_data => {
|
|
728
|
-
return {
|
|
729
|
-
secret: _data.secret
|
|
730
|
-
};
|
|
731
|
-
});
|
|
732
|
-
}, error => {
|
|
733
|
-
throw WebrpcRequestFailedError.new({
|
|
734
|
-
cause: `fetch(): ${error.message || ''}`
|
|
735
|
-
});
|
|
736
|
-
});
|
|
737
|
-
};
|
|
738
|
-
this.paperSessionSecret2 = (args, headers, signal) => {
|
|
739
|
-
return this.fetch(this.url('PaperSessionSecret2'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
740
|
-
return buildResponse(res).then(_data => {
|
|
741
|
-
return {
|
|
742
|
-
secret: _data.secret
|
|
743
|
-
};
|
|
744
|
-
});
|
|
745
|
-
}, error => {
|
|
746
|
-
throw WebrpcRequestFailedError.new({
|
|
747
|
-
cause: `fetch(): ${error.message || ''}`
|
|
748
|
-
});
|
|
749
|
-
});
|
|
750
|
-
};
|
|
751
|
-
this.linkWallet = (args, headers, signal) => {
|
|
752
|
-
return this.fetch(this.url('LinkWallet'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
753
|
-
return buildResponse(res).then(_data => {
|
|
754
|
-
return {
|
|
755
|
-
status: _data.status
|
|
756
|
-
};
|
|
757
|
-
});
|
|
758
|
-
}, error => {
|
|
759
|
-
throw WebrpcRequestFailedError.new({
|
|
760
|
-
cause: `fetch(): ${error.message || ''}`
|
|
761
|
-
});
|
|
762
|
-
});
|
|
763
|
-
};
|
|
764
|
-
this.getLinkedWallets = (args, headers, signal) => {
|
|
765
|
-
return this.fetch(this.url('GetLinkedWallets'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
766
|
-
return buildResponse(res).then(_data => {
|
|
767
|
-
return {
|
|
768
|
-
linkedWallets: _data.linkedWallets
|
|
769
|
-
};
|
|
770
|
-
});
|
|
771
|
-
}, error => {
|
|
772
|
-
throw WebrpcRequestFailedError.new({
|
|
773
|
-
cause: `fetch(): ${error.message || ''}`
|
|
774
|
-
});
|
|
775
|
-
});
|
|
776
|
-
};
|
|
777
|
-
this.removeLinkedWallet = (args, headers, signal) => {
|
|
778
|
-
return this.fetch(this.url('RemoveLinkedWallet'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
779
|
-
return buildResponse(res).then(_data => {
|
|
780
|
-
return {
|
|
781
|
-
status: _data.status
|
|
782
|
-
};
|
|
783
|
-
});
|
|
784
|
-
}, error => {
|
|
785
|
-
throw WebrpcRequestFailedError.new({
|
|
786
|
-
cause: `fetch(): ${error.message || ''}`
|
|
787
|
-
});
|
|
788
|
-
});
|
|
789
|
-
};
|
|
790
|
-
this.generateWaaSVerificationURL = (args, headers, signal) => {
|
|
791
|
-
return this.fetch(this.url('GenerateWaaSVerificationURL'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
792
|
-
return buildResponse(res).then(_data => {
|
|
793
|
-
return {
|
|
794
|
-
nonce: _data.nonce,
|
|
795
|
-
verificationURL: _data.verificationURL
|
|
796
|
-
};
|
|
797
|
-
});
|
|
798
|
-
}, error => {
|
|
799
|
-
throw WebrpcRequestFailedError.new({
|
|
800
|
-
cause: `fetch(): ${error.message || ''}`
|
|
801
|
-
});
|
|
802
|
-
});
|
|
803
|
-
};
|
|
804
|
-
this.validateWaaSVerificationNonce = (args, headers, signal) => {
|
|
805
|
-
return this.fetch(this.url('ValidateWaaSVerificationNonce'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
806
|
-
return buildResponse(res).then(_data => {
|
|
807
|
-
return {
|
|
808
|
-
walletAddress: _data.walletAddress
|
|
809
|
-
};
|
|
810
|
-
});
|
|
811
|
-
}, error => {
|
|
812
|
-
throw WebrpcRequestFailedError.new({
|
|
813
|
-
cause: `fetch(): ${error.message || ''}`
|
|
814
|
-
});
|
|
815
|
-
});
|
|
816
|
-
};
|
|
817
|
-
this.listAdoptedWallets = (args, headers, signal) => {
|
|
818
|
-
return this.fetch(this.url('ListAdoptedWallets'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
819
|
-
return buildResponse(res).then(_data => {
|
|
820
|
-
return {
|
|
821
|
-
page: _data.page,
|
|
822
|
-
wallets: _data.wallets
|
|
823
|
-
};
|
|
824
|
-
});
|
|
825
|
-
}, error => {
|
|
826
|
-
throw WebrpcRequestFailedError.new({
|
|
827
|
-
cause: `fetch(): ${error.message || ''}`
|
|
828
|
-
});
|
|
829
|
-
});
|
|
830
|
-
};
|
|
831
|
-
this.getLifiChains = (headers, signal) => {
|
|
832
|
-
return this.fetch(this.url('GetLifiChains'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
833
|
-
return buildResponse(res).then(_data => {
|
|
834
|
-
return {
|
|
835
|
-
chains: _data.chains
|
|
836
|
-
};
|
|
837
|
-
});
|
|
838
|
-
}, error => {
|
|
839
|
-
throw WebrpcRequestFailedError.new({
|
|
840
|
-
cause: `fetch(): ${error.message || ''}`
|
|
841
|
-
});
|
|
842
|
-
});
|
|
843
|
-
};
|
|
844
|
-
this.getLifiTokens = (args, headers, signal) => {
|
|
845
|
-
return this.fetch(this.url('GetLifiTokens'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
846
|
-
return buildResponse(res).then(_data => {
|
|
847
|
-
return {
|
|
848
|
-
tokens: _data.tokens
|
|
849
|
-
};
|
|
850
|
-
});
|
|
851
|
-
}, error => {
|
|
852
|
-
throw WebrpcRequestFailedError.new({
|
|
853
|
-
cause: `fetch(): ${error.message || ''}`
|
|
854
|
-
});
|
|
855
|
-
});
|
|
856
|
-
};
|
|
857
|
-
this.getLifiSwapRoutes = (args, headers, signal) => {
|
|
858
|
-
return this.fetch(this.url('GetLifiSwapRoutes'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
859
|
-
return buildResponse(res).then(_data => {
|
|
860
|
-
return {
|
|
861
|
-
routes: _data.routes
|
|
862
|
-
};
|
|
863
|
-
});
|
|
864
|
-
}, error => {
|
|
865
|
-
throw WebrpcRequestFailedError.new({
|
|
866
|
-
cause: `fetch(): ${error.message || ''}`
|
|
867
|
-
});
|
|
868
|
-
});
|
|
869
|
-
};
|
|
870
|
-
this.getLifiSwapQuote = (args, headers, signal) => {
|
|
871
|
-
return this.fetch(this.url('GetLifiSwapQuote'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
872
|
-
return buildResponse(res).then(_data => {
|
|
873
|
-
return {
|
|
874
|
-
quote: _data.quote
|
|
875
|
-
};
|
|
876
|
-
});
|
|
877
|
-
}, error => {
|
|
878
|
-
throw WebrpcRequestFailedError.new({
|
|
879
|
-
cause: `fetch(): ${error.message || ''}`
|
|
880
|
-
});
|
|
881
|
-
});
|
|
882
|
-
};
|
|
883
|
-
this.getIntentCallsPayloads = (args, headers, signal) => {
|
|
884
|
-
return this.fetch(this.url('GetIntentCallsPayloads'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
885
|
-
return buildResponse(res).then(_data => {
|
|
886
|
-
return {
|
|
887
|
-
calls: _data.calls,
|
|
888
|
-
preconditions: _data.preconditions,
|
|
889
|
-
metaTxns: _data.metaTxns,
|
|
890
|
-
trailsFee: _data.trailsFee,
|
|
891
|
-
quote: _data.quote,
|
|
892
|
-
feeQuotes: _data.feeQuotes,
|
|
893
|
-
originIntentAddress: _data.originIntentAddress,
|
|
894
|
-
destinationIntentAddress: _data.destinationIntentAddress
|
|
895
|
-
};
|
|
896
|
-
});
|
|
897
|
-
}, error => {
|
|
898
|
-
throw WebrpcRequestFailedError.new({
|
|
899
|
-
cause: `fetch(): ${error.message || ''}`
|
|
900
|
-
});
|
|
901
|
-
});
|
|
902
|
-
};
|
|
903
|
-
this.commitIntentConfig = (args, headers, signal) => {
|
|
904
|
-
return this.fetch(this.url('CommitIntentConfig'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
905
|
-
return buildResponse(res).then(_data => {
|
|
906
|
-
return {
|
|
907
|
-
config: _data.config
|
|
908
|
-
};
|
|
909
|
-
});
|
|
910
|
-
}, error => {
|
|
911
|
-
throw WebrpcRequestFailedError.new({
|
|
912
|
-
cause: `fetch(): ${error.message || ''}`
|
|
913
|
-
});
|
|
914
|
-
});
|
|
915
|
-
};
|
|
916
|
-
this.getIntentConfig = (args, headers, signal) => {
|
|
917
|
-
return this.fetch(this.url('GetIntentConfig'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
918
|
-
return buildResponse(res).then(_data => {
|
|
919
|
-
return {
|
|
920
|
-
config: _data.config
|
|
921
|
-
};
|
|
922
|
-
});
|
|
923
|
-
}, error => {
|
|
924
|
-
throw WebrpcRequestFailedError.new({
|
|
925
|
-
cause: `fetch(): ${error.message || ''}`
|
|
926
|
-
});
|
|
927
|
-
});
|
|
928
|
-
};
|
|
929
|
-
this.listCurrencyGroups = (headers, signal) => {
|
|
930
|
-
return this.fetch(this.url('ListCurrencyGroups'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
931
|
-
return buildResponse(res).then(_data => {
|
|
932
|
-
return {
|
|
933
|
-
currencyGroups: _data.currencyGroups
|
|
934
|
-
};
|
|
935
|
-
});
|
|
936
|
-
}, error => {
|
|
937
|
-
throw WebrpcRequestFailedError.new({
|
|
938
|
-
cause: `fetch(): ${error.message || ''}`
|
|
939
|
-
});
|
|
940
|
-
});
|
|
941
|
-
};
|
|
942
|
-
this.addOffchainInventory = (args, headers, signal) => {
|
|
943
|
-
return this.fetch(this.url('AddOffchainInventory'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
944
|
-
return buildResponse(res).then(_data => {
|
|
945
|
-
return {
|
|
946
|
-
inventoryId: _data.inventoryId
|
|
947
|
-
};
|
|
948
|
-
});
|
|
949
|
-
}, error => {
|
|
950
|
-
throw WebrpcRequestFailedError.new({
|
|
951
|
-
cause: `fetch(): ${error.message || ''}`
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
};
|
|
955
|
-
this.getOffchainInventory = (args, headers, signal) => {
|
|
956
|
-
return this.fetch(this.url('GetOffchainInventory'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
957
|
-
return buildResponse(res).then(_data => {
|
|
958
|
-
return {
|
|
959
|
-
inventory: _data.inventory
|
|
960
|
-
};
|
|
961
|
-
});
|
|
962
|
-
}, error => {
|
|
963
|
-
throw WebrpcRequestFailedError.new({
|
|
964
|
-
cause: `fetch(): ${error.message || ''}`
|
|
965
|
-
});
|
|
966
|
-
});
|
|
967
|
-
};
|
|
968
|
-
this.listOffchainInventories = (args, headers, signal) => {
|
|
969
|
-
return this.fetch(this.url('ListOffchainInventories'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
970
|
-
return buildResponse(res).then(_data => {
|
|
971
|
-
return {
|
|
972
|
-
inventory: _data.inventory
|
|
973
|
-
};
|
|
974
|
-
});
|
|
975
|
-
}, error => {
|
|
976
|
-
throw WebrpcRequestFailedError.new({
|
|
977
|
-
cause: `fetch(): ${error.message || ''}`
|
|
978
|
-
});
|
|
979
|
-
});
|
|
980
|
-
};
|
|
981
|
-
this.updateOffchainInventory = (args, headers, signal) => {
|
|
982
|
-
return this.fetch(this.url('UpdateOffchainInventory'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
983
|
-
return buildResponse(res).then(_data => {
|
|
984
|
-
return {};
|
|
985
|
-
});
|
|
986
|
-
}, error => {
|
|
987
|
-
throw WebrpcRequestFailedError.new({
|
|
988
|
-
cause: `fetch(): ${error.message || ''}`
|
|
989
|
-
});
|
|
990
|
-
});
|
|
991
|
-
};
|
|
992
|
-
this.deleteOffchainInventory = (args, headers, signal) => {
|
|
993
|
-
return this.fetch(this.url('DeleteOffchainInventory'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
994
|
-
return buildResponse(res).then(_data => {
|
|
995
|
-
return {
|
|
996
|
-
ok: _data.ok
|
|
997
|
-
};
|
|
998
|
-
});
|
|
999
|
-
}, error => {
|
|
1000
|
-
throw WebrpcRequestFailedError.new({
|
|
1001
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1002
|
-
});
|
|
1003
|
-
});
|
|
1004
|
-
};
|
|
1005
|
-
this.requestOffchainPayment = (args, headers, signal) => {
|
|
1006
|
-
return this.fetch(this.url('RequestOffchainPayment'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1007
|
-
return buildResponse(res).then(_data => {
|
|
1008
|
-
return {
|
|
1009
|
-
payment: _data.payment
|
|
1010
|
-
};
|
|
1011
|
-
});
|
|
1012
|
-
}, error => {
|
|
1013
|
-
throw WebrpcRequestFailedError.new({
|
|
1014
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1015
|
-
});
|
|
1016
|
-
});
|
|
1017
|
-
};
|
|
1018
|
-
this.listOffchainPayments = (args, headers, signal) => {
|
|
1019
|
-
return this.fetch(this.url('ListOffchainPayments'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1020
|
-
return buildResponse(res).then(_data => {
|
|
1021
|
-
return {
|
|
1022
|
-
page: _data.page,
|
|
1023
|
-
payments: _data.payments
|
|
1024
|
-
};
|
|
1025
|
-
});
|
|
1026
|
-
}, error => {
|
|
1027
|
-
throw WebrpcRequestFailedError.new({
|
|
1028
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1029
|
-
});
|
|
1030
|
-
});
|
|
1031
|
-
};
|
|
1032
|
-
this.savePack = (args, headers, signal) => {
|
|
1033
|
-
return this.fetch(this.url('SavePack'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1034
|
-
return buildResponse(res).then(_data => {
|
|
1035
|
-
return {
|
|
1036
|
-
merkleRoot: _data.merkleRoot
|
|
1037
|
-
};
|
|
1038
|
-
});
|
|
1039
|
-
}, error => {
|
|
1040
|
-
throw WebrpcRequestFailedError.new({
|
|
1041
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1042
|
-
});
|
|
1043
|
-
});
|
|
1044
|
-
};
|
|
1045
|
-
this.getPack = (args, headers, signal) => {
|
|
1046
|
-
return this.fetch(this.url('GetPack'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1047
|
-
return buildResponse(res).then(_data => {
|
|
1048
|
-
return {
|
|
1049
|
-
pack: _data.pack
|
|
1050
|
-
};
|
|
1051
|
-
});
|
|
1052
|
-
}, error => {
|
|
1053
|
-
throw WebrpcRequestFailedError.new({
|
|
1054
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1055
|
-
});
|
|
1056
|
-
});
|
|
1057
|
-
};
|
|
1058
|
-
this.getPackIds = (args, headers, signal) => {
|
|
1059
|
-
return this.fetch(this.url('GetPackIds'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1060
|
-
return buildResponse(res).then(_data => {
|
|
1061
|
-
return {
|
|
1062
|
-
packIds: _data.packIds
|
|
1063
|
-
};
|
|
1064
|
-
});
|
|
1065
|
-
}, error => {
|
|
1066
|
-
throw WebrpcRequestFailedError.new({
|
|
1067
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1068
|
-
});
|
|
1069
|
-
});
|
|
1070
|
-
};
|
|
1071
|
-
this.deletePack = (args, headers, signal) => {
|
|
1072
|
-
return this.fetch(this.url('DeletePack'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1073
|
-
return buildResponse(res).then(_data => {
|
|
1074
|
-
return {
|
|
1075
|
-
status: _data.status
|
|
1076
|
-
};
|
|
1077
|
-
});
|
|
1078
|
-
}, error => {
|
|
1079
|
-
throw WebrpcRequestFailedError.new({
|
|
1080
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1081
|
-
});
|
|
1082
|
-
});
|
|
1083
|
-
};
|
|
1084
|
-
this.updatePackContent = (args, headers, signal) => {
|
|
1085
|
-
return this.fetch(this.url('UpdatePackContent'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1086
|
-
return buildResponse(res).then(_data => {
|
|
1087
|
-
return {
|
|
1088
|
-
merkleRoot: _data.merkleRoot
|
|
1089
|
-
};
|
|
1090
|
-
});
|
|
1091
|
-
}, error => {
|
|
1092
|
-
throw WebrpcRequestFailedError.new({
|
|
1093
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1094
|
-
});
|
|
1095
|
-
});
|
|
1096
|
-
};
|
|
1097
|
-
this.getRevealTxData = (args, headers, signal) => {
|
|
1098
|
-
return this.fetch(this.url('GetRevealTxData'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1099
|
-
return buildResponse(res).then(_data => {
|
|
1100
|
-
return {
|
|
1101
|
-
txData: _data.txData
|
|
1102
|
-
};
|
|
1103
|
-
});
|
|
1104
|
-
}, error => {
|
|
1105
|
-
throw WebrpcRequestFailedError.new({
|
|
1106
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1107
|
-
});
|
|
1108
|
-
});
|
|
1109
|
-
};
|
|
1110
|
-
this.checkoutOptionsPrimary = (args, headers, signal) => {
|
|
1111
|
-
return this.fetch(this.url('CheckoutOptionsPrimary'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1112
|
-
return buildResponse(res).then(_data => {
|
|
1113
|
-
return {
|
|
1114
|
-
options: _data.options
|
|
1115
|
-
};
|
|
1116
|
-
});
|
|
1117
|
-
}, error => {
|
|
1118
|
-
throw WebrpcRequestFailedError.new({
|
|
1119
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1120
|
-
});
|
|
1121
|
-
});
|
|
1122
|
-
};
|
|
1123
|
-
this.checkoutOptionsSecondary = (args, headers, signal) => {
|
|
1124
|
-
return this.fetch(this.url('CheckoutOptionsSecondary'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1125
|
-
return buildResponse(res).then(_data => {
|
|
1126
|
-
return {
|
|
1127
|
-
options: _data.options
|
|
1128
|
-
};
|
|
1129
|
-
});
|
|
1130
|
-
}, error => {
|
|
1131
|
-
throw WebrpcRequestFailedError.new({
|
|
1132
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1133
|
-
});
|
|
1134
|
-
});
|
|
1135
|
-
};
|
|
1136
|
-
this.checkoutOptionsGetTransakContractID = (args, headers, signal) => {
|
|
1137
|
-
return this.fetch(this.url('CheckoutOptionsGetTransakContractID'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1138
|
-
return buildResponse(res).then(_data => {
|
|
1139
|
-
return {
|
|
1140
|
-
contractId: _data.contractId
|
|
1141
|
-
};
|
|
1142
|
-
});
|
|
1143
|
-
}, error => {
|
|
1144
|
-
throw WebrpcRequestFailedError.new({
|
|
1145
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1146
|
-
});
|
|
1147
|
-
});
|
|
1148
|
-
};
|
|
1149
|
-
this.fortePayCreateIntent = (args, headers, signal) => {
|
|
1150
|
-
return this.fetch(this.url('FortePayCreateIntent'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1151
|
-
return buildResponse(res).then(_data => {
|
|
1152
|
-
return {
|
|
1153
|
-
resp: _data.resp
|
|
1154
|
-
};
|
|
1155
|
-
});
|
|
1156
|
-
}, error => {
|
|
1157
|
-
throw WebrpcRequestFailedError.new({
|
|
1158
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1159
|
-
});
|
|
1160
|
-
});
|
|
1161
|
-
};
|
|
1162
|
-
this.fortePayGetPaymentStatuses = (args, headers, signal) => {
|
|
1163
|
-
return this.fetch(this.url('FortePayGetPaymentStatuses'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1164
|
-
return buildResponse(res).then(_data => {
|
|
1165
|
-
return {
|
|
1166
|
-
statuses: _data.statuses
|
|
1167
|
-
};
|
|
1168
|
-
});
|
|
1169
|
-
}, error => {
|
|
1170
|
-
throw WebrpcRequestFailedError.new({
|
|
1171
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1172
|
-
});
|
|
1173
|
-
});
|
|
1174
|
-
};
|
|
1175
|
-
this.getCCTPTransfer = (args, headers, signal) => {
|
|
1176
|
-
return this.fetch(this.url('GetCCTPTransfer'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1177
|
-
return buildResponse(res).then(_data => {
|
|
1178
|
-
return {
|
|
1179
|
-
transfer: _data.transfer
|
|
1180
|
-
};
|
|
1181
|
-
});
|
|
1182
|
-
}, error => {
|
|
1183
|
-
throw WebrpcRequestFailedError.new({
|
|
1184
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1185
|
-
});
|
|
1186
|
-
});
|
|
1187
|
-
};
|
|
1188
|
-
this.queueCCTPTransfer = (args, headers, signal) => {
|
|
1189
|
-
return this.fetch(this.url('QueueCCTPTransfer'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1190
|
-
return buildResponse(res).then(_data => {
|
|
1191
|
-
return {
|
|
1192
|
-
transfer: _data.transfer
|
|
1193
|
-
};
|
|
1194
|
-
});
|
|
1195
|
-
}, error => {
|
|
1196
|
-
throw WebrpcRequestFailedError.new({
|
|
1197
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1198
|
-
});
|
|
1199
|
-
});
|
|
1200
|
-
};
|
|
1201
|
-
this.queueIntentConfigExecution = (args, headers, signal) => {
|
|
1202
|
-
return this.fetch(this.url('QueueIntentConfigExecution'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1203
|
-
return buildResponse(res).then(_data => {
|
|
1204
|
-
return {
|
|
1205
|
-
status: _data.status
|
|
1206
|
-
};
|
|
1207
|
-
});
|
|
1208
|
-
}, error => {
|
|
1209
|
-
throw WebrpcRequestFailedError.new({
|
|
1210
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1211
|
-
});
|
|
1212
|
-
});
|
|
1213
|
-
};
|
|
1214
|
-
this.getIntentConfigExecutionStatus = (args, headers, signal) => {
|
|
1215
|
-
return this.fetch(this.url('GetIntentConfigExecutionStatus'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1216
|
-
return buildResponse(res).then(_data => {
|
|
1217
|
-
return {
|
|
1218
|
-
executionStatus: _data.executionStatus
|
|
1219
|
-
};
|
|
1220
|
-
});
|
|
1221
|
-
}, error => {
|
|
1222
|
-
throw WebrpcRequestFailedError.new({
|
|
1223
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1224
|
-
});
|
|
1225
|
-
});
|
|
1226
|
-
};
|
|
1227
|
-
this.listIntentConfigs = (args, headers, signal) => {
|
|
1228
|
-
return this.fetch(this.url('ListIntentConfigs'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1229
|
-
return buildResponse(res).then(_data => {
|
|
1230
|
-
return {
|
|
1231
|
-
page: _data.page,
|
|
1232
|
-
intentConfigs: _data.intentConfigs
|
|
1233
|
-
};
|
|
1234
|
-
});
|
|
1235
|
-
}, error => {
|
|
1236
|
-
throw WebrpcRequestFailedError.new({
|
|
1237
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1238
|
-
});
|
|
1239
|
-
});
|
|
1240
|
-
};
|
|
1241
|
-
this.queueMetaTxnReceipt = (args, headers, signal) => {
|
|
1242
|
-
return this.fetch(this.url('QueueMetaTxnReceipt'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1243
|
-
return buildResponse(res).then(_data => {
|
|
1244
|
-
return {
|
|
1245
|
-
status: _data.status
|
|
1246
|
-
};
|
|
1247
|
-
});
|
|
1248
|
-
}, error => {
|
|
1249
|
-
throw WebrpcRequestFailedError.new({
|
|
1250
|
-
cause: `fetch(): ${error.message || ''}`
|
|
1251
|
-
});
|
|
1252
|
-
});
|
|
1253
|
-
};
|
|
1254
|
-
this.hostname = hostname.replace(/\/*$/, '');
|
|
1255
|
-
this.fetch = (input, init) => fetch(input, init);
|
|
1256
|
-
}
|
|
1257
|
-
url(name) {
|
|
1258
|
-
return this.hostname + this.path + name;
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
|
|
1262
|
-
const reqHeaders = _extends({}, headers, {
|
|
1263
|
-
'Content-Type': 'application/json'
|
|
1264
|
-
});
|
|
1265
|
-
reqHeaders[WebrpcHeader] = WebrpcHeaderValue;
|
|
1266
|
-
return {
|
|
1267
|
-
method: 'POST',
|
|
1268
|
-
headers: reqHeaders,
|
|
1269
|
-
body: JSON.stringify(body || {}),
|
|
1270
|
-
signal
|
|
1271
|
-
};
|
|
1272
|
-
};
|
|
1273
|
-
const buildResponse = res => {
|
|
1274
|
-
return res.text().then(text => {
|
|
1275
|
-
let data;
|
|
1276
|
-
try {
|
|
1277
|
-
data = JSON.parse(text);
|
|
1278
|
-
} catch (error) {
|
|
1279
|
-
let message = '';
|
|
1280
|
-
if (error instanceof Error) {
|
|
1281
|
-
message = error.message;
|
|
1282
|
-
}
|
|
1283
|
-
throw WebrpcBadResponseError.new({
|
|
1284
|
-
status: res.status,
|
|
1285
|
-
cause: `JSON.parse(): ${message}: response text: ${text}`
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1288
|
-
if (!res.ok) {
|
|
1289
|
-
const code = typeof data.code === 'number' ? data.code : 0;
|
|
1290
|
-
throw (webrpcErrorByCode[code] || WebrpcError).new(data);
|
|
1291
|
-
}
|
|
1292
|
-
return data;
|
|
1293
|
-
});
|
|
1294
|
-
};
|
|
1295
|
-
|
|
1296
|
-
//
|
|
1297
|
-
// Errors
|
|
1298
|
-
//
|
|
1299
|
-
|
|
1300
|
-
class WebrpcError extends Error {
|
|
1301
|
-
constructor(name, code, message, status, cause) {
|
|
1302
|
-
super(message);
|
|
1303
|
-
this.name = void 0;
|
|
1304
|
-
this.code = void 0;
|
|
1305
|
-
this.message = void 0;
|
|
1306
|
-
this.status = void 0;
|
|
1307
|
-
this.cause = void 0;
|
|
1308
|
-
/** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
|
|
1309
|
-
this.msg = void 0;
|
|
1310
|
-
this.name = name || 'WebrpcError';
|
|
1311
|
-
this.code = typeof code === 'number' ? code : 0;
|
|
1312
|
-
this.message = message || `endpoint error ${this.code}`;
|
|
1313
|
-
this.msg = this.message;
|
|
1314
|
-
this.status = typeof status === 'number' ? status : 0;
|
|
1315
|
-
this.cause = cause;
|
|
1316
|
-
Object.setPrototypeOf(this, WebrpcError.prototype);
|
|
1317
|
-
}
|
|
1318
|
-
static new(payload) {
|
|
1319
|
-
return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause);
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
// Webrpc errors
|
|
1324
|
-
|
|
1325
|
-
class WebrpcEndpointError extends WebrpcError {
|
|
1326
|
-
constructor(name = 'WebrpcEndpoint', code = 0, message = `endpoint error`, status = 0, cause) {
|
|
1327
|
-
super(name, code, message, status, cause);
|
|
1328
|
-
Object.setPrototypeOf(this, WebrpcEndpointError.prototype);
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
class WebrpcRequestFailedError extends WebrpcError {
|
|
1332
|
-
constructor(name = 'WebrpcRequestFailed', code = -1, message = `request failed`, status = 0, cause) {
|
|
1333
|
-
super(name, code, message, status, cause);
|
|
1334
|
-
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype);
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
class WebrpcBadRouteError extends WebrpcError {
|
|
1338
|
-
constructor(name = 'WebrpcBadRoute', code = -2, message = `bad route`, status = 0, cause) {
|
|
1339
|
-
super(name, code, message, status, cause);
|
|
1340
|
-
Object.setPrototypeOf(this, WebrpcBadRouteError.prototype);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
class WebrpcBadMethodError extends WebrpcError {
|
|
1344
|
-
constructor(name = 'WebrpcBadMethod', code = -3, message = `bad method`, status = 0, cause) {
|
|
1345
|
-
super(name, code, message, status, cause);
|
|
1346
|
-
Object.setPrototypeOf(this, WebrpcBadMethodError.prototype);
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
class WebrpcBadRequestError extends WebrpcError {
|
|
1350
|
-
constructor(name = 'WebrpcBadRequest', code = -4, message = `bad request`, status = 0, cause) {
|
|
1351
|
-
super(name, code, message, status, cause);
|
|
1352
|
-
Object.setPrototypeOf(this, WebrpcBadRequestError.prototype);
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
class WebrpcBadResponseError extends WebrpcError {
|
|
1356
|
-
constructor(name = 'WebrpcBadResponse', code = -5, message = `bad response`, status = 0, cause) {
|
|
1357
|
-
super(name, code, message, status, cause);
|
|
1358
|
-
Object.setPrototypeOf(this, WebrpcBadResponseError.prototype);
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
class WebrpcServerPanicError extends WebrpcError {
|
|
1362
|
-
constructor(name = 'WebrpcServerPanic', code = -6, message = `server panic`, status = 0, cause) {
|
|
1363
|
-
super(name, code, message, status, cause);
|
|
1364
|
-
Object.setPrototypeOf(this, WebrpcServerPanicError.prototype);
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
class WebrpcInternalErrorError extends WebrpcError {
|
|
1368
|
-
constructor(name = 'WebrpcInternalError', code = -7, message = `internal error`, status = 0, cause) {
|
|
1369
|
-
super(name, code, message, status, cause);
|
|
1370
|
-
Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype);
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
class WebrpcClientDisconnectedError extends WebrpcError {
|
|
1374
|
-
constructor(name = 'WebrpcClientDisconnected', code = -8, message = `client disconnected`, status = 0, cause) {
|
|
1375
|
-
super(name, code, message, status, cause);
|
|
1376
|
-
Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype);
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
class WebrpcStreamLostError extends WebrpcError {
|
|
1380
|
-
constructor(name = 'WebrpcStreamLost', code = -9, message = `stream lost`, status = 0, cause) {
|
|
1381
|
-
super(name, code, message, status, cause);
|
|
1382
|
-
Object.setPrototypeOf(this, WebrpcStreamLostError.prototype);
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
class WebrpcStreamFinishedError extends WebrpcError {
|
|
1386
|
-
constructor(name = 'WebrpcStreamFinished', code = -10, message = `stream finished`, status = 0, cause) {
|
|
1387
|
-
super(name, code, message, status, cause);
|
|
1388
|
-
Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype);
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
// Schema errors
|
|
1393
|
-
|
|
1394
|
-
class UnauthorizedError extends WebrpcError {
|
|
1395
|
-
constructor(name = 'Unauthorized', code = 1000, message = `Unauthorized access`, status = 0, cause) {
|
|
1396
|
-
super(name, code, message, status, cause);
|
|
1397
|
-
Object.setPrototypeOf(this, UnauthorizedError.prototype);
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
class PermissionDeniedError extends WebrpcError {
|
|
1401
|
-
constructor(name = 'PermissionDenied', code = 1001, message = `Permission denied`, status = 0, cause) {
|
|
1402
|
-
super(name, code, message, status, cause);
|
|
1403
|
-
Object.setPrototypeOf(this, PermissionDeniedError.prototype);
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
class SessionExpiredError extends WebrpcError {
|
|
1407
|
-
constructor(name = 'SessionExpired', code = 1002, message = `Session expired`, status = 0, cause) {
|
|
1408
|
-
super(name, code, message, status, cause);
|
|
1409
|
-
Object.setPrototypeOf(this, SessionExpiredError.prototype);
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
class MethodNotFoundError extends WebrpcError {
|
|
1413
|
-
constructor(name = 'MethodNotFound', code = 1003, message = `Method not found`, status = 0, cause) {
|
|
1414
|
-
super(name, code, message, status, cause);
|
|
1415
|
-
Object.setPrototypeOf(this, MethodNotFoundError.prototype);
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
class RequestConflictError extends WebrpcError {
|
|
1419
|
-
constructor(name = 'RequestConflict', code = 1004, message = `Conflict with target resource`, status = 0, cause) {
|
|
1420
|
-
super(name, code, message, status, cause);
|
|
1421
|
-
Object.setPrototypeOf(this, RequestConflictError.prototype);
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
class AbortedError extends WebrpcError {
|
|
1425
|
-
constructor(name = 'Aborted', code = 1005, message = `Request aborted`, status = 0, cause) {
|
|
1426
|
-
super(name, code, message, status, cause);
|
|
1427
|
-
Object.setPrototypeOf(this, AbortedError.prototype);
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
class GeoblockedError extends WebrpcError {
|
|
1431
|
-
constructor(name = 'Geoblocked', code = 1006, message = `Geoblocked region`, status = 0, cause) {
|
|
1432
|
-
super(name, code, message, status, cause);
|
|
1433
|
-
Object.setPrototypeOf(this, GeoblockedError.prototype);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
class RateLimitedError extends WebrpcError {
|
|
1437
|
-
constructor(name = 'RateLimited', code = 1007, message = `Rate-limited. Please slow down.`, status = 0, cause) {
|
|
1438
|
-
super(name, code, message, status, cause);
|
|
1439
|
-
Object.setPrototypeOf(this, RateLimitedError.prototype);
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
class ProjectNotFoundError extends WebrpcError {
|
|
1443
|
-
constructor(name = 'ProjectNotFound', code = 1008, message = `Project not found`, status = 0, cause) {
|
|
1444
|
-
super(name, code, message, status, cause);
|
|
1445
|
-
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
class AccessKeyNotFoundError extends WebrpcError {
|
|
1449
|
-
constructor(name = 'AccessKeyNotFound', code = 1101, message = `Access key not found`, status = 0, cause) {
|
|
1450
|
-
super(name, code, message, status, cause);
|
|
1451
|
-
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype);
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
class AccessKeyMismatchError extends WebrpcError {
|
|
1455
|
-
constructor(name = 'AccessKeyMismatch', code = 1102, message = `Access key mismatch`, status = 0, cause) {
|
|
1456
|
-
super(name, code, message, status, cause);
|
|
1457
|
-
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype);
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
class InvalidOriginError extends WebrpcError {
|
|
1461
|
-
constructor(name = 'InvalidOrigin', code = 1103, message = `Invalid origin for Access Key`, status = 0, cause) {
|
|
1462
|
-
super(name, code, message, status, cause);
|
|
1463
|
-
Object.setPrototypeOf(this, InvalidOriginError.prototype);
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
class InvalidServiceError extends WebrpcError {
|
|
1467
|
-
constructor(name = 'InvalidService', code = 1104, message = `Service not enabled for Access key`, status = 0, cause) {
|
|
1468
|
-
super(name, code, message, status, cause);
|
|
1469
|
-
Object.setPrototypeOf(this, InvalidServiceError.prototype);
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
class UnauthorizedUserError extends WebrpcError {
|
|
1473
|
-
constructor(name = 'UnauthorizedUser', code = 1105, message = `Unauthorized user`, status = 0, cause) {
|
|
1474
|
-
super(name, code, message, status, cause);
|
|
1475
|
-
Object.setPrototypeOf(this, UnauthorizedUserError.prototype);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
class QuotaExceededError extends WebrpcError {
|
|
1479
|
-
constructor(name = 'QuotaExceeded', code = 1200, message = `Quota request exceeded`, status = 0, cause) {
|
|
1480
|
-
super(name, code, message, status, cause);
|
|
1481
|
-
Object.setPrototypeOf(this, QuotaExceededError.prototype);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
class QuotaRateLimitError extends WebrpcError {
|
|
1485
|
-
constructor(name = 'QuotaRateLimit', code = 1201, message = `Quota rate limit exceeded`, status = 0, cause) {
|
|
1486
|
-
super(name, code, message, status, cause);
|
|
1487
|
-
Object.setPrototypeOf(this, QuotaRateLimitError.prototype);
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
class NoDefaultKeyError extends WebrpcError {
|
|
1491
|
-
constructor(name = 'NoDefaultKey', code = 1300, message = `No default access key found`, status = 0, cause) {
|
|
1492
|
-
super(name, code, message, status, cause);
|
|
1493
|
-
Object.setPrototypeOf(this, NoDefaultKeyError.prototype);
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
class MaxAccessKeysError extends WebrpcError {
|
|
1497
|
-
constructor(name = 'MaxAccessKeys', code = 1301, message = `Access keys limit reached`, status = 0, cause) {
|
|
1498
|
-
super(name, code, message, status, cause);
|
|
1499
|
-
Object.setPrototypeOf(this, MaxAccessKeysError.prototype);
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
class AtLeastOneKeyError extends WebrpcError {
|
|
1503
|
-
constructor(name = 'AtLeastOneKey', code = 1302, message = `You need at least one Access Key`, status = 0, cause) {
|
|
1504
|
-
super(name, code, message, status, cause);
|
|
1505
|
-
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype);
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
class TimeoutError extends WebrpcError {
|
|
1509
|
-
constructor(name = 'Timeout', code = 1900, message = `Request timed out`, status = 0, cause) {
|
|
1510
|
-
super(name, code, message, status, cause);
|
|
1511
|
-
Object.setPrototypeOf(this, TimeoutError.prototype);
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
class InvalidArgumentError extends WebrpcError {
|
|
1515
|
-
constructor(name = 'InvalidArgument', code = 2000, message = `Invalid argument`, status = 0, cause) {
|
|
1516
|
-
super(name, code, message, status, cause);
|
|
1517
|
-
Object.setPrototypeOf(this, InvalidArgumentError.prototype);
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
class UnavailableError extends WebrpcError {
|
|
1521
|
-
constructor(name = 'Unavailable', code = 2002, message = `Unavailable resource`, status = 0, cause) {
|
|
1522
|
-
super(name, code, message, status, cause);
|
|
1523
|
-
Object.setPrototypeOf(this, UnavailableError.prototype);
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
class QueryFailedError extends WebrpcError {
|
|
1527
|
-
constructor(name = 'QueryFailed', code = 2003, message = `Query failed`, status = 0, cause) {
|
|
1528
|
-
super(name, code, message, status, cause);
|
|
1529
|
-
Object.setPrototypeOf(this, QueryFailedError.prototype);
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
class NotFoundError extends WebrpcError {
|
|
1533
|
-
constructor(name = 'NotFound', code = 3000, message = `Resource not found`, status = 0, cause) {
|
|
1534
|
-
super(name, code, message, status, cause);
|
|
1535
|
-
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
class UnsupportedNetworkError extends WebrpcError {
|
|
1539
|
-
constructor(name = 'UnsupportedNetwork', code = 3008, message = `Unsupported network`, status = 0, cause) {
|
|
1540
|
-
super(name, code, message, status, cause);
|
|
1541
|
-
Object.setPrototypeOf(this, UnsupportedNetworkError.prototype);
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
let errors = /*#__PURE__*/function (errors) {
|
|
1545
|
-
errors["WebrpcEndpoint"] = "WebrpcEndpoint";
|
|
1546
|
-
errors["WebrpcRequestFailed"] = "WebrpcRequestFailed";
|
|
1547
|
-
errors["WebrpcBadRoute"] = "WebrpcBadRoute";
|
|
1548
|
-
errors["WebrpcBadMethod"] = "WebrpcBadMethod";
|
|
1549
|
-
errors["WebrpcBadRequest"] = "WebrpcBadRequest";
|
|
1550
|
-
errors["WebrpcBadResponse"] = "WebrpcBadResponse";
|
|
1551
|
-
errors["WebrpcServerPanic"] = "WebrpcServerPanic";
|
|
1552
|
-
errors["WebrpcInternalError"] = "WebrpcInternalError";
|
|
1553
|
-
errors["WebrpcClientDisconnected"] = "WebrpcClientDisconnected";
|
|
1554
|
-
errors["WebrpcStreamLost"] = "WebrpcStreamLost";
|
|
1555
|
-
errors["WebrpcStreamFinished"] = "WebrpcStreamFinished";
|
|
1556
|
-
errors["Unauthorized"] = "Unauthorized";
|
|
1557
|
-
errors["PermissionDenied"] = "PermissionDenied";
|
|
1558
|
-
errors["SessionExpired"] = "SessionExpired";
|
|
1559
|
-
errors["MethodNotFound"] = "MethodNotFound";
|
|
1560
|
-
errors["RequestConflict"] = "RequestConflict";
|
|
1561
|
-
errors["Aborted"] = "Aborted";
|
|
1562
|
-
errors["Geoblocked"] = "Geoblocked";
|
|
1563
|
-
errors["RateLimited"] = "RateLimited";
|
|
1564
|
-
errors["ProjectNotFound"] = "ProjectNotFound";
|
|
1565
|
-
errors["AccessKeyNotFound"] = "AccessKeyNotFound";
|
|
1566
|
-
errors["AccessKeyMismatch"] = "AccessKeyMismatch";
|
|
1567
|
-
errors["InvalidOrigin"] = "InvalidOrigin";
|
|
1568
|
-
errors["InvalidService"] = "InvalidService";
|
|
1569
|
-
errors["UnauthorizedUser"] = "UnauthorizedUser";
|
|
1570
|
-
errors["QuotaExceeded"] = "QuotaExceeded";
|
|
1571
|
-
errors["QuotaRateLimit"] = "QuotaRateLimit";
|
|
1572
|
-
errors["NoDefaultKey"] = "NoDefaultKey";
|
|
1573
|
-
errors["MaxAccessKeys"] = "MaxAccessKeys";
|
|
1574
|
-
errors["AtLeastOneKey"] = "AtLeastOneKey";
|
|
1575
|
-
errors["Timeout"] = "Timeout";
|
|
1576
|
-
errors["InvalidArgument"] = "InvalidArgument";
|
|
1577
|
-
errors["Unavailable"] = "Unavailable";
|
|
1578
|
-
errors["QueryFailed"] = "QueryFailed";
|
|
1579
|
-
errors["NotFound"] = "NotFound";
|
|
1580
|
-
errors["UnsupportedNetwork"] = "UnsupportedNetwork";
|
|
1581
|
-
return errors;
|
|
1582
|
-
}({});
|
|
1583
|
-
let WebrpcErrorCodes = /*#__PURE__*/function (WebrpcErrorCodes) {
|
|
1584
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcEndpoint"] = 0] = "WebrpcEndpoint";
|
|
1585
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcRequestFailed"] = -1] = "WebrpcRequestFailed";
|
|
1586
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRoute"] = -2] = "WebrpcBadRoute";
|
|
1587
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadMethod"] = -3] = "WebrpcBadMethod";
|
|
1588
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRequest"] = -4] = "WebrpcBadRequest";
|
|
1589
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadResponse"] = -5] = "WebrpcBadResponse";
|
|
1590
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcServerPanic"] = -6] = "WebrpcServerPanic";
|
|
1591
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcInternalError"] = -7] = "WebrpcInternalError";
|
|
1592
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcClientDisconnected"] = -8] = "WebrpcClientDisconnected";
|
|
1593
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamLost"] = -9] = "WebrpcStreamLost";
|
|
1594
|
-
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamFinished"] = -10] = "WebrpcStreamFinished";
|
|
1595
|
-
WebrpcErrorCodes[WebrpcErrorCodes["Unauthorized"] = 1000] = "Unauthorized";
|
|
1596
|
-
WebrpcErrorCodes[WebrpcErrorCodes["PermissionDenied"] = 1001] = "PermissionDenied";
|
|
1597
|
-
WebrpcErrorCodes[WebrpcErrorCodes["SessionExpired"] = 1002] = "SessionExpired";
|
|
1598
|
-
WebrpcErrorCodes[WebrpcErrorCodes["MethodNotFound"] = 1003] = "MethodNotFound";
|
|
1599
|
-
WebrpcErrorCodes[WebrpcErrorCodes["RequestConflict"] = 1004] = "RequestConflict";
|
|
1600
|
-
WebrpcErrorCodes[WebrpcErrorCodes["Aborted"] = 1005] = "Aborted";
|
|
1601
|
-
WebrpcErrorCodes[WebrpcErrorCodes["Geoblocked"] = 1006] = "Geoblocked";
|
|
1602
|
-
WebrpcErrorCodes[WebrpcErrorCodes["RateLimited"] = 1007] = "RateLimited";
|
|
1603
|
-
WebrpcErrorCodes[WebrpcErrorCodes["ProjectNotFound"] = 1008] = "ProjectNotFound";
|
|
1604
|
-
WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyNotFound"] = 1101] = "AccessKeyNotFound";
|
|
1605
|
-
WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyMismatch"] = 1102] = "AccessKeyMismatch";
|
|
1606
|
-
WebrpcErrorCodes[WebrpcErrorCodes["InvalidOrigin"] = 1103] = "InvalidOrigin";
|
|
1607
|
-
WebrpcErrorCodes[WebrpcErrorCodes["InvalidService"] = 1104] = "InvalidService";
|
|
1608
|
-
WebrpcErrorCodes[WebrpcErrorCodes["UnauthorizedUser"] = 1105] = "UnauthorizedUser";
|
|
1609
|
-
WebrpcErrorCodes[WebrpcErrorCodes["QuotaExceeded"] = 1200] = "QuotaExceeded";
|
|
1610
|
-
WebrpcErrorCodes[WebrpcErrorCodes["QuotaRateLimit"] = 1201] = "QuotaRateLimit";
|
|
1611
|
-
WebrpcErrorCodes[WebrpcErrorCodes["NoDefaultKey"] = 1300] = "NoDefaultKey";
|
|
1612
|
-
WebrpcErrorCodes[WebrpcErrorCodes["MaxAccessKeys"] = 1301] = "MaxAccessKeys";
|
|
1613
|
-
WebrpcErrorCodes[WebrpcErrorCodes["AtLeastOneKey"] = 1302] = "AtLeastOneKey";
|
|
1614
|
-
WebrpcErrorCodes[WebrpcErrorCodes["Timeout"] = 1900] = "Timeout";
|
|
1615
|
-
WebrpcErrorCodes[WebrpcErrorCodes["InvalidArgument"] = 2000] = "InvalidArgument";
|
|
1616
|
-
WebrpcErrorCodes[WebrpcErrorCodes["Unavailable"] = 2002] = "Unavailable";
|
|
1617
|
-
WebrpcErrorCodes[WebrpcErrorCodes["QueryFailed"] = 2003] = "QueryFailed";
|
|
1618
|
-
WebrpcErrorCodes[WebrpcErrorCodes["NotFound"] = 3000] = "NotFound";
|
|
1619
|
-
WebrpcErrorCodes[WebrpcErrorCodes["UnsupportedNetwork"] = 3008] = "UnsupportedNetwork";
|
|
1620
|
-
return WebrpcErrorCodes;
|
|
1621
|
-
}({});
|
|
1622
|
-
const webrpcErrorByCode = {
|
|
1623
|
-
[0]: WebrpcEndpointError,
|
|
1624
|
-
[-1]: WebrpcRequestFailedError,
|
|
1625
|
-
[-2]: WebrpcBadRouteError,
|
|
1626
|
-
[-3]: WebrpcBadMethodError,
|
|
1627
|
-
[-4]: WebrpcBadRequestError,
|
|
1628
|
-
[-5]: WebrpcBadResponseError,
|
|
1629
|
-
[-6]: WebrpcServerPanicError,
|
|
1630
|
-
[-7]: WebrpcInternalErrorError,
|
|
1631
|
-
[-8]: WebrpcClientDisconnectedError,
|
|
1632
|
-
[-9]: WebrpcStreamLostError,
|
|
1633
|
-
[-10]: WebrpcStreamFinishedError,
|
|
1634
|
-
[1000]: UnauthorizedError,
|
|
1635
|
-
[1001]: PermissionDeniedError,
|
|
1636
|
-
[1002]: SessionExpiredError,
|
|
1637
|
-
[1003]: MethodNotFoundError,
|
|
1638
|
-
[1004]: RequestConflictError,
|
|
1639
|
-
[1005]: AbortedError,
|
|
1640
|
-
[1006]: GeoblockedError,
|
|
1641
|
-
[1007]: RateLimitedError,
|
|
1642
|
-
[1008]: ProjectNotFoundError,
|
|
1643
|
-
[1101]: AccessKeyNotFoundError,
|
|
1644
|
-
[1102]: AccessKeyMismatchError,
|
|
1645
|
-
[1103]: InvalidOriginError,
|
|
1646
|
-
[1104]: InvalidServiceError,
|
|
1647
|
-
[1105]: UnauthorizedUserError,
|
|
1648
|
-
[1200]: QuotaExceededError,
|
|
1649
|
-
[1201]: QuotaRateLimitError,
|
|
1650
|
-
[1300]: NoDefaultKeyError,
|
|
1651
|
-
[1301]: MaxAccessKeysError,
|
|
1652
|
-
[1302]: AtLeastOneKeyError,
|
|
1653
|
-
[1900]: TimeoutError,
|
|
1654
|
-
[2000]: InvalidArgumentError,
|
|
1655
|
-
[2002]: UnavailableError,
|
|
1656
|
-
[2003]: QueryFailedError,
|
|
1657
|
-
[3000]: NotFoundError,
|
|
1658
|
-
[3008]: UnsupportedNetworkError
|
|
1659
|
-
};
|
|
1660
|
-
|
|
1661
|
-
class SequenceAPIClient extends API {
|
|
1662
|
-
constructor(hostname, projectAccessKey, jwtAuth) {
|
|
1663
|
-
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
1664
|
-
this.projectAccessKey = projectAccessKey;
|
|
1665
|
-
this.jwtAuth = jwtAuth;
|
|
1666
|
-
this._fetch = (input, init) => {
|
|
1667
|
-
// automatically include jwt and access key auth header to requests
|
|
1668
|
-
// if its been set on the api client
|
|
1669
|
-
const headers = {};
|
|
1670
|
-
const jwtAuth = this.jwtAuth;
|
|
1671
|
-
const projectAccessKey = this.projectAccessKey;
|
|
1672
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
1673
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`;
|
|
1674
|
-
}
|
|
1675
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
1676
|
-
headers['X-Access-Key'] = projectAccessKey;
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
// before the request is made
|
|
1680
|
-
init.headers = _extends({}, init.headers, headers);
|
|
1681
|
-
return fetch(input, init);
|
|
1682
|
-
};
|
|
1683
|
-
this.fetch = this._fetch;
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
exports.API = API;
|
|
1688
|
-
exports.AbortedError = AbortedError;
|
|
1689
|
-
exports.AccessKeyMismatchError = AccessKeyMismatchError;
|
|
1690
|
-
exports.AccessKeyNotFoundError = AccessKeyNotFoundError;
|
|
1691
|
-
exports.AtLeastOneKeyError = AtLeastOneKeyError;
|
|
1692
|
-
exports.CheckoutOptionCrypto = CheckoutOptionCrypto;
|
|
1693
|
-
exports.CheckoutOptionNFTCheckoutProvider = CheckoutOptionNFTCheckoutProvider;
|
|
1694
|
-
exports.CheckoutOptionOnRampProvider = CheckoutOptionOnRampProvider;
|
|
1695
|
-
exports.CheckoutOptionSwapProvider = CheckoutOptionSwapProvider;
|
|
1696
|
-
exports.GeoblockedError = GeoblockedError;
|
|
1697
|
-
exports.GetLifiSwapRouteDirection = GetLifiSwapRouteDirection;
|
|
1698
|
-
exports.InvalidArgumentError = InvalidArgumentError;
|
|
1699
|
-
exports.InvalidOriginError = InvalidOriginError;
|
|
1700
|
-
exports.InvalidServiceError = InvalidServiceError;
|
|
1701
|
-
exports.MaxAccessKeysError = MaxAccessKeysError;
|
|
1702
|
-
exports.MethodNotFoundError = MethodNotFoundError;
|
|
1703
|
-
exports.NoDefaultKeyError = NoDefaultKeyError;
|
|
1704
|
-
exports.NotFoundError = NotFoundError;
|
|
1705
|
-
exports.PermissionDeniedError = PermissionDeniedError;
|
|
1706
|
-
exports.ProjectNotFoundError = ProjectNotFoundError;
|
|
1707
|
-
exports.QueryFailedError = QueryFailedError;
|
|
1708
|
-
exports.QuotaExceededError = QuotaExceededError;
|
|
1709
|
-
exports.QuotaRateLimitError = QuotaRateLimitError;
|
|
1710
|
-
exports.RateLimitedError = RateLimitedError;
|
|
1711
|
-
exports.RequestConflictError = RequestConflictError;
|
|
1712
|
-
exports.SequenceAPIClient = SequenceAPIClient;
|
|
1713
|
-
exports.SessionExpiredError = SessionExpiredError;
|
|
1714
|
-
exports.SortOrder = SortOrder;
|
|
1715
|
-
exports.TimeoutError = TimeoutError;
|
|
1716
|
-
exports.TokenType = TokenType;
|
|
1717
|
-
exports.TradeType = TradeType;
|
|
1718
|
-
exports.TransakBuySell = TransakBuySell;
|
|
1719
|
-
exports.UnauthorizedError = UnauthorizedError;
|
|
1720
|
-
exports.UnauthorizedUserError = UnauthorizedUserError;
|
|
1721
|
-
exports.UnavailableError = UnavailableError;
|
|
1722
|
-
exports.UnsupportedNetworkError = UnsupportedNetworkError;
|
|
1723
|
-
exports.VersionFromHeader = VersionFromHeader;
|
|
1724
|
-
exports.WebRPCSchemaHash = WebRPCSchemaHash;
|
|
1725
|
-
exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
|
|
1726
|
-
exports.WebRPCVersion = WebRPCVersion;
|
|
1727
|
-
exports.WebrpcBadMethodError = WebrpcBadMethodError;
|
|
1728
|
-
exports.WebrpcBadRequestError = WebrpcBadRequestError;
|
|
1729
|
-
exports.WebrpcBadResponseError = WebrpcBadResponseError;
|
|
1730
|
-
exports.WebrpcBadRouteError = WebrpcBadRouteError;
|
|
1731
|
-
exports.WebrpcClientDisconnectedError = WebrpcClientDisconnectedError;
|
|
1732
|
-
exports.WebrpcEndpointError = WebrpcEndpointError;
|
|
1733
|
-
exports.WebrpcError = WebrpcError;
|
|
1734
|
-
exports.WebrpcErrorCodes = WebrpcErrorCodes;
|
|
1735
|
-
exports.WebrpcHeader = WebrpcHeader;
|
|
1736
|
-
exports.WebrpcHeaderValue = WebrpcHeaderValue;
|
|
1737
|
-
exports.WebrpcInternalErrorError = WebrpcInternalErrorError;
|
|
1738
|
-
exports.WebrpcRequestFailedError = WebrpcRequestFailedError;
|
|
1739
|
-
exports.WebrpcServerPanicError = WebrpcServerPanicError;
|
|
1740
|
-
exports.WebrpcStreamFinishedError = WebrpcStreamFinishedError;
|
|
1741
|
-
exports.WebrpcStreamLostError = WebrpcStreamLostError;
|
|
1742
|
-
exports.errors = errors;
|
|
1743
|
-
exports.webrpcErrorByCode = webrpcErrorByCode;
|