@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.
@@ -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.
@@ -926,6 +927,35 @@ exports.ListingAttributes = async function({marketplaceParams, displayName}={})
926
927
  );
927
928
  };
928
929
 
930
+ /* PURCHASE / CLAIM */
931
+
932
+ /**
933
+ * Claim the specified item from the specified marketplace
934
+ *
935
+ * Use the <a href="#.ClaimStatus">ClaimStatus</a> method to check minting status after claiming
936
+ *
937
+ * @methodGroup Purchase
938
+ * @namedParams
939
+ * @param {Object} marketplaceParams - Parameters of the marketplace
940
+ * @param {string} sku - The SKU of the item to claime
941
+ */
942
+ exports.ClaimItem = async function({marketplaceParams, sku}) {
943
+ const marketplaceInfo = await this.MarketplaceInfo({marketplaceParams});
944
+
945
+ await this.client.authClient.MakeAuthServiceRequest({
946
+ method: "POST",
947
+ path: UrlJoin("as", "wlt", "act", marketplaceInfo.tenant_id),
948
+ body: {
949
+ op: "nft-claim",
950
+ sid: marketplaceInfo.marketplaceId,
951
+ sku
952
+ },
953
+ headers: {
954
+ Authorization: `Bearer ${this.AuthToken()}`
955
+ }
956
+ });
957
+ };
958
+
929
959
  /* MINTING STATUS */
930
960
 
