@eluvio/elv-client-js 4.0.29 → 4.0.31

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.
@@ -1891,7 +1891,7 @@ exports.LatestVersionHash = /*#__PURE__*/function () {
1891
1891
  _context27.prev = 18;
1892
1892
  _context27.t1 = _context27["catch"](12);
1893
1893
  case 20:
1894
- if (versionCount.toNumber()) {
1894
+ if (!(!versionCount || !versionCount.toNumber())) {
1895
1895
  _context27.next = 22;
1896
1896
  break;
1897
1897
  }
@@ -2087,16 +2087,68 @@ exports.CollectionRedemptionStatus = /*#__PURE__*/function () {
2087
2087
  };
2088
2088
  }();
2089
2089
 
2090
+ /**
2091
+ * Return status of the specified redeemable offer
2092
+ *
2093
+ * @methodGroup Status
2094
+ * @namedParams
2095
+ * @param {string=} tenantId - ID of the tenant for this NFT (not required if `marketplaceParams` is specified)
2096
+ * @param {Object=} marketplaceParams - Parameters of the marketplace for this NFT (not required if `tenantId` is specified)
2097
+ * @param {string} contractAddress - The address of the NFT contract
2098
+ * @param {string} tokenId - The token ID of the NFT
2099
+ * @param {string} offerId - The ID of the offer
2100
+ *
2101
+ * @returns {Promise<Object>} - The status of the offer redemption
2102
+ */
2103
+ exports.RedeemableOfferStatus = /*#__PURE__*/function () {
2104
+ var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(_ref75) {
2105
+ var tenantId, marketplaceParams, contractAddress, tokenId, offerId, statuses;
2106
+ return _regeneratorRuntime.wrap(function _callee38$(_context38) {
2107
+ while (1) switch (_context38.prev = _context38.next) {
2108
+ case 0:
2109
+ tenantId = _ref75.tenantId, marketplaceParams = _ref75.marketplaceParams, contractAddress = _ref75.contractAddress, tokenId = _ref75.tokenId, offerId = _ref75.offerId;
2110
+ _context38.prev = 1;
2111
+ _context38.next = 4;
2112
+ return this.MintingStatus({
2113
+ marketplaceParams: marketplaceParams,
2114
+ tenantId: tenantId
2115
+ });
2116
+ case 4:
2117
+ statuses = _context38.sent;
2118
+ contractAddress = Utils.FormatAddress(contractAddress);
2119
+ return _context38.abrupt("return", statuses.find(function (status) {
2120
+ return status.op === "nft-offer-redeem" && Utils.EqualAddress(status.address, contractAddress) && status.tokenId === (tokenId || "").toString() && status.extra && typeof status.extra[0] !== "undefined" && status.extra[0].toString() === (offerId || "").toString();
2121
+ }) || {
2122
+ status: "none"
2123
+ });
2124
+ case 9:
2125
+ _context38.prev = 9;
2126
+ _context38.t0 = _context38["catch"](1);
2127
+ this.Log(_context38.t0, true);
2128
+ return _context38.abrupt("return", {
2129
+ status: "unknown"
2130
+ });
2131
+ case 13:
2132
+ case "end":
2133
+ return _context38.stop();
2134
+ }
2135
+ }, _callee38, this, [[1, 9]]);
2136
+ }));
2137
+ return function (_x24) {
2138
+ return _ref76.apply(this, arguments);
2139
+ };
2140
+ }();
2141
+
2090
2142
  /* EVENTS */
2091
2143
 
