@audius/sdk 3.0.8-beta.7 → 3.0.8-beta.9

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.cjs.js CHANGED
@@ -36180,9 +36180,9 @@ var EthWeb3Manager = /*#__PURE__*/function () {
36180
36180
  }();
36181
36181
 
36182
36182
  var name = "@audius/sdk";
36183
- var version = "3.0.8-beta.7";
36183
+ var version = "3.0.8-beta.9";
36184
36184
  var audius = {
36185
- releaseSHA: "72c223f61d61e353356d3b0f33e8db6a17e5b7a9"
36185
+ releaseSHA: "460ca8bcef335cf7cfed191d2d26f1f913b2eee2"
36186
36186
  };
36187
36187
  var description = "Audius SDK";
36188
36188
  var keywords = [
@@ -37403,76 +37403,42 @@ var Web3Manager = /*#__PURE__*/function () {
37403
37403
  _context6.next = 22;
37404
37404
  return retry__default["default"]( /*#__PURE__*/function () {
37405
37405
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(bail) {
37406
- var _this$discoveryProvid, res, _this$identityService;
37406
+ var _this$discoveryProvid, _this$identityService, _this$identityService2, baseURL;
37407
37407
 
37408
37408
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
37409
37409
  while (1) {
37410
37410
  switch (_context5.prev = _context5.next) {
37411
37411
  case 0:
37412
37412
  _context5.prev = 0;
37413
+ baseURL = _this.useDiscoveryRelay() ? (_this$discoveryProvid = _this.discoveryProvider) === null || _this$discoveryProvid === void 0 ? void 0 : _this$discoveryProvid.discoveryProviderEndpoint : (_this$identityService = _this.identityService) === null || _this$identityService === void 0 ? void 0 : _this$identityService.identityServiceEndpoint;
37414
+ console.error("relaying to base url ".concat(baseURL));
37415
+ _context5.next = 5;
37416
+ return (_this$identityService2 = _this.identityService) === null || _this$identityService2 === void 0 ? void 0 : _this$identityService2.relay(contractRegistryKey, contractAddress, _this.ownerWallet.getAddressString(), encodedABI, gasLimit, _this.userSuppliedHandle, nethermindContractAddress, nethermindEncodedAbi, baseURL);
37413
37417
 
37414
- if (!_this.useDiscoveryRelay()) {
37415
- _context5.next = 10;
37416
- break;
37417
- }
37418
-
37419
- _context5.next = 4;
37420
- return (_this$discoveryProvid = _this.discoveryProvider) === null || _this$discoveryProvid === void 0 ? void 0 : _this$discoveryProvid.relay({
37421
- contractRegistryKey: contractRegistryKey,
37422
- contractAddress: contractAddress,
37423
- senderAddress: _this.ownerWallet.getAddressString(),
37424
- encodedABI: encodedABI,
37425
- gasLimit: gasLimit,
37426
- handle: _this.userSuppliedHandle,
37427
- nethermindContractAddress: nethermindContractAddress,
37428
- nethermindEncodedAbi: nethermindEncodedAbi
37429
- });
37430
-
37431
- case 4:
37432
- res = _context5.sent;
37433
-
37434
- if (!(res === null || res === undefined)) {
37435
- _context5.next = 7;
37436
- break;
37437
- }
37438
-
37439
- throw new Error("discovery relay returned empty response");
37440
-
37441
- case 7:
37442
- return _context5.abrupt("return", res);
37443
-
37444
- case 10:
37445
- _context5.next = 12;
37446
- return (_this$identityService = _this.identityService) === null || _this$identityService === void 0 ? void 0 : _this$identityService.relay(contractRegistryKey, contractAddress, _this.ownerWallet.getAddressString(), encodedABI, gasLimit, _this.userSuppliedHandle, nethermindContractAddress, nethermindEncodedAbi);
37447
-
37448
- case 12:
37418
+ case 5:
37449
37419
  return _context5.abrupt("return", _context5.sent);
37450
37420
 
37451
- case 13:
37452
- _context5.next = 21;
37453
- break;
37454
-
37455
- case 15:
37456
- _context5.prev = 15;
37421
+ case 8:
37422
+ _context5.prev = 8;
37457
37423
  _context5.t0 = _context5["catch"](0);
37458
37424
 
37459
37425
  if (!(_context5.t0.response.status === 403)) {
37460
- _context5.next = 20;
37426
+ _context5.next = 13;
37461
37427
  break;
37462
37428
  }
37463
37429
 
37464
37430
  bail(_context5.t0);
37465
37431
  return _context5.abrupt("return");
37466
37432
 
37467
- case 20:
37433
+ case 13:
37468
37434
  throw _context5.t0;
37469
37435
 
37470
- case 21:
37436
+ case 14:
37471
37437
  case "end":
37472
37438
  return _context5.stop();
37473
37439
  }
37474
37440
  }
37475
- }, _callee5, null, [[0, 15]]);
37441
+ }, _callee5, null, [[0, 8]]);
37476
37442
  }));
