@audius/sdk 1.0.10 → 1.0.11

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/legacy.js CHANGED
@@ -34008,9 +34008,9 @@ var formatProviders = function formatProviders(providers) {
34008
34008
  };
34009
34009
 
34010
34010
  var name = "@audius/sdk";
34011
- var version = "1.0.10";
34011
+ var version = "1.0.11";
34012
34012
  var audius = {
34013
- releaseSHA: "c3900f7771f89843401adefd86683fad8657e8f4"
34013
+ releaseSHA: "5f2f952b49defef75aab2e13ce086178edf8f66c"
34014
34014
  };
34015
34015
  var description = "";
34016
34016
  var main = "dist/index.cjs.js";
@@ -46076,6 +46076,7 @@ var Action$1;
46076
46076
  Action["CREATE"] = "Create";
46077
46077
  Action["UPDATE"] = "Update";
46078
46078
  Action["DELETE"] = "Delete";
46079
+ Action["VERIFY"] = "Verify";
46079
46080
  })(Action$1 || (Action$1 = {}));
46080
46081
 
46081
46082
  var EntityType$1;
@@ -46103,10 +46104,10 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
46103
46104
  }
46104
46105
 
46105
46106
  _createClass(EntityManagerClient, [{
46106
- key: "manageEntity",
46107
+ key: "getManageEntityParams",
46107
46108
  value: function () {
46108
- var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(userId, entityType, entityId, action, metadataMultihash) {
46109
- var nonce, chainId, contractAddress, signatureData, sig, method, tx;
46109
+ var _getManageEntityParams = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(userId, entityType, entityId, action, metadataMultihash, privateKey) {
46110
+ var nonce, chainId, contractAddress, signatureData, sig, method;
46110
46111
  return regeneratorRuntime.wrap(function _callee$(_context) {
46111
46112
  while (1) {
46112
46113
  switch (_context.prev = _context.next) {
@@ -46123,34 +46124,121 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
46123
46124
  case 6:
46124
46125
  contractAddress = _context.sent;
46125
46126
  signatureData = signatureSchemas.generators.getManageEntityData(chainId, contractAddress, userId, entityType, entityId, action, metadataMultihash, nonce);
46126
- _context.next = 10;
46127
+
46128
+ if (!privateKey) {
46129
+ _context.next = 12;
46130
+ break;
46131
+ }
46132
+
46133
+ sig = sigUtil__default["default"].signTypedData(safeBuffer.Buffer.from(privateKey, 'hex'), {
46134
+ data: signatureData
46135
+ });
46136
+ _context.next = 15;
46137
+ break;
46138
+
46139
+ case 12:
46140
+ _context.next = 14;
46127
46141
  return this.web3Manager.signTypedData(signatureData);
46128
46142
 
46129
- case 10:
46143
+ case 14:
46130
46144
  sig = _context.sent;
46131
- _context.next = 13;
46145
+
46146
+ case 15:
46147
+ _context.next = 17;
46132
46148
  return this.getMethod('manageEntity', userId, entityType, entityId, action, metadataMultihash, nonce, sig);
46133
46149
 
46134
- case 13:
46150
+ case 17:
46135
46151
  method = _context.sent;
46136
- _context.next = 16;
46152
+ return _context.abrupt("return", [method.encodeABI(), contractAddress]);
46153
+
46154
+ case 19:
46155
+ case "end":
46156
+ return _context.stop();
46157
+ }
46158
+ }
46159
+ }, _callee, this);
46160
+ }));
46161
+
46162
+ function getManageEntityParams(_x, _x2, _x3, _x4, _x5, _x6) {
46163
+ return _getManageEntityParams.apply(this, arguments);
46164
+ }
46165
+
46166
+ return getManageEntityParams;
46167
+ }()
46168
+ /**
46169
+ * Calls the manage entity method on chain
46170
+ * @param {number} userId The numeric user id
46171
+ * @param {EntityType} entityType The type of entity being modified
46172
+ * @param {number} entityId The id of the entity
46173
+ * @param {Action} action Action being performed on the entity
46174
+ * @param {string} metadataMultihash CID multihash or metadata associated with action
46175
+ * @param {string}privateKey The private key used to sign the transaction
46176
+ */
46177
+
46178
+ }, {
46179
+ key: "manageEntity",
46180
+ value: function () {
46181
+ var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(userId, entityType, entityId, action, metadataMultihash, privateKey) {
46182
+ var nonce, chainId, contractAddress, signatureData, sig, method, tx;
46183
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
46184
+ while (1) {
46185
+ switch (_context2.prev = _context2.next) {
46186
+ case 0:
46187
+ nonce = signatureSchemas.getNonce();
46188
+ _context2.next = 3;
46189
+ return this.getEthNetId();
46190
+
46191
+ case 3:
46192
+ chainId = _context2.sent;
46193
+ _context2.next = 6;
46194
+ return this.getAddress();
46195
+
46196
+ case 6:
46197
+ contractAddress = _context2.sent;
46198
+ signatureData = signatureSchemas.generators.getManageEntityData(chainId, contractAddress, userId, entityType, entityId, action, metadataMultihash, nonce);
46199
+
46200
+ if (!privateKey) {
46201
+ _context2.next = 12;
46202
+ break;
46203
+ }
46204
+
46205
+ sig = sigUtil__default["default"].signTypedData(safeBuffer.Buffer.from(privateKey, 'hex'), {
46206
+ data: signatureData
46207
+ });
46208
+ _context2.next = 15;
46209
+ break;
46210
+
46211
+ case 12:
46212
+ _context2.next = 14;
46213
+ return this.web3Manager.signTypedData(signatureData);
46214
+
46215
+ case 14:
46216
+ sig = _context2.sent;
46217
+
46218
+ case 15:
46219
+ _context2.next = 17;
46220
+ return this.getMethod('manageEntity', userId, entityType, entityId, action, metadataMultihash, nonce, sig);
46221
+
46222
+ case 17:
46223
+ method = _context2.sent;
46224
+ _context2.next = 20;
46137
46225
  return this.web3Manager.sendTransaction(method, this.contractRegistryKey, contractAddress);
46138
46226
 
46139
- case 16:
46140
- tx = _context.sent;
46141
- return _context.abrupt("return", {
46227
+ case 20:
46228
+ tx = _context2.sent;
46229
+ return _context2.abrupt("return", {
46142
46230
  txReceipt: tx
46143
46231
  });
46144
46232
 
46145
- case 18:
46233
+ case 22:
46146
46234
  case "end":
46147
- return _context.stop();
46235
+ return _context2.stop();
46148
46236
  }
46149
46237
  }
46150
- }, _callee, this);
46238
+ }, _callee2, this);
46151
46239
  }));
