@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/legacy.js CHANGED
@@ -35988,9 +35988,9 @@ var EthWeb3Manager = /*#__PURE__*/function () {
35988
35988
  }();
35989
35989
 
35990
35990
  var name = "@audius/sdk";
35991
- var version = "3.0.8-beta.7";
35991
+ var version = "3.0.8-beta.9";
35992
35992
  var audius = {
35993
- releaseSHA: "72c223f61d61e353356d3b0f33e8db6a17e5b7a9"
35993
+ releaseSHA: "460ca8bcef335cf7cfed191d2d26f1f913b2eee2"
35994
35994
  };
35995
35995
  var description = "Audius SDK";
35996
35996
  var keywords = [
@@ -37211,76 +37211,42 @@ var Web3Manager = /*#__PURE__*/function () {
37211
37211
  _context6.next = 22;
37212
37212
  return retry__default["default"]( /*#__PURE__*/function () {
37213
37213
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(bail) {
37214
- var _this$discoveryProvid, res, _this$identityService;
37214
+ var _this$discoveryProvid, _this$identityService, _this$identityService2, baseURL;
37215
37215
 
37216
37216
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
37217
37217
  while (1) {
37218
37218
  switch (_context5.prev = _context5.next) {
37219
37219
  case 0:
37220
37220
  _context5.prev = 0;
37221
+ 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;
37222
+ console.error("relaying to base url ".concat(baseURL));
37223
+ _context5.next = 5;
37224
+ 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);
37221
37225
 
37222
- if (!_this.useDiscoveryRelay()) {
37223
- _context5.next = 10;
37224
- break;
37225
- }
37226
-
37227
- _context5.next = 4;
37228
- return (_this$discoveryProvid = _this.discoveryProvider) === null || _this$discoveryProvid === void 0 ? void 0 : _this$discoveryProvid.relay({
37229
- contractRegistryKey: contractRegistryKey,
37230
- contractAddress: contractAddress,
37231
- senderAddress: _this.ownerWallet.getAddressString(),
37232
- encodedABI: encodedABI,
37233
- gasLimit: gasLimit,
37234
- handle: _this.userSuppliedHandle,
37235
- nethermindContractAddress: nethermindContractAddress,
37236
- nethermindEncodedAbi: nethermindEncodedAbi
37237
- });
37238
-
37239
- case 4:
37240
- res = _context5.sent;
37241
-
37242
- if (!(res === null || res === undefined)) {
37243
- _context5.next = 7;
37244
- break;
37245
- }
37246
-
37247
- throw new Error("discovery relay returned empty response");
37248
-
37249
- case 7:
37250
- return _context5.abrupt("return", res);
37251
-
37252
- case 10:
37253
- _context5.next = 12;
37254
- 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);
37255
-
37256
- case 12:
37226
+ case 5:
37257
37227
  return _context5.abrupt("return", _context5.sent);
37258
37228
 
37259
- case 13:
37260
- _context5.next = 21;
37261
- break;
37262
-
37263
- case 15:
37264
- _context5.prev = 15;
37229
+ case 8:
37230
+ _context5.prev = 8;
37265
37231
  _context5.t0 = _context5["catch"](0);
37266
37232
 
37267
37233
  if (!(_context5.t0.response.status === 403)) {
37268
- _context5.next = 20;
37234
+ _context5.next = 13;
37269
37235
  break;
37270
37236
  }
37271
37237
 
37272
37238
  bail(_context5.t0);
37273
37239
  return _context5.abrupt("return");
37274
37240
 
37275
- case 20:
37241
+ case 13:
37276
37242
  throw _context5.t0;
37277
37243
 
37278
- case 21:
37244
+ case 14:
37279
37245
  case "end":
37280
37246
  return _context5.stop();
37281
37247
  }
37282
37248
  }
37283
- }, _callee5, null, [[0, 15]]);
37249
+ }, _callee5, null, [[0, 8]]);
37284
37250
  }));
37285
37251
 
