@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.
@@ -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.12";
518
518
  var audius = {
519
- releaseSHA: "c3900f7771f89843401adefd86683fad8657e8f4"
519
+ releaseSHA: "78388a5771c4a3dca52d6805824b8710b17bb280"
520
520
  };
521
521
  var description = "";
522
522
  var main = "dist/index.cjs.js";
@@ -2368,6 +2368,16 @@ var getPermitTypehash = function getPermitTypehash() {
2368
2368
 
2369
2369
  return _permitTypehash;
2370
2370
  };
2371
+
2372
+ var _transferTokensTypehash = null;
2373
+
2374
+ var getTransferTokensTypeHash = function getTransferTokensTypeHash() {
2375
+ if (!_transferTokensTypehash) {
2376
+ _transferTokensTypehash = Utils.keccak256('TransferTokens(address from,uint256 amount,uint16 recipientChain,bytes32 recipient,uint256 artbiterFee,uint32 nonce,uint256 deadline)');
2377
+ }
2378
+
2379
+ return _transferTokensTypehash;
2380
+ }; // Returns the EIP712 hash which should be signed by the user
2371
2381
  // in order to make a call to `permit`
2372
2382
 
2373
2383
 
@@ -2377,6 +2387,14 @@ function getPermitDigest(web3, name, address, chainId, approve, nonce, deadline)
2377
2387
  var encoded = pack(['bytes1', 'bytes1', 'bytes32', 'bytes32'], ['0x19', '0x01', DOMAIN_SEPARATOR, Utils.keccak256(innerEncoded)]);
2378
2388
  return Utils.keccak256(encoded);
2379
2389
  } // Returns the EIP712 hash which should be signed by the user
2390
+ // in order to make a call to `transferTokens`
2391
+
2392
+ function getTransferTokensDigest(web3, name, address, chainId, transferTokens, nonce, deadline) {
2393
+ var DOMAIN_SEPARATOR = getDomainSeparator(web3, name, address, chainId);
2394
+ var innerEncoded = web3.eth.abi.encodeParameters(['bytes32', 'address', 'uint256', 'uint16', 'bytes32', 'uint256', 'uint32', 'uint256'], [getTransferTokensTypeHash(), transferTokens.from, transferTokens.amount, transferTokens.recipientChain, transferTokens.recipient, transferTokens.arbiterFee, nonce, deadline]);
2395
+ var encoded = pack(['bytes1', 'bytes1', 'bytes32', 'bytes32'], ['0x19', '0x01', DOMAIN_SEPARATOR, Utils.keccak256(innerEncoded)]);
2396
+ return Utils.keccak256(encoded);
2397
+ } // Gets the EIP712 domain separator
2380
2398
 
2381
2399
  function getDomainSeparator(web3, name, contractAddress, chainId) {
2382
2400
  var encoded = web3.eth.abi.encodeParameters(['bytes32', 'bytes32', 'bytes32', 'uint256', 'address'], [Utils.keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), Utils.keccak256(name), Utils.keccak256('1'), chainId, contractAddress]);
@@ -40828,6 +40846,7 @@ var Action$1;
40828
40846
  Action["CREATE"] = "Create";
40829
40847
  Action["UPDATE"] = "Update";
40830
40848
  Action["DELETE"] = "Delete";
40849
+ Action["VERIFY"] = "Verify";
40831
40850
  })(Action$1 || (Action$1 = {}));
40832
40851
 
40833
40852
  var EntityType$1;
@@ -40855,10 +40874,10 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
40855
40874
  }
40856
40875
 