46152
46240
 
46153
- function manageEntity(_x, _x2, _x3, _x4, _x5) {
46241
+ function manageEntity(_x7, _x8, _x9, _x10, _x11, _x12) {
46154
46242
  return _manageEntity.apply(this, arguments);
46155
46243
  }
46156
46244
 
@@ -46516,7 +46604,7 @@ var AudiusContracts = /*#__PURE__*/function () {
46516
46604
  key: "getRegistryAddressForContract",
46517
46605
  value: function () {
46518
46606
  var _getRegistryAddressForContract = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(contractName) {
46519
- var _this$contracts, _this$contractAddress;
46607
+ var _this$contracts, _ref2, _this$contractAddress;
46520
46608
 
46521
46609
  var address;
46522
46610
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
@@ -46524,7 +46612,7 @@ var AudiusContracts = /*#__PURE__*/function () {
46524
46612
  switch (_context4.prev = _context4.next) {
46525
46613
  case 0:
46526
46614
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names
46527
- this.contracts = (_this$contracts = this.contracts) !== null && _this$contracts !== void 0 ? _this$contracts : _defineProperty({}, this.registryAddress, 'registry');
46615
+ this.contracts = (_this$contracts = this.contracts) !== null && _this$contracts !== void 0 ? _this$contracts : (_ref2 = {}, _defineProperty(_ref2, this.registryAddress, 'registry'), _defineProperty(_ref2, this.entityManagerAddress, 'EntityManager'), _ref2);
46528
46616
  this.contractAddresses = (_this$contractAddress = this.contractAddresses) !== null && _this$contractAddress !== void 0 ? _this$contractAddress : {
46529
46617
  registry: this.registryAddress
46530
46618
  };
@@ -54392,18 +54480,30 @@ var Users = /*#__PURE__*/function (_Base) {
54392
54480
  }, {
54393
54481
  key: "updateIsVerified",
54394
54482
  value: function () {
54395
- var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(userId, isVerified, privateKey) {
54483
+ var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(userId, isVerified, privateKey, useEntityManager) {
54396
54484
  return regeneratorRuntime.wrap(function _callee16$(_context16) {
54397
54485
  while (1) {
54398
54486
  switch (_context16.prev = _context16.next) {
54399
54487
  case 0:
54400
- _context16.next = 2;
54488
+ if (!useEntityManager) {
54489
+ _context16.next = 6;
54490
+ break;
54491
+ }
54492
+
54493
+ _context16.next = 3;
54494
+ return this.contracts.EntityManagerClient.getManageEntityParams(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.VERIFY, '', privateKey);
54495
+
54496
+ case 3:
54497
+ return _context16.abrupt("return", _context16.sent);
54498
+
54499
+ case 6:
54500
+ _context16.next = 8;
54401
54501
  return this.contracts.UserFactoryClient.updateIsVerified(userId, isVerified, privateKey);
54402
54502
 
54403
- case 2:
54503
+ case 8:
54404
54504
  return _context16.abrupt("return", _context16.sent);
54405
54505
 
54406
- case 3:
54506
+ case 9:
54407
54507
  case "end":
54408
54508
  return _context16.stop();
54409
54509
  }
@@ -54411,7 +54511,7 @@ var Users = /*#__PURE__*/function (_Base) {
54411
54511
  }, _callee16, this);
54412
54512
  }));
54413
54513
 
54414
- function updateIsVerified(_x18, _x19, _x20) {
54514
+ function updateIsVerified(_x18, _x19, _x20, _x21) {
54415
54515
  return _updateIsVerified.apply(this, arguments);
54416
54516
  }
54417
54517
 
@@ -54445,7 +54545,7 @@ var Users = /*#__PURE__*/function (_Base) {
54445
54545
  }, _callee17, this);
54446
54546
  }));
54447
54547
 
54448
- function addUserFollow(_x21) {
54548
+ function addUserFollow(_x22) {
54449
54549
  return _addUserFollow.apply(this, arguments);
54450
54550
  }
54451
54551
 
@@ -54479,7 +54579,7 @@ var Users = /*#__PURE__*/function (_Base) {
54479
54579
  }, _callee18, this);
54480
54580
  }));
54481
54581
 
54482
- function deleteUserFollow(_x22) {
54582
+ function deleteUserFollow(_x23) {
54483
54583
  return _deleteUserFollow.apply(this, arguments);
54484
54584
  }
54485
54585
 
@@ -54686,7 +54786,7 @@ var Users = /*#__PURE__*/function (_Base) {
54686
54786
  }, _callee20, this, [[13, 76]]);
54687
54787
  }));
