@eluvio/elv-client-js 4.0.26 → 4.0.28

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.
@@ -1429,43 +1429,66 @@ var ElvClient = /*#__PURE__*/function () {
1429
1429
  }
1430
1430
  _context20.prev = 3;
1431
1431
  method = message.calledMethod;
1432
+ if (!(message.module === "walletClient")) {
1433
+ _context20.next = 15;
1434
+ break;
1435
+ }
1436
+ if (this.walletClient) {
1437
+ _context20.next = 8;
1438
+ break;
1439
+ }
1440
+ throw Error("Wallet client not set");
1441
+ case 8:
1442
+ if (!this.walletClient.ForbiddenMethods().includes(method)) {
1443
+ _context20.next = 10;
1444
+ break;
1445
+ }
1446
+ throw Error("Invalid user profile method: " + method);
1447
+ case 10:
1448
+ _context20.next = 12;
1449
+ return this.walletClient[method](message.args);
1450
+ case 12:
1451
+ methodResults = _context20.sent;
1452
+ _context20.next = 28;
1453
+ break;
1454
+ case 15:
1432
1455
  if (!(message.module === "userProfileClient")) {
1433
- _context20.next = 13;
1456
+ _context20.next = 23;
1434
1457
  break;
1435
1458
  }
1436
1459
  if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
1437
- _context20.next = 8;
1460
+ _context20.next = 18;
1438
1461
  break;
1439
1462
  }
1440
1463
  throw Error("Invalid user profile method: " + method);
1441
- case 8:
1442
- _context20.next = 10;
1464
+ case 18:
1465
+ _context20.next = 20;
1443
1466
  return this.userProfileClient[method](message.args);
1444
- case 10:
1467
+ case 20:
1445
1468
  methodResults = _context20.sent;
1446
- _context20.next = 18;
1469
+ _context20.next = 28;
1447
1470
  break;
1448
- case 13:
1471
+ case 23:
1449
1472
  if (this.FrameAllowedMethods().includes(method)) {
1450
- _context20.next = 15;
1473
+ _context20.next = 25;
1451
1474
  break;
1452
1475
  }
1453
1476
  throw Error("Invalid method: " + method);
1454
- case 15:
1455
- _context20.next = 17;
1477
+ case 25:
1478
+ _context20.next = 27;
1456
1479
  return this[method](message.args);
1457
- case 17:
1480
+ case 27:
1458
1481
  methodResults = _context20.sent;
1459
- case 18:
1482
+ case 28:
1460
1483
  Respond(this.utils.MakeClonable({
1461
1484
  type: "ElvFrameResponse",
1462
1485
  requestId: message.requestId,
1463
1486
  response: methodResults
1464
1487
  }));
1465
- _context20.next = 27;
1488
+ _context20.next = 37;
1466
1489
  break;
1467
- case 21:
1468
- _context20.prev = 21;
1490
+ case 31:
1491
+ _context20.prev = 31;
1469
1492
  _context20.t0 = _context20["catch"](3);
1470
1493
  // eslint-disable-next-line no-console
1471
1494
  this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context20.t0) === "object" ? JSON.stringify(_context20.t0, null, 2) : _context20.t0), true);
@@ -1478,11 +1501,11 @@ var ElvClient = /*#__PURE__*/function () {
1478
1501
  requestId: message.requestId,
1479
1502
  error: responseError
1480
1503
  }));
1481
- case 27:
1504
+ case 37:
1482
1505
  case "end":
1483
1506
  return _context20.stop();
1484
1507
  }
1485
- }, _callee20, this, [[3, 21]]);
1508
+ }, _callee20, this, [[3, 31]]);
1486
1509
  }));