40857
40876
  _createClass(EntityManagerClient, [{
40858
- key: "manageEntity",
40877
+ key: "getManageEntityParams",
40859
40878
  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;
40879
+ var _getManageEntityParams = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(userId, entityType, entityId, action, metadataMultihash, privateKey) {
40880
+ var nonce, chainId, contractAddress, signatureData, sig, method;
40862
40881
  return regeneratorRuntime.wrap(function _callee$(_context) {
40863
40882
  while (1) {
40864
40883
  switch (_context.prev = _context.next) {
@@ -40875,34 +40894,121 @@ var EntityManagerClient = /*#__PURE__*/function (_ContractClient) {
40875
40894
  case 6:
40876
40895
  contractAddress = _context.sent;
40877
40896
  signatureData = signatureSchemas.generators.getManageEntityData(chainId, contractAddress, userId, entityType, entityId, action, metadataMultihash, nonce);
40878
- _context.next = 10;
40897
+
40898
+ if (!privateKey) {
40899
+ _context.next = 12;
40900
+ break;
40901
+ }
40902
+
40903
+ sig = sigUtil.signTypedData(Buffer$1.from(privateKey, 'hex'), {
40904
+ data: signatureData
40905
+ });
40906
+ _context.next = 15;
40907
+ break;
40908
+
40909
+ case 12:
40910
+ _context.next = 14;
40879
40911
  return this.web3Manager.signTypedData(signatureData);
40880
40912
 
40881
- case 10:
40913
+ case 14:
40882
40914
  sig = _context.sent;
40883
- _context.next = 13;
40915
+
40916
+ case 15:
40917
+ _context.next = 17;
40884
40918
  return this.getMethod('manageEntity', userId, entityType, entityId, action, metadataMultihash, nonce, sig);
40885
40919
 
40886
- case 13:
40920
+ case 17:
40887
40921
  method = _context.sent;
40888
- _context.next = 16;
40922
+ return _context.abrupt("return", [method.encodeABI(), contractAddress]);
40923
+
40924
+ case 19:
40925
+ case "end":
40926
+ return _context.stop();
40927
+ }
40928
+ }
40929
+ }, _callee, this);
40930
+ }));
40931
+
40932
+ function getManageEntityParams(_x, _x2, _x3, _x4, _x5, _x6) {
40933
+ return _getManageEntityParams.apply(this, arguments);
40934
+ }
40935
+
40936
+ return getManageEntityParams;
40937
+ }()
40938
+ /**
40939
+ * Calls the manage entity method on chain
40940
+ * @param {number} userId The numeric user id
40941
+ * @param {EntityType} entityType The type of entity being modified
40942
+ * @param {number} entityId The id of the entity
40943
+ * @param {Action} action Action being performed on the entity
40944
+ * @param {string} metadataMultihash CID multihash or metadata associated with action
40945
+ * @param {string}privateKey The private key used to sign the transaction
40946
+ */
40947
+
40948
+ }, {
40949
+ key: "manageEntity",
40950
+ value: function () {
40951
+ var _manageEntity = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(userId, entityType, entityId, action, metadataMultihash, privateKey) {
40952
+ var nonce, chainId, contractAddress, signatureData, sig, method, tx;
40953
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
40954
+ while (1) {
40955
+ switch (_context2.prev = _context2.next) {
40956
+ case 0:
40957
+ nonce = signatureSchemas.getNonce();
40958
+ _context2.next = 3;
40959
+ return this.getEthNetId();
40960
+
40961
+ case 3:
40962
+ chainId = _context2.sent;
40963
+ _context2.next = 6;
40964
+ return this.getAddress();
40965
+
40966
+ case 6:
40967
+ contractAddress = _context2.sent;
40968
+ signatureData = signatureSchemas.generators.getManageEntityData(chainId, contractAddress, userId, entityType, entityId, action, metadataMultihash, nonce);
40969
+
40970
+ if (!privateKey) {
40971
+ _context2.next = 12;
40972
+ break;
40973
+ }
40974
+
40975
+ sig = sigUtil.signTypedData(Buffer$1.from(privateKey, 'hex'), {
40976
+ data: signatureData
40977
+ });
40978
+ _context2.next = 15;
40979
+ break;
40980
+
40981
+ case 12:
40982
+ _context2.next = 14;
40983
+ return this.web3Manager.signTypedData(signatureData);
40984
+
40985
+ case 14:
40986
+ sig = _context2.sent;
40987
+
40988
+ case 15:
40989
+ _context2.next = 17;
40990
+ return this.getMethod('manageEntity', userId, entityType, entityId, action, metadataMultihash, nonce, sig);
40991
+
40992
+ case 17:
40993
+ method = _context2.sent;
40994
+ _context2.next = 20;
40889
40995
  return this.web3Manager.sendTransaction(method, this.contractRegistryKey, contractAddress);
40890
40996
 
40891
- case 16:
40892
- tx = _context.sent;
40893
- return _context.abrupt("return", {
40997
+ case 20:
40998
+ tx = _context2.sent;
40999
+ return _context2.abrupt("return", {
40894
41000
  txReceipt: tx
40895
41001
  });
40896
41002
 
40897
- case 18:
41003
+ case 22:
40898
41004
  case "end":
40899
- return _context.stop();
41005
+ return _context2.stop();
40900
41006
  }
40901
41007
  }
40902
- }, _callee, this);
41008
+ }, _callee2, this);
40903
41009
  }));