37286
37252
  return function (_x8) {
@@ -53339,15 +53305,17 @@ var TransactionHandler = /*#__PURE__*/function () {
53339
53305
  feePayerAccount,
53340
53306
  tx,
53341
53307
  rawTransaction,
53342
- sendRawTransaction,
53343
- txid,
53344
53308
  errorCode,
53345
53309
  error,
53310
+ sendRawTransaction,
53311
+ txid,
53312
+ _errorCode,
53313
+ _error,
53346
53314
  done,
53347
53315
  sendCount,
53348
53316
  startTime,
53349
- _errorCode,
53350
- _error,
53317
+ _errorCode2,
53318
+ _error2,
53351
53319
  _args5 = arguments;
53352
53320
 
53353
53321
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -53420,8 +53388,31 @@ var TransactionHandler = /*#__PURE__*/function () {
53420
53388
  });
53421
53389
  }
53422
53390
 
53423
- rawTransaction = tx.serialize(); // Send the txn
53391
+ _context5.prev = 21;
53392
+ rawTransaction = tx.serialize();
53393
+ _context5.next = 32;
53394
+ break;
53424
53395
 
53396
+ case 25:
53397
+ _context5.prev = 25;
53398
+ _context5.t1 = _context5["catch"](21);
53399
+ logger.warn("transactionHandler: transaction serialization failed: ".concat(_context5.t1));
53400
+ errorCode = null;
53401
+ error = null;
53402
+
53403
+ if (_context5.t1 instanceof Error) {
53404
+ error = _context5.t1.message;
53405
+ errorCode = this._parseSolanaErrorCode(error);
53406
+ }
53407
+
53408
+ return _context5.abrupt("return", {
53409
+ res: null,
53410
+ error: error,
53411
+ errorCode: errorCode
53412
+ });
53413
+
53414
+ case 32:
53415
+ // Send the txn
53425
53416
  sendRawTransaction = /*#__PURE__*/function () {
53426
53417
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
53427
53418
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -53451,35 +53442,35 @@ var TransactionHandler = /*#__PURE__*/function () {
53451
53442
  };
53452
53443
  }();
53453
53444
 
53454
- _context5.prev = 23;
53455
- _context5.next = 26;
53445
+ _context5.prev = 33;
53446
+ _context5.next = 36;
53456
53447
  return sendRawTransaction();
53457
53448
 
53458
- case 26:
53449
+ case 36:
53459
53450
  txid = _context5.sent;
53460
- _context5.next = 36;
53451
+ _context5.next = 46;
53461
53452
  break;
53462
53453
 
53463
- case 29:
53464
- _context5.prev = 29;
53465
- _context5.t1 = _context5["catch"](23);
53454
+ case 39:
53455
+ _context5.prev = 39;
53456
+ _context5.t2 = _context5["catch"](33);
53466
53457
  // Rarely, this intiial send will fail
53467
- logger.warn("transactionHandler: Initial send failed: ".concat(_context5.t1));
53468
- errorCode = null;
53469
- error = null;
53458
+ logger.warn("transactionHandler: Initial send failed: ".concat(_context5.t2));
53459
+ _errorCode = null;
53460
+ _error = null;
53470
53461
 
