@eluvio/elv-client-js 4.0.114 → 4.0.116

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 (129) hide show
  1. package/dist/ElvClient-min.js +68 -0
  2. package/dist/ElvClient-node-min.js +67 -0
  3. package/dist/ElvFrameClient-min.js +60 -0
  4. package/dist/ElvPermissionsClient-min.js +60 -0
  5. package/dist/ElvWalletClient-min.js +68 -0
  6. package/dist/ElvWalletClient-node-min.js +67 -0
  7. package/dist/src/AuthorizationClient.js +2166 -0
  8. package/dist/src/ContentObjectAudit.js +175 -0
  9. package/dist/src/ContentObjectVerification.js +281 -0
  10. package/dist/src/Crypto.js +412 -0
  11. package/dist/src/ElvClient.js +2063 -0
  12. package/dist/src/ElvWallet.js +247 -0
  13. package/dist/src/EthClient.js +1153 -0
  14. package/dist/src/FrameClient.js +484 -0
  15. package/dist/src/HttpClient.js +314 -0
  16. package/dist/src/Id.js +20 -0
  17. package/dist/src/LogMessage.js +25 -0
  18. package/dist/src/PermissionsClient.js +1556 -0
  19. package/dist/src/RemoteSigner.js +383 -0
  20. package/dist/src/UserProfileClient.js +1465 -0
  21. package/dist/src/Utils.js +893 -0
  22. package/dist/src/Validation.js +121 -0
  23. package/dist/src/abr_profiles/abr_profile_live_drm.js +1661 -0
  24. package/dist/src/abr_profiles/abr_profile_live_to_vod.js +1606 -0
  25. package/dist/src/client/ABRPublishing.js +1018 -0
  26. package/dist/src/client/AccessGroups.js +1503 -0
  27. package/dist/src/client/ContentAccess.js +5202 -0
  28. package/dist/src/client/ContentManagement.js +2680 -0
  29. package/dist/src/client/Contracts.js +1520 -0
  30. package/dist/src/client/Files.js +2181 -0
  31. package/dist/src/client/LiveConf.js +567 -0
  32. package/dist/src/client/LiveStream.js +2638 -0
  33. package/dist/src/client/NFT.js +162 -0
  34. package/dist/src/client/NTP.js +581 -0
  35. package/dist/src/contracts/v2/AccessIndexor.js +831 -0
  36. package/dist/src/contracts/v2/Accessible.js +31 -0
  37. package/dist/src/contracts/v2/BaseAccessControlGroup.js +1263 -0
  38. package/dist/src/contracts/v2/BaseAccessWallet.js +1609 -0
  39. package/dist/src/contracts/v2/BaseAccessWalletFactory.js +93 -0
  40. package/dist/src/contracts/v2/BaseContent.js +1076 -0
  41. package/dist/src/contracts/v2/BaseContentFactory.js +219 -0
  42. package/dist/src/contracts/v2/BaseContentSpace.js +1352 -0
  43. package/dist/src/contracts/v2/BaseContentType.js +364 -0
  44. package/dist/src/contracts/v2/BaseFactory.js +107 -0
  45. package/dist/src/contracts/v2/BaseGroupFactory.js +93 -0
  46. package/dist/src/contracts/v2/BaseLibrary.js +1041 -0
  47. package/dist/src/contracts/v2/BaseLibraryFactory.js +96 -0
  48. package/dist/src/contracts/v2/Certifyer.js +86 -0
  49. package/dist/src/contracts/v2/Container.js +540 -0
  50. package/dist/src/contracts/v2/Content.js +443 -0
  51. package/dist/src/contracts/v2/Editable.js +306 -0
  52. package/dist/src/contracts/v2/ExternalUserWallet.js +379 -0
  53. package/dist/src/contracts/v2/IFactorySpace.js +57 -0
  54. package/dist/src/contracts/v2/IKmsSpace.js +52 -0
  55. package/dist/src/contracts/v2/INodeSpace.js +18 -0
  56. package/dist/src/contracts/v2/IUserSpace.js +18 -0
  57. package/dist/src/contracts/v2/LvRecordableStream.js +1037 -0
  58. package/dist/src/contracts/v2/LvRecording.js +627 -0
  59. package/dist/src/contracts/v2/LvStreamRightsHolder.js +562 -0
  60. package/dist/src/contracts/v2/MetaObject.js +119 -0
  61. package/dist/src/contracts/v2/Node.js +167 -0
  62. package/dist/src/contracts/v2/NodeSpace.js +273 -0
  63. package/dist/src/contracts/v2/Ownable.js +87 -0
  64. package/dist/src/contracts/v2/PaymentService.js +627 -0
  65. package/dist/src/contracts/v2/Precompile.js +15 -0
  66. package/dist/src/contracts/v2/Transactable.js +82 -0
  67. package/dist/src/contracts/v2/UserSpace.js +29 -0
  68. package/dist/src/contracts/v2/Utils.js +18 -0
  69. package/dist/src/contracts/v2/Verifier.js +53 -0
  70. package/dist/src/contracts/v2/strings.js +4 -0
  71. package/dist/src/contracts/v3/AccessIndexor.js +774 -0
  72. package/dist/src/contracts/v3/Accessible.js +232 -0
  73. package/dist/src/contracts/v3/Adminable.js +107 -0
  74. package/dist/src/contracts/v3/AvailsDelivery.js +586 -0
  75. package/dist/src/contracts/v3/BaseAccessControlGroup.js +1603 -0
  76. package/dist/src/contracts/v3/BaseAccessWallet.js +1628 -0
  77. package/dist/src/contracts/v3/BaseAccessWalletFactory.js +112 -0
  78. package/dist/src/contracts/v3/BaseContent.js +1312 -0
  79. package/dist/src/contracts/v3/BaseContentFactory.js +183 -0
  80. package/dist/src/contracts/v3/BaseContentFactoryExt.js +175 -0
  81. package/dist/src/contracts/v3/BaseContentSpace.js +1515 -0
  82. package/dist/src/contracts/v3/BaseContentType.js +527 -0
  83. package/dist/src/contracts/v3/BaseFactory.js +126 -0
  84. package/dist/src/contracts/v3/BaseGroupFactory.js +112 -0
  85. package/dist/src/contracts/v3/BaseLibrary.js +1204 -0
  86. package/dist/src/contracts/v3/BaseLibraryFactory.js +115 -0
  87. package/dist/src/contracts/v3/BaseTenantSpace.js +1587 -0
  88. package/dist/src/contracts/v3/Certifyer.js +86 -0
  89. package/dist/src/contracts/v3/Container.js +739 -0
  90. package/dist/src/contracts/v3/Content.js +438 -0
  91. package/dist/src/contracts/v3/CounterObject.js +243 -0
  92. package/dist/src/contracts/v3/Editable.js +519 -0
  93. package/dist/src/contracts/v3/EncToken.js +4 -0
  94. package/dist/src/contracts/v3/ExternalUserWallet.js +587 -0
  95. package/dist/src/contracts/v3/IAdmin.js +18 -0
  96. package/dist/src/contracts/v3/IFactorySpace.js +57 -0
  97. package/dist/src/contracts/v3/IKmsSpace.js +52 -0
  98. package/dist/src/contracts/v3/INodeSpace.js +18 -0
  99. package/dist/src/contracts/v3/IUserSpace.js +32 -0
  100. package/dist/src/contracts/v3/LvRecordableStream.js +1032 -0
  101. package/dist/src/contracts/v3/LvRecording.js +650 -0
  102. package/dist/src/contracts/v3/LvStreamRightsHolder.js +557 -0
  103. package/dist/src/contracts/v3/MetaObject.js +144 -0
  104. package/dist/src/contracts/v3/Node.js +178 -0
  105. package/dist/src/contracts/v3/NodeSpace.js +284 -0
  106. package/dist/src/contracts/v3/Ownable.js +98 -0
  107. package/dist/src/contracts/v3/PaymentService.js +622 -0
  108. package/dist/src/contracts/v3/Precompile.js +26 -0
  109. package/dist/src/contracts/v3/TenantFuncsBase.js +351 -0
  110. package/dist/src/contracts/v3/Transactable.js +82 -0
  111. package/dist/src/contracts/v3/UserSpace.js +43 -0
  112. package/dist/src/contracts/v3/Utils.js +18 -0
  113. package/dist/src/contracts/v3/Verifier.js +53 -0
  114. package/dist/src/contracts/v3/strings.js +4 -0
  115. package/dist/src/contracts/v3b/BaseAccessControlGroup.js +1704 -0
  116. package/dist/src/events/Topics.js +1793 -0
  117. package/dist/src/index.js +8 -0
  118. package/dist/src/walletClient/ClientMethods.js +3102 -0
  119. package/dist/src/walletClient/Configuration.js +38 -0
  120. package/dist/src/walletClient/Notifications.js +168 -0
  121. package/dist/src/walletClient/Profile.js +332 -0
  122. package/dist/src/walletClient/Utils.js +281 -0
  123. package/dist/src/walletClient/index.js +2109 -0
  124. package/package.json +1 -1
  125. package/src/AuthorizationClient.js +24 -16
  126. package/src/ElvClient.js +19 -0
  127. package/src/client/ContentAccess.js +20 -2
  128. package/src/client/LiveConf.js +10 -8
  129. package/src/client/LiveStream.js +6 -4
