@0xsequence/marketplace 2.3.19 → 2.3.21
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-marketplace.cjs.d.ts +2 -2
- package/dist/0xsequence-marketplace.cjs.dev.js +1396 -0
- package/dist/0xsequence-marketplace.cjs.js +6 -15
- package/dist/0xsequence-marketplace.cjs.prod.js +1396 -0
- package/dist/0xsequence-marketplace.esm.js +1332 -0
- package/dist/declarations/src/index.d.ts +8 -0
- package/dist/declarations/src/marketplace.gen.d.ts +1288 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1396 @@
|
|
|
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
|
+
// marketplace-api 6b46374337129883386b9668e652237c3b31eda1
|
|
17
|
+
// --
|
|
18
|
+
// Code generated by webrpc-gen@v0.25.4 with typescript generator. DO NOT EDIT.
|
|
19
|
+
//
|
|
20
|
+
// webrpc-gen -schema=marketplace.ridl -target=typescript -client -out=./clients/marketplace.gen.ts
|
|
21
|
+
|
|
22
|
+
const WebrpcHeader = 'Webrpc';
|
|
23
|
+
const WebrpcHeaderValue = 'webrpc@v0.25.4;gen-typescript@v0.17.0;marketplace-api@v0.0.0-6b46374337129883386b9668e652237c3b31eda1';
|
|
24
|
+
|
|
25
|
+
// WebRPC description and code-gen version
|
|
26
|
+
const WebRPCVersion = 'v1';
|
|
27
|
+
|
|
28
|
+
// Schema version of your RIDL schema
|
|
29
|
+
const WebRPCSchemaVersion = '';
|
|
30
|
+
|
|
31
|
+
// Schema hash generated from your RIDL schema
|
|
32
|
+
const WebRPCSchemaHash = '6b46374337129883386b9668e652237c3b31eda1';
|
|
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["ASC"] = "ASC";
|
|
75
|
+
SortOrder["DESC"] = "DESC";
|
|
76
|
+
return SortOrder;
|
|
77
|
+
}({});
|
|
78
|
+
let PropertyType = /*#__PURE__*/function (PropertyType) {
|
|
79
|
+
PropertyType["INT"] = "INT";
|
|
80
|
+
PropertyType["STRING"] = "STRING";
|
|
81
|
+
PropertyType["ARRAY"] = "ARRAY";
|
|
82
|
+
PropertyType["GENERIC"] = "GENERIC";
|
|
83
|
+
return PropertyType;
|
|
84
|
+
}({});
|
|
85
|
+
let MarketplaceKind = /*#__PURE__*/function (MarketplaceKind) {
|
|
86
|
+
MarketplaceKind["unknown"] = "unknown";
|
|
87
|
+
MarketplaceKind["sequence_marketplace_v1"] = "sequence_marketplace_v1";
|
|
88
|
+
MarketplaceKind["sequence_marketplace_v2"] = "sequence_marketplace_v2";
|
|
89
|
+
MarketplaceKind["blur"] = "blur";
|
|
90
|
+
MarketplaceKind["zerox"] = "zerox";
|
|
91
|
+
MarketplaceKind["opensea"] = "opensea";
|
|
92
|
+
MarketplaceKind["looks_rare"] = "looks_rare";
|
|
93
|
+
MarketplaceKind["x2y2"] = "x2y2";
|
|
94
|
+
MarketplaceKind["alienswap"] = "alienswap";
|
|
95
|
+
MarketplaceKind["payment_processor"] = "payment_processor";
|
|
96
|
+
MarketplaceKind["mintify"] = "mintify";
|
|
97
|
+
MarketplaceKind["magic_eden"] = "magic_eden";
|
|
98
|
+
return MarketplaceKind;
|
|
99
|
+
}({});
|
|
100
|
+
let OrderbookKind = /*#__PURE__*/function (OrderbookKind) {
|
|
101
|
+
OrderbookKind["unknown"] = "unknown";
|
|
102
|
+
OrderbookKind["sequence_marketplace_v1"] = "sequence_marketplace_v1";
|
|
103
|
+
OrderbookKind["sequence_marketplace_v2"] = "sequence_marketplace_v2";
|
|
104
|
+
OrderbookKind["blur"] = "blur";
|
|
105
|
+
OrderbookKind["opensea"] = "opensea";
|
|
106
|
+
OrderbookKind["looks_rare"] = "looks_rare";
|
|
107
|
+
OrderbookKind["reservoir"] = "reservoir";
|
|
108
|
+
OrderbookKind["x2y2"] = "x2y2";
|
|
109
|
+
return OrderbookKind;
|
|
110
|
+
}({});
|
|
111
|
+
let SourceKind = /*#__PURE__*/function (SourceKind) {
|
|
112
|
+
SourceKind["unknown"] = "unknown";
|
|
113
|
+
SourceKind["external"] = "external";
|
|
114
|
+
SourceKind["sequence_marketplace_v1"] = "sequence_marketplace_v1";
|
|
115
|
+
SourceKind["sequence_marketplace_v2"] = "sequence_marketplace_v2";
|
|
116
|
+
return SourceKind;
|
|
117
|
+
}({});
|
|
118
|
+
let OrderSide = /*#__PURE__*/function (OrderSide) {
|
|
119
|
+
OrderSide["unknown"] = "unknown";
|
|
120
|
+
OrderSide["listing"] = "listing";
|
|
121
|
+
OrderSide["offer"] = "offer";
|
|
122
|
+
return OrderSide;
|
|
123
|
+
}({});
|
|
124
|
+
let OrderStatus = /*#__PURE__*/function (OrderStatus) {
|
|
125
|
+
OrderStatus["unknown"] = "unknown";
|
|
126
|
+
OrderStatus["active"] = "active";
|
|
127
|
+
OrderStatus["inactive"] = "inactive";
|
|
128
|
+
OrderStatus["expired"] = "expired";
|
|
129
|
+
OrderStatus["cancelled"] = "cancelled";
|
|
130
|
+
OrderStatus["filled"] = "filled";
|
|
131
|
+
OrderStatus["decimals_missing"] = "decimals_missing";
|
|
132
|
+
return OrderStatus;
|
|
133
|
+
}({});
|
|
134
|
+
let ContractType = /*#__PURE__*/function (ContractType) {
|
|
135
|
+
ContractType["UNKNOWN"] = "UNKNOWN";
|
|
136
|
+
ContractType["ERC20"] = "ERC20";
|
|
137
|
+
ContractType["ERC721"] = "ERC721";
|
|
138
|
+
ContractType["ERC1155"] = "ERC1155";
|
|
139
|
+
return ContractType;
|
|
140
|
+
}({});
|
|
141
|
+
let CollectionPriority = /*#__PURE__*/function (CollectionPriority) {
|
|
142
|
+
CollectionPriority["unknown"] = "unknown";
|
|
143
|
+
CollectionPriority["low"] = "low";
|
|
144
|
+
CollectionPriority["normal"] = "normal";
|
|
145
|
+
CollectionPriority["high"] = "high";
|
|
146
|
+
return CollectionPriority;
|
|
147
|
+
}({});
|
|
148
|
+
let CollectionStatus = /*#__PURE__*/function (CollectionStatus) {
|
|
149
|
+
CollectionStatus["unknown"] = "unknown";
|
|
150
|
+
CollectionStatus["created"] = "created";
|
|
151
|
+
CollectionStatus["syncing_orders"] = "syncing_orders";
|
|
152
|
+
CollectionStatus["active"] = "active";
|
|
153
|
+
CollectionStatus["failed"] = "failed";
|
|
154
|
+
CollectionStatus["inactive"] = "inactive";
|
|
155
|
+
CollectionStatus["incompatible_type"] = "incompatible_type";
|
|
156
|
+
return CollectionStatus;
|
|
157
|
+
}({});
|
|
158
|
+
let ProjectStatus = /*#__PURE__*/function (ProjectStatus) {
|
|
159
|
+
ProjectStatus["unknown"] = "unknown";
|
|
160
|
+
ProjectStatus["active"] = "active";
|
|
161
|
+
ProjectStatus["inactive"] = "inactive";
|
|
162
|
+
return ProjectStatus;
|
|
163
|
+
}({});
|
|
164
|
+
let ItemsContractStatus = /*#__PURE__*/function (ItemsContractStatus) {
|
|
165
|
+
ItemsContractStatus["unknown"] = "unknown";
|
|
166
|
+
ItemsContractStatus["created"] = "created";
|
|
167
|
+
ItemsContractStatus["syncing_contract_metadata"] = "syncing_contract_metadata";
|
|
168
|
+
ItemsContractStatus["synced_contract_metadata"] = "synced_contract_metadata";
|
|
169
|
+
ItemsContractStatus["syncing_tokens"] = "syncing_tokens";
|
|
170
|
+
ItemsContractStatus["synced_tokens"] = "synced_tokens";
|
|
171
|
+
ItemsContractStatus["active"] = "active";
|
|
172
|
+
ItemsContractStatus["inactive"] = "inactive";
|
|
173
|
+
ItemsContractStatus["incompatible_type"] = "incompatible_type";
|
|
174
|
+
return ItemsContractStatus;
|
|
175
|
+
}({});
|
|
176
|
+
let CollectibleStatus = /*#__PURE__*/function (CollectibleStatus) {
|
|
177
|
+
CollectibleStatus["unknown"] = "unknown";
|
|
178
|
+
CollectibleStatus["active"] = "active";
|
|
179
|
+
CollectibleStatus["inactive"] = "inactive";
|
|
180
|
+
return CollectibleStatus;
|
|
181
|
+
}({});
|
|
182
|
+
let CollectibleSource = /*#__PURE__*/function (CollectibleSource) {
|
|
183
|
+
CollectibleSource["unknown"] = "unknown";
|
|
184
|
+
CollectibleSource["indexer"] = "indexer";
|
|
185
|
+
CollectibleSource["manual"] = "manual";
|
|
186
|
+
return CollectibleSource;
|
|
187
|
+
}({});
|
|
188
|
+
let CurrencyStatus = /*#__PURE__*/function (CurrencyStatus) {
|
|
189
|
+
CurrencyStatus["unknown"] = "unknown";
|
|
190
|
+
CurrencyStatus["created"] = "created";
|
|
191
|
+
CurrencyStatus["syncing_metadata"] = "syncing_metadata";
|
|
192
|
+
CurrencyStatus["active"] = "active";
|
|
193
|
+
CurrencyStatus["failed"] = "failed";
|
|
194
|
+
return CurrencyStatus;
|
|
195
|
+
}({});
|
|
196
|
+
let WalletKind = /*#__PURE__*/function (WalletKind) {
|
|
197
|
+
WalletKind["unknown"] = "unknown";
|
|
198
|
+
WalletKind["sequence"] = "sequence";
|
|
199
|
+
return WalletKind;
|
|
200
|
+
}({});
|
|
201
|
+
let StepType = /*#__PURE__*/function (StepType) {
|
|
202
|
+
StepType["unknown"] = "unknown";
|
|
203
|
+
StepType["tokenApproval"] = "tokenApproval";
|
|
204
|
+
StepType["buy"] = "buy";
|
|
205
|
+
StepType["sell"] = "sell";
|
|
206
|
+
StepType["createListing"] = "createListing";
|
|
207
|
+
StepType["createOffer"] = "createOffer";
|
|
208
|
+
StepType["signEIP712"] = "signEIP712";
|
|
209
|
+
StepType["signEIP191"] = "signEIP191";
|
|
210
|
+
StepType["cancel"] = "cancel";
|
|
211
|
+
return StepType;
|
|
212
|
+
}({});
|
|
213
|
+
let TransactionCrypto = /*#__PURE__*/function (TransactionCrypto) {
|
|
214
|
+
TransactionCrypto["none"] = "none";
|
|
215
|
+
TransactionCrypto["partially"] = "partially";
|
|
216
|
+
TransactionCrypto["all"] = "all";
|
|
217
|
+
return TransactionCrypto;
|
|
218
|
+
}({});
|
|
219
|
+
let TransactionNFTCheckoutProvider = /*#__PURE__*/function (TransactionNFTCheckoutProvider) {
|
|
220
|
+
TransactionNFTCheckoutProvider["unknown"] = "unknown";
|
|
221
|
+
TransactionNFTCheckoutProvider["transak"] = "transak";
|
|
222
|
+
TransactionNFTCheckoutProvider["sardine"] = "sardine";
|
|
223
|
+
return TransactionNFTCheckoutProvider;
|
|
224
|
+
}({});
|
|
225
|
+
let TransactionOnRampProvider = /*#__PURE__*/function (TransactionOnRampProvider) {
|
|
226
|
+
TransactionOnRampProvider["unknown"] = "unknown";
|
|
227
|
+
TransactionOnRampProvider["transak"] = "transak";
|
|
228
|
+
TransactionOnRampProvider["sardine"] = "sardine";
|
|
229
|
+
return TransactionOnRampProvider;
|
|
230
|
+
}({});
|
|
231
|
+
let TransactionSwapProvider = /*#__PURE__*/function (TransactionSwapProvider) {
|
|
232
|
+
TransactionSwapProvider["unknown"] = "unknown";
|
|
233
|
+
TransactionSwapProvider["lifi"] = "lifi";
|
|
234
|
+
return TransactionSwapProvider;
|
|
235
|
+
}({});
|
|
236
|
+
let ExecuteType = /*#__PURE__*/function (ExecuteType) {
|
|
237
|
+
ExecuteType["unknown"] = "unknown";
|
|
238
|
+
ExecuteType["order"] = "order";
|
|
239
|
+
return ExecuteType;
|
|
240
|
+
}({});
|
|
241
|
+
let ActivityAction = /*#__PURE__*/function (ActivityAction) {
|
|
242
|
+
ActivityAction["unknown"] = "unknown";
|
|
243
|
+
ActivityAction["listing"] = "listing";
|
|
244
|
+
ActivityAction["offer"] = "offer";
|
|
245
|
+
ActivityAction["mint"] = "mint";
|
|
246
|
+
ActivityAction["sale"] = "sale";
|
|
247
|
+
ActivityAction["listingCancel"] = "listingCancel";
|
|
248
|
+
ActivityAction["offerCancel"] = "offerCancel";
|
|
249
|
+
ActivityAction["transfer"] = "transfer";
|
|
250
|
+
return ActivityAction;
|
|
251
|
+
}({});
|
|
252
|
+
let PrimarySaleContractStatus = /*#__PURE__*/function (PrimarySaleContractStatus) {
|
|
253
|
+
PrimarySaleContractStatus["unknown"] = "unknown";
|
|
254
|
+
PrimarySaleContractStatus["created"] = "created";
|
|
255
|
+
PrimarySaleContractStatus["syncing_items"] = "syncing_items";
|
|
256
|
+
PrimarySaleContractStatus["active"] = "active";
|
|
257
|
+
PrimarySaleContractStatus["inactive"] = "inactive";
|
|
258
|
+
PrimarySaleContractStatus["incompatible_type"] = "incompatible_type";
|
|
259
|
+
PrimarySaleContractStatus["failed"] = "failed";
|
|
260
|
+
return PrimarySaleContractStatus;
|
|
261
|
+
}({});
|
|
262
|
+
let PrimarySaleItemDetailType = /*#__PURE__*/function (PrimarySaleItemDetailType) {
|
|
263
|
+
PrimarySaleItemDetailType["unknown"] = "unknown";
|
|
264
|
+
PrimarySaleItemDetailType["global"] = "global";
|
|
265
|
+
PrimarySaleItemDetailType["individual"] = "individual";
|
|
266
|
+
return PrimarySaleItemDetailType;
|
|
267
|
+
}({});
|
|
268
|
+
//
|
|
269
|
+
// Client
|
|
270
|
+
//
|
|
271
|
+
class Admin {
|
|
272
|
+
constructor(hostname, fetch) {
|
|
273
|
+
this.hostname = void 0;
|
|
274
|
+
this.fetch = void 0;
|
|
275
|
+
this.path = '/rpc/Admin/';
|
|
276
|
+
this.createCollection = (args, headers, signal) => {
|
|
277
|
+
return this.fetch(this.url('CreateCollection'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
278
|
+
return buildResponse(res).then(_data => {
|
|
279
|
+
return {
|
|
280
|
+
collection: _data.collection
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
}, error => {
|
|
284
|
+
throw WebrpcRequestFailedError.new({
|
|
285
|
+
cause: `fetch(): ${error.message || ''}`
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
this.getCollection = (args, headers, signal) => {
|
|
290
|
+
return this.fetch(this.url('GetCollection'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
291
|
+
return buildResponse(res).then(_data => {
|
|
292
|
+
return {
|
|
293
|
+
collection: _data.collection
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
}, error => {
|
|
297
|
+
throw WebrpcRequestFailedError.new({
|
|
298
|
+
cause: `fetch(): ${error.message || ''}`
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
this.updateCollection = (args, headers, signal) => {
|
|
303
|
+
return this.fetch(this.url('UpdateCollection'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
304
|
+
return buildResponse(res).then(_data => {
|
|
305
|
+
return {
|
|
306
|
+
collection: _data.collection
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
}, error => {
|
|
310
|
+
throw WebrpcRequestFailedError.new({
|
|
311
|
+
cause: `fetch(): ${error.message || ''}`
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
this.listCollections = (args, headers, signal) => {
|
|
316
|
+
return this.fetch(this.url('ListCollections'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
317
|
+
return buildResponse(res).then(_data => {
|
|
318
|
+
return {
|
|
319
|
+
collections: _data.collections,
|
|
320
|
+
page: _data.page
|
|
321
|
+
};
|
|
322
|
+
});
|
|
323
|
+
}, error => {
|
|
324
|
+
throw WebrpcRequestFailedError.new({
|
|
325
|
+
cause: `fetch(): ${error.message || ''}`
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
this.deleteCollection = (args, headers, signal) => {
|
|
330
|
+
return this.fetch(this.url('DeleteCollection'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
331
|
+
return buildResponse(res).then(_data => {
|
|
332
|
+
return {
|
|
333
|
+
collection: _data.collection
|
|
334
|
+
};
|
|
335
|
+
});
|
|
336
|
+
}, error => {
|
|
337
|
+
throw WebrpcRequestFailedError.new({
|
|
338
|
+
cause: `fetch(): ${error.message || ''}`
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
};
|
|
342
|
+
this.syncCollection = (args, headers, signal) => {
|
|
343
|
+
return this.fetch(this.url('SyncCollection'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
344
|
+
return buildResponse(res).then(_data => {
|
|
345
|
+
return {};
|
|
346
|
+
});
|
|
347
|
+
}, error => {
|
|
348
|
+
throw WebrpcRequestFailedError.new({
|
|
349
|
+
cause: `fetch(): ${error.message || ''}`
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
this.createPrimarySaleContract = (args, headers, signal) => {
|
|
354
|
+
return this.fetch(this.url('CreatePrimarySaleContract'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
355
|
+
return buildResponse(res).then(_data => {
|
|
356
|
+
return {
|
|
357
|
+
primarySaleContract: _data.primarySaleContract
|
|
358
|
+
};
|
|
359
|
+
});
|
|
360
|
+
}, error => {
|
|
361
|
+
throw WebrpcRequestFailedError.new({
|
|
362
|
+
cause: `fetch(): ${error.message || ''}`
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
this.deletePrimarySaleContract = (args, headers, signal) => {
|
|
367
|
+
return this.fetch(this.url('DeletePrimarySaleContract'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
368
|
+
return buildResponse(res).then(_data => {
|
|
369
|
+
return {};
|
|
370
|
+
});
|
|
371
|
+
}, error => {
|
|
372
|
+
throw WebrpcRequestFailedError.new({
|
|
373
|
+
cause: `fetch(): ${error.message || ''}`
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
this.createCurrency = (args, headers, signal) => {
|
|
378
|
+
return this.fetch(this.url('CreateCurrency'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
379
|
+
return buildResponse(res).then(_data => {
|
|
380
|
+
return {
|
|
381
|
+
currency: _data.currency
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
}, error => {
|
|
385
|
+
throw WebrpcRequestFailedError.new({
|
|
386
|
+
cause: `fetch(): ${error.message || ''}`
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
this.createCurrencies = (args, headers, signal) => {
|
|
391
|
+
return this.fetch(this.url('CreateCurrencies'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
392
|
+
return buildResponse(res).then(_data => {
|
|
393
|
+
return {
|
|
394
|
+
currency: _data.currency
|
|
395
|
+
};
|
|
396
|
+
});
|
|
397
|
+
}, error => {
|
|
398
|
+
throw WebrpcRequestFailedError.new({
|
|
399
|
+
cause: `fetch(): ${error.message || ''}`
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
this.updateCurrency = (args, headers, signal) => {
|
|
404
|
+
return this.fetch(this.url('UpdateCurrency'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
405
|
+
return buildResponse(res).then(_data => {
|
|
406
|
+
return {
|
|
407
|
+
currency: _data.currency
|
|
408
|
+
};
|
|
409
|
+
});
|
|
410
|
+
}, error => {
|
|
411
|
+
throw WebrpcRequestFailedError.new({
|
|
412
|
+
cause: `fetch(): ${error.message || ''}`
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
this.listCurrencies = (args, headers, signal) => {
|
|
417
|
+
return this.fetch(this.url('ListCurrencies'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
418
|
+
return buildResponse(res).then(_data => {
|
|
419
|
+
return {
|
|
420
|
+
currencies: _data.currencies
|
|
421
|
+
};
|
|
422
|
+
});
|
|
423
|
+
}, error => {
|
|
424
|
+
throw WebrpcRequestFailedError.new({
|
|
425
|
+
cause: `fetch(): ${error.message || ''}`
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
};
|
|
429
|
+
this.deleteCurrency = (args, headers, signal) => {
|
|
430
|
+
return this.fetch(this.url('DeleteCurrency'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
431
|
+
return buildResponse(res).then(_data => {
|
|
432
|
+
return {
|
|
433
|
+
currency: _data.currency
|
|
434
|
+
};
|
|
435
|
+
});
|
|
436
|
+
}, error => {
|
|
437
|
+
throw WebrpcRequestFailedError.new({
|
|
438
|
+
cause: `fetch(): ${error.message || ''}`
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
};
|
|
442
|
+
this.addCollectibles = (args, headers, signal) => {
|
|
443
|
+
return this.fetch(this.url('AddCollectibles'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
444
|
+
return buildResponse(res).then(_data => {
|
|
445
|
+
return {};
|
|
446
|
+
});
|
|
447
|
+
}, error => {
|
|
448
|
+
throw WebrpcRequestFailedError.new({
|
|
449
|
+
cause: `fetch(): ${error.message || ''}`
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
this.hostname = hostname.replace(/\/*$/, '');
|
|
454
|
+
this.fetch = (input, init) => fetch(input, init);
|
|
455
|
+
}
|
|
456
|
+
url(name) {
|
|
457
|
+
return this.hostname + this.path + name;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
class Marketplace {
|
|
461
|
+
constructor(hostname, fetch) {
|
|
462
|
+
this.hostname = void 0;
|
|
463
|
+
this.fetch = void 0;
|
|
464
|
+
this.path = '/rpc/Marketplace/';
|
|
465
|
+
this.listCurrencies = (args, headers, signal) => {
|
|
466
|
+
return this.fetch(this.url('ListCurrencies'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
467
|
+
return buildResponse(res).then(_data => {
|
|
468
|
+
return {
|
|
469
|
+
currencies: _data.currencies
|
|
470
|
+
};
|
|
471
|
+
});
|
|
472
|
+
}, error => {
|
|
473
|
+
throw WebrpcRequestFailedError.new({
|
|
474
|
+
cause: `fetch(): ${error.message || ''}`
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
};
|
|
478
|
+
this.getCollectionDetail = (args, headers, signal) => {
|
|
479
|
+
return this.fetch(this.url('GetCollectionDetail'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
480
|
+
return buildResponse(res).then(_data => {
|
|
481
|
+
return {
|
|
482
|
+
collection: _data.collection
|
|
483
|
+
};
|
|
484
|
+
});
|
|
485
|
+
}, error => {
|
|
486
|
+
throw WebrpcRequestFailedError.new({
|
|
487
|
+
cause: `fetch(): ${error.message || ''}`
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
this.getCollectible = (args, headers, signal) => {
|
|
492
|
+
return this.fetch(this.url('GetCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
493
|
+
return buildResponse(res).then(_data => {
|
|
494
|
+
return {
|
|
495
|
+
metadata: _data.metadata
|
|
496
|
+
};
|
|
497
|
+
});
|
|
498
|
+
}, error => {
|
|
499
|
+
throw WebrpcRequestFailedError.new({
|
|
500
|
+
cause: `fetch(): ${error.message || ''}`
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
};
|
|
504
|
+
this.getLowestPriceOfferForCollectible = (args, headers, signal) => {
|
|
505
|
+
return this.fetch(this.url('GetLowestPriceOfferForCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
506
|
+
return buildResponse(res).then(_data => {
|
|
507
|
+
return {
|
|
508
|
+
order: _data.order
|
|
509
|
+
};
|
|
510
|
+
});
|
|
511
|
+
}, error => {
|
|
512
|
+
throw WebrpcRequestFailedError.new({
|
|
513
|
+
cause: `fetch(): ${error.message || ''}`
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
};
|
|
517
|
+
this.getHighestPriceOfferForCollectible = (args, headers, signal) => {
|
|
518
|
+
return this.fetch(this.url('GetHighestPriceOfferForCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
519
|
+
return buildResponse(res).then(_data => {
|
|
520
|
+
return {
|
|
521
|
+
order: _data.order
|
|
522
|
+
};
|
|
523
|
+
});
|
|
524
|
+
}, error => {
|
|
525
|
+
throw WebrpcRequestFailedError.new({
|
|
526
|
+
cause: `fetch(): ${error.message || ''}`
|
|
527
|
+
});
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
this.getLowestPriceListingForCollectible = (args, headers, signal) => {
|
|
531
|
+
return this.fetch(this.url('GetLowestPriceListingForCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
532
|
+
return buildResponse(res).then(_data => {
|
|
533
|
+
return {
|
|
534
|
+
order: _data.order
|
|
535
|
+
};
|
|
536
|
+
});
|
|
537
|
+
}, error => {
|
|
538
|
+
throw WebrpcRequestFailedError.new({
|
|
539
|
+
cause: `fetch(): ${error.message || ''}`
|
|
540
|
+
});
|
|
541
|
+
});
|
|
542
|
+
};
|
|
543
|
+
this.getHighestPriceListingForCollectible = (args, headers, signal) => {
|
|
544
|
+
return this.fetch(this.url('GetHighestPriceListingForCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
545
|
+
return buildResponse(res).then(_data => {
|
|
546
|
+
return {
|
|
547
|
+
order: _data.order
|
|
548
|
+
};
|
|
549
|
+
});
|
|
550
|
+
}, error => {
|
|
551
|
+
throw WebrpcRequestFailedError.new({
|
|
552
|
+
cause: `fetch(): ${error.message || ''}`
|
|
553
|
+
});
|
|
554
|
+
});
|
|
555
|
+
};
|
|
556
|
+
this.listListingsForCollectible = (args, headers, signal) => {
|
|
557
|
+
return this.fetch(this.url('ListListingsForCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
558
|
+
return buildResponse(res).then(_data => {
|
|
559
|
+
return {
|
|
560
|
+
listings: _data.listings,
|
|
561
|
+
page: _data.page
|
|
562
|
+
};
|
|
563
|
+
});
|
|
564
|
+
}, error => {
|
|
565
|
+
throw WebrpcRequestFailedError.new({
|
|
566
|
+
cause: `fetch(): ${error.message || ''}`
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
};
|
|
570
|
+
this.listOffersForCollectible = (args, headers, signal) => {
|
|
571
|
+
return this.fetch(this.url('ListOffersForCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
572
|
+
return buildResponse(res).then(_data => {
|
|
573
|
+
return {
|
|
574
|
+
offers: _data.offers,
|
|
575
|
+
page: _data.page
|
|
576
|
+
};
|
|
577
|
+
});
|
|
578
|
+
}, error => {
|
|
579
|
+
throw WebrpcRequestFailedError.new({
|
|
580
|
+
cause: `fetch(): ${error.message || ''}`
|
|
581
|
+
});
|
|
582
|
+
});
|
|
583
|
+
};
|
|
584
|
+
this.listListings = (args, headers, signal) => {
|
|
585
|
+
return this.fetch(this.url('ListListings'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
586
|
+
return buildResponse(res).then(_data => {
|
|
587
|
+
return {
|
|
588
|
+
listings: _data.listings,
|
|
589
|
+
page: _data.page
|
|
590
|
+
};
|
|
591
|
+
});
|
|
592
|
+
}, error => {
|
|
593
|
+
throw WebrpcRequestFailedError.new({
|
|
594
|
+
cause: `fetch(): ${error.message || ''}`
|
|
595
|
+
});
|
|
596
|
+
});
|
|
597
|
+
};
|
|
598
|
+
this.listOffers = (args, headers, signal) => {
|
|
599
|
+
return this.fetch(this.url('ListOffers'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
600
|
+
return buildResponse(res).then(_data => {
|
|
601
|
+
return {
|
|
602
|
+
offers: _data.offers,
|
|
603
|
+
page: _data.page
|
|
604
|
+
};
|
|
605
|
+
});
|
|
606
|
+
}, error => {
|
|
607
|
+
throw WebrpcRequestFailedError.new({
|
|
608
|
+
cause: `fetch(): ${error.message || ''}`
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
this.getCountOfListingsForCollectible = (args, headers, signal) => {
|
|
613
|
+
return this.fetch(this.url('GetCountOfListingsForCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
614
|
+
return buildResponse(res).then(_data => {
|
|
615
|
+
return {
|
|
616
|
+
count: _data.count
|
|
617
|
+
};
|
|
618
|
+
});
|
|
619
|
+
}, error => {
|
|
620
|
+
throw WebrpcRequestFailedError.new({
|
|
621
|
+
cause: `fetch(): ${error.message || ''}`
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
};
|
|
625
|
+
this.getCountOfOffersForCollectible = (args, headers, signal) => {
|
|
626
|
+
return this.fetch(this.url('GetCountOfOffersForCollectible'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
627
|
+
return buildResponse(res).then(_data => {
|
|
628
|
+
return {
|
|
629
|
+
count: _data.count
|
|
630
|
+
};
|
|
631
|
+
});
|
|
632
|
+
}, error => {
|
|
633
|
+
throw WebrpcRequestFailedError.new({
|
|
634
|
+
cause: `fetch(): ${error.message || ''}`
|
|
635
|
+
});
|
|
636
|
+
});
|
|
637
|
+
};
|
|
638
|
+
this.getCollectibleLowestOffer = (args, headers, signal) => {
|
|
639
|
+
return this.fetch(this.url('GetCollectibleLowestOffer'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
640
|
+
return buildResponse(res).then(_data => {
|
|
641
|
+
return {
|
|
642
|
+
order: _data.order
|
|
643
|
+
};
|
|
644
|
+
});
|
|
645
|
+
}, error => {
|
|
646
|
+
throw WebrpcRequestFailedError.new({
|
|
647
|
+
cause: `fetch(): ${error.message || ''}`
|
|
648
|
+
});
|
|
649
|
+
});
|
|
650
|
+
};
|
|
651
|
+
this.getCollectibleHighestOffer = (args, headers, signal) => {
|
|
652
|
+
return this.fetch(this.url('GetCollectibleHighestOffer'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
653
|
+
return buildResponse(res).then(_data => {
|
|
654
|
+
return {
|
|
655
|
+
order: _data.order
|
|
656
|
+
};
|
|
657
|
+
});
|
|
658
|
+
}, error => {
|
|
659
|
+
throw WebrpcRequestFailedError.new({
|
|
660
|
+
cause: `fetch(): ${error.message || ''}`
|
|
661
|
+
});
|
|
662
|
+
});
|
|
663
|
+
};
|
|
664
|
+
this.getCollectibleLowestListing = (args, headers, signal) => {
|
|
665
|
+
return this.fetch(this.url('GetCollectibleLowestListing'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
666
|
+
return buildResponse(res).then(_data => {
|
|
667
|
+
return {
|
|
668
|
+
order: _data.order
|
|
669
|
+
};
|
|
670
|
+
});
|
|
671
|
+
}, error => {
|
|
672
|
+
throw WebrpcRequestFailedError.new({
|
|
673
|
+
cause: `fetch(): ${error.message || ''}`
|
|
674
|
+
});
|
|
675
|
+
});
|
|
676
|
+
};
|
|
677
|
+
this.getCollectibleHighestListing = (args, headers, signal) => {
|
|
678
|
+
return this.fetch(this.url('GetCollectibleHighestListing'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
679
|
+
return buildResponse(res).then(_data => {
|
|
680
|
+
return {
|
|
681
|
+
order: _data.order
|
|
682
|
+
};
|
|
683
|
+
});
|
|
684
|
+
}, error => {
|
|
685
|
+
throw WebrpcRequestFailedError.new({
|
|
686
|
+
cause: `fetch(): ${error.message || ''}`
|
|
687
|
+
});
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
this.listCollectibleListings = (args, headers, signal) => {
|
|
691
|
+
return this.fetch(this.url('ListCollectibleListings'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
692
|
+
return buildResponse(res).then(_data => {
|
|
693
|
+
return {
|
|
694
|
+
listings: _data.listings,
|
|
695
|
+
page: _data.page
|
|
696
|
+
};
|
|
697
|
+
});
|
|
698
|
+
}, error => {
|
|
699
|
+
throw WebrpcRequestFailedError.new({
|
|
700
|
+
cause: `fetch(): ${error.message || ''}`
|
|
701
|
+
});
|
|
702
|
+
});
|
|
703
|
+
};
|
|
704
|
+
this.listCollectibleOffers = (args, headers, signal) => {
|
|
705
|
+
return this.fetch(this.url('ListCollectibleOffers'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
706
|
+
return buildResponse(res).then(_data => {
|
|
707
|
+
return {
|
|
708
|
+
offers: _data.offers,
|
|
709
|
+
page: _data.page
|
|
710
|
+
};
|
|
711
|
+
});
|
|
712
|
+
}, error => {
|
|
713
|
+
throw WebrpcRequestFailedError.new({
|
|
714
|
+
cause: `fetch(): ${error.message || ''}`
|
|
715
|
+
});
|
|
716
|
+
});
|
|
717
|
+
};
|
|
718
|
+
this.generateBuyTransaction = (args, headers, signal) => {
|
|
719
|
+
return this.fetch(this.url('GenerateBuyTransaction'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
720
|
+
return buildResponse(res).then(_data => {
|
|
721
|
+
return {
|
|
722
|
+
steps: _data.steps
|
|
723
|
+
};
|
|
724
|
+
});
|
|
725
|
+
}, error => {
|
|
726
|
+
throw WebrpcRequestFailedError.new({
|
|
727
|
+
cause: `fetch(): ${error.message || ''}`
|
|
728
|
+
});
|
|
729
|
+
});
|
|
730
|
+
};
|
|
731
|
+
this.generateSellTransaction = (args, headers, signal) => {
|
|
732
|
+
return this.fetch(this.url('GenerateSellTransaction'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
733
|
+
return buildResponse(res).then(_data => {
|
|
734
|
+
return {
|
|
735
|
+
steps: _data.steps
|
|
736
|
+
};
|
|
737
|
+
});
|
|
738
|
+
}, error => {
|
|
739
|
+
throw WebrpcRequestFailedError.new({
|
|
740
|
+
cause: `fetch(): ${error.message || ''}`
|
|
741
|
+
});
|
|
742
|
+
});
|
|
743
|
+
};
|
|
744
|
+
this.generateListingTransaction = (args, headers, signal) => {
|
|
745
|
+
return this.fetch(this.url('GenerateListingTransaction'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
746
|
+
return buildResponse(res).then(_data => {
|
|
747
|
+
return {
|
|
748
|
+
steps: _data.steps
|
|
749
|
+
};
|
|
750
|
+
});
|
|
751
|
+
}, error => {
|
|
752
|
+
throw WebrpcRequestFailedError.new({
|
|
753
|
+
cause: `fetch(): ${error.message || ''}`
|
|
754
|
+
});
|
|
755
|
+
});
|
|
756
|
+
};
|
|
757
|
+
this.generateOfferTransaction = (args, headers, signal) => {
|
|
758
|
+
return this.fetch(this.url('GenerateOfferTransaction'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
759
|
+
return buildResponse(res).then(_data => {
|
|
760
|
+
return {
|
|
761
|
+
steps: _data.steps
|
|
762
|
+
};
|
|
763
|
+
});
|
|
764
|
+
}, error => {
|
|
765
|
+
throw WebrpcRequestFailedError.new({
|
|
766
|
+
cause: `fetch(): ${error.message || ''}`
|
|
767
|
+
});
|
|
768
|
+
});
|
|
769
|
+
};
|
|
770
|
+
this.generateCancelTransaction = (args, headers, signal) => {
|
|
771
|
+
return this.fetch(this.url('GenerateCancelTransaction'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
772
|
+
return buildResponse(res).then(_data => {
|
|
773
|
+
return {
|
|
774
|
+
steps: _data.steps
|
|
775
|
+
};
|
|
776
|
+
});
|
|
777
|
+
}, error => {
|
|
778
|
+
throw WebrpcRequestFailedError.new({
|
|
779
|
+
cause: `fetch(): ${error.message || ''}`
|
|
780
|
+
});
|
|
781
|
+
});
|
|
782
|
+
};
|
|
783
|
+
this.execute = (args, headers, signal) => {
|
|
784
|
+
return this.fetch(this.url('Execute'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
785
|
+
return buildResponse(res).then(_data => {
|
|
786
|
+
return {
|
|
787
|
+
orderId: _data.orderId
|
|
788
|
+
};
|
|
789
|
+
});
|
|
790
|
+
}, error => {
|
|
791
|
+
throw WebrpcRequestFailedError.new({
|
|
792
|
+
cause: `fetch(): ${error.message || ''}`
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
};
|
|
796
|
+
this.listCollectibles = (args, headers, signal) => {
|
|
797
|
+
return this.fetch(this.url('ListCollectibles'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
798
|
+
return buildResponse(res).then(_data => {
|
|
799
|
+
return {
|
|
800
|
+
collectibles: _data.collectibles,
|
|
801
|
+
page: _data.page
|
|
802
|
+
};
|
|
803
|
+
});
|
|
804
|
+
}, error => {
|
|
805
|
+
throw WebrpcRequestFailedError.new({
|
|
806
|
+
cause: `fetch(): ${error.message || ''}`
|
|
807
|
+
});
|
|
808
|
+
});
|
|
809
|
+
};
|
|
810
|
+
this.getCountOfAllCollectibles = (args, headers, signal) => {
|
|
811
|
+
return this.fetch(this.url('GetCountOfAllCollectibles'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
812
|
+
return buildResponse(res).then(_data => {
|
|
813
|
+
return {
|
|
814
|
+
count: _data.count
|
|
815
|
+
};
|
|
816
|
+
});
|
|
817
|
+
}, error => {
|
|
818
|
+
throw WebrpcRequestFailedError.new({
|
|
819
|
+
cause: `fetch(): ${error.message || ''}`
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
};
|
|
823
|
+
this.getCountOfFilteredCollectibles = (args, headers, signal) => {
|
|
824
|
+
return this.fetch(this.url('GetCountOfFilteredCollectibles'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
825
|
+
return buildResponse(res).then(_data => {
|
|
826
|
+
return {
|
|
827
|
+
count: _data.count
|
|
828
|
+
};
|
|
829
|
+
});
|
|
830
|
+
}, error => {
|
|
831
|
+
throw WebrpcRequestFailedError.new({
|
|
832
|
+
cause: `fetch(): ${error.message || ''}`
|
|
833
|
+
});
|
|
834
|
+
});
|
|
835
|
+
};
|
|
836
|
+
this.getFloorOrder = (args, headers, signal) => {
|
|
837
|
+
return this.fetch(this.url('GetFloorOrder'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
838
|
+
return buildResponse(res).then(_data => {
|
|
839
|
+
return {
|
|
840
|
+
collectible: _data.collectible
|
|
841
|
+
};
|
|
842
|
+
});
|
|
843
|
+
}, error => {
|
|
844
|
+
throw WebrpcRequestFailedError.new({
|
|
845
|
+
cause: `fetch(): ${error.message || ''}`
|
|
846
|
+
});
|
|
847
|
+
});
|
|
848
|
+
};
|
|
849
|
+
this.listCollectionActivities = (args, headers, signal) => {
|
|
850
|
+
return this.fetch(this.url('ListCollectionActivities'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
851
|
+
return buildResponse(res).then(_data => {
|
|
852
|
+
return {
|
|
853
|
+
activities: _data.activities,
|
|
854
|
+
page: _data.page
|
|
855
|
+
};
|
|
856
|
+
});
|
|
857
|
+
}, error => {
|
|
858
|
+
throw WebrpcRequestFailedError.new({
|
|
859
|
+
cause: `fetch(): ${error.message || ''}`
|
|
860
|
+
});
|
|
861
|
+
});
|
|
862
|
+
};
|
|
863
|
+
this.listCollectibleActivities = (args, headers, signal) => {
|
|
864
|
+
return this.fetch(this.url('ListCollectibleActivities'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
865
|
+
return buildResponse(res).then(_data => {
|
|
866
|
+
return {
|
|
867
|
+
activities: _data.activities,
|
|
868
|
+
page: _data.page
|
|
869
|
+
};
|
|
870
|
+
});
|
|
871
|
+
}, error => {
|
|
872
|
+
throw WebrpcRequestFailedError.new({
|
|
873
|
+
cause: `fetch(): ${error.message || ''}`
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
};
|
|
877
|
+
this.listCollectiblesWithLowestListing = (args, headers, signal) => {
|
|
878
|
+
return this.fetch(this.url('ListCollectiblesWithLowestListing'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
879
|
+
return buildResponse(res).then(_data => {
|
|
880
|
+
return {
|
|
881
|
+
collectibles: _data.collectibles,
|
|
882
|
+
page: _data.page
|
|
883
|
+
};
|
|
884
|
+
});
|
|
885
|
+
}, error => {
|
|
886
|
+
throw WebrpcRequestFailedError.new({
|
|
887
|
+
cause: `fetch(): ${error.message || ''}`
|
|
888
|
+
});
|
|
889
|
+
});
|
|
890
|
+
};
|
|
891
|
+
this.listCollectiblesWithHighestOffer = (args, headers, signal) => {
|
|
892
|
+
return this.fetch(this.url('ListCollectiblesWithHighestOffer'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
893
|
+
return buildResponse(res).then(_data => {
|
|
894
|
+
return {
|
|
895
|
+
collectibles: _data.collectibles,
|
|
896
|
+
page: _data.page
|
|
897
|
+
};
|
|
898
|
+
});
|
|
899
|
+
}, error => {
|
|
900
|
+
throw WebrpcRequestFailedError.new({
|
|
901
|
+
cause: `fetch(): ${error.message || ''}`
|
|
902
|
+
});
|
|
903
|
+
});
|
|
904
|
+
};
|
|
905
|
+
this.syncOrder = (args, headers, signal) => {
|
|
906
|
+
return this.fetch(this.url('SyncOrder'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
907
|
+
return buildResponse(res).then(_data => {
|
|
908
|
+
return {};
|
|
909
|
+
});
|
|
910
|
+
}, error => {
|
|
911
|
+
throw WebrpcRequestFailedError.new({
|
|
912
|
+
cause: `fetch(): ${error.message || ''}`
|
|
913
|
+
});
|
|
914
|
+
});
|
|
915
|
+
};
|
|
916
|
+
this.syncOrders = (args, headers, signal) => {
|
|
917
|
+
return this.fetch(this.url('SyncOrders'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
918
|
+
return buildResponse(res).then(_data => {
|
|
919
|
+
return {};
|
|
920
|
+
});
|
|
921
|
+
}, error => {
|
|
922
|
+
throw WebrpcRequestFailedError.new({
|
|
923
|
+
cause: `fetch(): ${error.message || ''}`
|
|
924
|
+
});
|
|
925
|
+
});
|
|
926
|
+
};
|
|
927
|
+
this.getOrders = (args, headers, signal) => {
|
|
928
|
+
return this.fetch(this.url('GetOrders'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
929
|
+
return buildResponse(res).then(_data => {
|
|
930
|
+
return {
|
|
931
|
+
orders: _data.orders,
|
|
932
|
+
page: _data.page
|
|
933
|
+
};
|
|
934
|
+
});
|
|
935
|
+
}, error => {
|
|
936
|
+
throw WebrpcRequestFailedError.new({
|
|
937
|
+
cause: `fetch(): ${error.message || ''}`
|
|
938
|
+
});
|
|
939
|
+
});
|
|
940
|
+
};
|
|
941
|
+
this.checkoutOptionsMarketplace = (args, headers, signal) => {
|
|
942
|
+
return this.fetch(this.url('CheckoutOptionsMarketplace'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
943
|
+
return buildResponse(res).then(_data => {
|
|
944
|
+
return {
|
|
945
|
+
options: _data.options
|
|
946
|
+
};
|
|
947
|
+
});
|
|
948
|
+
}, error => {
|
|
949
|
+
throw WebrpcRequestFailedError.new({
|
|
950
|
+
cause: `fetch(): ${error.message || ''}`
|
|
951
|
+
});
|
|
952
|
+
});
|
|
953
|
+
};
|
|
954
|
+
this.checkoutOptionsSalesContract = (args, headers, signal) => {
|
|
955
|
+
return this.fetch(this.url('CheckoutOptionsSalesContract'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
956
|
+
return buildResponse(res).then(_data => {
|
|
957
|
+
return {
|
|
958
|
+
options: _data.options
|
|
959
|
+
};
|
|
960
|
+
});
|
|
961
|
+
}, error => {
|
|
962
|
+
throw WebrpcRequestFailedError.new({
|
|
963
|
+
cause: `fetch(): ${error.message || ''}`
|
|
964
|
+
});
|
|
965
|
+
});
|
|
966
|
+
};
|
|
967
|
+
this.supportedMarketplaces = (args, headers, signal) => {
|
|
968
|
+
return this.fetch(this.url('SupportedMarketplaces'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
969
|
+
return buildResponse(res).then(_data => {
|
|
970
|
+
return {
|
|
971
|
+
marketplaces: _data.marketplaces
|
|
972
|
+
};
|
|
973
|
+
});
|
|
974
|
+
}, error => {
|
|
975
|
+
throw WebrpcRequestFailedError.new({
|
|
976
|
+
cause: `fetch(): ${error.message || ''}`
|
|
977
|
+
});
|
|
978
|
+
});
|
|
979
|
+
};
|
|
980
|
+
this.getPrimarySaleItem = (args, headers, signal) => {
|
|
981
|
+
return this.fetch(this.url('GetPrimarySaleItem'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
982
|
+
return buildResponse(res).then(_data => {
|
|
983
|
+
return {
|
|
984
|
+
item: _data.item
|
|
985
|
+
};
|
|
986
|
+
});
|
|
987
|
+
}, error => {
|
|
988
|
+
throw WebrpcRequestFailedError.new({
|
|
989
|
+
cause: `fetch(): ${error.message || ''}`
|
|
990
|
+
});
|
|
991
|
+
});
|
|
992
|
+
};
|
|
993
|
+
this.listPrimarySaleItems = (args, headers, signal) => {
|
|
994
|
+
return this.fetch(this.url('ListPrimarySaleItems'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
995
|
+
return buildResponse(res).then(_data => {
|
|
996
|
+
return {
|
|
997
|
+
primarySaleItems: _data.primarySaleItems,
|
|
998
|
+
page: _data.page
|
|
999
|
+
};
|
|
1000
|
+
});
|
|
1001
|
+
}, error => {
|
|
1002
|
+
throw WebrpcRequestFailedError.new({
|
|
1003
|
+
cause: `fetch(): ${error.message || ''}`
|
|
1004
|
+
});
|
|
1005
|
+
});
|
|
1006
|
+
};
|
|
1007
|
+
this.getCountOfPrimarySaleItems = (args, headers, signal) => {
|
|
1008
|
+
return this.fetch(this.url('GetCountOfPrimarySaleItems'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
1009
|
+
return buildResponse(res).then(_data => {
|
|
1010
|
+
return {
|
|
1011
|
+
count: _data.count
|
|
1012
|
+
};
|
|
1013
|
+
});
|
|
1014
|
+
}, error => {
|
|
1015
|
+
throw WebrpcRequestFailedError.new({
|
|
1016
|
+
cause: `fetch(): ${error.message || ''}`
|
|
1017
|
+
});
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
this.hostname = hostname.replace(/\/*$/, '');
|
|
1021
|
+
this.fetch = (input, init) => fetch(input, init);
|
|
1022
|
+
}
|
|
1023
|
+
url(name) {
|
|
1024
|
+
return this.hostname + this.path + name;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
|
|
1028
|
+
const reqHeaders = _extends({}, headers, {
|
|
1029
|
+
'Content-Type': 'application/json'
|
|
1030
|
+
});
|
|
1031
|
+
reqHeaders[WebrpcHeader] = WebrpcHeaderValue;
|
|
1032
|
+
return {
|
|
1033
|
+
method: 'POST',
|
|
1034
|
+
headers: reqHeaders,
|
|
1035
|
+
body: JSON.stringify(body || {}),
|
|
1036
|
+
signal
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
1039
|
+
const buildResponse = res => {
|
|
1040
|
+
return res.text().then(text => {
|
|
1041
|
+
let data;
|
|
1042
|
+
try {
|
|
1043
|
+
data = JSON.parse(text);
|
|
1044
|
+
} catch (error) {
|
|
1045
|
+
let message = '';
|
|
1046
|
+
if (error instanceof Error) {
|
|
1047
|
+
message = error.message;
|
|
1048
|
+
}
|
|
1049
|
+
throw WebrpcBadResponseError.new({
|
|
1050
|
+
status: res.status,
|
|
1051
|
+
cause: `JSON.parse(): ${message}: response text: ${text}`
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
if (!res.ok) {
|
|
1055
|
+
const code = typeof data.code === 'number' ? data.code : 0;
|
|
1056
|
+
throw (webrpcErrorByCode[code] || WebrpcError).new(data);
|
|
1057
|
+
}
|
|
1058
|
+
return data;
|
|
1059
|
+
});
|
|
1060
|
+
};
|
|
1061
|
+
|
|
1062
|
+
//
|
|
1063
|
+
// Errors
|
|
1064
|
+
//
|
|
1065
|
+
|
|
1066
|
+
class WebrpcError extends Error {
|
|
1067
|
+
constructor(name, code, message, status, cause) {
|
|
1068
|
+
super(message);
|
|
1069
|
+
this.name = void 0;
|
|
1070
|
+
this.code = void 0;
|
|
1071
|
+
this.message = void 0;
|
|
1072
|
+
this.status = void 0;
|
|
1073
|
+
this.cause = void 0;
|
|
1074
|
+
/** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
|
|
1075
|
+
this.msg = void 0;
|
|
1076
|
+
this.name = name || 'WebrpcError';
|
|
1077
|
+
this.code = typeof code === 'number' ? code : 0;
|
|
1078
|
+
this.message = message || `endpoint error ${this.code}`;
|
|
1079
|
+
this.msg = this.message;
|
|
1080
|
+
this.status = typeof status === 'number' ? status : 0;
|
|
1081
|
+
this.cause = cause;
|
|
1082
|
+
Object.setPrototypeOf(this, WebrpcError.prototype);
|
|
1083
|
+
}
|
|
1084
|
+
static new(payload) {
|
|
1085
|
+
return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
// Webrpc errors
|
|
1090
|
+
|
|
1091
|
+
class WebrpcEndpointError extends WebrpcError {
|
|
1092
|
+
constructor(name = 'WebrpcEndpoint', code = 0, message = `endpoint error`, status = 0, cause) {
|
|
1093
|
+
super(name, code, message, status, cause);
|
|
1094
|
+
Object.setPrototypeOf(this, WebrpcEndpointError.prototype);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
class WebrpcRequestFailedError extends WebrpcError {
|
|
1098
|
+
constructor(name = 'WebrpcRequestFailed', code = -1, message = `request failed`, status = 0, cause) {
|
|
1099
|
+
super(name, code, message, status, cause);
|
|
1100
|
+
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
class WebrpcBadRouteError extends WebrpcError {
|
|
1104
|
+
constructor(name = 'WebrpcBadRoute', code = -2, message = `bad route`, status = 0, cause) {
|
|
1105
|
+
super(name, code, message, status, cause);
|
|
1106
|
+
Object.setPrototypeOf(this, WebrpcBadRouteError.prototype);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
class WebrpcBadMethodError extends WebrpcError {
|
|
1110
|
+
constructor(name = 'WebrpcBadMethod', code = -3, message = `bad method`, status = 0, cause) {
|
|
1111
|
+
super(name, code, message, status, cause);
|
|
1112
|
+
Object.setPrototypeOf(this, WebrpcBadMethodError.prototype);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
class WebrpcBadRequestError extends WebrpcError {
|
|
1116
|
+
constructor(name = 'WebrpcBadRequest', code = -4, message = `bad request`, status = 0, cause) {
|
|
1117
|
+
super(name, code, message, status, cause);
|
|
1118
|
+
Object.setPrototypeOf(this, WebrpcBadRequestError.prototype);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
class WebrpcBadResponseError extends WebrpcError {
|
|
1122
|
+
constructor(name = 'WebrpcBadResponse', code = -5, message = `bad response`, status = 0, cause) {
|
|
1123
|
+
super(name, code, message, status, cause);
|
|
1124
|
+
Object.setPrototypeOf(this, WebrpcBadResponseError.prototype);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
class WebrpcServerPanicError extends WebrpcError {
|
|
1128
|
+
constructor(name = 'WebrpcServerPanic', code = -6, message = `server panic`, status = 0, cause) {
|
|
1129
|
+
super(name, code, message, status, cause);
|
|
1130
|
+
Object.setPrototypeOf(this, WebrpcServerPanicError.prototype);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
class WebrpcInternalErrorError extends WebrpcError {
|
|
1134
|
+
constructor(name = 'WebrpcInternalError', code = -7, message = `internal error`, status = 0, cause) {
|
|
1135
|
+
super(name, code, message, status, cause);
|
|
1136
|
+
Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
class WebrpcClientDisconnectedError extends WebrpcError {
|
|
1140
|
+
constructor(name = 'WebrpcClientDisconnected', code = -8, message = `client disconnected`, status = 0, cause) {
|
|
1141
|
+
super(name, code, message, status, cause);
|
|
1142
|
+
Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
class WebrpcStreamLostError extends WebrpcError {
|
|
1146
|
+
constructor(name = 'WebrpcStreamLost', code = -9, message = `stream lost`, status = 0, cause) {
|
|
1147
|
+
super(name, code, message, status, cause);
|
|
1148
|
+
Object.setPrototypeOf(this, WebrpcStreamLostError.prototype);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
class WebrpcStreamFinishedError extends WebrpcError {
|
|
1152
|
+
constructor(name = 'WebrpcStreamFinished', code = -10, message = `stream finished`, status = 0, cause) {
|
|
1153
|
+
super(name, code, message, status, cause);
|
|
1154
|
+
Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
// Schema errors
|
|
1159
|
+
|
|
1160
|
+
class UnauthorizedError extends WebrpcError {
|
|
1161
|
+
constructor(name = 'Unauthorized', code = 1000, message = `Unauthorized access`, status = 0, cause) {
|
|
1162
|
+
super(name, code, message, status, cause);
|
|
1163
|
+
Object.setPrototypeOf(this, UnauthorizedError.prototype);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
class PermissionDeniedError extends WebrpcError {
|
|
1167
|
+
constructor(name = 'PermissionDenied', code = 1001, message = `Permission denied`, status = 0, cause) {
|
|
1168
|
+
super(name, code, message, status, cause);
|
|
1169
|
+
Object.setPrototypeOf(this, PermissionDeniedError.prototype);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
class SessionExpiredError extends WebrpcError {
|
|
1173
|
+
constructor(name = 'SessionExpired', code = 1002, message = `Session expired`, status = 0, cause) {
|
|
1174
|
+
super(name, code, message, status, cause);
|
|
1175
|
+
Object.setPrototypeOf(this, SessionExpiredError.prototype);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
class MethodNotFoundError extends WebrpcError {
|
|
1179
|
+
constructor(name = 'MethodNotFound', code = 1003, message = `Method not found`, status = 0, cause) {
|
|
1180
|
+
super(name, code, message, status, cause);
|
|
1181
|
+
Object.setPrototypeOf(this, MethodNotFoundError.prototype);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
class TimeoutError extends WebrpcError {
|
|
1185
|
+
constructor(name = 'Timeout', code = 2000, message = `Request timed out`, status = 0, cause) {
|
|
1186
|
+
super(name, code, message, status, cause);
|
|
1187
|
+
Object.setPrototypeOf(this, TimeoutError.prototype);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
class InvalidArgumentError extends WebrpcError {
|
|
1191
|
+
constructor(name = 'InvalidArgument', code = 2001, message = `Invalid argument`, status = 0, cause) {
|
|
1192
|
+
super(name, code, message, status, cause);
|
|
1193
|
+
Object.setPrototypeOf(this, InvalidArgumentError.prototype);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
class NotFoundError extends WebrpcError {
|
|
1197
|
+
constructor(name = 'NotFound', code = 3000, message = `Resource not found`, status = 0, cause) {
|
|
1198
|
+
super(name, code, message, status, cause);
|
|
1199
|
+
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
class UserNotFoundError extends WebrpcError {
|
|
1203
|
+
constructor(name = 'UserNotFound', code = 3001, message = `User not found`, status = 0, cause) {
|
|
1204
|
+
super(name, code, message, status, cause);
|
|
1205
|
+
Object.setPrototypeOf(this, UserNotFoundError.prototype);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
class ProjectNotFoundError extends WebrpcError {
|
|
1209
|
+
constructor(name = 'ProjectNotFound', code = 3002, message = `Project not found`, status = 0, cause) {
|
|
1210
|
+
super(name, code, message, status, cause);
|
|
1211
|
+
Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
class InvalidTierError extends WebrpcError {
|
|
1215
|
+
constructor(name = 'InvalidTier', code = 3003, message = `Invalid subscription tier`, status = 0, cause) {
|
|
1216
|
+
super(name, code, message, status, cause);
|
|
1217
|
+
Object.setPrototypeOf(this, InvalidTierError.prototype);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
class ProjectLimitReachedError extends WebrpcError {
|
|
1221
|
+
constructor(name = 'ProjectLimitReached', code = 3005, message = `Project limit reached`, status = 0, cause) {
|
|
1222
|
+
super(name, code, message, status, cause);
|
|
1223
|
+
Object.setPrototypeOf(this, ProjectLimitReachedError.prototype);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
class NotImplementedError extends WebrpcError {
|
|
1227
|
+
constructor(name = 'NotImplemented', code = 9999, message = `Not Implemented`, status = 0, cause) {
|
|
1228
|
+
super(name, code, message, status, cause);
|
|
1229
|
+
Object.setPrototypeOf(this, NotImplementedError.prototype);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
let errors = /*#__PURE__*/function (errors) {
|
|
1233
|
+
errors["WebrpcEndpoint"] = "WebrpcEndpoint";
|
|
1234
|
+
errors["WebrpcRequestFailed"] = "WebrpcRequestFailed";
|
|
1235
|
+
errors["WebrpcBadRoute"] = "WebrpcBadRoute";
|
|
1236
|
+
errors["WebrpcBadMethod"] = "WebrpcBadMethod";
|
|
1237
|
+
errors["WebrpcBadRequest"] = "WebrpcBadRequest";
|
|
1238
|
+
errors["WebrpcBadResponse"] = "WebrpcBadResponse";
|
|
1239
|
+
errors["WebrpcServerPanic"] = "WebrpcServerPanic";
|
|
1240
|
+
errors["WebrpcInternalError"] = "WebrpcInternalError";
|
|
1241
|
+
errors["WebrpcClientDisconnected"] = "WebrpcClientDisconnected";
|
|
1242
|
+
errors["WebrpcStreamLost"] = "WebrpcStreamLost";
|
|
1243
|
+
errors["WebrpcStreamFinished"] = "WebrpcStreamFinished";
|
|
1244
|
+
errors["Unauthorized"] = "Unauthorized";
|
|
1245
|
+
errors["PermissionDenied"] = "PermissionDenied";
|
|
1246
|
+
errors["SessionExpired"] = "SessionExpired";
|
|
1247
|
+
errors["MethodNotFound"] = "MethodNotFound";
|
|
1248
|
+
errors["Timeout"] = "Timeout";
|
|
1249
|
+
errors["InvalidArgument"] = "InvalidArgument";
|
|
1250
|
+
errors["NotFound"] = "NotFound";
|
|
1251
|
+
errors["UserNotFound"] = "UserNotFound";
|
|
1252
|
+
errors["ProjectNotFound"] = "ProjectNotFound";
|
|
1253
|
+
errors["InvalidTier"] = "InvalidTier";
|
|
1254
|
+
errors["ProjectLimitReached"] = "ProjectLimitReached";
|
|
1255
|
+
errors["NotImplemented"] = "NotImplemented";
|
|
1256
|
+
return errors;
|
|
1257
|
+
}({});
|
|
1258
|
+
let WebrpcErrorCodes = /*#__PURE__*/function (WebrpcErrorCodes) {
|
|
1259
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcEndpoint"] = 0] = "WebrpcEndpoint";
|
|
1260
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcRequestFailed"] = -1] = "WebrpcRequestFailed";
|
|
1261
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRoute"] = -2] = "WebrpcBadRoute";
|
|
1262
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadMethod"] = -3] = "WebrpcBadMethod";
|
|
1263
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRequest"] = -4] = "WebrpcBadRequest";
|
|
1264
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadResponse"] = -5] = "WebrpcBadResponse";
|
|
1265
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcServerPanic"] = -6] = "WebrpcServerPanic";
|
|
1266
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcInternalError"] = -7] = "WebrpcInternalError";
|
|
1267
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcClientDisconnected"] = -8] = "WebrpcClientDisconnected";
|
|
1268
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamLost"] = -9] = "WebrpcStreamLost";
|
|
1269
|
+
WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamFinished"] = -10] = "WebrpcStreamFinished";
|
|
1270
|
+
WebrpcErrorCodes[WebrpcErrorCodes["Unauthorized"] = 1000] = "Unauthorized";
|
|
1271
|
+
WebrpcErrorCodes[WebrpcErrorCodes["PermissionDenied"] = 1001] = "PermissionDenied";
|
|
1272
|
+
WebrpcErrorCodes[WebrpcErrorCodes["SessionExpired"] = 1002] = "SessionExpired";
|
|
1273
|
+
WebrpcErrorCodes[WebrpcErrorCodes["MethodNotFound"] = 1003] = "MethodNotFound";
|
|
1274
|
+
WebrpcErrorCodes[WebrpcErrorCodes["Timeout"] = 2000] = "Timeout";
|
|
1275
|
+
WebrpcErrorCodes[WebrpcErrorCodes["InvalidArgument"] = 2001] = "InvalidArgument";
|
|
1276
|
+
WebrpcErrorCodes[WebrpcErrorCodes["NotFound"] = 3000] = "NotFound";
|
|
1277
|
+
WebrpcErrorCodes[WebrpcErrorCodes["UserNotFound"] = 3001] = "UserNotFound";
|
|
1278
|
+
WebrpcErrorCodes[WebrpcErrorCodes["ProjectNotFound"] = 3002] = "ProjectNotFound";
|
|
1279
|
+
WebrpcErrorCodes[WebrpcErrorCodes["InvalidTier"] = 3003] = "InvalidTier";
|
|
1280
|
+
WebrpcErrorCodes[WebrpcErrorCodes["ProjectLimitReached"] = 3005] = "ProjectLimitReached";
|
|
1281
|
+
WebrpcErrorCodes[WebrpcErrorCodes["NotImplemented"] = 9999] = "NotImplemented";
|
|
1282
|
+
return WebrpcErrorCodes;
|
|
1283
|
+
}({});
|
|
1284
|
+
const webrpcErrorByCode = {
|
|
1285
|
+
[0]: WebrpcEndpointError,
|
|
1286
|
+
[-1]: WebrpcRequestFailedError,
|
|
1287
|
+
[-2]: WebrpcBadRouteError,
|
|
1288
|
+
[-3]: WebrpcBadMethodError,
|
|
1289
|
+
[-4]: WebrpcBadRequestError,
|
|
1290
|
+
[-5]: WebrpcBadResponseError,
|
|
1291
|
+
[-6]: WebrpcServerPanicError,
|
|
1292
|
+
[-7]: WebrpcInternalErrorError,
|
|
1293
|
+
[-8]: WebrpcClientDisconnectedError,
|
|
1294
|
+
[-9]: WebrpcStreamLostError,
|
|
1295
|
+
[-10]: WebrpcStreamFinishedError,
|
|
1296
|
+
[1000]: UnauthorizedError,
|
|
1297
|
+
[1001]: PermissionDeniedError,
|
|
1298
|
+
[1002]: SessionExpiredError,
|
|
1299
|
+
[1003]: MethodNotFoundError,
|
|
1300
|
+
[2000]: TimeoutError,
|
|
1301
|
+
[2001]: InvalidArgumentError,
|
|
1302
|
+
[3000]: NotFoundError,
|
|
1303
|
+
[3001]: UserNotFoundError,
|
|
1304
|
+
[3002]: ProjectNotFoundError,
|
|
1305
|
+
[3003]: InvalidTierError,
|
|
1306
|
+
[3005]: ProjectLimitReachedError,
|
|
1307
|
+
[9999]: NotImplementedError
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1310
|
+
class MarketplaceIndexer extends Marketplace {
|
|
1311
|
+
constructor(hostname, projectAccessKey, jwtAuth) {
|
|
1312
|
+
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
1313
|
+
this.projectAccessKey = projectAccessKey;
|
|
1314
|
+
this.jwtAuth = jwtAuth;
|
|
1315
|
+
this._fetch = (input, init) => {
|
|
1316
|
+
// automatically include jwt and access key auth header to requests
|
|
1317
|
+
// if its been set on the api client
|
|
1318
|
+
const headers = {};
|
|
1319
|
+
const jwtAuth = this.jwtAuth;
|
|
1320
|
+
const projectAccessKey = this.projectAccessKey;
|
|
1321
|
+
if (jwtAuth && jwtAuth.length > 0) {
|
|
1322
|
+
headers['Authorization'] = `BEARER ${jwtAuth}`;
|
|
1323
|
+
}
|
|
1324
|
+
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
1325
|
+
headers['X-Access-Key'] = projectAccessKey;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// before the request is made
|
|
1329
|
+
init.headers = _extends({}, init.headers, headers);
|
|
1330
|
+
return fetch(input, init);
|
|
1331
|
+
};
|
|
1332
|
+
this.fetch = this._fetch;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
exports.ActivityAction = ActivityAction;
|
|
1337
|
+
exports.Admin = Admin;
|
|
1338
|
+
exports.CollectibleSource = CollectibleSource;
|
|
1339
|
+
exports.CollectibleStatus = CollectibleStatus;
|
|
1340
|
+
exports.CollectionPriority = CollectionPriority;
|
|
1341
|
+
exports.CollectionStatus = CollectionStatus;
|
|
1342
|
+
exports.ContractType = ContractType;
|
|
1343
|
+
exports.CurrencyStatus = CurrencyStatus;
|
|
1344
|
+
exports.ExecuteType = ExecuteType;
|
|
1345
|
+
exports.InvalidArgumentError = InvalidArgumentError;
|
|
1346
|
+
exports.InvalidTierError = InvalidTierError;
|
|
1347
|
+
exports.ItemsContractStatus = ItemsContractStatus;
|
|
1348
|
+
exports.Marketplace = Marketplace;
|
|
1349
|
+
exports.MarketplaceIndexer = MarketplaceIndexer;
|
|
1350
|
+
exports.MarketplaceKind = MarketplaceKind;
|
|
1351
|
+
exports.MethodNotFoundError = MethodNotFoundError;
|
|
1352
|
+
exports.NotFoundError = NotFoundError;
|
|
1353
|
+
exports.NotImplementedError = NotImplementedError;
|
|
1354
|
+
exports.OrderSide = OrderSide;
|
|
1355
|
+
exports.OrderStatus = OrderStatus;
|
|
1356
|
+
exports.OrderbookKind = OrderbookKind;
|
|
1357
|
+
exports.PermissionDeniedError = PermissionDeniedError;
|
|
1358
|
+
exports.PrimarySaleContractStatus = PrimarySaleContractStatus;
|
|
1359
|
+
exports.PrimarySaleItemDetailType = PrimarySaleItemDetailType;
|
|
1360
|
+
exports.ProjectLimitReachedError = ProjectLimitReachedError;
|
|
1361
|
+
exports.ProjectNotFoundError = ProjectNotFoundError;
|
|
1362
|
+
exports.ProjectStatus = ProjectStatus;
|
|
1363
|
+
exports.PropertyType = PropertyType;
|
|
1364
|
+
exports.SessionExpiredError = SessionExpiredError;
|
|
1365
|
+
exports.SortOrder = SortOrder;
|
|
1366
|
+
exports.SourceKind = SourceKind;
|
|
1367
|
+
exports.StepType = StepType;
|
|
1368
|
+
exports.TimeoutError = TimeoutError;
|
|
1369
|
+
exports.TransactionCrypto = TransactionCrypto;
|
|
1370
|
+
exports.TransactionNFTCheckoutProvider = TransactionNFTCheckoutProvider;
|
|
1371
|
+
exports.TransactionOnRampProvider = TransactionOnRampProvider;
|
|
1372
|
+
exports.TransactionSwapProvider = TransactionSwapProvider;
|
|
1373
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
1374
|
+
exports.UserNotFoundError = UserNotFoundError;
|
|
1375
|
+
exports.VersionFromHeader = VersionFromHeader;
|
|
1376
|
+
exports.WalletKind = WalletKind;
|
|
1377
|
+
exports.WebRPCSchemaHash = WebRPCSchemaHash;
|
|
1378
|
+
exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
|
|
1379
|
+
exports.WebRPCVersion = WebRPCVersion;
|
|
1380
|
+
exports.WebrpcBadMethodError = WebrpcBadMethodError;
|
|
1381
|
+
exports.WebrpcBadRequestError = WebrpcBadRequestError;
|
|
1382
|
+
exports.WebrpcBadResponseError = WebrpcBadResponseError;
|
|
1383
|
+
exports.WebrpcBadRouteError = WebrpcBadRouteError;
|
|
1384
|
+
exports.WebrpcClientDisconnectedError = WebrpcClientDisconnectedError;
|
|
1385
|
+
exports.WebrpcEndpointError = WebrpcEndpointError;
|
|
1386
|
+
exports.WebrpcError = WebrpcError;
|
|
1387
|
+
exports.WebrpcErrorCodes = WebrpcErrorCodes;
|
|
1388
|
+
exports.WebrpcHeader = WebrpcHeader;
|
|
1389
|
+
exports.WebrpcHeaderValue = WebrpcHeaderValue;
|
|
1390
|
+
exports.WebrpcInternalErrorError = WebrpcInternalErrorError;
|
|
1391
|
+
exports.WebrpcRequestFailedError = WebrpcRequestFailedError;
|
|
1392
|
+
exports.WebrpcServerPanicError = WebrpcServerPanicError;
|
|
1393
|
+
exports.WebrpcStreamFinishedError = WebrpcStreamFinishedError;
|
|
1394
|
+
exports.WebrpcStreamLostError = WebrpcStreamLostError;
|
|
1395
|
+
exports.errors = errors;
|
|
1396
|
+
exports.webrpcErrorByCode = webrpcErrorByCode;
|