1487
1510
  function CallFromFrameMessage(_x16, _x17) {
1488
1511
  return _CallFromFrameMessage.apply(this, arguments);
@@ -157,6 +157,53 @@ var FrameClient = /*#__PURE__*/function () {
157
157
  } finally {
158
158
  _iterator2.f();
159
159
  }
160
+ this.walletClient = {};
161
+ // Dynamically defined wallet client methods defined in AllowedWalletClientMethods
162
+ var _iterator3 = _createForOfIteratorHelper(this.AllowedWalletClientMethods()),
163
+ _step3;
164
+ try {
165
+ var _loop3 = function _loop3() {
166
+ var methodName = _step3.value;
167
+ _this.walletClient[methodName] = /*#__PURE__*/function () {
168
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(args) {
169
+ var callback;
170
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
171
+ while (1) switch (_context3.prev = _context3.next) {
172
+ case 0:
173
+ callback = args && args.callback;
174
+ if (callback) {
175
+ delete args.callback;
176
+ }
177
+ _context3.next = 4;
178
+ return _this.SendMessage({
179
+ options: {
180
+ module: "walletClient",
181
+ calledMethod: methodName,
182
+ args: _this.utils.MakeClonable(args)
183
+ },
184
+ callback: callback
185
+ });
186
+ case 4:
187
+ return _context3.abrupt("return", _context3.sent);
188
+ case 5:
189
+ case "end":
190
+ return _context3.stop();
191
+ }
192
+ }, _callee3);
193
+ }));
194
+ return function (_x3) {
195
+ return _ref4.apply(this, arguments);
196
+ };
197
+ }();
198
+ };
199
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
200
+ _loop3();
201
+ }
202
+ } catch (err) {
203
+ _iterator3.e(err);
204
+ } finally {
205
+ _iterator3.f();
206
+ }
160
207
  }
161
208
 
162
209
  /**
@@ -176,13 +223,13 @@ var FrameClient = /*#__PURE__*/function () {
176
223
  }, {
177
224
  key: "PassRequest",
178
225
  value: function () {
179
- var _PassRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
226
+ var _PassRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
180
227
  var request, Respond, response, error, callback;
181
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
182
- while (1) switch (_context3.prev = _context3.next) {
228
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
229
+ while (1) switch (_context4.prev = _context4.next) {
183
230
  case 0:
184
- request = _ref4.request, Respond = _ref4.Respond;
185
- _context3.prev = 1;
231
+ request = _ref5.request, Respond = _ref5.Respond;
232
+ _context4.prev = 1;
186
233
  if (request.callbackId) {
187
234
  callback = function callback(result) {
188
235
  return Respond({
@@ -192,21 +239,21 @@ var FrameClient = /*#__PURE__*/function () {
192
239
  });
193
240
  };
194
241
  }
195
- _context3.next = 5;
242
+ _context4.next = 5;
196
243
  return this.SendMessage({
197
244
  options: request,
198
245
  callback: callback
199
246
  });
200
247
  case 5:
201
- response = _context3.sent;
202
- _context3.next = 11;
248
+ response = _context4.sent;
249
+ _context4.next = 11;
203
250
  break;
204
251
  case 8:
205
- _context3.prev = 8;
206
- _context3.t0 = _context3["catch"](1);
207
- error = _context3.t0;
252
+ _context4.prev = 8;
253
+ _context4.t0 = _context4["catch"](1);
254
+ error = _context4.t0;
208
255
  case 11:
209
- return _context3.abrupt("return", {
256
+ return _context4.abrupt("return", {
210
257
  type: "ElvFrameResponse",
211
258
  requestId: request.requestId,
212
259
  response: response,
@@ -214,11 +261,11 @@ var FrameClient = /*#__PURE__*/function () {
214
261
  });
215
262
  case 12:
216
263
  case "end":
217
- return _context3.stop();
264
+ return _context4.stop();
218
265
  }
219
- }, _callee3, this, [[1, 8]]);
266
+ }, _callee4, this, [[1, 8]]);
220
267
  }));
