@eluvio/elv-client-js 4.0.13 → 4.0.15

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.
@@ -260,7 +260,7 @@ var RemoteSigner = /*#__PURE__*/function (_Ethers$Signer) {
260
260
  case 4:
261
261
  transaction.nonce = _context6.sent;
262
262
  case 5:
263
- return _context6.abrupt("return", Ethers.utils.populateTransaction(transaction, this.provider, this.address).then(function (tx) {
263
+ return _context6.abrupt("return", this.populateTransaction(transaction, this.provider, this.address).then(function (tx) {
264
264
  return _this3.sign(tx).then(function (signedTransaction) {
265
265
  return _this3.provider.sendTransaction(signedTransaction);
266
266
  });
@@ -961,8 +961,8 @@ exports.FinalizeABRMezzanine = /*#__PURE__*/function () {
961
961
  break;
962
962
  }
963
963
  params = {
964
- elvClient: this,
965
964
  nodeUrl: lroDraft.node,
965
+ offeringKey: offeringKey,
966
966
  writeToken: lroDraft.write_token
967
967
  };
968
968
  _context7.prev = 29;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.13",
3
+ "version": "4.0.15",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -69,7 +69,7 @@
69
69
  "ethers": "^5.7.2",
70
70
  "fraction.js": "^4.0.12",
71
71
  "hash.js": "^1.1.7",
72
- "image-type": "^4.1.0",
72
+ "image-type": "^5.2.0",
73
73
  "isarray": "^2.0.5",
74
74
  "js-polyfills": "^0.1.42",
75
75
  "jsonpath-plus": "^6.0.1",
@@ -78,11 +78,6 @@ class RemoteSigner extends Ethers.Signer {
78
78
  return this.address;
79
79
  }
80
80
 
81
- /**
82
- * Sign a hashed piece of data
83
- * @param {String} digest - Hex string of hashed data
84
- * @returns - the signed message as a hex string
85
- */
86
81
  async signDigest(digest) {
87
82
  if(!this.signatureCache[digest]) {
88
83
  this.signatureCache[digest] = new Promise(async (resolve, reject) => {
@@ -135,7 +130,7 @@ class RemoteSigner extends Ethers.Signer {
135
130
  transaction.nonce = await this.provider.getTransactionCount(this.address, "pending");
136
131
  }
137
132
 
138
- return Ethers.utils.populateTransaction(transaction, this.provider, this.address).then((tx) => {
133
+ return this.populateTransaction(transaction, this.provider, this.address).then((tx) => {
139
134
  return this.sign(tx).then((signedTransaction) => {
140
135
  return this.provider.sendTransaction(signedTransaction);
141
136
  });
@@ -686,8 +686,8 @@ exports.FinalizeABRMezzanine = async function({libraryId, objectId, preFinalizeF
686
686
  let preFinalizeWarnings = [];
687
687
  if(preFinalizeFn) {
688
688
  const params = {
689
- elvClient: this,
690
689
  nodeUrl: lroDraft.node,
690
+ offeringKey,
691
691
  writeToken: lroDraft.write_token
692
692
  };
693
693
  try {
@@ -747,7 +747,7 @@ exports.ProduceMetadataLinks = async function({
747
747
  // Is file or rep link - produce a url
748
748
  return {
749
749
  ...metadata,
750
- url: await this.LinkUrl({libraryId, objectId, versionHash, linkPath: path, authorizationToken})
750
+ url: await this.LinkUrl({libraryId, objectId, versionHash, linkPath: path, authorizationToken, noAuth})
751
751
  };
752
752
  }
753
753
 
@@ -783,7 +783,8 @@ exports.MetadataAuth = async function({
783
783
 
784
784
  if(versionHash) { objectId = this.utils.DecodeVersionHash(versionHash).objectId; }
785
785
 
786
- noAuth = this.noAuth || noAuth;
786
+ noAuth = this.noAuth || noAuth || this.staticToken;
787
+
787
788
  let isPublic = noAuth;
788
789
  let accessType;
789
790
  if(!noAuth) {
@@ -900,6 +901,14 @@ exports.ContentObjectMetadata = async function({
900
901
 
901
902
  let path = UrlJoin("q", writeToken || versionHash || objectId, "meta", metadataSubtree);
902
903
 
904
+ if(!versionHash) {
905
+ if(!libraryId) {
906
+ libraryId = await this.ContentObjectLibraryId({objectId});
907
+ }
908
+
909
+ path = UrlJoin("qlibs", libraryId, path);
910
+ }
911
+
903
912
  // Main authorization
904
913
  let defaultAuthToken = await this.MetadataAuth({libraryId, objectId, versionHash, path: metadataSubtree, noAuth});
905
914
 
@@ -1244,9 +1244,9 @@ exports.LoadDrop = async function({tenantSlug, eventSlug, dropId}) {
1244
1244
  }
1245
1245
 
1246
1246
  if(!this.drops[tenantSlug][eventSlug][dropId]) {
1247
- const mainSiteHash = await this.client.LatestVersionHash({objectId: this.mainSiteId});
1248
1247
  const event = (await this.client.ContentObjectMetadata({
1249
- versionHash: mainSiteHash,
1248
+ libraryId: this.mainSiteLibraryId,
1249
+ objectId: this.mainSiteId,
1250
1250
  metadataSubtree: UrlJoin("public", "asset_metadata", "tenants", tenantSlug, "sites", eventSlug, "info"),
1251
1251
  resolveLinks: true,
1252
1252
  linkDepthLimit: 2,
@@ -3,20 +3,23 @@ let WalletConfiguration = {
3
3
  configUrl: "https://demov3.net955210.contentfabric.io/config",
4
4
  stateStoreUrls: ["https://appsvc.svc.eluv.io/dv3"],
5
5
  staging: {
6
+ siteLibraryId: "ilib36Wi5fJDLXix8ckL7ZfaAJwJXWGD",
6
7
  siteId: "iq__2gkNh8CCZqFFnoRpEUmz7P3PaBQG",
7
8
  purchaseMode: "develop",
8
- appUrl: "https://core.test.contentfabric.io/wallet-demo"
9
+ appUrl: "https://wallet.demov3.contentfabric.io"
9
10
  }
10
11
  },
11
12
  main: {
12
13
  configUrl: "https://main.net955305.contentfabric.io/config",
13
14
  stateStoreUrls: ["https://appsvc.svc.eluv.io/main"],
14
15
  staging: {
16
+ siteLibraryId: "ilib2GdaYEFxB7HyLPhSDPKMyPLhV8x9",
15
17
  siteId: "iq__inauxD1KLyKWPHargCWjdCh2ayr",
16
18
  purchaseMode: "production",
17
19
  appUrl: "https://wallet.preview.contentfabric.io",
18
20
  },
19
21
  production: {
22
+ siteLibraryId: "ilib2GdaYEFxB7HyLPhSDPKMyPLhV8x9",
20
23
  siteId: "iq__suqRJUt2vmXsyiWS5ZaSGwtFU9R",
21
24
  purchaseMode: "production",
22
25
  appUrl: "https://wallet.contentfabric.io"
@@ -34,6 +34,7 @@ class ElvWalletClient {
34
34
  this.network = network;
35
35
  this.mode = mode;
36
36
  this.purchaseMode = Configuration[network][mode].purchaseMode;
37
+ this.mainSiteLibraryId = Configuration[network][mode].siteLibraryId;
37
38
  this.mainSiteId = Configuration[network][mode].siteId;
38
39
  this.appUrl = Configuration[network][mode].appUrl;
39
40
  this.publicStaticToken = client.staticToken;
@@ -595,9 +596,9 @@ class ElvWalletClient {
595
596
  return;
596
597
  }
597
598
 
598
- const mainSiteHash = await this.client.LatestVersionHash({objectId: this.mainSiteId});
599
599
  let metadata = await this.client.ContentObjectMetadata({
600
- versionHash: mainSiteHash,
600
+ libraryId: this.mainSiteLibraryId,
601
+ objectId: this.mainSiteId,
601
602
  metadataSubtree: "public/asset_metadata/tenants",
602
603
  resolveLinks: true,
603
604
  linkDepthLimit: 2,
@@ -736,11 +737,12 @@ class ElvWalletClient {
736
737
  return this.availableMarketplaces[marketplaceInfo.tenantSlug][marketplaceInfo.marketplaceSlug]["."].source;
737
738
  }
738
739
 
739
- const mainSiteHash = await this.client.LatestVersionHash({objectId: this.mainSiteId});
740
740
  const marketplaceLink = await this.client.ContentObjectMetadata({
741
- versionHash: mainSiteHash,
741
+ libraryId: this.mainSiteLibraryId,
742
+ objectId: this.mainSiteId,
742
743
  metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", marketplaceInfo.tenantSlug, "marketplaces", marketplaceInfo.marketplaceSlug),
743
- resolveLinks: false
744
+ resolveLinks: false,
745
+ noAuth: true
744
746
  });
745
747
 
746
748
  return LinkTargetHash(marketplaceLink);
@@ -750,7 +752,7 @@ class ElvWalletClient {
750
752
  const marketplaceInfo = this.MarketplaceInfo({marketplaceParams});
751
753
 
752
754
  const marketplaceId = marketplaceInfo.marketplaceId;
753
- const marketplaceHash = await this.LatestMarketplaceHash({marketplaceParams});
755
+ const marketplaceHashPromise = this.LatestMarketplaceHash({marketplaceParams});
754
756
 
755
757
  if(this.cachedMarketplaces[marketplaceId] && this.cachedMarketplaces[marketplaceId].versionHash !== marketplaceHash) {
756
758
  delete this.cachedMarketplaces[marketplaceId];
@@ -758,8 +760,9 @@ class ElvWalletClient {
758
760
 
759
761
  if(!this.cachedMarketplaces[marketplaceId]) {
760
762
  let marketplace = await this.client.ContentObjectMetadata({
761
- versionHash: marketplaceHash,
762
- metadataSubtree: "public/asset_metadata/info",
763
+ libraryId: this.mainSiteLibraryId,
764
+ objectId: this.mainSiteId,
765
+ metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", marketplaceInfo.tenantSlug, "marketplaces", marketplaceInfo.marketplaceSlug, "info"),
763
766
  localizationSubtree: this.localization ? UrlJoin("public", "asset_metadata", "localizations", this.localization, "info") : "",
764
767
  linkDepthLimit: 1,
765
768
  resolveLinks: true,
@@ -807,8 +810,8 @@ class ElvWalletClient {
807
810
 
808
811
  marketplace.retrievedAt = Date.now();
809
812
  marketplace.marketplaceId = marketplaceId;
810
- marketplace.versionHash = marketplaceHash;
811
- marketplace.marketplaceHash = marketplaceHash;
813
+ marketplace.versionHash = await marketplaceHashPromise;
814
+ marketplace.marketplaceHash = await marketplaceHashPromise;
812
815
 
813
816
  if(this.previewMarketplaceId && marketplaceId === this.previewMarketplaceId) {
814
817
  marketplace.branding.preview = true;