40904
41010
 
40905
- function manageEntity(_x, _x2, _x3, _x4, _x5) {
41011
+ function manageEntity(_x7, _x8, _x9, _x10, _x11, _x12) {
40906
41012
  return _manageEntity.apply(this, arguments);
40907
41013
  }
40908
41014
 
@@ -41268,7 +41374,7 @@ var AudiusContracts = /*#__PURE__*/function () {
41268
41374
  key: "getRegistryAddressForContract",
41269
41375
  value: function () {
41270
41376
  var _getRegistryAddressForContract = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(contractName) {
41271
- var _this$contracts, _this$contractAddress;
41377
+ var _this$contracts, _ref2, _this$contractAddress;
41272
41378
 
41273
41379
  var address;
41274
41380
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
@@ -41276,7 +41382,7 @@ var AudiusContracts = /*#__PURE__*/function () {
41276
41382
  switch (_context4.prev = _context4.next) {
41277
41383
  case 0:
41278
41384
  // 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');
41385
+ 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
41386
  this.contractAddresses = (_this$contractAddress = this.contractAddresses) !== null && _this$contractAddress !== void 0 ? _this$contractAddress : {
41281
41387
  registry: this.registryAddress
41282
41388
  };
@@ -44199,18 +44305,30 @@ var Users = /*#__PURE__*/function (_Base) {
44199
44305
  }, {
44200
44306
  key: "updateIsVerified",
44201
44307
  value: function () {
44202
- var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(userId, isVerified, privateKey) {
44308
+ var _updateIsVerified = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(userId, isVerified, privateKey, useEntityManager) {
44203
44309
  return regeneratorRuntime.wrap(function _callee16$(_context16) {
44204
44310
  while (1) {
44205
44311
  switch (_context16.prev = _context16.next) {
44206
44312
  case 0:
44207
- _context16.next = 2;
44313
+ if (!useEntityManager) {
44314
+ _context16.next = 6;
44315
+ break;
44316
+ }
44317
+
44318
+ _context16.next = 3;
44319
+ return this.contracts.EntityManagerClient.getManageEntityParams(userId, EntityManagerClient.EntityType.USER, userId, EntityManagerClient.Action.VERIFY, '', privateKey);
44320
+
44321
+ case 3:
44322
+ return _context16.abrupt("return", _context16.sent);
44323
+
44324
+ case 6:
44325
+ _context16.next = 8;
44208
44326
  return this.contracts.UserFactoryClient.updateIsVerified(userId, isVerified, privateKey);
44209
44327
 
44210
- case 2:
44328
+ case 8:
44211
44329
  return _context16.abrupt("return", _context16.sent);
44212
44330
 
44213
- case 3:
44331
+ case 9:
44214
44332
  case "end":
44215
44333
  return _context16.stop();
44216
44334
  }
@@ -44218,7 +44336,7 @@ var Users = /*#__PURE__*/function (_Base) {
44218
44336
  }, _callee16, this);
44219
44337
  }));
44220
44338
 
44221
- function updateIsVerified(_x18, _x19, _x20) {
44339
+ function updateIsVerified(_x18, _x19, _x20, _x21) {
44222
44340
  return _updateIsVerified.apply(this, arguments);
44223
44341
  }
44224
44342
 
@@ -44252,7 +44370,7 @@ var Users = /*#__PURE__*/function (_Base) {
44252
44370
  }, _callee17, this);
44253
44371
  }));
44254
44372
 
44255
- function addUserFollow(_x21) {
44373
+ function addUserFollow(_x22) {
44256
44374
  return _addUserFollow.apply(this, arguments);
44257
44375
  }
44258
44376
 
@@ -44286,7 +44404,7 @@ var Users = /*#__PURE__*/function (_Base) {
44286
44404
  }, _callee18, this);
44287
44405
  }));
44288
44406
 
44289
- function deleteUserFollow(_x22) {
44407
+ function deleteUserFollow(_x23) {
44290
44408
  return _deleteUserFollow.apply(this, arguments);
44291
44409
  }
44292
44410
 
@@ -44493,7 +44611,7 @@ var Users = /*#__PURE__*/function (_Base) {
44493
44611
  }, _callee20, this, [[13, 76]]);
44494
44612
  }));
