@eluvio/elv-client-js 3.2.10 → 3.2.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.2.10",
3
+ "version": "3.2.13",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
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
- rpcUris: this.authServiceURIs,
609
+ signerURIs: signerURIs || this.authServiceURIs,
609
610
  idToken,
610
611
  authToken,
611
612
  tenantId,
@@ -5,7 +5,7 @@ const UrlJoin = require("url-join");
5
5
 
6
6
  class RemoteSigner extends Ethers.Signer {
7
7
  constructor({
8
- rpcUris,
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: rpcUris});
21
+ this.HttpClient = new HttpClient({uris: signerURIs});
22
22
  this.idToken = idToken;
23
23
  this.tenantId = tenantId;
24
24
 
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const {ElvClient} = require("./ElvClient.js");
2
- const {ElvMarketplaceClient} = require("./walletClient/index.js");
2
+ const {ElvWalletClient} = require("./walletClient/index.js");
3
3
  const Utils = require("./Utils.js");
4
4
 
5
5
  exports.ElvClient = ElvClient;
6
- exports.ElvMarketplaceClient = ElvMarketplaceClient;
6
+ exports.ElvWalletClient = ElvWalletClient;
7
7
  exports.Utils = Utils;
@@ -195,7 +195,7 @@ exports.UserItemInfo = async function ({userAddress}={}) {
195
195
  * @param {string=} contractAddress - Filter results by the address of the NFT contract
196
196
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
197
197
  * @param {Object=} marketplaceParams - Filter results by marketplace
198
- * @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
198
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
199
199
  *
200
200
  * @returns {Promise<Object>} - Results of the query and pagination info
201
201
  */
@@ -317,8 +317,7 @@ exports.TenantConfiguration = async function({tenantId, contractAddress}) {
317
317
  })
318
318
  );
319
319
  } catch(error) {
320
- this.Log("Failed to load tenant configuration", true);
321
- this.Log(error, true);
320
+ this.Log("Failed to load tenant configuration", true, error);
322
321
 
323
322
  return {};
324
323
  }
