@eluvio/elv-client-js 3.2.9 → 3.2.12
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/ElvClient-min.js +8 -8
- package/dist/ElvClient-node-min.js +2 -2
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +2 -2
- package/dist/src/ElvClient.js +5 -4
- package/dist/src/RemoteSigner.js +2 -2
- package/dist/src/walletClient/ClientMethods.js +13 -11
- package/dist/src/walletClient/Configuration.js +1 -1
- package/dist/src/walletClient/index.js +149 -127
- package/package.json +1 -1
- package/src/ElvClient.js +3 -2
- package/src/RemoteSigner.js +2 -2
- package/src/walletClient/ClientMethods.js +13 -11
- package/src/walletClient/Configuration.js +1 -1
- package/src/walletClient/index.js +80 -50
- package/testScripts/Test.js +33 -0
|
@@ -31,6 +31,8 @@ var UrlJoin = require("url-join");
|
|
|
31
31
|
var Utils = require("../Utils");
|
|
32
32
|
|
|
33
33
|
var Ethers = require("ethers");
|
|
34
|
+
|
|
35
|
+
var inBrowser = typeof window !== "undefined";
|
|
34
36
|
/**
|
|
35
37
|
* Use the <a href="#.Initialize">Initialize</a> method to initialize a new client.
|
|
36
38
|
*
|
|
@@ -38,7 +40,6 @@ var Ethers = require("ethers");
|
|
|
38
40
|
* See the Modules section on the sidebar for all client methods unrelated to login and authorization
|
|
39
41
|
*/
|
|
40
42
|
|
|
41
|
-
|
|
42
43
|
var ElvWalletClient = /*#__PURE__*/function () {
|
|
43
44
|
"use strict";
|
|
44
45
|
|
|
@@ -116,7 +117,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
116
117
|
return false;
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
return !!this.__authorization.clusterToken || !!(this.UserInfo().walletName.toLowerCase() === "metamask" && window.ethereum && window.ethereum.isMetaMask && window.ethereum.chainId);
|
|
120
|
+
return !!this.__authorization.clusterToken || inBrowser && !!(this.UserInfo().walletName.toLowerCase() === "metamask" && window.ethereum && window.ethereum.isMetaMask && window.ethereum.chainId);
|
|
120
121
|
}
|
|
121
122
|
/**
|
|
122
123
|
* <b><i>Requires login</i></b>
|
|
@@ -156,7 +157,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
156
157
|
|
|
157
158
|
case 3:
|
|
158
159
|
if (!this.CanSign()) {
|
|
159
|
-
_context3.next =
|
|
160
|
+
_context3.next = 19;
|
|
160
161
|
break;
|
|
161
162
|
}
|
|
162
163
|
|
|
@@ -189,6 +190,18 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
189
190
|
throw Error("ElvWalletClient: Unable to sign");
|
|
190
191
|
|
|
191
192
|
case 17:
|
|
193
|
+
_context3.next = 21;
|
|
194
|
+
break;
|
|
195
|
+
|
|
196
|
+
case 19:
|
|
197
|
+
if (inBrowser) {
|
|
198
|
+
_context3.next = 21;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
throw Error("ElvWalletClient: Unable to sign");
|
|
203
|
+
|
|
204
|
+
case 21:
|
|
192
205
|
parameters = {
|
|
193
206
|
action: "personal-sign",
|
|
194
207
|
message: message,
|
|
@@ -197,7 +210,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
197
210
|
url = new URL(this.appUrl);
|
|
198
211
|
url.hash = UrlJoin("/action", "sign", Utils.B58(JSON.stringify(parameters)));
|
|
199
212
|
url.searchParams.set("origin", window.location.origin);
|
|
200
|
-
_context3.next =
|
|
213
|
+
_context3.next = 27;
|
|
201
214
|
return new Promise( /*#__PURE__*/function () {
|
|
202
215
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve, reject) {
|
|
203
216
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -262,10 +275,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
262
275
|
};
|
|
263
276
|
}());
|
|
264
277
|
|
|
265
|
-
case
|
|
278
|
+
case 27:
|
|
266
279
|
return _context3.abrupt("return", _context3.sent);
|
|
267
280
|
|
|
268
|
-
case
|
|
281
|
+
case 28:
|
|
269
282
|
case "end":
|
|
270
283
|
return _context3.stop();
|
|
271
284
|
}
|
|
@@ -537,7 +550,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
537
550
|
|
|
538
551
|
_context7.next = 13;
|
|
539
552
|
return this.client.SetRemoteSigner({
|
|
540
|
-
authToken: decodedToken.clusterToken
|
|
553
|
+
authToken: decodedToken.clusterToken,
|
|
554
|
+
signerURIs: decodedToken.signerURIs
|
|
541
555
|
});
|
|
542
556
|
|
|
543
557
|
case 13:
|
|
@@ -568,8 +582,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
568
582
|
* @param {string} idToken - An OAuth ID token
|
|
569
583
|
* @param {string=} tenantId - ID of tenant with which to associate the user. If marketplace info was set upon initialization, this will be determined automatically.
|
|
570
584
|
* @param {string=} email - Email address of the user. If not specified, this method will attempt to extract the email from the ID token.
|
|
585
|
+
* @param {Array<string>=} signerURIs - (Only if using custom OAuth) - URIs corresponding to the key server(s) to use
|
|
571
586
|
* @param {boolean=} shareEmail=false - Whether or not the user consents to sharing their email
|
|
572
|
-
* @param {number=} tokenDuration=24 - Number of hours the generated authorization token will last before expiring
|
|
573
587
|
*
|
|
574
588
|
* @returns {Promise<Object>} - Returns an authorization tokens that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
|
|
575
589
|
* Save this token to avoid having to reauthenticate with OAuth. This token expires after 24 hours.
|
|
@@ -584,64 +598,66 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
584
598
|
key: "AuthenticateOAuth",
|
|
585
599
|
value: function () {
|
|
586
600
|
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref7) {
|
|
587
|
-
var idToken, tenantId, email, _ref7$shareEmail, shareEmail,
|
|
601
|
+
var idToken, tenantId, email, signerURIs, _ref7$shareEmail, shareEmail, tokenDuration, expiresAt, fabricToken, address, decodedToken;
|
|
588
602
|
|
|
589
603
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
590
604
|
while (1) {
|
|
591
605
|
switch (_context8.prev = _context8.next) {
|
|
592
606
|
case 0:
|
|
593
|
-
idToken = _ref7.idToken, tenantId = _ref7.tenantId, email = _ref7.email,
|
|
607
|
+
idToken = _ref7.idToken, tenantId = _ref7.tenantId, email = _ref7.email, signerURIs = _ref7.signerURIs, _ref7$shareEmail = _ref7.shareEmail, shareEmail = _ref7$shareEmail === void 0 ? false : _ref7$shareEmail;
|
|
608
|
+
tokenDuration = 24;
|
|
594
609
|
|
|
595
610
|
if (!(!tenantId && this.selectedMarketplaceInfo)) {
|
|
596
|
-
_context8.next =
|
|
611
|
+
_context8.next = 6;
|
|
597
612
|
break;
|
|
598
613
|
}
|
|
599
614
|
|
|
600
|
-
_context8.next =
|
|
615
|
+
_context8.next = 5;
|
|
601
616
|
return this.AvailableMarketplaces();
|
|
602
617
|
|
|
603
|
-
case
|
|
618
|
+
case 5:
|
|
604
619
|
tenantId = this.selectedMarketplaceInfo.tenantId;
|
|
605
620
|
|
|
606
|
-
case
|
|
607
|
-
_context8.next =
|
|
621
|
+
case 6:
|
|
622
|
+
_context8.next = 8;
|
|
608
623
|
return this.client.SetRemoteSigner({
|
|
609
624
|
idToken: idToken,
|
|
610
625
|
tenantId: tenantId,
|
|
626
|
+
signerURIs: signerURIs,
|
|
611
627
|
extraData: {
|
|
612
628
|
share_email: shareEmail
|
|
613
629
|
},
|
|
614
630
|
unsignedPublicAuth: true
|
|
615
631
|
});
|
|
616
632
|
|
|
617
|
-
case
|
|
633
|
+
case 8:
|
|
618
634
|
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
619
|
-
_context8.next =
|
|
635
|
+
_context8.next = 11;
|
|
620
636
|
return this.client.CreateFabricToken({
|
|
621
637
|
duration: tokenDuration * 60 * 60 * 1000
|
|
622
638
|
});
|
|
623
639
|
|
|
624
|
-
case
|
|
640
|
+
case 11:
|
|
625
641
|
fabricToken = _context8.sent;
|
|
626
642
|
address = this.client.utils.FormatAddress(this.client.CurrentAccountAddress());
|
|
627
643
|
|
|
628
644
|
if (email) {
|
|
629
|
-
_context8.next =
|
|
645
|
+
_context8.next = 22;
|
|
630
646
|
break;
|
|
631
647
|
}
|
|
632
648
|
|
|
633
|
-
_context8.prev =
|
|
649
|
+
_context8.prev = 14;
|
|
634
650
|
decodedToken = JSON.parse(this.utils.FromB64URL(idToken.split(".")[1]));
|
|
635
651
|
email = decodedToken.email;
|
|
636
|
-
_context8.next =
|
|
652
|
+
_context8.next = 22;
|
|
637
653
|
break;
|
|
638
654
|
|
|
639
|
-
case
|
|
640
|
-
_context8.prev =
|
|
641
|
-
_context8.t0 = _context8["catch"](
|
|
655
|
+
case 19:
|
|
656
|
+
_context8.prev = 19;
|
|
657
|
+
_context8.t0 = _context8["catch"](14);
|
|
642
658
|
throw Error("Failed to decode ID token");
|
|
643
659
|
|
|
644
|
-
case
|
|
660
|
+
case 22:
|
|
645
661
|
this.client.SetStaticToken({
|
|
646
662
|
token: fabricToken
|
|
647
663
|
});
|
|
@@ -652,6 +668,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
652
668
|
address: address,
|
|
653
669
|
email: email,
|
|
654
670
|
expiresAt: expiresAt,
|
|
671
|
+
signerURIs: signerURIs,
|
|
655
672
|
walletType: "Custodial",
|
|
656
673
|
walletName: "Eluvio"
|
|
657
674
|
}),
|
|
@@ -662,17 +679,18 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
662
679
|
address: address,
|
|
663
680
|
email: email,
|
|
664
681
|
expiresAt: expiresAt,
|
|
682
|
+
signerURIs: signerURIs,
|
|
665
683
|
walletType: "Custodial",
|
|
666
684
|
walletName: "Eluvio"
|
|
667
685
|
})
|
|
668
686
|
});
|
|
669
687
|
|
|
670
|
-
case
|
|
688
|
+
case 24:
|
|
671
689
|
case "end":
|
|
672
690
|
return _context8.stop();
|
|
673
691
|
}
|
|
674
692
|
}
|
|
675
|
-
}, _callee8, this, [[
|
|
693
|
+
}, _callee8, this, [[14, 19]]);
|
|
676
694
|
}));
|
|
677
695
|
|
|
678
696
|
function AuthenticateOAuth(_x12) {
|
|
@@ -809,6 +827,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
809
827
|
address = _ref10.address,
|
|
810
828
|
email = _ref10.email,
|
|
811
829
|
expiresAt = _ref10.expiresAt,
|
|
830
|
+
signerURIs = _ref10.signerURIs,
|
|
812
831
|
walletType = _ref10.walletType,
|
|
813
832
|
walletName = _ref10.walletName;
|
|
814
833
|
address = this.client.utils.FormatAddress(address);
|
|
@@ -824,6 +843,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
824
843
|
|
|
825
844
|
if (clusterToken) {
|
|
826
845
|
this.__authorization.clusterToken = clusterToken;
|
|
846
|
+
|
|
847
|
+
if (signerURIs) {
|
|
848
|
+
this.__authorization.signerURIs = signerURIs;
|
|
849
|
+
}
|
|
827
850
|
}
|
|
828
851
|
|
|
829
852
|
this.loggedIn = true;
|
|
@@ -849,7 +872,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
849
872
|
case 0:
|
|
850
873
|
message = _ref11.message, address = _ref11.address;
|
|
851
874
|
|
|
852
|
-
if (window.ethereum) {
|
|
875
|
+
if (!(!inBrowser || !window.ethereum)) {
|
|
853
876
|
_context11.next = 3;
|
|
854
877
|
break;
|
|
855
878
|
}
|
|
@@ -1218,15 +1241,17 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1218
1241
|
_ref14$sortDesc,
|
|
1219
1242
|
sortDesc,
|
|
1220
1243
|
filter,
|
|
1221
|
-
|
|
1244
|
+
editionFilters,
|
|
1222
1245
|
attributeFilters,
|
|
1223
1246
|
contractAddress,
|
|
1224
1247
|
tokenId,
|
|
1225
1248
|
currency,
|
|
1226
1249
|
marketplaceParams,
|
|
1227
1250
|
tenantId,
|
|
1228
|
-
|
|
1229
|
-
|
|
1251
|
+
collectionIndexes,
|
|
1252
|
+
priceRange,
|
|
1253
|
+
tokenIdRange,
|
|
1254
|
+
capLimit,
|
|
1230
1255
|
sellerAddress,
|
|
1231
1256
|
_ref14$lastNDays,
|
|
1232
1257
|
lastNDays,
|
|
@@ -1238,7 +1263,6 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1238
1263
|
marketplaceInfo,
|
|
1239
1264
|
marketplace,
|
|
1240
1265
|
filters,
|
|
1241
|
-
collection,
|
|
1242
1266
|
path,
|
|
1243
1267
|
_ref16,
|
|
1244
1268
|
contents,
|
|
@@ -1249,8 +1273,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1249
1273
|
while (1) {
|
|
1250
1274
|
switch (_context16.prev = _context16.next) {
|
|
1251
1275
|
case 0:
|
|
1252
|
-
_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,
|
|
1253
|
-
|
|
1276
|
+
_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;
|
|
1277
|
+
collectionIndexes = (collectionIndexes || []).map(function (i) {
|
|
1278
|
+
return parseInt(i);
|
|
1279
|
+
});
|
|
1254
1280
|
params = {
|
|
1255
1281
|
sort_by: sortBy,
|
|
1256
1282
|
sort_descending: sortDesc,
|
|
@@ -1271,7 +1297,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1271
1297
|
case 6:
|
|
1272
1298
|
marketplaceInfo = _context16.sent;
|
|
1273
1299
|
|
|
1274
|
-
if (!(
|
|
1300
|
+
if (!(collectionIndexes.length > 0)) {
|
|
1275
1301
|
_context16.next = 11;
|
|
1276
1302
|
break;
|
|
1277
1303
|
}
|
|
@@ -1292,65 +1318,33 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1292
1318
|
filters.push("seller:eq:".concat(this.client.utils.FormatAddress(sellerAddress)));
|
|
1293
1319
|
}
|
|
1294
1320
|
|
|
1295
|
-
if (
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
if (!sku) {
|
|
1303
|
-
return;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
var item = marketplace.items.find(function (item) {
|
|
1307
|
-
return item.sku === sku;
|
|
1308
|
-
});
|
|
1309
|
-
|
|
1310
|
-
if (!item) {
|
|
1311
|
-
return;
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
var address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
|
|
1315
|
-
|
|
1316
|
-
if (address) {
|
|
1317
|
-
filters.push("".concat(mode === "owned" ? "contract_addr" : "contract", ":eq:").concat(Utils.FormatAddress(address)));
|
|
1318
|
-
}
|
|
1319
|
-
}); // No valid items, so there must not be anything relevant in the collection
|
|
1320
|
-
|
|
1321
|
-
if (!(filters.length === 0)) {
|
|
1322
|
-
_context16.next = 23;
|
|
1323
|
-
break;
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
if (!mode.includes("stats")) {
|
|
1327
|
-
_context16.next = 22;
|
|
1328
|
-
break;
|
|
1329
|
-
}
|
|
1321
|
+
if (marketplace && collectionIndexes.length >= 0) {
|
|
1322
|
+
collectionIndexes.forEach(function (collectionIndex) {
|
|
1323
|
+
var collection = marketplace.collections[collectionIndex];
|
|
1324
|
+
collection.items.forEach(function (sku) {
|
|
1325
|
+
if (!sku) {
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1330
1328
|
|
|
1331
|
-
|
|
1329
|
+
var item = marketplace.items.find(function (item) {
|
|
1330
|
+
return item.sku === sku;
|
|
1331
|
+
});
|
|
1332
1332
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
start: params.start,
|
|
1337
|
-
limit: params.limit,
|
|
1338
|
-
total: 0,
|
|
1339
|
-
more: false
|
|
1340
|
-
},
|
|
1341
|
-
results: []
|
|
1342
|
-
});
|
|
1333
|
+
if (!item) {
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1343
1336
|
|
|
1344
|
-
|
|
1345
|
-
_context16.next = 26;
|
|
1346
|
-
break;
|
|
1337
|
+
var address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
|
|
1347
1338
|
|
|
1348
|
-
|
|
1349
|
-
|
|
1339
|
+
if (address) {
|
|
1340
|
+
filters.push("".concat(mode === "owned" ? "contract_addr" : "contract", ":eq:").concat(Utils.FormatAddress(address)));
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
});
|
|
1344
|
+
} else if (mode !== "owned" && marketplaceInfo || tenantId) {
|
|
1350
1345
|
filters.push("tenant:eq:".concat(marketplaceInfo ? marketplaceInfo.tenantId : tenantId));
|
|
1351
1346
|
}
|
|
1352
1347
|
|
|
1353
|
-
case 26:
|
|
1354
1348
|
if (contractAddress) {
|
|
1355
1349
|
if (mode === "owned") {
|
|
1356
1350
|
filters.push("contract_addr:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
@@ -1372,15 +1366,17 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1372
1366
|
}
|
|
1373
1367
|
}
|
|
1374
1368
|
|
|
1375
|
-
if (
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1369
|
+
if (editionFilters) {
|
|
1370
|
+
editionFilters.forEach(function (editionFilter) {
|
|
1371
|
+
if (mode.includes("listing")) {
|
|
1372
|
+
filters.push("nft/edition_name:eq:".concat(editionFilter));
|
|
1373
|
+
} else if (mode === "owned") {
|
|
1374
|
+
filters.push("meta:@>:{\"edition_name\":\"".concat(editionFilter, "\"}"));
|
|
1375
|
+
params.exact = false;
|
|
1376
|
+
} else {
|
|
1377
|
+
filters.push("edition:eq:".concat(editionFilter));
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1384
1380
|
}
|
|
1385
1381
|
|
|
1386
1382
|
if (attributeFilters) {
|
|
@@ -1404,63 +1400,89 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1404
1400
|
filters.push("created:gt:".concat((Date.now() / 1000 - lastNDays * 24 * 60 * 60).toFixed(0)));
|
|
1405
1401
|
}
|
|
1406
1402
|
|
|
1403
|
+
if (priceRange) {
|
|
1404
|
+
if (priceRange.min) {
|
|
1405
|
+
filters.push("price:gt:".concat(parseFloat(priceRange.min) - 0.01));
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
if (priceRange.max) {
|
|
1409
|
+
filters.push("price:lt:".concat(parseFloat(priceRange.max) + 0.01));
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
if (tokenIdRange) {
|
|
1414
|
+
if (tokenIdRange.min) {
|
|
1415
|
+
filters.push("info/ordinal:gt:".concat(parseInt(tokenIdRange.min) - 1));
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
if (tokenIdRange.max) {
|
|
1419
|
+
filters.push("info/ordinal:lt:".concat(parseInt(tokenIdRange.max) + 1));
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
if (capLimit) {
|
|
1424
|
+
filters.push("info/cap:lt:".concat(parseInt(capLimit) + 1));
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1407
1427
|
_context16.t0 = mode;
|
|
1408
|
-
_context16.next = _context16.t0 === "owned" ?
|
|
1428
|
+
_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;
|
|
1409
1429
|
break;
|
|
1410
1430
|
|
|
1411
|
-
case
|
|
1431
|
+
case 26:
|
|
1412
1432
|
path = UrlJoin("as", "wlt", "nfts");
|
|
1413
1433
|
|
|
1414
1434
|
if (marketplaceInfo) {
|
|
1415
1435
|
path = UrlJoin("as", "wlt", "nfts", marketplaceInfo.tenantId);
|
|
1416
1436
|
}
|
|
1417
1437
|
|
|
1418
|
-
return _context16.abrupt("break",
|
|
1438
|
+
return _context16.abrupt("break", 42);
|
|
1419
1439
|
|
|
1420
|
-
case
|
|
1440
|
+
case 29:
|
|
1421
1441
|
path = UrlJoin("as", "mkt", "f");
|
|
1422
|
-
return _context16.abrupt("break",
|
|
1442
|
+
return _context16.abrupt("break", 42);
|
|
1423
1443
|
|
|
1424
|
-
case
|
|
1444
|
+
case 31:
|
|
1425
1445
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1426
|
-
|
|
1446
|
+
filters.push("action:eq:TRANSFERRED");
|
|
1447
|
+
filters.push("action:eq:SOLD");
|
|
1448
|
+
return _context16.abrupt("break", 42);
|
|
1427
1449
|
|
|
1428
|
-
case
|
|
1450
|
+
case 35:
|
|
1429
1451
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1430
1452
|
filters.push("action:eq:SOLD");
|
|
1431
|
-
return _context16.abrupt("break",
|
|
1453
|
+
return _context16.abrupt("break", 42);
|
|
1432
1454
|
|
|
1433
|
-
case
|
|
1455
|
+
case 38:
|
|
1434
1456
|
path = UrlJoin("as", "mkt", "stats", "listed");
|
|
1435
|
-
return _context16.abrupt("break",
|
|
1457
|
+
return _context16.abrupt("break", 42);
|
|
1436
1458
|
|
|
1437
|
-
case
|
|
1459
|
+
case 40:
|
|
1438
1460
|
path = UrlJoin("as", "mkt", "stats", "sold");
|
|
1439
|
-
return _context16.abrupt("break",
|
|
1461
|
+
return _context16.abrupt("break", 42);
|
|
1440
1462
|
|
|
1441
|
-
case
|
|
1463
|
+
case 42:
|
|
1442
1464
|
if (filters.length > 0) {
|
|
1443
1465
|
params.filter = filters;
|
|
1444
1466
|
}
|
|
1445
1467
|
|
|
1446
1468
|
if (!mode.includes("stats")) {
|
|
1447
|
-
_context16.next =
|
|
1469
|
+
_context16.next = 47;
|
|
1448
1470
|
break;
|
|
1449
1471
|
}
|
|
1450
1472
|
|
|
1451
|
-
_context16.next =
|
|
1473
|
+
_context16.next = 46;
|
|
1452
1474
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1453
1475
|
path: path,
|
|
1454
1476
|
method: "GET",
|
|
1455
1477
|
queryParams: params
|
|
1456
1478
|
}));
|
|
1457
1479
|
|
|
1458
|
-
case
|
|
1480
|
+
case 46:
|
|
1459
1481
|
return _context16.abrupt("return", _context16.sent);
|
|
1460
1482
|
|
|
1461
|
-
case
|
|
1483
|
+
case 47:
|
|
1462
1484
|
_context16.t2 = Utils;
|
|
1463
|
-
_context16.next =
|
|
1485
|
+
_context16.next = 50;
|
|
1464
1486
|
return this.client.authClient.MakeAuthServiceRequest({
|
|
1465
1487
|
path: path,
|
|
1466
1488
|
method: "GET",
|
|
@@ -1470,22 +1492,22 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1470
1492
|
} : {}
|
|
1471
1493
|
});
|
|
1472
1494
|
|
|
1473
|
-
case
|
|
1495
|
+
case 50:
|
|
1474
1496
|
_context16.t3 = _context16.sent;
|
|
1475
|
-
_context16.next =
|
|
1497
|
+
_context16.next = 53;
|
|
1476
1498
|
return _context16.t2.ResponseToJson.call(_context16.t2, _context16.t3);
|
|
1477
1499
|
|
|
1478
|
-
case
|
|
1500
|
+
case 53:
|
|
1479
1501
|
_context16.t1 = _context16.sent;
|
|
1480
1502
|
|
|
1481
1503
|
if (_context16.t1) {
|
|
1482
|
-
_context16.next =
|
|
1504
|
+
_context16.next = 56;
|
|
1483
1505
|
break;
|
|
1484
1506
|
}
|
|
1485
1507
|
|
|
1486
1508
|
_context16.t1 = [];
|
|
1487
1509
|
|
|
1488
|
-
case
|
|
1510
|
+
case 56:
|
|
1489
1511
|
_ref16 = _context16.t1;
|
|
1490
1512
|
contents = _ref16.contents;
|
|
1491
1513
|
paging = _ref16.paging;
|
|
@@ -1501,12 +1523,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1501
1523
|
})
|
|
1502
1524
|
});
|
|
1503
1525
|
|
|
1504
|
-
case
|
|
1505
|
-
_context16.prev =
|
|
1526
|
+
case 62:
|
|
1527
|
+
_context16.prev = 62;
|
|
1506
1528
|
_context16.t4 = _context16["catch"](11);
|
|
1507
1529
|
|
|
1508
1530
|
if (!(_context16.t4.status && _context16.t4.status.toString() === "404")) {
|
|
1509
|
-
_context16.next =
|
|
1531
|
+
_context16.next = 66;
|
|
1510
1532
|
break;
|
|
1511
1533
|
}
|
|
1512
1534
|
|
|
@@ -1520,15 +1542,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1520
1542
|
results: []
|
|
1521
1543
|
});
|
|
1522
1544
|
|
|
1523
|
-
case
|
|
1545
|
+
case 66:
|
|
1524
1546
|
throw _context16.t4;
|
|
1525
1547
|
|
|
1526
|
-
case
|
|
1548
|
+
case 67:
|
|
1527
1549
|
case "end":
|
|
1528
1550
|
return _context16.stop();
|
|
1529
1551
|
}
|
|
1530
1552
|
}
|
|
1531
|
-
}, _callee16, this, [[11,
|
|
1553
|
+
}, _callee16, this, [[11, 62]]);
|
|
1532
1554
|
}));
|
|
1533
1555
|
|
|
1534
1556
|
function FilteredQuery() {
|
|
@@ -1689,7 +1711,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1689
1711
|
storeAuthToken: storeAuthToken
|
|
1690
1712
|
});
|
|
1691
1713
|
|
|
1692
|
-
if (!(
|
|
1714
|
+
if (!(inBrowser && window.location && window.location.href)) {
|
|
1693
1715
|
_context18.next = 31;
|
|
1694
1716
|
break;
|
|
1695
1717
|
}
|
package/package.json
CHANGED
package/src/ElvClient.js
CHANGED
|
@@ -601,11 +601,12 @@ class ElvClient {
|
|
|
601
601
|
* @param {string=} authToken - Eluvio authorization token previously issued from OAuth ID token
|
|
602
602
|
* @param {string=} tenantId - If specified, user will be associated with the tenant
|
|
603
603
|
* @param {Object=} extraData - Additional data to pass to the login API
|
|
604
|
+
* @param {Array<string>=} signerURIs - (Only if using custom OAuth) - URIs corresponding to the key server(s) to use
|
|
604
605
|
* @param {boolean=} unsignedPublicAuth=false - If specified, the client will use an unsigned static token for calls that don't require authorization (reduces remote signature calls)
|
|
605
606
|
*/
|
|
606
|
-
async SetRemoteSigner({idToken, authToken, tenantId, extraData, unsignedPublicAuth}) {
|
|
607
|
+
async SetRemoteSigner({idToken, authToken, tenantId, extraData, signerURIs, unsignedPublicAuth}) {
|
|
607
608
|
const signer = new RemoteSigner({
|
|
608
|
-
|
|
609
|
+
signerURIs: signerURIs || this.authServiceURIs,
|
|
609
610
|
idToken,
|
|
610
611
|
authToken,
|
|
611
612
|
tenantId,
|
package/src/RemoteSigner.js
CHANGED
|
@@ -5,7 +5,7 @@ const UrlJoin = require("url-join");
|
|
|
5
5
|
|
|
6
6
|
class RemoteSigner extends Ethers.Signer {
|
|
7
7
|
constructor({
|
|
8
|
-
|
|
8
|
+
signerURIs,
|
|
9
9
|
idToken,
|
|
10
10
|
authToken,
|
|
11
11
|
tenantId,
|
|
@@ -18,7 +18,7 @@ class RemoteSigner extends Ethers.Signer {
|
|
|
18
18
|
this.remoteSigner = true;
|
|
19
19
|
this.unsignedPublicAuth = unsignedPublicAuth;
|
|
20
20
|
|
|
21
|
-
this.HttpClient = new HttpClient({uris:
|
|
21
|
+
this.HttpClient = new HttpClient({uris: signerURIs});
|
|
22
22
|
this.idToken = idToken;
|
|
23
23
|
this.tenantId = tenantId;
|
|
24
24
|
|