37477
37443
 
37478
37444
  return function (_x8) {
@@ -53531,15 +53497,17 @@ var TransactionHandler = /*#__PURE__*/function () {
53531
53497
  feePayerAccount,
53532
53498
  tx,
53533
53499
  rawTransaction,
53534
- sendRawTransaction,
53535
- txid,
53536
53500
  errorCode,
53537
53501
  error,
53502
+ sendRawTransaction,
53503
+ txid,
53504
+ _errorCode,
53505
+ _error,
53538
53506
  done,
53539
53507
  sendCount,
53540
53508
  startTime,
53541
- _errorCode,
53542
- _error,
53509
+ _errorCode2,
53510
+ _error2,
53543
53511
  _args5 = arguments;
53544
53512
 
53545
53513
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -53612,8 +53580,31 @@ var TransactionHandler = /*#__PURE__*/function () {
53612
53580
  });
53613
53581
  }
53614
53582
 
53615
- rawTransaction = tx.serialize(); // Send the txn
53583
+ _context5.prev = 21;
53584
+ rawTransaction = tx.serialize();
53585
+ _context5.next = 32;
53586
+ break;
53616
53587
 
53588
+ case 25:
53589
+ _context5.prev = 25;
53590
+ _context5.t1 = _context5["catch"](21);
53591
+ logger.warn("transactionHandler: transaction serialization failed: ".concat(_context5.t1));
53592
+ errorCode = null;
53593
+ error = null;
53594
+
53595
+ if (_context5.t1 instanceof Error) {
53596
+ error = _context5.t1.message;
53597
+ errorCode = this._parseSolanaErrorCode(error);
53598
+ }
53599
+
53600
+ return _context5.abrupt("return", {
53601
+ res: null,
53602
+ error: error,
53603
+ errorCode: errorCode
53604
+ });
53605
+
53606
+ case 32:
53607
+ // Send the txn
53617
53608
  sendRawTransaction = /*#__PURE__*/function () {
53618
53609
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
53619
53610
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -53643,35 +53634,35 @@ var TransactionHandler = /*#__PURE__*/function () {
53643
53634
  };
53644
53635
  }();
53645
53636
 
53646
- _context5.prev = 23;
53647
- _context5.next = 26;
53637
+ _context5.prev = 33;
53638
+ _context5.next = 36;
53648
53639
  return sendRawTransaction();
53649
53640
 
53650
- case 26:
53641
+ case 36:
53651
53642
  txid = _context5.sent;
53652
- _context5.next = 36;
53643
+ _context5.next = 46;
53653
53644
  break;
53654
53645
 
53655
- case 29:
53656
- _context5.prev = 29;
53657
- _context5.t1 = _context5["catch"](23);
53646
+ case 39:
53647
+ _context5.prev = 39;
53648
+ _context5.t2 = _context5["catch"](33);
53658
53649
  // Rarely, this intiial send will fail
53659
- logger.warn("transactionHandler: Initial send failed: ".concat(_context5.t1));
53660
- errorCode = null;
53661
- error = null;
53650
+ logger.warn("transactionHandler: Initial send failed: ".concat(_context5.t2));
53651
+ _errorCode = null;
53652
+ _error = null;
53662
53653
 
