@eluvio/elv-client-js 3.1.92 → 3.1.95

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.
Files changed (35) hide show
  1. package/dist/ElvClient-min.js +15 -11
  2. package/dist/ElvClient-node-min.js +17 -13
  3. package/dist/ElvFrameClient-min.js +13 -9
  4. package/dist/ElvPermissionsClient-min.js +13 -9
  5. package/dist/src/AuthorizationClient.js +2248 -1990
  6. package/dist/src/ContentObjectVerification.js +164 -173
  7. package/dist/src/Crypto.js +376 -324
  8. package/dist/src/ElvClient.js +1214 -938
  9. package/dist/src/ElvWallet.js +119 -95
  10. package/dist/src/EthClient.js +1040 -896
  11. package/dist/src/FrameClient.js +331 -300
  12. package/dist/src/HttpClient.js +153 -147
  13. package/dist/src/Id.js +1 -3
  14. package/dist/src/PermissionsClient.js +1294 -1168
  15. package/dist/src/RemoteSigner.js +260 -200
  16. package/dist/src/UserProfileClient.js +1168 -1014
  17. package/dist/src/Utils.js +382 -178
  18. package/dist/src/client/ABRPublishing.js +895 -856
  19. package/dist/src/client/AccessGroups.js +1102 -959
  20. package/dist/src/client/ContentAccess.js +3737 -3427
  21. package/dist/src/client/ContentManagement.js +2255 -2063
  22. package/dist/src/client/Contracts.js +647 -563
  23. package/dist/src/client/Files.js +1886 -1757
  24. package/dist/src/client/NFT.js +127 -158
  25. package/dist/src/client/NTP.js +478 -422
  26. package/package.json +2 -1
  27. package/src/ElvClient.js +62 -1
  28. package/src/RemoteSigner.js +22 -18
  29. package/src/Utils.js +119 -0
  30. package/src/client/ABRPublishing.js +2 -1
  31. package/src/client/NFT.js +14 -49
  32. package/testScripts/Test.js +0 -19
  33. package/testScripts/VariantABRProfile.js +45 -0
  34. package/utilities/SimpleIngest.js +245 -0
  35. package/package-lock.json +0 -12650
@@ -2,9 +2,11 @@ var _regeneratorRuntime = require("@babel/runtime/regenerator");
2
2
 
3
3
  var _defineProperty = require("@babel/runtime/helpers/defineProperty");
4
4
 
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
5
+ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
6
6
 
7
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
+ 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; }
8
+
9
+ 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; }
8
10
 
9
11
  /**
10
12
  * Methods for creating and managing NFTs
@@ -25,9 +27,8 @@ var _require = require("../Validation"),
25
27
  * @methodGroup Minting
26
28
  * @namedParams
27
29
  * @param {string} tenantId - The ID of the tenant
28
- * @param {string=} email - The email of the NFT recipient
29
30
  * @param {string=} address - The address of the NFT recipient
30
- * @param {string} collectionId - The ID of the NFT collection containing the NFT
31
+ * @param {string} marketplaceId - The ID of the marketplace containing the NFT
31
32
  * @param {Array<Object>} items - List of items
32
33
  * @param {string} items.sku - SKU of the NFT
33
34
  * @param {number=} items.quantity=1 - Number to mint
@@ -39,112 +40,74 @@ var _require = require("../Validation"),
39
40
  */
40
41
 
41
42
 
