@eluvio/elv-client-js 3.2.2 → 3.2.6

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.
Files changed (35) hide show
  1. package/dist/ElvClient-min.js +15 -11
  2. package/dist/ElvClient-node-min.js +17 -13
  3. package/dist/ElvFrameClient-min.js +12 -8
  4. package/dist/ElvPermissionsClient-min.js +13 -9
  5. package/dist/ElvWalletClient-min.js +58 -0
  6. package/dist/ElvWalletClient-node-min.js +78 -0
  7. package/dist/src/AuthorizationClient.js +2248 -1990
  8. package/dist/src/ContentObjectVerification.js +164 -173
  9. package/dist/src/Crypto.js +376 -324
  10. package/dist/src/ElvClient.js +1182 -1019
  11. package/dist/src/ElvWallet.js +119 -95
  12. package/dist/src/EthClient.js +1040 -896
  13. package/dist/src/FrameClient.js +331 -300
  14. package/dist/src/HttpClient.js +153 -147
  15. package/dist/src/Id.js +1 -3
  16. package/dist/src/PermissionsClient.js +1294 -1168
  17. package/dist/src/RemoteSigner.js +263 -211
  18. package/dist/src/UserProfileClient.js +1164 -1023
  19. package/dist/src/Utils.js +209 -181
  20. package/dist/src/client/ABRPublishing.js +895 -858
  21. package/dist/src/client/AccessGroups.js +1102 -959
  22. package/dist/src/client/ContentAccess.js +3724 -3431
  23. package/dist/src/client/ContentManagement.js +2252 -2068
  24. package/dist/src/client/Contracts.js +647 -563
  25. package/dist/src/client/Files.js +1886 -1757
  26. package/dist/src/client/NFT.js +126 -112
  27. package/dist/src/client/NTP.js +478 -422
  28. package/dist/src/walletClient/ClientMethods.js +1029 -879
  29. package/dist/src/walletClient/Utils.js +84 -70
  30. package/dist/src/walletClient/index.js +1203 -1087
  31. package/package.json +4 -2
  32. package/src/Utils.js +0 -1
  33. package/src/walletClient/ClientMethods.js +34 -2
  34. package/src/walletClient/index.js +3 -3
  35. package/utilities/ProductionMasterCreate.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.2.2",
3
+ "version": "3.2.6",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://github.com/eluv-io/elv-client-js",
9
9
  "scripts": {
10
10
  "bump-version": "npm --git-tag-version --no-commit-hooks version patch",
11
- "build": "npm run build-docs && npm run build-dist && npm run build-frame-client && npm run build-permissions-client && npm run build-prod",
11
+ "build": "npm run build-docs && npm run build-dist && npm run build-frame-client && npm run build-permissions-client && npm run build-wallet-client-web && npm run build-wallet-client-node && npm run build-prod",
12
12
  "build-docs": "node build/BuildDocs.js && npm run build-client-docs && npm run build-wallet-client-docs",
13
13
  "build-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc.json --readme README.md",
14
14
  "build-wallet-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc-mc.json --readme ./src/walletClient/README.md",
@@ -16,6 +16,8 @@
16
16
  "build-contracts": "node build/BuildContracts.js",
17
17
  "build-frame-client": "webpack -p --progress --entry ./dist/src/FrameClient.js --output-filename ElvFrameClient-min.js --devtool none --optimize-minimize && mv test/bundle-analysis/index.html test/bundle-analysis/frame-client.html",
18
18
  "build-permissions-client": "webpack -p --progress --entry ./dist/src/PermissionsClient.js --output-filename ElvPermissionsClient-min.js --devtool none --optimize-minimize && mv test/bundle-analysis/index.html test/bundle-analysis/permissions-client.html",
19
+ "build-wallet-client-web": "webpack -p --progress --mode production --entry ./dist/src/walletClient/index.js --target web --output-filename ElvWalletClient-min.js --devtool none --optimize-minimize && mv test/bundle-analysis/index.html test/bundle-analysis/wallet-client.html",
20
+ "build-wallet-client-node": "webpack -p --progress --mode production --entry ./dist/src/walletClient/index.js --target node --output-filename ElvWalletClient-node-min.js --devtool none --optimize-minimize && mv test/bundle-analysis/index.html test/bundle-analysis/wallet-client.html",
19
21
  "build-prod": "npm run build-web && npm run build-node",
20
22
  "build-web": "webpack --progress --mode production --target web --output-filename ElvClient-min.js --devtool none && mv test/bundle-analysis/index.html test/bundle-analysis/web.html",
21
23
  "build-node": "webpack --progress --mode production --target node --output-filename ElvClient-node-min.js --devtool none && mv test/bundle-analysis/index.html test/bundle-analysis/node.html",
package/src/Utils.js CHANGED
@@ -399,7 +399,6 @@ const Utils = {
399
399
  getAddress(address);
400
400
  return true;
401
401
  } catch(error) {
402
- this.Log(error);
403
402
  return false;
404
403
  }
405
404
  },
