@audius/sdk 1.0.10 → 1.0.12

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/index.esm.js CHANGED
@@ -33963,9 +33963,9 @@ var formatProviders = function formatProviders(providers) {
33963
33963
  };
33964
33964
 
33965
33965
  var name = "@audius/sdk";
33966
- var version = "1.0.10";
33966
+ var version = "1.0.12";
33967
33967
  var audius = {
33968
- releaseSHA: "c3900f7771f89843401adefd86683fad8657e8f4"
33968
+ releaseSHA: "78388a5771c4a3dca52d6805824b8710b17bb280"
33969
33969
  };
33970
33970
  var description = "";
33971
33971
  var main = "dist/index.cjs.js";
@@ -46031,6 +46031,7 @@ var Action$1;
46031
46031
  Action["CREATE"] = "Create";
46032
46032
  Action["UPDATE"] = "Update";
46033
46033
  Action["DELETE"] = "Delete";
46034
+ Action["VERIFY"] = "Verify";
46034
46035
  })(Action$1 || (Action$1 = {}));
46035
46036
 
46036
46037
  var EntityType$1;
@@ -46058,10 +46059,10 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
46058
46059
  }
46059
46060
 
46060
46061
  _createClass(EntityManagerClient, [{
46061
- key: "manageEntity",
46062
+ key: "getManageEntityParams",
46062
46063
  value: function () {
46063
- var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(userId, entityType, entityId, action, metadataMultihash) {
46064
- var nonce, chainId, contractAddress, signatureData, sig, method, tx;
46064
+ var _getManageEntityParams = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(userId, entityType, entityId, action, metadataMultihash, privateKey) {
46065
+ var nonce, chainId, contractAddress, signatureData, sig, method;
46065
46066
  return regeneratorRuntime.wrap(function _callee$(_context) {
46066
46067
  while (1) {
46067
46068
  switch (_context.prev = _context.next) {
@@ -46078,34 +46079,121 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
46078
46079
  case 6:
46079
46080
  contractAddress = _context.sent;
46080
46081
  signatureData = signatureSchemas.generators.getManageEntityData(chainId, contractAddress, userId, entityType, entityId, action, metadataMultihash, nonce);
46081
- _context.next = 10;
46082
+
46083
+ if (!privateKey) {
46084
+ _context.next = 12;
46085
+ break;
46086
+ }
46087
+
46088
+ sig = sigUtil.signTypedData(Buffer$1.from(privateKey, 'hex'), {
46089
+ data: signatureData
46090
+ });
46091
+ _context.next = 15;
46092
+ break;
46093
+
46094
+ case 12:
46095
+ _context.next = 14;
46082
46096
  return this.web3Manager.signTypedData(signatureData);
46083
46097
 
46084
- case 10:
46098
+ case 14:
46085
46099
  sig = _context.sent;
46086
- _context.next = 13;
46100
+
46101
+ case 15:
46102
+ _context.next = 17;
46087
46103
  return this.getMethod('manageEntity', userId, entityType, entityId, action, metadataMultihash, nonce, sig);
46088
46104
 
46089
- case 13:
46105
+ case 17:
46090
46106
  method = _context.sent;
46091
- _context.next = 16;
46107
+ return _context.abrupt("return", [method.encodeABI(), contractAddress]);
46108
+
46109
+ case 19:
46110
+ case "end":
46111
+ return _context.stop();
46112
+ }
46113
+ }
46114
+ }, _callee, this);
46115
+ }));
46116
+
46117
+ function getManageEntityParams(_x, _x2, _x3, _x4, _x5, _x6) {
46118
+ return _getManageEntityParams.apply(this, arguments);
46119
+ }
46120
+
46121
+ return getManageEntityParams;
46122
+ }()
46123
+ /**
46124
+ * Calls the manage entity method on chain
46125
+ * @param {number} userId The numeric user id
46126
+ * @param {EntityType} entityType The type of entity being modified
46127
+ * @param {number} entityId The id of the entity
46128
+ * @param {Action} action Action being performed on the entity
46129
+ * @param {string} metadataMultihash CID multihash or metadata associated with action
46130
+ * @param {string}privateKey The private key used to sign the transaction
46131
+ */
46132
+
46133
+ }, {
46134
+ key: "manageEntity",
46135
+ value: function () {
46136
+ var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(userId, entityType, entityId, action, metadataMultihash, privateKey) {
46137
+ var nonce, chainId, contractAddress, signatureData, sig, method, tx;
46138
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
46139
+ while (1) {
46140
+ switch (_context2.prev = _context2.next) {
46141
+ case 0:
46142
+ nonce = signatureSchemas.getNonce();
46143
+ _context2.next = 3;
46144
+ return this.getEthNetId();
46145
+
46146
+ case 3:
46147
+ chainId = _context2.sent;
46148
+ _context2.next = 6;
46149
+ return this.getAddress();
46150
+
46151
+ case 6:
46152
+ contractAddress = _context2.sent;
46153
+ signatureData = signatureSchemas.generators.getManageEntityData(chainId, contractAddress, userId, entityType, entityId, action, metadataMultihash, nonce);
46154
+
46155
+ if (!privateKey) {
46156
+ _context2.next = 12;
46157
+ break;
46158
+ }
46159
+
46160
+ sig = sigUtil.signTypedData(Buffer$1.from(privateKey, 'hex'), {
46161
+ data: signatureData
46162
+ });
46163
+ _context2.next = 15;
46164
+ break;
46165
+
46166
+ case 12:
46167
+ _context2.next = 14;
46168
+ return this.web3Manager.signTypedData(signatureData);
46169
+
46170
+ case 14:
46171
+ sig = _context2.sent;
46172
+
46173
+ case 15:
46174
+ _context2.next = 17;
46175
+ return this.getMethod('manageEntity', userId, entityType, entityId, action, metadataMultihash, nonce, sig);
46176
+
46177
+ case 17:
46178
+ method = _context2.sent;
46179
+ _context2.next = 20;
46092
46180
  return this.web3Manager.sendTransaction(method, this.contractRegistryKey, contractAddress);
46093
46181
 
46094
- case 16:
46095
- tx = _context.sent;
46096
- return _context.abrupt("return", {
46182
+ case 20:
46183
+ tx = _context2.sent;
46184
+ return _context2.abrupt("return", {
46097
46185
  txReceipt: tx
46098
46186
  });
46099
46187
 
46100
- case 18:
46188
+ case 22:
46101
46189
  case "end":
46102
- return _context.stop();
46190
+ return _context2.stop();
46103
46191
  }
46104
46192
  }
46105
- }, _callee, this);
46193
+ }, _callee2, this);
46106
46194
  }));