221
- function PassRequest(_x3) {
268
+ function PassRequest(_x4) {
222
269
  return _PassRequest.apply(this, arguments);
223
270
  }
224
271
  return PassRequest;
@@ -226,12 +273,12 @@ var FrameClient = /*#__PURE__*/function () {
226
273
  }, {
227
274
  key: "SendMessage",
228
275
  value: function () {
229
- var _SendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
230
- var _ref5$options, options, callback, _ref5$noResponse, noResponse, requestId, callbackId, operation, isFileOperation, timeout;
231
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
232
- while (1) switch (_context4.prev = _context4.next) {
276
+ var _SendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref6) {
277
+ var _ref6$options, options, callback, _ref6$noResponse, noResponse, requestId, callbackId, operation, isFileOperation, timeout;
278
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
279
+ while (1) switch (_context5.prev = _context5.next) {
233
280
  case 0:
234
- _ref5$options = _ref5.options, options = _ref5$options === void 0 ? {} : _ref5$options, callback = _ref5.callback, _ref5$noResponse = _ref5.noResponse, noResponse = _ref5$noResponse === void 0 ? false : _ref5$noResponse;
281
+ _ref6$options = _ref6.options, options = _ref6$options === void 0 ? {} : _ref6$options, callback = _ref6.callback, _ref6$noResponse = _ref6.noResponse, noResponse = _ref6$noResponse === void 0 ? false : _ref6$noResponse;
235
282
  requestId = Id.next();
236
283
  if (callback) {
237
284
  callbackId = Id.next();
@@ -244,10 +291,10 @@ var FrameClient = /*#__PURE__*/function () {
244
291
 
245
292
  // No timeout for prompted methods
246
293
  if (!noResponse) {
247
- _context4.next = 6;
294
+ _context5.next = 6;
248
295
  break;
249
296
  }
250
- return _context4.abrupt("return");
297
+ return _context5.abrupt("return");
251
298
  case 6:
252
299
  operation = options.calledMethod || options.operation;
253
300
  isFileOperation = FrameClient.FileMethods().includes(options.calledMethod);
@@ -257,17 +304,17 @@ var FrameClient = /*#__PURE__*/function () {
257
304
  } else if (options.args && options.args.fcTimeout) {
258
305
  timeout = options.args.fcTimeout;
259
306
  }
260
- _context4.next = 12;
307
+ _context5.next = 12;
261
308
  return this.AwaitMessage(requestId, timeout, callback, callbackId, operation);
262
309
  case 12:
263
- return _context4.abrupt("return", _context4.sent);
310
+ return _context5.abrupt("return", _context5.sent);
264
311
  case 13:
265
312
  case "end":
266
- return _context4.stop();
313
+ return _context5.stop();
267
314
  }
268
- }, _callee4, this);
315
+ }, _callee5, this);
269
316
  }));
