@eluvio/elv-client-js 4.0.114 → 4.0.115
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 +67 -0
- package/dist/ElvClient-node-min.js +66 -0
- package/dist/ElvFrameClient-min.js +60 -0
- package/dist/ElvPermissionsClient-min.js +60 -0
- package/dist/ElvWalletClient-min.js +67 -0
- package/dist/ElvWalletClient-node-min.js +66 -0
- package/dist/src/AuthorizationClient.js +2169 -0
- package/dist/src/ContentObjectAudit.js +175 -0
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/Crypto.js +412 -0
- package/dist/src/ElvClient.js +2044 -0
- package/dist/src/ElvWallet.js +245 -0
- package/dist/src/EthClient.js +1154 -0
- package/dist/src/FrameClient.js +485 -0
- package/dist/src/HttpClient.js +315 -0
- package/dist/src/Id.js +21 -0
- package/dist/src/LogMessage.js +25 -0
- package/dist/src/PermissionsClient.js +1544 -0
- package/dist/src/RemoteSigner.js +385 -0
- package/dist/src/UserProfileClient.js +1450 -0
- package/dist/src/Utils.js +894 -0
- package/dist/src/Validation.js +121 -0
- package/dist/src/abr_profiles/abr_profile_live_drm.js +1661 -0
- package/dist/src/abr_profiles/abr_profile_live_to_vod.js +1606 -0
- package/dist/src/client/ABRPublishing.js +1018 -0
- package/dist/src/client/AccessGroups.js +1503 -0
- package/dist/src/client/ContentAccess.js +5195 -0
- package/dist/src/client/ContentManagement.js +2680 -0
- package/dist/src/client/Contracts.js +1520 -0
- package/dist/src/client/Files.js +2181 -0
- package/dist/src/client/LiveConf.js +569 -0
- package/dist/src/client/LiveStream.js +2640 -0
- package/dist/src/client/NFT.js +162 -0
- package/dist/src/client/NTP.js +581 -0
- package/dist/src/contracts/v2/AccessIndexor.js +831 -0
- package/dist/src/contracts/v2/Accessible.js +31 -0
- package/dist/src/contracts/v2/BaseAccessControlGroup.js +1263 -0
- package/dist/src/contracts/v2/BaseAccessWallet.js +1609 -0
- package/dist/src/contracts/v2/BaseAccessWalletFactory.js +93 -0
- package/dist/src/contracts/v2/BaseContent.js +1076 -0
- package/dist/src/contracts/v2/BaseContentFactory.js +219 -0
- package/dist/src/contracts/v2/BaseContentSpace.js +1352 -0
- package/dist/src/contracts/v2/BaseContentType.js +364 -0
- package/dist/src/contracts/v2/BaseFactory.js +107 -0
- package/dist/src/contracts/v2/BaseGroupFactory.js +93 -0
- package/dist/src/contracts/v2/BaseLibrary.js +1041 -0
- package/dist/src/contracts/v2/BaseLibraryFactory.js +96 -0
- package/dist/src/contracts/v2/Certifyer.js +86 -0
- package/dist/src/contracts/v2/Container.js +540 -0
- package/dist/src/contracts/v2/Content.js +443 -0
- package/dist/src/contracts/v2/Editable.js +306 -0
- package/dist/src/contracts/v2/ExternalUserWallet.js +379 -0
- package/dist/src/contracts/v2/IFactorySpace.js +57 -0
- package/dist/src/contracts/v2/IKmsSpace.js +52 -0
- package/dist/src/contracts/v2/INodeSpace.js +18 -0
- package/dist/src/contracts/v2/IUserSpace.js +18 -0
- package/dist/src/contracts/v2/LvRecordableStream.js +1037 -0
- package/dist/src/contracts/v2/LvRecording.js +627 -0
- package/dist/src/contracts/v2/LvStreamRightsHolder.js +562 -0
- package/dist/src/contracts/v2/MetaObject.js +119 -0
- package/dist/src/contracts/v2/Node.js +167 -0
- package/dist/src/contracts/v2/NodeSpace.js +273 -0
- package/dist/src/contracts/v2/Ownable.js +87 -0
- package/dist/src/contracts/v2/PaymentService.js +627 -0
- package/dist/src/contracts/v2/Precompile.js +15 -0
- package/dist/src/contracts/v2/Transactable.js +82 -0
- package/dist/src/contracts/v2/UserSpace.js +29 -0
- package/dist/src/contracts/v2/Utils.js +18 -0
- package/dist/src/contracts/v2/Verifier.js +53 -0
- package/dist/src/contracts/v2/strings.js +4 -0
- package/dist/src/contracts/v3/AccessIndexor.js +774 -0
- package/dist/src/contracts/v3/Accessible.js +232 -0
- package/dist/src/contracts/v3/Adminable.js +107 -0
- package/dist/src/contracts/v3/AvailsDelivery.js +586 -0
- package/dist/src/contracts/v3/BaseAccessControlGroup.js +1603 -0
- package/dist/src/contracts/v3/BaseAccessWallet.js +1628 -0
- package/dist/src/contracts/v3/BaseAccessWalletFactory.js +112 -0
- package/dist/src/contracts/v3/BaseContent.js +1312 -0
- package/dist/src/contracts/v3/BaseContentFactory.js +183 -0
- package/dist/src/contracts/v3/BaseContentFactoryExt.js +175 -0
- package/dist/src/contracts/v3/BaseContentSpace.js +1515 -0
- package/dist/src/contracts/v3/BaseContentType.js +527 -0
- package/dist/src/contracts/v3/BaseFactory.js +126 -0
- package/dist/src/contracts/v3/BaseGroupFactory.js +112 -0
- package/dist/src/contracts/v3/BaseLibrary.js +1204 -0
- package/dist/src/contracts/v3/BaseLibraryFactory.js +115 -0
- package/dist/src/contracts/v3/BaseTenantSpace.js +1587 -0
- package/dist/src/contracts/v3/Certifyer.js +86 -0
- package/dist/src/contracts/v3/Container.js +739 -0
- package/dist/src/contracts/v3/Content.js +438 -0
- package/dist/src/contracts/v3/CounterObject.js +243 -0
- package/dist/src/contracts/v3/Editable.js +519 -0
- package/dist/src/contracts/v3/EncToken.js +4 -0
- package/dist/src/contracts/v3/ExternalUserWallet.js +587 -0
- package/dist/src/contracts/v3/IAdmin.js +18 -0
- package/dist/src/contracts/v3/IFactorySpace.js +57 -0
- package/dist/src/contracts/v3/IKmsSpace.js +52 -0
- package/dist/src/contracts/v3/INodeSpace.js +18 -0
- package/dist/src/contracts/v3/IUserSpace.js +32 -0
- package/dist/src/contracts/v3/LvRecordableStream.js +1032 -0
- package/dist/src/contracts/v3/LvRecording.js +650 -0
- package/dist/src/contracts/v3/LvStreamRightsHolder.js +557 -0
- package/dist/src/contracts/v3/MetaObject.js +144 -0
- package/dist/src/contracts/v3/Node.js +178 -0
- package/dist/src/contracts/v3/NodeSpace.js +284 -0
- package/dist/src/contracts/v3/Ownable.js +98 -0
- package/dist/src/contracts/v3/PaymentService.js +622 -0
- package/dist/src/contracts/v3/Precompile.js +26 -0
- package/dist/src/contracts/v3/TenantFuncsBase.js +351 -0
- package/dist/src/contracts/v3/Transactable.js +82 -0
- package/dist/src/contracts/v3/UserSpace.js +43 -0
- package/dist/src/contracts/v3/Utils.js +18 -0
- package/dist/src/contracts/v3/Verifier.js +53 -0
- package/dist/src/contracts/v3/strings.js +4 -0
- package/dist/src/contracts/v3b/BaseAccessControlGroup.js +1704 -0
- package/dist/src/events/Topics.js +1793 -0
- package/dist/src/index.js +8 -0
- package/dist/src/walletClient/ClientMethods.js +3102 -0
- package/dist/src/walletClient/Configuration.js +38 -0
- package/dist/src/walletClient/Notifications.js +168 -0
- package/dist/src/walletClient/Profile.js +332 -0
- package/dist/src/walletClient/Utils.js +281 -0
- package/dist/src/walletClient/index.js +2106 -0
- package/package.json +1 -1
- package/src/AuthorizationClient.js +24 -16
- package/src/ElvClient.js +19 -0
- package/src/client/ContentAccess.js +10 -1
- package/src/client/LiveConf.js +10 -8
- package/src/client/LiveStream.js +6 -4
|
@@ -0,0 +1,3102 @@
|
|
|
1
|
+
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
|
+
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
3
|
+
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
var Utils = require("../Utils");
|
|
7
|
+
var UrlJoin = require("url-join");
|
|
8
|
+
var _require = require("./Utils"),
|
|
9
|
+
FormatNFTDetails = _require.FormatNFTDetails,
|
|
10
|
+
FormatNFTMetadata = _require.FormatNFTMetadata,
|
|
11
|
+
FormatNFT = _require.FormatNFT;
|
|
12
|
+
var MergeWith = require("lodash/mergeWith");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Methods
|
|
16
|
+
*
|
|
17
|
+
* @module ClientMethods
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/* USER INFO */
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* <b><i>Requires login</i></b>
|
|
24
|
+
*
|
|
25
|
+
* Retrieve information about the user, including the address, wallet type, and (for custodial users) email address.
|
|
26
|
+
*
|
|
27
|
+
* @methodGroup User
|
|
28
|
+
*
|
|
29
|
+
* @returns {Object} - User info
|
|
30
|
+
*/
|
|
31
|
+
exports.UserInfo = function () {
|
|
32
|
+
if (!this.loggedIn) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
name: this.__authorization.email || this.UserAddress(),
|
|
37
|
+
address: this.UserAddress(),
|
|
38
|
+
email: this.__authorization.email,
|
|
39
|
+
walletType: this.__authorization.walletType,
|
|
40
|
+
walletName: this.__authorization.walletName
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* <b><i>Requires login</i></b>
|
|
46
|
+
*
|
|
47
|
+
* Retrieve the address of the current user.
|
|
48
|
+
*
|
|
49
|
+
* @methodGroup User
|
|
50
|
+
*
|
|
51
|
+
* @returns {string} - The address of the current user
|
|
52
|
+
*/
|
|
53
|
+
exports.UserAddress = function () {
|
|
54
|
+
if (!this.loggedIn) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
return this.client.utils.DecodeSignedToken(this.AuthToken()).payload.adr;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* <b><i>Requires login</i></b>
|
|
62
|
+
*
|
|
63
|
+
* Retrieve the fund balances for the current user
|
|
64
|
+
*
|
|
65
|
+
* @methodGroup User
|
|
66
|
+
* @returns {Promise<Object>} - Returns balances for the user. All values are in USD.
|
|
67
|
+
* <ul>
|
|
68
|
+
* <li>- totalWalletBalance - Total balance of the users sales and wallet balance purchases</li>
|
|
69
|
+
* <li>- availableWalletBalance - Balance available for purchasing items</li>
|
|
70
|
+
* <li>- pendingWalletBalance - Balance unavailable for purchasing items</li>
|
|
71
|
+
* <li>- withdrawableWalletBalance - Amount that is available for withdrawal</li>
|
|
72
|
+
* <li>- usedBalance - <i>(Only included if user has set up Solana link with the Phantom wallet)</i> Available USDC balance of the user's Solana wallet</li>
|
|
73
|
+
* </ul>
|
|
74
|
+
*/
|
|
75
|
+
exports.UserWalletBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
76
|
+
var checkOnboard,
|
|
77
|
+
_yield$this$client$ut,
|
|
78
|
+
balance,
|
|
79
|
+
usage_hold,
|
|
80
|
+
payout_hold,
|
|
81
|
+
locked_offer_balance,
|
|
82
|
+
stripe_id,
|
|
83
|
+
stripe_payouts_enabled,
|
|
84
|
+
userStripeId,
|
|
85
|
+
userStripeEnabled,
|
|
86
|
+
totalWalletBalance,
|
|
87
|
+
lockedWalletBalance,
|
|
88
|
+
availableWalletBalance,
|
|
89
|
+
pendingWalletBalance,
|
|
90
|
+
withdrawableWalletBalance,
|
|
91
|
+
rootUrl,
|
|
92
|
+
balances,
|
|
93
|
+
_args = arguments;
|
|
94
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
95
|
+
while (1) switch (_context.prev = _context.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
checkOnboard = _args.length > 0 && _args[0] !== undefined ? _args[0] : false;
|
|
98
|
+
if (this.loggedIn) {
|
|
99
|
+
_context.next = 3;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return _context.abrupt("return");
|
|
103
|
+
case 3:
|
|
104
|
+
_context.t0 = this.client.utils;
|
|
105
|
+
_context.next = 6;
|
|
106
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
107
|
+
path: UrlJoin("as", "wlt", "mkt", "bal"),
|
|
108
|
+
method: "GET",
|
|
109
|
+
headers: {
|
|
110
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
case 6:
|
|
114
|
+
_context.t1 = _context.sent;
|
|
115
|
+
_context.next = 9;
|
|
116
|
+
return _context.t0.ResponseToJson.call(_context.t0, _context.t1);
|
|
117
|
+
case 9:
|
|
118
|
+
_yield$this$client$ut = _context.sent;
|
|
119
|
+
balance = _yield$this$client$ut.balance;
|
|
120
|
+
usage_hold = _yield$this$client$ut.usage_hold;
|
|
121
|
+
payout_hold = _yield$this$client$ut.payout_hold;
|
|
122
|
+
locked_offer_balance = _yield$this$client$ut.locked_offer_balance;
|
|
123
|
+
stripe_id = _yield$this$client$ut.stripe_id;
|
|
124
|
+
stripe_payouts_enabled = _yield$this$client$ut.stripe_payouts_enabled;
|
|
125
|
+
userStripeId = stripe_id;
|
|
126
|
+
userStripeEnabled = stripe_payouts_enabled;
|
|
127
|
+
totalWalletBalance = parseFloat(balance || 0);
|
|
128
|
+
lockedWalletBalance = parseFloat(locked_offer_balance || 0);
|
|
129
|
+
availableWalletBalance = Math.max(0, totalWalletBalance - parseFloat(usage_hold || 0) - lockedWalletBalance);
|
|
130
|
+
pendingWalletBalance = Math.max(0, totalWalletBalance - availableWalletBalance);
|
|
131
|
+
withdrawableWalletBalance = Math.max(0, totalWalletBalance - parseFloat(Math.max(payout_hold, lockedWalletBalance) || 0));
|
|
132
|
+
if (!(checkOnboard && stripe_id && !stripe_payouts_enabled)) {
|
|
133
|
+
_context.next = 30;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
// Refresh stripe enabled flag
|
|
137
|
+
rootUrl = new URL(UrlJoin(window.location.origin, window.location.pathname)).toString();
|
|
138
|
+
_context.next = 27;
|
|
139
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
140
|
+
path: UrlJoin("as", "wlt", "onb", "stripe"),
|
|
141
|
+
method: "POST",
|
|
142
|
+
body: {
|
|
143
|
+
country: "US",
|
|
144
|
+
mode: this.mode,
|
|
145
|
+
refresh_url: rootUrl.toString(),
|
|
146
|
+
return_url: rootUrl.toString()
|
|
147
|
+
},
|
|
148
|
+
headers: {
|
|
149
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
case 27:
|
|
153
|
+
_context.next = 29;
|
|
154
|
+
return this.UserWalletBalance(false);
|
|
155
|
+
case 29:
|
|
156
|
+
return _context.abrupt("return", _context.sent);
|
|
157
|
+
case 30:
|
|
158
|
+
balances = {
|
|
159
|
+
totalWalletBalance: totalWalletBalance,
|
|
160
|
+
availableWalletBalance: availableWalletBalance,
|
|
161
|
+
lockedWalletBalance: lockedWalletBalance,
|
|
162
|
+
pendingWalletBalance: pendingWalletBalance,
|
|
163
|
+
withdrawableWalletBalance: withdrawableWalletBalance
|
|
164
|
+
};
|
|
165
|
+
if (userStripeEnabled) {
|
|
166
|
+
balances.userStripeId = userStripeId;
|
|
167
|
+
balances.userStripeEnabled = userStripeEnabled;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// TODO: integrate
|
|
171
|
+
/*
|
|
172
|
+
if(cryptoStore.usdcConnected) {
|
|
173
|
+
balances.usdcBalance = cryptoStore.phantomUSDCBalance;
|
|
174
|
+
}
|
|
175
|
+
*/
|
|
176
|
+
return _context.abrupt("return", balances);
|
|
177
|
+
case 33:
|
|
178
|
+
case "end":
|
|
179
|
+
return _context.stop();
|
|
180
|
+
}
|
|
181
|
+
}, _callee, this);
|
|
182
|
+
}));
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Retrieve all valid names for filtering user items. Full item names are required for filtering results by name.
|
|
186
|
+
*
|
|
187
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
188
|
+
*
|
|
189
|
+
* @methodGroup User
|
|
190
|
+
* @namedParams
|
|
191
|
+
* @param {string=} userAddress - Address of a user
|
|
192
|
+
* @param {Object=} marketplaceParams - Parameters of a marketplace to filter results by
|
|
193
|
+
*
|
|
194
|
+
* @returns {Promise<Array<String>>} - A list of item names
|
|
195
|
+
*/
|
|
196
|
+
exports.UserItemNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
197
|
+
var _ref3,
|
|
198
|
+
marketplaceParams,
|
|
199
|
+
userAddress,
|
|
200
|
+
filters,
|
|
201
|
+
_args2 = arguments;
|
|
202
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
203
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
204
|
+
case 0:
|
|
205
|
+
_ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, marketplaceParams = _ref3.marketplaceParams, userAddress = _ref3.userAddress;
|
|
206
|
+
filters = [];
|
|
207
|
+
if (!marketplaceParams) {
|
|
208
|
+
_context2.next = 10;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
_context2.t0 = filters;
|
|
212
|
+
_context2.t1 = "tenant:eq:";
|
|
213
|
+
_context2.next = 7;
|
|
214
|
+
return this.MarketplaceInfo({
|
|
215
|
+
marketplaceParams: marketplaceParams
|
|
216
|
+
});
|
|
217
|
+
case 7:
|
|
218
|
+
_context2.t2 = _context2.sent.tenantId;
|
|
219
|
+
_context2.t3 = _context2.t1.concat.call(_context2.t1, _context2.t2);
|
|
220
|
+
_context2.t0.push.call(_context2.t0, _context2.t3);
|
|
221
|
+
case 10:
|
|
222
|
+
if (userAddress) {
|
|
223
|
+
filters.push("wlt:eq:".concat(Utils.FormatAddress(userAddress)));
|
|
224
|
+
}
|
|
225
|
+
_context2.t4 = Utils;
|
|
226
|
+
_context2.next = 14;
|
|
227
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
228
|
+
path: UrlJoin("as", "wlt", "names"),
|
|
229
|
+
method: "GET",
|
|
230
|
+
queryParams: {
|
|
231
|
+
filter: filters
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
case 14:
|
|
235
|
+
_context2.t5 = _context2.sent;
|
|
236
|
+
_context2.next = 17;
|
|
237
|
+
return _context2.t4.ResponseToJson.call(_context2.t4, _context2.t5);
|
|
238
|
+
case 17:
|
|
239
|
+
return _context2.abrupt("return", _context2.sent);
|
|
240
|
+
case 18:
|
|
241
|
+
case "end":
|
|
242
|
+
return _context2.stop();
|
|
243
|
+
}
|
|
244
|
+
}, _callee2, this);
|
|
245
|
+
}));
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Retrieve all valid edition names for filtering the specified item. Full edition names are required for filtering results by edition.
|
|
249
|
+
*
|
|
250
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
251
|
+
*
|
|
252
|
+
* @methodGroup User
|
|
253
|
+
* @namedParams
|
|
254
|
+
* @param {string} displayName - Name of an item
|
|
255
|
+
*
|
|
256
|
+
* @returns {Promise<Array<String>>} - A list of item editions
|
|
257
|
+
*/
|
|
258
|
+
exports.UserItemEditionNames = /*#__PURE__*/function () {
|
|
259
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
|
|
260
|
+
var displayName;
|
|
261
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
262
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
263
|
+
case 0:
|
|
264
|
+
displayName = _ref4.displayName;
|
|
265
|
+
_context3.t0 = Utils;
|
|
266
|
+
_context3.next = 4;
|
|
267
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
268
|
+
path: UrlJoin("as", "wlt", "editions"),
|
|
269
|
+
method: "GET",
|
|
270
|
+
queryParams: {
|
|
271
|
+
filter: "meta/display_name:eq:".concat(displayName)
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
case 4:
|
|
275
|
+
_context3.t1 = _context3.sent;
|
|
276
|
+
_context3.next = 7;
|
|
277
|
+
return _context3.t0.ResponseToJson.call(_context3.t0, _context3.t1);
|
|
278
|
+
case 7:
|
|
279
|
+
return _context3.abrupt("return", _context3.sent);
|
|
280
|
+
case 8:
|
|
281
|
+
case "end":
|
|
282
|
+
return _context3.stop();
|
|
283
|
+
}
|
|
284
|
+
}, _callee3, this);
|
|
285
|
+
}));
|
|
286
|
+
return function (_x) {
|
|
287
|
+
return _ref5.apply(this, arguments);
|
|
288
|
+
};
|
|
289
|
+
}();
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Retrieve all valid attribute names and values. Full attribute names and values are required for filtering results by attribute.
|
|
293
|
+
*
|
|
294
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
295
|
+
*
|
|
296
|
+
* @methodGroup User
|
|
297
|
+
* @namedParams
|
|
298
|
+
* @param {string=} userAddress - Address of a user
|
|
299
|
+
* @param {string=} displayName - Name of an item
|
|
300
|
+
* @param {Object=} marketplaceParams - Parameters of a marketplace to filter results by
|
|
301
|
+
*
|
|
302
|
+
* @returns {Promise<Array<String>>} - A list of item names
|
|
303
|
+
*/
|
|
304
|
+
exports.UserItemAttributes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
305
|
+
var _ref7,
|
|
306
|
+
marketplaceParams,
|
|
307
|
+
displayName,
|
|
308
|
+
userAddress,
|
|
309
|
+
filters,
|
|
310
|
+
attributes,
|
|
311
|
+
_args4 = arguments;
|
|
312
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
313
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
314
|
+
case 0:
|
|
315
|
+
_ref7 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, marketplaceParams = _ref7.marketplaceParams, displayName = _ref7.displayName, userAddress = _ref7.userAddress;
|
|
316
|
+
filters = [];
|
|
317
|
+
if (!marketplaceParams) {
|
|
318
|
+
_context4.next = 10;
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
_context4.t0 = filters;
|
|
322
|
+
_context4.t1 = "tenant:eq:";
|
|
323
|
+
_context4.next = 7;
|
|
324
|
+
return this.MarketplaceInfo({
|
|
325
|
+
marketplaceParams: marketplaceParams
|
|
326
|
+
});
|
|
327
|
+
case 7:
|
|
328
|
+
_context4.t2 = _context4.sent.tenantId;
|
|
329
|
+
_context4.t3 = _context4.t1.concat.call(_context4.t1, _context4.t2);
|
|
330
|
+
_context4.t0.push.call(_context4.t0, _context4.t3);
|
|
331
|
+
case 10:
|
|
332
|
+
if (userAddress) {
|
|
333
|
+
filters.push("wlt:eq:".concat(Utils.FormatAddress(userAddress)));
|
|
334
|
+
}
|
|
335
|
+
if (displayName) {
|
|
336
|
+
filters.push("meta/display_name:eq:".concat(displayName));
|
|
337
|
+
}
|
|
338
|
+
_context4.t4 = Utils;
|
|
339
|
+
_context4.next = 15;
|
|
340
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
341
|
+
path: UrlJoin("as", "wlt", "attributes"),
|
|
342
|
+
method: "GET",
|
|
343
|
+
queryParams: {
|
|
344
|
+
filter: filters
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
case 15:
|
|
348
|
+
_context4.t5 = _context4.sent;
|
|
349
|
+
_context4.next = 18;
|
|
350
|
+
return _context4.t4.ResponseToJson.call(_context4.t4, _context4.t5);
|
|
351
|
+
case 18:
|
|
352
|
+
attributes = _context4.sent;
|
|
353
|
+
return _context4.abrupt("return", attributes.map(function (_ref8) {
|
|
354
|
+
var trait_type = _ref8.trait_type,
|
|
355
|
+
values = _ref8.values;
|
|
356
|
+
return {
|
|
357
|
+
name: trait_type,
|
|
358
|
+
values: values
|
|
359
|
+
};
|
|
360
|
+
}).filter(function (_ref9) {
|
|
361
|
+
var name = _ref9.name;
|
|
362
|
+
return !["Content Fabric Hash", "Total Minted Supply", "Creator"].includes(name);
|
|
363
|
+
}));
|
|
364
|
+
case 20:
|
|
365
|
+
case "end":
|
|
366
|
+
return _context4.stop();
|
|
367
|
+
}
|
|
368
|
+
}, _callee4, this);
|
|
369
|
+
}));
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* <b><i>Requires login</i></b>
|
|
373
|
+
*
|
|
374
|
+
* Retrieve items owned by the specified or current user matching the specified parameters.
|
|
375
|
+
*
|
|
376
|
+
* @methodGroup User
|
|
377
|
+
* @namedParams
|
|
378
|
+
* @param {boolean=} includeFullMetadata=false - If true, will include full metadata for each item. Ignored if not logged in.
|
|
379
|
+
* @param {string=} userAddress - Address of a user. If not specified, will return results for current user
|
|
380
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
381
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
382
|
+
* @param {string=} sortBy="default" - Sort order. Options: `default`, `meta/display_name`
|
|
383
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
384
|
+
* @param {string=} filter - Filter results by item name.
|
|
385
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
386
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
387
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
388
|
+
* @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
|
|
389
|
+
*
|
|
390
|
+
* @returns {Promise<Object>} - Results of the query and pagination info
|
|
391
|
+
*/
|
|
392
|
+
exports.UserItems = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
393
|
+
var _ref11,
|
|
394
|
+
_ref11$sortBy,
|
|
395
|
+
sortBy,
|
|
396
|
+
_ref11$includeFullMet,
|
|
397
|
+
includeFullMetadata,
|
|
398
|
+
_args5 = arguments;
|
|
399
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
400
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
401
|
+
case 0:
|
|
402
|
+
_ref11 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, _ref11$sortBy = _ref11.sortBy, sortBy = _ref11$sortBy === void 0 ? "default" : _ref11$sortBy, _ref11$includeFullMet = _ref11.includeFullMetadata, includeFullMetadata = _ref11$includeFullMet === void 0 ? false : _ref11$includeFullMet;
|
|
403
|
+
if (!(includeFullMetadata && this.loggedIn)) {
|
|
404
|
+
_context5.next = 5;
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
return _context5.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
408
|
+
mode: "owned-full-meta",
|
|
409
|
+
sortBy: sortBy
|
|
410
|
+
}, _args5[0] || {})));
|
|
411
|
+
case 5:
|
|
412
|
+
return _context5.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
413
|
+
mode: "owned",
|
|
414
|
+
sortBy: sortBy
|
|
415
|
+
}, _args5[0] || {})));
|
|
416
|
+
case 6:
|
|
417
|
+
case "end":
|
|
418
|
+
return _context5.stop();
|
|
419
|
+
}
|
|
420
|
+
}, _callee5, this);
|
|
421
|
+
}));
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Return all listings for the current user. Not paginated.
|
|
425
|
+
*
|
|
426
|
+
* @methodGroup User
|
|
427
|
+
* @namedParams
|
|
428
|
+
* @param {string=} userAddress - Address of a user. If not specified, will return results for current user
|
|
429
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `info/token_id`, `info/ordinal`, `price`, `nft/display_name`
|
|
430
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
431
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
432
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
433
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
434
|
+
*
|
|
435
|
+
* @returns {Promise<Array<Object>>} - List of current user's listings
|
|
436
|
+
*/
|
|
437
|
+
exports.UserListings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
438
|
+
var _ref13,
|
|
439
|
+
userAddress,
|
|
440
|
+
_ref13$sortBy,
|
|
441
|
+
sortBy,
|
|
442
|
+
_ref13$sortDesc,
|
|
443
|
+
sortDesc,
|
|
444
|
+
contractAddress,
|
|
445
|
+
tokenId,
|
|
446
|
+
marketplaceParams,
|
|
447
|
+
_args6 = arguments;
|
|
448
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
449
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
450
|
+
case 0:
|
|
451
|
+
_ref13 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, userAddress = _ref13.userAddress, _ref13$sortBy = _ref13.sortBy, sortBy = _ref13$sortBy === void 0 ? "created" : _ref13$sortBy, _ref13$sortDesc = _ref13.sortDesc, sortDesc = _ref13$sortDesc === void 0 ? false : _ref13$sortDesc, contractAddress = _ref13.contractAddress, tokenId = _ref13.tokenId, marketplaceParams = _ref13.marketplaceParams;
|
|
452
|
+
_context6.next = 3;
|
|
453
|
+
return this.FilteredQuery({
|
|
454
|
+
mode: "listings",
|
|
455
|
+
start: 0,
|
|
456
|
+
limit: 10000,
|
|
457
|
+
sortBy: sortBy,
|
|
458
|
+
sortDesc: sortDesc,
|
|
459
|
+
sellerAddress: userAddress || this.UserAddress(),
|
|
460
|
+
marketplaceParams: marketplaceParams,
|
|
461
|
+
contractAddress: contractAddress,
|
|
462
|
+
tokenId: tokenId,
|
|
463
|
+
includeCheckoutLocked: true
|
|
464
|
+
});
|
|
465
|
+
case 3:
|
|
466
|
+
return _context6.abrupt("return", _context6.sent.results);
|
|
467
|
+
case 4:
|
|
468
|
+
case "end":
|
|
469
|
+
return _context6.stop();
|
|
470
|
+
}
|
|
471
|
+
}, _callee6, this);
|
|
472
|
+
}));
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Return all sales for the current user. Not paginated.
|
|
476
|
+
*
|
|
477
|
+
* @methodGroup User
|
|
478
|
+
* @namedParams
|
|
479
|
+
* @param {string=} userAddress - Address of a user. If not specified, will return results for current user
|
|
480
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `price`, `name`
|
|
481
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
482
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
483
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
484
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
485
|
+
* @param {integer=} startTime - Filter by results listed after the specified time (in milliseconds since epoch)
|
|
486
|
+
* @param {integer=} endTime - Filter by results listed before the specified time (in milliseconds since epoch)
|
|
487
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
488
|
+
*
|
|
489
|
+
* @returns {Promise<Array<Object>>} - List of current user's sales
|
|
490
|
+
*/
|
|
491
|
+
exports.UserSales = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
492
|
+
var _ref15,
|
|
493
|
+
userAddress,
|
|
494
|
+
_ref15$sortBy,
|
|
495
|
+
sortBy,
|
|
496
|
+
_ref15$sortDesc,
|
|
497
|
+
sortDesc,
|
|
498
|
+
contractAddress,
|
|
499
|
+
tokenId,
|
|
500
|
+
startTime,
|
|
501
|
+
endTime,
|
|
502
|
+
lastNDays,
|
|
503
|
+
marketplaceParams,
|
|
504
|
+
_args7 = arguments;
|
|
505
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
506
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
507
|
+
case 0:
|
|
508
|
+
_ref15 = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, userAddress = _ref15.userAddress, _ref15$sortBy = _ref15.sortBy, sortBy = _ref15$sortBy === void 0 ? "created" : _ref15$sortBy, _ref15$sortDesc = _ref15.sortDesc, sortDesc = _ref15$sortDesc === void 0 ? false : _ref15$sortDesc, contractAddress = _ref15.contractAddress, tokenId = _ref15.tokenId, startTime = _ref15.startTime, endTime = _ref15.endTime, lastNDays = _ref15.lastNDays, marketplaceParams = _ref15.marketplaceParams;
|
|
509
|
+
_context7.next = 3;
|
|
510
|
+
return this.FilteredQuery({
|
|
511
|
+
mode: "sales",
|
|
512
|
+
start: 0,
|
|
513
|
+
limit: 10000,
|
|
514
|
+
sortBy: sortBy,
|
|
515
|
+
sortDesc: sortDesc,
|
|
516
|
+
sellerAddress: userAddress || this.UserAddress(),
|
|
517
|
+
startTime: startTime,
|
|
518
|
+
endTime: endTime,
|
|
519
|
+
lastNDays: lastNDays,
|
|
520
|
+
marketplaceParams: marketplaceParams,
|
|
521
|
+
contractAddress: contractAddress,
|
|
522
|
+
tokenId: tokenId
|
|
523
|
+
});
|
|
524
|
+
case 3:
|
|
525
|
+
return _context7.abrupt("return", _context7.sent.results);
|
|
526
|
+
case 4:
|
|
527
|
+
case "end":
|
|
528
|
+
return _context7.stop();
|
|
529
|
+
}
|
|
530
|
+
}, _callee7, this);
|
|
531
|
+
}));
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Return all transfers and sales for the current user. Not paginated.
|
|
535
|
+
*
|
|
536
|
+
* @methodGroup User
|
|
537
|
+
* @namedParams
|
|
538
|
+
* @param {string=} userAddress - Address of a user. If not specified, will return results for current user
|
|
539
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `price`, `name`
|
|
540
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
541
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
542
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
543
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
544
|
+
* @param {integer=} startTime - Filter by results listed after the specified time (in milliseconds since epoch)
|
|
545
|
+
* @param {integer=} endTime - Filter by results listed before the specified time (in milliseconds since epoch)
|
|
546
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
547
|
+
*
|
|
548
|
+
* @returns {Promise<Array<Object>>} - List of current user's sales
|
|
549
|
+
*/
|
|
550
|
+
exports.UserTransfers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
551
|
+
var _ref17,
|
|
552
|
+
userAddress,
|
|
553
|
+
_ref17$sortBy,
|
|
554
|
+
sortBy,
|
|
555
|
+
_ref17$sortDesc,
|
|
556
|
+
sortDesc,
|
|
557
|
+
contractAddress,
|
|
558
|
+
tokenId,
|
|
559
|
+
startTime,
|
|
560
|
+
endTime,
|
|
561
|
+
lastNDays,
|
|
562
|
+
marketplaceParams,
|
|
563
|
+
_args8 = arguments;
|
|
564
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
565
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
566
|
+
case 0:
|
|
567
|
+
_ref17 = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {}, userAddress = _ref17.userAddress, _ref17$sortBy = _ref17.sortBy, sortBy = _ref17$sortBy === void 0 ? "created" : _ref17$sortBy, _ref17$sortDesc = _ref17.sortDesc, sortDesc = _ref17$sortDesc === void 0 ? false : _ref17$sortDesc, contractAddress = _ref17.contractAddress, tokenId = _ref17.tokenId, startTime = _ref17.startTime, endTime = _ref17.endTime, lastNDays = _ref17.lastNDays, marketplaceParams = _ref17.marketplaceParams;
|
|
568
|
+
_context8.next = 3;
|
|
569
|
+
return this.FilteredQuery({
|
|
570
|
+
mode: "transfers",
|
|
571
|
+
start: 0,
|
|
572
|
+
limit: 10000,
|
|
573
|
+
sortBy: sortBy,
|
|
574
|
+
sortDesc: sortDesc,
|
|
575
|
+
sellerAddress: userAddress || this.UserAddress(),
|
|
576
|
+
marketplaceParams: marketplaceParams,
|
|
577
|
+
contractAddress: contractAddress,
|
|
578
|
+
tokenId: tokenId,
|
|
579
|
+
startTime: startTime,
|
|
580
|
+
endTime: endTime,
|
|
581
|
+
lastNDays: lastNDays
|
|
582
|
+
});
|
|
583
|
+
case 3:
|
|
584
|
+
return _context8.abrupt("return", _context8.sent.results);
|
|
585
|
+
case 4:
|
|
586
|
+
case "end":
|
|
587
|
+
return _context8.stop();
|
|
588
|
+
}
|
|
589
|
+
}, _callee8, this);
|
|
590
|
+
}));
|
|
591
|
+
|
|
592
|
+
/* TENANT */
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Retrieve configuration information about the specified tenant, or the tenant associated with the specified contract.
|
|
596
|
+
*
|
|
597
|
+
* This information includes the royalty rate the tenant receives for secondary sales.
|
|
598
|
+
*
|
|
599
|
+
* @methodGroup Tenants
|
|
600
|
+
* @namedParams
|
|
601
|
+
* @param {string=} tenantId - The ID of the tenant for which to retrieve configuration
|
|
602
|
+
* @param {string=} contractAddress - The ID of an nft contract for which to retrieve configuration
|
|
603
|
+
*
|
|
604
|
+
* @returns {Promise<Object>} - The tenant configuration
|
|
605
|
+
*/
|
|
606
|
+
exports.TenantConfiguration = /*#__PURE__*/function () {
|
|
607
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref18) {
|
|
608
|
+
var tenantId, contractAddress;
|
|
609
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
610
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
611
|
+
case 0:
|
|
612
|
+
tenantId = _ref18.tenantId, contractAddress = _ref18.contractAddress;
|
|
613
|
+
_context9.prev = 1;
|
|
614
|
+
contractAddress = contractAddress ? Utils.FormatAddress(contractAddress) : undefined;
|
|
615
|
+
if (this.tenantConfigs[contractAddress || tenantId]) {
|
|
616
|
+
_context9.next = 7;
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
_context9.next = 6;
|
|
620
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
621
|
+
path: contractAddress ? UrlJoin("as", "config", "nft", contractAddress) : UrlJoin("as", "config", "tnt", tenantId),
|
|
622
|
+
method: "GET"
|
|
623
|
+
}));
|
|
624
|
+
case 6:
|
|
625
|
+
this.tenantConfigs[contractAddress || tenantId] = _context9.sent;
|
|
626
|
+
case 7:
|
|
627
|
+
return _context9.abrupt("return", this.tenantConfigs[contractAddress || tenantId]);
|
|
628
|
+
case 10:
|
|
629
|
+
_context9.prev = 10;
|
|
630
|
+
_context9.t0 = _context9["catch"](1);
|
|
631
|
+
this.Log("Failed to load tenant configuration", true, _context9.t0);
|
|
632
|
+
return _context9.abrupt("return", {});
|
|
633
|
+
case 14:
|
|
634
|
+
case "end":
|
|
635
|
+
return _context9.stop();
|
|
636
|
+
}
|
|
637
|
+
}, _callee9, this, [[1, 10]]);
|
|
638
|
+
}));
|
|
639
|
+
return function (_x2) {
|
|
640
|
+
return _ref19.apply(this, arguments);
|
|
641
|
+
};
|
|
642
|
+
}();
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Retrieve the current exchange rate for the specified currency to USD
|
|
646
|
+
*
|
|
647
|
+
* @methodGroup Tenants
|
|
648
|
+
* @namedParams
|
|
649
|
+
* @param {string} currency - The currency for which to retrieve the USD exchange rate
|
|
650
|
+
*/
|
|
651
|
+
exports.ExchangeRate = /*#__PURE__*/function () {
|
|
652
|
+
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref20) {
|
|
653
|
+
var currency;
|
|
654
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
655
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
656
|
+
case 0:
|
|
657
|
+
currency = _ref20.currency;
|
|
658
|
+
if (currency) {
|
|
659
|
+
_context10.next = 3;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
throw Error("Eluvio Wallet Client: Invalid or missing currency in ExchangeRate");
|
|
663
|
+
case 3:
|
|
664
|
+
_context10.next = 5;
|
|
665
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
666
|
+
path: UrlJoin("as", "xr", "ebanx", currency),
|
|
667
|
+
method: "GET"
|
|
668
|
+
}));
|
|
669
|
+
case 5:
|
|
670
|
+
return _context10.abrupt("return", _context10.sent);
|
|
671
|
+
case 6:
|
|
672
|
+
case "end":
|
|
673
|
+
return _context10.stop();
|
|
674
|
+
}
|
|
675
|
+
}, _callee10, this);
|
|
676
|
+
}));
|
|
677
|
+
return function (_x3) {
|
|
678
|
+
return _ref21.apply(this, arguments);
|
|
679
|
+
};
|
|
680
|
+
}();
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Retrieve custom CSS for the specified tenant
|
|
684
|
+
*
|
|
685
|
+
* @methodGroup Tenants
|
|
686
|
+
* @namedParams
|
|
687
|
+
* @param {Object} tenantSlug
|
|
688
|
+
*
|
|
689
|
+
* @returns {Promise<string>} - The CSS of the tenant
|
|
690
|
+
*/
|
|
691
|
+
exports.TenantCSS = /*#__PURE__*/function () {
|
|
692
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref22) {
|
|
693
|
+
var tenantSlug;
|
|
694
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
695
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
696
|
+
case 0:
|
|
697
|
+
tenantSlug = _ref22.tenantSlug;
|
|
698
|
+
if (this.cachedCSS[tenantSlug]) {
|
|
699
|
+
_context11.next = 5;
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
_context11.next = 4;
|
|
703
|
+
return this.client.ContentObjectMetadata({
|
|
704
|
+
libraryId: this.mainSiteLibraryId,
|
|
705
|
+
objectId: this.mainSiteId,
|
|
706
|
+
metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", tenantSlug, "info", "branding", "wallet_css"),
|
|
707
|
+
authorizationToken: this.publicStaticToken
|
|
708
|
+
});
|
|
709
|
+
case 4:
|
|
710
|
+
this.cachedCSS[tenantSlug] = _context11.sent;
|
|
711
|
+
case 5:
|
|
712
|
+
return _context11.abrupt("return", this.cachedCSS[tenantSlug] || "");
|
|
713
|
+
case 6:
|
|
714
|
+
case "end":
|
|
715
|
+
return _context11.stop();
|
|
716
|
+
}
|
|
717
|
+
}, _callee11, this);
|
|
718
|
+
}));
|
|
719
|
+
return function (_x4) {
|
|
720
|
+
return _ref23.apply(this, arguments);
|
|
721
|
+
};
|
|
722
|
+
}();
|
|
723
|
+
|
|
724
|
+
/* MARKETPLACE */
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Retrieve available stock for the specified marketplace, organized by SKU.
|
|
728
|
+
*
|
|
729
|
+
* If a user is logged in, stock information will also include how many of that item the user has purchased.
|
|
730
|
+
*
|
|
731
|
+
* @methodGroup Marketplaces
|
|
732
|
+
* @namedParams
|
|
733
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
734
|
+
*
|
|
735
|
+
* @returns {Promise<Object>} - Stock info for items in the marketplace
|
|
736
|
+
*/
|
|
737
|
+
exports.MarketplaceStock = /*#__PURE__*/function () {
|
|
738
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref24) {
|
|
739
|
+
var marketplaceParams, tenantId, marketplaceInfo;
|
|
740
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
741
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
742
|
+
case 0:
|
|
743
|
+
marketplaceParams = _ref24.marketplaceParams, tenantId = _ref24.tenantId;
|
|
744
|
+
if (!tenantId) {
|
|
745
|
+
marketplaceInfo = this.MarketplaceInfo({
|
|
746
|
+
marketplaceParams: marketplaceParams
|
|
747
|
+
});
|
|
748
|
+
tenantId = marketplaceInfo.tenantId;
|
|
749
|
+
}
|
|
750
|
+
if (!this.loggedIn) {
|
|
751
|
+
_context12.next = 6;
|
|
752
|
+
break;
|
|
753
|
+
}
|
|
754
|
+
_context12.next = 5;
|
|
755
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
756
|
+
path: UrlJoin("as", "wlt", "nft", "info", tenantId),
|
|
757
|
+
method: "GET",
|
|
758
|
+
headers: {
|
|
759
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
760
|
+
}
|
|
761
|
+
}));
|
|
762
|
+
case 5:
|
|
763
|
+
return _context12.abrupt("return", _context12.sent);
|
|
764
|
+
case 6:
|
|
765
|
+
_context12.next = 8;
|
|
766
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
767
|
+
path: UrlJoin("as", "nft", "stock", tenantId),
|
|
768
|
+
method: "GET"
|
|
769
|
+
}));
|
|
770
|
+
case 8:
|
|
771
|
+
return _context12.abrupt("return", _context12.sent);
|
|
772
|
+
case 9:
|
|
773
|
+
case "end":
|
|
774
|
+
return _context12.stop();
|
|
775
|
+
}
|
|
776
|
+
}, _callee12, this);
|
|
777
|
+
}));
|
|
778
|
+
return function (_x5) {
|
|
779
|
+
return _ref25.apply(this, arguments);
|
|
780
|
+
};
|
|
781
|
+
}();
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Retrieve basic information about a specific available marketplace with the specified tenant/marketplace slug, ID, or hash.
|
|
785
|
+
*
|
|
786
|
+
* Includes the slugs, ID and hash of the marketplace, as well as branding information.
|
|
787
|
+
*
|
|
788
|
+
* To retrieve full metadata for the marketplace, use the <a href="#.Marketplace">Marketplace</a> method.
|
|
789
|
+
*
|
|
790
|
+
* @methodGroup Marketplaces
|
|
791
|
+
* @namedParams
|
|
792
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
793
|
+
*
|
|
794
|
+
* @returns {Promise<Object>} - Info about the marketplace
|
|
795
|
+
*/
|
|
796
|
+
exports.MarketplaceInfo = function (_ref26) {
|
|
797
|
+
var marketplaceParams = _ref26.marketplaceParams;
|
|
798
|
+
var _ref27 = marketplaceParams || {},
|
|
799
|
+
tenantSlug = _ref27.tenantSlug,
|
|
800
|
+
marketplaceSlug = _ref27.marketplaceSlug,
|
|
801
|
+
marketplaceId = _ref27.marketplaceId,
|
|
802
|
+
marketplaceHash = _ref27.marketplaceHash;
|
|
803
|
+
var marketplaceInfo;
|
|
804
|
+
if (tenantSlug && marketplaceSlug) {
|
|
805
|
+
marketplaceInfo = (this.availableMarketplaces[tenantSlug] || {})[marketplaceSlug];
|
|
806
|
+
} else {
|
|
807
|
+
marketplaceId = marketplaceHash ? this.client.utils.DecodeVersionHash(marketplaceHash).objectId : marketplaceId;
|
|
808
|
+
marketplaceInfo = this.availableMarketplacesById[marketplaceId];
|
|
809
|
+
}
|
|
810
|
+
if (!marketplaceInfo) {
|
|
811
|
+
throw Error("Eluvio Wallet Client: Unable to find marketplace with parameters ".concat(JSON.stringify(arguments)));
|
|
812
|
+
}
|
|
813
|
+
return marketplaceInfo;
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Retrieve custom CSS for the specified marketplace
|
|
818
|
+
*
|
|
819
|
+
* @methodGroup Marketplaces
|
|
820
|
+
* @namedParams
|
|
821
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
822
|
+
*
|
|
823
|
+
* @returns {Promise<string>} - The CSS of the marketplace
|
|
824
|
+
*/
|
|
825
|
+
exports.MarketplaceCSS = /*#__PURE__*/function () {
|
|
826
|
+
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref28) {
|
|
827
|
+
var marketplaceParams, marketplaceInfo, marketplaceHash;
|
|
828
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
829
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
830
|
+
case 0:
|
|
831
|
+
marketplaceParams = _ref28.marketplaceParams;
|
|
832
|
+
marketplaceInfo = this.MarketplaceInfo({
|
|
833
|
+
marketplaceParams: marketplaceParams
|
|
834
|
+
});
|
|
835
|
+
marketplaceHash = marketplaceInfo.marketplaceHash;
|
|
836
|
+
if (this.cachedCSS[marketplaceHash]) {
|
|
837
|
+
_context13.next = 7;
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
_context13.next = 6;
|
|
841
|
+
return this.client.ContentObjectMetadata({
|
|
842
|
+
versionHash: marketplaceHash,
|
|
843
|
+
metadataSubtree: "public/asset_metadata/info/branding/custom_css",
|
|
844
|
+
authorizationToken: this.publicStaticToken,
|
|
845
|
+
noAuth: true
|
|
846
|
+
});
|
|
847
|
+
case 6:
|
|
848
|
+
this.cachedCSS[marketplaceHash] = _context13.sent;
|
|
849
|
+
case 7:
|
|
850
|
+
return _context13.abrupt("return", this.cachedCSS[marketplaceHash] || "");
|
|
851
|
+
case 8:
|
|
852
|
+
case "end":
|
|
853
|
+
return _context13.stop();
|
|
854
|
+
}
|
|
855
|
+
}, _callee13, this);
|
|
856
|
+
}));
|
|
857
|
+
return function (_x6) {
|
|
858
|
+
return _ref29.apply(this, arguments);
|
|
859
|
+
};
|
|
860
|
+
}();
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Retrieve info about all available marketplaces
|
|
864
|
+
*
|
|
865
|
+
* @methodGroup Marketplaces
|
|
866
|
+
* @namedParams
|
|
867
|
+
* @param {boolean=} organizeById - By default, the returned marketplace info is organized by tenant and marketplace slug. If this option is enabled, the marketplaces will be organized by marketplace ID instead.
|
|
868
|
+
* @param {boolean=} forceReload=false - If specified, a new request will be made to check the currently available marketplaces instead of returning cached info
|
|
869
|
+
*
|
|
870
|
+
* @returns {Promise<Object>} - Info about available marketplaces
|
|
871
|
+
*/
|
|
872
|
+
exports.AvailableMarketplaces = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
873
|
+
var _ref31,
|
|
874
|
+
organizeById,
|
|
875
|
+
_ref31$forceReload,
|
|
876
|
+
forceReload,
|
|
877
|
+
_args14 = arguments;
|
|
878
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
879
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
880
|
+
case 0:
|
|
881
|
+
_ref31 = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {}, organizeById = _ref31.organizeById, _ref31$forceReload = _ref31.forceReload, forceReload = _ref31$forceReload === void 0 ? false : _ref31$forceReload;
|
|
882
|
+
if (!forceReload) {
|
|
883
|
+
_context14.next = 4;
|
|
884
|
+
break;
|
|
885
|
+
}
|
|
886
|
+
_context14.next = 4;
|
|
887
|
+
return this.LoadAvailableMarketplaces(true);
|
|
888
|
+
case 4:
|
|
889
|
+
return _context14.abrupt("return", _objectSpread({}, organizeById ? this.availableMarketplacesById : this.availableMarketplaces));
|
|
890
|
+
case 5:
|
|
891
|
+
case "end":
|
|
892
|
+
return _context14.stop();
|
|
893
|
+
}
|
|
894
|
+
}, _callee14, this);
|
|
895
|
+
}));
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Retrieve full information about the specified marketplace
|
|
899
|
+
*
|
|
900
|
+
* <b><i>Note</i></b> - Upon changing login state, the marketplace should be retrieved again as permission info in marketplace items may be different depending on the current user's permissions.
|
|
901
|
+
*
|
|
902
|
+
* @methodGroup Marketplaces
|
|
903
|
+
* @namedParams
|
|
904
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
905
|
+
*
|
|
906
|
+
* @returns {Promise<Object>} - The full information for the marketplace
|
|
907
|
+
*/
|
|
908
|
+
exports.Marketplace = /*#__PURE__*/function () {
|
|
909
|
+
var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref32) {
|
|
910
|
+
var marketplaceParams;
|
|
911
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
912
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
913
|
+
case 0:
|
|
914
|
+
marketplaceParams = _ref32.marketplaceParams;
|
|
915
|
+
return _context15.abrupt("return", this.LoadMarketplace(marketplaceParams));
|
|
916
|
+
case 2:
|
|
917
|
+
case "end":
|
|
918
|
+
return _context15.stop();
|
|
919
|
+
}
|
|
920
|
+
}, _callee15, this);
|
|
921
|
+
}));
|
|
922
|
+
return function (_x7) {
|
|
923
|
+
return _ref33.apply(this, arguments);
|
|
924
|
+
};
|
|
925
|
+
}();
|
|
926
|
+
|
|
927
|
+
/* NFTS */
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Return info about the specified NFT contract, including the cap, current total supply, and total minted and burned.
|
|
931
|
+
*
|
|
932
|
+
* @methodGroup NFTs
|
|
933
|
+
* @namedParams
|
|
934
|
+
* @param {string} contractAddress - The contract address of the NFT
|
|
935
|
+
*
|
|
936
|
+
* @returns {Promise<Object>} - Information about the specified contract
|
|
937
|
+
*/
|
|
938
|
+
exports.NFTContractStats = /*#__PURE__*/function () {
|
|
939
|
+
var _ref35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref34) {
|
|
940
|
+
var contractAddress;
|
|
941
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
942
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
943
|
+
case 0:
|
|
944
|
+
contractAddress = _ref34.contractAddress;
|
|
945
|
+
_context16.next = 3;
|
|
946
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
947
|
+
path: UrlJoin("as", "nft", "info", contractAddress),
|
|
948
|
+
method: "GET"
|
|
949
|
+
}));
|
|
950
|
+
case 3:
|
|
951
|
+
return _context16.abrupt("return", _context16.sent);
|
|
952
|
+
case 4:
|
|
953
|
+
case "end":
|
|
954
|
+
return _context16.stop();
|
|
955
|
+
}
|
|
956
|
+
}, _callee16, this);
|
|
957
|
+
}));
|
|
958
|
+
return function (_x8) {
|
|
959
|
+
return _ref35.apply(this, arguments);
|
|
960
|
+
};
|
|
961
|
+
}();
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Load full info for the specified NFT
|
|
965
|
+
*
|
|
966
|
+
* @methodGroup NFTs
|
|
967
|
+
* @namedParams
|
|
968
|
+
* @param {string} contractAddress - The contract address of the NFT
|
|
969
|
+
* @param {string} tokenId - The token ID of the NFT
|
|
970
|
+
*/
|
|
971
|
+
exports.NFT = /*#__PURE__*/function () {
|
|
972
|
+
var _ref37 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref36) {
|
|
973
|
+
var tokenId, contractAddress, nft, assetMetadata, localizedMetadata;
|
|
974
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
975
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
976
|
+
case 0:
|
|
977
|
+
tokenId = _ref36.tokenId, contractAddress = _ref36.contractAddress;
|
|
978
|
+
_context17.t0 = FormatNFTDetails;
|
|
979
|
+
_context17.next = 4;
|
|
980
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
981
|
+
path: UrlJoin("as", "nft", "info", contractAddress, tokenId),
|
|
982
|
+
method: "GET"
|
|
983
|
+
}));
|
|
984
|
+
case 4:
|
|
985
|
+
_context17.t1 = _context17.sent;
|
|
986
|
+
nft = (0, _context17.t0)(_context17.t1);
|
|
987
|
+
_context17.next = 8;
|
|
988
|
+
return this.client.ContentObjectMetadata({
|
|
989
|
+
versionHash: nft.details.VersionHash,
|
|
990
|
+
metadataSubtree: "public/asset_metadata/nft",
|
|
991
|
+
produceLinkUrls: true
|
|
992
|
+
});
|
|
993
|
+
case 8:
|
|
994
|
+
_context17.t2 = _context17.sent;
|
|
995
|
+
if (_context17.t2) {
|
|
996
|
+
_context17.next = 11;
|
|
997
|
+
break;
|
|
998
|
+
}
|
|
999
|
+
_context17.t2 = {};
|
|
1000
|
+
case 11:
|
|
1001
|
+
assetMetadata = _context17.t2;
|
|
1002
|
+
nft.metadata = MergeWith({}, assetMetadata, nft.metadata, function (a, b) {
|
|
1003
|
+
return b === null || b === "" ? a : undefined;
|
|
1004
|
+
});
|
|
1005
|
+
if (!this.localization) {
|
|
1006
|
+
_context17.next = 21;
|
|
1007
|
+
break;
|
|
1008
|
+
}
|
|
1009
|
+
_context17.next = 16;
|
|
1010
|
+
return this.client.ContentObjectMetadata({
|
|
1011
|
+
versionHash: nft.details.VersionHash,
|
|
1012
|
+
metadataSubtree: UrlJoin("public", "asset_metadata", "localizations", this.localization, "nft"),
|
|
1013
|
+
produceLinkUrls: true
|
|
1014
|
+
});
|
|
1015
|
+
case 16:
|
|
1016
|
+
_context17.t3 = _context17.sent;
|
|
1017
|
+
if (_context17.t3) {
|
|
1018
|
+
_context17.next = 19;
|
|
1019
|
+
break;
|
|
1020
|
+
}
|
|
1021
|
+
_context17.t3 = {};
|
|
1022
|
+
case 19:
|
|
1023
|
+
localizedMetadata = _context17.t3;
|
|
1024
|
+
nft.metadata = MergeWith({}, nft.metadata, localizedMetadata, function (a, b) {
|
|
1025
|
+
return b === null || b === "" ? a : undefined;
|
|
1026
|
+
});
|
|
1027
|
+
case 21:
|
|
1028
|
+
_context17.next = 23;
|
|
1029
|
+
return this.TenantConfiguration({
|
|
1030
|
+
contractAddress: contractAddress
|
|
1031
|
+
});
|
|
1032
|
+
case 23:
|
|
1033
|
+
nft.config = _context17.sent;
|
|
1034
|
+
return _context17.abrupt("return", FormatNFTMetadata(this, nft));
|
|
1035
|
+
case 25:
|
|
1036
|
+
case "end":
|
|
1037
|
+
return _context17.stop();
|
|
1038
|
+
}
|
|
1039
|
+
}, _callee17, this);
|
|
1040
|
+
}));
|
|
1041
|
+
return function (_x9) {
|
|
1042
|
+
return _ref37.apply(this, arguments);
|
|
1043
|
+
};
|
|
1044
|
+
}();
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* <b><i>Requires login</i></b>
|
|
1048
|
+
*
|
|
1049
|
+
* Transfer the specified NFT owned by the current user to the specified address
|
|
1050
|
+
*
|
|
1051
|
+
* @methodGroup NFTs
|
|
1052
|
+
* @namedParams
|
|
1053
|
+
* @param {string} contractAddress - The contract address of the NFT
|
|
1054
|
+
* @param {string} tokenId - The token ID of the NFT
|
|
1055
|
+
* @param {string} targetAddress - The address to which to transfer the NFT
|
|
1056
|
+
*/
|
|
1057
|
+
exports.TransferNFT = /*#__PURE__*/function () {
|
|
1058
|
+
var _ref39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref38) {
|
|
1059
|
+
var contractAddress, tokenId, targetAddress;
|
|
1060
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1061
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1062
|
+
case 0:
|
|
1063
|
+
contractAddress = _ref38.contractAddress, tokenId = _ref38.tokenId, targetAddress = _ref38.targetAddress;
|
|
1064
|
+
if (!(!targetAddress || !Utils.ValidAddress(targetAddress))) {
|
|
1065
|
+
_context18.next = 3;
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1068
|
+
throw Error("Eluvio Wallet Client: Invalid or missing target address in UserTransferNFT");
|
|
1069
|
+
case 3:
|
|
1070
|
+
_context18.next = 5;
|
|
1071
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1072
|
+
path: UrlJoin("as", "wlt", "mkt", "xfer"),
|
|
1073
|
+
method: "POST",
|
|
1074
|
+
body: {
|
|
1075
|
+
contract: Utils.FormatAddress(contractAddress),
|
|
1076
|
+
token: tokenId,
|
|
1077
|
+
to_addr: Utils.FormatAddress(targetAddress)
|
|
1078
|
+
},
|
|
1079
|
+
headers: {
|
|
1080
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
case 5:
|
|
1084
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1085
|
+
case 6:
|
|
1086
|
+
case "end":
|
|
1087
|
+
return _context18.stop();
|
|
1088
|
+
}
|
|
1089
|
+
}, _callee18, this);
|
|
1090
|
+
}));
|
|
1091
|
+
return function (_x10) {
|
|
1092
|
+
return _ref39.apply(this, arguments);
|
|
1093
|
+
};
|
|
1094
|
+
}();
|
|
1095
|
+
|
|
1096
|
+
/** LISTINGS */
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Retrieve the status of the specified listing
|
|
1100
|
+
*
|
|
1101
|
+
* @methodGroup Listings
|
|
1102
|
+
* @namedParams
|
|
1103
|
+
* @param {string=} listingId - The ID of the listing
|
|
1104
|
+
*
|
|
1105
|
+
* @returns {Promise<Object>} - The status of the listing
|
|
1106
|
+
*/
|
|
1107
|
+
exports.ListingStatus = /*#__PURE__*/function () {
|
|
1108
|
+
var _ref41 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref40) {
|
|
1109
|
+
var listingId;
|
|
1110
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1111
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1112
|
+
case 0:
|
|
1113
|
+
listingId = _ref40.listingId;
|
|
1114
|
+
_context19.prev = 1;
|
|
1115
|
+
_context19.t0 = Utils;
|
|
1116
|
+
_context19.next = 5;
|
|
1117
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1118
|
+
path: UrlJoin("as", "mkt", "status", listingId),
|
|
1119
|
+
method: "GET"
|
|
1120
|
+
});
|
|
1121
|
+
case 5:
|
|
1122
|
+
_context19.t1 = _context19.sent;
|
|
1123
|
+
_context19.next = 8;
|
|
1124
|
+
return _context19.t0.ResponseToJson.call(_context19.t0, _context19.t1);
|
|
1125
|
+
case 8:
|
|
1126
|
+
return _context19.abrupt("return", _context19.sent);
|
|
1127
|
+
case 11:
|
|
1128
|
+
_context19.prev = 11;
|
|
1129
|
+
_context19.t2 = _context19["catch"](1);
|
|
1130
|
+
if (!(_context19.t2.status === 404)) {
|
|
1131
|
+
_context19.next = 15;
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
return _context19.abrupt("return");
|
|
1135
|
+
case 15:
|
|
1136
|
+
throw _context19.t2;
|
|
1137
|
+
case 16:
|
|
1138
|
+
case "end":
|
|
1139
|
+
return _context19.stop();
|
|
1140
|
+
}
|
|
1141
|
+
}, _callee19, this, [[1, 11]]);
|
|
1142
|
+
}));
|
|
1143
|
+
return function (_x11) {
|
|
1144
|
+
return _ref41.apply(this, arguments);
|
|
1145
|
+
};
|
|
1146
|
+
}();
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Retrieve a specific listing
|
|
1150
|
+
*
|
|
1151
|
+
* NOTE: When a listing is sold or deleted, it will no longer be queryable with this API. Use <a href="#.ListingStatus">ListingStatus</a> instead.
|
|
1152
|
+
*
|
|
1153
|
+
* @methodGroup Listings
|
|
1154
|
+
* @namedParams
|
|
1155
|
+
* @param {string=} listingId - The ID of the listing
|
|
1156
|
+
*
|
|
1157
|
+
* @returns {Promise<Object>} - The listing
|
|
1158
|
+
*/
|
|
1159
|
+
exports.Listing = /*#__PURE__*/function () {
|
|
1160
|
+
var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref42) {
|
|
1161
|
+
var listingId;
|
|
1162
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1163
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1164
|
+
case 0:
|
|
1165
|
+
listingId = _ref42.listingId;
|
|
1166
|
+
_context20.t0 = FormatNFT;
|
|
1167
|
+
_context20.t1 = this;
|
|
1168
|
+
_context20.t2 = Utils;
|
|
1169
|
+
_context20.next = 6;
|
|
1170
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1171
|
+
path: UrlJoin("as", "mkt", "l", listingId),
|
|
1172
|
+
method: "GET"
|
|
1173
|
+
});
|
|
1174
|
+
case 6:
|
|
1175
|
+
_context20.t3 = _context20.sent;
|
|
1176
|
+
_context20.next = 9;
|
|
1177
|
+
return _context20.t2.ResponseToJson.call(_context20.t2, _context20.t3);
|
|
1178
|
+
case 9:
|
|
1179
|
+
_context20.t4 = _context20.sent;
|
|
1180
|
+
return _context20.abrupt("return", (0, _context20.t0)(_context20.t1, _context20.t4));
|
|
1181
|
+
case 11:
|
|
1182
|
+
case "end":
|
|
1183
|
+
return _context20.stop();
|
|
1184
|
+
}
|
|
1185
|
+
}, _callee20, this);
|
|
1186
|
+
}));
|
|
1187
|
+
return function (_x12) {
|
|
1188
|
+
return _ref43.apply(this, arguments);
|
|
1189
|
+
};
|
|
1190
|
+
}();
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Retrieve listings matching the specified parameters.
|
|
1194
|
+
*
|
|
1195
|
+
* @methodGroup Listings
|
|
1196
|
+
* @namedParams
|
|
1197
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
1198
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
1199
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `info/token_id`, `info/ordinal`, `price`, `nft/display_name`
|
|
1200
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
1201
|
+
* @param {string=} filter - Filter results by item name.
|
|
1202
|
+
* <br /><br />
|
|
1203
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
1204
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
1205
|
+
* @param {Array<string>=} editionFilters - Filter results by item edition.
|
|
1206
|
+
* <br /><br />
|
|
1207
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
1208
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
1209
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
1210
|
+
* <br /><br />
|
|
1211
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
1212
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
1213
|
+
* @param {Object=} priceRange - Filter min and/or max price (e.g. `{min: 1}` `{max: 2}` `{min: 1.50, max: 10.50})
|
|
1214
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
1215
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
1216
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
1217
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
1218
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
1219
|
+
* @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
|
|
1220
|
+
* @param {integer=} startTime - Filter by results listed after the specified time (in milliseconds since epoch)
|
|
1221
|
+
* @param {integer=} endTime - Filter by results listed before the specified time (in milliseconds since epoch)
|
|
1222
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
1223
|
+
* @param {boolean=} includeCheckoutLocked - If specified, listings which are currently in the checkout process (and not so currently purchasable) will be included in the results. By default they are excluded.
|
|
1224
|
+
*
|
|
1225
|
+
* @returns {Promise<Object>} - Results of the query and pagination info
|
|
1226
|
+
*/
|
|
1227
|
+
exports.Listings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
|
|
1228
|
+
var _args21 = arguments;
|
|
1229
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1230
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1231
|
+
case 0:
|
|
1232
|
+
return _context21.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
1233
|
+
mode: "listings"
|
|
1234
|
+
}, _args21[0] || {})));
|
|
1235
|
+
case 1:
|
|
1236
|
+
case "end":
|
|
1237
|
+
return _context21.stop();
|
|
1238
|
+
}
|
|
1239
|
+
}, _callee21, this);
|
|
1240
|
+
}));
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Retrieve stats for listings matching the specified parameters.
|
|
1244
|
+
*
|
|
1245
|
+
* @methodGroup Listings
|
|
1246
|
+
* @namedParams
|
|
1247
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
1248
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
1249
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `info/token_id`, `info/ordinal`, `price`, `nft/display_name`
|
|
1250
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
1251
|
+
* @param {string=} filter - Filter results by item name.
|
|
1252
|
+
* <br /><br />
|
|
1253
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
1254
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
1255
|
+
* @param {Array<string>} editionFilters - Filter results by item edition.
|
|
1256
|
+
* <br /><br />
|
|
1257
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
1258
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
1259
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
1260
|
+
* <br /><br />
|
|
1261
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
1262
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
1263
|
+
* @param {Object=} priceRange - Filter min and/or max price (e.g. `{min: 1}` `{max: 2}` `{min: 1.50, max: 10.50})
|
|
1264
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
1265
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
1266
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
1267
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
1268
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
1269
|
+
* @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
|
|
1270
|
+
* @param {integer=} startTime - Filter by results listed after the specified time (in milliseconds since epoch)
|
|
1271
|
+
* @param {integer=} endTime - Filter by results listed before the specified time (in milliseconds since epoch)
|
|
1272
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
1273
|
+
*
|
|
1274
|
+
* @returns {Promise<Object>} - Statistics about listings. All prices in USD.
|
|
1275
|
+
*/
|
|
1276
|
+
exports.ListingStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
1277
|
+
var _args22 = arguments;
|
|
1278
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
1279
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1280
|
+
case 0:
|
|
1281
|
+
return _context22.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
1282
|
+
mode: "listing-stats"
|
|
1283
|
+
}, _args22[0] || {})));
|
|
1284
|
+
case 1:
|
|
1285
|
+
case "end":
|
|
1286
|
+
return _context22.stop();
|
|
1287
|
+
}
|
|
1288
|
+
}, _callee22, this);
|
|
1289
|
+
}));
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Retrieve sales matching the specified parameters.
|
|
1293
|
+
*
|
|
1294
|
+
* @methodGroup Listings
|
|
1295
|
+
* @namedParams
|
|
1296
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
1297
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
1298
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `price`, `name`
|
|
1299
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
1300
|
+
* @param {string=} filter - Filter results by item name.
|
|
1301
|
+
* <br /><br />
|
|
1302
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
1303
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
1304
|
+
* @param {Array<string>} editionFilters - Filter results by item edition.
|
|
1305
|
+
* <br /><br />
|
|
1306
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
1307
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
1308
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
1309
|
+
* <br /><br />
|
|
1310
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
1311
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
1312
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
1313
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
1314
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
1315
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
1316
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
1317
|
+
* @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
|
|
1318
|
+
* @param {integer=} startTime - Filter by results listed after the specified time (in milliseconds since epoch)
|
|
1319
|
+
* @param {integer=} endTime - Filter by results listed before the specified time (in milliseconds since epoch)
|
|
1320
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
1321
|
+
*
|
|
1322
|
+
* @returns {Promise<Object>} - Results of the query and pagination info
|
|
1323
|
+
*/
|
|
1324
|
+
exports.Sales = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
|
|
1325
|
+
var _args23 = arguments;
|
|
1326
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
1327
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1328
|
+
case 0:
|
|
1329
|
+
return _context23.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
1330
|
+
mode: "sales"
|
|
1331
|
+
}, _args23[0] || {})));
|
|
1332
|
+
case 1:
|
|
1333
|
+
case "end":
|
|
1334
|
+
return _context23.stop();
|
|
1335
|
+
}
|
|
1336
|
+
}, _callee23, this);
|
|
1337
|
+
}));
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Retrieve sales and transfers matching the specified parameters.
|
|
1341
|
+
*
|
|
1342
|
+
* @methodGroup Listings
|
|
1343
|
+
* @namedParams
|
|
1344
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
1345
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
1346
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `price`, `name`
|
|
1347
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
1348
|
+
* @param {string=} filter - Filter results by item name.
|
|
1349
|
+
* <br /><br />
|
|
1350
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
1351
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
1352
|
+
* @param {Array<string>} editionFilters - Filter results by item edition.
|
|
1353
|
+
* <br /><br />
|
|
1354
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
1355
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
1356
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
1357
|
+
* <br /><br />
|
|
1358
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
1359
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
1360
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
1361
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
1362
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
1363
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
1364
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
1365
|
+
* @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
|
|
1366
|
+
* @param {integer=} startTime - Filter by results listed after the specified time (in milliseconds since epoch)
|
|
1367
|
+
* @param {integer=} endTime - Filter by results listed before the specified time (in milliseconds since epoch)
|
|
1368
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
1369
|
+
*
|
|
1370
|
+
* @returns {Promise<Object>} - Results of the query and pagination info
|
|
1371
|
+
*/
|
|
1372
|
+
exports.Transfers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {
|
|
1373
|
+
var _args24 = arguments;
|
|
1374
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
1375
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1376
|
+
case 0:
|
|
1377
|
+
return _context24.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
1378
|
+
mode: "transfers"
|
|
1379
|
+
}, _args24[0] || {})));
|
|
1380
|
+
case 1:
|
|
1381
|
+
case "end":
|
|
1382
|
+
return _context24.stop();
|
|
1383
|
+
}
|
|
1384
|
+
}, _callee24, this);
|
|
1385
|
+
}));
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* Retrieve stats for listings matching the specified parameters.
|
|
1389
|
+
*
|
|
1390
|
+
* @methodGroup Listings
|
|
1391
|
+
* @namedParams
|
|
1392
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
1393
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
1394
|
+
* @param {string=} sortBy="created" -
|
|
1395
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
1396
|
+
* @param {string=} filter - Filter results by item name.
|
|
1397
|
+
* <br /><br />
|
|
1398
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
1399
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
1400
|
+
* @param {Array<string>} editionFilters - Filter results by item edition.
|
|
1401
|
+
* <br /><br />
|
|
1402
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
1403
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
1404
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
1405
|
+
* <br /><br />
|
|
1406
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
1407
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
1408
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
1409
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
1410
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
1411
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
1412
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
1413
|
+
* @param {Array<integer>=} collectionIndexes - If filtering by marketplace, filter by collection(s). The index refers to the index in the array `marketplace.collections`
|
|
1414
|
+
* @param {integer=} startTime - Filter by results listed after the specified time (in milliseconds since epoch)
|
|
1415
|
+
* @param {integer=} endTime - Filter by results listed before the specified time (in milliseconds since epoch)
|
|
1416
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
1417
|
+
*
|
|
1418
|
+
* @returns {Promise<Object>} - Statistics about sales. All prices in USD.
|
|
1419
|
+
*/
|
|
1420
|
+
exports.SalesStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
|
|
1421
|
+
var _args25 = arguments;
|
|
1422
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
1423
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1424
|
+
case 0:
|
|
1425
|
+
return _context25.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
1426
|
+
mode: "sales-stats"
|
|
1427
|
+
}, _args25[0] || {})));
|
|
1428
|
+
case 1:
|
|
1429
|
+
case "end":
|
|
1430
|
+
return _context25.stop();
|
|
1431
|
+
}
|
|
1432
|
+
}, _callee25, this);
|
|
1433
|
+
}));
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* Get the leaderboard rankings for the specified marketplace. If user address is specified, will return the ranking for the specified user (if present)
|
|
1437
|
+
*
|
|
1438
|
+
* @methodGroup Leaderboard
|
|
1439
|
+
* @namedParams
|
|
1440
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
1441
|
+
* @param {string=} userAddress - Retrieve the ranking for a specific user
|
|
1442
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
1443
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
1444
|
+
*
|
|
1445
|
+
* @returns {Promise<Array|Object>} - Returns a list of leaderboard rankings or, if userAddress is specified, ranking for that user.
|
|
1446
|
+
*/
|
|
1447
|
+
exports.Leaderboard = /*#__PURE__*/function () {
|
|
1448
|
+
var _ref50 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref49) {
|
|
1449
|
+
var userAddress,
|
|
1450
|
+
marketplaceParams,
|
|
1451
|
+
params,
|
|
1452
|
+
_args26 = arguments;
|
|
1453
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
1454
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1455
|
+
case 0:
|
|
1456
|
+
userAddress = _ref49.userAddress, marketplaceParams = _ref49.marketplaceParams;
|
|
1457
|
+
if (!userAddress) {
|
|
1458
|
+
_context26.next = 20;
|
|
1459
|
+
break;
|
|
1460
|
+
}
|
|
1461
|
+
params = {
|
|
1462
|
+
addr: Utils.FormatAddress(userAddress)
|
|
1463
|
+
};
|
|
1464
|
+
if (!marketplaceParams) {
|
|
1465
|
+
_context26.next = 10;
|
|
1466
|
+
break;
|
|
1467
|
+
}
|
|
1468
|
+
_context26.t0 = "tenant:eq:";
|
|
1469
|
+
_context26.next = 7;
|
|
1470
|
+
return this.MarketplaceInfo({
|
|
1471
|
+
marketplaceParams: marketplaceParams
|
|
1472
|
+
});
|
|
1473
|
+
case 7:
|
|
1474
|
+
_context26.t1 = _context26.sent.tenantId;
|
|
1475
|
+
_context26.t2 = _context26.t0.concat.call(_context26.t0, _context26.t1);
|
|
1476
|
+
params.filter = [_context26.t2];
|
|
1477
|
+
case 10:
|
|
1478
|
+
_context26.t4 = Utils;
|
|
1479
|
+
_context26.next = 13;
|
|
1480
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1481
|
+
path: UrlJoin("as", "wlt", "ranks"),
|
|
1482
|
+
method: "GET",
|
|
1483
|
+
queryParams: params
|
|
1484
|
+
});
|
|
1485
|
+
case 13:
|
|
1486
|
+
_context26.t5 = _context26.sent;
|
|
1487
|
+
_context26.next = 16;
|
|
1488
|
+
return _context26.t4.ResponseToJson.call(_context26.t4, _context26.t5);
|
|
1489
|
+
case 16:
|
|
1490
|
+
_context26.t3 = _context26.sent;
|
|
1491
|
+
if (_context26.t3) {
|
|
1492
|
+
_context26.next = 19;
|
|
1493
|
+
break;
|
|
1494
|
+
}
|
|
1495
|
+
_context26.t3 = [];
|
|
1496
|
+
case 19:
|
|
1497
|
+
return _context26.abrupt("return", _context26.t3[0]);
|
|
1498
|
+
case 20:
|
|
1499
|
+
return _context26.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
1500
|
+
mode: "leaderboard"
|
|
1501
|
+
}, _args26[0] || {})));
|
|
1502
|
+
case 21:
|
|
1503
|
+
case "end":
|
|
1504
|
+
return _context26.stop();
|
|
1505
|
+
}
|
|
1506
|
+
}, _callee26, this);
|
|
1507
|
+
}));
|
|
1508
|
+
return function (_x13) {
|
|
1509
|
+
return _ref50.apply(this, arguments);
|
|
1510
|
+
};
|
|
1511
|
+
}();
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* <b><i>Requires login</i></b>
|
|
1515
|
+
*
|
|
1516
|
+
* Create or update a listing for the specified item
|
|
1517
|
+
*
|
|
1518
|
+
* @methodGroup Listings
|
|
1519
|
+
* @namedParams
|
|
1520
|
+
* @param {string} contractAddress - The NFT contract address of the item
|
|
1521
|
+
* @param {string} tokenId - The token ID of the item
|
|
1522
|
+
* @param {number} price - The price of the listing, in USD
|
|
1523
|
+
* @param {string=} listingId - (When editing a listing) The ID of the existing listing
|
|
1524
|
+
*
|
|
1525
|
+
* @returns {Promise<string>} - The listing ID of the created listing
|
|
1526
|
+
*/
|
|
1527
|
+
exports.CreateListing = /*#__PURE__*/function () {
|
|
1528
|
+
var _ref52 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref51) {
|
|
1529
|
+
var contractAddress, tokenId, price, listingId;
|
|
1530
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
1531
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1532
|
+
case 0:
|
|
1533
|
+
contractAddress = _ref51.contractAddress, tokenId = _ref51.tokenId, price = _ref51.price, listingId = _ref51.listingId;
|
|
1534
|
+
contractAddress = Utils.FormatAddress(contractAddress);
|
|
1535
|
+
if (!listingId) {
|
|
1536
|
+
_context27.next = 12;
|
|
1537
|
+
break;
|
|
1538
|
+
}
|
|
1539
|
+
_context27.t0 = Utils;
|
|
1540
|
+
_context27.next = 6;
|
|
1541
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1542
|
+
path: UrlJoin("as", "wlt", "mkt"),
|
|
1543
|
+
method: "PUT",
|
|
1544
|
+
body: {
|
|
1545
|
+
id: listingId,
|
|
1546
|
+
price: parseFloat(price)
|
|
1547
|
+
},
|
|
1548
|
+
headers: {
|
|
1549
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1550
|
+
}
|
|
1551
|
+
});
|
|
1552
|
+
case 6:
|
|
1553
|
+
_context27.t1 = _context27.sent;
|
|
1554
|
+
_context27.next = 9;
|
|
1555
|
+
return _context27.t0.ResponseToFormat.call(_context27.t0, "text", _context27.t1);
|
|
1556
|
+
case 9:
|
|
1557
|
+
return _context27.abrupt("return", _context27.sent);
|
|
1558
|
+
case 12:
|
|
1559
|
+
_context27.t2 = Utils;
|
|
1560
|
+
_context27.next = 15;
|
|
1561
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1562
|
+
path: UrlJoin("as", "wlt", "mkt"),
|
|
1563
|
+
method: "POST",
|
|
1564
|
+
body: {
|
|
1565
|
+
contract: contractAddress,
|
|
1566
|
+
token: tokenId,
|
|
1567
|
+
price: parseFloat(price)
|
|
1568
|
+
},
|
|
1569
|
+
headers: {
|
|
1570
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
case 15:
|
|
1574
|
+
_context27.t3 = _context27.sent;
|
|
1575
|
+
_context27.next = 18;
|
|
1576
|
+
return _context27.t2.ResponseToJson.call(_context27.t2, _context27.t3);
|
|
1577
|
+
case 18:
|
|
1578
|
+
return _context27.abrupt("return", _context27.sent);
|
|
1579
|
+
case 19:
|
|
1580
|
+
case "end":
|
|
1581
|
+
return _context27.stop();
|
|
1582
|
+
}
|
|
1583
|
+
}, _callee27, this);
|
|
1584
|
+
}));
|
|
1585
|
+
return function (_x14) {
|
|
1586
|
+
return _ref52.apply(this, arguments);
|
|
1587
|
+
};
|
|
1588
|
+
}();
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* <b><i>Requires login</i></b>
|
|
1592
|
+
*
|
|
1593
|
+
* Remove the specified listing
|
|
1594
|
+
*
|
|
1595
|
+
* @methodGroup Listings
|
|
1596
|
+
* @namedParams
|
|
1597
|
+
* @param {string} listingId - The ID of the listing to remove
|
|
1598
|
+
*/
|
|
1599
|
+
exports.RemoveListing = /*#__PURE__*/function () {
|
|
1600
|
+
var _ref54 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref53) {
|
|
1601
|
+
var listingId;
|
|
1602
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
1603
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1604
|
+
case 0:
|
|
1605
|
+
listingId = _ref53.listingId;
|
|
1606
|
+
_context28.next = 3;
|
|
1607
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1608
|
+
path: UrlJoin("as", "wlt", "mkt", listingId),
|
|
1609
|
+
method: "DELETE",
|
|
1610
|
+
headers: {
|
|
1611
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1614
|
+
case 3:
|
|
1615
|
+
case "end":
|
|
1616
|
+
return _context28.stop();
|
|
1617
|
+
}
|
|
1618
|
+
}, _callee28, this);
|
|
1619
|
+
}));
|
|
1620
|
+
return function (_x15) {
|
|
1621
|
+
return _ref54.apply(this, arguments);
|
|
1622
|
+
};
|
|
1623
|
+
}();
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* Retrieve all valid names for filtering listing sales names. Full item names are required for filtering sales results by name.
|
|
1627
|
+
*
|
|
1628
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
1629
|
+
*
|
|
1630
|
+
* @methodGroup Listings
|
|
1631
|
+
* @namedParams
|
|
1632
|
+
* @param {Object} marketplaceParams - Parameters of a marketplace to filter results by
|
|
1633
|
+
*
|
|
1634
|
+
* @returns {Promise<Array<String>>} - A list of item names
|
|
1635
|
+
*/
|
|
1636
|
+
exports.SalesNames = /*#__PURE__*/function () {
|
|
1637
|
+
var _ref56 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref55) {
|
|
1638
|
+
var marketplaceParams, tenantId;
|
|
1639
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
1640
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1641
|
+
case 0:
|
|
1642
|
+
marketplaceParams = _ref55.marketplaceParams;
|
|
1643
|
+
if (!marketplaceParams) {
|
|
1644
|
+
_context29.next = 5;
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1647
|
+
_context29.next = 4;
|
|
1648
|
+
return this.MarketplaceInfo({
|
|
1649
|
+
marketplaceParams: marketplaceParams
|
|
1650
|
+
});
|
|
1651
|
+
case 4:
|
|
1652
|
+
tenantId = _context29.sent.tenantId;
|
|
1653
|
+
case 5:
|
|
1654
|
+
_context29.t0 = Utils;
|
|
1655
|
+
_context29.next = 8;
|
|
1656
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1657
|
+
path: UrlJoin("as", "mkt", "names", "hst"),
|
|
1658
|
+
method: "GET",
|
|
1659
|
+
queryParams: tenantId ? {
|
|
1660
|
+
filter: "tenant:eq:".concat(tenantId)
|
|
1661
|
+
} : {}
|
|
1662
|
+
});
|
|
1663
|
+
case 8:
|
|
1664
|
+
_context29.t1 = _context29.sent;
|
|
1665
|
+
_context29.next = 11;
|
|
1666
|
+
return _context29.t0.ResponseToJson.call(_context29.t0, _context29.t1);
|
|
1667
|
+
case 11:
|
|
1668
|
+
return _context29.abrupt("return", _context29.sent);
|
|
1669
|
+
case 12:
|
|
1670
|
+
case "end":
|
|
1671
|
+
return _context29.stop();
|
|
1672
|
+
}
|
|
1673
|
+
}, _callee29, this);
|
|
1674
|
+
}));
|
|
1675
|
+
return function (_x16) {
|
|
1676
|
+
return _ref56.apply(this, arguments);
|
|
1677
|
+
};
|
|
1678
|
+
}();
|
|
1679
|
+
|
|
1680
|
+
/**
|
|
1681
|
+
* Retrieve all valid names for filtering listings. Full item names are required for filtering listing results by name.
|
|
1682
|
+
*
|
|
1683
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
1684
|
+
*
|
|
1685
|
+
* @methodGroup Listings
|
|
1686
|
+
* @namedParams
|
|
1687
|
+
* @param {Object} marketplaceParams - Parameters of a marketplace to filter results by
|
|
1688
|
+
*
|
|
1689
|
+
* @returns {Promise<Array<String>>} - A list of item names
|
|
1690
|
+
*/
|
|
1691
|
+
exports.ListingNames = /*#__PURE__*/function () {
|
|
1692
|
+
var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(_ref57) {
|
|
1693
|
+
var marketplaceParams, tenantId;
|
|
1694
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
1695
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1696
|
+
case 0:
|
|
1697
|
+
marketplaceParams = _ref57.marketplaceParams;
|
|
1698
|
+
if (!marketplaceParams) {
|
|
1699
|
+
_context30.next = 5;
|
|
1700
|
+
break;
|
|
1701
|
+
}
|
|
1702
|
+
_context30.next = 4;
|
|
1703
|
+
return this.MarketplaceInfo({
|
|
1704
|
+
marketplaceParams: marketplaceParams
|
|
1705
|
+
});
|
|
1706
|
+
case 4:
|
|
1707
|
+
tenantId = _context30.sent.tenantId;
|
|
1708
|
+
case 5:
|
|
1709
|
+
_context30.t0 = Utils;
|
|
1710
|
+
_context30.next = 8;
|
|
1711
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1712
|
+
path: UrlJoin("as", "mkt", "names"),
|
|
1713
|
+
method: "GET",
|
|
1714
|
+
queryParams: tenantId ? {
|
|
1715
|
+
filter: "tenant:eq:".concat(tenantId)
|
|
1716
|
+
} : {}
|
|
1717
|
+
});
|
|
1718
|
+
case 8:
|
|
1719
|
+
_context30.t1 = _context30.sent;
|
|
1720
|
+
_context30.next = 11;
|
|
1721
|
+
return _context30.t0.ResponseToJson.call(_context30.t0, _context30.t1);
|
|
1722
|
+
case 11:
|
|
1723
|
+
return _context30.abrupt("return", _context30.sent);
|
|
1724
|
+
case 12:
|
|
1725
|
+
case "end":
|
|
1726
|
+
return _context30.stop();
|
|
1727
|
+
}
|
|
1728
|
+
}, _callee30, this);
|
|
1729
|
+
}));
|
|
1730
|
+
return function (_x17) {
|
|
1731
|
+
return _ref58.apply(this, arguments);
|
|
1732
|
+
};
|
|
1733
|
+
}();
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* Retrieve all valid edition names of the specified item. Full item edition names are required for filtering listing results by edition.
|
|
1737
|
+
*
|
|
1738
|
+
* @methodGroup Listings
|
|
1739
|
+
* @namedParams
|
|
1740
|
+
* @param {string} displayName - Display name of the item from which to request edition names
|
|
1741
|
+
*
|
|
1742
|
+
* @returns {Promise<Array<String>>} - A list of item editions
|
|
1743
|
+
*/
|
|
1744
|
+
exports.ListingEditionNames = /*#__PURE__*/function () {
|
|
1745
|
+
var _ref60 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(_ref59) {
|
|
1746
|
+
var displayName;
|
|
1747
|
+
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
1748
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1749
|
+
case 0:
|
|
1750
|
+
displayName = _ref59.displayName;
|
|
1751
|
+
_context31.t0 = Utils;
|
|
1752
|
+
_context31.next = 4;
|
|
1753
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1754
|
+
path: UrlJoin("as", "mkt", "editions"),
|
|
1755
|
+
queryParams: {
|
|
1756
|
+
filter: "nft/display_name:eq:".concat(displayName)
|
|
1757
|
+
},
|
|
1758
|
+
method: "GET"
|
|
1759
|
+
});
|
|
1760
|
+
case 4:
|
|
1761
|
+
_context31.t1 = _context31.sent;
|
|
1762
|
+
_context31.next = 7;
|
|
1763
|
+
return _context31.t0.ResponseToJson.call(_context31.t0, _context31.t1);
|
|
1764
|
+
case 7:
|
|
1765
|
+
return _context31.abrupt("return", _context31.sent);
|
|
1766
|
+
case 8:
|
|
1767
|
+
case "end":
|
|
1768
|
+
return _context31.stop();
|
|
1769
|
+
}
|
|
1770
|
+
}, _callee31, this);
|
|
1771
|
+
}));
|
|
1772
|
+
return function (_x18) {
|
|
1773
|
+
return _ref60.apply(this, arguments);
|
|
1774
|
+
};
|
|
1775
|
+
}();
|
|
1776
|
+
|
|
1777
|
+
/**
|
|
1778
|
+
* Retrieve names of all valid attributes for listed items. Full attribute names and values are required for filtering listing results by attributes.
|
|
1779
|
+
*
|
|
1780
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
1781
|
+
*
|
|
1782
|
+
* @methodGroup Listings
|
|
1783
|
+
* @namedParams
|
|
1784
|
+
* @param {Object=} marketplaceParams - Parameters of a marketplace to filter results by
|
|
1785
|
+
* @param {string=} displayName - Display name of the item from which to request attributes
|
|
1786
|
+
*
|
|
1787
|
+
* @returns {Promise<Array<String>>} - A list of valid attributes
|
|
1788
|
+
*/
|
|
1789
|
+
exports.ListingAttributes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32() {
|
|
1790
|
+
var _ref62,
|
|
1791
|
+
marketplaceParams,
|
|
1792
|
+
displayName,
|
|
1793
|
+
filters,
|
|
1794
|
+
attributes,
|
|
1795
|
+
_args32 = arguments;
|
|
1796
|
+
return _regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
1797
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1798
|
+
case 0:
|
|
1799
|
+
_ref62 = _args32.length > 0 && _args32[0] !== undefined ? _args32[0] : {}, marketplaceParams = _ref62.marketplaceParams, displayName = _ref62.displayName;
|
|
1800
|
+
filters = [];
|
|
1801
|
+
if (!marketplaceParams) {
|
|
1802
|
+
_context32.next = 10;
|
|
1803
|
+
break;
|
|
1804
|
+
}
|
|
1805
|
+
_context32.t0 = filters;
|
|
1806
|
+
_context32.t1 = "tenant:eq:";
|
|
1807
|
+
_context32.next = 7;
|
|
1808
|
+
return this.MarketplaceInfo({
|
|
1809
|
+
marketplaceParams: marketplaceParams
|
|
1810
|
+
});
|
|
1811
|
+
case 7:
|
|
1812
|
+
_context32.t2 = _context32.sent.tenantId;
|
|
1813
|
+
_context32.t3 = _context32.t1.concat.call(_context32.t1, _context32.t2);
|
|
1814
|
+
_context32.t0.push.call(_context32.t0, _context32.t3);
|
|
1815
|
+
case 10:
|
|
1816
|
+
if (displayName) {
|
|
1817
|
+
filters.push("nft/display_name:eq:".concat(displayName));
|
|
1818
|
+
}
|
|
1819
|
+
_context32.t4 = Utils;
|
|
1820
|
+
_context32.next = 14;
|
|
1821
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1822
|
+
path: UrlJoin("as", "mkt", "attributes"),
|
|
1823
|
+
method: "GET",
|
|
1824
|
+
queryParams: {
|
|
1825
|
+
filter: filters
|
|
1826
|
+
}
|
|
1827
|
+
});
|
|
1828
|
+
case 14:
|
|
1829
|
+
_context32.t5 = _context32.sent;
|
|
1830
|
+
_context32.next = 17;
|
|
1831
|
+
return _context32.t4.ResponseToJson.call(_context32.t4, _context32.t5);
|
|
1832
|
+
case 17:
|
|
1833
|
+
attributes = _context32.sent;
|
|
1834
|
+
return _context32.abrupt("return", attributes.map(function (_ref63) {
|
|
1835
|
+
var trait_type = _ref63.trait_type,
|
|
1836
|
+
values = _ref63.values;
|
|
1837
|
+
return {
|
|
1838
|
+
name: trait_type,
|
|
1839
|
+
values: values
|
|
1840
|
+
};
|
|
1841
|
+
}).filter(function (_ref64) {
|
|
1842
|
+
var name = _ref64.name;
|
|
1843
|
+
return !["Content Fabric Hash", "Total Minted Supply", "Creator"].includes(name);
|
|
1844
|
+
}));
|
|
1845
|
+
case 19:
|
|
1846
|
+
case "end":
|
|
1847
|
+
return _context32.stop();
|
|
1848
|
+
}
|
|
1849
|
+
}, _callee32, this);
|
|
1850
|
+
}));
|
|
1851
|
+
|
|
1852
|
+
/* PURCHASE / CLAIM */
|
|
1853
|
+
|
|
1854
|
+
/**
|
|
1855
|
+
* Claim the specified gift code
|
|
1856
|
+
*
|
|
1857
|
+
* Use the <a href="#.GiftClaimStatus">GiftClaimStatus</a> method to check minting status after claiming
|
|
1858
|
+
*
|
|
1859
|
+
* @methodGroup Purchase
|
|
1860
|
+
* @namedParams
|
|
1861
|
+
* @param {string} code - The OTP gift code to claim
|
|
1862
|
+
*
|
|
1863
|
+
* @returns {Promise<Object>} - Information about the claim, including the tenant associated with the item, the gift ID and the status op key
|
|
1864
|
+
*/
|
|
1865
|
+
exports.ClaimGift = /*#__PURE__*/function () {
|
|
1866
|
+
var _ref66 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(_ref65) {
|
|
1867
|
+
var code;
|
|
1868
|
+
return _regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
1869
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1870
|
+
case 0:
|
|
1871
|
+
code = _ref65.code;
|
|
1872
|
+
_context33.next = 3;
|
|
1873
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1874
|
+
method: "POST",
|
|
1875
|
+
path: UrlJoin("as", "wlt", "gifts", "claim"),
|
|
1876
|
+
body: {
|
|
1877
|
+
otp_code: code
|
|
1878
|
+
},
|
|
1879
|
+
headers: {
|
|
1880
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1881
|
+
}
|
|
1882
|
+
}));
|
|
1883
|
+
case 3:
|
|
1884
|
+
return _context33.abrupt("return", _context33.sent);
|
|
1885
|
+
case 4:
|
|
1886
|
+
case "end":
|
|
1887
|
+
return _context33.stop();
|
|
1888
|
+
}
|
|
1889
|
+
}, _callee33, this);
|
|
1890
|
+
}));
|
|
1891
|
+
return function (_x19) {
|
|
1892
|
+
return _ref66.apply(this, arguments);
|
|
1893
|
+
};
|
|
1894
|
+
}();
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* Claim the specified item from the specified marketplace
|
|
1898
|
+
*
|
|
1899
|
+
* Use the <a href="#.ClaimStatus">ClaimStatus</a> method to check minting status after claiming
|
|
1900
|
+
*
|
|
1901
|
+
* @methodGroup Purchase
|
|
1902
|
+
* @namedParams
|
|
1903
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
1904
|
+
* @param {string} sku - The SKU of the item to claim
|
|
1905
|
+
* @param {string=} email - Email address of the user. If specified, this will bind the user to the tenant of the specified marketplace
|
|
1906
|
+
*/
|
|
1907
|
+
exports.ClaimItem = /*#__PURE__*/function () {
|
|
1908
|
+
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(_ref67) {
|
|
1909
|
+
var marketplaceParams, sku, email, marketplaceInfo;
|
|
1910
|
+
return _regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
1911
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1912
|
+
case 0:
|
|
1913
|
+
marketplaceParams = _ref67.marketplaceParams, sku = _ref67.sku, email = _ref67.email;
|
|
1914
|
+
_context34.next = 3;
|
|
1915
|
+
return this.MarketplaceInfo({
|
|
1916
|
+
marketplaceParams: marketplaceParams
|
|
1917
|
+
});
|
|
1918
|
+
case 3:
|
|
1919
|
+
marketplaceInfo = _context34.sent;
|
|
1920
|
+
_context34.next = 6;
|
|
1921
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1922
|
+
method: "POST",
|
|
1923
|
+
path: UrlJoin("as", "wlt", "act", marketplaceInfo.tenant_id),
|
|
1924
|
+
body: {
|
|
1925
|
+
op: "nft-claim",
|
|
1926
|
+
sid: marketplaceInfo.marketplaceId,
|
|
1927
|
+
sku: sku,
|
|
1928
|
+
email: email
|
|
1929
|
+
},
|
|
1930
|
+
headers: {
|
|
1931
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1932
|
+
}
|
|
1933
|
+
});
|
|
1934
|
+
case 6:
|
|
1935
|
+
case "end":
|
|
1936
|
+
return _context34.stop();
|
|
1937
|
+
}
|
|
1938
|
+
}, _callee34, this);
|
|
1939
|
+
}));
|
|
1940
|
+
return function (_x20) {
|
|
1941
|
+
return _ref68.apply(this, arguments);
|
|
1942
|
+
};
|
|
1943
|
+
}();
|
|
1944
|
+
|
|
1945
|
+
/**
|
|
1946
|
+
* Redirect to the wallet app to purchase the specified item from the specified marketplace
|
|
1947
|
+
*
|
|
1948
|
+
* Use the <a href="#.PurchaseStatus">PurchaseStatus</a> method to check minting status after purchasing
|
|
1949
|
+
*
|
|
1950
|
+
* @methodGroup Purchase
|
|
1951
|
+
* @namedParams
|
|
1952
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
1953
|
+
* @param {string} sku - The SKU of the item to claim
|
|
1954
|
+
* @param {string=} confirmationId - Confirmation ID with which to reference this purchase. If not specified, a confirmation ID will be automatically generated. On success, the user will be returned to `successUrl` with the `confirmationId` as a URL parameter.
|
|
1955
|
+
* @param {string} successUrl - The URL to redirect back to upon successful purchase
|
|
1956
|
+
* @param {string} cancelUrl - The URL to redirect back to upon cancellation of purchase
|
|
1957
|
+
*/
|
|
1958
|
+
exports.PurchaseItem = /*#__PURE__*/function () {
|
|
1959
|
+
var _ref70 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(_ref69) {
|
|
1960
|
+
var marketplaceParams, sku, confirmationId, successUrl, cancelUrl, marketplaceInfo;
|
|
1961
|
+
return _regeneratorRuntime.wrap(function _callee35$(_context35) {
|
|
1962
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1963
|
+
case 0:
|
|
1964
|
+
marketplaceParams = _ref69.marketplaceParams, sku = _ref69.sku, confirmationId = _ref69.confirmationId, successUrl = _ref69.successUrl, cancelUrl = _ref69.cancelUrl;
|
|
1965
|
+
_context35.next = 3;
|
|
1966
|
+
return this.MarketplaceInfo({
|
|
1967
|
+
marketplaceParams: marketplaceParams
|
|
1968
|
+
});
|
|
1969
|
+
case 3:
|
|
1970
|
+
marketplaceInfo = _context35.sent;
|
|
1971
|
+
window.location.href = this.FlowURL({
|
|
1972
|
+
type: "action",
|
|
1973
|
+
flow: "purchase",
|
|
1974
|
+
marketplaceId: marketplaceInfo.marketplaceId,
|
|
1975
|
+
parameters: {
|
|
1976
|
+
sku: sku,
|
|
1977
|
+
confirmationId: confirmationId,
|
|
1978
|
+
successUrl: successUrl,
|
|
1979
|
+
cancelUrl: cancelUrl,
|
|
1980
|
+
login: true,
|
|
1981
|
+
auth: this.ClientAuthToken()
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
case 5:
|
|
1985
|
+
case "end":
|
|
1986
|
+
return _context35.stop();
|
|
1987
|
+
}
|
|
1988
|
+
}, _callee35, this);
|
|
1989
|
+
}));
|
|
1990
|
+
return function (_x21) {
|
|
1991
|
+
return _ref70.apply(this, arguments);
|
|
1992
|
+
};
|
|
1993
|
+
}();
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* Redirect to the wallet app to purchase the specified listing
|
|
1997
|
+
*
|
|
1998
|
+
* Use the <a href="#.PurchaseStatus">ListingPurchaseStatus</a> method to check minting status after purchasing
|
|
1999
|
+
*
|
|
2000
|
+
* @methodGroup Purchase
|
|
2001
|
+
* @namedParams
|
|
2002
|
+
* @param {Object=} marketplaceParams - Parameters of the marketplace
|
|
2003
|
+
* @param {string} listingId - The SKU of the item to claim
|
|
2004
|
+
* @param {string=} confirmationId - Confirmation ID with which to reference this purchase. If not specified, a confirmation ID will be automatically generated. On success, the user will be returned to `successUrl` with the `confirmationId` as a URL parameter.
|
|
2005
|
+
* @param {string} successUrl - The URL to redirect back to upon successful purchase
|
|
2006
|
+
* @param {string} cancelUrl - The URL to redirect back to upon cancellation of purchase
|
|
2007
|
+
*/
|
|
2008
|
+
exports.PurchaseListing = /*#__PURE__*/function () {
|
|
2009
|
+
var _ref72 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(_ref71) {
|
|
2010
|
+
var marketplaceParams, listingId, confirmationId, successUrl, cancelUrl, marketplaceInfo;
|
|
2011
|
+
return _regeneratorRuntime.wrap(function _callee36$(_context36) {
|
|
2012
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2013
|
+
case 0:
|
|
2014
|
+
marketplaceParams = _ref71.marketplaceParams, listingId = _ref71.listingId, confirmationId = _ref71.confirmationId, successUrl = _ref71.successUrl, cancelUrl = _ref71.cancelUrl;
|
|
2015
|
+
if (!marketplaceParams) {
|
|
2016
|
+
_context36.next = 5;
|
|
2017
|
+
break;
|
|
2018
|
+
}
|
|
2019
|
+
_context36.next = 4;
|
|
2020
|
+
return this.MarketplaceInfo({
|
|
2021
|
+
marketplaceParams: marketplaceParams
|
|
2022
|
+
});
|
|
2023
|
+
case 4:
|
|
2024
|
+
marketplaceInfo = _context36.sent;
|
|
2025
|
+
case 5:
|
|
2026
|
+
window.location.href = this.FlowURL({
|
|
2027
|
+
type: "action",
|
|
2028
|
+
flow: "purchase",
|
|
2029
|
+
marketplaceId: marketplaceInfo && marketplaceInfo.marketplaceId,
|
|
2030
|
+
parameters: {
|
|
2031
|
+
listingId: listingId,
|
|
2032
|
+
confirmationId: confirmationId,
|
|
2033
|
+
successUrl: successUrl,
|
|
2034
|
+
cancelUrl: cancelUrl,
|
|
2035
|
+
login: true,
|
|
2036
|
+
auth: this.ClientAuthToken()
|
|
2037
|
+
}
|
|
2038
|
+
});
|
|
2039
|
+
case 6:
|
|
2040
|
+
case "end":
|
|
2041
|
+
return _context36.stop();
|
|
2042
|
+
}
|
|
2043
|
+
}, _callee36, this);
|
|
2044
|
+
}));
|
|
2045
|
+
return function (_x22) {
|
|
2046
|
+
return _ref72.apply(this, arguments);
|
|
2047
|
+
};
|
|
2048
|
+
}();
|
|
2049
|
+
|
|
2050
|
+
/* MINTING STATUS */
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* Return status of the specified listing purchase
|
|
2054
|
+
*
|
|
2055
|
+
* @methodGroup Status
|
|
2056
|
+
* @namedParams
|
|
2057
|
+
* @param {string} listingId - The ID of the listing
|
|
2058
|
+
* @param {string} confirmationId - The confirmation ID of the purchase
|
|
2059
|
+
*
|
|
2060
|
+
* @returns {Promise<Object>} - The status of the purchase
|
|
2061
|
+
*/
|
|
2062
|
+
exports.ListingPurchaseStatus = /*#__PURE__*/function () {
|
|
2063
|
+
var _ref74 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(_ref73) {
|
|
2064
|
+
var listingId, confirmationId, listingStatus, statuses;
|
|
2065
|
+
return _regeneratorRuntime.wrap(function _callee37$(_context37) {
|
|
2066
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2067
|
+
case 0:
|
|
2068
|
+
listingId = _ref73.listingId, confirmationId = _ref73.confirmationId;
|
|
2069
|
+
_context37.prev = 1;
|
|
2070
|
+
_context37.next = 4;
|
|
2071
|
+
return this.ListingStatus({
|
|
2072
|
+
listingId: listingId
|
|
2073
|
+
});
|
|
2074
|
+
case 4:
|
|
2075
|
+
listingStatus = _context37.sent;
|
|
2076
|
+
if (listingStatus) {
|
|
2077
|
+
_context37.next = 7;
|
|
2078
|
+
break;
|
|
2079
|
+
}
|
|
2080
|
+
throw Error("Unable to find info for listing " + listingId);
|
|
2081
|
+
case 7:
|
|
2082
|
+
_context37.next = 9;
|
|
2083
|
+
return this.MintingStatus({
|
|
2084
|
+
tenantId: listingStatus.tenant
|
|
2085
|
+
});
|
|
2086
|
+
case 9:
|
|
2087
|
+
statuses = _context37.sent;
|
|
2088
|
+
return _context37.abrupt("return", statuses.find(function (status) {
|
|
2089
|
+
return status.op === "nft-transfer" && status.extra && status.extra[0] === confirmationId;
|
|
2090
|
+
}) || {
|
|
2091
|
+
status: "none"
|
|
2092
|
+
});
|
|
2093
|
+
case 13:
|
|
2094
|
+
_context37.prev = 13;
|
|
2095
|
+
_context37.t0 = _context37["catch"](1);
|
|
2096
|
+
this.Log(_context37.t0, true);
|
|
2097
|
+
return _context37.abrupt("return", {
|
|
2098
|
+
status: "unknown"
|
|
2099
|
+
});
|
|
2100
|
+
case 17:
|
|
2101
|
+
case "end":
|
|
2102
|
+
return _context37.stop();
|
|
2103
|
+
}
|
|
2104
|
+
}, _callee37, this, [[1, 13]]);
|
|
2105
|
+
}));
|
|
2106
|
+
return function (_x23) {
|
|
2107
|
+
return _ref74.apply(this, arguments);
|
|
2108
|
+
};
|
|
2109
|
+
}();
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* Return status of the specified marketplace purchase
|
|
2113
|
+
*
|
|
2114
|
+
* @methodGroup Status
|
|
2115
|
+
* @namedParams
|
|
2116
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
2117
|
+
* @param {string} confirmationId - The confirmation ID of the purchase
|
|
2118
|
+
*
|
|
2119
|
+
* @returns {Promise<Object>} - The minting status of the purchaseed item(s)
|
|
2120
|
+
*/
|
|
2121
|
+
exports.PurchaseStatus = /*#__PURE__*/function () {
|
|
2122
|
+
var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(_ref75) {
|
|
2123
|
+
var marketplaceParams, confirmationId, marketplaceInfo, statuses;
|
|
2124
|
+
return _regeneratorRuntime.wrap(function _callee38$(_context38) {
|
|
2125
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2126
|
+
case 0:
|
|
2127
|
+
marketplaceParams = _ref75.marketplaceParams, confirmationId = _ref75.confirmationId;
|
|
2128
|
+
_context38.prev = 1;
|
|
2129
|
+
_context38.next = 4;
|
|
2130
|
+
return this.MarketplaceInfo({
|
|
2131
|
+
marketplaceParams: marketplaceParams
|
|
2132
|
+
});
|
|
2133
|
+
case 4:
|
|
2134
|
+
marketplaceInfo = _context38.sent;
|
|
2135
|
+
_context38.next = 7;
|
|
2136
|
+
return this.MintingStatus({
|
|
2137
|
+
tenantId: marketplaceInfo.tenant_id
|
|
2138
|
+
});
|
|
2139
|
+
case 7:
|
|
2140
|
+
statuses = _context38.sent;
|
|
2141
|
+
return _context38.abrupt("return", statuses.find(function (status) {
|
|
2142
|
+
return status.op === "nft-buy" && status.confirmationId === confirmationId;
|
|
2143
|
+
}) || {
|
|
2144
|
+
status: "none"
|
|
2145
|
+
});
|
|
2146
|
+
case 11:
|
|
2147
|
+
_context38.prev = 11;
|
|
2148
|
+
_context38.t0 = _context38["catch"](1);
|
|
2149
|
+
this.Log(_context38.t0, true);
|
|
2150
|
+
return _context38.abrupt("return", {
|
|
2151
|
+
status: "unknown"
|
|
2152
|
+
});
|
|
2153
|
+
case 15:
|
|
2154
|
+
case "end":
|
|
2155
|
+
return _context38.stop();
|
|
2156
|
+
}
|
|
2157
|
+
}, _callee38, this, [[1, 11]]);
|
|
2158
|
+
}));
|
|
2159
|
+
return function (_x24) {
|
|
2160
|
+
return _ref76.apply(this, arguments);
|
|
2161
|
+
};
|
|
2162
|
+
}();
|
|
2163
|
+
|
|
2164
|
+
/**
|
|
2165
|
+
* Return status of the specified item claim
|
|
2166
|
+
*
|
|
2167
|
+
* @methodGroup Status
|
|
2168
|
+
* @namedParams
|
|
2169
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
2170
|
+
* @param {string} sku - The SKU of the item claimed
|
|
2171
|
+
*
|
|
2172
|
+
* @returns {Promise<Object>} - The minting status of the claim
|
|
2173
|
+
*/
|
|
2174
|
+
exports.ClaimStatus = /*#__PURE__*/function () {
|
|
2175
|
+
var _ref78 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(_ref77) {
|
|
2176
|
+
var marketplaceParams, sku, marketplaceInfo, statuses;
|
|
2177
|
+
return _regeneratorRuntime.wrap(function _callee39$(_context39) {
|
|
2178
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2179
|
+
case 0:
|
|
2180
|
+
marketplaceParams = _ref77.marketplaceParams, sku = _ref77.sku;
|
|
2181
|
+
_context39.prev = 1;
|
|
2182
|
+
_context39.next = 4;
|
|
2183
|
+
return this.MarketplaceInfo({
|
|
2184
|
+
marketplaceParams: marketplaceParams
|
|
2185
|
+
});
|
|
2186
|
+
case 4:
|
|
2187
|
+
marketplaceInfo = _context39.sent;
|
|
2188
|
+
_context39.next = 7;
|
|
2189
|
+
return this.MintingStatus({
|
|
2190
|
+
tenantId: marketplaceInfo.tenantId
|
|
2191
|
+
});
|
|
2192
|
+
case 7:
|
|
2193
|
+
statuses = _context39.sent;
|
|
2194
|
+
return _context39.abrupt("return", statuses.find(function (status) {
|
|
2195
|
+
return status.op === "nft-claim" && status.marketplaceId === marketplaceInfo.marketplaceId && status.confirmationId === sku;
|
|
2196
|
+
}) || {
|
|
2197
|
+
status: "none"
|
|
2198
|
+
});
|
|
2199
|
+
case 11:
|
|
2200
|
+
_context39.prev = 11;
|
|
2201
|
+
_context39.t0 = _context39["catch"](1);
|
|
2202
|
+
this.Log(_context39.t0, true);
|
|
2203
|
+
return _context39.abrupt("return", {
|
|
2204
|
+
status: "unknown"
|
|
2205
|
+
});
|
|
2206
|
+
case 15:
|
|
2207
|
+
case "end":
|
|
2208
|
+
return _context39.stop();
|
|
2209
|
+
}
|
|
2210
|
+
}, _callee39, this, [[1, 11]]);
|
|
2211
|
+
}));
|
|
2212
|
+
return function (_x25) {
|
|
2213
|
+
return _ref78.apply(this, arguments);
|
|
2214
|
+
};
|
|
2215
|
+
}();
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* Return status of the specified gift claim
|
|
2219
|
+
*
|
|
2220
|
+
* @methodGroup Status
|
|
2221
|
+
* @namedParams
|
|
2222
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
2223
|
+
* @param {string=} confirmationId - The confirmation ID of the gift purchase
|
|
2224
|
+
* @param {string=} giftId - The ID of the claimed gift
|
|
2225
|
+
*
|
|
2226
|
+
* @returns {Promise<Object>} - The transfer status of the gift claim
|
|
2227
|
+
*/
|
|
2228
|
+
exports.GiftClaimStatus = /*#__PURE__*/function () {
|
|
2229
|
+
var _ref80 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(_ref79) {
|
|
2230
|
+
var marketplaceParams, confirmationId, giftId, marketplaceInfo, statuses, responses;
|
|
2231
|
+
return _regeneratorRuntime.wrap(function _callee40$(_context40) {
|
|
2232
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2233
|
+
case 0:
|
|
2234
|
+
marketplaceParams = _ref79.marketplaceParams, confirmationId = _ref79.confirmationId, giftId = _ref79.giftId;
|
|
2235
|
+
_context40.prev = 1;
|
|
2236
|
+
_context40.next = 4;
|
|
2237
|
+
return this.MarketplaceInfo({
|
|
2238
|
+
marketplaceParams: marketplaceParams
|
|
2239
|
+
});
|
|
2240
|
+
case 4:
|
|
2241
|
+
marketplaceInfo = _context40.sent;
|
|
2242
|
+
_context40.next = 7;
|
|
2243
|
+
return this.MintingStatus({
|
|
2244
|
+
tenantId: marketplaceInfo.tenantId
|
|
2245
|
+
});
|
|
2246
|
+
case 7:
|
|
2247
|
+
statuses = _context40.sent;
|
|
2248
|
+
// Status is a list of transfer statuses, may be multiple if quantity > 1
|
|
2249
|
+
responses = statuses.filter(function (status) {
|
|
2250
|
+
return status.op === "nft-transfer" && (confirmationId && status.confirmationId === confirmationId || giftId && status.giftId === giftId);
|
|
2251
|
+
}) || {
|
|
2252
|
+
status: "none"
|
|
2253
|
+
};
|
|
2254
|
+
if (!(responses.length === 0)) {
|
|
2255
|
+
_context40.next = 13;
|
|
2256
|
+
break;
|
|
2257
|
+
}
|
|
2258
|
+
return _context40.abrupt("return", {
|
|
2259
|
+
status: "none"
|
|
2260
|
+
});
|
|
2261
|
+
case 13:
|
|
2262
|
+
if (!responses.find(function (response) {
|
|
2263
|
+
return response.status === "failed";
|
|
2264
|
+
})) {
|
|
2265
|
+
_context40.next = 17;
|
|
2266
|
+
break;
|
|
2267
|
+
}
|
|
2268
|
+
return _context40.abrupt("return", {
|
|
2269
|
+
status: "failed",
|
|
2270
|
+
op: "nft-transfer",
|
|
2271
|
+
transfer_statuses: responses
|
|
2272
|
+
});
|
|
2273
|
+
case 17:
|
|
2274
|
+
if (!responses.find(function (response) {
|
|
2275
|
+
return response.status !== "complete";
|
|
2276
|
+
})) {
|
|
2277
|
+
_context40.next = 21;
|
|
2278
|
+
break;
|
|
2279
|
+
}
|
|
2280
|
+
return _context40.abrupt("return", {
|
|
2281
|
+
status: "pending",
|
|
2282
|
+
op: "nft-transfer",
|
|
2283
|
+
transfer_statuses: responses
|
|
2284
|
+
});
|
|
2285
|
+
case 21:
|
|
2286
|
+
return _context40.abrupt("return", {
|
|
2287
|
+
status: "complete",
|
|
2288
|
+
op: "nft-transfer",
|
|
2289
|
+
transfer_statuses: responses,
|
|
2290
|
+
items: responses.map(function (response) {
|
|
2291
|
+
return {
|
|
2292
|
+
token_addr: response.address,
|
|
2293
|
+
token_id_str: response.tokenId
|
|
2294
|
+
};
|
|
2295
|
+
})
|
|
2296
|
+
});
|
|
2297
|
+
case 22:
|
|
2298
|
+
_context40.next = 28;
|
|
2299
|
+
break;
|
|
2300
|
+
case 24:
|
|
2301
|
+
_context40.prev = 24;
|
|
2302
|
+
_context40.t0 = _context40["catch"](1);
|
|
2303
|
+
this.Log(_context40.t0, true);
|
|
2304
|
+
return _context40.abrupt("return", {
|
|
2305
|
+
status: "unknown"
|
|
2306
|
+
});
|
|
2307
|
+
case 28:
|
|
2308
|
+
case "end":
|
|
2309
|
+
return _context40.stop();
|
|
2310
|
+
}
|
|
2311
|
+
}, _callee40, this, [[1, 24]]);
|
|
2312
|
+
}));
|
|
2313
|
+
return function (_x26) {
|
|
2314
|
+
return _ref80.apply(this, arguments);
|
|
2315
|
+
};
|
|
2316
|
+
}();
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* Return status of the specified entitlement claim
|
|
2320
|
+
*
|
|
2321
|
+
* @methodGroup Status
|
|
2322
|
+
* @namedParams
|
|
2323
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
2324
|
+
* @param {string} purchaseId - The purchase ID of the entitlement, for confirmation of status
|
|
2325
|
+
*
|
|
2326
|
+
* @returns {Promise<Object>} - The mint status of the entitlement claim
|
|
2327
|
+
*/
|
|
2328
|
+
exports.EntitlementClaimStatus = /*#__PURE__*/function () {
|
|
2329
|
+
var _ref82 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(_ref81) {
|
|
2330
|
+
var marketplaceParams, purchaseId, marketplaceInfo, statuses, responses;
|
|
2331
|
+
return _regeneratorRuntime.wrap(function _callee41$(_context41) {
|
|
2332
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2333
|
+
case 0:
|
|
2334
|
+
marketplaceParams = _ref81.marketplaceParams, purchaseId = _ref81.purchaseId;
|
|
2335
|
+
_context41.prev = 1;
|
|
2336
|
+
_context41.next = 4;
|
|
2337
|
+
return this.MarketplaceInfo({
|
|
2338
|
+
marketplaceParams: marketplaceParams
|
|
2339
|
+
});
|
|
2340
|
+
case 4:
|
|
2341
|
+
marketplaceInfo = _context41.sent;
|
|
2342
|
+
_context41.next = 7;
|
|
2343
|
+
return this.MintingStatus({
|
|
2344
|
+
tenantId: marketplaceInfo.tenantId
|
|
2345
|
+
});
|
|
2346
|
+
case 7:
|
|
2347
|
+
statuses = _context41.sent;
|
|
2348
|
+
responses = statuses.filter(function (status) {
|
|
2349
|
+
return status.op === "nft-claim-entitlement" && purchaseId && purchaseId == status.confirmationId;
|
|
2350
|
+
}) || {
|
|
2351
|
+
status: "none"
|
|
2352
|
+
};
|
|
2353
|
+
if (!(responses.length === 0)) {
|
|
2354
|
+
_context41.next = 13;
|
|
2355
|
+
break;
|
|
2356
|
+
}
|
|
2357
|
+
return _context41.abrupt("return", {
|
|
2358
|
+
status: "none"
|
|
2359
|
+
});
|
|
2360
|
+
case 13:
|
|
2361
|
+
if (!responses.find(function (response) {
|
|
2362
|
+
return response.status === "complete";
|
|
2363
|
+
})) {
|
|
2364
|
+
_context41.next = 17;
|
|
2365
|
+
break;
|
|
2366
|
+
}
|
|
2367
|
+
return _context41.abrupt("return", {
|
|
2368
|
+
status: "complete",
|
|
2369
|
+
op: "nft-claim-entitlement",
|
|
2370
|
+
items: [{
|
|
2371
|
+
token_addr: responses[0].address,
|
|
2372
|
+
token_id: responses[0].tokenId
|
|
2373
|
+
}]
|
|
2374
|
+
});
|
|
2375
|
+
case 17:
|
|
2376
|
+
if (!responses.find(function (response) {
|
|
2377
|
+
return response.status === "error";
|
|
2378
|
+
})) {
|
|
2379
|
+
_context41.next = 21;
|
|
2380
|
+
break;
|
|
2381
|
+
}
|
|
2382
|
+
return _context41.abrupt("return", {
|
|
2383
|
+
status: "error",
|
|
2384
|
+
op: "nft-claim-entitlement"
|
|
2385
|
+
});
|
|
2386
|
+
case 21:
|
|
2387
|
+
return _context41.abrupt("return", {
|
|
2388
|
+
status: "pending",
|
|
2389
|
+
op: "nft-claim-entitlement"
|
|
2390
|
+
});
|
|
2391
|
+
case 22:
|
|
2392
|
+
_context41.next = 28;
|
|
2393
|
+
break;
|
|
2394
|
+
case 24:
|
|
2395
|
+
_context41.prev = 24;
|
|
2396
|
+
_context41.t0 = _context41["catch"](1);
|
|
2397
|
+
this.Log(_context41.t0, true);
|
|
2398
|
+
return _context41.abrupt("return", {
|
|
2399
|
+
status: "unknown"
|
|
2400
|
+
});
|
|
2401
|
+
case 28:
|
|
2402
|
+
case "end":
|
|
2403
|
+
return _context41.stop();
|
|
2404
|
+
}
|
|
2405
|
+
}, _callee41, this, [[1, 24]]);
|
|
2406
|
+
}));
|
|
2407
|
+
return function (_x27) {
|
|
2408
|
+
return _ref82.apply(this, arguments);
|
|
2409
|
+
};
|
|
2410
|
+
}();
|
|
2411
|
+
|
|
2412
|
+
/**
|
|
2413
|
+
* Return status of the specified pack opening
|
|
2414
|
+
*
|
|
2415
|
+
* @methodGroup Status
|
|
2416
|
+
* @namedParams
|
|
2417
|
+
* @param {string} contractAddress - The NFT contract address of the opened pack
|
|
2418
|
+
* @param {string} tokenId - The token ID of the opened pack
|
|
2419
|
+
*
|
|
2420
|
+
* @returns {Promise<Object>} - The status of the pack opening
|
|
2421
|
+
*/
|
|
2422
|
+
exports.PackOpenStatus = /*#__PURE__*/function () {
|
|
2423
|
+
var _ref84 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(_ref83) {
|
|
2424
|
+
var contractAddress, tokenId, tenantConfig, statuses;
|
|
2425
|
+
return _regeneratorRuntime.wrap(function _callee42$(_context42) {
|
|
2426
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
2427
|
+
case 0:
|
|
2428
|
+
contractAddress = _ref83.contractAddress, tokenId = _ref83.tokenId;
|
|
2429
|
+
_context42.prev = 1;
|
|
2430
|
+
_context42.next = 4;
|
|
2431
|
+
return this.TenantConfiguration({
|
|
2432
|
+
contractAddress: contractAddress
|
|
2433
|
+
});
|
|
2434
|
+
case 4:
|
|
2435
|
+
tenantConfig = _context42.sent;
|
|
2436
|
+
_context42.next = 7;
|
|
2437
|
+
return this.MintingStatus({
|
|
2438
|
+
tenantId: tenantConfig.tenant
|
|
2439
|
+
});
|
|
2440
|
+
case 7:
|
|
2441
|
+
statuses = _context42.sent;
|
|
2442
|
+
return _context42.abrupt("return", statuses.find(function (status) {
|
|
2443
|
+
return status.op === "nft-open" && Utils.EqualAddress(contractAddress, status.address) && status.tokenId === tokenId;
|
|
2444
|
+
}) || {
|
|
2445
|
+
status: "none"
|
|
2446
|
+
});
|
|
2447
|
+
case 11:
|
|
2448
|
+
_context42.prev = 11;
|
|
2449
|
+
_context42.t0 = _context42["catch"](1);
|
|
2450
|
+
this.Log(_context42.t0, true);
|
|
2451
|
+
return _context42.abrupt("return", {
|
|
2452
|
+
status: "unknown"
|
|
2453
|
+
});
|
|
2454
|
+
case 15:
|
|
2455
|
+
case "end":
|
|
2456
|
+
return _context42.stop();
|
|
2457
|
+
}
|
|
2458
|
+
}, _callee42, this, [[1, 11]]);
|
|
2459
|
+
}));
|
|
2460
|
+
return function (_x28) {
|
|
2461
|
+
return _ref84.apply(this, arguments);
|
|
2462
|
+
};
|
|
2463
|
+
}();
|
|
2464
|
+
|
|
2465
|
+
/**
|
|
2466
|
+
* Return status of the specified collection redemption
|
|
2467
|
+
*
|
|
2468
|
+
* @methodGroup Status
|
|
2469
|
+
* @namedParams
|
|
2470
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
2471
|
+
* @param {string} confirmationId - The confirmation ID of the redemption
|
|
2472
|
+
*
|
|
2473
|
+
* @returns {Promise<Object>} - The status of the collection redemption
|
|
2474
|
+
*/
|
|
2475
|
+
exports.CollectionRedemptionStatus = /*#__PURE__*/function () {
|
|
2476
|
+
var _ref86 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(_ref85) {
|
|
2477
|
+
var marketplaceParams, confirmationId, statuses;
|
|
2478
|
+
return _regeneratorRuntime.wrap(function _callee43$(_context43) {
|
|
2479
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
2480
|
+
case 0:
|
|
2481
|
+
marketplaceParams = _ref85.marketplaceParams, confirmationId = _ref85.confirmationId;
|
|
2482
|
+
_context43.prev = 1;
|
|
2483
|
+
_context43.next = 4;
|
|
2484
|
+
return this.MintingStatus({
|
|
2485
|
+
marketplaceParams: marketplaceParams
|
|
2486
|
+
});
|
|
2487
|
+
case 4:
|
|
2488
|
+
statuses = _context43.sent;
|
|
2489
|
+
return _context43.abrupt("return", statuses.find(function (status) {
|
|
2490
|
+
return status.op === "nft-redeem" && status.confirmationId === confirmationId;
|
|
2491
|
+
}) || {
|
|
2492
|
+
status: "none"
|
|
2493
|
+
});
|
|
2494
|
+
case 8:
|
|
2495
|
+
_context43.prev = 8;
|
|
2496
|
+
_context43.t0 = _context43["catch"](1);
|
|
2497
|
+
this.Log(_context43.t0, true);
|
|
2498
|
+
return _context43.abrupt("return", {
|
|
2499
|
+
status: "unknown"
|
|
2500
|
+
});
|
|
2501
|
+
case 12:
|
|
2502
|
+
case "end":
|
|
2503
|
+
return _context43.stop();
|
|
2504
|
+
}
|
|
2505
|
+
}, _callee43, this, [[1, 8]]);
|
|
2506
|
+
}));
|
|
2507
|
+
return function (_x29) {
|
|
2508
|
+
return _ref86.apply(this, arguments);
|
|
2509
|
+
};
|
|
2510
|
+
}();
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Return status of the specified redeemable offer
|
|
2514
|
+
*
|
|
2515
|
+
* @methodGroup Status
|
|
2516
|
+
* @namedParams
|
|
2517
|
+
* @param {string=} tenantId - ID of the tenant for this NFT (not required if `marketplaceParams` is specified)
|
|
2518
|
+
* @param {Object=} marketplaceParams - Parameters of the marketplace for this NFT (not required if `tenantId` is specified)
|
|
2519
|
+
* @param {string} contractAddress - The address of the NFT contract
|
|
2520
|
+
* @param {string} tokenId - The token ID of the NFT
|
|
2521
|
+
* @param {string} offerId - The ID of the offer
|
|
2522
|
+
*
|
|
2523
|
+
* @returns {Promise<Object>} - The status of the offer redemption
|
|
2524
|
+
*/
|
|
2525
|
+
exports.RedeemableOfferStatus = /*#__PURE__*/function () {
|
|
2526
|
+
var _ref88 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(_ref87) {
|
|
2527
|
+
var tenantId, marketplaceParams, contractAddress, tokenId, offerId, statuses;
|
|
2528
|
+
return _regeneratorRuntime.wrap(function _callee44$(_context44) {
|
|
2529
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
2530
|
+
case 0:
|
|
2531
|
+
tenantId = _ref87.tenantId, marketplaceParams = _ref87.marketplaceParams, contractAddress = _ref87.contractAddress, tokenId = _ref87.tokenId, offerId = _ref87.offerId;
|
|
2532
|
+
_context44.prev = 1;
|
|
2533
|
+
_context44.next = 4;
|
|
2534
|
+
return this.MintingStatus({
|
|
2535
|
+
marketplaceParams: marketplaceParams,
|
|
2536
|
+
tenantId: tenantId
|
|
2537
|
+
});
|
|
2538
|
+
case 4:
|
|
2539
|
+
statuses = _context44.sent;
|
|
2540
|
+
contractAddress = Utils.FormatAddress(contractAddress);
|
|
2541
|
+
return _context44.abrupt("return", statuses.find(function (status) {
|
|
2542
|
+
return status.op === "nft-offer-redeem" && Utils.EqualAddress(status.address, contractAddress) && status.tokenId === (tokenId || "").toString() && status.offerId === (offerId || "").toString();
|
|
2543
|
+
}) || {
|
|
2544
|
+
status: "none"
|
|
2545
|
+
});
|
|
2546
|
+
case 9:
|
|
2547
|
+
_context44.prev = 9;
|
|
2548
|
+
_context44.t0 = _context44["catch"](1);
|
|
2549
|
+
this.Log(_context44.t0, true);
|
|
2550
|
+
return _context44.abrupt("return", {
|
|
2551
|
+
status: "unknown"
|
|
2552
|
+
});
|
|
2553
|
+
case 13:
|
|
2554
|
+
case "end":
|
|
2555
|
+
return _context44.stop();
|
|
2556
|
+
}
|
|
2557
|
+
}, _callee44, this, [[1, 9]]);
|
|
2558
|
+
}));
|
|
2559
|
+
return function (_x30) {
|
|
2560
|
+
return _ref88.apply(this, arguments);
|
|
2561
|
+
};
|
|
2562
|
+
}();
|
|
2563
|
+
exports.RedeemableCustomFulfillmentInfo = /*#__PURE__*/function () {
|
|
2564
|
+
var _ref90 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(_ref89) {
|
|
2565
|
+
var redeemableTransactionId;
|
|
2566
|
+
return _regeneratorRuntime.wrap(function _callee45$(_context45) {
|
|
2567
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
2568
|
+
case 0:
|
|
2569
|
+
redeemableTransactionId = _ref89.redeemableTransactionId;
|
|
2570
|
+
_context45.next = 3;
|
|
2571
|
+
return Utils.ResponseToJson(this.stateStoreClient.Request({
|
|
2572
|
+
method: "GET",
|
|
2573
|
+
path: UrlJoin("code-fulfillment", this.network === "main" ? "main" : "demov3", "fulfill", redeemableTransactionId),
|
|
2574
|
+
headers: {
|
|
2575
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
2576
|
+
}
|
|
2577
|
+
}));
|
|
2578
|
+
case 3:
|
|
2579
|
+
return _context45.abrupt("return", _context45.sent);
|
|
2580
|
+
case 4:
|
|
2581
|
+
case "end":
|
|
2582
|
+
return _context45.stop();
|
|
2583
|
+
}
|
|
2584
|
+
}, _callee45, this);
|
|
2585
|
+
}));
|
|
2586
|
+
return function (_x31) {
|
|
2587
|
+
return _ref90.apply(this, arguments);
|
|
2588
|
+
};
|
|
2589
|
+
}();
|
|
2590
|
+
|
|
2591
|
+
/* EVENTS */
|
|
2592
|
+
|
|
2593
|
+
exports.LoadDrop = /*#__PURE__*/function () {
|
|
2594
|
+
var _ref92 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(_ref91) {
|
|
2595
|
+
var _this = this;
|
|
2596
|
+
var tenantSlug, eventSlug, dropId, event, eventId;
|
|
2597
|
+
return _regeneratorRuntime.wrap(function _callee46$(_context46) {
|
|
2598
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
2599
|
+
case 0:
|
|
2600
|
+
tenantSlug = _ref91.tenantSlug, eventSlug = _ref91.eventSlug, dropId = _ref91.dropId;
|
|
2601
|
+
if (!this.drops) {
|
|
2602
|
+
this.drops = {};
|
|
2603
|
+
}
|
|
2604
|
+
if (!this.drops[tenantSlug]) {
|
|
2605
|
+
this.drops[tenantSlug] = {};
|
|
2606
|
+
}
|
|
2607
|
+
if (!this.drops[tenantSlug][eventSlug]) {
|
|
2608
|
+
this.drops[tenantSlug][eventSlug] = {};
|
|
2609
|
+
}
|
|
2610
|
+
if (this.drops[tenantSlug][eventSlug][dropId]) {
|
|
2611
|
+
_context46.next = 13;
|
|
2612
|
+
break;
|
|
2613
|
+
}
|
|
2614
|
+
_context46.next = 7;
|
|
2615
|
+
return this.client.ContentObjectMetadata({
|
|
2616
|
+
libraryId: this.mainSiteLibraryId,
|
|
2617
|
+
objectId: this.mainSiteId,
|
|
2618
|
+
metadataSubtree: UrlJoin("public", "asset_metadata", "tenants", tenantSlug, "sites", eventSlug, "info"),
|
|
2619
|
+
resolveLinks: true,
|
|
2620
|
+
linkDepthLimit: 2,
|
|
2621
|
+
resolveIncludeSource: true,
|
|
2622
|
+
produceLinkUrls: true,
|
|
2623
|
+
select: [".", "drops"],
|
|
2624
|
+
noAuth: true
|
|
2625
|
+
});
|
|
2626
|
+
case 7:
|
|
2627
|
+
_context46.t0 = _context46.sent;
|
|
2628
|
+
if (_context46.t0) {
|
|
2629
|
+
_context46.next = 10;
|
|
2630
|
+
break;
|
|
2631
|
+
}
|
|
2632
|
+
_context46.t0 = [];
|
|
2633
|
+
case 10:
|
|
2634
|
+
event = _context46.t0;
|
|
2635
|
+
eventId = Utils.DecodeVersionHash(event["."].source).objectId;
|
|
2636
|
+
event.drops.forEach(function (drop) {
|
|
2637
|
+
drop = _objectSpread(_objectSpread({}, drop), {}, {
|
|
2638
|
+
eventId: eventId
|
|
2639
|
+
});
|
|
2640
|
+
_this.drops[tenantSlug][eventSlug][drop.uuid] = drop;
|
|
2641
|
+
_this.drops[drop.uuid] = drop;
|
|
2642
|
+
});
|
|
2643
|
+
case 13:
|
|
2644
|
+
return _context46.abrupt("return", this.drops[dropId]);
|
|
2645
|
+
case 14:
|
|
2646
|
+
case "end":
|
|
2647
|
+
return _context46.stop();
|
|
2648
|
+
}
|
|
2649
|
+
}, _callee46, this);
|
|
2650
|
+
}));
|
|
2651
|
+
return function (_x32) {
|
|
2652
|
+
return _ref92.apply(this, arguments);
|
|
2653
|
+
};
|
|
2654
|
+
}();
|
|
2655
|
+
exports.SubmitDropVote = /*#__PURE__*/function () {
|
|
2656
|
+
var _ref94 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(_ref93) {
|
|
2657
|
+
var marketplaceParams, eventId, dropId, sku, marketplaceInfo;
|
|
2658
|
+
return _regeneratorRuntime.wrap(function _callee47$(_context47) {
|
|
2659
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
2660
|
+
case 0:
|
|
2661
|
+
marketplaceParams = _ref93.marketplaceParams, eventId = _ref93.eventId, dropId = _ref93.dropId, sku = _ref93.sku;
|
|
2662
|
+
_context47.next = 3;
|
|
2663
|
+
return this.MarketplaceInfo({
|
|
2664
|
+
marketplaceParams: marketplaceParams
|
|
2665
|
+
});
|
|
2666
|
+
case 3:
|
|
2667
|
+
marketplaceInfo = _context47.sent;
|
|
2668
|
+
_context47.next = 6;
|
|
2669
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
2670
|
+
path: UrlJoin("as", "wlt", "act", marketplaceInfo.tenant_id),
|
|
2671
|
+
method: "POST",
|
|
2672
|
+
body: {
|
|
2673
|
+
op: "vote-drop",
|
|
2674
|
+
evt: eventId,
|
|
2675
|
+
id: dropId,
|
|
2676
|
+
itm: sku
|
|
2677
|
+
},
|
|
2678
|
+
headers: {
|
|
2679
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
case 6:
|
|
2683
|
+
case "end":
|
|
2684
|
+
return _context47.stop();
|
|
2685
|
+
}
|
|
2686
|
+
}, _callee47, this);
|
|
2687
|
+
}));
|
|
2688
|
+
return function (_x33) {
|
|
2689
|
+
return _ref94.apply(this, arguments);
|
|
2690
|
+
};
|
|
2691
|
+
}();
|
|
2692
|
+
exports.DropStatus = /*#__PURE__*/function () {
|
|
2693
|
+
var _ref96 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(_ref95) {
|
|
2694
|
+
var marketplace, eventId, dropId, response;
|
|
2695
|
+
return _regeneratorRuntime.wrap(function _callee48$(_context48) {
|
|
2696
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
2697
|
+
case 0:
|
|
2698
|
+
marketplace = _ref95.marketplace, eventId = _ref95.eventId, dropId = _ref95.dropId;
|
|
2699
|
+
_context48.prev = 1;
|
|
2700
|
+
_context48.next = 4;
|
|
2701
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
2702
|
+
path: UrlJoin("as", "wlt", "act", marketplace.tenant_id, eventId, dropId),
|
|
2703
|
+
method: "GET",
|
|
2704
|
+
headers: {
|
|
2705
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
2706
|
+
}
|
|
2707
|
+
}));
|
|
2708
|
+
case 4:
|
|
2709
|
+
response = _context48.sent;
|
|
2710
|
+
return _context48.abrupt("return", response.sort(function (a, b) {
|
|
2711
|
+
return a.ts > b.ts ? 1 : -1;
|
|
2712
|
+
})[0] || {
|
|
2713
|
+
status: "none"
|
|
2714
|
+
});
|
|
2715
|
+
case 8:
|
|
2716
|
+
_context48.prev = 8;
|
|
2717
|
+
_context48.t0 = _context48["catch"](1);
|
|
2718
|
+
this.Log(_context48.t0, true);
|
|
2719
|
+
return _context48.abrupt("return", "");
|
|
2720
|
+
case 12:
|
|
2721
|
+
case "end":
|
|
2722
|
+
return _context48.stop();
|
|
2723
|
+
}
|
|
2724
|
+
}, _callee48, this, [[1, 8]]);
|
|
2725
|
+
}));
|
|
2726
|
+
return function (_x34) {
|
|
2727
|
+
return _ref96.apply(this, arguments);
|
|
2728
|
+
};
|
|
2729
|
+
}();
|
|
2730
|
+
|
|
2731
|
+
/* OFFERS */
|
|
2732
|
+
|
|
2733
|
+
/**
|
|
2734
|
+
* Retrieve offers for the specified parameters
|
|
2735
|
+
*
|
|
2736
|
+
* @methodGroup Offers
|
|
2737
|
+
* @namedParams
|
|
2738
|
+
* @param {string=} contractAddress - The address of an NFT contract
|
|
2739
|
+
* @param {string=} tokenId - The token ID of an NFT
|
|
2740
|
+
* @param {string=} buyerAddress - The address of the offerrer
|
|
2741
|
+
* @param {string=} sellerAddress - The address of the offerree
|
|
2742
|
+
* @param {Array<String>=} statuses - Status to filter results by. Allowed values: "ACTIVE", "ACCEPTED", "CANCELLED", "DECLINED", "INVALID"
|
|
2743
|
+
* @param {number} start=0 - The index to start from
|
|
2744
|
+
* @param {number=} limit=10 - The maximum number of results to return
|
|
2745
|
+
*
|
|
2746
|
+
* @returns {Promise<Array<Object>>} - Offers matching the specified filters
|
|
2747
|
+
*/
|
|
2748
|
+
exports.MarketplaceOffers = /*#__PURE__*/function () {
|
|
2749
|
+
var _ref98 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(_ref97) {
|
|
2750
|
+
var contractAddress, tokenId, buyerAddress, sellerAddress, statuses, _ref97$start, start, _ref97$limit, limit, path, queryParams, offers;
|
|
2751
|
+
return _regeneratorRuntime.wrap(function _callee49$(_context49) {
|
|
2752
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
2753
|
+
case 0:
|
|
2754
|
+
contractAddress = _ref97.contractAddress, tokenId = _ref97.tokenId, buyerAddress = _ref97.buyerAddress, sellerAddress = _ref97.sellerAddress, statuses = _ref97.statuses, _ref97$start = _ref97.start, start = _ref97$start === void 0 ? 0 : _ref97$start, _ref97$limit = _ref97.limit, limit = _ref97$limit === void 0 ? 10 : _ref97$limit;
|
|
2755
|
+
path = UrlJoin("as", "mkt", "offers", "ls");
|
|
2756
|
+
if (buyerAddress) {
|
|
2757
|
+
path = UrlJoin(path, "b", Utils.FormatAddress(buyerAddress));
|
|
2758
|
+
} else if (sellerAddress) {
|
|
2759
|
+
path = UrlJoin(path, "s", Utils.FormatAddress(sellerAddress));
|
|
2760
|
+
}
|
|
2761
|
+
if (contractAddress) {
|
|
2762
|
+
path = UrlJoin(path, "c", Utils.FormatAddress(contractAddress));
|
|
2763
|
+
if (tokenId) {
|
|
2764
|
+
path = UrlJoin(path, "t", tokenId);
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
queryParams = {
|
|
2768
|
+
start: start,
|
|
2769
|
+
limit: limit
|
|
2770
|
+
};
|
|
2771
|
+
if (statuses && statuses.length > 0) {
|
|
2772
|
+
queryParams.include = statuses.join(",");
|
|
2773
|
+
}
|
|
2774
|
+
_context49.next = 8;
|
|
2775
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
2776
|
+
path: path,
|
|
2777
|
+
method: "GET",
|
|
2778
|
+
queryParams: queryParams
|
|
2779
|
+
}));
|
|
2780
|
+
case 8:
|
|
2781
|
+
offers = _context49.sent;
|
|
2782
|
+
return _context49.abrupt("return", offers.map(function (offer) {
|
|
2783
|
+
return _objectSpread(_objectSpread({}, offer), {}, {
|
|
2784
|
+
created: offer.created * 1000,
|
|
2785
|
+
updated: offer.updated * 1000,
|
|
2786
|
+
expiration: offer.expiration * 1000
|
|
2787
|
+
});
|
|
2788
|
+
}));
|
|
2789
|
+
case 10:
|
|
2790
|
+
case "end":
|
|
2791
|
+
return _context49.stop();
|
|
2792
|
+
}
|
|
2793
|
+
}, _callee49, this);
|
|
2794
|
+
}));
|
|
2795
|
+
return function (_x35) {
|
|
2796
|
+
return _ref98.apply(this, arguments);
|
|
2797
|
+
};
|
|
2798
|
+
}();
|
|
2799
|
+
|
|
2800
|
+
/**
|
|
2801
|
+
* <b><i>Requires login</i></b>
|
|
2802
|
+
*
|
|
2803
|
+
* Create or update an offer on the specified NFT
|
|
2804
|
+
*
|
|
2805
|
+
* @methodGroup Offers
|
|
2806
|
+
* @namedParams
|
|
2807
|
+
* @param {string} contractAddress - The contract address of the NFT
|
|
2808
|
+
* @param {string} tokenId - The token ID of the NFT
|
|
2809
|
+
* @param {string=} offerId - IF modifying an existing offer, the ID of the offer
|
|
2810
|
+
* @param {number} price - The amount to offer
|
|
2811
|
+
* @param {number=} expiresAt - The time (in epoch ms) the offer will expire
|
|
2812
|
+
*
|
|
2813
|
+
* @returns {Promise<Object>} - Info about the created/updated offer
|
|
2814
|
+
*/
|
|
2815
|
+
exports.CreateMarketplaceOffer = /*#__PURE__*/function () {
|
|
2816
|
+
var _ref100 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(_ref99) {
|
|
2817
|
+
var contractAddress, tokenId, offerId, price, expiresAt, response;
|
|
2818
|
+
return _regeneratorRuntime.wrap(function _callee50$(_context50) {
|
|
2819
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
2820
|
+
case 0:
|
|
2821
|
+
contractAddress = _ref99.contractAddress, tokenId = _ref99.tokenId, offerId = _ref99.offerId, price = _ref99.price, expiresAt = _ref99.expiresAt;
|
|
2822
|
+
if (!offerId) {
|
|
2823
|
+
_context50.next = 7;
|
|
2824
|
+
break;
|
|
2825
|
+
}
|
|
2826
|
+
_context50.next = 4;
|
|
2827
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
2828
|
+
path: UrlJoin("as", "wlt", "mkt", "offers", offerId),
|
|
2829
|
+
method: "PUT",
|
|
2830
|
+
body: {
|
|
2831
|
+
price: price,
|
|
2832
|
+
expiration: Math.floor(expiresAt / 1000)
|
|
2833
|
+
},
|
|
2834
|
+
headers: {
|
|
2835
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
2836
|
+
}
|
|
2837
|
+
}));
|
|
2838
|
+
case 4:
|
|
2839
|
+
response = _context50.sent;
|
|
2840
|
+
_context50.next = 10;
|
|
2841
|
+
break;
|
|
2842
|
+
case 7:
|
|
2843
|
+
_context50.next = 9;
|
|
2844
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
2845
|
+
path: UrlJoin("as", "wlt", "mkt", "offers", contractAddress, tokenId),
|
|
2846
|
+
method: "POST",
|
|
2847
|
+
body: {
|
|
2848
|
+
contract: contractAddress,
|
|
2849
|
+
token: tokenId,
|
|
2850
|
+
price: price,
|
|
2851
|
+
expiration: Math.floor(expiresAt / 1000)
|
|
2852
|
+
},
|
|
2853
|
+
headers: {
|
|
2854
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
2855
|
+
}
|
|
2856
|
+
}));
|
|
2857
|
+
case 9:
|
|
2858
|
+
response = _context50.sent;
|
|
2859
|
+
case 10:
|
|
2860
|
+
return _context50.abrupt("return", response.offer_id);
|
|
2861
|
+
case 11:
|
|
2862
|
+
case "end":
|
|
2863
|
+
return _context50.stop();
|
|
2864
|
+
}
|
|
2865
|
+
}, _callee50, this);
|
|
2866
|
+
}));
|
|
2867
|
+
return function (_x36) {
|
|
2868
|
+
return _ref100.apply(this, arguments);
|
|
2869
|
+
};
|
|
2870
|
+
}();
|
|
2871
|
+
|
|
2872
|
+
/**
|
|
2873
|
+
* <b><i>Requires login</i></b>
|
|
2874
|
+
*
|
|
2875
|
+
* Cancel the specified offer
|
|
2876
|
+
*
|
|
2877
|
+
* @methodGroup Offers
|
|
2878
|
+
* @namedParams
|
|
2879
|
+
* @param {string} offerId - The ID of the offer
|
|
2880
|
+
*/
|
|
2881
|
+
exports.RemoveMarketplaceOffer = /*#__PURE__*/function () {
|
|
2882
|
+
var _ref102 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(_ref101) {
|
|
2883
|
+
var offerId;
|
|
2884
|
+
return _regeneratorRuntime.wrap(function _callee51$(_context51) {
|
|
2885
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
2886
|
+
case 0:
|
|
2887
|
+
offerId = _ref101.offerId;
|
|
2888
|
+
_context51.next = 3;
|
|
2889
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
2890
|
+
path: UrlJoin("as", "wlt", "mkt", "offers", offerId),
|
|
2891
|
+
method: "DELETE",
|
|
2892
|
+
headers: {
|
|
2893
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
2894
|
+
}
|
|
2895
|
+
});
|
|
2896
|
+
case 3:
|
|
2897
|
+
return _context51.abrupt("return", _context51.sent);
|
|
2898
|
+
case 4:
|
|
2899
|
+
case "end":
|
|
2900
|
+
return _context51.stop();
|
|
2901
|
+
}
|
|
2902
|
+
}, _callee51, this);
|
|
2903
|
+
}));
|
|
2904
|
+
return function (_x37) {
|
|
2905
|
+
return _ref102.apply(this, arguments);
|
|
2906
|
+
};
|
|
2907
|
+
}();
|
|
2908
|
+
|
|
2909
|
+
/**
|
|
2910
|
+
* <b><i>Requires login</i></b>
|
|
2911
|
+
*
|
|
2912
|
+
* Accept the specified offer
|
|
2913
|
+
*
|
|
2914
|
+
* @methodGroup Offers
|
|
2915
|
+
* @namedParams
|
|
2916
|
+
* @param {string} offerId - The ID of the offer
|
|
2917
|
+
*/
|
|
2918
|
+
exports.AcceptMarketplaceOffer = /*#__PURE__*/function () {
|
|
2919
|
+
var _ref104 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(_ref103) {
|
|
2920
|
+
var offerId;
|
|
2921
|
+
return _regeneratorRuntime.wrap(function _callee52$(_context52) {
|
|
2922
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
2923
|
+
case 0:
|
|
2924
|
+
offerId = _ref103.offerId;
|
|
2925
|
+
_context52.next = 3;
|
|
2926
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
2927
|
+
path: UrlJoin("as", "wlt", "mkt", "offers", "accept", offerId),
|
|
2928
|
+
method: "PUT",
|
|
2929
|
+
headers: {
|
|
2930
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
case 3:
|
|
2934
|
+
return _context52.abrupt("return", _context52.sent);
|
|
2935
|
+
case 4:
|
|
2936
|
+
case "end":
|
|
2937
|
+
return _context52.stop();
|
|
2938
|
+
}
|
|
2939
|
+
}, _callee52, this);
|
|
2940
|
+
}));
|
|
2941
|
+
return function (_x38) {
|
|
2942
|
+
return _ref104.apply(this, arguments);
|
|
2943
|
+
};
|
|
2944
|
+
}();
|
|
2945
|
+
|
|
2946
|
+
/**
|
|
2947
|
+
* <b><i>Requires login</i></b>
|
|
2948
|
+
*
|
|
2949
|
+
* Reject the specified offer
|
|
2950
|
+
*
|
|
2951
|
+
* @methodGroup Offers
|
|
2952
|
+
* @namedParams
|
|
2953
|
+
* @param {string} offerId - The ID of the offer
|
|
2954
|
+
*/
|
|
2955
|
+
exports.RejectMarketplaceOffer = /*#__PURE__*/function () {
|
|
2956
|
+
var _ref106 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(_ref105) {
|
|
2957
|
+
var offerId;
|
|
2958
|
+
return _regeneratorRuntime.wrap(function _callee53$(_context53) {
|
|
2959
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
2960
|
+
case 0:
|
|
2961
|
+
offerId = _ref105.offerId;
|
|
2962
|
+
_context53.next = 3;
|
|
2963
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
2964
|
+
path: UrlJoin("as", "wlt", "mkt", "offers", "decline", offerId),
|
|
2965
|
+
method: "PUT",
|
|
2966
|
+
headers: {
|
|
2967
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
2968
|
+
}
|
|
2969
|
+
});
|
|
2970
|
+
case 3:
|
|
2971
|
+
return _context53.abrupt("return", _context53.sent);
|
|
2972
|
+
case 4:
|
|
2973
|
+
case "end":
|
|
2974
|
+
return _context53.stop();
|
|
2975
|
+
}
|
|
2976
|
+
}, _callee53, this);
|
|
2977
|
+
}));
|
|
2978
|
+
return function (_x39) {
|
|
2979
|
+
return _ref106.apply(this, arguments);
|
|
2980
|
+
};
|
|
2981
|
+
}();
|
|
2982
|
+
|
|
2983
|
+
/* Voting */
|
|
2984
|
+
|
|
2985
|
+
/**
|
|
2986
|
+
* Retrieve the current status of the specified voting event
|
|
2987
|
+
*
|
|
2988
|
+
* @methodGroup Voting
|
|
2989
|
+
* @namedParams
|
|
2990
|
+
* @param {string} tenantId - The tenant ID of the marketplace in which the voting event is specified
|
|
2991
|
+
* @param {string} votingEventId - The ID of the voting event
|
|
2992
|
+
*
|
|
2993
|
+
* @returns {Promise<Object>} - Info about the voting event, including the current user's votes and the current total voting tally
|
|
2994
|
+
*/
|
|
2995
|
+
exports.VoteStatus = /*#__PURE__*/function () {
|
|
2996
|
+
var _ref108 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(_ref107) {
|
|
2997
|
+
var tenantId, votingEventId;
|
|
2998
|
+
return _regeneratorRuntime.wrap(function _callee54$(_context54) {
|
|
2999
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
3000
|
+
case 0:
|
|
3001
|
+
tenantId = _ref107.tenantId, votingEventId = _ref107.votingEventId;
|
|
3002
|
+
_context54.next = 3;
|
|
3003
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
3004
|
+
path: UrlJoin("as", "votes", tenantId, votingEventId),
|
|
3005
|
+
headers: {
|
|
3006
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
3007
|
+
}
|
|
3008
|
+
}));
|
|
3009
|
+
case 3:
|
|
3010
|
+
return _context54.abrupt("return", _context54.sent);
|
|
3011
|
+
case 4:
|
|
3012
|
+
case "end":
|
|
3013
|
+
return _context54.stop();
|
|
3014
|
+
}
|
|
3015
|
+
}, _callee54, this);
|
|
3016
|
+
}));
|
|
3017
|
+
return function (_x40) {
|
|
3018
|
+
return _ref108.apply(this, arguments);
|
|
3019
|
+
};
|
|
3020
|
+
}();
|
|
3021
|
+
|
|
3022
|
+
/**
|
|
3023
|
+
* <b><i>Requires login</i></b>
|
|
3024
|
+
*
|
|
3025
|
+
* Cast a vote for the specified item in the specified voting event
|
|
3026
|
+
*
|
|
3027
|
+
* @methodGroup Voting
|
|
3028
|
+
* @namedParams
|
|
3029
|
+
* @param {string} tenantId - The tenant ID of the marketplace in which the voting event is specified
|
|
3030
|
+
* @param {string} votingEventId - The ID of the voting event
|
|
3031
|
+
* @param {string} sku - The SKU of the item to vote for
|
|
3032
|
+
*
|
|
3033
|
+
* @returns {Promise<Object>} - Info about the voting event, including the current user's votes and the current total voting tally
|
|
3034
|
+
*/
|
|
3035
|
+
exports.CastVote = /*#__PURE__*/function () {
|
|
3036
|
+
var _ref110 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(_ref109) {
|
|
3037
|
+
var tenantId, votingEventId, sku;
|
|
3038
|
+
return _regeneratorRuntime.wrap(function _callee55$(_context55) {
|
|
3039
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
3040
|
+
case 0:
|
|
3041
|
+
tenantId = _ref109.tenantId, votingEventId = _ref109.votingEventId, sku = _ref109.sku;
|
|
3042
|
+
_context55.next = 3;
|
|
3043
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
3044
|
+
path: UrlJoin("as", "votes", tenantId, votingEventId, sku),
|
|
3045
|
+
method: "POST",
|
|
3046
|
+
headers: {
|
|
3047
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
3048
|
+
}
|
|
3049
|
+
}));
|
|
3050
|
+
case 3:
|
|
3051
|
+
return _context55.abrupt("return", _context55.sent);
|
|
3052
|
+
case 4:
|
|
3053
|
+
case "end":
|
|
3054
|
+
return _context55.stop();
|
|
3055
|
+
}
|
|
3056
|
+
}, _callee55, this);
|
|
3057
|
+
}));
|
|
3058
|
+
return function (_x41) {
|
|
3059
|
+
return _ref110.apply(this, arguments);
|
|
3060
|
+
};
|
|
3061
|
+
}();
|
|
3062
|
+
|
|
3063
|
+
/**
|
|
3064
|
+
* <b><i>Requires login</i></b>
|
|
3065
|
+
*
|
|
3066
|
+
* Revoke a previously cast vote for the specified item in the specified voting event
|
|
3067
|
+
*
|
|
3068
|
+
* @methodGroup Voting
|
|
3069
|
+
* @namedParams
|
|
3070
|
+
* @param {string} tenantId - The tenant ID of the marketplace in which the voting event is specified
|
|
3071
|
+
* @param {string} votingEventId - The ID of the voting event
|
|
3072
|
+
* @param {string} sku - The SKU of the item to vote for
|
|
3073
|
+
*
|
|
3074
|
+
* @returns {Promise<Object>} - Info about the voting event, including the current user's votes and the current total voting tally
|
|
3075
|
+
*/
|
|
3076
|
+
exports.RevokeVote = /*#__PURE__*/function () {
|
|
3077
|
+
var _ref112 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(_ref111) {
|
|
3078
|
+
var tenantId, votingEventId, sku;
|
|
3079
|
+
return _regeneratorRuntime.wrap(function _callee56$(_context56) {
|
|
3080
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
3081
|
+
case 0:
|
|
3082
|
+
tenantId = _ref111.tenantId, votingEventId = _ref111.votingEventId, sku = _ref111.sku;
|
|
3083
|
+
_context56.next = 3;
|
|
3084
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
3085
|
+
path: UrlJoin("as", "votes", tenantId, votingEventId, sku),
|
|
3086
|
+
method: "DELETE",
|
|
3087
|
+
headers: {
|
|
3088
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
3089
|
+
}
|
|
3090
|
+
}));
|
|
3091
|
+
case 3:
|
|
3092
|
+
return _context56.abrupt("return", _context56.sent);
|
|
3093
|
+
case 4:
|
|
3094
|
+
case "end":
|
|
3095
|
+
return _context56.stop();
|
|
3096
|
+
}
|
|
3097
|
+
}, _callee56, this);
|
|
3098
|
+
}));
|
|
3099
|
+
return function (_x42) {
|
|
3100
|
+
return _ref112.apply(this, arguments);
|
|
3101
|
+
};
|
|
3102
|
+
}();
|