@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.
@@ -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
  */
@@ -604,7 +604,7 @@ exports.Listing = async function({listingId}) {
604
604
  * <br /><br />
605
605
  * NOTE: This string must be an <b>exact match</b> on the item name.
606
606
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
607
- * @param {string=} editionFilter - Filter results by item edition.
607
+ * @param {Array<string>=} editionFilters - Filter results by item edition.
608
608
  * <br /><br />
609
609
  * NOTE: This string must be an <b>exact match</b> on the edition name.
610
610
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -612,12 +612,13 @@ exports.Listing = async function({listingId}) {
612
612
  * <br /><br />
613
613
  * NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
614
614
  * You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
615
+ * @param {Object=} priceRange - Filter min and/or max price (e.g. `{min: 1}` `{max: 2}` `{min: 1.50, max: 10.50})
615
616
  * @param {string=} sellerAddress - Filter by a specific seller
616
617
  * @param {string=} contractAddress - Filter results by the address of the NFT contract
617
618
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
618
619
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
619
620
  * @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`
621
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
621
622
  * @param {integer=} lastNDays - Filter by results listed in the past N days
622
623
  *
623
624
  * @returns {Promise<Object>} - Results of the query and pagination info
@@ -639,7 +640,7 @@ exports.Listings = async function() {
639
640
  * <br /><br />
640
641
  * NOTE: This string must be an <b>exact match</b> on the item name.
641
642
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
642
- * @param {string=} editionFilter - Filter results by item edition.
643
+ * @param {Array<string>} editionFilters - Filter results by item edition.
643
644
  * <br /><br />
644
645
  * NOTE: This string must be an <b>exact match</b> on the edition name.
645
646
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -647,12 +648,13 @@ exports.Listings = async function() {
647
648
  * <br /><br />
648
649
  * NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
649
650
  * You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
651
+ * @param {Object=} priceRange - Filter min and/or max price (e.g. `{min: 1}` `{max: 2}` `{min: 1.50, max: 10.50})
650
652
  * @param {string=} sellerAddress - Filter by a specific seller
651
653
  * @param {string=} contractAddress - Filter results by the address of the NFT contract
652
654
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
653
655
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
654
656
  * @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`
657
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
656
658
  * @param {integer=} lastNDays - Filter by results listed in the past N days
657
659
  *
658
660
  * @returns {Promise<Object>} - Statistics about listings. All prices in USD.
@@ -674,7 +676,7 @@ exports.ListingStats = async function() {
674
676
  * <br /><br />
675
677
  * NOTE: This string must be an <b>exact match</b> on the item name.
676
678
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
677
- * @param {string=} editionFilter - Filter results by item edition.
679
+ * @param {Array<string>} editionFilters - Filter results by item edition.
678
680
  * <br /><br />
679
681
  * NOTE: This string must be an <b>exact match</b> on the edition name.
680
682
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -687,7 +689,7 @@ exports.ListingStats = async function() {
687
689
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
688
690
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
689
691
  * @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`
692
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
691
693
  * @param {integer=} lastNDays - Filter by results listed in the past N days
692
694
  *
693
695
  * @returns {Promise<Object>} - Results of the query and pagination info
@@ -709,7 +711,7 @@ exports.Sales = async function() {
709
711
  * <br /><br />
710
712
  * NOTE: This string must be an <b>exact match</b> on the item name.
711
713
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
712
- * @param {string=} editionFilter - Filter results by item edition.
714
+ * @param {Array<string>} editionFilters - Filter results by item edition.
713
715
  * <br /><br />
714
716
  * NOTE: This string must be an <b>exact match</b> on the edition name.
715
717
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -722,7 +724,7 @@ exports.Sales = async function() {
722
724
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
723
725
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
724
726
  * @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`
727
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
726
728
  * @param {integer=} lastNDays - Filter by results listed in the past N days
727
729
  *
728
730
  * @returns {Promise<Object>} - Results of the query and pagination info
@@ -744,7 +746,7 @@ exports.Transfers = async function() {
744
746
  * <br /><br />
745
747
  * NOTE: This string must be an <b>exact match</b> on the item name.
746
748
  * You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
747
- * @param {string=} editionFilter - Filter results by item edition.
749
+ * @param {Array<string>} editionFilters - Filter results by item edition.
748
750
  * <br /><br />
749
751
  * NOTE: This string must be an <b>exact match</b> on the edition name.
750
752
  * You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
@@ -757,7 +759,7 @@ exports.Transfers = async function() {
757
759
  * @param {string=} tokenId - Filter by token ID (if filtering by contract address)
758
760
  * @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
759
761
  * @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`
762
+ * @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
761
763
  * @param {integer=} lastNDays - Filter by results listed in the past N days
762
764
  *
763
765
  * @returns {Promise<Object>} - Statistics about sales. All prices in USD.
@@ -12,7 +12,7 @@ let WalletConfiguration = {
12
12
  staging: {
13
13
  siteId: "iq__inauxD1KLyKWPHargCWjdCh2ayr",
14
14
  purchaseMode: "production",
15
- appUrl: "https://core.test.contentfabric.io/wallet"
15
+ appUrl: "https://wallet.preview.contentfabric.io",
16
16
  },
17
17
  production: {
18
18
  siteId: "iq__suqRJUt2vmXsyiWS5ZaSGwtFU9R",
@@ -5,6 +5,7 @@ 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";
8
9
 
9
10
  /**
10
11
  * Use the <a href="#.Initialize">Initialize</a> method to initialize a new client.
@@ -91,7 +92,7 @@ class ElvWalletClient {
91
92
  storeAuthToken
92
93
  });
93
94
 
94
- if(window && window.location && window.location.href) {
95
+ if(inBrowser && window.location && window.location.href) {
95
96
  let url = new URL(window.location.href);
96
97
  if(url.searchParams.get("elvToken")) {
97
98
  await walletClient.Authenticate({token: url.searchParams.get("elvToken")});
@@ -130,7 +131,7 @@ class ElvWalletClient {
130
131
  if(!this.loggedIn) { return false; }
131
132
 
132
133
  return !!this.__authorization.clusterToken ||
133
- !!(this.UserInfo().walletName.toLowerCase() === "metamask" && window.ethereum && window.ethereum.isMetaMask && window.ethereum.chainId);
134
+ (inBrowser && !!(this.UserInfo().walletName.toLowerCase() === "metamask" && window.ethereum && window.ethereum.isMetaMask && window.ethereum.chainId));
134
135
  }
135
136
 
136
137
  /**
@@ -167,6 +168,8 @@ class ElvWalletClient {
167
168
  } else {
168
169
  throw Error("ElvWalletClient: Unable to sign");
169
170
  }
171
+ } else if(!inBrowser) {
172
+ throw Error("ElvWalletClient: Unable to sign");
170
173
  }
171
174
 
172
175
  const parameters = {
@@ -331,7 +334,7 @@ class ElvWalletClient {
331
334
  }
332
335
 
333
336
  if(decodedToken.clusterToken) {
334
- await this.client.SetRemoteSigner({authToken: decodedToken.clusterToken});
337
+ await this.client.SetRemoteSigner({authToken: decodedToken.clusterToken, signerURIs: decodedToken.signerURIs});
335
338
  }
336
339
 
337
340
  this.client.SetStaticToken({token: decodedToken.fabricToken});
@@ -347,8 +350,8 @@ class ElvWalletClient {
347
350
  * @param {string} idToken - An OAuth ID token
348
351
  * @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
352
  * @param {string=} email - Email address of the user. If not specified, this method will attempt to extract the email from the ID token.
353
+ * @param {Array<string>=} signerURIs - (Only if using custom OAuth) - URIs corresponding to the key server(s) to use
350
354
  * @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
355
  *
353
356
  * @returns {Promise<Object>} - Returns an authorization tokens that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
354
357
  * Save this token to avoid having to reauthenticate with OAuth. This token expires after 24 hours.
@@ -358,14 +361,16 @@ class ElvWalletClient {
358
361
  * - 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
362
  * shared with third parties.
360
363
  */
361
- async AuthenticateOAuth({idToken, tenantId, email, shareEmail=false, tokenDuration=24}) {
364
+ async AuthenticateOAuth({idToken, tenantId, email, signerURIs, shareEmail=false}) {
365
+ let tokenDuration = 24;
366
+
362
367
  if(!tenantId && this.selectedMarketplaceInfo) {
363
368
  // Load tenant ID automatically from selected marketplace
364
369
  await this.AvailableMarketplaces();
365
370
  tenantId = this.selectedMarketplaceInfo.tenantId;
366
371
  }
367
372
 
368
- await this.client.SetRemoteSigner({idToken, tenantId, extraData: { share_email: shareEmail }, unsignedPublicAuth: true});
373
+ await this.client.SetRemoteSigner({idToken, tenantId, signerURIs, extraData: { share_email: shareEmail }, unsignedPublicAuth: true});
369
374
 
370
375
  const expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
371
376
  const fabricToken = await this.client.CreateFabricToken({duration: tokenDuration * 60 * 60 * 1000});
@@ -389,6 +394,7 @@ class ElvWalletClient {
389
394
  address,
390
395
  email,
391
396
  expiresAt,
397
+ signerURIs,
392
398
  walletType: "Custodial",
393
399
  walletName: "Eluvio"
394
400
  }),
@@ -399,6 +405,7 @@ class ElvWalletClient {
399
405
  address,
400
406
  email,
401
407
  expiresAt,
408
+ signerURIs,
402
409
  walletType: "Custodial",
403
410
  walletName: "Eluvio"
404
411
  })
@@ -461,7 +468,7 @@ class ElvWalletClient {
461
468
  return this.__authorization.fabricToken;
462
469
  }
463
470
 
464
- SetAuthorization({clusterToken, fabricToken, tenantId, address, email, expiresAt, walletType, walletName}) {
471
+ SetAuthorization({clusterToken, fabricToken, tenantId, address, email, expiresAt, signerURIs, walletType, walletName}) {
465
472
  address = this.client.utils.FormatAddress(address);
466
473
 
467
474
  this.__authorization = {
@@ -476,6 +483,10 @@ class ElvWalletClient {
476
483
 
477
484
  if(clusterToken) {
478
485
  this.__authorization.clusterToken = clusterToken;
486
+
487
+ if(signerURIs) {
488
+ this.__authorization.signerURIs = signerURIs;
489
+ }
479
490
  }
480
491
 
481
492
  this.loggedIn = true;
@@ -495,7 +506,7 @@ class ElvWalletClient {
495
506
  }
496
507
 
497
508
  async SignMetamask({message, address}) {
498
- if(!window.ethereum) {
509
+ if(!inBrowser || !window.ethereum) {
499
510
  throw Error("ElvWalletClient: Unable to initialize - Metamask not available");
500
511
  }
501
512
 
@@ -699,20 +710,23 @@ class ElvWalletClient {
699
710
  sortBy="created",
700
711
  sortDesc=false,
701
712
  filter,
702
- editionFilter,
713
+ editionFilters,
703
714
  attributeFilters,
704
715
  contractAddress,
705
716
  tokenId,
706
717
  currency,
707
718
  marketplaceParams,
708
719
  tenantId,
709
- collectionIndex=-1,
720
+ collectionIndexes,
721
+ priceRange,
722
+ tokenIdRange,
723
+ capLimit,
710
724
  sellerAddress,
711
725
  lastNDays=-1,
712
726
  start=0,
713
727
  limit=50
714
728
  }={}) {
715
- collectionIndex = parseInt(collectionIndex);
729
+ collectionIndexes = (collectionIndexes || []).map(i => parseInt(i));
716
730
 
717
731
  let params = {
718
732
  sort_by: sortBy,
@@ -725,7 +739,7 @@ class ElvWalletClient {
725
739
  if(marketplaceParams) {
726
740
  marketplaceInfo = await this.MarketplaceInfo({marketplaceParams});
727
741
 
728
- if(collectionIndex >= 0) {
742
+ if(collectionIndexes.length > 0) {
729
743
  marketplace = await this.Marketplace({marketplaceParams});
730
744
  }
731
745
  }
@@ -737,41 +751,30 @@ class ElvWalletClient {
737
751
  filters.push(`seller:eq:${this.client.utils.FormatAddress(sellerAddress)}`);
738
752
  }
739
753
 
740
- if(marketplace && collectionIndex >= 0) {
741
- const collection = marketplace.collections[collectionIndex];
754
+ if(marketplace && collectionIndexes.length >= 0) {
755
+ collectionIndexes.forEach(collectionIndex => {
756
+ const collection = marketplace.collections[collectionIndex];
742
757
 
743
- collection.items.forEach(sku => {
744
- if(!sku) { return; }
758
+ collection.items.forEach(sku => {
759
+ if(!sku) {
760
+ return;
761
+ }
745
762
 
746
- const item = marketplace.items.find(item => item.sku === sku);
763
+ const item = marketplace.items.find(item => item.sku === sku);
747
764
 
748
- if(!item) { return; }
765
+ if(!item) {
766
+ return;
767
+ }
749
768
 
750
- const address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
769
+ const address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
751
770
 
752
- if(address) {
753
- filters.push(
754
- `${mode === "owned" ? "contract_addr": "contract"}:eq:${Utils.FormatAddress(address)}`
755
- );
756
- }
771
+ if(address) {
772
+ filters.push(
773
+ `${mode === "owned" ? "contract_addr" : "contract"}:eq:${Utils.FormatAddress(address)}`
774
+ );
775
+ }
776
+ });
757
777
  });
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
778
  } else if(mode !== "owned" && marketplaceInfo || tenantId) {
776
779
  filters.push(`tenant:eq:${marketplaceInfo ? marketplaceInfo.tenantId : tenantId}`);
777
780
  }
@@ -797,15 +800,17 @@ class ElvWalletClient {
797
800
  }
798
801
  }
799
802
 
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
- }
803
+ if(editionFilters) {
804
+ editionFilters.forEach(editionFilter => {
805
+ if(mode.includes("listing")) {
806
+ filters.push(`nft/edition_name:eq:${editionFilter}`);
807
+ } else if(mode === "owned") {
808
+ filters.push(`meta:@>:{"edition_name":"${editionFilter}"}`);
809
+ params.exact = false;
810
+ } else {
811
+ filters.push(`edition:eq:${editionFilter}`);
812
+ }
813
+ });
809
814
  }
810
815
 
811
816
  if(attributeFilters) {
@@ -824,6 +829,31 @@ class ElvWalletClient {
824
829
  filters.push(`created:gt:${((Date.now() / 1000) - ( lastNDays * 24 * 60 * 60 )).toFixed(0)}`);
825
830
  }
826
831
 
832
+ if(priceRange) {
833
+ if(priceRange.min) {
834
+ filters.push(`price:gt:${parseFloat(priceRange.min) - 0.01}`);
835
+ }
836
+
837
+ if(priceRange.max) {
838
+ filters.push(`price:lt:${parseFloat(priceRange.max) + 0.01}`);
839
+ }
840
+ }
841
+
842
+ if(tokenIdRange) {
843
+ if(tokenIdRange.min) {
844
+ filters.push(`info/ordinal:gt:${parseInt(tokenIdRange.min) - 1}`);
845
+ }
846
+
847
+ if(tokenIdRange.max) {
848
+ filters.push(`info/ordinal:lt:${parseInt(tokenIdRange.max) + 1}`);
849
+ }
850
+ }
851
+
852
+ if(capLimit) {
853
+ filters.push(`info/cap:lt:${parseInt(capLimit) + 1}`);
854
+ }
855
+
856
+
827
857
  let path;
828
858
  switch(mode) {
829
859
  case "owned":
@@ -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..-hVeB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jYsIm5iZiI6MTY1ODUyOTkyNiwidmVyIjoiMS4wIiwiaXNzIjoiaHR0cHM6Ly93ZGNiMmMuYjJjbG9naW4uY29tL3RmcC9mYWVhYTg5ZS02YTA1LTRjMzEtOGJkNS01MGRlNWNkNGQyZTEvYjJjXzFfbXNfc2lnbl91cF9pbi92Mi4wLyIsInN1YiI6IjVhYWIyOWNiLWRiZDMtNDM1ZS04MzViLTlmYmFkYTBkODg2MyIsImF1ZCI6ImFjYjQ3MjMzLTk3ZDUtNGFjMy04OWQzLTdkMTUzNjFjMjYzNiIsImlhdCI6MTY1ODUyOTkyNiwiYXV0aF90aW1lIjoxNjU4NTI5OTA2LCJpZHAiOiJsaXZlLmNvbSIsImVtYWlscyI6WyJrZXZpbkBlbHV2LmlvIl0sInRmcCI6IkIyQ18xX21zX3NpZ25fdXBfaW4ifQ.H1rbbrKCzU2dkdWe62GCTlOHACLbr8IV8UDiL1nukyerGrBVq_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));