42
- exports.MintNFT = function _callee(_ref) {
43
- var tenantId, email, address, collectionId, items, _ref$extraData, extraData, accountInitializationBody, accountInitializationSignature, _ref2, addr, requestBody, transactionId, mintSignature;
44
-
45
- return _regeneratorRuntime.async(function _callee$(_context) {
46
- while (1) {
47
- switch (_context.prev = _context.next) {
48
- case 0:
49
- tenantId = _ref.tenantId, email = _ref.email, address = _ref.address, collectionId = _ref.collectionId, items = _ref.items, _ref$extraData = _ref.extraData, extraData = _ref$extraData === void 0 ? {} : _ref$extraData;
50
- ValidatePresence("tenantId", tenantId);
51
- ValidatePresence("email or address", email || address);
52
- ValidatePresence("collectionId", collectionId);
53
- ValidatePresence("items", items);
54
- ValidateObject(collectionId); // If address not specified, make call to initialize address for email
55
-
56
- accountInitializationBody = {
57
- ts: Date.now()
58
- };
59
-
60
- if (email) {
61
- accountInitializationBody.email = email;
62
- } else {
63
- accountInitializationBody.addr = address;
64
- }
65
-
66
- _context.next = 10;
67
- return _regeneratorRuntime.awrap(this.Sign(JSON.stringify(accountInitializationBody)));
68
-
69
- case 10:
70
- accountInitializationSignature = _context.sent;
71
- _context.t0 = _regeneratorRuntime;
72
- _context.t1 = this.utils;
73
- _context.next = 15;
74
- return _regeneratorRuntime.awrap(this.authClient.MakeAuthServiceRequest({
75
- method: "POST",
76
- path: "/as/tnt/prov/eth/".concat(tenantId),
77
- body: accountInitializationBody,
78
- headers: {
79
- "Authorization": "Bearer ".concat(accountInitializationSignature)
80
- }
81
- }));
82
-
83
- case 15:
84
- _context.t2 = _context.sent;
85
- _context.t3 = _context.t1.ResponseToJson.call(_context.t1, _context.t2);
86
- _context.next = 19;
87
- return _context.t0.awrap.call(_context.t0, _context.t3);
88
-
89
- case 19:
90
- _ref2 = _context.sent;
91
- addr = _ref2.addr;
92
- address = this.utils.FormatAddress(addr);
93
- requestBody = {
94
- "tickets": null,
95
- "products": items.map(function (item) {
96
- return {
97
- sku: item.sku,
98
- quant: item.quantity || 1,
99
- extra: item.tokenId ? _objectSpread({}, item.extraData || {}, {
100
- token_id: item.tokenId
101
- }) : _objectSpread({}, item.extraData || {})
102
- };
103
- }),
104
- "ident": email || address,
105
- "cust_name": email || address,
106
- "extra": _objectSpread({}, extraData)
107
- };
108
- ValidateAddress(address);
109
-
110
- if (email) {
111
- requestBody.email = email;
112
- } else {
113
- requestBody.addr = address;
114
- }
115
-
116
- requestBody.extra.elv_addr = address;
117
- transactionId = this.utils.B58(UUID.parse(UUID.v4()));
118
- requestBody.ts = Date.now();
119
- requestBody.trans_id = transactionId;
120
- _context.next = 31;
121
- return _regeneratorRuntime.awrap(this.Sign(JSON.stringify(requestBody)));
122
-
123
- case 31:
124
- mintSignature = _context.sent;
125
- _context.next = 34;
126
- return _regeneratorRuntime.awrap(this.authClient.MakeAuthServiceRequest({
127
- method: "POST",
128
- path: "/as/otp/webhook/base/".concat(tenantId, "/").concat(collectionId),
129
- body: requestBody,
130
- headers: {
131
- "Authorization": "Bearer ".concat(mintSignature)
132
- }
133
- }));
134
-
135
- case 34:
136
- return _context.abrupt("return", {
137
- address: address,
138
- transactionId: transactionId
139
- });
140
-
141
- case 35:
142
- case "end":
143
- return _context.stop();
43
+ exports.MintNFT = /*#__PURE__*/function () {
44
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
45
+ var tenantId, address, marketplaceId, items, _ref$extraData, extraData, requestBody, transactionId, mintSignature;
46
+
47
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
48
+ while (1) {
49
+ switch (_context.prev = _context.next) {
50
+ case 0:
51
+ tenantId = _ref.tenantId, address = _ref.address, marketplaceId = _ref.marketplaceId, items = _ref.items, _ref$extraData = _ref.extraData, extraData = _ref$extraData === void 0 ? {} : _ref$extraData;
52
+ ValidatePresence("tenantId", tenantId);
53
+ ValidatePresence("address", address);
54
+ ValidatePresence("marketplaceId", marketplaceId);
55
+ ValidatePresence("items", items);
56
+ ValidateObject(marketplaceId);
57
+ ValidateAddress(address);
58
+ requestBody = {
59
+ tickets: null,
60
+ products: items.map(function (item) {
61
+ return {
62
+ sku: item.sku,
63
+ quant: item.quantity || 1,
64
+ extra: item.tokenId ? _objectSpread(_objectSpread({}, item.extraData || {}), {}, {
65
+ token_id: item.tokenId
66
+ }) : _objectSpread({}, item.extraData || {})
67
+ };
68
+ }),
69
+ ident: address,
70
+ cust_name: address,
71
+ extra: _objectSpread(_objectSpread({}, extraData), {}, {
72
+ elv_addr: address
73
+ })
74
+ };
75
+ transactionId = this.utils.B58(UUID.parse(UUID.v4()));
76
+ requestBody.ts = Date.now();
77
+ requestBody.trans_id = transactionId;
78
+ _context.next = 13;
79
+ return this.Sign(JSON.stringify(requestBody));
80
+
81
+ case 13:
82
+ mintSignature = _context.sent;
83
+ _context.next = 16;
84
+ return this.authClient.MakeAuthServiceRequest({
85
+ method: "POST",
86
+ path: UrlJoin("/as/tnt/trans/base", tenantId, marketplaceId),
87
+ body: requestBody,
88
+ headers: {
89
+ "Authorization": "Bearer ".concat(mintSignature)
90
+ }
91
+ });
92
+
93
+ case 16:
94
+ return _context.abrupt("return", {
95
+ address: address,
96
+ transactionId: transactionId
97
+ });
98
+
99
+ case 17:
100
+ case "end":
101
+ return _context.stop();
102
+ }
144
103
  }
145
- }
146
- }, null, this);
147
- };
104
+ }, _callee, this);
105
+ }));
106
+
107
+ return function (_x) {
108
+ return _ref2.apply(this, arguments);
109
+ };
110
+ }();
148
111
  /**
149
112
  * Retrieve information about transactions for the specified collection
150
113
  *
@@ -163,53 +126,59 @@ exports.MintNFT = function _callee(_ref) {
163
126
  */
