@eluvio/elv-client-js 4.0.5 → 4.0.6

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 (43) hide show
  1. package/dist/ElvClient-min.js +12 -11
  2. package/dist/ElvClient-node-min.js +12 -17
  3. package/dist/ElvFrameClient-min.js +12 -11
  4. package/dist/ElvPermissionsClient-min.js +10 -9
  5. package/dist/ElvWalletClient-min.js +11 -10
  6. package/dist/ElvWalletClient-node-min.js +12 -17
  7. package/dist/src/AuthorizationClient.js +1556 -2077
  8. package/dist/src/ContentObjectVerification.js +134 -185
  9. package/dist/src/Crypto.js +225 -322
  10. package/dist/src/ElvClient.js +823 -1117
  11. package/dist/src/ElvWallet.js +64 -106
  12. package/dist/src/EthClient.js +719 -974
  13. package/dist/src/FrameClient.js +222 -318
  14. package/dist/src/HttpClient.js +112 -154
  15. package/dist/src/Id.js +1 -6
  16. package/dist/src/LogMessage.js +4 -8
  17. package/dist/src/PermissionsClient.js +973 -1271
  18. package/dist/src/RemoteSigner.js +161 -232
  19. package/dist/src/UserProfileClient.js +781 -1038
  20. package/dist/src/Utils.js +160 -302
  21. package/dist/src/Validation.js +2 -17
  22. package/dist/src/client/ABRPublishing.js +772 -942
  23. package/dist/src/client/AccessGroups.js +849 -1095
  24. package/dist/src/client/ContentAccess.js +3263 -4132
  25. package/dist/src/client/ContentManagement.js +1811 -2283
  26. package/dist/src/client/Contracts.js +468 -614
  27. package/dist/src/client/Files.js +1505 -1845
  28. package/dist/src/client/NFT.js +94 -116
  29. package/dist/src/client/NTP.js +326 -425
  30. package/dist/src/index.js +2 -5
  31. package/dist/src/walletClient/ClientMethods.js +1348 -1735
  32. package/dist/src/walletClient/Configuration.js +4 -2
  33. package/dist/src/walletClient/Notifications.js +98 -127
  34. package/dist/src/walletClient/Profile.js +184 -246
  35. package/dist/src/walletClient/Utils.js +76 -122
  36. package/dist/src/walletClient/index.js +1168 -1493
  37. package/package.json +2 -2
  38. package/src/Crypto.js +1 -1
  39. package/src/ElvClient.js +1 -3
  40. package/src/Utils.js +1 -1
  41. package/testScripts/Test.js +0 -1
  42. package/utilities/NFTIngest.js +527 -0
  43. package/utilities/lib/concerns/LocalFile.js +2 -1
@@ -1,15 +1,9 @@
1
1
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
2
-
3
2
  var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
3
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
6
-
7
4
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
8
-
9
5
  var _createClass = require("@babel/runtime/helpers/createClass");
10
-
11
6
  var Ethers = require("ethers");