270
- function SendMessage(_x4) {
317
+ function SendMessage(_x5) {
271
318
  return _SendMessage.apply(this, arguments);
272
319
  }
273
320
  return SendMessage;
@@ -275,11 +322,11 @@ var FrameClient = /*#__PURE__*/function () {
275
322
  }, {
276
323
  key: "AwaitMessage",
277
324
  value: function () {
278
- var _AwaitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(requestId, timeout, callback, callbackId, operation) {
279
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
280
- while (1) switch (_context6.prev = _context6.next) {
325
+ var _AwaitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(requestId, timeout, callback, callbackId, operation) {
326
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
327
+ while (1) switch (_context7.prev = _context7.next) {
281
328
  case 0:
282
- _context6.next = 2;
329
+ _context7.next = 2;
283
330
  return new Promise(function (resolve, reject) {
284
331
  var methodListener;
285
332
 
@@ -323,18 +370,18 @@ var FrameClient = /*#__PURE__*/function () {
323
370
 
324
371
  // Set up final method response listener
325
372
  methodListener = /*#__PURE__*/function () {
326
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(event) {
373
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(event) {
327
374
  var message;
328
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
329
- while (1) switch (_context5.prev = _context5.next) {
375
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
376
+ while (1) switch (_context6.prev = _context6.next) {
330
377
  case 0:
331
- _context5.prev = 0;
378
+ _context6.prev = 0;
332
379
  message = event.data;
333
380
  if (!(message.type !== "ElvFrameResponse" || message.requestId !== requestId)) {
334
- _context5.next = 4;
381
+ _context6.next = 4;
335
382
  break;
336
383
  }
337
- return _context5.abrupt("return");
384
+ return _context6.abrupt("return");
338
385
  case 4:
339
386
  clearTimeout(timeoutId);
340
387
  window.removeEventListener("message", methodListener);
@@ -346,25 +393,25 @@ var FrameClient = /*#__PURE__*/function () {
346
393
  } else {
347
394
  resolve(message.response);
348
395
  }
349
- _context5.next = 16;
396
+ _context6.next = 16;
350
397
  break;
351
398
  case 10:
352
- _context5.prev = 10;
353
- _context5.t0 = _context5["catch"](0);
399
+ _context6.prev = 10;
400
+ _context6.t0 = _context6["catch"](0);
354
401
  clearTimeout(timeoutId);
355
402
  window.removeEventListener("message", methodListener);
356
403
  if (callbackListener) {
357
404
  window.removeEventListener("message", callbackListener);
358
405
  }
359
- reject(_context5.t0);
406
+ reject(_context6.t0);
360
407
  case 16:
361
408
  case "end":
362
- return _context5.stop();
409
+ return _context6.stop();
363
410
  }
364
- }, _callee5, null, [[0, 10]]);
411
+ }, _callee6, null, [[0, 10]]);
365
412
  }));
366
- return function methodListener(_x10) {
367
- return _ref6.apply(this, arguments);
413
+ return function methodListener(_x11) {
414
+ return _ref7.apply(this, arguments);
368
415
  };
369
416
  }();
370
417
 
@@ -373,14 +420,14 @@ var FrameClient = /*#__PURE__*/function () {
373
420
  window.addEventListener("message", methodListener);
374
421
  });
375
422
  case 2:
376
- return _context6.abrupt("return", _context6.sent);
423
+ return _context7.abrupt("return", _context7.sent);
377
424
  case 3:
378
425
  case "end":
379
- return _context6.stop();
426
+ return _context7.stop();
380
427
  }
381
- }, _callee6);
428
+ }, _callee7);
382
429
  }));