54688
54788
 
54689
- function updateAndUploadMetadata(_x23) {
54789
+ function updateAndUploadMetadata(_x24) {
54690
54790
  return _updateAndUploadMetadata.apply(this, arguments);
54691
54791
  }
54692
54792
 
@@ -54794,7 +54894,7 @@ var Users = /*#__PURE__*/function (_Base) {
54794
54894
  }, _callee22, this);
54795
54895
  }));
54796
54896
 
54797
- function _waitForCreatorNodeEndpointIndexing(_x24, _x25) {
54897
+ function _waitForCreatorNodeEndpointIndexing(_x25, _x26) {
54798
54898
  return _waitForCreatorNodeEndpointIndexing2.apply(this, arguments);
54799
54899
  }
54800
54900
 
@@ -54897,7 +54997,7 @@ var Users = /*#__PURE__*/function (_Base) {
54897
54997
  }, _callee24);
54898
54998
  }));
54899
54999
 
54900
- function waitForReplicaSetDiscoveryIndexing(_x26, _x27, _x28) {
55000
+ function waitForReplicaSetDiscoveryIndexing(_x27, _x28, _x29) {
54901
55001
  return _waitForReplicaSetDiscoveryIndexing.apply(this, arguments);
54902
55002
  }
54903
55003
 
@@ -54972,7 +55072,7 @@ var Users = /*#__PURE__*/function (_Base) {
54972
55072
  }, _callee26);
54973
55073
  }));
54974
55074
 
54975
- function _waitForURSMCreatorNodeEndpointIndexing(_x29, _x30) {
55075
+ function _waitForURSMCreatorNodeEndpointIndexing(_x30, _x31) {
54976
55076
  return _waitForURSMCreatorNodeEndpointIndexing2.apply(this, arguments);
54977
55077
  }
54978
55078
 
@@ -55058,7 +55158,7 @@ var Users = /*#__PURE__*/function (_Base) {
55058
55158
  }, _callee27, this);
55059
55159
  }));
55060
55160
 
55061
- function _addUserOperations(_x31, _x32) {
55161
+ function _addUserOperations(_x32, _x33) {
55062
55162
  return _addUserOperations2.apply(this, arguments);
55063
55163
  }
55064
55164
 
@@ -55153,7 +55253,7 @@ var Users = /*#__PURE__*/function (_Base) {
55153
55253
  }, _callee28, this);
55154
55254
  }));
55155
55255
 
55156
- function _updateUserOperations(_x33, _x34, _x35) {
55256
+ function _updateUserOperations(_x34, _x35, _x36) {
55157
55257
  return _updateUserOperations2.apply(this, arguments);
55158
55258
  }
55159
55259
 
@@ -55309,7 +55409,7 @@ var Users = /*#__PURE__*/function (_Base) {
55309
55409
  }, _callee29, this, [[17, 27]]);
55310
55410
  }));
55311
55411
 
55312
- function _updateReplicaSetOnChain(_x36, _x37) {
55412
+ function _updateReplicaSetOnChain(_x37, _x38) {
55313
55413
  return _updateReplicaSetOnChain2.apply(this, arguments);
55314
55414
  }
55315
55415
 
@@ -55364,7 +55464,7 @@ var Users = /*#__PURE__*/function (_Base) {
55364
55464
  }, _callee30, this);
55365
55465
  }));
55366
55466
 
55367
- function _retrieveSpIDFromEndpoint(_x38) {
55467
+ function _retrieveSpIDFromEndpoint(_x39) {
55368
55468
  return _retrieveSpIDFromEndpoint2.apply(this, arguments);
55369
55469
  }
55370
55470