46107
46195
 
46108
- function manageEntity(_x, _x2, _x3, _x4, _x5) {
46196
+ function manageEntity(_x7, _x8, _x9, _x10, _x11, _x12) {
46109
46197
  return _manageEntity.apply(this, arguments);
46110
46198
  }
46111
46199
 
@@ -46471,7 +46559,7 @@ var AudiusContracts = /*#__PURE__*/function () {
46471
46559
  key: "getRegistryAddressForContract",
46472
46560
  value: function () {
46473
46561
  var _getRegistryAddressForContract = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(contractName) {
46474
- var _this$contracts, _this$contractAddress;
46562
+ var _this$contracts, _ref2, _this$contractAddress;
46475
46563
 
46476
46564
  var address;
46477
46565
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
@@ -46479,7 +46567,7 @@ var AudiusContracts = /*#__PURE__*/function () {
46479
46567
  switch (_context4.prev = _context4.next) {
46480
46568
  case 0:
46481
46569
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names
46482
- this.contracts = (_this$contracts = this.contracts) !== null && _this$contracts !== void 0 ? _this$contracts : _defineProperty({}, this.registryAddress, 'registry');
46570
+ 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);
46483
46571
  this.contractAddresses = (_this$contractAddress = this.contractAddresses) !== null && _this$contractAddress !== void 0 ? _this$contractAddress : {
46484
46572
  registry: this.registryAddress
46485
46573
  };
@@ -50415,7 +50503,7 @@ var CreatorNodeSelection = /*#__PURE__*/function (_ServiceSelection) {
50415
50503
  return CreatorNodeSelection;
50416
50504
  }(ServiceSelection);
50417
50505
 
50418
- /** Singleton state-manager for Audius Eth Contracts */
50506
+ /** Singleton state-manager for audius wormhole interaction */
50419
50507
 
50420
50508
  var Wormhole = /*#__PURE__*/function () {
50421
50509
  function Wormhole(hedgehog, ethWeb3Manager, ethContracts, identityService, solanaWeb3Manager, rpcHosts, solBridgeAddress, solTokenBridgeAddress, ethBridgeAddress, ethTokenBridgeAddress) {
@@ -54347,18 +54435,30 @@ var Users = /*#__PURE__*/function (_Base) {
54347
54435
  }, {
54348
54436
  key: "updateIsVerified",
54349
54437
  value: function () {
54350
- var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(userId, isVerified, privateKey) {
54438
+ var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(userId, isVerified, privateKey, useEntityManager) {
54351
54439
  return regeneratorRuntime.wrap(function _callee16$(_context16) {
54352
54440
  while (1) {
54353
54441
  switch (_context16.prev = _context16.next) {
54354
54442
  case 0:
54355
- _context16.next = 2;
54443
+ if (!useEntityManager) {
54444
+ _context16.next = 6;
54445
+ break;
54446
+ }
54447
+
54448
+ _context16.next = 3;
54449
+ return this.contracts.EntityManagerClient.getManageEntityParams(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.VERIFY, '', privateKey);
54450
+
54451
+ case 3:
54452
+ return _context16.abrupt("return", _context16.sent);
54453
+
54454
+ case 6:
54455
+ _context16.next = 8;
54356
54456
  return this.contracts.UserFactoryClient.updateIsVerified(userId, isVerified, privateKey);
54357
54457
 
54358
- case 2:
54458
+ case 8:
54359
54459
  return _context16.abrupt("return", _context16.sent);
54360
54460
 
54361
- case 3:
54461
+ case 9:
54362
54462
  case "end":
54363
54463
  return _context16.stop();
54364
54464
  }
@@ -54366,7 +54466,7 @@ var Users = /*#__PURE__*/function (_Base) {
54366
54466
  }, _callee16, this);
54367
54467
  }));
54368
54468
 
54369
- function updateIsVerified(_x18, _x19, _x20) {
54469
+ function updateIsVerified(_x18, _x19, _x20, _x21) {
54370
54470
  return _updateIsVerified.apply(this, arguments);
54371
54471
  }
54372
54472
 
@@ -54400,7 +54500,7 @@ var Users = /*#__PURE__*/function (_Base) {
54400
54500
  }, _callee17, this);
54401
54501
  }));
54402
54502
 
54403
- function addUserFollow(_x21) {
54503
+ function addUserFollow(_x22) {
54404
54504
  return _addUserFollow.apply(this, arguments);
54405
54505
  }
54406
54506
 
@@ -54434,7 +54534,7 @@ var Users = /*#__PURE__*/function (_Base) {
54434
54534
  }, _callee18, this);
54435
54535
  }));
54436
54536
 
54437
- function deleteUserFollow(_x22) {
54537
+ function deleteUserFollow(_x23) {
54438
54538
  return _deleteUserFollow.apply(this, arguments);
54439
54539
  }
54440
54540
 
@@ -54641,7 +54741,7 @@ var Users = /*#__PURE__*/function (_Base) {
54641
54741
  }, _callee20, this, [[13, 76]]);
54642
54742
  }));
54643
54743
 
54644
- function updateAndUploadMetadata(_x23) {
54744
+ function updateAndUploadMetadata(_x24) {
54645
54745
  return _updateAndUploadMetadata.apply(this, arguments);
54646
54746
  }
54647
54747
 
@@ -54749,7 +54849,7 @@ var Users = /*#__PURE__*/function (_Base) {
54749
54849
  }, _callee22, this);
54750
54850
  }));