383
- function AwaitMessage(_x5, _x6, _x7, _x8, _x9) {
430
+ function AwaitMessage(_x6, _x7, _x8, _x9, _x10) {
384
431
  return _AwaitMessage.apply(this, arguments);
385
432
  }
386
433
  return AwaitMessage;
@@ -409,6 +456,11 @@ var FrameClient = /*#__PURE__*/function () {
409
456
  value: function AllowedUserProfileMethods() {
410
457
  return ["AccessLevel", "CollectedTags", "CreateWallet", "DeleteUserMetadata", "MergeUserMetadata", "PublicUserMetadata", "ReplaceUserMetadata", "TenantId", "UserMetadata", "UserProfileImage", "UserWalletAddress", "UserWalletObjectInfo", "WalletAddress"];
411
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
+ }
412
464
  }], [{
413
465
  key: "PromptedMethods",
414
466
  value: function PromptedMethods() {
@@ -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
@@ -75,6 +75,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
75
75
  this.cachedMarketplaces = {};
76
76
  this.cachedCSS = {};
77
77
  this.utils = client.utils;
78
+ this.ForbiddenMethods = ElvWalletClient.ForbiddenMethods;
78
79
  }
79
80
  _createClass(ElvWalletClient, [{
80
81
  key: "Log",
@@ -94,23 +95,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
94
95
  }
95
96
  }
96
97
 
97
- /**
98
- * Initialize the wallet client.
99
- *
100
- * Specify tenantSlug and marketplaceSlug to automatically associate this tenant with a particular marketplace.
101
- *
102
- *
103
- * @methodGroup Initialization
104
- * @namedParams
105
- * @param {string} appId - A string identifying your app. This is used for namespacing user profile data.
106
- * @param {string} network=main - Name of the Fabric network to use (`main`, `demo`)
107
- * @param {string} mode=production - Environment to use (`production`, `staging`)
108
- * @param {Object=} marketplaceParams - Marketplace parameters
109
- * @param {boolean=} storeAuthToken=true - If specified, auth tokens will be stored in localstorage (if available)
110
- * @param {Object=} client - Existing instance of ElvClient to use instead of initializing a new one
111
- *
112
- * @returns {Promise<ElvWalletClient>}
113
- */
98
+ // Methods forbidden from usage by FrameClient
114
99
  }, {
115
100
  key: "CanSign",
116
101
  value: /* Login and authorization */
@@ -1527,14 +1512,47 @@ var ElvWalletClient = /*#__PURE__*/function () {
1527
1512
  return MintingStatus;
1528
1513
  }()
1529
1514
  }], [{
1515
+ key: "ForbiddenMethods",
1516
+ value: function ForbiddenMethods() {
1517
+ return ["constructor", "Authenticate", "AuthenticateOAuth", "AuthenticateExternalWallet", "AuthToken", "ClientAuthToken", "Initialize", "Log", "LogIn", "LogOut", "PersonalSign", "SetAuthorization", "SignMetamask"];
1518
+ }
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
+
1530
+ /**
1531
+ * Initialize the wallet client.
1532
+ *
1533
+ * Specify tenantSlug and marketplaceSlug to automatically associate this tenant with a particular marketplace.
1534
+ *
1535
+ *
1536
+ * @methodGroup Initialization
1537
+ * @namedParams
1538
+ * @param {string} appId - A string identifying your app. This is used for namespacing user profile data.
1539
+ * @param {string} network=main - Name of the Fabric network to use (`main`, `demo`)
1540
+ * @param {string} mode=production - Environment to use (`production`, `staging`)
1541
+ * @param {Object=} marketplaceParams - Marketplace parameters
1542
+ * @param {boolean=} storeAuthToken=true - If specified, auth tokens will be stored in localstorage (if available)
1543
+ * @param {Object=} client - Existing instance of ElvClient to use instead of initializing a new one
1544
+ *
1545
+ * @returns {Promise<ElvWalletClient>}
1546
+ */
1547
+ }, {
1530
1548
  key: "Initialize",
1531
1549
  value: function () {
1532
1550
  var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref18) {
1533
- var client, _ref18$appId, appId, _ref18$network, network, _ref18$mode, mode, localization, marketplaceParams, previewMarketplaceId, _ref18$storeAuthToken, storeAuthToken, _ref19, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
1551
+ var client, _ref18$appId, appId, _ref18$network, network, _ref18$mode, mode, localization, marketplaceParams, previewMarketplaceId, _ref18$storeAuthToken, storeAuthToken, _ref18$skipMarketplac, skipMarketplaceLoad, _ref19, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
1534
1552
  return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1535
1553
  while (1) switch (_context18.prev = _context18.next) {
1536
1554
  case 0:
1537
- client = _ref18.client, _ref18$appId = _ref18.appId, appId = _ref18$appId === void 0 ? "general" : _ref18$appId, _ref18$network = _ref18.network, network = _ref18$network === void 0 ? "main" : _ref18$network, _ref18$mode = _ref18.mode, mode = _ref18$mode === void 0 ? "production" : _ref18$mode, localization = _ref18.localization, marketplaceParams = _ref18.marketplaceParams, previewMarketplaceId = _ref18.previewMarketplaceId, _ref18$storeAuthToken = _ref18.storeAuthToken, storeAuthToken = _ref18$storeAuthToken === void 0 ? true : _ref18$storeAuthToken;
1555
+ client = _ref18.client, _ref18$appId = _ref18.appId, appId = _ref18$appId === void 0 ? "general" : _ref18$appId, _ref18$network = _ref18.network, network = _ref18$network === void 0 ? "main" : _ref18$network, _ref18$mode = _ref18.mode, mode = _ref18$mode === void 0 ? "production" : _ref18$mode, localization = _ref18.localization, marketplaceParams = _ref18.marketplaceParams, previewMarketplaceId = _ref18.previewMarketplaceId, _ref18$storeAuthToken = _ref18.storeAuthToken, storeAuthToken = _ref18$storeAuthToken === void 0 ? true : _ref18$storeAuthToken, _ref18$skipMarketplac = _ref18.skipMarketplaceLoad, skipMarketplaceLoad = _ref18$skipMarketplac === void 0 ? false : _ref18$skipMarketplac;
1538
1556
  _ref19 = marketplaceParams || {}, tenantSlug = _ref19.tenantSlug, marketplaceSlug = _ref19.marketplaceSlug, marketplaceId = _ref19.marketplaceId, marketplaceHash = _ref19.marketplaceHash;
1539
1557
  if (Configuration[network]) {
1540
1558
  _context18.next = 6;
@@ -1628,11 +1646,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
1628
1646
  _context18.prev = 35;
1629
1647
  _context18.t0 = _context18["catch"](28);
1630
1648
  case 37:
1631
- _context18.next = 39;
1649
+ if (skipMarketplaceLoad) {
1650
+ _context18.next = 40;
1651
+ break;
1652
+ }
1653
+ _context18.next = 40;
1632
1654
  return walletClient.LoadAvailableMarketplaces();
1633
- case 39:
1634
- return _context18.abrupt("return", walletClient);
1635
1655
  case 40:
1656
+ return _context18.abrupt("return", walletClient);
1657
+ case 41:
1636
1658
  case "end":
1637
1659
  return _context18.stop();
1638
1660
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.26",
3
+ "version": "4.0.28",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
package/src/ElvClient.js CHANGED
@@ -1134,7 +1134,17 @@ class ElvClient {
1134
1134
  const method = message.calledMethod;
1135
1135
 
1136
1136
  let methodResults;
1137
- if(message.module === "userProfileClient") {
1137
+ if(message.module === "walletClient") {
1138
+ if(!this.walletClient) {
1139
+ throw Error("Wallet client not set");
1140
+ }
1141
+
1142
+ if(this.walletClient.ForbiddenMethods().includes(method)) {
1143
+ throw Error("Invalid user profile method: " + method);
1144
+ }
1145
+
1146
+ methodResults = await this.walletClient[method](message.args);
1147
+ } else if(message.module === "userProfileClient") {
1138
1148
  if(!this.userProfileClient.FrameAllowedMethods().includes(method)) {
1139
1149
  throw Error("Invalid user profile method: " + method);
1140
1150
  }
@@ -88,6 +88,24 @@ class FrameClient {
88
88
  });
89
89
  };
90
90
  }
91
+
92
+ this.walletClient = {};
93
+ // Dynamically defined wallet client methods defined in AllowedWalletClientMethods
94
+ for(const methodName of this.AllowedWalletClientMethods()) {
95
+ this.walletClient[methodName] = async (args) => {
96
+ let callback = args && args.callback;
97
+ if(callback) { delete args.callback; }
98
+
99
+ return await this.SendMessage({
100
+ options: {
101
+ module: "walletClient",
102
+ calledMethod: methodName,
103
+ args: this.utils.MakeClonable(args)
104
+ },
105
+ callback
106
+ });
107
+ };
108
+ }
91
109
  }
92
110
 
93
111
  /**
@@ -483,6 +501,76 @@ class FrameClient {
483
501
  "WalletAddress"
484
502
  ];
485
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
+ }
486
574
  }
487
575
 
488
576
  const { UploadFiles } = require("./client/Files");
@@ -30,6 +30,7 @@ let WalletConfiguration = {
30
30
  __MARKETPLACE_ORDER: [
31
31
  "PREVIEW",
32
32
  "masked-singer-brazil-marketplace",
33
+ "eluvio-live-marketplace-globo-taf",
33
34
  "de228e92-ed45-4fe0-8e52-658cf366e962",
34
35
  "wwe-marketplace-main",
35
36
  "maskverse-marketplace",