@eluvio/elv-client-js 3.1.95 → 3.2.0

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 (51) hide show
  1. package/dist/ElvClient-min.js +11 -15
  2. package/dist/ElvClient-node-min.js +13 -17
  3. package/dist/ElvFrameClient-min.js +9 -13
  4. package/dist/ElvPermissionsClient-min.js +9 -13
  5. package/dist/src/AuthorizationClient.js +1980 -2238
  6. package/dist/src/ContentObjectVerification.js +173 -164
  7. package/dist/src/Crypto.js +324 -376
  8. package/dist/src/ElvClient.js +1022 -1182
  9. package/dist/src/ElvWallet.js +95 -119
  10. package/dist/src/EthClient.js +896 -1040
  11. package/dist/src/FrameClient.js +300 -331
  12. package/dist/src/HttpClient.js +147 -153
  13. package/dist/src/Id.js +3 -1
  14. package/dist/src/PermissionsClient.js +1168 -1294
  15. package/dist/src/RemoteSigner.js +211 -263
  16. package/dist/src/UserProfileClient.js +1023 -1164
  17. package/dist/src/Utils.js +217 -212
  18. package/dist/src/client/ABRPublishing.js +858 -895
  19. package/dist/src/client/AccessGroups.js +959 -1102
  20. package/dist/src/client/ContentAccess.js +3433 -3717
  21. package/dist/src/client/ContentManagement.js +2068 -2252
  22. package/dist/src/client/Contracts.js +563 -647
  23. package/dist/src/client/Files.js +1757 -1886
  24. package/dist/src/client/NFT.js +112 -126
  25. package/dist/src/client/NTP.js +422 -478
  26. package/dist/src/index.js +11 -0
  27. package/dist/src/marketplaceClient/ClientMethods.js +1918 -0
  28. package/dist/src/marketplaceClient/Configuration.js +29 -0
  29. package/dist/src/marketplaceClient/Utils.js +304 -0
  30. package/dist/src/marketplaceClient/index.js +1553 -0
  31. package/dist/src/walletClient/ClientMethods.js +1828 -0
  32. package/dist/src/walletClient/Configuration.js +29 -0
  33. package/dist/src/walletClient/Utils.js +290 -0
  34. package/dist/src/walletClient/index.js +1459 -0
  35. package/package-lock.json +22001 -0
  36. package/package.json +6 -4
  37. package/src/AuthorizationClient.js +1 -1
  38. package/src/ElvClient.js +4 -1
  39. package/src/Utils.js +44 -3
  40. package/src/client/ContentAccess.js +4 -0
  41. package/src/index.js +7 -0
  42. package/src/walletClient/ClientMethods.js +1016 -0
  43. package/src/walletClient/Configuration.js +40 -0
  44. package/src/walletClient/README.md +185 -0
  45. package/src/walletClient/Utils.js +234 -0
  46. package/src/walletClient/index.js +884 -0
  47. package/testScripts/TestMarketplaceClient.js +25 -0
  48. package/utilities/ObjectSetPermission.js +4 -4
  49. package/utilities/SimpleIngest.js +41 -0
  50. package/utilities/example_files/simple_ingest_library_metadata.json +180 -0
  51. package/utilities/example_files/simple_ingest_library_metadata_animation_NFTs.json +133 -0
@@ -1,20 +1,14 @@
1
1
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
2
2
 
3
- var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
4
-
5
3
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
6
4
 
7
5
  var _createClass = require("@babel/runtime/helpers/createClass");
8
6
 
9
- var _inherits = require("@babel/runtime/helpers/inherits");
10
-
11
7
  var _possibleConstructorReturn = require("@babel/runtime/helpers/possibleConstructorReturn");
12
8
 
13
9
  var _getPrototypeOf = require("@babel/runtime/helpers/getPrototypeOf");
14
10
 
15
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
-
17
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
+ var _inherits = require("@babel/runtime/helpers/inherits");
18
12
 
19
13
  var Ethers = require("ethers");
20
14
 
@@ -24,13 +18,13 @@ var HttpClient = require("./HttpClient");
24
18
 
25
19
  var UrlJoin = require("url-join");
26
20
 
