@eluvio/elv-client-js 3.2.1 → 3.2.5
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 +15 -11
- package/dist/ElvClient-node-min.js +17 -13
- package/dist/ElvFrameClient-min.js +12 -8
- package/dist/ElvPermissionsClient-min.js +13 -9
- package/dist/ElvWalletClient-min.js +58 -0
- package/dist/ElvWalletClient-node-min.js +78 -0
- package/dist/src/AuthorizationClient.js +2248 -1990
- package/dist/src/ContentObjectVerification.js +164 -173
- package/dist/src/Crypto.js +376 -324
- package/dist/src/ElvClient.js +1182 -1019
- package/dist/src/ElvWallet.js +119 -95
- package/dist/src/EthClient.js +1040 -896
- package/dist/src/FrameClient.js +331 -300
- package/dist/src/HttpClient.js +153 -147
- package/dist/src/Id.js +1 -3
- package/dist/src/PermissionsClient.js +1294 -1168
- package/dist/src/RemoteSigner.js +263 -211
- package/dist/src/UserProfileClient.js +1164 -1023
- package/dist/src/Utils.js +209 -181
- package/dist/src/client/ABRPublishing.js +895 -858
- package/dist/src/client/AccessGroups.js +1102 -959
- package/dist/src/client/ContentAccess.js +3724 -3431
- package/dist/src/client/ContentManagement.js +2252 -2068
- package/dist/src/client/Contracts.js +647 -563
- package/dist/src/client/Files.js +1886 -1757
- package/dist/src/client/NFT.js +126 -112
- package/dist/src/client/NTP.js +478 -422
- package/dist/src/walletClient/ClientMethods.js +1029 -879
- package/dist/src/walletClient/Utils.js +84 -70
- package/dist/src/walletClient/index.js +1200 -1088
- package/package.json +4 -2
- package/src/Utils.js +0 -1
- package/src/walletClient/ClientMethods.js +37 -5
- package/utilities/ProductionMasterCreate.js +2 -2
|
@@ -6,13 +6,15 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
|
6
6
|
|
|
7
7
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
8
8
|
|
|
9
|
+
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
10
|
+
|
|
9
11
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
10
12
|
|
|
11
13
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
12
14
|
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
16
|
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
18
|
|
|
17
19
|
var _require = require("../ElvClient"),
|
|
18
20
|
ElvClient = _require.ElvClient;
|
|
@@ -35,9 +37,7 @@ var Utils = require("../Utils");
|
|
|
35
37
|
*/
|
|
36
38
|
|
|
37
39
|
|
|
38
|
-
var ElvWalletClient =
|
|
39
|
-
/*#__PURE__*/
|
|
40
|
-
function () {
|
|
40
|
+
var ElvWalletClient = /*#__PURE__*/function () {
|
|
41
41
|
"use strict";
|
|
42
42
|
|
|
43
43
|
function ElvWalletClient(_ref) {
|
|
@@ -98,7 +98,7 @@ function () {
|
|
|
98
98
|
|
|
99
99
|
}, {
|
|
100
100
|
key: "LogIn",
|
|
101
|
-
|
|
101
|
+
value:
|
|
102
102
|
/* Login and authorization */
|
|
103
103
|
|
|
104
104
|
/**
|
|
@@ -119,158 +119,180 @@ function () {
|
|
|
119
119
|
*
|
|
120
120
|
* @throws - If using the popup flow and the user closes the popup, this method will throw an error.
|
|
121
121
|
*/
|
|
122
|
-
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (mode) {
|
|
142
|
-
loginUrl.searchParams.set("mode", mode);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (!marketplaceParams) {
|
|
146
|
-
_context3.next = 15;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
_context3.t0 = loginUrl.searchParams;
|
|
151
|
-
_context3.next = 11;
|
|
152
|
-
return _regeneratorRuntime.awrap(this.MarketplaceInfo({
|
|
153
|
-
marketplaceParams: marketplaceParams
|
|
154
|
-
}));
|
|
122
|
+
function () {
|
|
123
|
+
var _LogIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
124
|
+
var _this = this;
|
|
125
|
+
|
|
126
|
+
var _ref2$method, method, provider, _ref2$mode, mode, callbackUrl, marketplaceParams, _ref2$clearLogin, clearLogin, callback, loginUrl;
|
|
127
|
+
|
|
128
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
129
|
+
while (1) {
|
|
130
|
+
switch (_context3.prev = _context3.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
_ref2$method = _ref2.method, method = _ref2$method === void 0 ? "redirect" : _ref2$method, provider = _ref2.provider, _ref2$mode = _ref2.mode, mode = _ref2$mode === void 0 ? "login" : _ref2$mode, callbackUrl = _ref2.callbackUrl, marketplaceParams = _ref2.marketplaceParams, _ref2$clearLogin = _ref2.clearLogin, clearLogin = _ref2$clearLogin === void 0 ? false : _ref2$clearLogin, callback = _ref2.callback;
|
|
133
|
+
loginUrl = new URL(this.appUrl);
|
|
134
|
+
loginUrl.hash = "/login";
|
|
135
|
+
loginUrl.searchParams.set("origin", window.location.origin);
|
|
136
|
+
loginUrl.searchParams.set("action", "login");
|
|
137
|
+
|
|
138
|
+
if (provider) {
|
|
139
|
+
loginUrl.searchParams.set("provider", provider);
|
|
140
|
+
}
|
|
155
141
|
|
|
156
|
-
|
|
157
|
-
|
|
142
|
+
if (mode) {
|
|
143
|
+
loginUrl.searchParams.set("mode", mode);
|
|
144
|
+
}
|
|
158
145
|
|
|
159
|
-
|
|
146
|
+
if (!marketplaceParams) {
|
|
147
|
+
_context3.next = 15;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
160
150
|
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
_context3.t0 = loginUrl.searchParams;
|
|
152
|
+
_context3.next = 11;
|
|
153
|
+
return this.MarketplaceInfo({
|
|
154
|
+
marketplaceParams: marketplaceParams
|
|
155
|
+
});
|
|
163
156
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
loginUrl.searchParams.set("mid", this.selectedMarketplaceInfo.marketplaceHash);
|
|
167
|
-
}
|
|
157
|
+
case 11:
|
|
158
|
+
_context3.t1 = _context3.sent.marketplaceHash;
|
|
168
159
|
|
|
169
|
-
|
|
170
|
-
if (clearLogin) {
|
|
171
|
-
loginUrl.searchParams.set("clear", "");
|
|
172
|
-
}
|
|
160
|
+
_context3.t0.set.call(_context3.t0, "mid", _context3.t1);
|
|
173
161
|
|
|
174
|
-
|
|
175
|
-
_context3.next = 24;
|
|
162
|
+
_context3.next = 16;
|
|
176
163
|
break;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
loginUrl.searchParams.set("response", "redirect");
|
|
180
|
-
loginUrl.searchParams.set("source", "origin");
|
|
181
|
-
loginUrl.searchParams.set("redirect", callbackUrl);
|
|
182
|
-
window.location = loginUrl;
|
|
183
|
-
_context3.next = 28;
|
|
184
|
-
break;
|
|
185
|
-
|
|
186
|
-
case 24:
|
|
187
|
-
loginUrl.searchParams.set("response", "message");
|
|
188
|
-
loginUrl.searchParams.set("source", "parent");
|
|
189
|
-
_context3.next = 28;
|
|
190
|
-
return _regeneratorRuntime.awrap(new Promise(function _callee(resolve, reject) {
|
|
191
|
-
return _regeneratorRuntime.async(function _callee$(_context2) {
|
|
192
|
-
while (1) {
|
|
193
|
-
switch (_context2.prev = _context2.next) {
|
|
194
|
-
case 0:
|
|
195
|
-
_context2.next = 2;
|
|
196
|
-
return _regeneratorRuntime.awrap(ActionPopup({
|
|
197
|
-
mode: "tab",
|
|
198
|
-
url: loginUrl.toString(),
|
|
199
|
-
onCancel: function onCancel() {
|
|
200
|
-
return reject("User cancelled login");
|
|
201
|
-
},
|
|
202
|
-
onMessage: function onMessage(event, Close) {
|
|
203
|
-
return _regeneratorRuntime.async(function onMessage$(_context) {
|
|
204
|
-
while (1) {
|
|
205
|
-
switch (_context.prev = _context.next) {
|
|
206
|
-
case 0:
|
|
207
|
-
if (!(!event || !event.data || event.data.type !== "LoginResponse")) {
|
|
208
|
-
_context.next = 2;
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
164
|
|
|
212
|
-
|
|
165
|
+
case 15:
|
|
166
|
+
if ((this.selectedMarketplaceInfo || {}).marketplaceHash) {
|
|
167
|
+
loginUrl.searchParams.set("mid", this.selectedMarketplaceInfo.marketplaceHash);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
case 16:
|
|
171
|
+
if (clearLogin) {
|
|
172
|
+
loginUrl.searchParams.set("clear", "");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (!(method === "redirect")) {
|
|
176
|
+
_context3.next = 24;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
213
179
|
|
|
214
|
-
|
|
215
|
-
|
|
180
|
+
loginUrl.searchParams.set("response", "redirect");
|
|
181
|
+
loginUrl.searchParams.set("source", "origin");
|
|
182
|
+
loginUrl.searchParams.set("redirect", callbackUrl);
|
|
183
|
+
window.location = loginUrl;
|
|
184
|
+
_context3.next = 28;
|
|
185
|
+
break;
|
|
216
186
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
187
|
+
case 24:
|
|
188
|
+
loginUrl.searchParams.set("response", "message");
|
|
189
|
+
loginUrl.searchParams.set("source", "parent");
|
|
190
|
+
_context3.next = 28;
|
|
191
|
+
return new Promise( /*#__PURE__*/function () {
|
|
192
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve, reject) {
|
|
193
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
194
|
+
while (1) {
|
|
195
|
+
switch (_context2.prev = _context2.next) {
|
|
196
|
+
case 0:
|
|
197
|
+
_context2.next = 2;
|
|
198
|
+
return ActionPopup({
|
|
199
|
+
mode: "tab",
|
|
200
|
+
url: loginUrl.toString(),
|
|
201
|
+
onCancel: function onCancel() {
|
|
202
|
+
return reject("User cancelled login");
|
|
203
|
+
},
|
|
204
|
+
onMessage: function () {
|
|
205
|
+
var _onMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event, Close) {
|
|
206
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
207
|
+
while (1) {
|
|
208
|
+
switch (_context.prev = _context.next) {
|
|
209
|
+
case 0:
|
|
210
|
+
if (!(!event || !event.data || event.data.type !== "LoginResponse")) {
|
|
211
|
+
_context.next = 2;
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return _context.abrupt("return");
|
|
216
|
+
|
|
217
|
+
case 2:
|
|
218
|
+
_context.prev = 2;
|
|
219
|
+
|
|
220
|
+
if (!callback) {
|
|
221
|
+
_context.next = 8;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
_context.next = 6;
|
|
226
|
+
return callback(event.data.params);
|
|
227
|
+
|
|
228
|
+
case 6:
|
|
229
|
+
_context.next = 10;
|
|
230
|
+
break;
|
|
231
|
+
|
|
232
|
+
case 8:
|
|
233
|
+
_context.next = 10;
|
|
234
|
+
return _this.Authenticate({
|
|
235
|
+
token: event.data.params.clientSigningToken || event.data.params.clientAuthToken
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
case 10:
|
|
239
|
+
resolve();
|
|
240
|
+
_context.next = 16;
|
|
241
|
+
break;
|
|
242
|
+
|
|
243
|
+
case 13:
|
|
244
|
+
_context.prev = 13;
|
|
245
|
+
_context.t0 = _context["catch"](2);
|
|
246
|
+
reject(_context.t0);
|
|
247
|
+
|
|
248
|
+
case 16:
|
|
249
|
+
_context.prev = 16;
|
|
250
|
+
Close();
|
|
251
|
+
return _context.finish(16);
|
|
252
|
+
|
|
253
|
+
case 19:
|
|
254
|
+
case "end":
|
|
255
|
+
return _context.stop();
|
|
256
|
+
}
|
|
220
257
|
}
|
|
258
|
+
}, _callee, null, [[2, 13, 16, 19]]);
|
|
259
|
+
}));
|
|
221
260
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
case 6:
|
|
226
|
-
_context.next = 10;
|
|
227
|
-
break;
|
|
228
|
-
|
|
229
|
-
case 8:
|
|
230
|
-
_context.next = 10;
|
|
231
|
-
return _regeneratorRuntime.awrap(_this.Authenticate({
|
|
232
|
-
token: event.data.params.clientSigningToken || event.data.params.clientAuthToken
|
|
233
|
-
}));
|
|
234
|
-
|
|
235
|
-
case 10:
|
|
236
|
-
resolve();
|
|
237
|
-
_context.next = 16;
|
|
238
|
-
break;
|
|
239
|
-
|
|
240
|
-
case 13:
|
|
241
|
-
_context.prev = 13;
|
|
242
|
-
_context.t0 = _context["catch"](2);
|
|
243
|
-
reject(_context.t0);
|
|
244
|
-
|
|
245
|
-
case 16:
|
|
246
|
-
_context.prev = 16;
|
|
247
|
-
Close();
|
|
248
|
-
return _context.finish(16);
|
|
249
|
-
|
|
250
|
-
case 19:
|
|
251
|
-
case "end":
|
|
252
|
-
return _context.stop();
|
|
261
|
+
function onMessage(_x4, _x5) {
|
|
262
|
+
return _onMessage.apply(this, arguments);
|
|
253
263
|
}
|
|
254
|
-
}
|
|
255
|
-
}, null, null, [[2, 13, 16, 19]]);
|
|
256
|
-
}
|
|
257
|
-
}));
|
|
258
264
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
265
|
+
return onMessage;
|
|
266
|
+
}()
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
case 2:
|
|
270
|
+
case "end":
|
|
271
|
+
return _context2.stop();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}, _callee2);
|
|
275
|
+
}));
|
|
276
|
+
|
|
277
|
+
return function (_x2, _x3) {
|
|
278
|
+
return _ref3.apply(this, arguments);
|
|
279
|
+
};
|
|
280
|
+
}());
|
|
266
281
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
282
|
+
case 28:
|
|
283
|
+
case "end":
|
|
284
|
+
return _context3.stop();
|
|
285
|
+
}
|
|
270
286
|
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
287
|
+
}, _callee3, this);
|
|
288
|
+
}));
|
|
289
|
+
|
|
290
|
+
function LogIn(_x) {
|
|
291
|
+
return _LogIn.apply(this, arguments);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return LogIn;
|
|
295
|
+
}()
|
|
274
296
|
/**
|
|
275
297
|
* Remove authorization for the current user.
|
|
276
298
|
*
|
|
@@ -300,51 +322,59 @@ function () {
|
|
|
300
322
|
|
|
301
323
|
}, {
|
|
302
324
|
key: "Authenticate",
|
|
303
|
-
value: function
|
|
304
|
-
var
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
case 5:
|
|
316
|
-
_context4.prev = 5;
|
|
317
|
-
_context4.t0 = _context4["catch"](1);
|
|
318
|
-
throw new Error("Invalid authorization token " + token);
|
|
319
|
-
|
|
320
|
-
case 8:
|
|
321
|
-
if (!(!decodedToken.expiresAt || Date.now() > decodedToken.expiresAt)) {
|
|
322
|
-
_context4.next = 10;
|
|
325
|
+
value: function () {
|
|
326
|
+
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
|
|
327
|
+
var token, decodedToken;
|
|
328
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
329
|
+
while (1) {
|
|
330
|
+
switch (_context4.prev = _context4.next) {
|
|
331
|
+
case 0:
|
|
332
|
+
token = _ref4.token;
|
|
333
|
+
_context4.prev = 1;
|
|
334
|
+
decodedToken = JSON.parse(this.utils.FromB58ToStr(token)) || {};
|
|
335
|
+
_context4.next = 8;
|
|
323
336
|
break;
|
|
324
|
-
}
|
|
325
337
|
|
|
326
|
-
|
|
338
|
+
case 5:
|
|
339
|
+
_context4.prev = 5;
|
|
340
|
+
_context4.t0 = _context4["catch"](1);
|
|
341
|
+
throw new Error("Invalid authorization token " + token);
|
|
327
342
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
343
|
+
case 8:
|
|
344
|
+
if (!(!decodedToken.expiresAt || Date.now() > decodedToken.expiresAt)) {
|
|
345
|
+
_context4.next = 10;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
throw Error("ElvWalletClient: Provided authorization token has expired");
|
|
332
350
|
|
|
333
|
-
|
|
334
|
-
this.client.
|
|
335
|
-
|
|
351
|
+
case 10:
|
|
352
|
+
this.client.SetStaticToken({
|
|
353
|
+
token: decodedToken.fabricToken
|
|
336
354
|
});
|
|
337
|
-
}
|
|
338
355
|
|
|
339
|
-
|
|
356
|
+
if (decodedToken.clusterToken) {
|
|
357
|
+
this.client.SetRemoteSigner({
|
|
358
|
+
authToken: decodedToken.clusterToken
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return _context4.abrupt("return", this.SetAuthorization(decodedToken));
|
|
340
363
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
364
|
+
case 13:
|
|
365
|
+
case "end":
|
|
366
|
+
return _context4.stop();
|
|
367
|
+
}
|
|
344
368
|
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
369
|
+
}, _callee4, this, [[1, 5]]);
|
|
370
|
+
}));
|
|
371
|
+
|
|
372
|
+
function Authenticate(_x6) {
|
|
373
|
+
return _Authenticate.apply(this, arguments);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return Authenticate;
|
|
377
|
+
}()
|
|
348
378
|
/**
|
|
349
379
|
* Authenticate with an OAuth ID token
|
|
350
380
|
*
|
|
@@ -367,97 +397,105 @@ function () {
|
|
|
367
397
|
|
|
368
398
|
}, {
|
|
369
399
|
key: "AuthenticateOAuth",
|
|
370
|
-
value: function
|
|
371
|
-
var
|
|
400
|
+
value: function () {
|
|
401
|
+
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
|
|
402
|
+
var idToken, tenantId, email, _ref5$shareEmail, shareEmail, _ref5$tokenDuration, tokenDuration, expiresAt, fabricToken, address, decodedToken;
|
|
403
|
+
|
|
404
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
405
|
+
while (1) {
|
|
406
|
+
switch (_context5.prev = _context5.next) {
|
|
407
|
+
case 0:
|
|
408
|
+
idToken = _ref5.idToken, tenantId = _ref5.tenantId, email = _ref5.email, _ref5$shareEmail = _ref5.shareEmail, shareEmail = _ref5$shareEmail === void 0 ? false : _ref5$shareEmail, _ref5$tokenDuration = _ref5.tokenDuration, tokenDuration = _ref5$tokenDuration === void 0 ? 24 : _ref5$tokenDuration;
|
|
409
|
+
|
|
410
|
+
if (!(!tenantId && this.selectedMarketplaceInfo)) {
|
|
411
|
+
_context5.next = 5;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
372
414
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
switch (_context5.prev = _context5.next) {
|
|
376
|
-
case 0:
|
|
377
|
-
idToken = _ref4.idToken, tenantId = _ref4.tenantId, email = _ref4.email, _ref4$shareEmail = _ref4.shareEmail, shareEmail = _ref4$shareEmail === void 0 ? false : _ref4$shareEmail, _ref4$tokenDuration = _ref4.tokenDuration, tokenDuration = _ref4$tokenDuration === void 0 ? 24 : _ref4$tokenDuration;
|
|
415
|
+
_context5.next = 4;
|
|
416
|
+
return this.AvailableMarketplaces();
|
|
378
417
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (email) {
|
|
418
|
+
case 4:
|
|
419
|
+
tenantId = this.selectedMarketplaceInfo.tenantId;
|
|
420
|
+
|
|
421
|
+
case 5:
|
|
422
|
+
_context5.next = 7;
|
|
423
|
+
return this.client.SetRemoteSigner({
|
|
424
|
+
idToken: idToken,
|
|
425
|
+
tenantId: tenantId,
|
|
426
|
+
extraData: {
|
|
427
|
+
share_email: shareEmail
|
|
428
|
+
},
|
|
429
|
+
unsignedPublicAuth: true
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
case 7:
|
|
433
|
+
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
434
|
+
_context5.next = 10;
|
|
435
|
+
return this.client.CreateFabricToken({
|
|
436
|
+
duration: tokenDuration * 60 * 60 * 1000
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
case 10:
|
|
440
|
+
fabricToken = _context5.sent;
|
|
441
|
+
address = this.client.utils.FormatAddress(this.client.CurrentAccountAddress());
|
|
442
|
+
|
|
443
|
+
if (email) {
|
|
444
|
+
_context5.next = 21;
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
_context5.prev = 13;
|
|
449
|
+
decodedToken = JSON.parse(this.utils.FromB64URL(idToken.split(".")[1]));
|
|
450
|
+
email = decodedToken.email;
|
|
413
451
|
_context5.next = 21;
|
|
414
452
|
break;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
})
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
case 23:
|
|
455
|
-
case "end":
|
|
456
|
-
return _context5.stop();
|
|
453
|
+
|
|
454
|
+
case 18:
|
|
455
|
+
_context5.prev = 18;
|
|
456
|
+
_context5.t0 = _context5["catch"](13);
|
|
457
|
+
throw Error("Failed to decode ID token");
|
|
458
|
+
|
|
459
|
+
case 21:
|
|
460
|
+
this.client.SetStaticToken({
|
|
461
|
+
token: fabricToken
|
|
462
|
+
});
|
|
463
|
+
return _context5.abrupt("return", {
|
|
464
|
+
authToken: this.SetAuthorization({
|
|
465
|
+
fabricToken: fabricToken,
|
|
466
|
+
tenantId: tenantId,
|
|
467
|
+
address: address,
|
|
468
|
+
email: email,
|
|
469
|
+
expiresAt: expiresAt,
|
|
470
|
+
walletType: "Custodial",
|
|
471
|
+
walletName: "Eluvio"
|
|
472
|
+
}),
|
|
473
|
+
signingToken: this.SetAuthorization({
|
|
474
|
+
clusterToken: this.client.signer.authToken,
|
|
475
|
+
fabricToken: fabricToken,
|
|
476
|
+
tenantId: tenantId,
|
|
477
|
+
address: address,
|
|
478
|
+
email: email,
|
|
479
|
+
expiresAt: expiresAt,
|
|
480
|
+
walletType: "Custodial",
|
|
481
|
+
walletName: "Eluvio"
|
|
482
|
+
})
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
case 23:
|
|
486
|
+
case "end":
|
|
487
|
+
return _context5.stop();
|
|
488
|
+
}
|
|
457
489
|
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
490
|
+
}, _callee5, this, [[13, 18]]);
|
|
491
|
+
}));
|
|
492
|
+
|
|
493
|
+
function AuthenticateOAuth(_x7) {
|
|
494
|
+
return _AuthenticateOAuth.apply(this, arguments);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return AuthenticateOAuth;
|
|
498
|
+
}()
|
|
461
499
|
/**
|
|
462
500
|
* Authenticate with an external Ethereum compatible wallet, like Metamask.
|
|
463
501
|
*
|
|
@@ -474,69 +512,83 @@ function () {
|
|
|
474
512
|
|
|
475
513
|
}, {
|
|
476
514
|
key: "AuthenticateExternalWallet",
|
|
477
|
-
value: function
|
|
478
|
-
var
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
address
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
515
|
+
value: function () {
|
|
516
|
+
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref6) {
|
|
517
|
+
var _this2 = this;
|
|
518
|
+
|
|
519
|
+
var address, _ref6$tokenDuration, tokenDuration, _ref6$walletName, walletName, Sign, expiresAt, fabricToken;
|
|
520
|
+
|
|
521
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
522
|
+
while (1) {
|
|
523
|
+
switch (_context7.prev = _context7.next) {
|
|
524
|
+
case 0:
|
|
525
|
+
address = _ref6.address, _ref6$tokenDuration = _ref6.tokenDuration, tokenDuration = _ref6$tokenDuration === void 0 ? 24 : _ref6$tokenDuration, _ref6$walletName = _ref6.walletName, walletName = _ref6$walletName === void 0 ? "Metamask" : _ref6$walletName, Sign = _ref6.Sign;
|
|
526
|
+
|
|
527
|
+
if (!address) {
|
|
528
|
+
address = window.ethereum.selectedAddress;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
address = this.utils.FormatAddress(address);
|
|
532
|
+
|
|
533
|
+
if (!Sign) {
|
|
534
|
+
Sign = /*#__PURE__*/function () {
|
|
535
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(message) {
|
|
536
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
537
|
+
while (1) {
|
|
538
|
+
switch (_context6.prev = _context6.next) {
|
|
539
|
+
case 0:
|
|
540
|
+
return _context6.abrupt("return", _this2.SignMetamask({
|
|
541
|
+
message: message,
|
|
542
|
+
address: address
|
|
543
|
+
}));
|
|
544
|
+
|
|
545
|
+
case 1:
|
|
546
|
+
case "end":
|
|
547
|
+
return _context6.stop();
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}, _callee6);
|
|
551
|
+
}));
|
|
552
|
+
|
|
553
|
+
return function Sign(_x9) {
|
|
554
|
+
return _ref7.apply(this, arguments);
|
|
555
|
+
};
|
|
556
|
+
}();
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
560
|
+
_context7.next = 7;
|
|
561
|
+
return this.client.CreateFabricToken({
|
|
562
|
+
address: address,
|
|
563
|
+
duration: tokenDuration * 60 * 60 * 1000,
|
|
564
|
+
Sign: Sign,
|
|
565
|
+
addEthereumPrefix: false
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
case 7:
|
|
569
|
+
fabricToken = _context7.sent;
|
|
570
|
+
return _context7.abrupt("return", this.SetAuthorization({
|
|
571
|
+
fabricToken: fabricToken,
|
|
572
|
+
address: address,
|
|
573
|
+
expiresAt: expiresAt,
|
|
574
|
+
walletType: "External",
|
|
575
|
+
walletName: walletName
|
|
576
|
+
}));
|
|
577
|
+
|
|
578
|
+
case 9:
|
|
579
|
+
case "end":
|
|
580
|
+
return _context7.stop();
|
|
581
|
+
}
|
|
536
582
|
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
583
|
+
}, _callee7, this);
|
|
584
|
+
}));
|
|
585
|
+
|
|
586
|
+
function AuthenticateExternalWallet(_x8) {
|
|
587
|
+
return _AuthenticateExternalWallet.apply(this, arguments);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
return AuthenticateExternalWallet;
|
|
591
|
+
}()
|
|
540
592
|
/**
|
|
541
593
|
* <b><i>Requires login</i></b>
|
|
542
594
|
*
|
|
@@ -565,15 +617,15 @@ function () {
|
|
|
565
617
|
}
|
|
566
618
|
}, {
|
|
567
619
|
key: "SetAuthorization",
|
|
568
|
-
value: function SetAuthorization(
|
|
569
|
-
var clusterToken =
|
|
570
|
-
fabricToken =
|
|
571
|
-
tenantId =
|
|
572
|
-
address =
|
|
573
|
-
email =
|
|
574
|
-
expiresAt =
|
|
575
|
-
walletType =
|
|
576
|
-
walletName =
|
|
620
|
+
value: function SetAuthorization(_ref8) {
|
|
621
|
+
var clusterToken = _ref8.clusterToken,
|
|
622
|
+
fabricToken = _ref8.fabricToken,
|
|
623
|
+
tenantId = _ref8.tenantId,
|
|
624
|
+
address = _ref8.address,
|
|
625
|
+
email = _ref8.email,
|
|
626
|
+
expiresAt = _ref8.expiresAt,
|
|
627
|
+
walletType = _ref8.walletType,
|
|
628
|
+
walletName = _ref8.walletName;
|
|
577
629
|
address = this.client.utils.FormatAddress(address);
|
|
578
630
|
this.__authorization = {
|
|
579
631
|
fabricToken: fabricToken,
|
|
@@ -603,853 +655,913 @@ function () {
|
|
|
603
655
|
}
|
|
604
656
|
}, {
|
|
605
657
|
key: "SignMetamask",
|
|
606
|
-
value: function
|
|
607
|
-
var
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
658
|
+
value: function () {
|
|
659
|
+
var _SignMetamask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref9) {
|
|
660
|
+
var message, address, from;
|
|
661
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
662
|
+
while (1) {
|
|
663
|
+
switch (_context8.prev = _context8.next) {
|
|
664
|
+
case 0:
|
|
665
|
+
message = _ref9.message, address = _ref9.address;
|
|
666
|
+
|
|
667
|
+
if (window.ethereum) {
|
|
668
|
+
_context8.next = 3;
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
throw Error("ElvWalletClient: Unable to initialize - Metamask not available");
|
|
673
|
+
|
|
674
|
+
case 3:
|
|
675
|
+
_context8.next = 5;
|
|
676
|
+
return window.ethereum.request({
|
|
677
|
+
method: "eth_requestAccounts"
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
case 5:
|
|
681
|
+
from = address || window.ethereum.selectedAddress;
|
|
682
|
+
_context8.next = 8;
|
|
683
|
+
return window.ethereum.request({
|
|
684
|
+
method: "personal_sign",
|
|
685
|
+
params: [message, from, ""]
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
case 8:
|
|
689
|
+
return _context8.abrupt("return", _context8.sent);
|
|
690
|
+
|
|
691
|
+
case 9:
|
|
692
|
+
case "end":
|
|
693
|
+
return _context8.stop();
|
|
694
|
+
}
|
|
641
695
|
}
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
|
|
696
|
+
}, _callee8);
|
|
697
|
+
}));
|
|
698
|
+
|
|
699
|
+
function SignMetamask(_x10) {
|
|
700
|
+
return _SignMetamask.apply(this, arguments);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
return SignMetamask;
|
|
704
|
+
}() // Internal loading methods
|
|
645
705
|
// If marketplace slug is specified, load only that marketplace. Otherwise load all
|
|
646
706
|
|
|
647
707
|
}, {
|
|
648
708
|
key: "LoadAvailableMarketplaces",
|
|
649
|
-
value: function
|
|
650
|
-
var
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
if (_this3.selectedMarketplaceInfo
|
|
725
|
-
_this3.selectedMarketplaceInfo
|
|
709
|
+
value: function () {
|
|
710
|
+
var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
711
|
+
var _this3 = this;
|
|
712
|
+
|
|
713
|
+
var forceReload,
|
|
714
|
+
mainSiteHash,
|
|
715
|
+
metadata,
|
|
716
|
+
availableMarketplaces,
|
|
717
|
+
availableMarketplacesById,
|
|
718
|
+
_args9 = arguments;
|
|
719
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
720
|
+
while (1) {
|
|
721
|
+
switch (_context9.prev = _context9.next) {
|
|
722
|
+
case 0:
|
|
723
|
+
forceReload = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
|
|
724
|
+
|
|
725
|
+
if (!(!forceReload && Object.keys(this.availableMarketplaces) > 0)) {
|
|
726
|
+
_context9.next = 3;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
return _context9.abrupt("return");
|
|
731
|
+
|
|
732
|
+
case 3:
|
|
733
|
+
_context9.next = 5;
|
|
734
|
+
return this.client.LatestVersionHash({
|
|
735
|
+
objectId: this.mainSiteId
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
case 5:
|
|
739
|
+
mainSiteHash = _context9.sent;
|
|
740
|
+
_context9.next = 8;
|
|
741
|
+
return this.client.ContentObjectMetadata({
|
|
742
|
+
versionHash: mainSiteHash,
|
|
743
|
+
metadataSubtree: "public/asset_metadata/tenants",
|
|
744
|
+
resolveLinks: true,
|
|
745
|
+
linkDepthLimit: 2,
|
|
746
|
+
resolveIncludeSource: true,
|
|
747
|
+
resolveIgnoreErrors: true,
|
|
748
|
+
produceLinkUrls: true,
|
|
749
|
+
authorizationToken: this.publicStaticToken,
|
|
750
|
+
noAuth: true,
|
|
751
|
+
select: ["*/.", "*/marketplaces/*/.", "*/marketplaces/*/info/tenant_id", "*/marketplaces/*/info/tenant_name", "*/marketplaces/*/info/branding"],
|
|
752
|
+
remove: ["*/marketplaces/*/info/branding/custom_css"]
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
case 8:
|
|
756
|
+
metadata = _context9.sent;
|
|
757
|
+
availableMarketplaces = _objectSpread({}, this.availableMarketplaces || {});
|
|
758
|
+
availableMarketplacesById = _objectSpread({}, this.availableMarketplacesById || {});
|
|
759
|
+
Object.keys(metadata || {}).forEach(function (tenantSlug) {
|
|
760
|
+
try {
|
|
761
|
+
availableMarketplaces[tenantSlug] = {
|
|
762
|
+
versionHash: metadata[tenantSlug]["."].source
|
|
763
|
+
};
|
|
764
|
+
Object.keys(metadata[tenantSlug].marketplaces || {}).forEach(function (marketplaceSlug) {
|
|
765
|
+
try {
|
|
766
|
+
var versionHash = metadata[tenantSlug].marketplaces[marketplaceSlug]["."].source;
|
|
767
|
+
|
|
768
|
+
var objectId = _this3.utils.DecodeVersionHash(versionHash).objectId;
|
|
769
|
+
|
|
770
|
+
availableMarketplaces[tenantSlug][marketplaceSlug] = _objectSpread(_objectSpread({}, metadata[tenantSlug].marketplaces[marketplaceSlug].info || {}), {}, {
|
|
771
|
+
tenantName: metadata[tenantSlug].marketplaces[marketplaceSlug].info.tenant_name,
|
|
772
|
+
tenantId: metadata[tenantSlug].marketplaces[marketplaceSlug].info.tenant_id,
|
|
773
|
+
tenantSlug: tenantSlug,
|
|
774
|
+
marketplaceSlug: marketplaceSlug,
|
|
775
|
+
marketplaceId: objectId,
|
|
776
|
+
marketplaceHash: versionHash,
|
|
777
|
+
order: Configuration.__MARKETPLACE_ORDER.findIndex(function (slug) {
|
|
778
|
+
return slug === marketplaceSlug;
|
|
779
|
+
})
|
|
780
|
+
});
|
|
781
|
+
availableMarketplacesById[objectId] = availableMarketplaces[tenantSlug][marketplaceSlug];
|
|
782
|
+
_this3.marketplaceHashes[objectId] = versionHash; // Fill out selected marketplace info
|
|
783
|
+
|
|
784
|
+
if (_this3.selectedMarketplaceInfo) {
|
|
785
|
+
if (_this3.selectedMarketplaceInfo.tenantSlug === tenantSlug && _this3.selectedMarketplaceInfo.marketplaceSlug === marketplaceSlug || _this3.selectedMarketplaceInfo.marketplaceId === objectId) {
|
|
786
|
+
_this3.selectedMarketplaceInfo = availableMarketplaces[tenantSlug][marketplaceSlug];
|
|
787
|
+
}
|
|
726
788
|
}
|
|
789
|
+
} catch (error) {
|
|
790
|
+
_this3.Log("Eluvio Wallet Client: Unable to load info for marketplace ".concat(tenantSlug, "/").concat(marketplaceSlug), true);
|
|
727
791
|
}
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
});
|
|
732
|
-
} catch (error) {
|
|
733
|
-
_this3.Log("Eluvio Wallet Client: Failed to load tenant info ".concat(tenantSlug), true);
|
|
792
|
+
});
|
|
793
|
+
} catch (error) {
|
|
794
|
+
_this3.Log("Eluvio Wallet Client: Failed to load tenant info ".concat(tenantSlug), true);
|
|
734
795
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
796
|
+
_this3.Log(error, true);
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
this.availableMarketplaces = availableMarketplaces;
|
|
800
|
+
this.availableMarketplacesById = availableMarketplacesById;
|
|
740
801
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
802
|
+
case 14:
|
|
803
|
+
case "end":
|
|
804
|
+
return _context9.stop();
|
|
805
|
+
}
|
|
744
806
|
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
|
|
807
|
+
}, _callee9, this);
|
|
808
|
+
}));
|
|
809
|
+
|
|
810
|
+
function LoadAvailableMarketplaces() {
|
|
811
|
+
return _LoadAvailableMarketplaces.apply(this, arguments);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
return LoadAvailableMarketplaces;
|
|
815
|
+
}() // Get the hash of the currently linked marketplace
|
|
748
816
|
|
|
749
817
|
}, {
|
|
750
818
|
key: "LatestMarketplaceHash",
|
|
751
|
-
value: function
|
|
752
|
-
var
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
819
|
+
value: function () {
|
|
820
|
+
var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref10) {
|
|
821
|
+
var tenantSlug, marketplaceSlug, mainSiteHash, marketplaceLink;
|
|
822
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
823
|
+
while (1) {
|
|
824
|
+
switch (_context10.prev = _context10.next) {
|
|
825
|
+
case 0:
|
|
826
|
+
tenantSlug = _ref10.tenantSlug, marketplaceSlug = _ref10.marketplaceSlug;
|
|
827
|
+
_context10.next = 3;
|
|
828
|
+
return this.client.LatestVersionHash({
|
|
829
|
+
objectId: this.mainSiteId
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
case 3:
|
|
833
|
+
mainSiteHash = _context10.sent;
|
|
834
|
+
_context10.next = 6;
|
|
835
|
+
return this.client.ContentObjectMetadata({
|
|
836
|
+
versionHash: mainSiteHash,
|
|
837
|
+
metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", tenantSlug, "marketplaces", marketplaceSlug),
|
|
838
|
+
resolveLinks: false
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
case 6:
|
|
842
|
+
marketplaceLink = _context10.sent;
|
|
843
|
+
return _context10.abrupt("return", LinkTargetHash(marketplaceLink));
|
|
844
|
+
|
|
845
|
+
case 8:
|
|
846
|
+
case "end":
|
|
847
|
+
return _context10.stop();
|
|
848
|
+
}
|
|
779
849
|
}
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
|
|
850
|
+
}, _callee10, this);
|
|
851
|
+
}));
|
|
852
|
+
|
|
853
|
+
function LatestMarketplaceHash(_x11) {
|
|
854
|
+
return _LatestMarketplaceHash.apply(this, arguments);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
return LatestMarketplaceHash;
|
|
858
|
+
}()
|
|
783
859
|
}, {
|
|
784
860
|
key: "LoadMarketplace",
|
|
785
|
-
value: function
|
|
786
|
-
var
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
case 9:
|
|
828
|
-
marketplace = _context12.sent;
|
|
829
|
-
_context12.next = 12;
|
|
830
|
-
return _regeneratorRuntime.awrap(Promise.all(marketplace.items.map(function _callee2(item, index) {
|
|
831
|
-
return _regeneratorRuntime.async(function _callee2$(_context11) {
|
|
832
|
-
while (1) {
|
|
833
|
-
switch (_context11.prev = _context11.next) {
|
|
834
|
-
case 0:
|
|
835
|
-
if (!item.requires_permissions) {
|
|
836
|
-
_context11.next = 14;
|
|
837
|
-
break;
|
|
838
|
-
}
|
|
861
|
+
value: function () {
|
|
862
|
+
var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(marketplaceParams) {
|
|
863
|
+
var _this4 = this;
|
|
864
|
+
|
|
865
|
+
var marketplaceInfo, marketplaceId, marketplaceHash, marketplace;
|
|
866
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
867
|
+
while (1) {
|
|
868
|
+
switch (_context12.prev = _context12.next) {
|
|
869
|
+
case 0:
|
|
870
|
+
marketplaceInfo = this.MarketplaceInfo({
|
|
871
|
+
marketplaceParams: marketplaceParams
|
|
872
|
+
});
|
|
873
|
+
marketplaceId = marketplaceInfo.marketplaceId;
|
|
874
|
+
_context12.next = 4;
|
|
875
|
+
return this.LatestMarketplaceHash({
|
|
876
|
+
tenantSlug: marketplaceInfo.tenantSlug,
|
|
877
|
+
marketplaceSlug: marketplaceInfo.marketplaceSlug
|
|
878
|
+
});
|
|
879
|
+
|
|
880
|
+
case 4:
|
|
881
|
+
marketplaceHash = _context12.sent;
|
|
882
|
+
|
|
883
|
+
if (this.cachedMarketplaces[marketplaceId] && this.cachedMarketplaces[marketplaceId].versionHash !== marketplaceHash) {
|
|
884
|
+
delete this.cachedMarketplaces[marketplaceId];
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
if (this.cachedMarketplaces[marketplaceId]) {
|
|
888
|
+
_context12.next = 19;
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
_context12.next = 9;
|
|
893
|
+
return this.client.ContentObjectMetadata({
|
|
894
|
+
versionHash: marketplaceHash,
|
|
895
|
+
metadataSubtree: "public/asset_metadata/info",
|
|
896
|
+
linkDepthLimit: 2,
|
|
897
|
+
resolveLinks: true,
|
|
898
|
+
resolveIgnoreErrors: true,
|
|
899
|
+
resolveIncludeSource: true,
|
|
900
|
+
produceLinkUrls: true,
|
|
901
|
+
authorizationToken: this.publicStaticToken
|
|
902
|
+
});
|
|
839
903
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
904
|
+
case 9:
|
|
905
|
+
marketplace = _context12.sent;
|
|
906
|
+
_context12.next = 12;
|
|
907
|
+
return Promise.all(marketplace.items.map( /*#__PURE__*/function () {
|
|
908
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(item, index) {
|
|
909
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
910
|
+
while (1) {
|
|
911
|
+
switch (_context11.prev = _context11.next) {
|
|
912
|
+
case 0:
|
|
913
|
+
if (!item.requires_permissions) {
|
|
914
|
+
_context11.next = 14;
|
|
915
|
+
break;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
if (_this4.loggedIn) {
|
|
919
|
+
_context11.next = 5;
|
|
920
|
+
break;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
item.authorized = false;
|
|
924
|
+
_context11.next = 14;
|
|
925
|
+
break;
|
|
926
|
+
|
|
927
|
+
case 5:
|
|
928
|
+
_context11.prev = 5;
|
|
929
|
+
_context11.next = 8;
|
|
930
|
+
return _this4.client.ContentObjectMetadata({
|
|
931
|
+
versionHash: LinkTargetHash(item.nft_template),
|
|
932
|
+
metadataSubtree: "permissioned"
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
case 8:
|
|
936
|
+
item.authorized = true;
|
|
937
|
+
_context11.next = 14;
|
|
938
|
+
break;
|
|
939
|
+
|
|
940
|
+
case 11:
|
|
941
|
+
_context11.prev = 11;
|
|
942
|
+
_context11.t0 = _context11["catch"](5);
|
|
943
|
+
item.authorized = false;
|
|
944
|
+
|
|
945
|
+
case 14:
|
|
946
|
+
item.nftTemplateMetadata = (item.nft_template || {}).nft || {};
|
|
947
|
+
item.itemIndex = index;
|
|
948
|
+
return _context11.abrupt("return", item);
|
|
949
|
+
|
|
950
|
+
case 17:
|
|
951
|
+
case "end":
|
|
952
|
+
return _context11.stop();
|
|
843
953
|
}
|
|
954
|
+
}
|
|
955
|
+
}, _callee11, null, [[5, 11]]);
|
|
956
|
+
}));
|
|
844
957
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
case 8:
|
|
858
|
-
item.authorized = true;
|
|
859
|
-
_context11.next = 14;
|
|
860
|
-
break;
|
|
861
|
-
|
|
862
|
-
case 11:
|
|
863
|
-
_context11.prev = 11;
|
|
864
|
-
_context11.t0 = _context11["catch"](5);
|
|
865
|
-
item.authorized = false;
|
|
866
|
-
|
|
867
|
-
case 14:
|
|
868
|
-
item.nftTemplateMetadata = (item.nft_template || {}).nft || {};
|
|
869
|
-
item.itemIndex = index;
|
|
870
|
-
return _context11.abrupt("return", item);
|
|
871
|
-
|
|
872
|
-
case 17:
|
|
873
|
-
case "end":
|
|
874
|
-
return _context11.stop();
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
}, null, null, [[5, 11]]);
|
|
878
|
-
})));
|
|
879
|
-
|
|
880
|
-
case 12:
|
|
881
|
-
marketplace.items = _context12.sent;
|
|
882
|
-
marketplace.collections = (marketplace.collections || []).map(function (collection, collectionIndex) {
|
|
883
|
-
return _objectSpread({}, collection, {
|
|
884
|
-
collectionIndex: collectionIndex
|
|
958
|
+
return function (_x13, _x14) {
|
|
959
|
+
return _ref11.apply(this, arguments);
|
|
960
|
+
};
|
|
961
|
+
}()));
|
|
962
|
+
|
|
963
|
+
case 12:
|
|
964
|
+
marketplace.items = _context12.sent;
|
|
965
|
+
marketplace.collections = (marketplace.collections || []).map(function (collection, collectionIndex) {
|
|
966
|
+
return _objectSpread(_objectSpread({}, collection), {}, {
|
|
967
|
+
collectionIndex: collectionIndex
|
|
968
|
+
});
|
|
885
969
|
});
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
}
|
|
970
|
+
marketplace.retrievedAt = Date.now();
|
|
971
|
+
marketplace.marketplaceId = marketplaceId;
|
|
972
|
+
marketplace.versionHash = marketplaceHash; // Generate embed URLs for pack opening animations
|
|
973
|
+
|
|
974
|
+
["purchase_animation", "purchase_animation__mobile", "reveal_animation", "reveal_animation_mobile"].forEach(function (key) {
|
|
975
|
+
try {
|
|
976
|
+
if (marketplace.storefront[key]) {
|
|
977
|
+
var embedUrl = new URL("https://embed.v3.contentfabric.io");
|
|
978
|
+
var targetHash = LinkTargetHash(marketplace.storefront[key]);
|
|
979
|
+
embedUrl.searchParams.set("p", "");
|
|
980
|
+
embedUrl.searchParams.set("net", _this4.network === "main" ? "main" : "demo");
|
|
981
|
+
embedUrl.searchParams.set("ath", (_this4.__authorization || {}).authToken || _this4.publicStaticToken);
|
|
982
|
+
embedUrl.searchParams.set("vid", targetHash);
|
|
983
|
+
embedUrl.searchParams.set("ap", "");
|
|
984
|
+
|
|
985
|
+
if (!key.startsWith("reveal")) {
|
|
986
|
+
embedUrl.searchParams.set("m", "");
|
|
987
|
+
embedUrl.searchParams.set("lp", "");
|
|
988
|
+
}
|
|
906
989
|
|
|
907
|
-
|
|
908
|
-
|
|
990
|
+
marketplace.storefront["".concat(key, "_embed_url")] = embedUrl.toString();
|
|
991
|
+
} // eslint-disable-next-line no-empty
|
|
909
992
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
993
|
+
} catch (error) {}
|
|
994
|
+
});
|
|
995
|
+
this.cachedMarketplaces[marketplaceId] = marketplace;
|
|
913
996
|
|
|
914
|
-
|
|
915
|
-
|
|
997
|
+
case 19:
|
|
998
|
+
return _context12.abrupt("return", this.cachedMarketplaces[marketplaceId]);
|
|
916
999
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1000
|
+
case 20:
|
|
1001
|
+
case "end":
|
|
1002
|
+
return _context12.stop();
|
|
1003
|
+
}
|
|
920
1004
|
}
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
|
|
1005
|
+
}, _callee12, this);
|
|
1006
|
+
}));
|
|
1007
|
+
|
|
1008
|
+
function LoadMarketplace(_x12) {
|
|
1009
|
+
return _LoadMarketplace.apply(this, arguments);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
return LoadMarketplace;
|
|
1013
|
+
}()
|
|
924
1014
|
}, {
|
|
925
1015
|
key: "FilteredQuery",
|
|
926
|
-
value: function
|
|
927
|
-
var
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
if (!marketplaceParams) {
|
|
976
|
-
_context13.next = 11;
|
|
977
|
-
break;
|
|
978
|
-
}
|
|
1016
|
+
value: function () {
|
|
1017
|
+
var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
1018
|
+
var _ref12,
|
|
1019
|
+
_ref12$mode,
|
|
1020
|
+
mode,
|
|
1021
|
+
_ref12$sortBy,
|
|
1022
|
+
sortBy,
|
|
1023
|
+
_ref12$sortDesc,
|
|
1024
|
+
sortDesc,
|
|
1025
|
+
filter,
|
|
1026
|
+
editionFilter,
|
|
1027
|
+
attributeFilters,
|
|
1028
|
+
contractAddress,
|
|
1029
|
+
tokenId,
|
|
1030
|
+
currency,
|
|
1031
|
+
marketplaceParams,
|
|
1032
|
+
tenantId,
|
|
1033
|
+
_ref12$collectionInde,
|
|
1034
|
+
collectionIndex,
|
|
1035
|
+
sellerAddress,
|
|
1036
|
+
_ref12$lastNDays,
|
|
1037
|
+
lastNDays,
|
|
1038
|
+
_ref12$start,
|
|
1039
|
+
start,
|
|
1040
|
+
_ref12$limit,
|
|
1041
|
+
limit,
|
|
1042
|
+
params,
|
|
1043
|
+
marketplaceInfo,
|
|
1044
|
+
marketplace,
|
|
1045
|
+
filters,
|
|
1046
|
+
collection,
|
|
1047
|
+
path,
|
|
1048
|
+
_ref14,
|
|
1049
|
+
contents,
|
|
1050
|
+
paging,
|
|
1051
|
+
_args13 = arguments;
|
|
1052
|
+
|
|
1053
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
1054
|
+
while (1) {
|
|
1055
|
+
switch (_context13.prev = _context13.next) {
|
|
1056
|
+
case 0:
|
|
1057
|
+
_ref12 = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {}, _ref12$mode = _ref12.mode, mode = _ref12$mode === void 0 ? "listings" : _ref12$mode, _ref12$sortBy = _ref12.sortBy, sortBy = _ref12$sortBy === void 0 ? "created" : _ref12$sortBy, _ref12$sortDesc = _ref12.sortDesc, sortDesc = _ref12$sortDesc === void 0 ? false : _ref12$sortDesc, filter = _ref12.filter, editionFilter = _ref12.editionFilter, attributeFilters = _ref12.attributeFilters, contractAddress = _ref12.contractAddress, tokenId = _ref12.tokenId, currency = _ref12.currency, marketplaceParams = _ref12.marketplaceParams, tenantId = _ref12.tenantId, _ref12$collectionInde = _ref12.collectionIndex, collectionIndex = _ref12$collectionInde === void 0 ? -1 : _ref12$collectionInde, sellerAddress = _ref12.sellerAddress, _ref12$lastNDays = _ref12.lastNDays, lastNDays = _ref12$lastNDays === void 0 ? -1 : _ref12$lastNDays, _ref12$start = _ref12.start, start = _ref12$start === void 0 ? 0 : _ref12$start, _ref12$limit = _ref12.limit, limit = _ref12$limit === void 0 ? 50 : _ref12$limit;
|
|
1058
|
+
collectionIndex = parseInt(collectionIndex);
|
|
1059
|
+
params = {
|
|
1060
|
+
sort_by: sortBy,
|
|
1061
|
+
sort_descending: sortDesc,
|
|
1062
|
+
start: start,
|
|
1063
|
+
limit: limit
|
|
1064
|
+
};
|
|
979
1065
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1066
|
+
if (!marketplaceParams) {
|
|
1067
|
+
_context13.next = 11;
|
|
1068
|
+
break;
|
|
1069
|
+
}
|
|
984
1070
|
|
|
985
|
-
|
|
986
|
-
|
|
1071
|
+
_context13.next = 6;
|
|
1072
|
+
return this.MarketplaceInfo({
|
|
1073
|
+
marketplaceParams: marketplaceParams
|
|
1074
|
+
});
|
|
987
1075
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
1076
|
+
case 6:
|
|
1077
|
+
marketplaceInfo = _context13.sent;
|
|
992
1078
|
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1079
|
+
if (!(collectionIndex >= 0)) {
|
|
1080
|
+
_context13.next = 11;
|
|
1081
|
+
break;
|
|
1082
|
+
}
|
|
997
1083
|
|
|
998
|
-
|
|
999
|
-
|
|
1084
|
+
_context13.next = 10;
|
|
1085
|
+
return this.Marketplace({
|
|
1086
|
+
marketplaceParams: marketplaceParams
|
|
1087
|
+
});
|
|
1000
1088
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
filters = [];
|
|
1089
|
+
case 10:
|
|
1090
|
+
marketplace = _context13.sent;
|
|
1004
1091
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1092
|
+
case 11:
|
|
1093
|
+
_context13.prev = 11;
|
|
1094
|
+
filters = [];
|
|
1008
1095
|
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1096
|
+
if (sellerAddress) {
|
|
1097
|
+
filters.push("seller:eq:".concat(this.client.utils.FormatAddress(sellerAddress)));
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
if (!(marketplace && collectionIndex >= 0)) {
|
|
1101
|
+
_context13.next = 25;
|
|
1102
|
+
break;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
collection = marketplace.collections[collectionIndex];
|
|
1106
|
+
collection.items.forEach(function (sku) {
|
|
1107
|
+
if (!sku) {
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
var item = marketplace.items.find(function (item) {
|
|
1112
|
+
return item.sku === sku;
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
if (!item) {
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
var address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
|
|
1120
|
+
|
|
1121
|
+
if (address) {
|
|
1122
|
+
filters.push("".concat(mode === "owned" ? "contract_addr" : "contract", ":eq:").concat(Utils.FormatAddress(address)));
|
|
1123
|
+
}
|
|
1124
|
+
}); // No valid items, so there must not be anything relevant in the collection
|
|
1125
|
+
|
|
1126
|
+
if (!(filters.length === 0)) {
|
|
1127
|
+
_context13.next = 23;
|
|
1128
|
+
break;
|
|
1129
|
+
}
|
|
1013
1130
|
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
return;
|
|
1131
|
+
if (!mode.includes("stats")) {
|
|
1132
|
+
_context13.next = 22;
|
|
1133
|
+
break;
|
|
1018
1134
|
}
|
|
1019
1135
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1136
|
+
return _context13.abrupt("return", {});
|
|
1137
|
+
|
|
1138
|
+
case 22:
|
|
1139
|
+
return _context13.abrupt("return", {
|
|
1140
|
+
paging: {
|
|
1141
|
+
start: params.start,
|
|
1142
|
+
limit: params.limit,
|
|
1143
|
+
total: 0,
|
|
1144
|
+
more: false
|
|
1145
|
+
},
|
|
1146
|
+
results: []
|
|
1022
1147
|
});
|
|
1023
1148
|
|
|
1024
|
-
|
|
1025
|
-
|
|
1149
|
+
case 23:
|
|
1150
|
+
_context13.next = 26;
|
|
1151
|
+
break;
|
|
1152
|
+
|
|
1153
|
+
case 25:
|
|
1154
|
+
if (mode !== "owned" && marketplaceInfo || tenantId) {
|
|
1155
|
+
filters.push("tenant:eq:".concat(marketplaceInfo ? marketplaceInfo.tenantId : tenantId));
|
|
1026
1156
|
}
|
|
1027
1157
|
|
|
1028
|
-
|
|
1158
|
+
case 26:
|
|
1159
|
+
if (contractAddress) {
|
|
1160
|
+
if (mode === "owned") {
|
|
1161
|
+
filters.push("contract_addr:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
1162
|
+
} else {
|
|
1163
|
+
filters.push("contract:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
1164
|
+
}
|
|
1029
1165
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1166
|
+
if (tokenId) {
|
|
1167
|
+
filters.push("token:eq:".concat(tokenId));
|
|
1168
|
+
}
|
|
1169
|
+
} else if (filter) {
|
|
1170
|
+
if (mode.includes("listing")) {
|
|
1171
|
+
filters.push("nft/display_name:eq:".concat(filter));
|
|
1172
|
+
} else if (mode === "owned") {
|
|
1173
|
+
filters.push("meta:@>:{\"display_name\":\"".concat(filter, "\"}"));
|
|
1174
|
+
params.exact = false;
|
|
1175
|
+
} else {
|
|
1176
|
+
filters.push("name:eq:".concat(filter));
|
|
1177
|
+
}
|
|
1032
1178
|
}
|
|
1033
|
-
}); // No valid items, so there must not be anything relevant in the collection
|
|
1034
1179
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1180
|
+
if (editionFilter) {
|
|
1181
|
+
if (mode.includes("listing")) {
|
|
1182
|
+
filters.push("nft/edition_name:eq:".concat(editionFilter));
|
|
1183
|
+
} else if (mode === "owned") {
|
|
1184
|
+
filters.push("meta:@>:{\"edition_name\":\"".concat(editionFilter, "\"}"));
|
|
1185
|
+
params.exact = false;
|
|
1186
|
+
} else {
|
|
1187
|
+
filters.push("edition:eq:".concat(editionFilter));
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1039
1190
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
limit: params.limit,
|
|
1052
|
-
total: 0,
|
|
1053
|
-
more: false
|
|
1054
|
-
},
|
|
1055
|
-
results: []
|
|
1056
|
-
});
|
|
1057
|
-
|
|
1058
|
-
case 23:
|
|
1059
|
-
_context13.next = 26;
|
|
1060
|
-
break;
|
|
1061
|
-
|
|
1062
|
-
case 25:
|
|
1063
|
-
if (mode !== "owned" && marketplaceInfo || tenantId) {
|
|
1064
|
-
filters.push("tenant:eq:".concat(marketplaceInfo ? marketplaceInfo.tenantId : tenantId));
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
case 26:
|
|
1068
|
-
if (contractAddress) {
|
|
1069
|
-
if (mode === "owned") {
|
|
1070
|
-
filters.push("contract_addr:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
1071
|
-
} else {
|
|
1072
|
-
filters.push("contract:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
1191
|
+
if (attributeFilters) {
|
|
1192
|
+
attributeFilters.map(function (_ref13) {
|
|
1193
|
+
var name = _ref13.name,
|
|
1194
|
+
value = _ref13.value;
|
|
1195
|
+
|
|
1196
|
+
if (!name || !value) {
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
filters.push("nft/attributes/".concat(name, ":eq:").concat(value));
|
|
1201
|
+
});
|
|
1073
1202
|
}
|
|
1074
1203
|
|
|
1075
|
-
if (
|
|
1076
|
-
filters.push("
|
|
1204
|
+
if (currency) {
|
|
1205
|
+
filters.push("link_type:eq:sol");
|
|
1077
1206
|
}
|
|
1078
|
-
|
|
1079
|
-
if (
|
|
1080
|
-
filters.push("
|
|
1081
|
-
} else if (mode === "owned") {
|
|
1082
|
-
filters.push("meta:@>:{\"display_name\":\"".concat(filter, "\"}"));
|
|
1083
|
-
params.exact = false;
|
|
1084
|
-
} else {
|
|
1085
|
-
filters.push("name:eq:".concat(filter));
|
|
1207
|
+
|
|
1208
|
+
if (lastNDays && lastNDays > 0) {
|
|
1209
|
+
filters.push("created:gt:".concat((Date.now() / 1000 - lastNDays * 24 * 60 * 60).toFixed(0)));
|
|
1086
1210
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1211
|
+
|
|
1212
|
+
_context13.t0 = mode;
|
|
1213
|
+
_context13.next = _context13.t0 === "owned" ? 34 : _context13.t0 === "listings" ? 37 : _context13.t0 === "sales" ? 39 : _context13.t0 === "listing-stats" ? 42 : _context13.t0 === "sales-stats" ? 44 : 46;
|
|
1214
|
+
break;
|
|
1215
|
+
|
|
1216
|
+
case 34:
|
|
1217
|
+
path = UrlJoin("as", "wlt", "nfts");
|
|
1218
|
+
|
|
1219
|
+
if (marketplaceInfo) {
|
|
1220
|
+
path = UrlJoin("as", "wlt", "nfts", marketplaceInfo.tenantId);
|
|
1097
1221
|
}
|
|
1098
|
-
}
|
|
1099
1222
|
|
|
1100
|
-
|
|
1101
|
-
attributeFilters.map(function (_ref10) {
|
|
1102
|
-
var name = _ref10.name,
|
|
1103
|
-
value = _ref10.value;
|
|
1223
|
+
return _context13.abrupt("break", 46);
|
|
1104
1224
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1225
|
+
case 37:
|
|
1226
|
+
path = UrlJoin("as", "mkt", "f");
|
|
1227
|
+
return _context13.abrupt("break", 46);
|
|
1108
1228
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1229
|
+
case 39:
|
|
1230
|
+
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1231
|
+
filters.push("action:eq:SOLD");
|
|
1232
|
+
return _context13.abrupt("break", 46);
|
|
1233
|
+
|
|
1234
|
+
case 42:
|
|
1235
|
+
path = UrlJoin("as", "mkt", "stats", "listed");
|
|
1236
|
+
return _context13.abrupt("break", 46);
|
|
1112
1237
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1238
|
+
case 44:
|
|
1239
|
+
path = UrlJoin("as", "mkt", "stats", "sold");
|
|
1240
|
+
return _context13.abrupt("break", 46);
|
|
1116
1241
|
|
|
1117
|
-
|
|
1118
|
-
filters.
|
|
1119
|
-
|
|
1242
|
+
case 46:
|
|
1243
|
+
if (filters.length > 0) {
|
|
1244
|
+
params.filter = filters;
|
|
1245
|
+
}
|
|
1120
1246
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1247
|
+
if (!mode.includes("stats")) {
|
|
1248
|
+
_context13.next = 51;
|
|
1249
|
+
break;
|
|
1250
|
+
}
|
|
1124
1251
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1252
|
+
_context13.next = 50;
|
|
1253
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1254
|
+
path: path,
|
|
1255
|
+
method: "GET",
|
|
1256
|
+
queryParams: params
|
|
1257
|
+
}));
|
|
1258
|
+
|
|
1259
|
+
case 50:
|
|
1260
|
+
return _context13.abrupt("return", _context13.sent);
|
|
1261
|
+
|
|
1262
|
+
case 51:
|
|
1263
|
+
_context13.t2 = Utils;
|
|
1264
|
+
_context13.next = 54;
|
|
1265
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1266
|
+
path: path,
|
|
1267
|
+
method: "GET",
|
|
1268
|
+
queryParams: params,
|
|
1269
|
+
headers: mode === "owned" ? {
|
|
1270
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1271
|
+
} : {}
|
|
1272
|
+
});
|
|
1127
1273
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1274
|
+
case 54:
|
|
1275
|
+
_context13.t3 = _context13.sent;
|
|
1276
|
+
_context13.next = 57;
|
|
1277
|
+
return _context13.t2.ResponseToJson.call(_context13.t2, _context13.t3);
|
|
1131
1278
|
|
|
1132
|
-
|
|
1279
|
+
case 57:
|
|
1280
|
+
_context13.t1 = _context13.sent;
|
|
1133
1281
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1282
|
+
if (_context13.t1) {
|
|
1283
|
+
_context13.next = 60;
|
|
1284
|
+
break;
|
|
1285
|
+
}
|
|
1137
1286
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1287
|
+
_context13.t1 = [];
|
|
1288
|
+
|
|
1289
|
+
case 60:
|
|
1290
|
+
_ref14 = _context13.t1;
|
|
1291
|
+
contents = _ref14.contents;
|
|
1292
|
+
paging = _ref14.paging;
|
|
1293
|
+
return _context13.abrupt("return", {
|
|
1294
|
+
paging: {
|
|
1295
|
+
start: params.start,
|
|
1296
|
+
limit: params.limit,
|
|
1297
|
+
total: paging.total,
|
|
1298
|
+
more: paging.total > start + limit
|
|
1299
|
+
},
|
|
1300
|
+
results: (contents || []).map(function (item) {
|
|
1301
|
+
return ["owned", "listings"].includes(mode) ? FormatNFT(item) : item;
|
|
1302
|
+
})
|
|
1303
|
+
});
|
|
1142
1304
|
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1305
|
+
case 66:
|
|
1306
|
+
_context13.prev = 66;
|
|
1307
|
+
_context13.t4 = _context13["catch"](11);
|
|
1146
1308
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1309
|
+
if (!(_context13.t4.status && _context13.t4.status.toString() === "404")) {
|
|
1310
|
+
_context13.next = 70;
|
|
1311
|
+
break;
|
|
1312
|
+
}
|
|
1150
1313
|
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1314
|
+
return _context13.abrupt("return", {
|
|
1315
|
+
paging: {
|
|
1316
|
+
start: params.start,
|
|
1317
|
+
limit: params.limit,
|
|
1318
|
+
total: 0,
|
|
1319
|
+
more: false
|
|
1320
|
+
},
|
|
1321
|
+
results: []
|
|
1322
|
+
});
|
|
1155
1323
|
|
|
1156
|
-
|
|
1157
|
-
_context13.
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
path: path,
|
|
1164
|
-
method: "GET",
|
|
1165
|
-
queryParams: params
|
|
1166
|
-
})));
|
|
1167
|
-
|
|
1168
|
-
case 50:
|
|
1169
|
-
return _context13.abrupt("return", _context13.sent);
|
|
1170
|
-
|
|
1171
|
-
case 51:
|
|
1172
|
-
_context13.t2 = _regeneratorRuntime;
|
|
1173
|
-
_context13.t3 = Utils;
|
|
1174
|
-
_context13.next = 55;
|
|
1175
|
-
return _regeneratorRuntime.awrap(this.client.authClient.MakeAuthServiceRequest({
|
|
1176
|
-
path: path,
|
|
1177
|
-
method: "GET",
|
|
1178
|
-
queryParams: params,
|
|
1179
|
-
headers: mode === "owned" ? {
|
|
1180
|
-
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1181
|
-
} : {}
|
|
1182
|
-
}));
|
|
1183
|
-
|
|
1184
|
-
case 55:
|
|
1185
|
-
_context13.t4 = _context13.sent;
|
|
1186
|
-
_context13.t5 = _context13.t3.ResponseToJson.call(_context13.t3, _context13.t4);
|
|
1187
|
-
_context13.next = 59;
|
|
1188
|
-
return _context13.t2.awrap.call(_context13.t2, _context13.t5);
|
|
1189
|
-
|
|
1190
|
-
case 59:
|
|
1191
|
-
_context13.t1 = _context13.sent;
|
|
1192
|
-
|
|
1193
|
-
if (_context13.t1) {
|
|
1194
|
-
_context13.next = 62;
|
|
1195
|
-
break;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
_context13.t1 = [];
|
|
1199
|
-
|
|
1200
|
-
case 62:
|
|
1201
|
-
_ref11 = _context13.t1;
|
|
1202
|
-
contents = _ref11.contents;
|
|
1203
|
-
paging = _ref11.paging;
|
|
1204
|
-
return _context13.abrupt("return", {
|
|
1205
|
-
paging: {
|
|
1206
|
-
start: params.start,
|
|
1207
|
-
limit: params.limit,
|
|
1208
|
-
total: paging.total,
|
|
1209
|
-
more: paging.total > start + limit
|
|
1210
|
-
},
|
|
1211
|
-
results: (contents || []).map(function (item) {
|
|
1212
|
-
return ["owned", "listings"].includes(mode) ? FormatNFT(item) : item;
|
|
1213
|
-
})
|
|
1214
|
-
});
|
|
1215
|
-
|
|
1216
|
-
case 68:
|
|
1217
|
-
_context13.prev = 68;
|
|
1218
|
-
_context13.t6 = _context13["catch"](11);
|
|
1219
|
-
|
|
1220
|
-
if (!(_context13.t6.status && _context13.t6.status.toString() === "404")) {
|
|
1221
|
-
_context13.next = 72;
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
return _context13.abrupt("return", {
|
|
1226
|
-
paging: {
|
|
1227
|
-
start: params.start,
|
|
1228
|
-
limit: params.limit,
|
|
1229
|
-
total: 0,
|
|
1230
|
-
more: false
|
|
1231
|
-
},
|
|
1232
|
-
results: []
|
|
1233
|
-
});
|
|
1234
|
-
|
|
1235
|
-
case 72:
|
|
1236
|
-
throw _context13.t6;
|
|
1237
|
-
|
|
1238
|
-
case 73:
|
|
1239
|
-
case "end":
|
|
1240
|
-
return _context13.stop();
|
|
1324
|
+
case 70:
|
|
1325
|
+
throw _context13.t4;
|
|
1326
|
+
|
|
1327
|
+
case 71:
|
|
1328
|
+
case "end":
|
|
1329
|
+
return _context13.stop();
|
|
1330
|
+
}
|
|
1241
1331
|
}
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1332
|
+
}, _callee13, this, [[11, 66]]);
|
|
1333
|
+
}));
|
|
1334
|
+
|
|
1335
|
+
function FilteredQuery() {
|
|
1336
|
+
return _FilteredQuery.apply(this, arguments);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
return FilteredQuery;
|
|
1340
|
+
}()
|
|
1245
1341
|
}, {
|
|
1246
1342
|
key: "MintingStatus",
|
|
1247
|
-
value: function
|
|
1248
|
-
var
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
_context14.next = 4;
|
|
1261
|
-
return _regeneratorRuntime.awrap(this.MarketplaceInfo({
|
|
1262
|
-
marketplaceParams: marketplaceParams || this.selectedMarketplaceInfo
|
|
1263
|
-
}));
|
|
1264
|
-
|
|
1265
|
-
case 4:
|
|
1266
|
-
marketplaceInfo = _context14.sent;
|
|
1267
|
-
tenantId = marketplaceInfo.tenantId;
|
|
1268
|
-
|
|
1269
|
-
case 6:
|
|
1270
|
-
_context14.prev = 6;
|
|
1271
|
-
_context14.next = 9;
|
|
1272
|
-
return _regeneratorRuntime.awrap(Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1273
|
-
path: UrlJoin("as", "wlt", "status", "act", tenantId),
|
|
1274
|
-
method: "GET",
|
|
1275
|
-
headers: {
|
|
1276
|
-
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1343
|
+
value: function () {
|
|
1344
|
+
var _MintingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref15) {
|
|
1345
|
+
var marketplaceParams, tenantId, marketplaceInfo, response;
|
|
1346
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
1347
|
+
while (1) {
|
|
1348
|
+
switch (_context14.prev = _context14.next) {
|
|
1349
|
+
case 0:
|
|
1350
|
+
marketplaceParams = _ref15.marketplaceParams, tenantId = _ref15.tenantId;
|
|
1351
|
+
|
|
1352
|
+
if (tenantId) {
|
|
1353
|
+
_context14.next = 6;
|
|
1354
|
+
break;
|
|
1277
1355
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1356
|
+
|
|
1357
|
+
_context14.next = 4;
|
|
1358
|
+
return this.MarketplaceInfo({
|
|
1359
|
+
marketplaceParams: marketplaceParams || this.selectedMarketplaceInfo
|
|
1360
|
+
});
|
|
1361
|
+
|
|
1362
|
+
case 4:
|
|
1363
|
+
marketplaceInfo = _context14.sent;
|
|
1364
|
+
tenantId = marketplaceInfo.tenantId;
|
|
1365
|
+
|
|
1366
|
+
case 6:
|
|
1367
|
+
_context14.prev = 6;
|
|
1368
|
+
_context14.next = 9;
|
|
1369
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1370
|
+
path: UrlJoin("as", "wlt", "status", "act", tenantId),
|
|
1371
|
+
method: "GET",
|
|
1372
|
+
headers: {
|
|
1373
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1374
|
+
}
|
|
1375
|
+
}));
|
|
1376
|
+
|
|
1377
|
+
case 9:
|
|
1378
|
+
response = _context14.sent;
|
|
1379
|
+
return _context14.abrupt("return", response.map(function (status) {
|
|
1380
|
+
var _status$op$split = status.op.split(":"),
|
|
1381
|
+
_status$op$split2 = _slicedToArray(_status$op$split, 3),
|
|
1382
|
+
op = _status$op$split2[0],
|
|
1383
|
+
address = _status$op$split2[1],
|
|
1384
|
+
id = _status$op$split2[2];
|
|
1385
|
+
|
|
1386
|
+
address = address.startsWith("0x") ? Utils.FormatAddress(address) : address;
|
|
1387
|
+
var confirmationId, tokenId;
|
|
1388
|
+
|
|
1389
|
+
if (op === "nft-buy") {
|
|
1390
|
+
confirmationId = id;
|
|
1391
|
+
} else if (op === "nft-claim") {
|
|
1392
|
+
confirmationId = id;
|
|
1393
|
+
status.marketplaceId = address;
|
|
1394
|
+
|
|
1395
|
+
if (status.extra && status.extra["0"]) {
|
|
1396
|
+
address = status.extra.token_addr;
|
|
1397
|
+
tokenId = status.extra.token_id_str;
|
|
1398
|
+
}
|
|
1399
|
+
} else if (op === "nft-redeem") {
|
|
1400
|
+
confirmationId = status.op.split(":").slice(-1)[0];
|
|
1401
|
+
} else {
|
|
1402
|
+
tokenId = id;
|
|
1301
1403
|
}
|
|
1302
|
-
} else if (op === "nft-redeem") {
|
|
1303
|
-
confirmationId = status.op.split(":").slice(-1)[0];
|
|
1304
|
-
} else {
|
|
1305
|
-
tokenId = id;
|
|
1306
|
-
}
|
|
1307
1404
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1405
|
+
if (op === "nft-transfer") {
|
|
1406
|
+
confirmationId = status.extra && status.extra.trans_id;
|
|
1407
|
+
}
|
|
1311
1408
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1409
|
+
return _objectSpread(_objectSpread({}, status), {}, {
|
|
1410
|
+
timestamp: new Date(status.ts),
|
|
1411
|
+
state: status.state && _typeof(status.state) === "object" ? Object.values(status.state) : status.state,
|
|
1412
|
+
extra: status.extra && _typeof(status.extra) === "object" ? Object.values(status.extra) : status.extra,
|
|
1413
|
+
confirmationId: confirmationId,
|
|
1414
|
+
op: op,
|
|
1415
|
+
address: address,
|
|
1416
|
+
tokenId: tokenId
|
|
1417
|
+
});
|
|
1418
|
+
}).sort(function (a, b) {
|
|
1419
|
+
return a.ts < b.ts ? 1 : -1;
|
|
1420
|
+
}));
|
|
1421
|
+
|
|
1422
|
+
case 13:
|
|
1423
|
+
_context14.prev = 13;
|
|
1424
|
+
_context14.t0 = _context14["catch"](6);
|
|
1425
|
+
this.Log("Failed to retrieve minting status", true);
|
|
1426
|
+
this.Log(_context14.t0);
|
|
1427
|
+
return _context14.abrupt("return", []);
|
|
1428
|
+
|
|
1429
|
+
case 18:
|
|
1430
|
+
case "end":
|
|
1431
|
+
return _context14.stop();
|
|
1432
|
+
}
|
|
1335
1433
|
}
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1434
|
+
}, _callee14, this, [[6, 13]]);
|
|
1435
|
+
}));
|
|
1436
|
+
|
|
1437
|
+
function MintingStatus(_x15) {
|
|
1438
|
+
return _MintingStatus.apply(this, arguments);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
return MintingStatus;
|
|
1442
|
+
}()
|
|
1339
1443
|
}], [{
|
|
1340
1444
|
key: "Initialize",
|
|
1341
|
-
value: function
|
|
1342
|
-
var
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1445
|
+
value: function () {
|
|
1446
|
+
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref16) {
|
|
1447
|
+
var _ref16$network, network, _ref16$mode, mode, marketplaceParams, _ref16$storeAuthToken, storeAuthToken, _ref17, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, client, walletClient, url, savedToken;
|
|
1448
|
+
|
|
1449
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
1450
|
+
while (1) {
|
|
1451
|
+
switch (_context15.prev = _context15.next) {
|
|
1452
|
+
case 0:
|
|
1453
|
+
_ref16$network = _ref16.network, network = _ref16$network === void 0 ? "main" : _ref16$network, _ref16$mode = _ref16.mode, mode = _ref16$mode === void 0 ? "production" : _ref16$mode, marketplaceParams = _ref16.marketplaceParams, _ref16$storeAuthToken = _ref16.storeAuthToken, storeAuthToken = _ref16$storeAuthToken === void 0 ? true : _ref16$storeAuthToken;
|
|
1454
|
+
_ref17 = marketplaceParams || {}, tenantSlug = _ref17.tenantSlug, marketplaceSlug = _ref17.marketplaceSlug, marketplaceId = _ref17.marketplaceId, marketplaceHash = _ref17.marketplaceHash;
|
|
1455
|
+
|
|
1456
|
+
if (Configuration[network]) {
|
|
1457
|
+
_context15.next = 6;
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1355
1460
|
|
|
1356
|
-
|
|
1461
|
+
throw Error("ElvWalletClient: Invalid network ".concat(network));
|
|
1357
1462
|
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
throw Error("ElvWalletClient: Invalid mode ".concat(mode));
|
|
1365
|
-
|
|
1366
|
-
case 8:
|
|
1367
|
-
_context15.next = 10;
|
|
1368
|
-
return _regeneratorRuntime.awrap(ElvClient.FromNetworkName({
|
|
1369
|
-
networkName: network,
|
|
1370
|
-
assumeV3: true
|
|
1371
|
-
}));
|
|
1372
|
-
|
|
1373
|
-
case 10:
|
|
1374
|
-
client = _context15.sent;
|
|
1375
|
-
walletClient = new ElvWalletClient({
|
|
1376
|
-
client: client,
|
|
1377
|
-
network: network,
|
|
1378
|
-
mode: mode,
|
|
1379
|
-
marketplaceInfo: {
|
|
1380
|
-
tenantSlug: tenantSlug,
|
|
1381
|
-
marketplaceSlug: marketplaceSlug,
|
|
1382
|
-
marketplaceId: marketplaceHash ? client.utils.DecodeVersionHash(marketplaceHash).objectId : marketplaceId,
|
|
1383
|
-
marketplaceHash: marketplaceHash
|
|
1384
|
-
},
|
|
1385
|
-
storeAuthToken: storeAuthToken
|
|
1386
|
-
});
|
|
1387
|
-
|
|
1388
|
-
if (!(window && window.location && window.location.href)) {
|
|
1389
|
-
_context15.next = 31;
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1463
|
+
case 6:
|
|
1464
|
+
if (Configuration[network][mode]) {
|
|
1465
|
+
_context15.next = 8;
|
|
1466
|
+
break;
|
|
1467
|
+
}
|
|
1392
1468
|
|
|
1393
|
-
|
|
1469
|
+
throw Error("ElvWalletClient: Invalid mode ".concat(mode));
|
|
1394
1470
|
|
|
1395
|
-
|
|
1396
|
-
_context15.next =
|
|
1397
|
-
|
|
1398
|
-
|
|
1471
|
+
case 8:
|
|
1472
|
+
_context15.next = 10;
|
|
1473
|
+
return ElvClient.FromNetworkName({
|
|
1474
|
+
networkName: network,
|
|
1475
|
+
assumeV3: true
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
case 10:
|
|
1479
|
+
client = _context15.sent;
|
|
1480
|
+
walletClient = new ElvWalletClient({
|
|
1481
|
+
client: client,
|
|
1482
|
+
network: network,
|
|
1483
|
+
mode: mode,
|
|
1484
|
+
marketplaceInfo: {
|
|
1485
|
+
tenantSlug: tenantSlug,
|
|
1486
|
+
marketplaceSlug: marketplaceSlug,
|
|
1487
|
+
marketplaceId: marketplaceHash ? client.utils.DecodeVersionHash(marketplaceHash).objectId : marketplaceId,
|
|
1488
|
+
marketplaceHash: marketplaceHash
|
|
1489
|
+
},
|
|
1490
|
+
storeAuthToken: storeAuthToken
|
|
1491
|
+
});
|
|
1399
1492
|
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1493
|
+
if (!(window && window.location && window.location.href)) {
|
|
1494
|
+
_context15.next = 31;
|
|
1495
|
+
break;
|
|
1496
|
+
}
|
|
1404
1497
|
|
|
1405
|
-
|
|
1406
|
-
url.searchParams["delete"]("elvToken");
|
|
1407
|
-
window.history.replaceState("", "", url);
|
|
1408
|
-
_context15.next = 31;
|
|
1409
|
-
break;
|
|
1498
|
+
url = new URL(window.location.href);
|
|
1410
1499
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1500
|
+
if (!url.searchParams.get("elvToken")) {
|
|
1501
|
+
_context15.next = 21;
|
|
1502
|
+
break;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
_context15.next = 17;
|
|
1506
|
+
return walletClient.Authenticate({
|
|
1507
|
+
token: url.searchParams.get("elvToken")
|
|
1508
|
+
});
|
|
1509
|
+
|
|
1510
|
+
case 17:
|
|
1511
|
+
url.searchParams["delete"]("elvToken");
|
|
1512
|
+
window.history.replaceState("", "", url);
|
|
1413
1513
|
_context15.next = 31;
|
|
1414
1514
|
break;
|
|
1415
|
-
}
|
|
1416
1515
|
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1516
|
+
case 21:
|
|
1517
|
+
if (!(storeAuthToken && typeof localStorage !== "undefined")) {
|
|
1518
|
+
_context15.next = 31;
|
|
1519
|
+
break;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
_context15.prev = 22;
|
|
1523
|
+
// Load saved auth token
|
|
1524
|
+
savedToken = localStorage.getItem("__elv-token-".concat(network));
|
|
1525
|
+
|
|
1526
|
+
if (!savedToken) {
|
|
1527
|
+
_context15.next = 27;
|
|
1528
|
+
break;
|
|
1529
|
+
}
|
|
1420
1530
|
|
|
1421
|
-
if (!savedToken) {
|
|
1422
1531
|
_context15.next = 27;
|
|
1532
|
+
return walletClient.Authenticate({
|
|
1533
|
+
token: savedToken
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
case 27:
|
|
1537
|
+
_context15.next = 31;
|
|
1423
1538
|
break;
|
|
1424
|
-
}
|
|
1425
1539
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
}));
|
|
1540
|
+
case 29:
|
|
1541
|
+
_context15.prev = 29;
|
|
1542
|
+
_context15.t0 = _context15["catch"](22);
|
|
1430
1543
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1544
|
+
case 31:
|
|
1545
|
+
_context15.next = 33;
|
|
1546
|
+
return walletClient.LoadAvailableMarketplaces();
|
|
1434
1547
|
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
_context15.t0 = _context15["catch"](22);
|
|
1548
|
+
case 33:
|
|
1549
|
+
return _context15.abrupt("return", walletClient);
|
|
1438
1550
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1551
|
+
case 34:
|
|
1552
|
+
case "end":
|
|
1553
|
+
return _context15.stop();
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}, _callee15, null, [[22, 29]]);
|
|
1557
|
+
}));
|
|
1442
1558
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1559
|
+
function Initialize(_x16) {
|
|
1560
|
+
return _Initialize.apply(this, arguments);
|
|
1561
|
+
}
|
|
1445
1562
|
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
return _context15.stop();
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
}, null, null, [[22, 29]]);
|
|
1452
|
-
}
|
|
1563
|
+
return Initialize;
|
|
1564
|
+
}()
|
|
1453
1565
|
}]);
|
|
1454
1566
|
|
|
1455
1567
|
return ElvWalletClient;
|