@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.
@@ -514,9 +514,9 @@ if (typeof window !== 'undefined' && window && window.Web3) {
514
514
  var LibsWeb3 = Web3;
515
515
 
516
516
  var name = "@audius/sdk";
517
- var version = "1.0.10";
517
+ var version = "1.0.11";
518
518
  var audius = {
519
- releaseSHA: "c3900f7771f89843401adefd86683fad8657e8f4"
519
+ releaseSHA: "5f2f952b49defef75aab2e13ce086178edf8f66c"
520
520
  };
521
521
  var description = "";
522
522
  var main = "dist/index.cjs.js";
@@ -40828,6 +40828,7 @@ var Action$1;
40828
40828
  Action["CREATE"] = "Create";
40829
40829
  Action["UPDATE"] = "Update";
40830
40830
  Action["DELETE"] = "Delete";
40831
+ Action["VERIFY"] = "Verify";
40831
40832
  })(Action$1 || (Action$1 = {}));
40832
40833
 
40833
40834
  var EntityType$1;
@@ -40855,10 +40856,10 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
40855
40856
  }
40856
40857
 
40857
40858
  _createClass(EntityManagerClient, [{
40858
- key: "manageEntity",
40859
+ key: "getManageEntityParams",
40859
40860
  value: function () {
40860
- var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(userId, entityType, entityId, action, metadataMultihash) {
40861
- var nonce, chainId, contractAddress, signatureData, sig, method, tx;
40861
+ var _getManageEntityParams = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(userId, entityType, entityId, action, metadataMultihash, privateKey) {
40862
+ var nonce, chainId, contractAddress, signatureData, sig, method;
40862
40863
  return regeneratorRuntime.wrap(function _callee$(_context) {
40863
40864
  while (1) {
40864
40865
  switch (_context.prev = _context.next) {
@@ -40875,34 +40876,121 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
40875
40876
  case 6:
40876
40877
  contractAddress = _context.sent;
40877
40878
  signatureData = signatureSchemas.generators.getManageEntityData(chainId, contractAddress, userId, entityType, entityId, action, metadataMultihash, nonce);
40878
- _context.next = 10;
40879
+
40880
+ if (!privateKey) {
40881
+ _context.next = 12;
40882
+ break;
40883
+ }
40884
+
40885
+ sig = sigUtil.signTypedData(Buffer$1.from(privateKey, 'hex'), {
40886
+ data: signatureData
40887
+ });
40888
+ _context.next = 15;
40889
+ break;
40890
+
40891
+ case 12:
40892
+ _context.next = 14;
40879
40893
  return this.web3Manager.signTypedData(signatureData);
40880
40894
 
40881
- case 10:
40895
+ case 14:
40882
40896
  sig = _context.sent;
40883
- _context.next = 13;
40897
+
40898
+ case 15:
40899
+ _context.next = 17;
40884
40900
  return this.getMethod('manageEntity', userId, entityType, entityId, action, metadataMultihash, nonce, sig);
40885
40901
 
40886
- case 13:
40902
+ case 17:
40887
40903
  method = _context.sent;
40888
- _context.next = 16;
40904
+ return _context.abrupt("return", [method.encodeABI(), contractAddress]);
40905
+
40906
+ case 19:
40907
+ case "end":
40908
+ return _context.stop();
40909
+ }
40910
+ }
40911
+ }, _callee, this);
40912
+ }));
40913
+
40914
+ function getManageEntityParams(_x, _x2, _x3, _x4, _x5, _x6) {
40915
+ return _getManageEntityParams.apply(this, arguments);
40916
+ }
40917
+
40918
+ return getManageEntityParams;
40919
+ }()
40920
+ /**
40921
+ * Calls the manage entity method on chain
40922
+ * @param {number} userId The numeric user id
40923
+ * @param {EntityType} entityType The type of entity being modified
40924
+ * @param {number} entityId The id of the entity
40925
+ * @param {Action} action Action being performed on the entity
40926
+ * @param {string} metadataMultihash CID multihash or metadata associated with action
40927
+ * @param {string}privateKey The private key used to sign the transaction
40928
+ */
40929
+
40930
+ }, {
40931
+ key: "manageEntity",
40932
+ value: function () {
40933
+ var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(userId, entityType, entityId, action, metadataMultihash, privateKey) {
40934
+ var nonce, chainId, contractAddress, signatureData, sig, method, tx;
40935
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
40936
+ while (1) {
40937
+ switch (_context2.prev = _context2.next) {
40938
+ case 0:
40939
+ nonce = signatureSchemas.getNonce();
40940
+ _context2.next = 3;
40941
+ return this.getEthNetId();
40942
+
40943
+ case 3:
40944
+ chainId = _context2.sent;
40945
+ _context2.next = 6;
40946
+ return this.getAddress();
40947
+
40948
+ case 6:
40949
+ contractAddress = _context2.sent;
40950
+ signatureData = signatureSchemas.generators.getManageEntityData(chainId, contractAddress, userId, entityType, entityId, action, metadataMultihash, nonce);
40951
+
40952
+ if (!privateKey) {
40953
+ _context2.next = 12;
40954
+ break;
40955
+ }
40956
+
40957
+ sig = sigUtil.signTypedData(Buffer$1.from(privateKey, 'hex'), {
40958
+ data: signatureData
40959
+ });
40960
+ _context2.next = 15;
40961
+ break;
40962
+
40963
+ case 12:
40964
+ _context2.next = 14;
40965
+ return this.web3Manager.signTypedData(signatureData);
40966
+
40967
+ case 14:
40968
+ sig = _context2.sent;
40969
+
40970
+ case 15:
40971
+ _context2.next = 17;
40972
+ return this.getMethod('manageEntity', userId, entityType, entityId, action, metadataMultihash, nonce, sig);
40973
+
40974
+ case 17:
40975
+ method = _context2.sent;
40976
+ _context2.next = 20;
40889
40977
  return this.web3Manager.sendTransaction(method, this.contractRegistryKey, contractAddress);
40890
40978
 
40891
- case 16:
40892
- tx = _context.sent;
40893
- return _context.abrupt("return", {
40979
+ case 20:
40980
+ tx = _context2.sent;
40981
+ return _context2.abrupt("return", {
40894
40982
  txReceipt: tx
40895
40983
  });
40896
40984
 
40897
- case 18:
40985
+ case 22:
40898
40986
  case "end":
40899
- return _context.stop();
40987
+ return _context2.stop();
40900
40988
  }
40901
40989
  }
40902
- }, _callee, this);
40990
+ }, _callee2, this);
40903
40991
  }));
