@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.esm.js CHANGED
@@ -35937,9 +35937,9 @@ var EthWeb3Manager = /*#__PURE__*/function () {
35937
35937
  }();
35938
35938
 
35939
35939
  var name = "@audius/sdk";
35940
- var version = "3.0.8-beta.7";
35940
+ var version = "3.0.8-beta.9";
35941
35941
  var audius = {
35942
- releaseSHA: "72c223f61d61e353356d3b0f33e8db6a17e5b7a9"
35942
+ releaseSHA: "460ca8bcef335cf7cfed191d2d26f1f913b2eee2"
35943
35943
  };
35944
35944
  var description = "Audius SDK";
35945
35945
  var keywords = [
@@ -37160,76 +37160,42 @@ var Web3Manager = /*#__PURE__*/function () {
37160
37160
  _context6.next = 22;
37161
37161
  return retry( /*#__PURE__*/function () {
37162
37162
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(bail) {
37163
- var _this$discoveryProvid, res, _this$identityService;
37163
+ var _this$discoveryProvid, _this$identityService, _this$identityService2, baseURL;
37164
37164
 
37165
37165
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
37166
37166
  while (1) {
37167
37167
  switch (_context5.prev = _context5.next) {
37168
37168
  case 0:
37169
37169
  _context5.prev = 0;
37170
+ 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;
37171
+ console.error("relaying to base url ".concat(baseURL));
37172
+ _context5.next = 5;
37173
+ 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);
37170
37174
 
37171
- if (!_this.useDiscoveryRelay()) {
37172
- _context5.next = 10;
37173
- break;
37174
- }
37175
-
37176
- _context5.next = 4;
37177
- return (_this$discoveryProvid = _this.discoveryProvider) === null || _this$discoveryProvid === void 0 ? void 0 : _this$discoveryProvid.relay({
37178
- contractRegistryKey: contractRegistryKey,
37179
- contractAddress: contractAddress,
37180
- senderAddress: _this.ownerWallet.getAddressString(),
37181
- encodedABI: encodedABI,
37182
- gasLimit: gasLimit,
37183
- handle: _this.userSuppliedHandle,
37184
- nethermindContractAddress: nethermindContractAddress,
37185
- nethermindEncodedAbi: nethermindEncodedAbi
37186
- });
37187
-
37188
- case 4:
37189
- res = _context5.sent;
37190
-
37191
- if (!(res === null || res === undefined)) {
37192
- _context5.next = 7;
37193
- break;
37194
- }
37195
-
37196
- throw new Error("discovery relay returned empty response");
37197
-
37198
- case 7:
37199
- return _context5.abrupt("return", res);
37200
-
37201
- case 10:
37202
- _context5.next = 12;
37203
- 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);
37204
-
37205
- case 12:
37175
+ case 5:
37206
37176
  return _context5.abrupt("return", _context5.sent);
37207
37177
 
37208
- case 13:
37209
- _context5.next = 21;
37210
- break;
37211
-
37212
- case 15:
37213
- _context5.prev = 15;
37178
+ case 8:
37179
+ _context5.prev = 8;
37214
37180
  _context5.t0 = _context5["catch"](0);
37215
37181
 
37216
37182
  if (!(_context5.t0.response.status === 403)) {
37217
- _context5.next = 20;
37183
+ _context5.next = 13;
37218
37184
  break;
37219
37185
  }
37220
37186
 
37221
37187
  bail(_context5.t0);
37222
37188
  return _context5.abrupt("return");
37223
37189
 
37224
- case 20:
37190
+ case 13:
37225
37191
  throw _context5.t0;
37226
37192
 
37227
- case 21:
37193
+ case 14:
37228
37194
  case "end":
37229
37195
  return _context5.stop();
37230
37196
  }
37231
37197
  }
37232
- }, _callee5, null, [[0, 15]]);
37198
+ }, _callee5, null, [[0, 8]]);
37233
37199
  }));
37234
37200
 