@@ -0,0 +1,247 @@
1
+ var _regeneratorRuntime = require("@babel/runtime/regenerator");
2
+ var _typeof = require("@babel/runtime/helpers/typeof");
3
+ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
4
+ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
5
+ var _createClass = require("@babel/runtime/helpers/createClass");
6
+ var Ethers = require("ethers");
7
+ var ElvWallet = /*#__PURE__*/function () {
8
+ "use strict";
9
+
10
+ /**
11
+ * Create a new ElvWallet connected to the given provider
12
+ *
13
+ * NOTE: It is recommended to initialize wallets from the ElvClient, not using this constructor
14
+ *
15
+ * @see ElvClient#GenerateWallet()
16
+ */
17
+ function ElvWallet(provider) {
18
+ _classCallCheck(this, ElvWallet);
19
+ this.provider = provider;
20
+ this.signers = {};
21
+ }
22
+
23
+ /**
24
+ * Generate a mnemonic that can be used to initialize a private key
25
+ *
26
+ * @returns {string} - Space-separated list of random words
27
+ */
28
+ return _createClass(ElvWallet, [{
29
+ key: "GenerateMnemonic",
30
+ value: function GenerateMnemonic() {
31
+ return Ethers.Wallet.createRandom().mnemonic.phrase;
32
+ }
33
+
34
+ /**
35
+ * Generate a private key from the given mnemonic
36
+ *
37
+ * @namedParams
38
+ * @param {string=} accountName - Name of account to save in wallet. Account will be saved in the wallet if provided.
39
+ * @param {string} mnemonic - Mnemonic from which to generate a private key
40
+ *
41
+ * @returns {Signer} - Signer with the generated private key, connected to the provider
42
+ */
43
+ }, {
44
+ key: "AddAccountFromMnemonic",
45
+ value: function AddAccountFromMnemonic(_ref) {
46
+ var accountName = _ref.accountName,
47
+ mnemonic = _ref.mnemonic;
48
+ var signer = Ethers.Wallet.fromMnemonic(mnemonic);
49
+ return this.AddAccount({
50
+ accountName: accountName,
51
+ privateKey: signer.privateKey
52
+ });
53
+ }
54
+
55
+ /**
56
+ * Add an account from an encrypted private key (Ethereum keystore format)
57
+ *
58
+ * @namedParams
59
+ * @param {string=} accountName - Name of account to save in wallet. Account will be saved in the wallet if provided.
60
+ * @param {string} encryptedPrivateKey - Encrypted private key to decrypt
61
+ * @params {string} password - Password with which to decrypt the private key
62
+ *
63
+ * @returns {Promise<Signer>} - Signer with the decrypted private key, connected to the provider
64
+ */
65
+ }, {
66
+ key: "AddAccountFromEncryptedPK",
67
+ value: (function () {
68
+ var _AddAccountFromEncryptedPK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
69
+ var accountName, encryptedPrivateKey, password, signer;
70
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
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();
88
+ }
89
+ }, _callee, this);
90
+ }));
91
+ function AddAccountFromEncryptedPK(_x) {
92
+ return _AddAccountFromEncryptedPK.apply(this, arguments);
93
+ }
94
+ return AddAccountFromEncryptedPK;
95
+ }()
96
+ /**
97
+ * Add an account from a private key (Ethereum keystore format)
98
+ *
99
+ * @namedParams
100
+ * @param {string=} accountName - Name of account to save in wallet. Account will be saved in the wallet if provided.
101
+ * @param {string} privateKey - Private key to use
102
+ *
103
+ * @returns {Signer} - Signer with the private key, connected to the provider
104
+ */
105
+ )
106
+ }, {
107
+ key: "AddAccount",
108
+ value: function AddAccount(_ref3) {
109
+ var accountName = _ref3.accountName,
110
+ privateKey = _ref3.privateKey;
111
+ try {
112
+ var signer = new Ethers.Wallet(privateKey);
113
+ signer = signer.connect(this.provider);
114
+ if (accountName) {
115
+ this.signers[accountName] = signer;
116
+ }
117
+ return signer;
118
+ } catch (error) {
119
+ throw Error("Invalid private key");
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Get the balance of the account. The account to query can be specified either by
125
+ * passing the signer object, or by passing the account name of a saved account
126
+ *
127
+ * Note: Either the signer OR the account name should be specified
128
+ *
129
+ * @namedParams
130
+ * @param {string=} accountName - Saved account to query the account balance of
131
+ * @param {Signer=} signer - Signer to query the account balance of
132
+ *
133
+ * @returns {number} - Account balance of the specified account, in ETH
134
+ */
135
+ }, {
136
+ key: "GetAccountBalance",
137
+ value: (function () {
138
+ var _GetAccountBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4) {
139
+ var accountName, signer, accountSigner;
140
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
141
+ while (1) switch (_context2.prev = _context2.next) {
142
+ case 0:
143
+ accountName = _ref4.accountName, signer = _ref4.signer;
144
+ accountSigner = signer || this.GetAccount({
145
+ accountName: accountName
146
+ });
147
+ if (accountSigner) {
148
+ _context2.next = 4;
149
+ break;
150
+ }
151
+ throw Error("Unknown account: " + accountName);
152
+ case 4:
153
+ _context2.t0 = Ethers.utils;
154
+ _context2.next = 7;
155
+ return accountSigner.getBalance();
156
+ case 7:
157
+ _context2.t1 = _context2.sent;
158
+ return _context2.abrupt("return", _context2.t0.formatEther.call(_context2.t0, _context2.t1));
159
+ case 9:
160
+ case "end":
161
+ return _context2.stop();
162
+ }
163
+ }, _callee2, this);
164
+ }));
165
+ function GetAccountBalance(_x2) {
166
+ return _GetAccountBalance.apply(this, arguments);
167
+ }
168
+ return GetAccountBalance;
169
+ }()
170
+ /**
171
+ * Generate the encrypted private key (Ethereum keystore format) of the signer's private key
172
+ * The private key to decrypt can be specified either by passing the signer object, or by passing
173
+ * the account name of a saved account
174
+ *
175
+ * Note: Either the signer OR the account name should be specified
176
+ *
177
+ * @namedParams
178
+ * @param {string=} accountName - Saved account to encrypt the private key of
179
+ * @param {string=} signer - Signer to encrypt the private key of
180
+ * @param {string} password - Password to encrypt the private key with
181
+ *
182
+ * @returns {Promise<string>} - The encrypted private key (in Ethereum keystore format)
183
+ */
184
+ )
185
+ }, {
186
+ key: "GenerateEncryptedPrivateKey",
187
+ value: (function () {
188
+ var _GenerateEncryptedPrivateKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
189
+ var accountName, signer, password, options, accountSigner;
190
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
191
+ while (1) switch (_context3.prev = _context3.next) {
192
+ case 0:
193
+ accountName = _ref5.accountName, signer = _ref5.signer, password = _ref5.password, options = _ref5.options;
194
+ accountSigner = signer || this.GetAccount({
195
+ accountName: accountName
196
+ });
197
+ if (accountSigner) {
198
+ _context3.next = 4;
199
+ break;
200
+ }
201
+ throw Error("Unknown account: " + accountName);
202
+ case 4:
203
+ _context3.next = 6;
204
+ return accountSigner.encrypt(password, options);
205
+ case 6:
206
+ return _context3.abrupt("return", _context3.sent);
207
+ case 7:
208
+ case "end":
209
+ return _context3.stop();
210
+ }
211
+ }, _callee3, this);
212
+ }));
213
+ function GenerateEncryptedPrivateKey(_x3) {
214
+ return _GenerateEncryptedPrivateKey.apply(this, arguments);
215
+ }
216
+ return GenerateEncryptedPrivateKey;
217
+ }()
218
+ /**
219
+ * Get the signer of a previously saved account by name
220
+ *
221
+ * @namedParams
222
+ * @param {string} accountName - Name of the account
223
+ * @returns {(Signer|undefined)} - Signer of the saved account, if it exists
224
+ */
225
+ )
226
+ }, {
227
+ key: "GetAccount",
228
+ value: function GetAccount(_ref6) {
229
+ var accountName = _ref6.accountName;
230
+ return this.signers[accountName];
231
+ }
232
+
233
+ /**
234
+ * Remove a previously saved account from this wallet
235
+ *
236
+ * @namedParams
237
+ * @param {string} accountName - Name of the account to delete
238
+ */
239
+ }, {
240
+ key: "RemoveAccount",
241
+ value: function RemoveAccount(_ref7) {
242
+ var accountName = _ref7.accountName;
243
+ delete this.signers[accountName];
244
+ }
245
+ }]);
246
+ }();
247
+ module.exports = ElvWallet;