@@ -604,7 +603,7 @@ exports.Listing = async function({listingId}) {
604
603
  * <br /><br />
605
604
  * NOTE: This string must be an <b>exact match</b> on the item name.
606
605
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
607
- * @param {string=} editionFilter - Filter results by item edition.
606
+ * @param {Array<string>=} editionFilters - Filter results by item edition.
608
607
  * <br /><br />
609
608
  * NOTE: This string must be an <b>exact match</b> on the edition name.
610
609
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -612,12 +611,13 @@ exports.Listing = async function({listingId}) {
612
611
  * <br /><br />
613
612
  * NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
614
613
  * You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
614
+ * @param {Object=} priceRange - Filter min and/or max price (e.g. `{min: 1}` `{max: 2}` `{min: 1.50, max: 10.50})
615
615
  * @param {string=} sellerAddress - Filter by a specific seller
616
616
  * @param {string=} contractAddress - Filter results by the address of the NFT contract
617
617
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
618
618
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
619
619
  * @param {Object=} marketplaceParams - Filter results by marketplace
620
- * @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
620
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
621
621
  * @param {integer=} lastNDays - Filter by results listed in the past N days
622
622
  *
623
623
  * @returns {Promise<Object>} - Results of the query and pagination info
@@ -639,7 +639,7 @@ exports.Listings = async function() {
639
639
  * <br /><br />
640
640
  * NOTE: This string must be an <b>exact match</b> on the item name.
641
641
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
642
- * @param {string=} editionFilter - Filter results by item edition.
642
+ * @param {Array<string>} editionFilters - Filter results by item edition.
643
643
  * <br /><br />
644
644
  * NOTE: This string must be an <b>exact match</b> on the edition name.
645
645
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -647,12 +647,13 @@ exports.Listings = async function() {
647
647
  * <br /><br />
648
648
  * NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
649
649
  * You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
650
+ * @param {Object=} priceRange - Filter min and/or max price (e.g. `{min: 1}` `{max: 2}` `{min: 1.50, max: 10.50})
650
651
  * @param {string=} sellerAddress - Filter by a specific seller
651
652
  * @param {string=} contractAddress - Filter results by the address of the NFT contract
652
653
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
653
654
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
654
655
  * @param {Object=} marketplaceParams - Filter results by marketplace
655
- * @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
656
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
656
657
  * @param {integer=} lastNDays - Filter by results listed in the past N days
657
658
  *
658
659
  * @returns {Promise<Object>} - Statistics about listings. All prices in USD.
@@ -674,7 +675,7 @@ exports.ListingStats = async function() {
674
675
  * <br /><br />
675
676
  * NOTE: This string must be an <b>exact match</b> on the item name.
676
677
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
677
- * @param {string=} editionFilter - Filter results by item edition.
678
+ * @param {Array<string>} editionFilters - Filter results by item edition.
678
679
  * <br /><br />
679
680
  * NOTE: This string must be an <b>exact match</b> on the edition name.
680
681
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -687,7 +688,7 @@ exports.ListingStats = async function() {
687
688
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
688
689
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
689
690
  * @param {Object=} marketplaceParams - Filter results by marketplace
690
- * @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
691
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
691
692
  * @param {integer=} lastNDays - Filter by results listed in the past N days
692
693
  *
693
694
  * @returns {Promise<Object>} - Results of the query and pagination info
@@ -709,7 +710,7 @@ exports.Sales = async function() {
709
710
  * <br /><br />
710
711
  * NOTE: This string must be an <b>exact match</b> on the item name.
711
712
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
712
- * @param {string=} editionFilter - Filter results by item edition.
713
+ * @param {Array<string>} editionFilters - Filter results by item edition.
713
714
  * <br /><br />
714
715
  * NOTE: This string must be an <b>exact match</b> on the edition name.
715
716
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -722,7 +723,7 @@ exports.Sales = async function() {
722
723
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
723
724
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
724
725
  * @param {Object=} marketplaceParams - Filter results by marketplace
725
- * @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
726
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
726
727
  * @param {integer=} lastNDays - Filter by results listed in the past N days
727
728
  *
728
729
  * @returns {Promise<Object>} - Results of the query and pagination info
@@ -744,7 +745,7 @@ exports.Transfers = async function() {
744
745
  * <br /><br />
745
746
  * NOTE: This string must be an <b>exact match</b> on the item name.
746
747
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
747
- * @param {string=} editionFilter - Filter results by item edition.
748
+ * @param {Array<string>} editionFilters - Filter results by item edition.
748
749
  * <br /><br />
749
750
  * NOTE: This string must be an <b>exact match</b> on the edition name.
750
751
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -757,7 +758,7 @@ exports.Transfers = async function() {
757
758
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
758
759
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
759
760
  * @param {Object=} marketplaceParams - Filter results by marketplace
760
- * @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
761
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
761
762
  * @param {integer=} lastNDays - Filter by results listed in the past N days
762
763
  *
763
764
  * @returns {Promise<Object>} - Statistics about sales. All prices in USD.
@@ -5,6 +5,8 @@ const UrlJoin = require("url-join");
5
5
  const Utils = require("../Utils");
6
6
  const Ethers = require("ethers");
7
7
 
8
+ const inBrowser = typeof window !== "undefined";
9
+ const embedded = inBrowser && window.top !== window.self;
8
10
 
9
11
  /**
10
12
  * Use the <a href="#.Initialize">Initialize</a> method to initialize a new client.
@@ -38,7 +40,7 @@ class ElvWalletClient {
38
40
  this.utils = client.utils;
39
41
  }
40
42
 
41
- Log(message, error=false) {
43
+ Log(message, error=false, errorObject) {
42
44
  if(error) {
43
45
  // eslint-disable-next-line no-console
44
46
  console.error("Eluvio Wallet Client:", message);
@@ -46,6 +48,11 @@ class ElvWalletClient {
46
48
  // eslint-disable-next-line no-console
47
49
  console.log("Eluvio Wallet Client:", message);
48
50
  }
51
+
52
+ if(errorObject) {
53
+ // eslint-disable-next-line no-console
54
+ console.error(errorObject);
55
+ }
49
56
  }
50
57
 
51
58
  /**
@@ -91,7 +98,7 @@ class ElvWalletClient {
91
98
  storeAuthToken
92
99
  });
93
100
 
94
- if(window && window.location && window.location.href) {
101
+ if(inBrowser && window.location && window.location.href) {
95
102
  let url = new URL(window.location.href);
96
103
  if(url.searchParams.get("elvToken")) {
97
104
  await walletClient.Authenticate({token: url.searchParams.get("elvToken")});
@@ -129,8 +136,7 @@ class ElvWalletClient {
129
136
  CanSign() {
130
137
  if(!this.loggedIn) { return false; }
131
138
 
132
- return !!this.__authorization.clusterToken ||
133
- !!(this.UserInfo().walletName.toLowerCase() === "metamask" && window.ethereum && window.ethereum.isMetaMask && window.ethereum.chainId);
139
+ return !!this.__authorization.clusterToken || (inBrowser && !!(this.UserInfo().walletName.toLowerCase() === "metamask" && window.ethereum && window.ethereum.isMetaMask && window.ethereum.chainId));
134
140
  }
135
141
 
136
142
  /**
@@ -167,6 +173,8 @@ class ElvWalletClient {
167
173
  } else {
168
174
  throw Error("ElvWalletClient: Unable to sign");
169
175
  }
176
+ } else if(!inBrowser) {
177
+ throw Error("ElvWalletClient: Unable to sign");
170
178
  }
171
179
 
172
180
  const parameters = {
@@ -179,6 +187,11 @@ class ElvWalletClient {
179
187
  url.hash = UrlJoin("/action", "sign", Utils.B58(JSON.stringify(parameters)));
180
188
  url.searchParams.set("origin", window.location.origin);
181
189
 
190
+ if(!embedded && window.location.origin === url.origin) {
191
+ // Already in wallet app, but still can't sign
192
+ throw Error("ElvWalletClient: Unable to sign");
193
+ }
194
+
182
195
  return await new Promise(async (resolve, reject) => {
183
196
  await ActionPopup({
184
197
  mode: "tab",
@@ -331,12 +344,12 @@ class ElvWalletClient {
331
344
  }
332
345
 
333
346
  if(decodedToken.clusterToken) {
334
- await this.client.SetRemoteSigner({authToken: decodedToken.clusterToken});
347
+ await this.client.SetRemoteSigner({authToken: decodedToken.clusterToken, signerURIs: decodedToken.signerURIs});
335
348
  }
336
349
 
337
350
  this.client.SetStaticToken({token: decodedToken.fabricToken});
338
351
 
339
- return this.SetAuthorization(decodedToken);
352
+ return this.SetAuthorization({...decodedToken});
340
353
  }
341
354
 
342
355
  /**
@@ -347,8 +360,8 @@ class ElvWalletClient {
347
360
  * @param {string} idToken - An OAuth ID token
348
361
  * @param {string=} tenantId - ID of tenant with which to associate the user. If marketplace info was set upon initialization, this will be determined automatically.
349
362
  * @param {string=} email - Email address of the user. If not specified, this method will attempt to extract the email from the ID token.
363
+ * @param {Array<string>=} signerURIs - (Only if using custom OAuth) - URIs corresponding to the key server(s) to use
350
364
  * @param {boolean=} shareEmail=false - Whether or not the user consents to sharing their email
351
- * @param {number=} tokenDuration=24 - Number of hours the generated authorization token will last before expiring
352
365
  *
353
366
  * @returns {Promise<Object>} - Returns an authorization tokens that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
354
367
  * Save this token to avoid having to reauthenticate with OAuth. This token expires after 24 hours.
@@ -358,14 +371,16 @@ class ElvWalletClient {
358
371
  * - signingToken - Identical to `authToken`, but also includes the ability to perform arbitrary signatures with the custodial wallet. This token should be protected and should not be
359
372
  * shared with third parties.
360
373
  */
361
- async AuthenticateOAuth({idToken, tenantId, email, shareEmail=false, tokenDuration=24}) {
374
+ async AuthenticateOAuth({idToken, tenantId, email, signerURIs, shareEmail=false}) {
375
+ let tokenDuration = 24;
376
+
362
377
  if(!tenantId && this.selectedMarketplaceInfo) {
363
378
  // Load tenant ID automatically from selected marketplace
364
379
  await this.AvailableMarketplaces();
365
380
  tenantId = this.selectedMarketplaceInfo.tenantId;
366
381
  }
367
382
 
368
- await this.client.SetRemoteSigner({idToken, tenantId, extraData: { share_email: shareEmail }, unsignedPublicAuth: true});
383
+ await this.client.SetRemoteSigner({idToken, tenantId, signerURIs, extraData: { share_email: shareEmail }, unsignedPublicAuth: true});
369
384
 
370
385
  const expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
371
386
  const fabricToken = await this.client.CreateFabricToken({duration: tokenDuration * 60 * 60 * 1000});
@@ -389,8 +404,10 @@ class ElvWalletClient {
389
404
  address,
390
405
  email,
391
406
  expiresAt,
407
+ signerURIs,
392
408
  walletType: "Custodial",
393
- walletName: "Eluvio"
409
+ walletName: "Eluvio",
410
+ register: true
394
411
  }),
395
412
  signingToken: this.SetAuthorization({
396
413
  clusterToken: this.client.signer.authToken,
@@ -399,6 +416,7 @@ class ElvWalletClient {
399
416
  address,
400
417
  email,
401
418
  expiresAt,
419
+ signerURIs,
402
420
  walletType: "Custodial",
403
421
  walletName: "Eluvio"
404
422
  })
@@ -437,7 +455,7 @@ class ElvWalletClient {
437
455
  addEthereumPrefix: false
438
456
  });
439
457
 
440
- return this.SetAuthorization({fabricToken, address, expiresAt, walletType: "External", walletName});
458
+ return this.SetAuthorization({fabricToken, address, expiresAt, walletType: "External", walletName, register: true});
441
459
  }
442
460
 
443
461
  /**
@@ -461,7 +479,7 @@ class ElvWalletClient {
461
479
  return this.__authorization.fabricToken;
462
480
  }
463
481
 
464
- SetAuthorization({clusterToken, fabricToken, tenantId, address, email, expiresAt, walletType, walletName}) {
482
+ SetAuthorization({clusterToken, fabricToken, tenantId, address, email, expiresAt, signerURIs, walletType, walletName, register=false}) {
465
483
  address = this.client.utils.FormatAddress(address);
466
484
 
467
485
  this.__authorization = {
@@ -476,6 +494,10 @@ class ElvWalletClient {
476
494
 
477
495
  if(clusterToken) {
478
496
  this.__authorization.clusterToken = clusterToken;
497
+
498
+ if(signerURIs) {
499
+ this.__authorization.signerURIs = signerURIs;
500
+ }
479
501
  }
480
502
 
481
503
  this.loggedIn = true;
@@ -491,11 +513,24 @@ class ElvWalletClient {
491
513
  } catch(error) {}
492
514
  }
493
515
 
516
+ if(register) {
517
+ this.client.authClient.MakeAuthServiceRequest({
518
+ path: "/as/wlt/register",
519
+ method: "POST",
520
+ headers: {
521
+ Authorization: `Bearer ${this.AuthToken()}`
522
+ }
523
+ })
524
+ .catch(error => {
525
+ this.Log("Failed to register account: ", true, error);
526
+ });
527
+ }
528
+
494
529
  return token;
495
530
  }
496
531
 
497
532
  async SignMetamask({message, address}) {
498
- if(!window.ethereum) {
533
+ if(!inBrowser || !window.ethereum) {
499
534
  throw Error("ElvWalletClient: Unable to initialize - Metamask not available");
500
535
  }
501
536
 
@@ -513,7 +548,6 @@ class ElvWalletClient {
513
548
  }
514
549
 
515
550
 
516
-
517
551
  // Internal loading methods
518
552
 
519
553
 
@@ -586,8 +620,7 @@ class ElvWalletClient {
586
620
  }
587
621
  });
588
622
  } catch(error) {
589
- this.Log(`Eluvio Wallet Client: Failed to load tenant info ${tenantSlug}`, true);
590
- this.Log(error, true);
623
+ this.Log(`Eluvio Wallet Client: Failed to load tenant info ${tenantSlug}`, true, error);
591
624
  }
592
625
  });
593
626
 
@@ -699,20 +732,23 @@ class ElvWalletClient {
699
732
  sortBy="created",
700
733
  sortDesc=false,
701
734
  filter,
702
- editionFilter,
735
+ editionFilters,
703
736
  attributeFilters,
704
737
  contractAddress,
705
738
  tokenId,
706
739
  currency,
707
740
  marketplaceParams,
708
741
  tenantId,
709
- collectionIndex=-1,
742
+ collectionIndexes,
743
+ priceRange,
744
+ tokenIdRange,
745
+ capLimit,
710
746
  sellerAddress,
711
747
  lastNDays=-1,
712
748
  start=0,
713
749
  limit=50
714
750
  }={}) {
715
- collectionIndex = parseInt(collectionIndex);
751
+ collectionIndexes = (collectionIndexes || []).map(i => parseInt(i));
716
752
 
717
753
  let params = {
718
754
  sort_by: sortBy,
@@ -725,7 +761,7 @@ class ElvWalletClient {
725
761
  if(marketplaceParams) {
726
762
  marketplaceInfo = await this.MarketplaceInfo({marketplaceParams});
727
763
 
728
- if(collectionIndex >= 0) {
764
+ if(collectionIndexes.length > 0) {
729
765
  marketplace = await this.Marketplace({marketplaceParams});
730
766
  }
731
767
  }
@@ -737,41 +773,30 @@ class ElvWalletClient {
737
773
  filters.push(`seller:eq:${this.client.utils.FormatAddress(sellerAddress)}`);
738
774
  }
739
775
 
740
- if(marketplace && collectionIndex >= 0) {
741
- const collection = marketplace.collections[collectionIndex];
776
+ if(marketplace && collectionIndexes.length >= 0) {
777
+ collectionIndexes.forEach(collectionIndex => {
778
+ const collection = marketplace.collections[collectionIndex];
742
779
 
743
- collection.items.forEach(sku => {
744
- if(!sku) { return; }
780
+ collection.items.forEach(sku => {
781
+ if(!sku) {
782
+ return;
783
+ }
745
784
 
746
- const item = marketplace.items.find(item => item.sku === sku);
785
+ const item = marketplace.items.find(item => item.sku === sku);
747
786
 
748
- if(!item) { return; }
787
+ if(!item) {
788
+ return;
789
+ }
749
790
 
750
- const address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
791
+ const address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
751
792
 
752
- if(address) {
753
- filters.push(
754
- `${mode === "owned" ? "contract_addr": "contract"}:eq:${Utils.FormatAddress(address)}`
755
- );
756
- }
793
+ if(address) {
794
+ filters.push(
795
+ `${mode === "owned" ? "contract_addr" : "contract"}:eq:${Utils.FormatAddress(address)}`
796
+ );
797
+ }
798
+ });
757
799
  });
758
-
759
- // No valid items, so there must not be anything relevant in the collection
760
- if(filters.length === 0) {
761
- if(mode.includes("stats")) {
762
- return {};
763
- } else {
764
- return {
765
- paging: {
766
- start: params.start,
767
- limit: params.limit,
768
- total: 0,
769
- more: false
770
- },
771
- results: []
772
- };
773
- }
774
- }
775
800
  } else if(mode !== "owned" && marketplaceInfo || tenantId) {
776
801
  filters.push(`tenant:eq:${marketplaceInfo ? marketplaceInfo.tenantId : tenantId}`);
777
802
  }
@@ -797,15 +822,17 @@ class ElvWalletClient {
797
822
  }
798
823
  }
799
824
 
800
- if(editionFilter) {
801
- if(mode.includes("listing")) {
802
- filters.push(`nft/edition_name:eq:${editionFilter}`);
803
- } else if(mode === "owned") {
804
- filters.push(`meta:@>:{"edition_name":"${editionFilter}"}`);
805
- params.exact = false;
806
- } else {
807
- filters.push(`edition:eq:${editionFilter}`);
808
- }
825
+ if(editionFilters) {
826
+ editionFilters.forEach(editionFilter => {
827
+ if(mode.includes("listing")) {
828
+ filters.push(`nft/edition_name:eq:${editionFilter}`);
829
+ } else if(mode === "owned") {
830
+ filters.push(`meta:@>:{"edition_name":"${editionFilter}"}`);
831
+ params.exact = false;
832
+ } else {
833
+ filters.push(`edition:eq:${editionFilter}`);
834
+ }
835
+ });
809
836
  }
810
837
 
811
838
  if(attributeFilters) {
@@ -824,6 +851,31 @@ class ElvWalletClient {
824
851
  filters.push(`created:gt:${((Date.now() / 1000) - ( lastNDays * 24 * 60 * 60 )).toFixed(0)}`);
825
852
  }
826
853
 
854
+ if(priceRange) {
855
+ if(priceRange.min) {
856
+ filters.push(`price:ge:${parseFloat(priceRange.min)}`);
857
+ }
858
+
859
+ if(priceRange.max) {
860
+ filters.push(`price:le:${parseFloat(priceRange.max)}`);
861
+ }
862
+ }
863
+
864
+ if(tokenIdRange) {
865
+ if(tokenIdRange.min) {
866
+ filters.push(`info/token_id:ge:${parseInt(tokenIdRange.min)}`);
867
+ }
868
+
869
+ if(tokenIdRange.max) {
870
+ filters.push(`info/token_id:le:${parseInt(tokenIdRange.max)}`);
871
+ }
872
+ }
873
+
874
+ if(capLimit) {
875
+ filters.push(`info/cap:le:${parseInt(capLimit)}`);
876
+ }
877
+
878
+
827
879
  let path;
828
880
  switch(mode) {
829
881
  case "owned":
@@ -966,8 +1018,7 @@ class ElvWalletClient {
966
1018
  })
967
1019
  .sort((a, b) => a.ts < b.ts ? 1 : -1);
968
1020
  } catch(error) {
969
- this.Log("Failed to retrieve minting status", true);
970
- this.Log(error);
1021
+ this.Log("Failed to retrieve minting status", true, error);
971
1022
 
972
1023
  return [];
973
1024
  }
@@ -1,8 +1,10 @@
1
1
  const { ElvClient } = require("../src/ElvClient");
2
+ const { ElvWalletClient } = require("../src/walletClient/index");
2
3
  const ClientConfiguration = require("../TestConfiguration.json");
3
4
 
4
5
  const Test = async () => {
5
6
  try {
7
+ /*
6
8
  const client = await ElvClient.FromConfigurationUrl({
7
9
  configUrl: ClientConfiguration["config-url"]
8
10
  });
@@ -13,6 +15,37 @@ const Test = async () => {
13
15
  });
14
16
 
15
17
  client.SetSigner({signer});
18
+
19
+ */
20
+ //const idToken = "eyJraWQiOiJjcGltY29yZV8wOTI1MjAxNSIsInZlciI6IjEuMCIsInppcCI6IkRlZmxhdGUiLCJzZXIiOiIxLjAifQ..-hVeBqfPm9f0dsZ_.h7ECJlFBsX1y8rfAVanFXoper2YBRd_yH3HyJiyV5fZJ-GGxMJR8y7gP_YIWS1D-zps4fR2QkFZ1j7DZKHQwZH0kOkCq-OYyNvLDHulF-uIY1HW9U-yfpyPO2K6Ukr0QcUvGASB7RyqqVLhvDAxCBYTpm4vEHo9DQrVal--9YlkdGogeF6HLLfYoFFCGdjb5korzaQIKyWTP4LsDDTZXITcCjHaCR9GC8rNHOybLy58IbEjukvJzooKpaRxzp20OuKr96-TDApKpklpCDCgiCsCvnOj5-CxhI10rs4frsFKF4s4d2RAa93RLplzy2SLJkg9zRe6cyezp9APZYGRUHb2wjEK8YXH0-_Uus48OIfPJQIbA-BatMHZUMTUJ9ZnYRCIL2FrIRu3QcaBR1KL2DYOJLVC3uQvNwUYV0_Yxr4CgooP2e6wb0Y61d5qU_O649XjIXIqHn0slr9lcAufIrG1or5D9Gc-yliF9BCoRZQi3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erGrBVq_LtguLJAOjKO1jBClyJDOTMgI9y1wGb1zHdF2tCeN75wNwXCUUC5hn_TcemLOgp-haAEMC7KFFdR-4K_5A7IUUW9IqOQciE5DKNCKRDOKVNsDoMg7eV3VFp8QSeSCp7OGWL9FI1dWLmD6D_uoHfyYxE96LPrB-VCveCThQgsLMb6QE072S05w8ZM8CGxbLXcgKWG3VVaKT95e1e0NlDWQYlQQGFMBirUISpA3D82q3Wm4QlrANfGv49oypdnj-T4Uclu6pVnNwLvCIisj5w2GLobiyyyqMhEEsI1Q";
24
+
25
+ const client = await ElvWalletClient.Initialize({
26
+ network: "demo",
27
+ mode: "staging"
28
+ });
29
+
30
+ /*
31
+ console.log(
32
+ await client.AuthenticateOAuth({
33
+ idToken,
34
+ signerURIs: [
35
+ "https://wlt.stg.svc.eluv.io"
36
+ ]
37
+ })
38
+ );
39
+
40
+ */
41
+
42
+ await client.Authenticate({
43
+ token: "DYxK5cLMW5ofVh3pU23TmbAzkpFAsYrQQLsantU3uHFCJgyAjNoRHE7HvSCbQzZx1F33JM65R6oWZ1ZLYPEUhfA3WrnN9emo69A6AAKyFNBecKSFn3T6PP5MxMMPZRwN6AgwmuRgZMJQthF1xo7cMUqVwZCXtdHARYSrTHoRe3QMPggd6EJ6MzK7WHv2Sb7MPGGyVCR8uC4mK9SbncNm77Fj4H2LWxQpQggnF579GWv3SwAYiUBhbtgnfw6WEzyo1ZmBTV8vSkMiDAyBoMC138nokWNZc6DkpBNkyn6z3GwszoPsdXezKv7vANEVF6rrD3odbjosJpRoWbeEoPkebjoVySTgU8ywJybCDzeoFcg2XC1FQ4nyBhv5o3UVyXWispw3hN7oNs65vt9DaXmXwy45HzG3vL7PNdK8qviBg5XttCHUxkQ2aeYXTXcUzBYJ34PgDTXPBUwrj7a5FBa3gyC42eu48DAyxaFtV6GC5SXJCczTgQW6DPTrXiwzyEkBbVCoyDbMepaAA5MWH5WmpeWWzuexbHhKd3qW2ukWMHyjJpwAy1aUMZXGrAx3eGjTTmev342DqsV8ECHw9zPuzKv7MufkU7A9N9Wgi6jWoZXZvbMySxuRo81CV7XQZ6Zvcfy2xXFbtu5rgYA1xxhZaGZBioMUgT3HwEo1eqJuvs7r1QW3t1mMx9zbAJDTJtHFsYu4nkvyrDHQwDgKvQmnzSDhUs7yxeKeVKeFi2wy4QkXz56VJKxp3CtB9gM8qMLP3eUg1B3BRaNH8uPmy7qVYn3wn9epwPA2fDwR6MbunU5C4kx7rTbZmiQtKW4VUVP8iL6MvVy6Wx3NEXCeTmaSDz2BAfkrv7zFmC9ERyeqfrPvCYDyeTV2PHA6vVmdh5cXo6meJWKCD6jc5QAd6J7D1hJw6PWP8gyUQZGtZ6Xd9v82v3cP1L6njMWc4kpivB41mUF7Q86Zy8EoZ2xYhFrU3MoUuNPV3ApVKRqUmcL4cpKhbcSCgPi8QvnhUCjZGyEtxLwzCaRhXa"
44
+ })
45
+
46
+ console.log(
47
+ await client.PersonalSign({message: "test"})
48
+ )
16
49
  } catch(error) {
17
50
  console.error(error);
18
51
  console.error(JSON.stringify(error, null, 2));
@@ -1,25 +0,0 @@
1
- const { ElvMarketplaceClient } = require("../src/walletClient/ElvMarketplaceClient");
2
- const ClientConfiguration = require("../TestConfiguration.json");
3
-
4
- const Test = async () => {
5
- try {
6
- const idToken = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Inlwd1ZUbXJkWENkYU5tcjAzVGRDaCJ9.eyJodHRwczovL2F1dGguY29udGVudGZhYnJpYy5pby9nZW8iOnsiY291bnRyeV9jb2RlIjoiVVMiLCJjb3VudHJ5X2NvZGUzIjoiVVNBIiwiY291bnRyeV9uYW1lIjoiVW5pdGVkIFN0YXRlcyIsImNpdHlfbmFtZSI6IlJhbmNobyBDb3Jkb3ZhIiwibGF0aXR1ZGUiOjM4LjYxMDYsImxvbmdpdHVkZSI6LTEyMS4yNzg5LCJ0aW1lX3pvbmUiOiJBbWVyaWNhL0xvc19BbmdlbGVzIiwiY29udGluZW50X2N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W-AuxAj1UT-ZDJytNRD72R0aFKlv8r0fvOiTDWGXE4P5g";
7
-
8
- const marketplaceClient = await ElvMarketplaceClient.Initialize({
9
- configUrl: ClientConfiguration["config-url"]
10
- });
11
-
12
- const token = await marketplaceClient.AuthenticateOAuth({
13
- idToken
14
- });
15
-
16
- console.log(token);
17
- } catch(error) {
18
- console.error(error);
19
- console.error(JSON.stringify(error, null, 2));
20
- }
21
-
22
- process.exit(0);
23
- };
24
-
25
- Test();