37235
37201
  return function (_x8) {
@@ -53288,15 +53254,17 @@ var TransactionHandler = /*#__PURE__*/function () {
53288
53254
  feePayerAccount,
53289
53255
  tx,
53290
53256
  rawTransaction,
53291
- sendRawTransaction,
53292
- txid,
53293
53257
  errorCode,
53294
53258
  error,
53259
+ sendRawTransaction,
53260
+ txid,
53261
+ _errorCode,
53262
+ _error,
53295
53263
  done,
53296
53264
  sendCount,
53297
53265
  startTime,
53298
- _errorCode,
53299
- _error,
53266
+ _errorCode2,
53267
+ _error2,
53300
53268
  _args5 = arguments;
53301
53269
 
53302
53270
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -53369,8 +53337,31 @@ var TransactionHandler = /*#__PURE__*/function () {
53369
53337
  });
53370
53338
  }
53371
53339
 
53372
- rawTransaction = tx.serialize(); // Send the txn
53340
+ _context5.prev = 21;
53341
+ rawTransaction = tx.serialize();
53342
+ _context5.next = 32;
53343
+ break;
53373
53344
 
53345
+ case 25:
53346
+ _context5.prev = 25;
53347
+ _context5.t1 = _context5["catch"](21);
53348
+ logger.warn("transactionHandler: transaction serialization failed: ".concat(_context5.t1));
53349
+ errorCode = null;
53350
+ error = null;
53351
+
53352
+ if (_context5.t1 instanceof Error) {
53353
+ error = _context5.t1.message;
53354
+ errorCode = this._parseSolanaErrorCode(error);
53355
+ }
53356
+
53357
+ return _context5.abrupt("return", {
53358
+ res: null,
53359
+ error: error,
53360
+ errorCode: errorCode
53361
+ });
53362
+
53363
+ case 32:
53364
+ // Send the txn
53374
53365
  sendRawTransaction = /*#__PURE__*/function () {
53375
53366
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
53376
53367
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -53400,35 +53391,35 @@ var TransactionHandler = /*#__PURE__*/function () {
53400
53391
  };
53401
53392
  }();
53402
53393
 
53403
- _context5.prev = 23;
53404
- _context5.next = 26;
53394
+ _context5.prev = 33;
53395
+ _context5.next = 36;
53405
53396
  return sendRawTransaction();
53406
53397
 
53407
- case 26:
53398
+ case 36:
53408
53399
  txid = _context5.sent;
53409
- _context5.next = 36;
53400
+ _context5.next = 46;
53410
53401
  break;
53411
53402
 
53412
- case 29:
53413
- _context5.prev = 29;
53414
- _context5.t1 = _context5["catch"](23);
53403
+ case 39:
53404
+ _context5.prev = 39;
53405
+ _context5.t2 = _context5["catch"](33);
53415
53406
  // Rarely, this intiial send will fail
53416
- logger.warn("transactionHandler: Initial send failed: ".concat(_context5.t1));
53417
- errorCode = null;
53418
- error = null;
53407
+ logger.warn("transactionHandler: Initial send failed: ".concat(_context5.t2));
53408
+ _errorCode = null;
53409
+ _error = null;
53419
53410
 