931
961
  /**
@@ -6,6 +6,7 @@ const Utils = require("../Utils");
6
6
  const Ethers = require("ethers");
7
7
 
8
8
  const inBrowser = typeof window !== "undefined";
9
+ const embedded = inBrowser && window.top !== window.self;
9
10
 
10
11
  /**
11
12
  * Use the <a href="#.Initialize">Initialize</a> method to initialize a new client.
@@ -39,7 +40,7 @@ class ElvWalletClient {
39
40
  this.utils = client.utils;
40
41
  }
41
42
 
42
- Log(message, error=false) {
43
+ Log(message, error=false, errorObject) {
43
44
  if(error) {
44
45
  // eslint-disable-next-line no-console
45
46
  console.error("Eluvio Wallet Client:", message);
@@ -47,6 +48,11 @@ class ElvWalletClient {
47
48
  // eslint-disable-next-line no-console
48
49
  console.log("Eluvio Wallet Client:", message);
49
50
  }
51
+
52
+ if(errorObject) {
53
+ // eslint-disable-next-line no-console
54
+ console.error(errorObject);
55
+ }
50
56
  }
51
57
 
52
58
  /**
@@ -130,8 +136,7 @@ class ElvWalletClient {
130
136
  CanSign() {
131
137
  if(!this.loggedIn) { return false; }
132
138
 
133
- return !!this.__authorization.clusterToken ||
134
- (inBrowser && !!(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));
135
140
  }
136
141
 
137
142
  /**
@@ -182,6 +187,11 @@ class ElvWalletClient {
182
187
  url.hash = UrlJoin("/action", "sign", Utils.B58(JSON.stringify(parameters)));
183
188
  url.searchParams.set("origin", window.location.origin);
184
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
+
185
195
  return await new Promise(async (resolve, reject) => {
186
196
  await ActionPopup({
187
197
  mode: "tab",
@@ -339,7 +349,7 @@ class ElvWalletClient {
339
349
 
340
350
  this.client.SetStaticToken({token: decodedToken.fabricToken});
341
351
 
342
- return this.SetAuthorization(decodedToken);
352
+ return this.SetAuthorization({...decodedToken});
343
353
  }
344
354
 
345
355
  /**
@@ -396,7 +406,8 @@ class ElvWalletClient {
396
406
  expiresAt,
397
407
  signerURIs,
398
408
  walletType: "Custodial",
399
- walletName: "Eluvio"
409
+ walletName: "Eluvio",
410
+ register: true
400
411
  }),
401
412
  signingToken: this.SetAuthorization({
402
413
  clusterToken: this.client.signer.authToken,
@@ -444,7 +455,7 @@ class ElvWalletClient {
444
455
  addEthereumPrefix: false
445
456
  });
446
457
 
447
- return this.SetAuthorization({fabricToken, address, expiresAt, walletType: "External", walletName});
458
+ return this.SetAuthorization({fabricToken, address, expiresAt, walletType: "External", walletName, register: true});
448
459
  }
449
460
 
450
461
  /**
@@ -468,7 +479,7 @@ class ElvWalletClient {
468
479
  return this.__authorization.fabricToken;
469
480
  }
470
481
 
471
- SetAuthorization({clusterToken, fabricToken, tenantId, address, email, expiresAt, signerURIs, walletType, walletName}) {
482
+ SetAuthorization({clusterToken, fabricToken, tenantId, address, email, expiresAt, signerURIs, walletType, walletName, register=false}) {
472
483
  address = this.client.utils.FormatAddress(address);
473
484
 
474
485
  this.__authorization = {
@@ -502,6 +513,19 @@ class ElvWalletClient {
502
513
  } catch(error) {}
503
514
  }
504
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
+
505
529
  return token;
506
530
  }
507
531
 
@@ -524,7 +548,6 @@ class ElvWalletClient {
524
548
  }
525
549
 
526
550
 
527
-
528
551
  // Internal loading methods
529
552
 
530
553
 
@@ -597,8 +620,7 @@ class ElvWalletClient {
597
620
  }
598
621
  });
599
622
  } catch(error) {
600
- this.Log(`Eluvio Wallet Client: Failed to load tenant info ${tenantSlug}`, true);
601
- this.Log(error, true);
623
+ this.Log(`Eluvio Wallet Client: Failed to load tenant info ${tenantSlug}`, true, error);
602
624
  }
603
625
  });
604
626
 
@@ -710,20 +732,23 @@ class ElvWalletClient {
710
732
  sortBy="created",
711
733
  sortDesc=false,
712
734
  filter,
713
- editionFilter,
735
+ editionFilters,
714
736
  attributeFilters,
715
737
  contractAddress,
716
738
  tokenId,
717
739
  currency,
718
740
  marketplaceParams,
719
741
  tenantId,
720
- collectionIndex=-1,
742
+ collectionIndexes,
743
+ priceRange,
744
+ tokenIdRange,
745
+ capLimit,
721
746
  sellerAddress,
722
747
  lastNDays=-1,
723
748
  start=0,
724
749
  limit=50
725
750
  }={}) {
726
- collectionIndex = parseInt(collectionIndex);
751
+ collectionIndexes = (collectionIndexes || []).map(i => parseInt(i));
727
752
 
728
753
  let params = {
729
754
  sort_by: sortBy,
@@ -736,7 +761,7 @@ class ElvWalletClient {
736
761
  if(marketplaceParams) {
737
762
  marketplaceInfo = await this.MarketplaceInfo({marketplaceParams});
738
763
 
739
- if(collectionIndex >= 0) {
764
+ if(collectionIndexes.length > 0) {
740
765
  marketplace = await this.Marketplace({marketplaceParams});
741
766
  }
742
767
  }
@@ -748,41 +773,30 @@ class ElvWalletClient {
748
773
  filters.push(`seller:eq:${this.client.utils.FormatAddress(sellerAddress)}`);
749
774
  }
750
775
 
751
- if(marketplace && collectionIndex >= 0) {
752
- const collection = marketplace.collections[collectionIndex];
776
+ if(marketplace && collectionIndexes.length >= 0) {
777
+ collectionIndexes.forEach(collectionIndex => {
778
+ const collection = marketplace.collections[collectionIndex];
753
779
 
754
- collection.items.forEach(sku => {
755
- if(!sku) { return; }
780
+ collection.items.forEach(sku => {
781
+ if(!sku) {
782
+ return;
783
+ }
756
784
 
757
- const item = marketplace.items.find(item => item.sku === sku);
785
+ const item = marketplace.items.find(item => item.sku === sku);
758
786
 
759
- if(!item) { return; }
787
+ if(!item) {
788
+ return;
789
+ }
760
790
 
761
- const address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
791
+ const address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
762
792
 
763
- if(address) {
764
- filters.push(
765
- `${mode === "owned" ? "contract_addr": "contract"}:eq:${Utils.FormatAddress(address)}`
766
- );
767
- }
793
+ if(address) {
794
+ filters.push(
795
+ `${mode === "owned" ? "contract_addr" : "contract"}:eq:${Utils.FormatAddress(address)}`
796
+ );
797
+ }
798
+ });
768
799
  });
769
-
770
- // No valid items, so there must not be anything relevant in the collection
771
- if(filters.length === 0) {
772
- if(mode.includes("stats")) {
773
- return {};
774
- } else {
775
- return {
776
- paging: {
777
- start: params.start,
778
- limit: params.limit,
779
- total: 0,
780
- more: false
781
- },
782
- results: []
783
- };
784
- }
785
- }
786
800
  } else if(mode !== "owned" && marketplaceInfo || tenantId) {
787
801
  filters.push(`tenant:eq:${marketplaceInfo ? marketplaceInfo.tenantId : tenantId}`);
788
802
  }
@@ -808,15 +822,17 @@ class ElvWalletClient {
808
822
  }
809
823
  }
810
824
 
811
- if(editionFilter) {
812
- if(mode.includes("listing")) {
813
- filters.push(`nft/edition_name:eq:${editionFilter}`);
814
- } else if(mode === "owned") {
815
- filters.push(`meta:@>:{"edition_name":"${editionFilter}"}`);
816
- params.exact = false;
817
- } else {
818
- filters.push(`edition:eq:${editionFilter}`);
819
- }
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
+ });
820
836
  }
821
837
 
822
838
  if(attributeFilters) {
@@ -835,6 +851,31 @@ class ElvWalletClient {
835
851
  filters.push(`created:gt:${((Date.now() / 1000) - ( lastNDays * 24 * 60 * 60 )).toFixed(0)}`);
836
852
  }
837
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
+
838
879
  let path;
839
880
  switch(mode) {
840
881
  case "owned":
@@ -977,8 +1018,7 @@ class ElvWalletClient {
977
1018
  })
978
1019
  .sort((a, b) => a.ts < b.ts ? 1 : -1);
979
1020
  } catch(error) {
980
- this.Log("Failed to retrieve minting status", true);
981
- this.Log(error);
1021
+ this.Log("Failed to retrieve minting status", true, error);
982
1022
 
983
1023
  return [];
984
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-yliF9BCoRZQi3Zgm80L6T3imO0XT8J3abTJpBJ9PtoW5cADPKEXz5GAENkjjay3YUyC4ZX_3u0ZdaNTOd8JAL6wKQRI3lBfJS_77MkTk8ea2JDCX4MJjYCIVOpIo_YVNOmx9cQEPSZiQ5.ZPc2LOM-vuHeZBrETCCOaA";
21
+ //const idToken = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Inlwd1ZUbXJkWENkYU5tcjAzVGRDaCJ9.eyJodHRwczovL2F1dGguY29udGVudGZhYnJpYy5pby9nZW8iOnsiY291bnRyeV9jb2RlIjoiVVMiLCJjb3VudH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
+ 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.eyJodHRwczovL2F1dGguY29udGVudGZhYnJpYy5pby9nZW8iOnsiY291bnRyeV9jb2RlIjoiVVMiLCJjb3VudHJ5X2NvZGUzIjoiVVNBIiwiY291bnRyeV9uYW1lIjoiVW5pdGVkIFN0YXRlcyIsImNpdHlfbmFtZSI6IlJhbmNobyBDb3Jkb3ZhIiwibGF0aXR1ZGUiOjM4LjYxMDYsImxvbmdpdHVkZSI6LTEyMS4yNzg5LCJ0aW1lX3pvbmUiOiJBbWVyaWNhL0xvc19BbmdlbGVzIiwiY29udGluZW50X2NvZGUiOiJOQSIsInN1YmRpdmlzaW9uX2NvZGUiOiJDQSIsInN1YmRpdmlzaW9uX25hbWUiOiJDYWxpZm9ybmlhIn0sIm5pY2tuYW1lIjoia2V2aW4rNyIsIm5hbWUiOiJrZXZpbis3QGVsdXYuaW8iLCJwaWN0dXJlIjoiaHR0cHM6Ly9zLmdyYXZhdGFyLmNvbS9hdmF0YXIvZmQ0MzE3ZjhmN2YzMGM1NWRlMDZhMjljYTFjYjY5ZjE_cz00ODAmcj1wZyZkPWh0dHBzJTNBJTJGJTJGY2RuLmF1dGgwLmNvbSUyRmF2YXRhcnMlMkZrZS5wbmciLCJ1cGRhdGVkX2F0IjoiMjAyMi0wNi0xN1QxOTo1Nzo0NC4yODZaIiwiZW1haWwiOiJrZXZpbis3QGVsdXYuaW8iLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsImlzcyI6Imh0dHBzOi8vYXV0aC5jb250ZW50ZmFicmljLmlvLyIsInN1YiI6ImF1dGgwfDYxNjY3NzE3ODk5YjkyMDA3MGYzNGFjNCIsImF1ZCI6Ik9OeXViUDlyRkk1Qkh6bVlnbFFLQloxYkJiaXlvQjNTIiwiaWF0IjoxNjU1NDk1ODY1LCJleHAiOjE2NTU1MzE4NjUsIm5vbmNlIjoiY0c4MlFrTkplV2wwU1U1RVVrOUpaR1kwTW1oRlZXaFpOSE5LVGxZNU5VWjJjRmwwWkhwVmIxQjJNQT09In0.dPBk0hGjHAW5Dz8yfhW0IEG-ArJ258Q7x3dYMz0tIIj9EUY438issp0rJwfoAVWu4hw6SBUGNS2bnAZ9bvhag8IMZm_YYRfKTnY7gV7ST_-ni72mQ04F2Kpc9H2jzNKwRWqdKdXy3Rp0YoIR1PYOTwk2BWJtiqoyA11og-QNiI4pBEhZ6JRyDO7693jPoGXdUPJpXPHsfEJqLbGM8BYcv5X-PwVnU8TzSqgFpB5G4pZSfnoyz26wbmpFs5jc2_QgWAIvc94pW-cwpMbfpHb10LejrBFbO9FW3Sv6eOPY9W-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();