164
127
 
165
128
 
166
- exports.CollectionTransactions = function _callee2(_ref3) {
167
- var tenantId, collectionId, _ref3$filterOptions, filterOptions, ts, queryParams, allowedOptions, path, signature;
168
-
169
- return _regeneratorRuntime.async(function _callee2$(_context2) {
170
- while (1) {
171
- switch (_context2.prev = _context2.next) {
172
- case 0:
173
- tenantId = _ref3.tenantId, collectionId = _ref3.collectionId, _ref3$filterOptions = _ref3.filterOptions, filterOptions = _ref3$filterOptions === void 0 ? {} : _ref3$filterOptions;
174
- ts = Date.now();
175
- queryParams = {
176
- ts: ts
177
- };
178
- allowedOptions = {
179
- "email": "email",
180
- "fromOrdinal": "from_ord",
181
- "max": "max",
182
- "status": "status",
183
- "transactionId": "trans_id"
184
- };
185
- Object.keys(allowedOptions).forEach(function (option) {
186
- if (filterOptions[option]) {
187
- queryParams[allowedOptions[option]] = filterOptions[option];
188
- }
189
- });
190
- path = this.AuthHttpClient.BaseURI().path(UrlJoin("/tnt", "trans", tenantId, collectionId)).query(queryParams).hash("").resource();
191
- _context2.next = 8;
192
- return _regeneratorRuntime.awrap(this.Sign(path));
193
-
194
- case 8:
195
- signature = _context2.sent;
196
- _context2.next = 11;
197
- return _regeneratorRuntime.awrap(this.utils.ResponseToJson(this.authClient.MakeAuthServiceRequest({
198
- method: "GET",
199
- path: UrlJoin("as", "tnt", "trans", tenantId, collectionId),
200
- queryParams: queryParams,
201
- headers: {
202
- "Authorization": "Bearer ".concat(signature)
203
- }
204
- })));
205
-
206
- case 11:
207
- return _context2.abrupt("return", _context2.sent);
208
-
209
- case 12:
210
- case "end":
211
- return _context2.stop();
129
+ exports.CollectionTransactions = /*#__PURE__*/function () {
130
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
131
+ var tenantId, collectionId, _ref3$filterOptions, filterOptions, ts, queryParams, allowedOptions, path, signature;
132
+
133
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
134
+ while (1) {
135
+ switch (_context2.prev = _context2.next) {
136
+ case 0:
137
+ tenantId = _ref3.tenantId, collectionId = _ref3.collectionId, _ref3$filterOptions = _ref3.filterOptions, filterOptions = _ref3$filterOptions === void 0 ? {} : _ref3$filterOptions;
138
+ ts = Date.now();
139
+ queryParams = {
140
+ ts: ts
141
+ };
142
+ allowedOptions = {
143
+ "email": "email",
144
+ "fromOrdinal": "from_ord",
145
+ "max": "max",
146
+ "status": "status",
147
+ "transactionId": "trans_id"
148
+ };
149
+ Object.keys(allowedOptions).forEach(function (option) {
150
+ if (filterOptions[option]) {
151
+ queryParams[allowedOptions[option]] = filterOptions[option];
152
+ }
153
+ });
154
+ path = this.AuthHttpClient.BaseURI().path(UrlJoin("/tnt", "trans", tenantId, collectionId)).query(queryParams).hash("").resource();
155
+ _context2.next = 8;
156
+ return this.Sign(path);
157
+
158
+ case 8:
159
+ signature = _context2.sent;
160
+ _context2.next = 11;
161
+ return this.utils.ResponseToJson(this.authClient.MakeAuthServiceRequest({
162
+ method: "GET",
163
+ path: UrlJoin("as", "tnt", "trans", tenantId, collectionId),
164
+ queryParams: queryParams,
165
+ headers: {
166
+ "Authorization": "Bearer ".concat(signature)
167
+ }
168
+ }));
169
+
170
+ case 11:
171
+ return _context2.abrupt("return", _context2.sent);
172
+
173
+ case 12:
174
+ case "end":
175
+ return _context2.stop();
176
+ }
212
177
  }
213
- }
214
- }, null, this);
215
- };
178
+ }, _callee2, this);
179
+ }));
180
+
181
+ return function (_x2) {
182
+ return _ref4.apply(this, arguments);
183
+ };
184
+ }();