53420
- if (_context5.t1 instanceof Error) {
53421
- error = _context5.t1.message;
53422
- errorCode = this._parseSolanaErrorCode(error);
53411
+ if (_context5.t2 instanceof Error) {
53412
+ _error = _context5.t2.message;
53413
+ _errorCode = this._parseSolanaErrorCode(_error);
53423
53414
  }
53424
53415
 
53425
53416
  return _context5.abrupt("return", {
53426
53417
  res: null,
53427
- error: error,
53428
- errorCode: errorCode
53418
+ error: _error,
53419
+ errorCode: _errorCode
53429
53420
  });
53430
53421
 
53431
- case 36:
53422
+ case 46:
53432
53423
  done = false; // Start up resubmission loop
53433
53424
 
53434
53425
  sendCount = 0;
@@ -53475,11 +53466,11 @@ var TransactionHandler = /*#__PURE__*/function () {
53475
53466
  } // Await for tx confirmation
53476
53467
 
53477
53468
 
53478
- _context5.prev = 40;
53479
- _context5.next = 43;
53469
+ _context5.prev = 50;
53470
+ _context5.next = 53;
53480
53471
  return this._awaitTransactionSignatureConfirmation(txid, logger);
53481
53472
 
53482
- case 43:
53473
+ case 53:
53483
53474
  done = true;
53484
53475
  logger.info("transactionHandler: finished for txid ".concat(txid, " with ").concat(sendCount, " retries"));
53485
53476
  return _context5.abrupt("return", {
@@ -53488,31 +53479,31 @@ var TransactionHandler = /*#__PURE__*/function () {
53488
53479
  errorCode: null
53489
53480
  });
53490
53481
 
53491
- case 48:
53492
- _context5.prev = 48;
53493
- _context5.t2 = _context5["catch"](40);
53494
- logger.warn("transactionHandler: error in awaitTransactionSignature: ".concat(JSON.stringify(_context5.t2), ", ").concat(txid));
53482
+ case 58:
53483
+ _context5.prev = 58;
53484
+ _context5.t3 = _context5["catch"](50);
53485
+ logger.warn("transactionHandler: error in awaitTransactionSignature: ".concat(JSON.stringify(_context5.t3), ", ").concat(txid));
53495
53486
  done = true;
53496
- _errorCode = null;
53497
- _error = null;
53487
+ _errorCode2 = null;
53488
+ _error2 = null;
53498
53489
 
53499
- if (_context5.t2 instanceof Error) {
53500
- _error = _context5.t2.message;
53501
- _errorCode = this._parseSolanaErrorCode(_error);
53490
+ if (_context5.t3 instanceof Error) {
53491
+ _error2 = _context5.t3.message;
53492
+ _errorCode2 = this._parseSolanaErrorCode(_error2);
53502
53493
  }
53503
53494
 
53504
53495
  return _context5.abrupt("return", {
53505
53496
  res: null,
53506
- error: _error,
53507
- errorCode: _errorCode
53497
+ error: _error2,
53498
+ errorCode: _errorCode2
53508
53499
  });
53509
53500
 
53510
- case 56:
53501
+ case 66:
53511
53502
  case "end":
53512
53503
  return _context5.stop();
53513
53504
  }
53514
53505
  }
53515
- }, _callee5, this, [[23, 29], [40, 48]]);
53506
+ }, _callee5, this, [[21, 25], [33, 39], [50, 58]]);
53516
53507
  }));
53517
53508
 
53518
53509
  function _locallyConfirmTransaction(_x5, _x6, _x7, _x8) {
@@ -59926,6 +59917,7 @@ var IdentityService = /*#__PURE__*/function () {
59926
59917
  var handle,
59927
59918
  nethermindContractAddress,
59928
59919
  nethermindEncodedAbi,
59920
+ baseURL,
59929
59921
  _args17 = arguments;
59930
59922
  return regeneratorRuntime.wrap(function _callee17$(_context17) {
59931
59923
  while (1) {
@@ -59934,8 +59926,10 @@ var IdentityService = /*#__PURE__*/function () {
59934
59926
  handle = _args17.length > 5 && _args17[5] !== undefined ? _args17[5] : null;
59935
59927
  nethermindContractAddress = _args17.length > 6 ? _args17[6] : undefined;
59936
59928
  nethermindEncodedAbi = _args17.length > 7 ? _args17[7] : undefined;
59937
- _context17.next = 5;
59929
+ baseURL = _args17.length > 8 ? _args17[8] : undefined;
59930
+ _context17.next = 6;
59938
59931
  return this._makeRequest({
59932
+ baseURL: baseURL,
59939
59933
  url: '/relay',
59940
59934
  method: 'post',
59941
59935
  data: {
@@ -59950,10 +59944,10 @@ var IdentityService = /*#__PURE__*/function () {
59950
59944
  }
59951
59945
  });
59952
59946
 
59953
- case 5:
59947
+ case 6:
59954
59948
  return _context17.abrupt("return", _context17.sent);
59955
59949
 
59956
- case 6:
59950
+ case 7:
59957
59951
  case "end":
59958
59952
  return _context17.stop();
59959
59953
  }
@@ -60472,7 +60466,7 @@ var IdentityService = /*#__PURE__*/function () {
60472
60466
  while (1) {
60473
60467
  switch (_context31.prev = _context31.next) {
60474
60468
  case 0:
60475
- axiosRequestObj.baseURL = this.identityServiceEndpoint;
60469
+ axiosRequestObj.baseURL = axiosRequestObj.baseURL || this.identityServiceEndpoint;
60476
60470
  requestId = uuid();
60477
60471
  axiosRequestObj.headers = _objectSpread2(_objectSpread2({}, axiosRequestObj.headers || {}), {}, {
60478
60472
  'X-Request-ID': requestId