40904
40992
 
40905
- function manageEntity(_x, _x2, _x3, _x4, _x5) {
40993
+ function manageEntity(_x7, _x8, _x9, _x10, _x11, _x12) {
40906
40994
  return _manageEntity.apply(this, arguments);
40907
40995
  }
40908
40996
 
@@ -41268,7 +41356,7 @@ var AudiusContracts = /*#__PURE__*/function () {
41268
41356
  key: "getRegistryAddressForContract",
41269
41357
  value: function () {
41270
41358
  var _getRegistryAddressForContract = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(contractName) {
41271
- var _this$contracts, _this$contractAddress;
41359
+ var _this$contracts, _ref2, _this$contractAddress;
41272
41360
 
41273
41361
  var address;
41274
41362
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
@@ -41276,7 +41364,7 @@ var AudiusContracts = /*#__PURE__*/function () {
41276
41364
  switch (_context4.prev = _context4.next) {
41277
41365
  case 0:
41278
41366
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names
41279
- this.contracts = (_this$contracts = this.contracts) !== null && _this$contracts !== void 0 ? _this$contracts : _defineProperty({}, this.registryAddress, 'registry');
41367
+ 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);
41280
41368
  this.contractAddresses = (_this$contractAddress = this.contractAddresses) !== null && _this$contractAddress !== void 0 ? _this$contractAddress : {
41281
41369
  registry: this.registryAddress
41282
41370
  };
@@ -44199,18 +44287,30 @@ var Users = /*#__PURE__*/function (_Base) {
44199
44287
  }, {
44200
44288
  key: "updateIsVerified",
44201
44289
  value: function () {
44202
- var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(userId, isVerified, privateKey) {
44290
+ var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(userId, isVerified, privateKey, useEntityManager) {
44203
44291
  return regeneratorRuntime.wrap(function _callee16$(_context16) {
44204
44292
  while (1) {
44205
44293
  switch (_context16.prev = _context16.next) {
44206
44294
  case 0:
44207
- _context16.next = 2;
44295
+ if (!useEntityManager) {
44296
+ _context16.next = 6;
44297
+ break;
44298
+ }
44299
+
44300
+ _context16.next = 3;
44301
+ return this.contracts.EntityManagerClient.getManageEntityParams(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.VERIFY, '', privateKey);
44302
+
44303
+ case 3:
44304
+ return _context16.abrupt("return", _context16.sent);
44305
+
44306
+ case 6:
44307
+ _context16.next = 8;
44208
44308
  return this.contracts.UserFactoryClient.updateIsVerified(userId, isVerified, privateKey);
44209
44309
 
44210
- case 2:
44310
+ case 8:
44211
44311
  return _context16.abrupt("return", _context16.sent);
44212
44312
 
44213
- case 3:
44313
+ case 9:
44214
44314
  case "end":
44215
44315
  return _context16.stop();
44216
44316
  }
@@ -44218,7 +44318,7 @@ var Users = /*#__PURE__*/function (_Base) {
44218
44318
  }, _callee16, this);
44219
44319
  }));
44220
44320
 
44221
- function updateIsVerified(_x18, _x19, _x20) {
44321
+ function updateIsVerified(_x18, _x19, _x20, _x21) {
44222
44322
  return _updateIsVerified.apply(this, arguments);
44223
44323
  }
44224
44324
 
@@ -44252,7 +44352,7 @@ var Users = /*#__PURE__*/function (_Base) {
44252
44352
  }, _callee17, this);
44253
44353
  }));
44254
44354
 
44255
- function addUserFollow(_x21) {
44355
+ function addUserFollow(_x22) {
44256
44356
  return _addUserFollow.apply(this, arguments);
44257
44357
  }
44258
44358
 
@@ -44286,7 +44386,7 @@ var Users = /*#__PURE__*/function (_Base) {
44286
44386
  }, _callee18, this);
44287
44387
  }));
44288
44388
 
44289
- function deleteUserFollow(_x22) {
44389
+ function deleteUserFollow(_x23) {
44290
44390
  return _deleteUserFollow.apply(this, arguments);
44291
44391
  }
44292
44392
 
@@ -44493,7 +44593,7 @@ var Users = /*#__PURE__*/function (_Base) {
44493
44593
  }, _callee20, this, [[13, 76]]);
44494
44594
  }));