53663
- if (_context5.t1 instanceof Error) {
53664
- error = _context5.t1.message;
53665
- errorCode = this._parseSolanaErrorCode(error);
53654
+ if (_context5.t2 instanceof Error) {
53655
+ _error = _context5.t2.message;
53656
+ _errorCode = this._parseSolanaErrorCode(_error);
53666
53657
  }
53667
53658
 
53668
53659
  return _context5.abrupt("return", {
53669
53660
  res: null,
53670
- error: error,
53671
- errorCode: errorCode
53661
+ error: _error,
53662
+ errorCode: _errorCode
53672
53663
  });
53673
53664
 
53674
- case 36:
53665
+ case 46:
53675
53666
  done = false; // Start up resubmission loop
53676
53667
 
53677
53668
  sendCount = 0;
@@ -53718,11 +53709,11 @@ var TransactionHandler = /*#__PURE__*/function () {
53718
53709
  } // Await for tx confirmation
53719
53710
 
53720
53711
 
53721
- _context5.prev = 40;
53722
- _context5.next = 43;
53712
+ _context5.prev = 50;
53713
+ _context5.next = 53;
53723
53714
  return this._awaitTransactionSignatureConfirmation(txid, logger);
53724
53715
 
53725
- case 43:
53716
+ case 53:
53726
53717
  done = true;
53727
53718
  logger.info("transactionHandler: finished for txid ".concat(txid, " with ").concat(sendCount, " retries"));
53728
53719
  return _context5.abrupt("return", {
@@ -53731,31 +53722,31 @@ var TransactionHandler = /*#__PURE__*/function () {
53731
53722
  errorCode: null
53732
53723
  });
53733
53724
 
53734
- case 48:
53735
- _context5.prev = 48;
53736
- _context5.t2 = _context5["catch"](40);
53737
- logger.warn("transactionHandler: error in awaitTransactionSignature: ".concat(JSON.stringify(_context5.t2), ", ").concat(txid));
53725
+ case 58:
53726
+ _context5.prev = 58;
53727
+ _context5.t3 = _context5["catch"](50);
53728
+ logger.warn("transactionHandler: error in awaitTransactionSignature: ".concat(JSON.stringify(_context5.t3), ", ").concat(txid));
53738
53729
  done = true;
53739
- _errorCode = null;
53740
- _error = null;
53730
+ _errorCode2 = null;
53731
+ _error2 = null;
53741
53732
 
53742
- if (_context5.t2 instanceof Error) {
53743
- _error = _context5.t2.message;
53744
- _errorCode = this._parseSolanaErrorCode(_error);
53733
+ if (_context5.t3 instanceof Error) {
53734
+ _error2 = _context5.t3.message;
53735
+ _errorCode2 = this._parseSolanaErrorCode(_error2);
53745
53736
  }
53746
53737
 
53747
53738
  return _context5.abrupt("return", {
53748
53739
  res: null,
53749
- error: _error,
53750
- errorCode: _errorCode
53740
+ error: _error2,
53741
+ errorCode: _errorCode2
53751
53742
  });
53752
53743
 
53753
- case 56:
53744
+ case 66:
53754
53745
  case "end":
53755
53746
  return _context5.stop();
53756
53747
  }
53757
53748
  }
53758
- }, _callee5, this, [[23, 29], [40, 48]]);
53749
+ }, _callee5, this, [[21, 25], [33, 39], [50, 58]]);
53759
53750
  }));
53760
53751
 
53761
53752
  function _locallyConfirmTransaction(_x5, _x6, _x7, _x8) {
@@ -60169,6 +60160,7 @@ var IdentityService = /*#__PURE__*/function () {
60169
60160
  var handle,
60170
60161
  nethermindContractAddress,
60171
60162
  nethermindEncodedAbi,
60163
+ baseURL,
60172
60164
  _args17 = arguments;
60173
60165
  return regeneratorRuntime.wrap(function _callee17$(_context17) {
60174
60166
  while (1) {
@@ -60177,8 +60169,10 @@ var IdentityService = /*#__PURE__*/function () {
60177
60169
  handle = _args17.length > 5 && _args17[5] !== undefined ? _args17[5] : null;
60178
60170
  nethermindContractAddress = _args17.length > 6 ? _args17[6] : undefined;
60179
60171
  nethermindEncodedAbi = _args17.length > 7 ? _args17[7] : undefined;
60180
- _context17.next = 5;
60172
+ baseURL = _args17.length > 8 ? _args17[8] : undefined;
60173
+ _context17.next = 6;
60181
60174
  return this._makeRequest({
60175
+ baseURL: baseURL,
60182
60176
  url: '/relay',
60183
60177
  method: 'post',
60184
60178
  data: {
@@ -60193,10 +60187,10 @@ var IdentityService = /*#__PURE__*/function () {
60193
60187
  }
60194
60188
  });
60195
60189
 
60196
- case 5:
60190
+ case 6:
60197
60191
  return _context17.abrupt("return", _context17.sent);
60198
60192
 
60199
- case 6:
60193
+ case 7:
60200
60194
  case "end":
60201
60195
  return _context17.stop();
60202
60196
  }
@@ -60715,7 +60709,7 @@ var IdentityService = /*#__PURE__*/function () {
60715
60709
  while (1) {
60716
60710
  switch (_context31.prev = _context31.next) {
60717
60711
  case 0:
60718
- axiosRequestObj.baseURL = this.identityServiceEndpoint;
60712
+ axiosRequestObj.baseURL = axiosRequestObj.baseURL || this.identityServiceEndpoint;
60719
60713
  requestId = uuid();
60720
60714
  axiosRequestObj.headers = _objectSpread2(_objectSpread2({}, axiosRequestObj.headers || {}), {}, {
60721
60715
  'X-Request-ID': requestId