@eluvio/elv-client-js 3.2.16 → 3.2.18
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 +9 -9
- package/dist/ElvWalletClient-node-min.js +10 -10
- package/dist/src/walletClient/ClientMethods.js +793 -481
- package/dist/src/walletClient/Configuration.js +2 -0
- package/dist/src/walletClient/Profile.js +368 -0
- package/dist/src/walletClient/Utils.js +33 -29
- package/dist/src/walletClient/index.js +86 -62
- package/package.json +1 -1
- package/src/walletClient/ClientMethods.js +151 -13
- package/src/walletClient/Configuration.js +2 -0
- package/src/walletClient/Profile.js +182 -0
- package/src/walletClient/Utils.js +29 -24
- package/src/walletClient/index.js +39 -19
|
@@ -26,6 +26,8 @@ var _require2 = require("./Utils"),
|
|
|
26
26
|
FormatNFT = _require2.FormatNFT,
|
|
27
27
|
ActionPopup = _require2.ActionPopup;
|
|
28
28
|
|
|
29
|
+
var HTTPClient = require("../HttpClient");
|
|
30
|
+
|
|
29
31
|
var UrlJoin = require("url-join");
|
|
30
32
|
|
|
31
33
|
var Utils = require("../Utils");
|
|
@@ -45,7 +47,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
45
47
|
"use strict";
|
|
46
48
|
|
|
47
49
|
function ElvWalletClient(_ref) {
|
|
48
|
-
var
|
|
50
|
+
var appId = _ref.appId,
|
|
51
|
+
client = _ref.client,
|
|
49
52
|
network = _ref.network,
|
|
50
53
|
mode = _ref.mode,
|
|
51
54
|
marketplaceInfo = _ref.marketplaceInfo,
|
|
@@ -53,6 +56,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
53
56
|
|
|
54
57
|
_classCallCheck(this, ElvWalletClient);
|
|
55
58
|
|
|
59
|
+
this.appId = appId;
|
|
56
60
|
this.client = client;
|
|
57
61
|
this.loggedIn = false;
|
|
58
62
|
this.network = network;
|
|
@@ -65,7 +69,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
65
69
|
this.selectedMarketplaceInfo = marketplaceInfo;
|
|
66
70
|
this.availableMarketplaces = {};
|
|
67
71
|
this.availableMarketplacesById = {};
|
|
68
|
-
this.marketplaceHashes = {};
|
|
72
|
+
this.marketplaceHashes = {};
|
|
73
|
+
this.stateStoreUrls = Configuration[network].stateStoreUrls;
|
|
74
|
+
this.stateStoreClient = new HTTPClient({
|
|
75
|
+
uris: this.stateStoreUrls
|
|
76
|
+
}); // Caches
|
|
69
77
|
|
|
70
78
|
this.cachedMarketplaces = {};
|
|
71
79
|
this.cachedCSS = {};
|
|
@@ -96,8 +104,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
96
104
|
*
|
|
97
105
|
* Specify tenantSlug and marketplaceSlug to automatically associate this tenant with a particular marketplace.
|
|
98
106
|
*
|
|
107
|
+
*
|
|
99
108
|
* @methodGroup Initialization
|
|
100
109
|
* @namedParams
|
|
110
|
+
* @param {string} appId - A string identifying your app. This is used for namespacing user profile data.
|
|
101
111
|
* @param {string} network=main - Name of the Fabric network to use (`main`, `demo`)
|
|
102
112
|
* @param {string} mode=production - Environment to use (`production`, `staging`)
|
|
103
113
|
* @param {Object=} marketplaceParams - Marketplace parameters
|
|
@@ -311,6 +321,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
311
321
|
/**
|
|
312
322
|
* Direct the user to the Eluvio Media Wallet login page.
|
|
313
323
|
*
|
|
324
|
+
* For redirect login, the authorization token will be included in the URL parameters of the callbackUrl. Simply re-initialize the wallet client and it will authorize with this token,
|
|
325
|
+
* or you can retrieve the parameter (`elvToken`) yourself and use it in the <a href="#Authenticate">Authenticate</a> method.
|
|
326
|
+
*
|
|
314
327
|
* <b>NOTE:</b> The domain of the opening window (popup flow) or domain of the `callbackUrl` (redirect flow) MUST be allowed in the metadata of the specified marketplace.
|
|
315
328
|
*
|
|
316
329
|
* @methodGroup Login
|
|
@@ -1266,6 +1279,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1266
1279
|
key: "FilteredQuery",
|
|
1267
1280
|
value: function () {
|
|
1268
1281
|
var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
1282
|
+
var _this6 = this;
|
|
1283
|
+
|
|
1269
1284
|
var _ref14,
|
|
1270
1285
|
_ref14$mode,
|
|
1271
1286
|
mode,
|
|
@@ -1285,9 +1300,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1285
1300
|
priceRange,
|
|
1286
1301
|
tokenIdRange,
|
|
1287
1302
|
capLimit,
|
|
1303
|
+
userAddress,
|
|
1288
1304
|
sellerAddress,
|
|
1289
1305
|
_ref14$lastNDays,
|
|
1290
1306
|
lastNDays,
|
|
1307
|
+
_ref14$includeCheckou,
|
|
1308
|
+
includeCheckoutLocked,
|
|
1291
1309
|
_ref14$start,
|
|
1292
1310
|
start,
|
|
1293
1311
|
_ref14$limit,
|
|
@@ -1306,49 +1324,58 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1306
1324
|
while (1) {
|
|
1307
1325
|
switch (_context16.prev = _context16.next) {
|
|
1308
1326
|
case 0:
|
|
1309
|
-
_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;
|
|
1327
|
+
_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, userAddress = _ref14.userAddress, sellerAddress = _ref14.sellerAddress, _ref14$lastNDays = _ref14.lastNDays, lastNDays = _ref14$lastNDays === void 0 ? -1 : _ref14$lastNDays, _ref14$includeCheckou = _ref14.includeCheckoutLocked, includeCheckoutLocked = _ref14$includeCheckou === void 0 ? false : _ref14$includeCheckou, _ref14$start = _ref14.start, start = _ref14$start === void 0 ? 0 : _ref14$start, _ref14$limit = _ref14.limit, limit = _ref14$limit === void 0 ? 50 : _ref14$limit;
|
|
1310
1328
|
collectionIndexes = (collectionIndexes || []).map(function (i) {
|
|
1311
1329
|
return parseInt(i);
|
|
1312
1330
|
});
|
|
1313
1331
|
params = {
|
|
1314
|
-
sort_by: sortBy,
|
|
1315
|
-
sort_descending: sortDesc,
|
|
1316
1332
|
start: start,
|
|
1317
|
-
limit: limit
|
|
1333
|
+
limit: limit,
|
|
1334
|
+
sort_descending: sortDesc
|
|
1318
1335
|
};
|
|
1319
1336
|
|
|
1337
|
+
if (mode !== "leaderboard") {
|
|
1338
|
+
params.sort_by = sortBy;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
if (mode.includes("listings") && includeCheckoutLocked) {
|
|
1342
|
+
params.checkout = true;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1320
1345
|
if (!marketplaceParams) {
|
|
1321
|
-
_context16.next =
|
|
1346
|
+
_context16.next = 13;
|
|
1322
1347
|
break;
|
|
1323
1348
|
}
|
|
1324
1349
|
|
|
1325
|
-
_context16.next =
|
|
1350
|
+
_context16.next = 8;
|
|
1326
1351
|
return this.MarketplaceInfo({
|
|
1327
1352
|
marketplaceParams: marketplaceParams
|
|
1328
1353
|
});
|
|
1329
1354
|
|
|
1330
|
-
case
|
|
1355
|
+
case 8:
|
|
1331
1356
|
marketplaceInfo = _context16.sent;
|
|
1332
1357
|
|
|
1333
1358
|
if (!(collectionIndexes.length > 0)) {
|
|
1334
|
-
_context16.next =
|
|
1359
|
+
_context16.next = 13;
|
|
1335
1360
|
break;
|
|
1336
1361
|
}
|
|
1337
1362
|
|
|
1338
|
-
_context16.next =
|
|
1363
|
+
_context16.next = 12;
|
|
1339
1364
|
return this.Marketplace({
|
|
1340
1365
|
marketplaceParams: marketplaceParams
|
|
1341
1366
|
});
|
|
1342
1367
|
|
|
1343
|
-
case
|
|
1368
|
+
case 12:
|
|
1344
1369
|
marketplace = _context16.sent;
|
|
1345
1370
|
|
|
1346
|
-
case
|
|
1347
|
-
_context16.prev =
|
|
1371
|
+
case 13:
|
|
1372
|
+
_context16.prev = 13;
|
|
1348
1373
|
filters = [];
|
|
1349
1374
|
|
|
1350
1375
|
if (sellerAddress) {
|
|
1351
1376
|
filters.push("seller:eq:".concat(this.client.utils.FormatAddress(sellerAddress)));
|
|
1377
|
+
} else if (userAddress && mode !== "owned") {
|
|
1378
|
+
filters.push("addr:eq:".concat(this.client.utils.FormatAddress(userAddress)));
|
|
1352
1379
|
}
|
|
1353
1380
|
|
|
1354
1381
|
if (marketplace && collectionIndexes.length >= 0) {
|
|
@@ -1374,7 +1401,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1374
1401
|
}
|
|
1375
1402
|
});
|
|
1376
1403
|
});
|
|
1377
|
-
} else if (
|
|
1404
|
+
} else if (marketplaceInfo || tenantId) {
|
|
1378
1405
|
filters.push("tenant:eq:".concat(marketplaceInfo ? marketplaceInfo.tenantId : tenantId));
|
|
1379
1406
|
}
|
|
1380
1407
|
|
|
@@ -1389,11 +1416,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1389
1416
|
filters.push("token:eq:".concat(tokenId));
|
|
1390
1417
|
}
|
|
1391
1418
|
} else if (filter) {
|
|
1392
|
-
if (mode
|
|
1419
|
+
if (mode === "listing") {
|
|
1393
1420
|
filters.push("nft/display_name:eq:".concat(filter));
|
|
1394
1421
|
} else if (mode === "owned") {
|
|
1395
|
-
filters.push("meta
|
|
1396
|
-
params.exact = false;
|
|
1422
|
+
filters.push("meta/display_name:eq:".concat(filter));
|
|
1397
1423
|
} else {
|
|
1398
1424
|
filters.push("name:eq:".concat(filter));
|
|
1399
1425
|
}
|
|
@@ -1458,91 +1484,87 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1458
1484
|
}
|
|
1459
1485
|
|
|
1460
1486
|
_context16.t0 = mode;
|
|
1461
|
-
_context16.next = _context16.t0 === "owned" ?
|
|
1487
|
+
_context16.next = _context16.t0 === "owned" ? 28 : _context16.t0 === "listings" ? 30 : _context16.t0 === "transfers" ? 32 : _context16.t0 === "sales" ? 36 : _context16.t0 === "listing-stats" ? 40 : _context16.t0 === "sales-stats" ? 42 : _context16.t0 === "leaderboard" ? 45 : 47;
|
|
1462
1488
|
break;
|
|
1463
1489
|
|
|
1464
|
-
case
|
|
1465
|
-
path = UrlJoin("as", "wlt",
|
|
1466
|
-
|
|
1467
|
-
if (marketplaceInfo) {
|
|
1468
|
-
path = UrlJoin("as", "wlt", "nfts", marketplaceInfo.tenantId);
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
return _context16.abrupt("break", 44);
|
|
1490
|
+
case 28:
|
|
1491
|
+
path = UrlJoin("as", "wlt", userAddress || this.UserAddress());
|
|
1492
|
+
return _context16.abrupt("break", 47);
|
|
1472
1493
|
|
|
1473
|
-
case
|
|
1494
|
+
case 30:
|
|
1474
1495
|
path = UrlJoin("as", "mkt", "f");
|
|
1475
|
-
return _context16.abrupt("break",
|
|
1496
|
+
return _context16.abrupt("break", 47);
|
|
1476
1497
|
|
|
1477
|
-
case
|
|
1498
|
+
case 32:
|
|
1478
1499
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1479
1500
|
filters.push("action:eq:TRANSFERRED");
|
|
1480
1501
|
filters.push("action:eq:SOLD");
|
|
1481
|
-
return _context16.abrupt("break",
|
|
1502
|
+
return _context16.abrupt("break", 47);
|
|
1482
1503
|
|
|
1483
|
-
case
|
|
1504
|
+
case 36:
|
|
1484
1505
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1485
1506
|
filters.push("action:eq:SOLD");
|
|
1486
1507
|
filters.push("seller:co:0x");
|
|
1487
|
-
return _context16.abrupt("break",
|
|
1508
|
+
return _context16.abrupt("break", 47);
|
|
1488
1509
|
|
|
1489
|
-
case
|
|
1510
|
+
case 40:
|
|
1490
1511
|
path = UrlJoin("as", "mkt", "stats", "listed");
|
|
1491
|
-
return _context16.abrupt("break",
|
|
1512
|
+
return _context16.abrupt("break", 47);
|
|
1492
1513
|
|
|
1493
|
-
case
|
|
1514
|
+
case 42:
|
|
1494
1515
|
path = UrlJoin("as", "mkt", "stats", "sold");
|
|
1495
1516
|
filters.push("seller:co:0x");
|
|
1496
|
-
return _context16.abrupt("break",
|
|
1517
|
+
return _context16.abrupt("break", 47);
|
|
1518
|
+
|
|
1519
|
+
case 45:
|
|
1520
|
+
path = UrlJoin("as", "wlt", "leaders");
|
|
1521
|
+
return _context16.abrupt("break", 47);
|
|
1497
1522
|
|
|
1498
|
-
case
|
|
1523
|
+
case 47:
|
|
1499
1524
|
if (filters.length > 0) {
|
|
1500
1525
|
params.filter = filters;
|
|
1501
1526
|
}
|
|
1502
1527
|
|
|
1503
1528
|
if (!mode.includes("stats")) {
|
|
1504
|
-
_context16.next =
|
|
1529
|
+
_context16.next = 52;
|
|
1505
1530
|
break;
|
|
1506
1531
|
}
|
|
1507
1532
|
|
|
1508
|
-
_context16.next =
|
|
1533
|
+
_context16.next = 51;
|
|
1509
1534
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1510
1535
|
path: path,
|
|
1511
1536
|
method: "GET",
|
|
1512
1537
|
queryParams: params
|
|
1513
1538
|
}));
|
|
1514
1539
|
|
|
1515
|
-
case
|
|
1540
|
+
case 51:
|
|
1516
1541
|
return _context16.abrupt("return", _context16.sent);
|
|
1517
1542
|
|
|
1518
|
-
case
|
|
1543
|
+
case 52:
|
|
1519
1544
|
_context16.t2 = Utils;
|
|
1520
|
-
_context16.next =
|
|
1545
|
+
_context16.next = 55;
|
|
1521
1546
|
return this.client.authClient.MakeAuthServiceRequest({
|
|
1522
1547
|
path: path,
|
|
1523
1548
|
method: "GET",
|
|
1524
|
-
queryParams: params
|
|
1525
|
-
headers: mode === "owned" ? {
|
|
1526
|
-
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1527
|
-
} : {}
|
|
1549
|
+
queryParams: params
|
|
1528
1550
|
});
|
|
1529
1551
|
|
|
1530
|
-
case
|
|
1552
|
+
case 55:
|
|
1531
1553
|
_context16.t3 = _context16.sent;
|
|
1532
|
-
_context16.next =
|
|
1554
|
+
_context16.next = 58;
|
|
1533
1555
|
return _context16.t2.ResponseToJson.call(_context16.t2, _context16.t3);
|
|
1534
1556
|
|
|
1535
|
-
case
|
|
1557
|
+
case 58:
|
|
1536
1558
|
_context16.t1 = _context16.sent;
|
|
1537
1559
|
|
|
1538
1560
|
if (_context16.t1) {
|
|
1539
|
-
_context16.next =
|
|
1561
|
+
_context16.next = 61;
|
|
1540
1562
|
break;
|
|
1541
1563
|
}
|
|
1542
1564
|
|
|
1543
1565
|
_context16.t1 = [];
|
|
1544
1566
|
|
|
1545
|
-
case
|
|
1567
|
+
case 61:
|
|
1546
1568
|
_ref16 = _context16.t1;
|
|
1547
1569
|
contents = _ref16.contents;
|
|
1548
1570
|
paging = _ref16.paging;
|
|
@@ -1554,16 +1576,16 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1554
1576
|
more: paging.total > start + limit
|
|
1555
1577
|
},
|
|
1556
1578
|
results: (contents || []).map(function (item) {
|
|
1557
|
-
return ["owned", "listings"].includes(mode) ? FormatNFT(item) : item;
|
|
1579
|
+
return ["owned", "listings"].includes(mode) ? FormatNFT(_this6, item) : item;
|
|
1558
1580
|
})
|
|
1559
1581
|
});
|
|
1560
1582
|
|
|
1561
|
-
case
|
|
1562
|
-
_context16.prev =
|
|
1563
|
-
_context16.t4 = _context16["catch"](
|
|
1583
|
+
case 67:
|
|
1584
|
+
_context16.prev = 67;
|
|
1585
|
+
_context16.t4 = _context16["catch"](13);
|
|
1564
1586
|
|
|
1565
1587
|
if (!(_context16.t4.status && _context16.t4.status.toString() === "404")) {
|
|
1566
|
-
_context16.next =
|
|
1588
|
+
_context16.next = 71;
|
|
1567
1589
|
break;
|
|
1568
1590
|
}
|
|
1569
1591
|
|
|
@@ -1577,15 +1599,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1577
1599
|
results: []
|
|
1578
1600
|
});
|
|
1579
1601
|
|
|
1580
|
-
case
|
|
1602
|
+
case 71:
|
|
1581
1603
|
throw _context16.t4;
|
|
1582
1604
|
|
|
1583
|
-
case
|
|
1605
|
+
case 72:
|
|
1584
1606
|
case "end":
|
|
1585
1607
|
return _context16.stop();
|
|
1586
1608
|
}
|
|
1587
1609
|
}
|
|
1588
|
-
}, _callee16, this, [[
|
|
1610
|
+
}, _callee16, this, [[13, 67]]);
|
|
1589
1611
|
}));
|
|
1590
1612
|
|
|
1591
1613
|
function FilteredQuery() {
|
|
@@ -1699,13 +1721,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1699
1721
|
key: "Initialize",
|
|
1700
1722
|
value: function () {
|
|
1701
1723
|
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref18) {
|
|
1702
|
-
var _ref18$network, network, _ref18$mode, mode, marketplaceParams, _ref18$storeAuthToken, storeAuthToken, _ref19, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, client, walletClient, url, savedToken;
|
|
1724
|
+
var _ref18$appId, appId, _ref18$network, network, _ref18$mode, mode, marketplaceParams, _ref18$storeAuthToken, storeAuthToken, _ref19, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, client, walletClient, url, savedToken;
|
|
1703
1725
|
|
|
1704
1726
|
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1705
1727
|
while (1) {
|
|
1706
1728
|
switch (_context18.prev = _context18.next) {
|
|
1707
1729
|
case 0:
|
|
1708
|
-
_ref18$network = _ref18.network, network = _ref18$network === void 0 ? "main" : _ref18$network, _ref18$mode = _ref18.mode, mode = _ref18$mode === void 0 ? "production" : _ref18$mode, marketplaceParams = _ref18.marketplaceParams, _ref18$storeAuthToken = _ref18.storeAuthToken, storeAuthToken = _ref18$storeAuthToken === void 0 ? true : _ref18$storeAuthToken;
|
|
1730
|
+
_ref18$appId = _ref18.appId, appId = _ref18$appId === void 0 ? "general" : _ref18$appId, _ref18$network = _ref18.network, network = _ref18$network === void 0 ? "main" : _ref18$network, _ref18$mode = _ref18.mode, mode = _ref18$mode === void 0 ? "production" : _ref18$mode, marketplaceParams = _ref18.marketplaceParams, _ref18$storeAuthToken = _ref18.storeAuthToken, storeAuthToken = _ref18$storeAuthToken === void 0 ? true : _ref18$storeAuthToken;
|
|
1709
1731
|
_ref19 = marketplaceParams || {}, tenantSlug = _ref19.tenantSlug, marketplaceSlug = _ref19.marketplaceSlug, marketplaceId = _ref19.marketplaceId, marketplaceHash = _ref19.marketplaceHash;
|
|
1710
1732
|
|
|
1711
1733
|
if (Configuration[network]) {
|
|
@@ -1733,6 +1755,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1733
1755
|
case 10:
|
|
1734
1756
|
client = _context18.sent;
|
|
1735
1757
|
walletClient = new ElvWalletClient({
|
|
1758
|
+
appId: appId,
|
|
1736
1759
|
client: client,
|
|
1737
1760
|
network: network,
|
|
1738
1761
|
mode: mode,
|
|
@@ -1823,4 +1846,5 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1823
1846
|
}();
|
|
1824
1847
|
|
|
1825
1848
|
Object.assign(ElvWalletClient.prototype, require("./ClientMethods"));
|
|
1849
|
+
Object.assign(ElvWalletClient.prototype, require("./Profile"));
|
|
1826
1850
|
exports.ElvWalletClient = ElvWalletClient;
|
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@ exports.UserAddress = function() {
|
|
|
53
53
|
* Retrieve the fund balances for the current user
|
|
54
54
|
*
|
|
55
55
|
* @methodGroup User
|
|
56
|
-
* @returns {Promise<
|
|
56
|
+
* @returns {Promise<Object>} - Returns balances for the user. All values are in USD.
|
|
57
57
|
* <ul>
|
|
58
58
|
* <li>- totalWalletBalance - Total balance of the users sales and wallet balance purchases</li>
|
|
59
59
|
* <li>- availableWalletBalance - Balance available for purchasing items</li>
|
|
@@ -180,13 +180,110 @@ exports.UserItemInfo = async function ({userAddress}={}) {
|
|
|
180
180
|
};
|
|
181
181
|
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Retrieve all valid names for filtering user items. Full item names are required for filtering results by name.
|
|
185
|
+
*
|
|
186
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
187
|
+
*
|
|
188
|
+
* @methodGroup User
|
|
189
|
+
* @namedParams
|
|
190
|
+
* @param {string=} userAddress - Address of a user
|
|
191
|
+
* @param {Object=} marketplaceParams - Parameters of a marketplace to filter results by
|
|
192
|
+
*
|
|
193
|
+
* @returns {Promise<Array<String>>} - A list of item names
|
|
194
|
+
*/
|
|
195
|
+
exports.UserItemNames = async function({marketplaceParams, userAddress}={}) {
|
|
196
|
+
let filters = [];
|
|
197
|
+
if(marketplaceParams) {
|
|
198
|
+
filters.push(`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams})).tenantId}`);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if(userAddress) {
|
|
202
|
+
filters.push(`wlt:eq:${Utils.FormatAddress(userAddress)}`);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return await Utils.ResponseToJson(
|
|
206
|
+
await this.client.authClient.MakeAuthServiceRequest({
|
|
207
|
+
path: UrlJoin("as", "wlt", "names"),
|
|
208
|
+
method: "GET",
|
|
209
|
+
queryParams: { filter: filters }
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Retrieve all valid edition names for filtering the specified item. Full edition names are required for filtering results by edition.
|
|
216
|
+
*
|
|
217
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
218
|
+
*
|
|
219
|
+
* @methodGroup User
|
|
220
|
+
* @namedParams
|
|
221
|
+
* @param {string} displayName - Name of an item
|
|
222
|
+
*
|
|
223
|
+
* @returns {Promise<Array<String>>} - A list of item editions
|
|
224
|
+
*/
|
|
225
|
+
exports.UserItemEditionNames = async function({displayName}) {
|
|
226
|
+
return await Utils.ResponseToJson(
|
|
227
|
+
await this.client.authClient.MakeAuthServiceRequest({
|
|
228
|
+
path: UrlJoin("as", "wlt", "editions"),
|
|
229
|
+
method: "GET",
|
|
230
|
+
queryParams: { filter: `meta/display_name:eq:${displayName}` }
|
|
231
|
+
})
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Retrieve all valid attribute names and values. Full attribute names and values are required for filtering results by attribute.
|
|
237
|
+
*
|
|
238
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
239
|
+
*
|
|
240
|
+
* @methodGroup User
|
|
241
|
+
* @namedParams
|
|
242
|
+
* @param {string=} userAddress - Address of a user
|
|
243
|
+
* @param {string=} displayName - Name of an item
|
|
244
|
+
* @param {Object=} marketplaceParams - Parameters of a marketplace to filter results by
|
|
245
|
+
*
|
|
246
|
+
* @returns {Promise<Array<String>>} - A list of item names
|
|
247
|
+
*/
|
|
248
|
+
exports.UserItemAttributes = async function({marketplaceParams, displayName, userAddress}={}) {
|
|
249
|
+
let filters = [];
|
|
250
|
+
if(marketplaceParams) {
|
|
251
|
+
filters.push(`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams})).tenantId}`);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if(userAddress) {
|
|
255
|
+
filters.push(`wlt:eq:${Utils.FormatAddress(userAddress)}`);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if(displayName) {
|
|
259
|
+
filters.push(`meta/display_name:eq:${displayName}`);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const attributes = await Utils.ResponseToJson(
|
|
263
|
+
await this.client.authClient.MakeAuthServiceRequest({
|
|
264
|
+
path: UrlJoin("as", "wlt", "attributes"),
|
|
265
|
+
method: "GET",
|
|
266
|
+
queryParams: {
|
|
267
|
+
filter: filters
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
return attributes
|
|
273
|
+
.map(({trait_type, values}) => ({ name: trait_type, values }))
|
|
274
|
+
.filter(({name}) =>
|
|
275
|
+
!["Content Fabric Hash", "Total Minted Supply", "Creator"].includes(name)
|
|
276
|
+
);
|
|
277
|
+
};
|
|
278
|
+
|
|
183
279
|
/**
|
|
184
280
|
* <b><i>Requires login</i></b>
|
|
185
281
|
*
|
|
186
|
-
* Retrieve items owned by the current user matching the specified parameters.
|
|
282
|
+
* Retrieve items owned by the specified or current user matching the specified parameters.
|
|
187
283
|
*
|
|
188
284
|
* @methodGroup User
|
|
189
285
|
* @namedParams
|
|
286
|
+
* @param {string=} userAddress - Address of a user. If not specified, will return results for current user
|
|
190
287
|
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
191
288
|
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
192
289
|
* @param {string=} sortBy="created" - Sort order. Options: `default`, `meta/display_name`
|
|
@@ -208,6 +305,7 @@ exports.UserItems = async function() {
|
|
|
208
305
|
*
|
|
209
306
|
* @methodGroup User
|
|
210
307
|
* @namedParams
|
|
308
|
+
* @param {string=} userAddress - Address of a user. If not specified, will return results for current user
|
|
211
309
|
* @param {string=} sortBy="created" - Sort order. Options: `created`, `info/token_id`, `info/ordinal`, `price`, `nft/display_name`
|
|
212
310
|
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
213
311
|
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
@@ -216,7 +314,7 @@ exports.UserItems = async function() {
|
|
|
216
314
|
*
|
|
217
315
|
* @returns {Promise<Array<Object>>} - List of current user's listings
|
|
218
316
|
*/
|
|
219
|
-
exports.UserListings = async function({sortBy="created", sortDesc=false, contractAddress, tokenId, marketplaceParams}={}) {
|
|
317
|
+
exports.UserListings = async function({userAddress, sortBy="created", sortDesc=false, contractAddress, tokenId, marketplaceParams}={}) {
|
|
220
318
|
return (
|
|
221
319
|
await this.FilteredQuery({
|
|
222
320
|
mode: "listings",
|
|
@@ -224,10 +322,11 @@ exports.UserListings = async function({sortBy="created", sortDesc=false, contrac
|
|
|
224
322
|
limit: 10000,
|
|
225
323
|
sortBy,
|
|
226
324
|
sortDesc,
|
|
227
|
-
sellerAddress: this.UserAddress(),
|
|
325
|
+
sellerAddress: userAddress || this.UserAddress(),
|
|
228
326
|
marketplaceParams,
|
|
229
327
|
contractAddress,
|
|
230
|
-
tokenId
|
|
328
|
+
tokenId,
|
|
329
|
+
includeCheckoutLocked: true
|
|
231
330
|
})
|
|
232
331
|
).results;
|
|
233
332
|
};
|
|
@@ -237,6 +336,7 @@ exports.UserListings = async function({sortBy="created", sortDesc=false, contrac
|
|
|
237
336
|
*
|
|
238
337
|
* @methodGroup User
|
|
239
338
|
* @namedParams
|
|
339
|
+
* @param {string=} userAddress - Address of a user. If not specified, will return results for current user
|
|
240
340
|
* @param {string=} sortBy="created" - Sort order. Options: `created`, `price`, `name`
|
|
241
341
|
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
242
342
|
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
@@ -246,7 +346,7 @@ exports.UserListings = async function({sortBy="created", sortDesc=false, contrac
|
|
|
246
346
|
*
|
|
247
347
|
* @returns {Promise<Array<Object>>} - List of current user's sales
|
|
248
348
|
*/
|
|
249
|
-
exports.UserSales = async function({sortBy="created", sortDesc=false, contractAddress, tokenId, marketplaceParams}={}) {
|
|
349
|
+
exports.UserSales = async function({userAddress, sortBy="created", sortDesc=false, contractAddress, tokenId, marketplaceParams}={}) {
|
|
250
350
|
return (
|
|
251
351
|
await this.FilteredQuery({
|
|
252
352
|
mode: "sales",
|
|
@@ -254,7 +354,7 @@ exports.UserSales = async function({sortBy="created", sortDesc=false, contractAd
|
|
|
254
354
|
limit: 10000,
|
|
255
355
|
sortBy,
|
|
256
356
|
sortDesc,
|
|
257
|
-
sellerAddress: this.UserAddress(),
|
|
357
|
+
sellerAddress: userAddress || this.UserAddress(),
|
|
258
358
|
marketplaceParams,
|
|
259
359
|
contractAddress,
|
|
260
360
|
tokenId
|
|
@@ -267,6 +367,7 @@ exports.UserSales = async function({sortBy="created", sortDesc=false, contractAd
|
|
|
267
367
|
*
|
|
268
368
|
* @methodGroup User
|
|
269
369
|
* @namedParams
|
|
370
|
+
* @param {string=} userAddress - Address of a user. If not specified, will return results for current user
|
|
270
371
|
* @param {string=} sortBy="created" - Sort order. Options: `created`, `price`, `name`
|
|
271
372
|
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
272
373
|
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
@@ -276,7 +377,7 @@ exports.UserSales = async function({sortBy="created", sortDesc=false, contractAd
|
|
|
276
377
|
*
|
|
277
378
|
* @returns {Promise<Array<Object>>} - List of current user's sales
|
|
278
379
|
*/
|
|
279
|
-
exports.UserTransfers = async function({sortBy="created", sortDesc=false, contractAddress, tokenId, marketplaceParams}={}) {
|
|
380
|
+
exports.UserTransfers = async function({userAddress, sortBy="created", sortDesc=false, contractAddress, tokenId, marketplaceParams}={}) {
|
|
280
381
|
return (
|
|
281
382
|
await this.FilteredQuery({
|
|
282
383
|
mode: "transfers",
|
|
@@ -284,7 +385,7 @@ exports.UserTransfers = async function({sortBy="created", sortDesc=false, contra
|
|
|
284
385
|
limit: 10000,
|
|
285
386
|
sortBy,
|
|
286
387
|
sortDesc,
|
|
287
|
-
sellerAddress: this.UserAddress(),
|
|
388
|
+
sellerAddress: userAddress || this.UserAddress(),
|
|
288
389
|
marketplaceParams,
|
|
289
390
|
contractAddress,
|
|
290
391
|
tokenId
|
|
@@ -304,7 +405,7 @@ exports.UserTransfers = async function({sortBy="created", sortDesc=false, contra
|
|
|
304
405
|
* @param {string=} tenantId - The ID of the tenant for which to retrieve configuration
|
|
305
406
|
* @param {string=} contractAddress - The ID of an nft contract for which to retrieve configuration
|
|
306
407
|
*
|
|
307
|
-
* @returns {Promise<
|
|
408
|
+
* @returns {Promise<Object>} - The tenant configuration
|
|
308
409
|
*/
|
|
309
410
|
exports.TenantConfiguration = async function({tenantId, contractAddress}) {
|
|
310
411
|
try {
|
|
@@ -428,7 +529,7 @@ exports.MarketplaceCSS = async function ({marketplaceParams}) {
|
|
|
428
529
|
* @param {boolean=} organizeById - By default, the returned marketplace info is organized by tenant and marketplace slug. If this option is enabled, the marketplaces will be organized by marketplace ID instead.
|
|
429
530
|
* @param {boolean=} forceReload=false - If specified, a new request will be made to check the currently available marketplaces instead of returning cached info
|
|
430
531
|
*
|
|
431
|
-
* @returns {Promise<
|
|
532
|
+
* @returns {Promise<Object>} - Info about available marketplaces
|
|
432
533
|
*/
|
|
433
534
|
exports.AvailableMarketplaces = async function ({organizeById, forceReload=false}={}) {
|
|
434
535
|
if(forceReload) {
|
|
@@ -507,7 +608,7 @@ exports.NFT = async function({tokenId, contractAddress}) {
|
|
|
507
608
|
|
|
508
609
|
nft.config = await this.TenantConfiguration({contractAddress});
|
|
509
610
|
|
|
510
|
-
return FormatNFTMetadata(nft);
|
|
611
|
+
return FormatNFTMetadata(this, nft);
|
|
511
612
|
};
|
|
512
613
|
|
|
513
614
|
/**
|
|
@@ -580,6 +681,7 @@ exports.ListingStatus = async function({listingId}) {
|
|
|
580
681
|
*/
|
|
581
682
|
exports.Listing = async function({listingId}) {
|
|
582
683
|
return FormatNFT(
|
|
684
|
+
this,
|
|
583
685
|
await Utils.ResponseToJson(
|
|
584
686
|
await this.client.authClient.MakeAuthServiceRequest({
|
|
585
687
|
path: UrlJoin("as", "mkt", "l", listingId),
|
|
@@ -619,6 +721,7 @@ exports.Listing = async function({listingId}) {
|
|
|
619
721
|
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
620
722
|
* @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
|
|
621
723
|
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
724
|
+
* @param {boolean=} includeCheckoutLocked - If specified, listings which are currently in the checkout process (and not so currently purchasable) will be included in the results. By default they are excluded.
|
|
622
725
|
*
|
|
623
726
|
* @returns {Promise<Object>} - Results of the query and pagination info
|
|
624
727
|
*/
|
|
@@ -767,6 +870,41 @@ exports.SalesStats = async function() {
|
|
|
767
870
|
return this.FilteredQuery({mode: "sales-stats", ...(arguments[0] || {})});
|
|
768
871
|
};
|
|
769
872
|
|
|
873
|
+
/**
|
|
874
|
+
* Get the leaderboard rankings for the specified marketplace. If user address is specified, will return the ranking for the specified user (if present)
|
|
875
|
+
*
|
|
876
|
+
* @methodGroup Leaderboard
|
|
877
|
+
* @namedParams
|
|
878
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
879
|
+
* @param {string=} userAddress - Retrieve the ranking for a specific user
|
|
880
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
881
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
882
|
+
*
|
|
883
|
+
* @returns {Promise<Array|Object>} - Returns a list of leaderboard rankings or, if userAddress is specified, ranking for that user.
|
|
884
|
+
*/
|
|
885
|
+
exports.Leaderboard = async function({userAddress, marketplaceParams}) {
|
|
886
|
+
if(userAddress) {
|
|
887
|
+
let params = {
|
|
888
|
+
addr: Utils.FormatAddress(userAddress)
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
if(marketplaceParams) {
|
|
892
|
+
params.filter = [`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams})).tenantId}`];
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
return ((await Utils.ResponseToJson(
|
|
896
|
+
await this.client.authClient.MakeAuthServiceRequest({
|
|
897
|
+
path: UrlJoin("as", "wlt", "ranks"),
|
|
898
|
+
method: "GET",
|
|
899
|
+
queryParams: params
|
|
900
|
+
})
|
|
901
|
+
)) || [])[0];
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
return this.FilteredQuery({mode: "leaderboard", ...(arguments[0] || {})});
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
|
|
770
908
|
|
|
771
909
|
/**
|
|
772
910
|
* <b><i>Requires login</i></b>
|
|
@@ -888,7 +1026,7 @@ exports.ListingEditionNames = async function({displayName}) {
|
|
|
888
1026
|
};
|
|
889
1027
|
|
|
890
1028
|
/**
|
|
891
|
-
* Retrieve names of all valid attributes for listed
|
|
1029
|
+
* Retrieve names of all valid attributes for listed items. Full attribute names and values are required for filtering listing results by attributes.
|
|
892
1030
|
*
|
|
893
1031
|
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
894
1032
|
*
|