@eluvio/elv-client-js 4.0.27 → 4.0.29
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 +11 -11
- package/dist/ElvClient-node-min.js +10 -10
- package/dist/ElvFrameClient-min.js +12 -12
- package/dist/ElvWalletClient-min.js +8 -8
- package/dist/ElvWalletClient-node-min.js +8 -8
- package/dist/src/FrameClient.js +10 -11
- package/dist/src/client/ContentAccess.js +17 -10
- package/dist/src/walletClient/Configuration.js +1 -1
- package/dist/src/walletClient/index.js +10 -0
- package/package.json +1 -1
- package/src/FrameClient.js +72 -5
- package/src/client/ContentAccess.js +8 -4
- package/src/walletClient/Configuration.js +1 -0
- package/src/walletClient/index.js +8 -0
- package/testScripts/Test.js +15 -0
package/dist/src/FrameClient.js
CHANGED
|
@@ -14,8 +14,6 @@ var permissionLevels = require("./client/ContentAccess").permissionLevels;
|
|
|
14
14
|
var _require = require("./LogMessage"),
|
|
15
15
|
LogMessage = _require.LogMessage;
|
|
16
16
|
var Crypto = require("./Crypto");
|
|
17
|
-
var _require2 = require("./walletClient/index"),
|
|
18
|
-
ElvWalletClient = _require2.ElvWalletClient;
|
|
19
17
|
var FrameClient = /*#__PURE__*/function () {
|
|
20
18
|
"use strict";
|
|
21
19
|
|
|
@@ -160,15 +158,12 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
160
158
|
_iterator2.f();
|
|
161
159
|
}
|
|
162
160
|
this.walletClient = {};
|
|
163
|
-
|
|
164
|
-
var _iterator3 = _createForOfIteratorHelper(
|
|
161
|
+
// Dynamically defined wallet client methods defined in AllowedWalletClientMethods
|
|
162
|
+
var _iterator3 = _createForOfIteratorHelper(this.AllowedWalletClientMethods()),
|
|
165
163
|
_step3;
|
|
166
164
|
try {
|
|
167
165
|
var _loop3 = function _loop3() {
|
|
168
166
|
var methodName = _step3.value;
|
|
169
|
-
if (forbiddenMethods.includes(methodName)) {
|
|
170
|
-
return "continue";
|
|
171
|
-
}
|
|
172
167
|
_this.walletClient[methodName] = /*#__PURE__*/function () {
|
|
173
168
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(args) {
|
|
174
169
|
var callback;
|
|
@@ -202,8 +197,7 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
202
197
|
}();
|
|
203
198
|
};
|
|
204
199
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
205
|
-
|
|
206
|
-
if (_ret === "continue") continue;
|
|
200
|
+
_loop3();
|
|
207
201
|
}
|
|
208
202
|
} catch (err) {
|
|
209
203
|
_iterator3.e(err);
|
|
@@ -462,6 +456,11 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
462
456
|
value: function AllowedUserProfileMethods() {
|
|
463
457
|
return ["AccessLevel", "CollectedTags", "CreateWallet", "DeleteUserMetadata", "MergeUserMetadata", "PublicUserMetadata", "ReplaceUserMetadata", "TenantId", "UserMetadata", "UserProfileImage", "UserWalletAddress", "UserWalletObjectInfo", "WalletAddress"];
|
|
464
458
|
}
|
|
459
|
+
}, {
|
|
460
|
+
key: "AllowedWalletClientMethods",
|
|
461
|
+
value: function AllowedWalletClientMethods() {
|
|
462
|
+
return ["AcceptMarketplaceOffer", "AddNotificationListener", "AvailableMarketplaces", "CanSign", "CastVote", "ClaimItem", "ClaimStatus", "CollectionRedemptionStatus", "CreateListing", "CreateMarketplaceOffer", "DropStatus", "ExchangeRate", "FilteredQuery", "LatestMarketplaceHash", "Leaderboard", "Listing", "ListingAttributes", "ListingEditionNames", "ListingNames", "ListingPurchaseStatus", "ListingStats", "ListingStatus", "Listings", "LoadAvailableMarketplaces", "LoadDrop", "LoadMarketplace", "Marketplace", "MarketplaceCSS", "MarketplaceInfo", "MarketplaceOffers", "MarketplaceStock", "MintingStatus", "NFT", "NFTContractStats", "Notifications", "PackOpenStatus", "Profile", "ProfileMetadata", "PurchaseStatus", "PushNotification", "RejectMarketplaceOffer", "RemoveListing", "RemoveMarketplaceOffer", "RemoveProfileMetadata", "RevokeVote", "Sales", "SalesNames", "SalesStats", "SetProfileMetadata", "SubmitDropVote", "TenantConfiguration", "TransferNFT", "Transfers", "UserAddress", "UserInfo", "UserItemAttributes", "UserItemEditionNames", "UserItemNames", "UserItems", "UserListings", "UserNameToAddress", "UserSales", "UserTransfers", "UserWalletBalance", "VoteStatus"];
|
|
463
|
+
}
|
|
465
464
|
}], [{
|
|
466
465
|
key: "PromptedMethods",
|
|
467
466
|
value: function PromptedMethods() {
|
|
@@ -480,7 +479,7 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
480
479
|
}]);
|
|
481
480
|
return FrameClient;
|
|
482
481
|
}();
|
|
483
|
-
var
|
|
484
|
-
UploadFiles =
|
|
482
|
+
var _require2 = require("./client/Files"),
|
|
483
|
+
UploadFiles = _require2.UploadFiles;
|
|
485
484
|
FrameClient.prototype.UploadFiles = UploadFiles;
|
|
486
485
|
exports.FrameClient = FrameClient;
|
|
@@ -1874,37 +1874,44 @@ exports.LatestVersionHash = /*#__PURE__*/function () {
|
|
|
1874
1874
|
_context27.t0 = _context27["catch"](3);
|
|
1875
1875
|
case 11:
|
|
1876
1876
|
if (latestHash) {
|
|
1877
|
-
_context27.next =
|
|
1877
|
+
_context27.next = 25;
|
|
1878
1878
|
break;
|
|
1879
1879
|
}
|
|
1880
|
-
_context27.
|
|
1880
|
+
_context27.prev = 12;
|
|
1881
|
+
_context27.next = 15;
|
|
1881
1882
|
return this.CallContractMethod({
|
|
1882
1883
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
1883
1884
|
methodName: "countVersionHashes"
|
|
1884
1885
|
});
|
|
1885
|
-
case
|
|
1886
|
+
case 15:
|
|
1886
1887
|
versionCount = _context27.sent;
|
|
1888
|
+
_context27.next = 20;
|
|
1889
|
+
break;
|
|
1890
|
+
case 18:
|
|
1891
|
+
_context27.prev = 18;
|
|
1892
|
+
_context27.t1 = _context27["catch"](12);
|
|
1893
|
+
case 20:
|
|
1887
1894
|
if (versionCount.toNumber()) {
|
|
1888
|
-
_context27.next =
|
|
1895
|
+
_context27.next = 22;
|
|
1889
1896
|
break;
|
|
1890
1897
|
}
|
|
1891
1898
|
throw Error("Unable to determine latest version hash for ".concat(versionHash || objectId, " - Item deleted?"));
|
|
1892
|
-
case
|
|
1893
|
-
_context27.next =
|
|
1899
|
+
case 22:
|
|
1900
|
+
_context27.next = 24;
|
|
1894
1901
|
return this.CallContractMethod({
|
|
1895
1902
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
1896
1903
|
methodName: "versionHashes",
|
|
1897
1904
|
methodArgs: [versionCount - 1]
|
|
1898
1905
|
});
|
|
1899
|
-
case
|
|
1906
|
+
case 24:
|
|
1900
1907
|
latestHash = _context27.sent;
|
|
1901
|
-
case
|
|
1908
|
+
case 25:
|
|
1902
1909
|
return _context27.abrupt("return", latestHash);
|
|
1903
|
-
case
|
|
1910
|
+
case 26:
|
|
1904
1911
|
case "end":
|
|
1905
1912
|
return _context27.stop();
|
|
1906
1913
|
}
|
|
1907
|
-
}, _callee27, this, [[3, 9]]);
|
|
1914
|
+
}, _callee27, this, [[3, 9], [12, 18]]);
|
|
1908
1915
|
}));
|
|
1909
1916
|
return function (_x28) {
|
|
1910
1917
|
return _ref47.apply(this, arguments);
|
|
@@ -27,7 +27,7 @@ var WalletConfiguration = {
|
|
|
27
27
|
appUrl: "https://wallet.contentfabric.io"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
__MARKETPLACE_ORDER: ["PREVIEW", "masked-singer-brazil-marketplace", "de228e92-ed45-4fe0-8e52-658cf366e962", "wwe-marketplace-main", "maskverse-marketplace", "dolly-marketplace", "eluvio-live-marketplace-sonark", "cirkay-marketplace", "eluvio-live-marketplace-fuudge", "oc-marketplace", "emp-marketplace", "microsoft", "indieflix-marketplace", "angels-airwaves-marketplace", "realcannonballrun-marketplace"]
|
|
30
|
+
__MARKETPLACE_ORDER: ["PREVIEW", "masked-singer-brazil-marketplace", "eluvio-live-marketplace-globo-taf", "de228e92-ed45-4fe0-8e52-658cf366e962", "wwe-marketplace-main", "maskverse-marketplace", "dolly-marketplace", "eluvio-live-marketplace-sonark", "cirkay-marketplace", "eluvio-live-marketplace-fuudge", "oc-marketplace", "emp-marketplace", "microsoft", "indieflix-marketplace", "angels-airwaves-marketplace", "realcannonballrun-marketplace"]
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// No production environment on demo
|
|
@@ -1517,6 +1517,16 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1517
1517
|
return ["constructor", "Authenticate", "AuthenticateOAuth", "AuthenticateExternalWallet", "AuthToken", "ClientAuthToken", "Initialize", "Log", "LogIn", "LogOut", "PersonalSign", "SetAuthorization", "SignMetamask"];
|
|
1518
1518
|
}
|
|
1519
1519
|
|
|
1520
|
+
// Used to generate AllowedWalletClientMethods for FrameClient
|
|
1521
|
+
// Note: Do not import ElvWalletClient in FrameClient directly
|
|
1522
|
+
}, {
|
|
1523
|
+
key: "AllowedMethods",
|
|
1524
|
+
value: function AllowedMethods() {
|
|
1525
|
+
return Object.getOwnPropertyNames(ElvWalletClient.prototype).filter(function (methodName) {
|
|
1526
|
+
return !ElvWalletClient.ForbiddenMethods().includes(methodName);
|
|
1527
|
+
}).sort();
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1520
1530
|
/**
|
|
1521
1531
|
* Initialize the wallet client.
|
|
1522
1532
|
*
|
package/package.json
CHANGED
package/src/FrameClient.js
CHANGED
|
@@ -3,7 +3,6 @@ const Utils = require("./Utils");
|
|
|
3
3
|
const permissionLevels = require("./client/ContentAccess").permissionLevels;
|
|
4
4
|
const {LogMessage} = require("./LogMessage");
|
|
5
5
|
const Crypto = require("./Crypto");
|
|
6
|
-
const { ElvWalletClient } = require("./walletClient/index");
|
|
7
6
|
|
|
8
7
|
class FrameClient {
|
|
9
8
|
Log(message, error = false) {
|
|
@@ -91,10 +90,8 @@ class FrameClient {
|
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
this.walletClient = {};
|
|
94
|
-
|
|
95
|
-
for(const methodName of
|
|
96
|
-
if(forbiddenMethods.includes(methodName)) { continue; }
|
|
97
|
-
|
|
93
|
+
// Dynamically defined wallet client methods defined in AllowedWalletClientMethods
|
|
94
|
+
for(const methodName of this.AllowedWalletClientMethods()) {
|
|
98
95
|
this.walletClient[methodName] = async (args) => {
|
|
99
96
|
let callback = args && args.callback;
|
|
100
97
|
if(callback) { delete args.callback; }
|
|
@@ -504,6 +501,76 @@ class FrameClient {
|
|
|
504
501
|
"WalletAddress"
|
|
505
502
|
];
|
|
506
503
|
}
|
|
504
|
+
|
|
505
|
+
AllowedWalletClientMethods() {
|
|
506
|
+
return [
|
|
507
|
+
"AcceptMarketplaceOffer",
|
|
508
|
+
"AddNotificationListener",
|
|
509
|
+
"AvailableMarketplaces",
|
|
510
|
+
"CanSign",
|
|
511
|
+
"CastVote",
|
|
512
|
+
"ClaimItem",
|
|
513
|
+
"ClaimStatus",
|
|
514
|
+
"CollectionRedemptionStatus",
|
|
515
|
+
"CreateListing",
|
|
516
|
+
"CreateMarketplaceOffer",
|
|
517
|
+
"DropStatus",
|
|
518
|
+
"ExchangeRate",
|
|
519
|
+
"FilteredQuery",
|
|
520
|
+
"LatestMarketplaceHash",
|
|
521
|
+
"Leaderboard",
|
|
522
|
+
"Listing",
|
|
523
|
+
"ListingAttributes",
|
|
524
|
+
"ListingEditionNames",
|
|
525
|
+
"ListingNames",
|
|
526
|
+
"ListingPurchaseStatus",
|
|
527
|
+
"ListingStats",
|
|
528
|
+
"ListingStatus",
|
|
529
|
+
"Listings",
|
|
530
|
+
"LoadAvailableMarketplaces",
|
|
531
|
+
"LoadDrop",
|
|
532
|
+
"LoadMarketplace",
|
|
533
|
+
"Marketplace",
|
|
534
|
+
"MarketplaceCSS",
|
|
535
|
+
"MarketplaceInfo",
|
|
536
|
+
"MarketplaceOffers",
|
|
537
|
+
"MarketplaceStock",
|
|
538
|
+
"MintingStatus",
|
|
539
|
+
"NFT",
|
|
540
|
+
"NFTContractStats",
|
|
541
|
+
"Notifications",
|
|
542
|
+
"PackOpenStatus",
|
|
543
|
+
"Profile",
|
|
544
|
+
"ProfileMetadata",
|
|
545
|
+
"PurchaseStatus",
|
|
546
|
+
"PushNotification",
|
|
547
|
+
"RejectMarketplaceOffer",
|
|
548
|
+
"RemoveListing",
|
|
549
|
+
"RemoveMarketplaceOffer",
|
|
550
|
+
"RemoveProfileMetadata",
|
|
551
|
+
"RevokeVote",
|
|
552
|
+
"Sales",
|
|
553
|
+
"SalesNames",
|
|
554
|
+
"SalesStats",
|
|
555
|
+
"SetProfileMetadata",
|
|
556
|
+
"SubmitDropVote",
|
|
557
|
+
"TenantConfiguration",
|
|
558
|
+
"TransferNFT",
|
|
559
|
+
"Transfers",
|
|
560
|
+
"UserAddress",
|
|
561
|
+
"UserInfo",
|
|
562
|
+
"UserItemAttributes",
|
|
563
|
+
"UserItemEditionNames",
|
|
564
|
+
"UserItemNames",
|
|
565
|
+
"UserItems",
|
|
566
|
+
"UserListings",
|
|
567
|
+
"UserNameToAddress",
|
|
568
|
+
"UserSales",
|
|
569
|
+
"UserTransfers",
|
|
570
|
+
"UserWalletBalance",
|
|
571
|
+
"VoteStatus"
|
|
572
|
+
];
|
|
573
|
+
}
|
|
507
574
|
}
|
|
508
575
|
|
|
509
576
|
const { UploadFiles } = require("./client/Files");
|
|
@@ -1099,10 +1099,14 @@ exports.LatestVersionHash = async function({objectId, versionHash}) {
|
|
|
1099
1099
|
} catch(error) {}
|
|
1100
1100
|
|
|
1101
1101
|
if(!latestHash) {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1102
|
+
let versionCount;
|
|
1103
|
+
try {
|
|
1104
|
+
versionCount = await this.CallContractMethod({
|
|
1105
|
+
contractAddress: this.utils.HashToAddress(objectId),
|
|
1106
|
+
methodName: "countVersionHashes"
|
|
1107
|
+
});
|
|
1108
|
+
// eslint-disable-next-line no-empty
|
|
1109
|
+
} catch(error) {}
|
|
1106
1110
|
|
|
1107
1111
|
if(!versionCount.toNumber()) {
|
|
1108
1112
|
throw Error(`Unable to determine latest version hash for ${versionHash || objectId} - Item deleted?`);
|
|
@@ -96,6 +96,14 @@ class ElvWalletClient {
|
|
|
96
96
|
];
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// Used to generate AllowedWalletClientMethods for FrameClient
|
|
100
|
+
// Note: Do not import ElvWalletClient in FrameClient directly
|
|
101
|
+
static AllowedMethods() {
|
|
102
|
+
return Object.getOwnPropertyNames(ElvWalletClient.prototype)
|
|
103
|
+
.filter(methodName => !ElvWalletClient.ForbiddenMethods().includes(methodName))
|
|
104
|
+
.sort();
|
|
105
|
+
}
|
|
106
|
+
|
|
99
107
|
/**
|
|
100
108
|
* Initialize the wallet client.
|
|
101
109
|
*
|
package/testScripts/Test.js
CHANGED
|
@@ -2,6 +2,7 @@ const { ElvClient } = require("../src/ElvClient");
|
|
|
2
2
|
const { ElvWalletClient } = require("../src/walletClient/index");
|
|
3
3
|
const ClientConfiguration = require("../TestConfiguration.json");
|
|
4
4
|
const fs = require("fs");
|
|
5
|
+
const HttpClient = require("../src/HttpClient");
|
|
5
6
|
|
|
6
7
|
const Test = async () => {
|
|
7
8
|
try {
|
|
@@ -15,6 +16,20 @@ const Test = async () => {
|
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
client.SetSigner({signer});
|
|
19
|
+
|
|
20
|
+
client.ToggleLogging(true);
|
|
21
|
+
const response = await client.CallContractMethod({
|
|
22
|
+
cacheContract: true,
|
|
23
|
+
contractAddress: "0xc4958836b7f883a02e9fedcc11f7ebbcc8c2d5bb",
|
|
24
|
+
formatAgruments: true,
|
|
25
|
+
methodArgs: [1],
|
|
26
|
+
methodName: "membersList",
|
|
27
|
+
overrideCachedContract: false,
|
|
28
|
+
overrides: {}
|
|
29
|
+
});
|
|
30
|
+
client.ToggleLogging(false);
|
|
31
|
+
|
|
32
|
+
console.log("response", response)
|
|
18
33
|
} catch(error) {
|
|
19
34
|
console.error(error);
|
|
20
35
|
console.error(JSON.stringify(error, null, 2));
|