44495
44595
 
44496
- function updateAndUploadMetadata(_x23) {
44596
+ function updateAndUploadMetadata(_x24) {
44497
44597
  return _updateAndUploadMetadata.apply(this, arguments);
44498
44598
  }
44499
44599
 
@@ -44601,7 +44701,7 @@ var Users = /*#__PURE__*/function (_Base) {
44601
44701
  }, _callee22, this);
44602
44702
  }));
44603
44703
 
44604
- function _waitForCreatorNodeEndpointIndexing(_x24, _x25) {
44704
+ function _waitForCreatorNodeEndpointIndexing(_x25, _x26) {
44605
44705
  return _waitForCreatorNodeEndpointIndexing2.apply(this, arguments);
44606
44706
  }
44607
44707
 
@@ -44704,7 +44804,7 @@ var Users = /*#__PURE__*/function (_Base) {
44704
44804
  }, _callee24);
44705
44805
  }));
44706
44806
 
44707
- function waitForReplicaSetDiscoveryIndexing(_x26, _x27, _x28) {
44807
+ function waitForReplicaSetDiscoveryIndexing(_x27, _x28, _x29) {
44708
44808
  return _waitForReplicaSetDiscoveryIndexing.apply(this, arguments);
44709
44809
  }
44710
44810
 
@@ -44779,7 +44879,7 @@ var Users = /*#__PURE__*/function (_Base) {
44779
44879
  }, _callee26);
44780
44880
  }));
44781
44881
 
44782
- function _waitForURSMCreatorNodeEndpointIndexing(_x29, _x30) {
44882
+ function _waitForURSMCreatorNodeEndpointIndexing(_x30, _x31) {
44783
44883
  return _waitForURSMCreatorNodeEndpointIndexing2.apply(this, arguments);
44784
44884
  }
44785
44885
 
@@ -44865,7 +44965,7 @@ var Users = /*#__PURE__*/function (_Base) {
44865
44965
  }, _callee27, this);
44866
44966
  }));
44867
44967
 
44868
- function _addUserOperations(_x31, _x32) {
44968
+ function _addUserOperations(_x32, _x33) {
44869
44969
  return _addUserOperations2.apply(this, arguments);
44870
44970
  }
44871
44971
 
@@ -44960,7 +45060,7 @@ var Users = /*#__PURE__*/function (_Base) {
44960
45060
  }, _callee28, this);
44961
45061
  }));
44962
45062
 
44963
- function _updateUserOperations(_x33, _x34, _x35) {
45063
+ function _updateUserOperations(_x34, _x35, _x36) {
44964
45064
  return _updateUserOperations2.apply(this, arguments);
44965
45065
  }
44966
45066
 
@@ -45116,7 +45216,7 @@ var Users = /*#__PURE__*/function (_Base) {
45116
45216
  }, _callee29, this, [[17, 27]]);
45117
45217
  }));
45118
45218
 
45119
- function _updateReplicaSetOnChain(_x36, _x37) {
45219
+ function _updateReplicaSetOnChain(_x37, _x38) {
45120
45220
  return _updateReplicaSetOnChain2.apply(this, arguments);
45121
45221
  }
45122
45222
 
@@ -45171,7 +45271,7 @@ var Users = /*#__PURE__*/function (_Base) {
45171
45271
  }, _callee30, this);
45172
45272
  }));
45173
45273
 
45174
- function _retrieveSpIDFromEndpoint(_x38) {
45274
+ function _retrieveSpIDFromEndpoint(_x39) {
45175
45275
  return _retrieveSpIDFromEndpoint2.apply(this, arguments);
45176
45276
  }
45177
45277