54751
54851
 
54752
- function _waitForCreatorNodeEndpointIndexing(_x24, _x25) {
54852
+ function _waitForCreatorNodeEndpointIndexing(_x25, _x26) {
54753
54853
  return _waitForCreatorNodeEndpointIndexing2.apply(this, arguments);
54754
54854
  }
54755
54855
 
@@ -54852,7 +54952,7 @@ var Users = /*#__PURE__*/function (_Base) {
54852
54952
  }, _callee24);
54853
54953
  }));
54854
54954
 
54855
- function waitForReplicaSetDiscoveryIndexing(_x26, _x27, _x28) {
54955
+ function waitForReplicaSetDiscoveryIndexing(_x27, _x28, _x29) {
54856
54956
  return _waitForReplicaSetDiscoveryIndexing.apply(this, arguments);
54857
54957
  }
54858
54958
 
@@ -54927,7 +55027,7 @@ var Users = /*#__PURE__*/function (_Base) {
54927
55027
  }, _callee26);
54928
55028
  }));
54929
55029
 
54930
- function _waitForURSMCreatorNodeEndpointIndexing(_x29, _x30) {
55030
+ function _waitForURSMCreatorNodeEndpointIndexing(_x30, _x31) {
54931
55031
  return _waitForURSMCreatorNodeEndpointIndexing2.apply(this, arguments);
54932
55032
  }
54933
55033
 
@@ -55013,7 +55113,7 @@ var Users = /*#__PURE__*/function (_Base) {
55013
55113
  }, _callee27, this);
55014
55114
  }));
55015
55115
 
55016
- function _addUserOperations(_x31, _x32) {
55116
+ function _addUserOperations(_x32, _x33) {
55017
55117
  return _addUserOperations2.apply(this, arguments);
55018
55118
  }
55019
55119
 
@@ -55108,7 +55208,7 @@ var Users = /*#__PURE__*/function (_Base) {
55108
55208
  }, _callee28, this);
55109
55209
  }));
55110
55210
 
55111
- function _updateUserOperations(_x33, _x34, _x35) {
55211
+ function _updateUserOperations(_x34, _x35, _x36) {
55112
55212
  return _updateUserOperations2.apply(this, arguments);
55113
55213
  }
55114
55214
 
@@ -55264,7 +55364,7 @@ var Users = /*#__PURE__*/function (_Base) {
55264
55364
  }, _callee29, this, [[17, 27]]);
55265
55365
  }));
55266
55366
 
55267
- function _updateReplicaSetOnChain(_x36, _x37) {
55367
+ function _updateReplicaSetOnChain(_x37, _x38) {
55268
55368
  return _updateReplicaSetOnChain2.apply(this, arguments);
55269
55369
  }
55270
55370
 
@@ -55319,7 +55419,7 @@ var Users = /*#__PURE__*/function (_Base) {
55319
55419
  }, _callee30, this);
55320
55420
  }));
55321
55421
 
55322
- function _retrieveSpIDFromEndpoint(_x38) {
55422
+ function _retrieveSpIDFromEndpoint(_x39) {
55323
55423
  return _retrieveSpIDFromEndpoint2.apply(this, arguments);
55324
55424
  }
55325
55425