44495
44613
 
44496
- function updateAndUploadMetadata(_x23) {
44614
+ function updateAndUploadMetadata(_x24) {
44497
44615
  return _updateAndUploadMetadata.apply(this, arguments);
44498
44616
  }
44499
44617
 
@@ -44601,7 +44719,7 @@ var Users = /*#__PURE__*/function (_Base) {
44601
44719
  }, _callee22, this);
44602
44720
  }));
44603
44721
 
44604
- function _waitForCreatorNodeEndpointIndexing(_x24, _x25) {
44722
+ function _waitForCreatorNodeEndpointIndexing(_x25, _x26) {
44605
44723
  return _waitForCreatorNodeEndpointIndexing2.apply(this, arguments);
44606
44724
  }
44607
44725
 
@@ -44704,7 +44822,7 @@ var Users = /*#__PURE__*/function (_Base) {
44704
44822
  }, _callee24);
44705
44823
  }));
44706
44824
 
44707
- function waitForReplicaSetDiscoveryIndexing(_x26, _x27, _x28) {
44825
+ function waitForReplicaSetDiscoveryIndexing(_x27, _x28, _x29) {
44708
44826
  return _waitForReplicaSetDiscoveryIndexing.apply(this, arguments);
44709
44827
  }
44710
44828
 
@@ -44779,7 +44897,7 @@ var Users = /*#__PURE__*/function (_Base) {
44779
44897
  }, _callee26);
44780
44898
  }));
44781
44899
 
44782
- function _waitForURSMCreatorNodeEndpointIndexing(_x29, _x30) {
44900
+ function _waitForURSMCreatorNodeEndpointIndexing(_x30, _x31) {
44783
44901
  return _waitForURSMCreatorNodeEndpointIndexing2.apply(this, arguments);
44784
44902
  }
44785
44903
 
@@ -44865,7 +44983,7 @@ var Users = /*#__PURE__*/function (_Base) {
44865
44983
  }, _callee27, this);
44866
44984
  }));
44867
44985
 
44868
- function _addUserOperations(_x31, _x32) {
44986
+ function _addUserOperations(_x32, _x33) {
44869
44987
  return _addUserOperations2.apply(this, arguments);
44870
44988
  }
44871
44989
 
@@ -44960,7 +45078,7 @@ var Users = /*#__PURE__*/function (_Base) {
44960
45078
  }, _callee28, this);
44961
45079
  }));
44962
45080
 
44963
- function _updateUserOperations(_x33, _x34, _x35) {
45081
+ function _updateUserOperations(_x34, _x35, _x36) {
44964
45082
  return _updateUserOperations2.apply(this, arguments);
44965
45083
  }
44966
45084
 
@@ -45116,7 +45234,7 @@ var Users = /*#__PURE__*/function (_Base) {
45116
45234
  }, _callee29, this, [[17, 27]]);
45117
45235
  }));
45118
45236
 
45119
- function _updateReplicaSetOnChain(_x36, _x37) {
45237
+ function _updateReplicaSetOnChain(_x37, _x38) {
45120
45238
  return _updateReplicaSetOnChain2.apply(this, arguments);
45121
45239
  }
45122
45240
 
@@ -45171,7 +45289,7 @@ var Users = /*#__PURE__*/function (_Base) {
45171
45289
  }, _callee30, this);
45172
45290
  }));
45173
45291
 