2092
2144
  exports.LoadDrop = /*#__PURE__*/function () {
2093
- var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(_ref75) {
2145
+ var _ref78 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(_ref77) {
2094
2146
  var _this = this;
2095
2147
  var tenantSlug, eventSlug, dropId, event, eventId;
2096
- return _regeneratorRuntime.wrap(function _callee38$(_context38) {
2097
- while (1) switch (_context38.prev = _context38.next) {
2148
+ return _regeneratorRuntime.wrap(function _callee39$(_context39) {
2149
+ while (1) switch (_context39.prev = _context39.next) {
2098
2150
  case 0:
2099
- tenantSlug = _ref75.tenantSlug, eventSlug = _ref75.eventSlug, dropId = _ref75.dropId;
2151
+ tenantSlug = _ref77.tenantSlug, eventSlug = _ref77.eventSlug, dropId = _ref77.dropId;
2100
2152
  if (!this.drops) {
2101
2153
  this.drops = {};
2102
2154
  }
@@ -2107,10 +2159,10 @@ exports.LoadDrop = /*#__PURE__*/function () {
2107
2159
  this.drops[tenantSlug][eventSlug] = {};
2108
2160
  }
2109
2161
  if (this.drops[tenantSlug][eventSlug][dropId]) {
2110
- _context38.next = 13;
2162
+ _context39.next = 13;
2111
2163
  break;
2112
2164
  }
2113
- _context38.next = 7;
2165
+ _context39.next = 7;
2114
2166
  return this.client.ContentObjectMetadata({
2115
2167
  libraryId: this.mainSiteLibraryId,
2116
2168
  objectId: this.mainSiteId,
@@ -2123,14 +2175,14 @@ exports.LoadDrop = /*#__PURE__*/function () {
2123
2175
  noAuth: true
2124
2176
  });
2125
2177
  case 7:
2126
- _context38.t0 = _context38.sent;
2127
- if (_context38.t0) {
2128
- _context38.next = 10;
2178
+ _context39.t0 = _context39.sent;
2179
+ if (_context39.t0) {
2180
+ _context39.next = 10;
2129
2181
  break;
2130
2182
  }
2131
- _context38.t0 = [];
2183
+ _context39.t0 = [];
2132
2184
  case 10:
2133
- event = _context38.t0;
2185
+ event = _context39.t0;
2134
2186
  eventId = Utils.DecodeVersionHash(event["."].source).objectId;
2135
2187
  event.drops.forEach(function (drop) {
2136
2188
  drop = _objectSpread(_objectSpread({}, drop), {}, {
@@ -2140,31 +2192,31 @@ exports.LoadDrop = /*#__PURE__*/function () {
2140
2192
  _this.drops[drop.uuid] = drop;
2141
2193
  });
2142
2194
  case 13:
2143
- return _context38.abrupt("return", this.drops[dropId]);
2195
+ return _context39.abrupt("return", this.drops[dropId]);
2144
2196
  case 14:
2145
2197
  case "end":
2146
- return _context38.stop();
2198
+ return _context39.stop();
2147
2199
  }
2148
- }, _callee38, this);
2200
+ }, _callee39, this);
2149
2201
  }));
2150
- return function (_x24) {
2151
- return _ref76.apply(this, arguments);
2202
+ return function (_x25) {
2203
+ return _ref78.apply(this, arguments);
2152
2204
  };
2153
2205
  }();
2154
2206
  exports.SubmitDropVote = /*#__PURE__*/function () {
2155
- var _ref78 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(_ref77) {
2207
+ var _ref80 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(_ref79) {
2156
2208
  var marketplaceParams, eventId, dropId, sku, marketplaceInfo;
2157
- return _regeneratorRuntime.wrap(function _callee39$(_context39) {
2158
- while (1) switch (_context39.prev = _context39.next) {
2209
+ return _regeneratorRuntime.wrap(function _callee40$(_context40) {
2210
+ while (1) switch (_context40.prev = _context40.next) {
2159
2211
  case 0:
2160
- marketplaceParams = _ref77.marketplaceParams, eventId = _ref77.eventId, dropId = _ref77.dropId, sku = _ref77.sku;
2161
- _context39.next = 3;
2212
+ marketplaceParams = _ref79.marketplaceParams, eventId = _ref79.eventId, dropId = _ref79.dropId, sku = _ref79.sku;
2213
+ _context40.next = 3;
2162
2214
  return this.MarketplaceInfo({
2163
2215
  marketplaceParams: marketplaceParams
2164
2216
  });
2165
2217
  case 3:
2166
- marketplaceInfo = _context39.sent;
2167
- _context39.next = 6;
2218
+ marketplaceInfo = _context40.sent;
2219
+ _context40.next = 6;
2168
2220
  return this.client.authClient.MakeAuthServiceRequest({
2169
2221
  path: UrlJoin("as", "wlt", "act", marketplaceInfo.tenant_id),
2170
2222
  method: "POST",
@@ -2180,23 +2232,23 @@ exports.SubmitDropVote = /*#__PURE__*/function () {
2180
2232
  });
2181
2233
  case 6:
2182
2234
  case "end":
2183
- return _context39.stop();
2235
+ return _context40.stop();
2184
2236
  }
2185
- }, _callee39, this);
2237
+ }, _callee40, this);
2186
2238
  }));
2187
- return function (_x25) {
2188
- return _ref78.apply(this, arguments);
2239
+ return function (_x26) {
2240
+ return _ref80.apply(this, arguments);
2189
2241
  };
2190
2242
  }();
2191
2243
  exports.DropStatus = /*#__PURE__*/function () {
2192
- var _ref80 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(_ref79) {
2244
+ var _ref82 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(_ref81) {
2193
2245
  var marketplace, eventId, dropId, response;
2194
- return _regeneratorRuntime.wrap(function _callee40$(_context40) {
2195
- while (1) switch (_context40.prev = _context40.next) {
2246
+ return _regeneratorRuntime.wrap(function _callee41$(_context41) {
2247
+ while (1) switch (_context41.prev = _context41.next) {
2196
2248
  case 0:
2197
- marketplace = _ref79.marketplace, eventId = _ref79.eventId, dropId = _ref79.dropId;
2198
- _context40.prev = 1;
2199
- _context40.next = 4;
2249
+ marketplace = _ref81.marketplace, eventId = _ref81.eventId, dropId = _ref81.dropId;
2250
+ _context41.prev = 1;
2251
+ _context41.next = 4;
2200
2252
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
2201
2253
  path: UrlJoin("as", "wlt", "act", marketplace.tenant_id, eventId, dropId),
2202
2254
  method: "GET",
@@ -2205,25 +2257,25 @@ exports.DropStatus = /*#__PURE__*/function () {
2205
2257
  }
2206
2258
  }));
2207
2259
  case 4:
2208
- response = _context40.sent;
2209
- return _context40.abrupt("return", response.sort(function (a, b) {
2260
+ response = _context41.sent;
2261
+ return _context41.abrupt("return", response.sort(function (a, b) {
2210
2262
  return a.ts > b.ts ? 1 : -1;
2211
2263
  })[0] || {
2212
2264
  status: "none"
2213
2265
  });
2214
2266
  case 8:
2215
- _context40.prev = 8;
2216
- _context40.t0 = _context40["catch"](1);
2217
- this.Log(_context40.t0, true);
2218
- return _context40.abrupt("return", "");
2267
+ _context41.prev = 8;
2268
+ _context41.t0 = _context41["catch"](1);
2269
+ this.Log(_context41.t0, true);
2270
+ return _context41.abrupt("return", "");
2219
2271
  case 12:
2220
2272
  case "end":
2221
- return _context40.stop();
2273
+ return _context41.stop();
2222
2274
  }
2223
- }, _callee40, this, [[1, 8]]);
2275
+ }, _callee41, this, [[1, 8]]);
2224
2276
  }));
2225
- return function (_x26) {
2226
- return _ref80.apply(this, arguments);
2277
+ return function (_x27) {
2278
+ return _ref82.apply(this, arguments);
2227
2279
  };
2228
2280
  }();
2229
2281
 
@@ -2245,12 +2297,12 @@ exports.DropStatus = /*#__PURE__*/function () {
2245
2297
  * @returns {Promise<Array<Object>>} - Offers matching the specified filters
2246
2298
  */
2247
2299
  exports.MarketplaceOffers = /*#__PURE__*/function () {
2248
- var _ref82 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(_ref81) {
2249
- var contractAddress, tokenId, buyerAddress, sellerAddress, statuses, _ref81$start, start, _ref81$limit, limit, path, queryParams, offers;
2250
- return _regeneratorRuntime.wrap(function _callee41$(_context41) {
2251
- while (1) switch (_context41.prev = _context41.next) {
2300
+ var _ref84 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(_ref83) {
2301
+ var contractAddress, tokenId, buyerAddress, sellerAddress, statuses, _ref83$start, start, _ref83$limit, limit, path, queryParams, offers;
2302
+ return _regeneratorRuntime.wrap(function _callee42$(_context42) {
2303
+ while (1) switch (_context42.prev = _context42.next) {
2252
2304
  case 0:
2253
- contractAddress = _ref81.contractAddress, tokenId = _ref81.tokenId, buyerAddress = _ref81.buyerAddress, sellerAddress = _ref81.sellerAddress, statuses = _ref81.statuses, _ref81$start = _ref81.start, start = _ref81$start === void 0 ? 0 : _ref81$start, _ref81$limit = _ref81.limit, limit = _ref81$limit === void 0 ? 10 : _ref81$limit;
2305
+ contractAddress = _ref83.contractAddress, tokenId = _ref83.tokenId, buyerAddress = _ref83.buyerAddress, sellerAddress = _ref83.sellerAddress, statuses = _ref83.statuses, _ref83$start = _ref83.start, start = _ref83$start === void 0 ? 0 : _ref83$start, _ref83$limit = _ref83.limit, limit = _ref83$limit === void 0 ? 10 : _ref83$limit;
2254
2306
  path = UrlJoin("as", "mkt", "offers", "ls");
2255
2307
  if (buyerAddress) {
2256
2308
  path = UrlJoin(path, "b", Utils.FormatAddress(buyerAddress));
@@ -2270,15 +2322,15 @@ exports.MarketplaceOffers = /*#__PURE__*/function () {
2270
2322
  if (statuses && statuses.length > 0) {
2271
2323
  queryParams.include = statuses.join(",");
2272
2324
  }
2273
- _context41.next = 8;
2325
+ _context42.next = 8;
2274
2326
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
2275
2327
  path: path,
2276
2328
  method: "GET",
2277
2329
  queryParams: queryParams
2278
2330
  }));
2279
2331
  case 8:
2280
- offers = _context41.sent;
2281
- return _context41.abrupt("return", offers.map(function (offer) {
2332
+ offers = _context42.sent;
2333
+ return _context42.abrupt("return", offers.map(function (offer) {
2282
2334
  return _objectSpread(_objectSpread({}, offer), {}, {
2283
2335
  created: offer.created * 1000,
2284
2336
  updated: offer.updated * 1000,
@@ -2287,12 +2339,12 @@ exports.MarketplaceOffers = /*#__PURE__*/function () {
2287
2339
  }));
2288
2340
  case 10:
2289
2341
  case "end":
2290
- return _context41.stop();
2342
+ return _context42.stop();
2291
2343
  }
2292
- }, _callee41, this);
2344
+ }, _callee42, this);
2293
2345
  }));
2294
- return function (_x27) {
2295
- return _ref82.apply(this, arguments);
2346
+ return function (_x28) {
2347
+ return _ref84.apply(this, arguments);
2296
2348
  };
2297
2349
  }();
2298
2350
 
@@ -2312,17 +2364,17 @@ exports.MarketplaceOffers = /*#__PURE__*/function () {
2312
2364
  * @returns {Promise<Object>} - Info about the created/updated offer
2313
2365
  */
2314
2366
  exports.CreateMarketplaceOffer = /*#__PURE__*/function () {
2315
- var _ref84 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(_ref83) {
2367
+ var _ref86 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(_ref85) {
2316
2368
  var contractAddress, tokenId, offerId, price, expiresAt, response;
2317
- return _regeneratorRuntime.wrap(function _callee42$(_context42) {
2318
- while (1) switch (_context42.prev = _context42.next) {
2369
+ return _regeneratorRuntime.wrap(function _callee43$(_context43) {
2370
+ while (1) switch (_context43.prev = _context43.next) {
2319
2371
  case 0:
2320
- contractAddress = _ref83.contractAddress, tokenId = _ref83.tokenId, offerId = _ref83.offerId, price = _ref83.price, expiresAt = _ref83.expiresAt;
2372
+ contractAddress = _ref85.contractAddress, tokenId = _ref85.tokenId, offerId = _ref85.offerId, price = _ref85.price, expiresAt = _ref85.expiresAt;
2321
2373
  if (!offerId) {
2322
- _context42.next = 7;
2374
+ _context43.next = 7;
2323
2375
  break;
2324
2376
  }
2325
- _context42.next = 4;
2377
+ _context43.next = 4;
2326
2378
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
2327
2379
  path: UrlJoin("as", "wlt", "mkt", "offers", offerId),
2328
2380
  method: "PUT",
@@ -2335,11 +2387,11 @@ exports.CreateMarketplaceOffer = /*#__PURE__*/function () {
2335
2387
  }
2336
2388
  }));
2337
2389
  case 4:
2338
- response = _context42.sent;
2339
- _context42.next = 10;
2390
+ response = _context43.sent;
2391
+ _context43.next = 10;
2340
2392
  break;
2341
2393
  case 7:
2342
- _context42.next = 9;
2394
+ _context43.next = 9;
2343
2395
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
2344
2396
  path: UrlJoin("as", "wlt", "mkt", "offers", contractAddress, tokenId),
2345
2397
  method: "POST",
@@ -2354,17 +2406,17 @@ exports.CreateMarketplaceOffer = /*#__PURE__*/function () {
2354
2406
  }
2355
2407
  }));
2356
2408
  case 9:
2357
- response = _context42.sent;
2409
+ response = _context43.sent;
2358
2410
  case 10:
2359
- return _context42.abrupt("return", response.offer_id);
2411
+ return _context43.abrupt("return", response.offer_id);
2360
2412
  case 11:
2361
2413
  case "end":
2362
- return _context42.stop();
2414
+ return _context43.stop();
2363
2415
  }
2364
- }, _callee42, this);
2416
+ }, _callee43, this);
2365
2417
  }));
2366
- return function (_x28) {
2367
- return _ref84.apply(this, arguments);
2418
+ return function (_x29) {
2419
+ return _ref86.apply(this, arguments);
2368
2420
  };
2369
2421
  }();
2370
2422
 
@@ -2378,13 +2430,13 @@ exports.CreateMarketplaceOffer = /*#__PURE__*/function () {
2378
2430
  * @param {string} offerId - The ID of the offer
2379
2431
  */
2380
2432
  exports.RemoveMarketplaceOffer = /*#__PURE__*/function () {
2381
- var _ref86 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(_ref85) {
2433
+ var _ref88 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(_ref87) {
2382
2434
  var offerId;
2383
- return _regeneratorRuntime.wrap(function _callee43$(_context43) {
2384
- while (1) switch (_context43.prev = _context43.next) {
2435
+ return _regeneratorRuntime.wrap(function _callee44$(_context44) {
2436
+ while (1) switch (_context44.prev = _context44.next) {
2385
2437
  case 0:
2386
- offerId = _ref85.offerId;
2387
- _context43.next = 3;
2438
+ offerId = _ref87.offerId;
2439
+ _context44.next = 3;
2388
2440
  return this.client.authClient.MakeAuthServiceRequest({
2389
2441
  path: UrlJoin("as", "wlt", "mkt", "offers", offerId),
2390
2442
  method: "DELETE",
@@ -2393,15 +2445,15 @@ exports.RemoveMarketplaceOffer = /*#__PURE__*/function () {
2393
2445
  }
2394
2446
  });
2395
2447
  case 3:
2396
- return _context43.abrupt("return", _context43.sent);
2448
+ return _context44.abrupt("return", _context44.sent);
2397
2449
  case 4:
2398
2450
  case "end":
2399
- return _context43.stop();
2451
+ return _context44.stop();
2400
2452
  }
2401
- }, _callee43, this);
2453
+ }, _callee44, this);
2402
2454
  }));
2403
- return function (_x29) {
2404
- return _ref86.apply(this, arguments);
2455
+ return function (_x30) {
2456
+ return _ref88.apply(this, arguments);
2405
2457
  };
2406
2458
  }();
2407
2459
 
@@ -2415,13 +2467,13 @@ exports.RemoveMarketplaceOffer = /*#__PURE__*/function () {
2415
2467
  * @param {string} offerId - The ID of the offer
2416
2468
  */
2417
2469
  exports.AcceptMarketplaceOffer = /*#__PURE__*/function () {
2418
- var _ref88 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(_ref87) {
2470
+ var _ref90 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(_ref89) {
2419
2471
  var offerId;
2420
- return _regeneratorRuntime.wrap(function _callee44$(_context44) {
2421
- while (1) switch (_context44.prev = _context44.next) {
2472
+ return _regeneratorRuntime.wrap(function _callee45$(_context45) {
2473
+ while (1) switch (_context45.prev = _context45.next) {
2422
2474
  case 0:
2423
- offerId = _ref87.offerId;
2424
- _context44.next = 3;
2475
+ offerId = _ref89.offerId;
2476
+ _context45.next = 3;
2425
2477
  return this.client.authClient.MakeAuthServiceRequest({
2426
2478
  path: UrlJoin("as", "wlt", "mkt", "offers", "accept", offerId),
2427
2479
  method: "PUT",
@@ -2430,15 +2482,15 @@ exports.AcceptMarketplaceOffer = /*#__PURE__*/function () {
2430
2482
  }
2431
2483
  });
2432
2484
  case 3:
2433
- return _context44.abrupt("return", _context44.sent);
2485
+ return _context45.abrupt("return", _context45.sent);
2434
2486
  case 4:
2435
2487
  case "end":
2436
- return _context44.stop();
2488
+ return _context45.stop();
2437
2489
  }
2438
- }, _callee44, this);
2490
+ }, _callee45, this);
2439
2491
  }));
2440
- return function (_x30) {
2441
- return _ref88.apply(this, arguments);
2492
+ return function (_x31) {
2493
+ return _ref90.apply(this, arguments);
2442
2494
  };
2443
2495
  }();
2444
2496
 
@@ -2452,13 +2504,13 @@ exports.AcceptMarketplaceOffer = /*#__PURE__*/function () {
2452
2504
  * @param {string} offerId - The ID of the offer
2453
2505
  */
2454
2506
  exports.RejectMarketplaceOffer = /*#__PURE__*/function () {
2455
- var _ref90 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(_ref89) {
2507
+ var _ref92 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(_ref91) {
2456
2508
  var offerId;
2457
- return _regeneratorRuntime.wrap(function _callee45$(_context45) {
2458
- while (1) switch (_context45.prev = _context45.next) {
2509
+ return _regeneratorRuntime.wrap(function _callee46$(_context46) {
2510
+ while (1) switch (_context46.prev = _context46.next) {
2459
2511
  case 0:
2460
- offerId = _ref89.offerId;
2461
- _context45.next = 3;
2512
+ offerId = _ref91.offerId;
2513
+ _context46.next = 3;
2462
2514
  return this.client.authClient.MakeAuthServiceRequest({
2463
2515
  path: UrlJoin("as", "wlt", "mkt", "offers", "decline", offerId),
2464
2516
  method: "PUT",
@@ -2467,15 +2519,15 @@ exports.RejectMarketplaceOffer = /*#__PURE__*/function () {
2467
2519
  }
2468
2520
  });
2469
2521
  case 3:
2470
- return _context45.abrupt("return", _context45.sent);
2522
+ return _context46.abrupt("return", _context46.sent);
2471
2523
  case 4:
2472
2524
  case "end":
2473
- return _context45.stop();
2525
+ return _context46.stop();
2474
2526
  }
2475
- }, _callee45, this);
2527
+ }, _callee46, this);
2476
2528
  }));
2477
- return function (_x31) {
2478
- return _ref90.apply(this, arguments);
2529
+ return function (_x32) {
2530
+ return _ref92.apply(this, arguments);
2479
2531
  };
2480
2532
  }();
2481
2533
 
@@ -2492,13 +2544,13 @@ exports.RejectMarketplaceOffer = /*#__PURE__*/function () {
2492
2544
  * @returns {Promise<Object>} - Info about the voting event, including the current user's votes and the current total voting tally
2493
2545
  */
2494
2546
  exports.VoteStatus = /*#__PURE__*/function () {
2495
- var _ref92 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(_ref91) {
2547
+ var _ref94 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(_ref93) {
2496
2548
  var tenantId, votingEventId;
2497
- return _regeneratorRuntime.wrap(function _callee46$(_context46) {
2498
- while (1) switch (_context46.prev = _context46.next) {
2549
+ return _regeneratorRuntime.wrap(function _callee47$(_context47) {
2550
+ while (1) switch (_context47.prev = _context47.next) {
2499
2551
  case 0:
2500
- tenantId = _ref91.tenantId, votingEventId = _ref91.votingEventId;
2501
- _context46.next = 3;
2552
+ tenantId = _ref93.tenantId, votingEventId = _ref93.votingEventId;
2553
+ _context47.next = 3;
2502
2554
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
2503
2555
  path: UrlJoin("as", "votes", tenantId, votingEventId),
2504
2556
  headers: {
@@ -2506,15 +2558,15 @@ exports.VoteStatus = /*#__PURE__*/function () {
2506
2558
  }
2507
2559
  }));
2508
2560
  case 3:
2509
- return _context46.abrupt("return", _context46.sent);
2561
+ return _context47.abrupt("return", _context47.sent);
2510
2562
  case 4:
2511
2563
  case "end":
2512
- return _context46.stop();
2564
+ return _context47.stop();
2513
2565
  }
2514
- }, _callee46, this);
2566
+ }, _callee47, this);
2515
2567
  }));
2516
- return function (_x32) {
2517
- return _ref92.apply(this, arguments);
2568
+ return function (_x33) {
2569
+ return _ref94.apply(this, arguments);
2518
2570
  };
2519
2571
  }();
2520
2572
 
@@ -2532,13 +2584,13 @@ exports.VoteStatus = /*#__PURE__*/function () {
2532
2584
  * @returns {Promise<Object>} - Info about the voting event, including the current user's votes and the current total voting tally
2533
2585
  */
2534
2586
  exports.CastVote = /*#__PURE__*/function () {
2535
- var _ref94 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(_ref93) {
2587
+ var _ref96 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(_ref95) {
2536
2588
  var tenantId, votingEventId, sku;
2537
- return _regeneratorRuntime.wrap(function _callee47$(_context47) {
2538
- while (1) switch (_context47.prev = _context47.next) {
2589
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
2590
+ while (1) switch (_context48.prev = _context48.next) {
2539
2591
  case 0:
2540
- tenantId = _ref93.tenantId, votingEventId = _ref93.votingEventId, sku = _ref93.sku;
2541
- _context47.next = 3;
2592
+ tenantId = _ref95.tenantId, votingEventId = _ref95.votingEventId, sku = _ref95.sku;
2593
+ _context48.next = 3;
2542
2594
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
2543
2595
  path: UrlJoin("as", "votes", tenantId, votingEventId, sku),
2544
2596
  method: "POST",
@@ -2547,15 +2599,15 @@ exports.CastVote = /*#__PURE__*/function () {
2547
2599
  }
2548
2600
  }));
2549
2601
  case 3:
2550
- return _context47.abrupt("return", _context47.sent);
2602
+ return _context48.abrupt("return", _context48.sent);
2551
2603
  case 4:
2552
2604
  case "end":
2553
- return _context47.stop();
2605
+ return _context48.stop();
2554
2606
  }
2555
- }, _callee47, this);
2607
+ }, _callee48, this);
2556
2608
  }));
2557
- return function (_x33) {
2558
- return _ref94.apply(this, arguments);
2609
+ return function (_x34) {
2610
+ return _ref96.apply(this, arguments);
2559
2611
  };
2560
2612
  }();
2561
2613
 
@@ -2573,13 +2625,13 @@ exports.CastVote = /*#__PURE__*/function () {
2573
2625
  * @returns {Promise<Object>} - Info about the voting event, including the current user's votes and the current total voting tally
2574
2626
  */
2575
2627
  exports.RevokeVote = /*#__PURE__*/function () {
2576
- var _ref96 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(_ref95) {
2628
+ var _ref98 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(_ref97) {
2577
2629
  var tenantId, votingEventId, sku;
2578
- return _regeneratorRuntime.wrap(function _callee48$(_context48) {
2579
- while (1) switch (_context48.prev = _context48.next) {
2630
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
2631
+ while (1) switch (_context49.prev = _context49.next) {
2580
2632
  case 0:
2581
- tenantId = _ref95.tenantId, votingEventId = _ref95.votingEventId, sku = _ref95.sku;
2582
- _context48.next = 3;
2633
+ tenantId = _ref97.tenantId, votingEventId = _ref97.votingEventId, sku = _ref97.sku;
2634
+ _context49.next = 3;
2583
2635
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
2584
2636
  path: UrlJoin("as", "votes", tenantId, votingEventId, sku),
2585
2637
  method: "DELETE",
@@ -2588,14 +2640,14 @@ exports.RevokeVote = /*#__PURE__*/function () {
2588
2640
  }
2589
2641
  }));
2590
2642
  case 3:
2591
- return _context48.abrupt("return", _context48.sent);
2643
+ return _context49.abrupt("return", _context49.sent);
2592
2644
  case 4:
2593
2645
  case "end":
2594
- return _context48.stop();
2646
+ return _context49.stop();
2595
2647
  }
2596
- }, _callee48, this);
2648
+ }, _callee49, this);
2597
2649
  }));
2598
- return function (_x34) {
2599
- return _ref96.apply(this, arguments);
2650
+ return function (_x35) {
2651
+ return _ref98.apply(this, arguments);
2600
2652
  };
2601
2653
  }();
@@ -1489,7 +1489,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
1489
1489
  extra: status.extra && _typeof(status.extra) === "object" ? Object.values(status.extra) : status.extra,
1490
1490
  confirmationId: confirmationId,
1491
1491
  op: op,
1492
- address: address,
1492
+ address: Utils.FormatAddress(address),
1493
1493
  tokenId: tokenId
1494
1494
  });
1495
1495
  }).sort(function (a, b) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.29",
3
+ "version": "4.0.31",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -1108,7 +1108,7 @@ exports.LatestVersionHash = async function({objectId, versionHash}) {
1108
1108
  // eslint-disable-next-line no-empty
1109
1109
  } catch(error) {}
1110
1110
 
1111
- if(!versionCount.toNumber()) {
1111
+ if(!versionCount || !versionCount.toNumber()) {
1112
1112
  throw Error(`Unable to determine latest version hash for ${versionHash || objectId} - Item deleted?`);
1113
1113
  }
1114
1114
 
@@ -1227,6 +1227,37 @@ exports.CollectionRedemptionStatus = async function({marketplaceParams, confirma
1227
1227
  }
1228
1228
  };
1229
1229
 
1230
+ /**
1231
+ * Return status of the specified redeemable offer
1232
+ *
1233
+ * @methodGroup Status
1234
+ * @namedParams
1235
+ * @param {string=} tenantId - ID of the tenant for this NFT (not required if `marketplaceParams` is specified)
1236
+ * @param {Object=} marketplaceParams - Parameters of the marketplace for this NFT (not required if `tenantId` is specified)
1237
+ * @param {string} contractAddress - The address of the NFT contract
1238
+ * @param {string} tokenId - The token ID of the NFT
1239
+ * @param {string} offerId - The ID of the offer
1240
+ *
1241
+ * @returns {Promise<Object>} - The status of the offer redemption
1242
+ */
1243
+ exports.RedeemableOfferStatus = async function({tenantId, marketplaceParams, contractAddress, tokenId, offerId}) {
1244
+ try {
1245
+ const statuses = await this.MintingStatus({marketplaceParams, tenantId});
1246
+ contractAddress = Utils.FormatAddress(contractAddress);
1247
+
1248
+ return statuses.find(status =>
1249
+ status.op === "nft-offer-redeem" &&
1250
+ Utils.EqualAddress(status.address, contractAddress) &&
1251
+ status.tokenId === (tokenId || "").toString() &&
1252
+ status.extra && typeof status.extra[0] !== "undefined" && status.extra[0].toString() === (offerId || "").toString()
1253
+ ) || { status: "none" };
1254
+ } catch(error) {
1255
+ this.Log(error, true);
1256
+ return { status: "unknown" };
1257
+ }
1258
+ };
1259
+
1260
+
1230
1261
  /* EVENTS */
1231
1262
 
1232
1263
 
@@ -1178,7 +1178,7 @@ class ElvWalletClient {
1178
1178
  extra: status.extra && typeof status.extra === "object" ? Object.values(status.extra) : status.extra,
1179
1179
  confirmationId,
1180
1180
  op,
1181
- address,
1181
+ address: Utils.FormatAddress(address),
1182
1182
  tokenId
1183
1183
  };
1184
1184
  })