27
- var RemoteSigner = /*#__PURE__*/function (_Ethers$Signer) {
21
+ var RemoteSigner =
22
+ /*#__PURE__*/
23
+ function (_Ethers$Signer) {
28
24
  "use strict";
29
25
 
30
26
  _inherits(RemoteSigner, _Ethers$Signer);
31
27
 
32
- var _super = _createSuper(RemoteSigner);
33
-
34
28
  function RemoteSigner(_ref) {
35
29
  var _this;
36
30
 
@@ -46,7 +40,7 @@ var RemoteSigner = /*#__PURE__*/function (_Ethers$Signer) {
46
40
 
47
41
  _classCallCheck(this, RemoteSigner);
48
42
 
49
- _this = _super.call(this);
43
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(RemoteSigner).call(this));
50
44
  _this.remoteSigner = true;
51
45
  _this.unsignedPublicAuth = unsignedPublicAuth;
52
46
  _this.HttpClient = new HttpClient({
@@ -63,86 +57,78 @@ var RemoteSigner = /*#__PURE__*/function (_Ethers$Signer) {
63
57
 
64
58
  _createClass(RemoteSigner, [{
65
59
  key: "Initialize",
66
- value: function () {
67
- var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
68
- var _yield$Utils$Response, addr, eth, token, keys, address;
69
-
70
- return _regeneratorRuntime.wrap(function _callee$(_context) {
71
- while (1) {
72
- switch (_context.prev = _context.next) {
73
- case 0:
74
- if (this.authToken) {
75
- _context.next = 10;
76
- break;
77
- }
78
-
79
- _context.next = 3;
80
- return Utils.ResponseToJson(this.HttpClient.Request({
81
- path: UrlJoin("as", "wlt", "login", "jwt"),
82
- method: "POST",
83
- body: this.tenantId ? {
84
- tid: this.tenantId,
85
- ext: this.extraLoginData || {}
86
- } : {
87
- ext: this.extraLoginData || {}
88
- },
89
- headers: {
90
- Authorization: "Bearer ".concat(this.idToken)
91
- }
92
- }));
93
-
94
- case 3:
95
- _yield$Utils$Response = _context.sent;
96
- addr = _yield$Utils$Response.addr;
97
- eth = _yield$Utils$Response.eth;
98
- token = _yield$Utils$Response.token;
99
- this.authToken = token;
100
- this.address = Utils.FormatAddress(addr);
101
- this.id = eth;
102
-
103
- case 10:
104
- if (this.address) {
105
- _context.next = 16;
106
- break;
60
+ value: function Initialize() {
61
+ var _ref2, addr, eth, token, keys, address;
62
+
63
+ return _regeneratorRuntime.async(function Initialize$(_context) {
64
+ while (1) {
65
+ switch (_context.prev = _context.next) {
66
+ case 0:
67
+ if (this.authToken) {
68
+ _context.next = 10;
69
+ break;
70
+ }
71
+
72
+ _context.next = 3;
73
+ return _regeneratorRuntime.awrap(Utils.ResponseToJson(this.HttpClient.Request({
74
+ path: UrlJoin("as", "wlt", "login", "jwt"),
75
+ method: "POST",
76
+ body: this.tenantId ? {
77
+ tid: this.tenantId,
78
+ ext: this.extraLoginData || {}
79
+ } : {
80
+ ext: this.extraLoginData || {}
81
+ },
82
+ headers: {
83
+ Authorization: "Bearer ".concat(this.idToken)
107
84
  }
108
-
109
- _context.next = 13;
110
- return Utils.ResponseToJson(this.HttpClient.Request({
111
- method: "GET",
112
- path: UrlJoin("as", "wlt", "keys"),
113
- headers: {
114
- Authorization: "Bearer ".concat(this.authToken)
115
- }
116
- }));
117
-
118
- case 13:
119
- keys = _context.sent;
120
- address = keys.eth[0];
121
-
122
- if (address && address.startsWith("0x")) {
123
- this.address = address;
124
- } else {
125
- this.address = Utils.HashToAddress(keys.eth[0]);
85
+ })));
86
+
87
+ case 3:
88
+ _ref2 = _context.sent;
89
+ addr = _ref2.addr;
90
+ eth = _ref2.eth;
91
+ token = _ref2.token;
92
+ this.authToken = token;
93
+ this.address = Utils.FormatAddress(addr);
94
+ this.id = eth;
95
+
96
+ case 10:
97
+ if (this.address) {
98
+ _context.next = 16;
99
+ break;
100
+ }
101
+
102
+ _context.next = 13;
103
+ return _regeneratorRuntime.awrap(Utils.ResponseToJson(this.HttpClient.Request({
104
+ method: "GET",
105
+ path: UrlJoin("as", "wlt", "keys"),
106
+ headers: {
107
+ Authorization: "Bearer ".concat(this.authToken)
126
108
  }
109
+ })));
127
110
 
128
- case 16:
129
- this.id = this.address ? "ikms".concat(Utils.AddressToHash(this.address)) : undefined;
130
- this.signer = this.provider.getSigner(this.address);
111
+ case 13:
112
+ keys = _context.sent;
113
+ address = keys.eth[0];
131
114
 
132
- case 18:
133
- case "end":
134
- return _context.stop();
135
- }
136
- }
137
- }, _callee, this);
138
- }));
115
+ if (address && address.startsWith("0x")) {
116
+ this.address = address;
117
+ } else {
118
+ this.address = Utils.HashToAddress(keys.eth[0]);
119
+ }
139
120
 
140
- function Initialize() {
141
- return _Initialize.apply(this, arguments);
142
- }
121
+ case 16:
122
+ this.id = this.address ? "ikms".concat(Utils.AddressToHash(this.address)) : undefined;
123
+ this.signer = this.provider.getSigner(this.address);
143
124
 
144
- return Initialize;
145
- }() // Overrides
125
+ case 18:
126
+ case "end":
127
+ return _context.stop();
128
+ }
129
+ }
130
+ }, null, this);
131
+ } // Overrides
146
132
 
147
133
  }, {
148
134
  key: "getAddress",
@@ -157,194 +143,156 @@ var RemoteSigner = /*#__PURE__*/function (_Ethers$Signer) {
157
143
 
158
144
  }, {
159
145
  key: "signDigest",
160
- value: function () {
161
- var _signDigest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(digest) {
162
- var _this2 = this;
163
-
164
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
165
- while (1) {
166
- switch (_context3.prev = _context3.next) {
167
- case 0:
168
- if (!this.signatureCache[digest]) {
169
- this.signatureCache[digest] = new Promise( /*#__PURE__*/function () {
170
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve, reject) {
171
- var signature;
172
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
173
- while (1) {
174
- switch (_context2.prev = _context2.next) {
175
- case 0:
176
- _context2.prev = 0;
177
- _context2.next = 3;
178
- return Utils.ResponseToJson(_this2.HttpClient.Request({
179
- method: "POST",
180
- path: UrlJoin("as", "wlt", "sign", "eth", _this2.id),
181
- headers: {
182
- Authorization: "Bearer ".concat(_this2.authToken)
183
- },
184
- body: {
185
- hash: digest
186
- }
187
- }));
188
-
189
- case 3:
190
- signature = _context2.sent;
191
- signature.v = parseInt(signature.v, 16);
192
- signature.recoveryParam = signature.v - 27;
193
- resolve(signature);
194
- _context2.next = 12;
195
- break;
196
-
197
- case 9:
198
- _context2.prev = 9;
199
- _context2.t0 = _context2["catch"](0);
200
- reject(_context2.t0);
201
-
202
- case 12:
203
- case "end":
204
- return _context2.stop();
205
- }
206
- }
207
- }, _callee2, null, [[0, 9]]);
208
- }));
209
-
210
- return function (_x2, _x3) {
211
- return _ref2.apply(this, arguments);
212
- };
213
- }());
214
- }
215
-
216
- _context3.next = 3;
217
- return this.signatureCache[digest];
218
-
219
- case 3:
220
- return _context3.abrupt("return", _context3.sent);
221
-
222
- case 4:
223
- case "end":
224
- return _context3.stop();
225
- }
146
+ value: function signDigest(digest) {
147
+ var _this2 = this;
148
+
149
+ return _regeneratorRuntime.async(function signDigest$(_context3) {
150
+ while (1) {
151
+ switch (_context3.prev = _context3.next) {
152
+ case 0:
153
+ if (!this.signatureCache[digest]) {
154
+ this.signatureCache[digest] = new Promise(function _callee(resolve, reject) {
155
+ var signature;
156
+ return _regeneratorRuntime.async(function _callee$(_context2) {
157
+ while (1) {
158
+ switch (_context2.prev = _context2.next) {
159
+ case 0:
160
+ _context2.prev = 0;
161
+ _context2.next = 3;
162
+ return _regeneratorRuntime.awrap(Utils.ResponseToJson(_this2.HttpClient.Request({
163
+ method: "POST",
164
+ path: UrlJoin("as", "wlt", "sign", "eth", _this2.id),
165
+ headers: {
166
+ Authorization: "Bearer ".concat(_this2.authToken)
167
+ },
168
+ body: {
169
+ hash: digest
170
+ }
171
+ })));
172
+
173
+ case 3:
174
+ signature = _context2.sent;
175
+ signature.v = parseInt(signature.v, 16);
176
+ signature.recoveryParam = signature.v - 27;
177
+ resolve(signature);
178
+ _context2.next = 12;
179
+ break;
180
+
181
+ case 9:
182
+ _context2.prev = 9;
183
+ _context2.t0 = _context2["catch"](0);
184
+ reject(_context2.t0);
185
+
186
+ case 12:
187
+ case "end":
188
+ return _context2.stop();
189
+ }
190
+ }
191
+ }, null, null, [[0, 9]]);
192
+ });
193
+ }
194
+
195
+ _context3.next = 3;
196
+ return _regeneratorRuntime.awrap(this.signatureCache[digest]);
197
+
198
+ case 3:
199
+ return _context3.abrupt("return", _context3.sent);
200
+
201
+ case 4:
202
+ case "end":
203
+ return _context3.stop();
226
204
  }
227
- }, _callee3, this);
228
- }));
229
-
230
- function signDigest(_x) {
231
- return _signDigest.apply(this, arguments);
232
- }
233
-
234
- return signDigest;
235
- }()
205
+ }
206
+ }, null, this);
207
+ }
236
208
  }, {
237
209
  key: "signMessage",
238
- value: function () {
239
- var _signMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(message) {
240
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
241
- while (1) {
242
- switch (_context4.prev = _context4.next) {
243
- case 0:
244
- _context4.t0 = Promise;
245
- _context4.t1 = Ethers.utils;
246
- _context4.t2 = "0x";
247
- _context4.next = 5;
248
- return this.signDigest(Ethers.utils.hashMessage(message));
249
-
250
- case 5:
251
- _context4.t3 = _context4.sent;
252
- _context4.t4 = _context4.t2.concat.call(_context4.t2, _context4.t3);
253
- _context4.t5 = _context4.t1.joinSignature.call(_context4.t1, _context4.t4);
254
- return _context4.abrupt("return", _context4.t0.resolve.call(_context4.t0, _context4.t5));
255
-
256
- case 9:
257
- case "end":
258
- return _context4.stop();
259
- }
210
+ value: function signMessage(message) {
211
+ return _regeneratorRuntime.async(function signMessage$(_context4) {
212
+ while (1) {
213
+ switch (_context4.prev = _context4.next) {
214
+ case 0:
215
+ _context4.t0 = Promise;
216
+ _context4.t1 = Ethers.utils;
217
+ _context4.t2 = "0x";
218
+ _context4.next = 5;
219
+ return _regeneratorRuntime.awrap(this.signDigest(Ethers.utils.hashMessage(message)));
220
+
221
+ case 5:
222
+ _context4.t3 = _context4.sent;
223
+ _context4.t4 = _context4.t2.concat.call(_context4.t2, _context4.t3);
224
+ _context4.t5 = _context4.t1.joinSignature.call(_context4.t1, _context4.t4);
225
+ return _context4.abrupt("return", _context4.t0.resolve.call(_context4.t0, _context4.t5));
226
+
227
+ case 9:
228
+ case "end":
229
+ return _context4.stop();
260
230
  }
261
- }, _callee4, this);
262
- }));
263
-
264
- function signMessage(_x4) {
265
- return _signMessage.apply(this, arguments);
266
- }
267
-
268
- return signMessage;
269
- }()
231
+ }
232
+ }, null, this);
233
+ }
270
234
  }, {
271
235
  key: "sign",
272
- value: function () {
273
- var _sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(transaction) {
274
- var signature;
275
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
276
- while (1) {
277
- switch (_context5.prev = _context5.next) {
278
- case 0:
279
- _context5.next = 2;
280
- return Ethers.utils.resolveProperties(transaction);
281
-
282
- case 2:
283
- transaction = _context5.sent;
284
- _context5.next = 5;
285
- return this.signDigest(Ethers.utils.keccak256(Ethers.utils.serializeTransaction(transaction)));
286
-
287
- case 5:
288
- signature = _context5.sent;
289
- return _context5.abrupt("return", Ethers.utils.serializeTransaction(transaction, signature));
290
-
291
- case 7:
292
- case "end":
293
- return _context5.stop();
294
- }
236
+ value: function sign(transaction) {
237
+ var signature;
238
+ return _regeneratorRuntime.async(function sign$(_context5) {
239
+ while (1) {
240
+ switch (_context5.prev = _context5.next) {
241
+ case 0:
242
+ _context5.next = 2;
243
+ return _regeneratorRuntime.awrap(Ethers.utils.resolveProperties(transaction));
244
+
245
+ case 2:
246
+ transaction = _context5.sent;
247
+ _context5.next = 5;
248
+ return _regeneratorRuntime.awrap(this.signDigest(Ethers.utils.keccak256(Ethers.utils.serializeTransaction(transaction))));
249
+
250
+ case 5:
251
+ signature = _context5.sent;
252
+ return _context5.abrupt("return", Ethers.utils.serializeTransaction(transaction, signature));
253
+
254
+ case 7:
255
+ case "end":
256
+ return _context5.stop();
295
257
  }
296
- }, _callee5, this);
297
- }));
298
-
299
- function sign(_x5) {
300
- return _sign.apply(this, arguments);
301
- }
302
-
303
- return sign;
304
- }()
258
+ }
259
+ }, null, this);
260
+ }
305
261
  }, {
306
262
  key: "sendTransaction",
307
- value: function () {
308
- var _sendTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(transaction) {
309
- var _this3 = this;
310
-
311
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
312
- while (1) {
313
- switch (_context6.prev = _context6.next) {
314
- case 0:
315
- if (!(transaction.nonce == null)) {
316
- _context6.next = 5;
317
- break;
318
- }
319
-
320
- transaction = Ethers.utils.shallowCopy(transaction);
321
- _context6.next = 4;
322
- return this.provider.getTransactionCount(this.address, "pending");
323
-
324
- case 4:
325
- transaction.nonce = _context6.sent;
326
-
327
- case 5:
328
- return _context6.abrupt("return", Ethers.utils.populateTransaction(transaction, this.provider, this.address).then(function (tx) {
329
- return _this3.sign(tx).then(function (signedTransaction) {
330
- return _this3.provider.sendTransaction(signedTransaction);
331
- });
332
- }));
333
-
334
- case 6:
335
- case "end":
336
- return _context6.stop();
337
- }
263
+ value: function sendTransaction(transaction) {
264
+ var _this3 = this;
265
+
266
+ return _regeneratorRuntime.async(function sendTransaction$(_context6) {
267
+ while (1) {
268
+ switch (_context6.prev = _context6.next) {
269
+ case 0:
270
+ if (!(transaction.nonce == null)) {
271
+ _context6.next = 5;
272
+ break;
273
+ }
274
+
275
+ transaction = Ethers.utils.shallowCopy(transaction);
276
+ _context6.next = 4;
277
+ return _regeneratorRuntime.awrap(this.provider.getTransactionCount(this.address, "pending"));
278
+
279
+ case 4:
280
+ transaction.nonce = _context6.sent;
281
+
282
+ case 5:
283
+ return _context6.abrupt("return", Ethers.utils.populateTransaction(transaction, this.provider, this.address).then(function (tx) {
284
+ return _this3.sign(tx).then(function (signedTransaction) {
285
+ return _this3.provider.sendTransaction(signedTransaction);
286
+ });
287
+ }));
288
+
289
+ case 6:
290
+ case "end":
291
+ return _context6.stop();
338
292
  }
339
- }, _callee6, this);
340
- }));
341
-
342
- function sendTransaction(_x6) {
343
- return _sendTransaction.apply(this, arguments);
344
- }
345
-
346
- return sendTransaction;
347
- }()
293
+ }
294
+ }, null, this);
295
+ }
348
296
  }, {
349
297
  key: "connect",
350
298
  value: function connect() {}