45174
- function _retrieveSpIDFromEndpoint(_x38) {
45292
+ function _retrieveSpIDFromEndpoint(_x39) {
45175
45293
  return _retrieveSpIDFromEndpoint2.apply(this, arguments);
45176
45294
  }
45177
45295
 
@@ -48847,6 +48965,148 @@ var EntityManager = /*#__PURE__*/function (_Base) {
48847
48965
  return EntityManager;
48848
48966
  }(Base);
48849
48967
 
48968
+ /** Singleton state-manager for audius proxy wormhole interaction */
48969
+
48970
+ var ProxyWormhole = /*#__PURE__*/function () {
48971
+ function ProxyWormhole(hedgehog, ethWeb3Manager, ethContracts, identityService, solanaWeb3Manager) {
48972
+ _classCallCheck(this, ProxyWormhole);
48973
+
48974
+ // Wormhole service dependecies
48975
+ this.hedgehog = hedgehog;
48976
+ this.ethWeb3Manager = ethWeb3Manager;
48977
+ this.ethContracts = ethContracts;
48978
+ this.identityService = identityService;
48979
+ this.solanaWeb3Manager = solanaWeb3Manager;
48980
+ }
48981
+ /**
48982
+ * Locks assets owned by `fromAccount` into the Solana wormhole with a target
48983
+ * solanaAccount destination via the provided relayer wallet.
48984
+ */
48985
+
48986
+
48987
+ _createClass(ProxyWormhole, [{
48988
+ key: "_getTransferTokensToEthWormholeParams",
48989
+ value: function () {
48990
+ var _getTransferTokensToEthWormholeParams2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(fromAccount, amount, solanaAccount) {
48991
+ var _this$hedgehog$getWal;
48992
+
48993
+ var web3, wormholeClientAddress, chainId, currentBlockNumber, currentBlock, deadline, solanaB58, recipient, nonce, arbiterFee, digest, privateKey, signedDigest;
48994
+ return regeneratorRuntime.wrap(function _callee$(_context) {
48995
+ while (1) {
48996
+ switch (_context.prev = _context.next) {
48997
+ case 0:
48998
+ if (this.hedgehog) {
48999
+ _context.next = 2;
49000
+ break;
49001
+ }
49002
+
49003
+ throw new Error('Hedgehog required for _getTransferTokensToEthWormholeParams');
49004
+
49005
+ case 2:
49006
+ web3 = this.ethWeb3Manager.getWeb3();
49007
+ wormholeClientAddress = this.ethContracts.WormholeClient.contractAddress;
49008
+ _context.next = 6;
49009
+ return web3.eth.getChainId();
49010
+
49011
+ case 6:
49012
+ chainId = _context.sent;
49013
+ _context.next = 9;
49014
+ return web3.eth.getBlockNumber();
49015
+
49016
+ case 9:
49017
+ currentBlockNumber = _context.sent;
49018
+ _context.next = 12;
49019
+ return web3.eth.getBlock(currentBlockNumber);
49020
+
49021
+ case 12:
49022
+ currentBlock = _context.sent;
49023
+ // 1 hour, sufficiently far in future
49024
+ deadline = currentBlock.timestamp + 60 * 60 * 1;
49025
+ solanaB58 = bs58.decode(solanaAccount).toString('hex');
49026
+ recipient = toBuffer("0x".concat(solanaB58));
49027
+ _context.next = 18;
49028
+ return this.ethContracts.WormholeClient.nonces(fromAccount);
49029
+
49030
+ case 18:
49031
+ nonce = _context.sent;
49032
+ arbiterFee = Utils.toBN('0');
49033
+ digest = getTransferTokensDigest(web3, 'AudiusWormholeClient', wormholeClientAddress, chainId, {
49034
+ from: fromAccount,
49035
+ amount: amount,
49036
+ recipientChain: chainId,
49037
+ recipient: recipient,
49038
+ arbiterFee: arbiterFee
49039
+ }, nonce, deadline);
49040
+ privateKey = (_this$hedgehog$getWal = this.hedgehog.getWallet()) === null || _this$hedgehog$getWal === void 0 ? void 0 : _this$hedgehog$getWal.getPrivateKey();
49041
+ signedDigest = sign(digest, privateKey);
49042
+ return _context.abrupt("return", {
49043
+ chainId: chainId,
49044
+ deadline: deadline,
49045
+ recipient: recipient,
49046
+ arbiterFee: arbiterFee,
49047
+ signedDigest: signedDigest
49048
+ });
49049
+
49050
+ case 24:
49051
+ case "end":
49052
+ return _context.stop();
49053
+ }
49054
+ }
49055
+ }, _callee, this);
49056
+ }));
49057
+
49058
+ function _getTransferTokensToEthWormholeParams(_x, _x2, _x3) {
49059
+ return _getTransferTokensToEthWormholeParams2.apply(this, arguments);
49060
+ }
49061
+
49062
+ return _getTransferTokensToEthWormholeParams;
49063
+ }()
49064
+ }, {
49065
+ key: "getTransferTokensToEthWormholeMethod",
49066
+ value: function () {
49067
+ var _getTransferTokensToEthWormholeMethod = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(fromAccount, amount, solanaAccount) {
49068
+ var _yield$this$_getTrans, chainId, deadline, recipient, arbiterFee, signedDigest, method;
49069
+
49070
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
49071
+ while (1) {
49072
+ switch (_context2.prev = _context2.next) {
49073
+ case 0:
49074
+ _context2.next = 2;
49075
+ return this._getTransferTokensToEthWormholeParams(fromAccount, amount, solanaAccount);
49076
+
49077
+ case 2:
49078
+ _yield$this$_getTrans = _context2.sent;
49079
+ chainId = _yield$this$_getTrans.chainId;
49080
+ deadline = _yield$this$_getTrans.deadline;
49081
+ recipient = _yield$this$_getTrans.recipient;
49082
+ arbiterFee = _yield$this$_getTrans.arbiterFee;
49083
+ signedDigest = _yield$this$_getTrans.signedDigest;
49084
+ _context2.next = 10;
49085
+ return this.ethContracts.WormholeClient.WormholeContract.methods.transferTokens(fromAccount, amount, chainId, recipient, arbiterFee, deadline, signedDigest.v, signedDigest.r, signedDigest.s);
49086
+
49087
+ case 10:
49088
+ method = _context2.sent;
49089
+ return _context2.abrupt("return", method);
49090
+
49091
+ case 12:
49092
+ case "end":
49093
+ return _context2.stop();
49094
+ }
49095
+ }
49096
+ }, _callee2, this);
49097
+ }));
49098
+
49099
+ function getTransferTokensToEthWormholeMethod(_x4, _x5, _x6) {
49100
+ return _getTransferTokensToEthWormholeMethod.apply(this, arguments);
49101
+ }
49102
+
49103
+ return getTransferTokensToEthWormholeMethod;
49104
+ }()
49105
+ }]);
49106
+
49107
+ return ProxyWormhole;
49108
+ }();
49109
+
48850
49110
  /**
48851
49111
  * Add secondary creator nodes for a user if they don't have any
48852
49112
  * Goal: Make it so users always have a replica set
@@ -49209,6 +49469,7 @@ var AudiusLibs = /*#__PURE__*/function () {
49209
49469
  discoveryProviderConfig = _ref.discoveryProviderConfig,
49210
49470
  creatorNodeConfig = _ref.creatorNodeConfig,
49211
49471
  comstockConfig = _ref.comstockConfig,
49472
+ wormholeConfig = _ref.wormholeConfig,
49212
49473
  captchaConfig = _ref.captchaConfig,
49213
49474
  hedgehogConfig = _ref.hedgehogConfig,
49214
49475
  isServer = _ref.isServer,
@@ -49234,6 +49495,7 @@ var AudiusLibs = /*#__PURE__*/function () {
49234
49495
  this.creatorNodeConfig = creatorNodeConfig;
49235
49496
  this.discoveryProviderConfig = discoveryProviderConfig;
49236
49497
  this.comstockConfig = comstockConfig;
49498
+ this.wormholeConfig = wormholeConfig;
49237
49499
  this.captchaConfig = captchaConfig;
49238
49500
  this.hedgehogConfig = hedgehogConfig;
49239
49501
  this.isServer = isServer;
@@ -49248,10 +49510,11 @@ var AudiusLibs = /*#__PURE__*/function () {
49248
49510
  this.ethContracts = null;
49249
49511
  this.web3Manager = null;
49250
49512
  this.solanaWeb3Manager = null;
49513
+ this.wormholeClient = null;
49251
49514
  this.contracts = null;
49252
49515
  this.creatorNode = null;
49253
49516
  this.captcha = null;
49254
- this.comstock = null; // // API
49517
+ this.comstock = null; // API
49255
49518
 
49256
49519
  this.ServiceProvider = null;
49257
49520
  this.Account = null;
@@ -49401,8 +49664,14 @@ var AudiusLibs = /*#__PURE__*/function () {
49401
49664
  return Promise.all(contractsToInit);
49402
49665
 
49403
49666
  case 30:
49667
+ if (this.wormholeConfig && this.ethWeb3Manager && this.ethContracts && this.solanaWeb3Manager) {
49668
+ this.wormholeClient = new ProxyWormhole(this.hedgehog, this.ethWeb3Manager, this.ethContracts, this.identityService, this.solanaWeb3Manager);
49669
+ }
49670
+ /** Discovery Provider */
49671
+
49672
+
49404
49673
  if (!this.discoveryProviderConfig) {
49405
- _context.next = 34;
49674
+ _context.next = 35;
49406
49675
  break;
49407
49676
  }
49408
49677
 
@@ -49412,29 +49681,29 @@ var AudiusLibs = /*#__PURE__*/function () {
49412
49681
  web3Manager: this.web3Manager,
49413
49682
  localStorage: this.localStorage
49414
49683
  }, this.discoveryProviderConfig));
49415
- _context.next = 34;
49684
+ _context.next = 35;
49416
49685
  return this.discoveryProvider.init();
49417
49686
 
49418
- case 34:
49687
+ case 35:
49419
49688
  if (!this.creatorNodeConfig) {
49420
- _context.next = 40;
49689
+ _context.next = 41;
49421
49690
  break;
49422
49691
  }
49423
49692
 
49424
49693
  currentUser = this.userStateManager.getCurrentUser();
49425
49694
  creatorNodeEndpoint = currentUser ? (_CreatorNode$getPrima = CreatorNode.getPrimary(currentUser.creator_node_endpoint)) !== null && _CreatorNode$getPrima !== void 0 ? _CreatorNode$getPrima : this.creatorNodeConfig.fallbackUrl : this.creatorNodeConfig.fallbackUrl;
49426
49695
  this.creatorNode = new CreatorNode(this.web3Manager, creatorNodeEndpoint, this.isServer, this.userStateManager, this.creatorNodeConfig.lazyConnect, this.schemas, this.creatorNodeConfig.passList, this.creatorNodeConfig.blockList, this.creatorNodeConfig.monitoringCallbacks, this.creatorNodeConfig.writeQuorumEnabled);
49427
- _context.next = 40;
49696
+ _context.next = 41;
49428
49697
  return this.creatorNode.init();
49429
49698
 
49430
- case 40:
49699
+ case 41:
49431
49700
  /** Comstock */
49432
49701
  if (this.comstockConfig) {
49433
49702
  this.comstock = new Comstock(this.comstockConfig.url);
49434
49703
  } // Initialize apis
49435
49704
 
49436
49705
 
49437
- services = [this.userStateManager, this.identityService, this.hedgehog, this.discoveryProvider, this.web3Manager, this.contracts, this.ethWeb3Manager, this.ethContracts, this.solanaWeb3Manager, null, null, this.creatorNode, this.comstock, this.captcha, this.isServer, this.logger];
49706
+ services = [this.userStateManager, this.identityService, this.hedgehog, this.discoveryProvider, this.web3Manager, this.contracts, this.ethWeb3Manager, this.ethContracts, this.solanaWeb3Manager, null, this.wormholeClient, this.creatorNode, this.comstock, this.captcha, this.isServer, this.logger];
49438
49707
  this.ServiceProvider = _construct(ServiceProvider, services);
49439
49708
  this.User = _construct(Users, [this.ServiceProvider, this.preferHigherPatchForPrimary, this.preferHigherPatchForSecondaries].concat(services));
49440
49709
  this.Account = _construct(Account, [this.User].concat(services));
@@ -49445,7 +49714,7 @@ var AudiusLibs = /*#__PURE__*/function () {
49445
49714
  this.Reactions = _construct(Reactions, services);
49446
49715
  this.EntityManager = _construct(EntityManager, services);
49447
49716
 
49448
- case 51:
49717
+ case 52:
49449
49718
  case "end":
49450
49719
  return _context.stop();
49451
49720
  }
@@ -49621,8 +49890,7 @@ var AudiusLibs = /*#__PURE__*/function () {
49621
49890
  };
49622
49891
  }
49623
49892
  /**
49624
- * Configures wormhole
49625
- * This is a stubbed version for native
49893
+ * Configures proxy-only wormhole
49626
49894
  */
49627
49895
 
49628
49896
  }, {