53471
- if (_context5.t1 instanceof Error) {
53472
- error = _context5.t1.message;
53473
- errorCode = this._parseSolanaErrorCode(error);
53462
+ if (_context5.t2 instanceof Error) {
53463
+ _error = _context5.t2.message;
53464
+ _errorCode = this._parseSolanaErrorCode(_error);
53474
53465
  }
53475
53466
 
53476
53467
  return _context5.abrupt("return", {
53477
53468
  res: null,
53478
- error: error,
53479
- errorCode: errorCode
53469
+ error: _error,
53470
+ errorCode: _errorCode
53480
53471
  });
53481
53472
 
53482
- case 36:
53473
+ case 46:
53483
53474
  done = false; // Start up resubmission loop
53484
53475
 
53485
53476
  sendCount = 0;
@@ -53526,11 +53517,11 @@ var TransactionHandler = /*#__PURE__*/function () {
53526
53517
  } // Await for tx confirmation
53527
53518
 
53528
53519
 
53529
- _context5.prev = 40;
53530
- _context5.next = 43;
53520
+ _context5.prev = 50;
53521
+ _context5.next = 53;
53531
53522
  return this._awaitTransactionSignatureConfirmation(txid, logger);
53532
53523
 
53533
- case 43:
53524
+ case 53:
53534
53525
  done = true;
53535
53526
  logger.info("transactionHandler: finished for txid ".concat(txid, " with ").concat(sendCount, " retries"));
53536
53527
  return _context5.abrupt("return", {
@@ -53539,31 +53530,31 @@ var TransactionHandler = /*#__PURE__*/function () {
53539
53530
  errorCode: null
53540
53531
  });
53541
53532
 
53542
- case 48:
53543
- _context5.prev = 48;
53544
- _context5.t2 = _context5["catch"](40);
53545
- logger.warn("transactionHandler: error in awaitTransactionSignature: ".concat(JSON.stringify(_context5.t2), ", ").concat(txid));
53533
+ case 58:
53534
+ _context5.prev = 58;
53535
+ _context5.t3 = _context5["catch"](50);
53536
+ logger.warn("transactionHandler: error in awaitTransactionSignature: ".concat(JSON.stringify(_context5.t3), ", ").concat(txid));
53546
53537
  done = true;
53547
- _errorCode = null;
53548
- _error = null;
53538
+ _errorCode2 = null;
53539
+ _error2 = null;
53549
53540
 
53550
- if (_context5.t2 instanceof Error) {
53551
- _error = _context5.t2.message;
53552
- _errorCode = this._parseSolanaErrorCode(_error);
53541
+ if (_context5.t3 instanceof Error) {
53542
+ _error2 = _context5.t3.message;
53543
+ _errorCode2 = this._parseSolanaErrorCode(_error2);
53553
53544
  }
53554
53545
 
53555
53546
  return _context5.abrupt("return", {
53556
53547
  res: null,
53557
- error: _error,
53558
- errorCode: _errorCode
53548
+ error: _error2,
53549
+ errorCode: _errorCode2
53559
53550
  });
53560
53551
 
53561
- case 56:
53552
+ case 66:
53562
53553
  case "end":
53563
53554
  return _context5.stop();
53564
53555
  }
53565
53556
  }
53566
- }, _callee5, this, [[23, 29], [40, 48]]);
53557
+ }, _callee5, this, [[21, 25], [33, 39], [50, 58]]);
53567
53558
  }));
53568
53559
 
53569
53560
  function _locallyConfirmTransaction(_x5, _x6, _x7, _x8) {
@@ -59977,6 +59968,7 @@ var IdentityService = /*#__PURE__*/function () {
59977
59968
  var handle,
59978
59969
  nethermindContractAddress,
59979
59970
  nethermindEncodedAbi,
59971
+ baseURL,
59980
59972
  _args17 = arguments;
59981
59973
  return regeneratorRuntime.wrap(function _callee17$(_context17) {
59982
59974
  while (1) {
@@ -59985,8 +59977,10 @@ var IdentityService = /*#__PURE__*/function () {
59985
59977
  handle = _args17.length > 5 && _args17[5] !== undefined ? _args17[5] : null;
59986
59978
  nethermindContractAddress = _args17.length > 6 ? _args17[6] : undefined;
59987
59979
  nethermindEncodedAbi = _args17.length > 7 ? _args17[7] : undefined;
59988
- _context17.next = 5;
59980
+ baseURL = _args17.length > 8 ? _args17[8] : undefined;
59981
+ _context17.next = 6;
59989
59982
  return this._makeRequest({
59983
+ baseURL: baseURL,
59990
59984
  url: '/relay',
59991
59985
  method: 'post',
59992
59986
  data: {
@@ -60001,10 +59995,10 @@ var IdentityService = /*#__PURE__*/function () {
60001
59995
  }
60002
59996
  });
60003
59997
 
60004
- case 5:
59998
+ case 6:
60005
59999
  return _context17.abrupt("return", _context17.sent);
60006
60000
 
60007
- case 6:
60001
+ case 7:
60008
60002
  case "end":
60009
60003
  return _context17.stop();
60010
60004
  }
@@ -60523,7 +60517,7 @@ var IdentityService = /*#__PURE__*/function () {
60523
60517
  while (1) {
60524
60518
  switch (_context31.prev = _context31.next) {
60525
60519
  case 0:
60526
- axiosRequestObj.baseURL = this.identityServiceEndpoint;
60520
+ axiosRequestObj.baseURL = axiosRequestObj.baseURL || this.identityServiceEndpoint;
60527
60521
  requestId = uuid();
60528
60522
  axiosRequestObj.headers = _objectSpread2(_objectSpread2({}, axiosRequestObj.headers || {}), {}, {
60529
60523
  'X-Request-ID': requestId