@eluvio/elv-client-js 3.2.11 → 3.2.14
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/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +2 -2
- package/dist/src/index.js +2 -2
- package/dist/src/walletClient/ClientMethods.js +204 -148
- package/dist/src/walletClient/index.js +151 -123
- package/package.json +1 -1
- package/src/index.js +2 -2
- package/src/walletClient/ClientMethods.js +43 -13
- package/src/walletClient/index.js +94 -54
- package/testScripts/Test.js +33 -0
- package/testScripts/TestMarketplaceClient.js +0 -25
|
@@ -33,6 +33,7 @@ var Utils = require("../Utils");
|
|
|
33
33
|
var Ethers = require("ethers");
|
|
34
34
|
|
|
35
35
|
var inBrowser = typeof window !== "undefined";
|
|
36
|
+
var embedded = inBrowser && window.top !== window.self;
|
|
36
37
|
/**
|
|
37
38
|
* Use the <a href="#.Initialize">Initialize</a> method to initialize a new client.
|
|
38
39
|
*
|
|
@@ -75,6 +76,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
75
76
|
key: "Log",
|
|
76
77
|
value: function Log(message) {
|
|
77
78
|
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
79
|
+
var errorObject = arguments.length > 2 ? arguments[2] : undefined;
|
|
78
80
|
|
|
79
81
|
if (error) {
|
|
80
82
|
// eslint-disable-next-line no-console
|
|
@@ -83,6 +85,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
83
85
|
// eslint-disable-next-line no-console
|
|
84
86
|
console.log("Eluvio Wallet Client:", message);
|
|
85
87
|
}
|
|
88
|
+
|
|
89
|
+
if (errorObject) {
|
|
90
|
+
// eslint-disable-next-line no-console
|
|
91
|
+
console.error(errorObject);
|
|
92
|
+
}
|
|
86
93
|
}
|
|
87
94
|
/**
|
|
88
95
|
* Initialize the wallet client.
|
|
@@ -210,7 +217,16 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
210
217
|
url = new URL(this.appUrl);
|
|
211
218
|
url.hash = UrlJoin("/action", "sign", Utils.B58(JSON.stringify(parameters)));
|
|
212
219
|
url.searchParams.set("origin", window.location.origin);
|
|
213
|
-
|
|
220
|
+
|
|
221
|
+
if (!(!embedded && window.location.origin === url.origin)) {
|
|
222
|
+
_context3.next = 27;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
throw Error("ElvWalletClient: Unable to sign");
|
|
227
|
+
|
|
228
|
+
case 27:
|
|
229
|
+
_context3.next = 29;
|
|
214
230
|
return new Promise( /*#__PURE__*/function () {
|
|
215
231
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve, reject) {
|
|
216
232
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -275,10 +291,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
275
291
|
};
|
|
276
292
|
}());
|
|
277
293
|
|
|
278
|
-
case
|
|
294
|
+
case 29:
|
|
279
295
|
return _context3.abrupt("return", _context3.sent);
|
|
280
296
|
|
|
281
|
-
case
|
|
297
|
+
case 30:
|
|
282
298
|
case "end":
|
|
283
299
|
return _context3.stop();
|
|
284
300
|
}
|
|
@@ -558,7 +574,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
558
574
|
this.client.SetStaticToken({
|
|
559
575
|
token: decodedToken.fabricToken
|
|
560
576
|
});
|
|
561
|
-
return _context7.abrupt("return", this.SetAuthorization(decodedToken));
|
|
577
|
+
return _context7.abrupt("return", this.SetAuthorization(_objectSpread({}, decodedToken)));
|
|
562
578
|
|
|
563
579
|
case 15:
|
|
564
580
|
case "end":
|
|
@@ -670,7 +686,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
670
686
|
expiresAt: expiresAt,
|
|
671
687
|
signerURIs: signerURIs,
|
|
672
688
|
walletType: "Custodial",
|
|
673
|
-
walletName: "Eluvio"
|
|
689
|
+
walletName: "Eluvio",
|
|
690
|
+
register: true
|
|
674
691
|
}),
|
|
675
692
|
signingToken: this.SetAuthorization({
|
|
676
693
|
clusterToken: this.client.signer.authToken,
|
|
@@ -775,7 +792,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
775
792
|
address: address,
|
|
776
793
|
expiresAt: expiresAt,
|
|
777
794
|
walletType: "External",
|
|
778
|
-
walletName: walletName
|
|
795
|
+
walletName: walletName,
|
|
796
|
+
register: true
|
|
779
797
|
}));
|
|
780
798
|
|
|
781
799
|
case 9:
|
|
@@ -821,6 +839,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
821
839
|
}, {
|
|
822
840
|
key: "SetAuthorization",
|
|
823
841
|
value: function SetAuthorization(_ref10) {
|
|
842
|
+
var _this3 = this;
|
|
843
|
+
|
|
824
844
|
var clusterToken = _ref10.clusterToken,
|
|
825
845
|
fabricToken = _ref10.fabricToken,
|
|
826
846
|
tenantId = _ref10.tenantId,
|
|
@@ -829,7 +849,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
829
849
|
expiresAt = _ref10.expiresAt,
|
|
830
850
|
signerURIs = _ref10.signerURIs,
|
|
831
851
|
walletType = _ref10.walletType,
|
|
832
|
-
walletName = _ref10.walletName
|
|
852
|
+
walletName = _ref10.walletName,
|
|
853
|
+
_ref10$register = _ref10.register,
|
|
854
|
+
register = _ref10$register === void 0 ? false : _ref10$register;
|
|
833
855
|
address = this.client.utils.FormatAddress(address);
|
|
834
856
|
this.__authorization = {
|
|
835
857
|
fabricToken: fabricToken,
|
|
@@ -859,6 +881,18 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
859
881
|
} catch (error) {}
|
|
860
882
|
}
|
|
861
883
|
|
|
884
|
+
if (register) {
|
|
885
|
+
this.client.authClient.MakeAuthServiceRequest({
|
|
886
|
+
path: "/as/wlt/register",
|
|
887
|
+
method: "POST",
|
|
888
|
+
headers: {
|
|
889
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
890
|
+
}
|
|
891
|
+
})["catch"](function (error) {
|
|
892
|
+
_this3.Log("Failed to register account: ", true, error);
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
|
|
862
896
|
return token;
|
|
863
897
|
}
|
|
864
898
|
}, {
|
|
@@ -926,7 +960,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
926
960
|
key: "LoadAvailableMarketplaces",
|
|
927
961
|
value: function () {
|
|
928
962
|
var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
929
|
-
var
|
|
963
|
+
var _this4 = this;
|
|
930
964
|
|
|
931
965
|
var forceReload,
|
|
932
966
|
mainSiteHash,
|
|
@@ -983,7 +1017,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
983
1017
|
try {
|
|
984
1018
|
var versionHash = metadata[tenantSlug].marketplaces[marketplaceSlug]["."].source;
|
|
985
1019
|
|
|
986
|
-
var objectId =
|
|
1020
|
+
var objectId = _this4.utils.DecodeVersionHash(versionHash).objectId;
|
|
987
1021
|
|
|
988
1022
|
availableMarketplaces[tenantSlug][marketplaceSlug] = _objectSpread(_objectSpread({}, metadata[tenantSlug].marketplaces[marketplaceSlug].info || {}), {}, {
|
|
989
1023
|
tenantName: metadata[tenantSlug].marketplaces[marketplaceSlug].info.tenant_name,
|
|
@@ -997,21 +1031,19 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
997
1031
|
})
|
|
998
1032
|
});
|
|
999
1033
|
availableMarketplacesById[objectId] = availableMarketplaces[tenantSlug][marketplaceSlug];
|
|
1000
|
-
|
|
1034
|
+
_this4.marketplaceHashes[objectId] = versionHash; // Fill out selected marketplace info
|
|
1001
1035
|
|
|
1002
|
-
if (
|
|
1003
|
-
if (
|
|
1004
|
-
|
|
1036
|
+
if (_this4.selectedMarketplaceInfo) {
|
|
1037
|
+
if (_this4.selectedMarketplaceInfo.tenantSlug === tenantSlug && _this4.selectedMarketplaceInfo.marketplaceSlug === marketplaceSlug || _this4.selectedMarketplaceInfo.marketplaceId === objectId) {
|
|
1038
|
+
_this4.selectedMarketplaceInfo = availableMarketplaces[tenantSlug][marketplaceSlug];
|
|
1005
1039
|
}
|
|
1006
1040
|
}
|
|
1007
1041
|
} catch (error) {
|
|
1008
|
-
|
|
1042
|
+
_this4.Log("Eluvio Wallet Client: Unable to load info for marketplace ".concat(tenantSlug, "/").concat(marketplaceSlug), true);
|
|
1009
1043
|
}
|
|
1010
1044
|
});
|
|
1011
1045
|
} catch (error) {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
_this3.Log(error, true);
|
|
1046
|
+
_this4.Log("Eluvio Wallet Client: Failed to load tenant info ".concat(tenantSlug), true, error);
|
|
1015
1047
|
}
|
|
1016
1048
|
});
|
|
1017
1049
|
this.availableMarketplaces = availableMarketplaces;
|
|
@@ -1078,7 +1110,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1078
1110
|
key: "LoadMarketplace",
|
|
1079
1111
|
value: function () {
|
|
1080
1112
|
var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(marketplaceParams) {
|
|
1081
|
-
var
|
|
1113
|
+
var _this5 = this;
|
|
1082
1114
|
|
|
1083
1115
|
var marketplaceInfo, marketplaceId, marketplaceHash, marketplace;
|
|
1084
1116
|
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
@@ -1133,7 +1165,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1133
1165
|
break;
|
|
1134
1166
|
}
|
|
1135
1167
|
|
|
1136
|
-
if (
|
|
1168
|
+
if (_this5.loggedIn) {
|
|
1137
1169
|
_context14.next = 5;
|
|
1138
1170
|
break;
|
|
1139
1171
|
}
|
|
@@ -1145,7 +1177,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1145
1177
|
case 5:
|
|
1146
1178
|
_context14.prev = 5;
|
|
1147
1179
|
_context14.next = 8;
|
|
1148
|
-
return
|
|
1180
|
+
return _this5.client.ContentObjectMetadata({
|
|
1149
1181
|
versionHash: LinkTargetHash(item.nft_template),
|
|
1150
1182
|
metadataSubtree: "permissioned"
|
|
1151
1183
|
});
|
|
@@ -1195,8 +1227,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1195
1227
|
var embedUrl = new URL("https://embed.v3.contentfabric.io");
|
|
1196
1228
|
var targetHash = LinkTargetHash(marketplace.storefront[key]);
|
|
1197
1229
|
embedUrl.searchParams.set("p", "");
|
|
1198
|
-
embedUrl.searchParams.set("net",
|
|
1199
|
-
embedUrl.searchParams.set("ath", (
|
|
1230
|
+
embedUrl.searchParams.set("net", _this5.network === "main" ? "main" : "demo");
|
|
1231
|
+
embedUrl.searchParams.set("ath", (_this5.__authorization || {}).authToken || _this5.publicStaticToken);
|
|
1200
1232
|
embedUrl.searchParams.set("vid", targetHash);
|
|
1201
1233
|
embedUrl.searchParams.set("ap", "");
|
|
1202
1234
|
|
|
@@ -1241,15 +1273,17 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1241
1273
|
_ref14$sortDesc,
|
|
1242
1274
|
sortDesc,
|
|
1243
1275
|
filter,
|
|
1244
|
-
|
|
1276
|
+
editionFilters,
|
|
1245
1277
|
attributeFilters,
|
|
1246
1278
|
contractAddress,
|
|
1247
1279
|
tokenId,
|
|
1248
1280
|
currency,
|
|
1249
1281
|
marketplaceParams,
|
|
1250
1282
|
tenantId,
|
|
1251
|
-
|
|
1252
|
-
|
|
1283
|
+
collectionIndexes,
|
|
1284
|
+
priceRange,
|
|
1285
|
+
tokenIdRange,
|
|
1286
|
+
capLimit,
|
|
1253
1287
|
sellerAddress,
|
|
1254
1288
|
_ref14$lastNDays,
|
|
1255
1289
|
lastNDays,
|
|
@@ -1261,7 +1295,6 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1261
1295
|
marketplaceInfo,
|
|
1262
1296
|
marketplace,
|
|
1263
1297
|
filters,
|
|
1264
|
-
collection,
|
|
1265
1298
|
path,
|
|
1266
1299
|
_ref16,
|
|
1267
1300
|
contents,
|
|
@@ -1272,8 +1305,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1272
1305
|
while (1) {
|
|
1273
1306
|
switch (_context16.prev = _context16.next) {
|
|
1274
1307
|
case 0:
|
|
1275
|
-
_ref14 = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {}, _ref14$mode = _ref14.mode, mode = _ref14$mode === void 0 ? "listings" : _ref14$mode, _ref14$sortBy = _ref14.sortBy, sortBy = _ref14$sortBy === void 0 ? "created" : _ref14$sortBy, _ref14$sortDesc = _ref14.sortDesc, sortDesc = _ref14$sortDesc === void 0 ? false : _ref14$sortDesc, filter = _ref14.filter,
|
|
1276
|
-
|
|
1308
|
+
_ref14 = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {}, _ref14$mode = _ref14.mode, mode = _ref14$mode === void 0 ? "listings" : _ref14$mode, _ref14$sortBy = _ref14.sortBy, sortBy = _ref14$sortBy === void 0 ? "created" : _ref14$sortBy, _ref14$sortDesc = _ref14.sortDesc, sortDesc = _ref14$sortDesc === void 0 ? false : _ref14$sortDesc, filter = _ref14.filter, editionFilters = _ref14.editionFilters, attributeFilters = _ref14.attributeFilters, contractAddress = _ref14.contractAddress, tokenId = _ref14.tokenId, currency = _ref14.currency, marketplaceParams = _ref14.marketplaceParams, tenantId = _ref14.tenantId, collectionIndexes = _ref14.collectionIndexes, priceRange = _ref14.priceRange, tokenIdRange = _ref14.tokenIdRange, capLimit = _ref14.capLimit, sellerAddress = _ref14.sellerAddress, _ref14$lastNDays = _ref14.lastNDays, lastNDays = _ref14$lastNDays === void 0 ? -1 : _ref14$lastNDays, _ref14$start = _ref14.start, start = _ref14$start === void 0 ? 0 : _ref14$start, _ref14$limit = _ref14.limit, limit = _ref14$limit === void 0 ? 50 : _ref14$limit;
|
|
1309
|
+
collectionIndexes = (collectionIndexes || []).map(function (i) {
|
|
1310
|
+
return parseInt(i);
|
|
1311
|
+
});
|
|
1277
1312
|
params = {
|
|
1278
1313
|
sort_by: sortBy,
|
|
1279
1314
|
sort_descending: sortDesc,
|
|
@@ -1294,7 +1329,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1294
1329
|
case 6:
|
|
1295
1330
|
marketplaceInfo = _context16.sent;
|
|
1296
1331
|
|
|
1297
|
-
if (!(
|
|
1332
|
+
if (!(collectionIndexes.length > 0)) {
|
|
1298
1333
|
_context16.next = 11;
|
|
1299
1334
|
break;
|
|
1300
1335
|
}
|
|
@@ -1315,65 +1350,33 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1315
1350
|
filters.push("seller:eq:".concat(this.client.utils.FormatAddress(sellerAddress)));
|
|
1316
1351
|
}
|
|
1317
1352
|
|
|
1318
|
-
if (
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
if (!sku) {
|
|
1326
|
-
return;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
var item = marketplace.items.find(function (item) {
|
|
1330
|
-
return item.sku === sku;
|
|
1331
|
-
});
|
|
1332
|
-
|
|
1333
|
-
if (!item) {
|
|
1334
|
-
return;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
var address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
|
|
1338
|
-
|
|
1339
|
-
if (address) {
|
|
1340
|
-
filters.push("".concat(mode === "owned" ? "contract_addr" : "contract", ":eq:").concat(Utils.FormatAddress(address)));
|
|
1341
|
-
}
|
|
1342
|
-
}); // No valid items, so there must not be anything relevant in the collection
|
|
1343
|
-
|
|
1344
|
-
if (!(filters.length === 0)) {
|
|
1345
|
-
_context16.next = 23;
|
|
1346
|
-
break;
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
if (!mode.includes("stats")) {
|
|
1350
|
-
_context16.next = 22;
|
|
1351
|
-
break;
|
|
1352
|
-
}
|
|
1353
|
+
if (marketplace && collectionIndexes.length >= 0) {
|
|
1354
|
+
collectionIndexes.forEach(function (collectionIndex) {
|
|
1355
|
+
var collection = marketplace.collections[collectionIndex];
|
|
1356
|
+
collection.items.forEach(function (sku) {
|
|
1357
|
+
if (!sku) {
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1353
1360
|
|
|
1354
|
-
|
|
1361
|
+
var item = marketplace.items.find(function (item) {
|
|
1362
|
+
return item.sku === sku;
|
|
1363
|
+
});
|
|
1355
1364
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
start: params.start,
|
|
1360
|
-
limit: params.limit,
|
|
1361
|
-
total: 0,
|
|
1362
|
-
more: false
|
|
1363
|
-
},
|
|
1364
|
-
results: []
|
|
1365
|
-
});
|
|
1365
|
+
if (!item) {
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1366
1368
|
|
|
1367
|
-
|
|
1368
|
-
_context16.next = 26;
|
|
1369
|
-
break;
|
|
1369
|
+
var address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
|
|
1370
1370
|
|
|
1371
|
-
|
|
1372
|
-
|
|
1371
|
+
if (address) {
|
|
1372
|
+
filters.push("".concat(mode === "owned" ? "contract_addr" : "contract", ":eq:").concat(Utils.FormatAddress(address)));
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
});
|
|
1376
|
+
} else if (mode !== "owned" && marketplaceInfo || tenantId) {
|
|
1373
1377
|
filters.push("tenant:eq:".concat(marketplaceInfo ? marketplaceInfo.tenantId : tenantId));
|
|
1374
1378
|
}
|
|
1375
1379
|
|
|
1376
|
-
case 26:
|
|
1377
1380
|
if (contractAddress) {
|
|
1378
1381
|
if (mode === "owned") {
|
|
1379
1382
|
filters.push("contract_addr:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
@@ -1395,15 +1398,17 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1395
1398
|
}
|
|
1396
1399
|
}
|
|
1397
1400
|
|
|
1398
|
-
if (
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1401
|
+
if (editionFilters) {
|
|
1402
|
+
editionFilters.forEach(function (editionFilter) {
|
|
1403
|
+
if (mode.includes("listing")) {
|
|
1404
|
+
filters.push("nft/edition_name:eq:".concat(editionFilter));
|
|
1405
|
+
} else if (mode === "owned") {
|
|
1406
|
+
filters.push("meta:@>:{\"edition_name\":\"".concat(editionFilter, "\"}"));
|
|
1407
|
+
params.exact = false;
|
|
1408
|
+
} else {
|
|
1409
|
+
filters.push("edition:eq:".concat(editionFilter));
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1407
1412
|
}
|
|
1408
1413
|
|
|
1409
1414
|
if (attributeFilters) {
|
|
@@ -1427,65 +1432,89 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1427
1432
|
filters.push("created:gt:".concat((Date.now() / 1000 - lastNDays * 24 * 60 * 60).toFixed(0)));
|
|
1428
1433
|
}
|
|
1429
1434
|
|
|
1435
|
+
if (priceRange) {
|
|
1436
|
+
if (priceRange.min) {
|
|
1437
|
+
filters.push("price:ge:".concat(parseFloat(priceRange.min)));
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
if (priceRange.max) {
|
|
1441
|
+
filters.push("price:le:".concat(parseFloat(priceRange.max)));
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
if (tokenIdRange) {
|
|
1446
|
+
if (tokenIdRange.min) {
|
|
1447
|
+
filters.push("info/token_id:ge:".concat(parseInt(tokenIdRange.min)));
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
if (tokenIdRange.max) {
|
|
1451
|
+
filters.push("info/token_id:le:".concat(parseInt(tokenIdRange.max)));
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
if (capLimit) {
|
|
1456
|
+
filters.push("info/cap:le:".concat(parseInt(capLimit)));
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1430
1459
|
_context16.t0 = mode;
|
|
1431
|
-
_context16.next = _context16.t0 === "owned" ?
|
|
1460
|
+
_context16.next = _context16.t0 === "owned" ? 26 : _context16.t0 === "listings" ? 29 : _context16.t0 === "transfers" ? 31 : _context16.t0 === "sales" ? 35 : _context16.t0 === "listing-stats" ? 38 : _context16.t0 === "sales-stats" ? 40 : 42;
|
|
1432
1461
|
break;
|
|
1433
1462
|
|
|
1434
|
-
case
|
|
1463
|
+
case 26:
|
|
1435
1464
|
path = UrlJoin("as", "wlt", "nfts");
|
|
1436
1465
|
|
|
1437
1466
|
if (marketplaceInfo) {
|
|
1438
1467
|
path = UrlJoin("as", "wlt", "nfts", marketplaceInfo.tenantId);
|
|
1439
1468
|
}
|
|
1440
1469
|
|
|
1441
|
-
return _context16.abrupt("break",
|
|
1470
|
+
return _context16.abrupt("break", 42);
|
|
1442
1471
|
|
|
1443
|
-
case
|
|
1472
|
+
case 29:
|
|
1444
1473
|
path = UrlJoin("as", "mkt", "f");
|
|
1445
|
-
return _context16.abrupt("break",
|
|
1474
|
+
return _context16.abrupt("break", 42);
|
|
1446
1475
|
|
|
1447
|
-
case
|
|
1476
|
+
case 31:
|
|
1448
1477
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1449
1478
|
filters.push("action:eq:TRANSFERRED");
|
|
1450
1479
|
filters.push("action:eq:SOLD");
|
|
1451
|
-
return _context16.abrupt("break",
|
|
1480
|
+
return _context16.abrupt("break", 42);
|
|
1452
1481
|
|
|
1453
|
-
case
|
|
1482
|
+
case 35:
|
|
1454
1483
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1455
1484
|
filters.push("action:eq:SOLD");
|
|
1456
|
-
return _context16.abrupt("break",
|
|
1485
|
+
return _context16.abrupt("break", 42);
|
|
1457
1486
|
|
|
1458
|
-
case
|
|
1487
|
+
case 38:
|
|
1459
1488
|
path = UrlJoin("as", "mkt", "stats", "listed");
|
|
1460
|
-
return _context16.abrupt("break",
|
|
1489
|
+
return _context16.abrupt("break", 42);
|
|
1461
1490
|
|
|
1462
|
-
case
|
|
1491
|
+
case 40:
|
|
1463
1492
|
path = UrlJoin("as", "mkt", "stats", "sold");
|
|
1464
|
-
return _context16.abrupt("break",
|
|
1493
|
+
return _context16.abrupt("break", 42);
|
|
1465
1494
|
|
|
1466
|
-
case
|
|
1495
|
+
case 42:
|
|
1467
1496
|
if (filters.length > 0) {
|
|
1468
1497
|
params.filter = filters;
|
|
1469
1498
|
}
|
|
1470
1499
|
|
|
1471
1500
|
if (!mode.includes("stats")) {
|
|
1472
|
-
_context16.next =
|
|
1501
|
+
_context16.next = 47;
|
|
1473
1502
|
break;
|
|
1474
1503
|
}
|
|
1475
1504
|
|
|
1476
|
-
_context16.next =
|
|
1505
|
+
_context16.next = 46;
|
|
1477
1506
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1478
1507
|
path: path,
|
|
1479
1508
|
method: "GET",
|
|
1480
1509
|
queryParams: params
|
|
1481
1510
|
}));
|
|
1482
1511
|
|
|
1483
|
-
case
|
|
1512
|
+
case 46:
|
|
1484
1513
|
return _context16.abrupt("return", _context16.sent);
|
|
1485
1514
|
|
|
1486
|
-
case
|
|
1515
|
+
case 47:
|
|
1487
1516
|
_context16.t2 = Utils;
|
|
1488
|
-
_context16.next =
|
|
1517
|
+
_context16.next = 50;
|
|
1489
1518
|
return this.client.authClient.MakeAuthServiceRequest({
|
|
1490
1519
|
path: path,
|
|
1491
1520
|
method: "GET",
|
|
@@ -1495,22 +1524,22 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1495
1524
|
} : {}
|
|
1496
1525
|
});
|
|
1497
1526
|
|
|
1498
|
-
case
|
|
1527
|
+
case 50:
|
|
1499
1528
|
_context16.t3 = _context16.sent;
|
|
1500
|
-
_context16.next =
|
|
1529
|
+
_context16.next = 53;
|
|
1501
1530
|
return _context16.t2.ResponseToJson.call(_context16.t2, _context16.t3);
|
|
1502
1531
|
|
|
1503
|
-
case
|
|
1532
|
+
case 53:
|
|
1504
1533
|
_context16.t1 = _context16.sent;
|
|
1505
1534
|
|
|
1506
1535
|
if (_context16.t1) {
|
|
1507
|
-
_context16.next =
|
|
1536
|
+
_context16.next = 56;
|
|
1508
1537
|
break;
|
|
1509
1538
|
}
|
|
1510
1539
|
|
|
1511
1540
|
_context16.t1 = [];
|
|
1512
1541
|
|
|
1513
|
-
case
|
|
1542
|
+
case 56:
|
|
1514
1543
|
_ref16 = _context16.t1;
|
|
1515
1544
|
contents = _ref16.contents;
|
|
1516
1545
|
paging = _ref16.paging;
|
|
@@ -1526,12 +1555,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1526
1555
|
})
|
|
1527
1556
|
});
|
|
1528
1557
|
|
|
1529
|
-
case
|
|
1530
|
-
_context16.prev =
|
|
1558
|
+
case 62:
|
|
1559
|
+
_context16.prev = 62;
|
|
1531
1560
|
_context16.t4 = _context16["catch"](11);
|
|
1532
1561
|
|
|
1533
1562
|
if (!(_context16.t4.status && _context16.t4.status.toString() === "404")) {
|
|
1534
|
-
_context16.next =
|
|
1563
|
+
_context16.next = 66;
|
|
1535
1564
|
break;
|
|
1536
1565
|
}
|
|
1537
1566
|
|
|
@@ -1545,15 +1574,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1545
1574
|
results: []
|
|
1546
1575
|
});
|
|
1547
1576
|
|
|
1548
|
-
case
|
|
1577
|
+
case 66:
|
|
1549
1578
|
throw _context16.t4;
|
|
1550
1579
|
|
|
1551
|
-
case
|
|
1580
|
+
case 67:
|
|
1552
1581
|
case "end":
|
|
1553
1582
|
return _context16.stop();
|
|
1554
1583
|
}
|
|
1555
1584
|
}
|
|
1556
|
-
}, _callee16, this, [[11,
|
|
1585
|
+
}, _callee16, this, [[11, 62]]);
|
|
1557
1586
|
}));
|
|
1558
1587
|
|
|
1559
1588
|
function FilteredQuery() {
|
|
@@ -1646,11 +1675,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1646
1675
|
case 13:
|
|
1647
1676
|
_context17.prev = 13;
|
|
1648
1677
|
_context17.t0 = _context17["catch"](6);
|
|
1649
|
-
this.Log("Failed to retrieve minting status", true);
|
|
1650
|
-
this.Log(_context17.t0);
|
|
1678
|
+
this.Log("Failed to retrieve minting status", true, _context17.t0);
|
|
1651
1679
|
return _context17.abrupt("return", []);
|
|
1652
1680
|
|
|
1653
|
-
case
|
|
1681
|
+
case 17:
|
|
1654
1682
|
case "end":
|
|
1655
1683
|
return _context17.stop();
|
|
1656
1684
|
}
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const {ElvClient} = require("./ElvClient.js");
|
|
2
|
-
const {
|
|
2
|
+
const {ElvWalletClient} = require("./walletClient/index.js");
|
|
3
3
|
const Utils = require("./Utils.js");
|
|
4
4
|
|
|
5
5
|
exports.ElvClient = ElvClient;
|
|
6
|
-
exports.
|
|
6
|
+
exports.ElvWalletClient = ElvWalletClient;
|
|
7
7
|
exports.Utils = Utils;
|