@@ -280,7 +280,7 @@ exports.UserSales = async function({sortBy="created", sortDesc=false, contractAd
280
280
  */
281
281
  exports.TenantConfiguration = async function({tenantId, contractAddress}) {
282
282
  try {
283
- return await this.utils.ResponseToJson(
283
+ return await Utils.ResponseToJson(
284
284
  this.client.authClient.MakeAuthServiceRequest({
285
285
  path: contractAddress ?
286
286
  UrlJoin("as", "config", "nft", contractAddress) :
@@ -356,7 +356,8 @@ exports.MarketplaceInfo = function ({marketplaceParams}) {
356
356
  if(tenantSlug && marketplaceSlug) {
357
357
  marketplaceInfo = (this.availableMarketplaces[tenantSlug] || {})[marketplaceSlug];
358
358
  } else {
359
- marketplaceInfo = this.availableMarketplacesById[marketplaceId || this.client.utils.DecodeVersionHash(marketplaceHash).objectId];
359
+ marketplaceId = marketplaceHash ? this.client.utils.DecodeVersionHash(marketplaceHash).objectId : marketplaceId;
360
+ marketplaceInfo = this.availableMarketplacesById[marketplaceId];
360
361
  }
361
362
 
362
363
  if(!marketplaceInfo) {
@@ -464,6 +465,37 @@ exports.NFT = async function({tokenId, contractAddress}) {
464
465
  return FormatNFTMetadata(nft);
465
466
  };
466
467
 
468
+ /**
469
+ * <b><i>Requires login</i></b>
470
+ *
471
+ * Transfer the specified NFT owned by the current user to the specified address
472
+ *
473
+ * @methodGroup NFT
474
+ * @namedParams
475
+ * @param {string} contractAddress - The contract address of the NFT
476
+ * @param {string} tokenId - The token ID of the NFT
477
+ * @param {string} targetAddress - The address to which to transfer the NFT
478
+ */
479
+ exports.TransferNFT = async function({contractAddress, tokenId, targetAddress}) {
480
+ if(!targetAddress || !Utils.ValidAddress(targetAddress)) {
481
+ throw Error("Eluvio Wallet Client: Invalid or missing target address in UserTransferNFT");
482
+ }
483
+
484
+ return await this.client.authClient.MakeAuthServiceRequest({
485
+ path: UrlJoin("as", "wlt", "mkt", "xfer"),
486
+ method: "POST",
487
+ body: {
488
+ contract: Utils.FormatAddress(contractAddress),
489
+ token: tokenId,
490
+ to_addr: Utils.FormatAddress(targetAddress)
491
+ },
492
+ headers: {
493
+ Authorization: `Bearer ${this.AuthToken()}`
494
+ }
495
+ });
496
+ };
497
+
498
+
467
499
  /** LISTINGS */
468
500
 
469
501
  /**
@@ -246,12 +246,12 @@ class ElvWalletClient {
246
246
  throw Error("ElvWalletClient: Provided authorization token has expired");
247
247
  }
248
248
 
249
- this.client.SetStaticToken({token: decodedToken.fabricToken});
250
-
251
249
  if(decodedToken.clusterToken) {
252
- this.client.SetRemoteSigner({authToken: decodedToken.clusterToken});
250
+ await this.client.SetRemoteSigner({authToken: decodedToken.clusterToken});
253
251
  }
254
252
 
253
+ this.client.SetStaticToken({token: decodedToken.fabricToken});
254
+
255
255
  return this.SetAuthorization(decodedToken);
256
256
  }
257
257
 
@@ -110,7 +110,7 @@ class ProductionMasterCreate extends Utility {
110
110
  objectId: id,
111
111
  writeToken: write_token,
112
112
  metadata: streams,
113
- metadataSubtree: "/production_master/variants/default"
113
+ metadataSubtree: "/production_master/variants/default/streams"
114
114
  });
115
115
 
116
116
  const finalizeResponse = await client.FinalizeContentObject({
@@ -181,4 +181,4 @@ if(require.main === module) {
181
181
  Utility.cmdLineInvoke(ProductionMasterCreate);
182
182
  } else {
183
183
  module.exports = ProductionMasterCreate;
184
- }
184
+ }