@eluvio/elv-client-js 4.0.8 → 4.0.10
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/dist/ElvClient-min.js +10 -10
- package/dist/ElvClient-node-min.js +5 -5
- package/dist/ElvFrameClient-min.js +8 -8
- package/dist/ElvPermissionsClient-min.js +8 -8
- package/dist/ElvWalletClient-min.js +10 -10
- package/dist/ElvWalletClient-node-min.js +7 -7
- package/dist/src/Crypto.js +4 -2
- package/dist/src/ElvClient.js +4 -2
- package/dist/src/Utils.js +3 -1
- package/dist/src/client/ContentAccess.js +63 -10
- package/dist/src/client/ContentManagement.js +55 -52
- package/dist/src/client/Files.js +1 -1
- package/dist/src/walletClient/ClientMethods.js +38 -17
- package/dist/src/walletClient/Utils.js +2 -2
- package/dist/src/walletClient/index.js +7 -3
- package/package.json +1 -1
- package/src/client/ContentAccess.js +27 -10
- package/src/client/ContentManagement.js +24 -29
- package/src/walletClient/ClientMethods.js +18 -10
- package/src/walletClient/index.js +7 -2
- package/testScripts/CreateMezMonolithic.js +779 -0
- package/utilities/ListAccessGroups.js +34 -0
|
@@ -174,20 +174,20 @@ exports.CreateContentType = async function({name, metadata={}, bitcode}) {
|
|
|
174
174
|
this.Log(`Created type: ${contractAddress} ${objectId}`);
|
|
175
175
|
|
|
176
176
|
/* Create object, upload bitcode and finalize */
|
|
177
|
-
const
|
|
178
|
-
this.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
);
|
|
177
|
+
const rawCreateResponse = await this.HttpClient.Request({
|
|
178
|
+
headers: await this.authClient.AuthorizationHeader({
|
|
179
|
+
libraryId: this.contentSpaceLibraryId,
|
|
180
|
+
objectId,
|
|
181
|
+
update: true
|
|
182
|
+
}),
|
|
183
|
+
method: "POST",
|
|
184
|
+
path: path
|
|
185
|
+
});
|
|
186
|
+
const nodeUrl = (new URL(rawCreateResponse.url)).origin;
|
|
187
|
+
const createResponse = await this.utils.ResponseToJson(rawCreateResponse);
|
|
188
188
|
|
|
189
189
|
// Record the node used in creating this write token
|
|
190
|
-
this.HttpClient.RecordWriteToken(createResponse.write_token);
|
|
190
|
+
this.HttpClient.RecordWriteToken(createResponse.write_token, nodeUrl);
|
|
191
191
|
|
|
192
192
|
await this.ReplaceMetadata({
|
|
193
193
|
libraryId: this.contentSpaceLibraryId,
|
|
@@ -605,20 +605,21 @@ exports.CreateContentObject = async function({libraryId, objectId, options={}})
|
|
|
605
605
|
|
|
606
606
|
const path = UrlJoin("qid", objectId);
|
|
607
607
|
|
|
608
|
-
|
|
609
|
-
this.
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
);
|
|
608
|
+
const rawCreateResponse = await this.HttpClient.Request({
|
|
609
|
+
headers: await this.authClient.AuthorizationHeader({libraryId, objectId, update: true}),
|
|
610
|
+
method: "POST",
|
|
611
|
+
path: path,
|
|
612
|
+
body: options
|
|
613
|
+
});
|
|
614
|
+
const nodeUrl = (new URL(rawCreateResponse.url)).origin;
|
|
615
|
+
const createResponse = await this.utils.ResponseToJson(rawCreateResponse);
|
|
616
616
|
|
|
617
617
|
// Record the node used in creating this write token
|
|
618
|
-
this.HttpClient.RecordWriteToken(createResponse.write_token);
|
|
618
|
+
this.HttpClient.RecordWriteToken(createResponse.write_token, nodeUrl);
|
|
619
619
|
|
|
620
620
|
createResponse.writeToken = createResponse.write_token;
|
|
621
621
|
createResponse.objectId = createResponse.id;
|
|
622
|
+
createResponse.nodeUrl = nodeUrl;
|
|
622
623
|
|
|
623
624
|
return createResponse;
|
|
624
625
|
};
|
|
@@ -780,14 +781,8 @@ exports.EditContentObject = async function({libraryId, objectId, options={}}) {
|
|
|
780
781
|
path: path,
|
|
781
782
|
body: options
|
|
782
783
|
});
|
|
783
|
-
|
|
784
|
-
const
|
|
785
|
-
actualUrl.pathname = "";
|
|
786
|
-
actualUrl.search = "";
|
|
787
|
-
actualUrl.hash = "";
|
|
788
|
-
const nodeUrl = actualUrl.href;
|
|
789
|
-
|
|
790
|
-
let editResponse = await this.utils.ResponseToJson(rawEditResponse);
|
|
784
|
+
const nodeUrl = (new URL(rawEditResponse.url)).origin;
|
|
785
|
+
const editResponse = await this.utils.ResponseToJson(rawEditResponse);
|
|
791
786
|
|
|
792
787
|
// Record the node used in creating this write token
|
|
793
788
|
this.HttpClient.RecordWriteToken(editResponse.write_token, nodeUrl);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const Utils = require("../Utils");
|
|
2
2
|
const UrlJoin = require("url-join");
|
|
3
3
|
const {FormatNFTDetails, FormatNFTMetadata, FormatNFT} = require("./Utils");
|
|
4
|
+
const MergeWith = require("lodash/mergeWith");
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Methods
|
|
@@ -571,16 +572,23 @@ exports.NFT = async function({tokenId, contractAddress}) {
|
|
|
571
572
|
)
|
|
572
573
|
);
|
|
573
574
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
575
|
+
const assetMetadata = (await this.client.ContentObjectMetadata({
|
|
576
|
+
versionHash: nft.details.VersionHash,
|
|
577
|
+
metadataSubtree: "public/asset_metadata/nft",
|
|
578
|
+
produceLinkUrls: true
|
|
579
|
+
})) || {};
|
|
580
|
+
|
|
581
|
+
nft.metadata = MergeWith({}, assetMetadata, nft.metadata, (a, b) => b === null || b === "" ? a : undefined);
|
|
582
|
+
|
|
583
|
+
if(this.localization) {
|
|
584
|
+
const localizedMetadata = (await this.client.ContentObjectMetadata({
|
|
585
|
+
versionHash: nft.details.VersionHash,
|
|
586
|
+
metadataSubtree: UrlJoin("public", "asset_metadata", "localizations", this.localization, "nft"),
|
|
587
|
+
produceLinkUrls: true
|
|
588
|
+
})) || {};
|
|
589
|
+
|
|
590
|
+
nft.metadata = MergeWith({}, nft.metadata, localizedMetadata, (a, b) => b === null || b === "" ? a : undefined);
|
|
591
|
+
}
|
|
584
592
|
|
|
585
593
|
nft.config = await this.TenantConfiguration({contractAddress});
|
|
586
594
|
|
|
@@ -23,12 +23,14 @@ try {
|
|
|
23
23
|
* See the Modules section on the sidebar for all client methods unrelated to login and authorization
|
|
24
24
|
*/
|
|
25
25
|
class ElvWalletClient {
|
|
26
|
-
constructor({appId, client, network, mode, marketplaceInfo, previewMarketplaceHash, storeAuthToken}) {
|
|
26
|
+
constructor({appId, client, network, mode, localization, marketplaceInfo, previewMarketplaceHash, storeAuthToken}) {
|
|
27
27
|
this.appId = appId;
|
|
28
28
|
|
|
29
29
|
this.client = client;
|
|
30
30
|
this.loggedIn = false;
|
|
31
31
|
|
|
32
|
+
this.localization = localization;
|
|
33
|
+
|
|
32
34
|
this.network = network;
|
|
33
35
|
this.mode = mode;
|
|
34
36
|
this.purchaseMode = Configuration[network][mode].purchaseMode;
|
|
@@ -93,6 +95,7 @@ class ElvWalletClient {
|
|
|
93
95
|
appId="general",
|
|
94
96
|
network="main",
|
|
95
97
|
mode="production",
|
|
98
|
+
localization,
|
|
96
99
|
marketplaceParams,
|
|
97
100
|
previewMarketplaceId,
|
|
98
101
|
storeAuthToken=true
|
|
@@ -119,6 +122,7 @@ class ElvWalletClient {
|
|
|
119
122
|
client,
|
|
120
123
|
network,
|
|
121
124
|
mode,
|
|
125
|
+
localization,
|
|
122
126
|
marketplaceInfo: {
|
|
123
127
|
tenantSlug,
|
|
124
128
|
marketplaceSlug,
|
|
@@ -756,6 +760,7 @@ class ElvWalletClient {
|
|
|
756
760
|
let marketplace = await this.client.ContentObjectMetadata({
|
|
757
761
|
versionHash: marketplaceHash,
|
|
758
762
|
metadataSubtree: "public/asset_metadata/info",
|
|
763
|
+
localizationSubtree: this.localization ? UrlJoin("public", "asset_metadata", "localizations", this.localization, "info") : "",
|
|
759
764
|
linkDepthLimit: 1,
|
|
760
765
|
resolveLinks: true,
|
|
761
766
|
resolveIgnoreErrors: true,
|
|
@@ -810,7 +815,7 @@ class ElvWalletClient {
|
|
|
810
815
|
}
|
|
811
816
|
|
|
812
817
|
// Generate embed URLs for pack opening animations
|
|
813
|
-
["purchase_animation", "
|
|
818
|
+
["purchase_animation", "purchase_animation_mobile", "reveal_animation", "reveal_animation_mobile"].forEach(key => {
|
|
814
819
|
try {
|
|
815
820
|
if(marketplace.storefront[key]) {
|
|
816
821
|
let embedUrl = new URL("https://embed.v3.contentfabric.io");
|