12
-
13
7
  var ElvWallet = /*#__PURE__*/function () {
14
8
  "use strict";
15
9
 
@@ -22,22 +16,21 @@ var ElvWallet = /*#__PURE__*/function () {
22
16
  */
23
17
  function ElvWallet(provider) {
24
18
  _classCallCheck(this, ElvWallet);
25
-
26
19
  this.provider = provider;
27
20
  this.signers = {};
28
21
  }
22
+
29
23
  /**
30
24
  * Generate a mnemonic that can be used to initialize a private key
31
25
  *
32
26
  * @returns {string} - Space-separated list of random words
33
27
  */
34
-
35
-
36
28
  _createClass(ElvWallet, [{
37
29
  key: "GenerateMnemonic",
38
30
  value: function GenerateMnemonic() {
39
31
  return Ethers.Wallet.createRandom().mnemonic.phrase;
40
32
  }
33
+
41
34
  /**
42
35
  * Generate a private key from the given mnemonic
43
36
  *
@@ -47,18 +40,18 @@ var ElvWallet = /*#__PURE__*/function () {
47
40
  *
48
41
  * @returns {Signer} - Signer with the generated private key, connected to the provider
49
42
  */
50
-
51
43
  }, {
52
44
  key: "AddAccountFromMnemonic",
53
45
  value: function AddAccountFromMnemonic(_ref) {
54
46
  var accountName = _ref.accountName,
55
- mnemonic = _ref.mnemonic;
47
+ mnemonic = _ref.mnemonic;
56
48
  var signer = Ethers.Wallet.fromMnemonic(mnemonic);
57
49
  return this.AddAccount({
58
50
  accountName: accountName,
59
51
  privateKey: signer.privateKey
60
52
  });
61
53
  }
54
+
62
55
  /**
63
56
  * Add an account from an encrypted private key (Ethereum keystore format)
64
57
  *
@@ -69,44 +62,35 @@ var ElvWallet = /*#__PURE__*/function () {
69
62
  *
70
63
  * @returns {Promise<Signer>} - Signer with the decrypted private key, connected to the provider
71
64
  */
72
-
73
65
  }, {
74
66
  key: "AddAccountFromEncryptedPK",
75
67
  value: function () {
76
68
  var _AddAccountFromEncryptedPK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
77
69
  var accountName, encryptedPrivateKey, password, signer;
78
70
  return _regeneratorRuntime.wrap(function _callee$(_context) {
79
- while (1) {
80
- switch (_context.prev = _context.next) {
81
- case 0:
82
- accountName = _ref2.accountName, encryptedPrivateKey = _ref2.encryptedPrivateKey, password = _ref2.password;
83
-
84
- if (_typeof(encryptedPrivateKey) === "object") {
85
- encryptedPrivateKey = JSON.stringify(encryptedPrivateKey);
86
- }
87
-
88
- _context.next = 4;
89
- return Ethers.Wallet.fromEncryptedJson(encryptedPrivateKey, password);
90
-
91
- case 4:
92
- signer = _context.sent;
93
- return _context.abrupt("return", this.AddAccount({
94
- accountName: accountName,
95
- privateKey: signer.privateKey
96
- }));
97
-
98
- case 6:
99
- case "end":
100
- return _context.stop();
101
- }
71
+ while (1) switch (_context.prev = _context.next) {
72
+ case 0:
73
+ accountName = _ref2.accountName, encryptedPrivateKey = _ref2.encryptedPrivateKey, password = _ref2.password;
74
+ if (_typeof(encryptedPrivateKey) === "object") {
75
+ encryptedPrivateKey = JSON.stringify(encryptedPrivateKey);
76
+ }
77
+ _context.next = 4;
78
+ return Ethers.Wallet.fromEncryptedJson(encryptedPrivateKey, password);
79
+ case 4:
80
+ signer = _context.sent;
81
+ return _context.abrupt("return", this.AddAccount({
82
+ accountName: accountName,
83
+ privateKey: signer.privateKey
84
+ }));
85
+ case 6:
86
+ case "end":
87
+ return _context.stop();
102
88
  }
103
89
  }, _callee, this);
104
90
  }));
105
-
106
91
  function AddAccountFromEncryptedPK(_x) {
107
92
  return _AddAccountFromEncryptedPK.apply(this, arguments);
108
93
  }
109
-
110
94
  return AddAccountFromEncryptedPK;
111
95
  }()
112
96
  /**
@@ -118,26 +102,23 @@ var ElvWallet = /*#__PURE__*/function () {
118
102
  *
119
103
  * @returns {Signer} - Signer with the private key, connected to the provider
120
104
  */
121
-
122
105
  }, {
123
106
  key: "AddAccount",
124
107
  value: function AddAccount(_ref3) {
125
108
  var accountName = _ref3.accountName,
126
- privateKey = _ref3.privateKey;
127
-
109
+ privateKey = _ref3.privateKey;
128
110
  try {
129
111
  var signer = new Ethers.Wallet(privateKey);
130
112
  signer = signer.connect(this.provider);
131
-
132
113
  if (accountName) {
133
114
  this.signers[accountName] = signer;
134
115
  }
135
-
136
116
  return signer;
137
117
  } catch (error) {
138
118
  throw Error("Invalid private key");
139
119
  }
140
120
  }
121
+
141
122
  /**
142
123
  * Get the balance of the account. The account to query can be specified either by
143
124
  * passing the signer object, or by passing the account name of a saved account
@@ -150,49 +131,39 @@ var ElvWallet = /*#__PURE__*/function () {
150
131
  *
151
132
  * @returns {number} - Account balance of the specified account, in ETH
152
133
  */
153
-
154
134
  }, {
155
135
  key: "GetAccountBalance",
156
136
  value: function () {
157
137
  var _GetAccountBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4) {
158
138
  var accountName, signer, accountSigner;
159
139
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
160
- while (1) {
161
- switch (_context2.prev = _context2.next) {
162
- case 0:
163
- accountName = _ref4.accountName, signer = _ref4.signer;
164
- accountSigner = signer || this.GetAccount({
165
- accountName: accountName
166
- });
167
-
168
- if (accountSigner) {
169
- _context2.next = 4;
170
- break;
171
- }
172
-
173
- throw Error("Unknown account: " + accountName);
174
-
175
- case 4:
176
- _context2.t0 = Ethers.utils;
177
- _context2.next = 7;
178
- return accountSigner.getBalance();
179
-
180
- case 7:
181
- _context2.t1 = _context2.sent;
182
- return _context2.abrupt("return", _context2.t0.formatEther.call(_context2.t0, _context2.t1));
183
-
184
- case 9:
185
- case "end":
186
- return _context2.stop();
187
- }
140
+ while (1) switch (_context2.prev = _context2.next) {
141
+ case 0:
142
+ accountName = _ref4.accountName, signer = _ref4.signer;
143
+ accountSigner = signer || this.GetAccount({
144
+ accountName: accountName
145
+ });
146
+ if (accountSigner) {
147
+ _context2.next = 4;
148
+ break;
149
+ }
150
+ throw Error("Unknown account: " + accountName);
151
+ case 4:
152
+ _context2.t0 = Ethers.utils;
153
+ _context2.next = 7;
154
+ return accountSigner.getBalance();
155
+ case 7:
156
+ _context2.t1 = _context2.sent;
157
+ return _context2.abrupt("return", _context2.t0.formatEther.call(_context2.t0, _context2.t1));
158
+ case 9:
159
+ case "end":
160
+ return _context2.stop();
188
161
  }
189
162
  }, _callee2, this);
190
163
  }));
191
-
192
164
  function GetAccountBalance(_x2) {
193
165
  return _GetAccountBalance.apply(this, arguments);
194
166
  }
195
-
196
167
  return GetAccountBalance;
197
168
  }()
198
169
  /**
@@ -209,47 +180,37 @@ var ElvWallet = /*#__PURE__*/function () {
209
180
  *
210
181
  * @returns {Promise<string>} - The encrypted private key (in Ethereum keystore format)
211
182
  */
212
-
213
183
  }, {
214
184
  key: "GenerateEncryptedPrivateKey",
215
185
  value: function () {
216
186
  var _GenerateEncryptedPrivateKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
217
187
  var accountName, signer, password, options, accountSigner;
218
188
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
219
- while (1) {
220
- switch (_context3.prev = _context3.next) {
221
- case 0:
222
- accountName = _ref5.accountName, signer = _ref5.signer, password = _ref5.password, options = _ref5.options;
223
- accountSigner = signer || this.GetAccount({
224
- accountName: accountName
225
- });
226
-
227
- if (accountSigner) {
228
- _context3.next = 4;
229
- break;
230
- }
231
-
232
- throw Error("Unknown account: " + accountName);
233
-
234
- case 4:
235
- _context3.next = 6;
236
- return accountSigner.encrypt(password, options);
237
-
238
- case 6:
239
- return _context3.abrupt("return", _context3.sent);
240
-
241
- case 7:
242
- case "end":
243
- return _context3.stop();
244
- }
189
+ while (1) switch (_context3.prev = _context3.next) {
190
+ case 0:
191
+ accountName = _ref5.accountName, signer = _ref5.signer, password = _ref5.password, options = _ref5.options;
192
+ accountSigner = signer || this.GetAccount({
193
+ accountName: accountName
194
+ });
195
+ if (accountSigner) {
196
+ _context3.next = 4;
197
+ break;
198
+ }
199
+ throw Error("Unknown account: " + accountName);
200
+ case 4:
201
+ _context3.next = 6;
202
+ return accountSigner.encrypt(password, options);
203
+ case 6:
204
+ return _context3.abrupt("return", _context3.sent);
205
+ case 7:
206
+ case "end":
207
+ return _context3.stop();
245
208
  }
246
209
  }, _callee3, this);
247
210
  }));
248
-
249
211
  function GenerateEncryptedPrivateKey(_x3) {
250
212
  return _GenerateEncryptedPrivateKey.apply(this, arguments);
251
213
  }
252
-
253
214
  return GenerateEncryptedPrivateKey;
254
215
  }()
255
216
  /**
@@ -259,20 +220,19 @@ var ElvWallet = /*#__PURE__*/function () {
259
220
  * @param {string} accountName - Name of the account
260
221
  * @returns {(Signer|undefined)} - Signer of the saved account, if it exists
261
222
  */
262
-
263
223
  }, {
264
224
  key: "GetAccount",
265
225
  value: function GetAccount(_ref6) {
266
226
  var accountName = _ref6.accountName;
267
227
  return this.signers[accountName];
268
228
  }
229
+
269
230
  /**
270
231
  * Remove a previously saved account from this wallet
271
232
  *
272
233
  * @namedParams
273
234
  * @param {string} accountName - Name of the account to delete
274
235
  */
275
-
276
236
  }, {
277
237
  key: "RemoveAccount",
278
238
  value: function RemoveAccount(_ref7) {
@@ -280,8 +240,6 @@ var ElvWallet = /*#__PURE__*/function () {
280
240
  delete this.signers[accountName];
281
241
  }
282
242
  }]);
283
-
284
243
  return ElvWallet;
285
244
  }();
286
-
287
245
  module.exports = ElvWallet;