@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.
@@ -601,9 +601,9 @@ if (typeof window !== 'undefined' && window && window.Web3) {
601
601
  var LibsWeb3 = Web3;
602
602
 
603
603
  var name = "@audius/sdk";
604
- var version$1 = "3.0.8-beta.7";
604
+ var version$1 = "3.0.8-beta.9";
605
605
  var audius = {
606
- releaseSHA: "72c223f61d61e353356d3b0f33e8db6a17e5b7a9"
606
+ releaseSHA: "460ca8bcef335cf7cfed191d2d26f1f913b2eee2"
607
607
  };
608
608
  var description = "Audius SDK";
609
609
  var keywords = [
@@ -9428,76 +9428,42 @@ var Web3Manager = /*#__PURE__*/function () {
9428
9428
  _context6.next = 22;
9429
9429
  return retry( /*#__PURE__*/function () {
9430
9430
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(bail) {
9431
- var _this$discoveryProvid, res, _this$identityService;
9431
+ var _this$discoveryProvid, _this$identityService, _this$identityService2, baseURL;
9432
9432
 
9433
9433
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
9434
9434
  while (1) {
9435
9435
  switch (_context5.prev = _context5.next) {
9436
9436
  case 0:
9437
9437
  _context5.prev = 0;
9438
+ 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;
9439
+ console.error("relaying to base url ".concat(baseURL));
9440
+ _context5.next = 5;
9441
+ 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);
9438
9442
 
9439
- if (!_this.useDiscoveryRelay()) {
9440
- _context5.next = 10;
9441
- break;
9442
- }
9443
-
9444
- _context5.next = 4;
9445
- return (_this$discoveryProvid = _this.discoveryProvider) === null || _this$discoveryProvid === void 0 ? void 0 : _this$discoveryProvid.relay({
9446
- contractRegistryKey: contractRegistryKey,
9447
- contractAddress: contractAddress,
9448
- senderAddress: _this.ownerWallet.getAddressString(),
9449
- encodedABI: encodedABI,
9450
- gasLimit: gasLimit,
9451
- handle: _this.userSuppliedHandle,
9452
- nethermindContractAddress: nethermindContractAddress,
9453
- nethermindEncodedAbi: nethermindEncodedAbi
9454
- });
9455
-
9456
- case 4:
9457
- res = _context5.sent;
9458
-
9459
- if (!(res === null || res === undefined)) {
9460
- _context5.next = 7;
9461
- break;
9462
- }
9463
-
9464
- throw new Error("discovery relay returned empty response");
9465
-
9466
- case 7:
9467
- return _context5.abrupt("return", res);
9468
-
9469
- case 10:
9470
- _context5.next = 12;
9471
- 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);
9472
-
9473
- case 12:
9443
+ case 5:
9474
9444
  return _context5.abrupt("return", _context5.sent);
9475
9445
 
9476
- case 13:
9477
- _context5.next = 21;
9478
- break;
9479
-
9480
- case 15:
9481
- _context5.prev = 15;
9446
+ case 8:
9447
+ _context5.prev = 8;
9482
9448
  _context5.t0 = _context5["catch"](0);
9483
9449
 
9484
9450
  if (!(_context5.t0.response.status === 403)) {
9485
- _context5.next = 20;
9451
+ _context5.next = 13;
9486
9452
  break;
9487
9453
  }
9488
9454
 
9489
9455
  bail(_context5.t0);
9490
9456
  return _context5.abrupt("return");
9491
9457
 
9492
- case 20:
9458
+ case 13:
9493
9459
  throw _context5.t0;
9494
9460
 
9495
- case 21:
9461
+ case 14:
9496
9462
  case "end":
9497
9463
  return _context5.stop();
9498
9464
  }
9499
9465
  }
9500
- }, _callee5, null, [[0, 15]]);
9466
+ }, _callee5, null, [[0, 8]]);
9501
9467
  }));
9502
9468
 
9503
9469
  return function (_x8) {
@@ -32560,6 +32526,7 @@ var IdentityService = /*#__PURE__*/function () {
32560
32526
  var handle,
32561
32527
  nethermindContractAddress,
32562
32528
  nethermindEncodedAbi,
32529
+ baseURL,
32563
32530
  _args17 = arguments;
32564
32531
  return regeneratorRuntime.wrap(function _callee17$(_context17) {
32565
32532
  while (1) {
@@ -32568,8 +32535,10 @@ var IdentityService = /*#__PURE__*/function () {
32568
32535
  handle = _args17.length > 5 && _args17[5] !== undefined ? _args17[5] : null;
32569
32536
  nethermindContractAddress = _args17.length > 6 ? _args17[6] : undefined;
32570
32537
  nethermindEncodedAbi = _args17.length > 7 ? _args17[7] : undefined;
32571
- _context17.next = 5;
32538
+ baseURL = _args17.length > 8 ? _args17[8] : undefined;
32539
+ _context17.next = 6;
32572
32540
  return this._makeRequest({
32541
+ baseURL: baseURL,
32573
32542
  url: '/relay',
32574
32543
  method: 'post',
32575
32544
  data: {
@@ -32584,10 +32553,10 @@ var IdentityService = /*#__PURE__*/function () {
32584
32553
  }
32585
32554
  });
32586
32555
 
32587
- case 5:
32556
+ case 6:
32588
32557
  return _context17.abrupt("return", _context17.sent);
32589
32558
 
32590
- case 6:
32559
+ case 7:
32591
32560
  case "end":
32592
32561
  return _context17.stop();
32593
32562
  }
@@ -33106,7 +33075,7 @@ var IdentityService = /*#__PURE__*/function () {
33106
33075
  while (1) {
33107
33076
  switch (_context31.prev = _context31.next) {
33108
33077
  case 0:
33109
- axiosRequestObj.baseURL = this.identityServiceEndpoint;
33078
+ axiosRequestObj.baseURL = axiosRequestObj.baseURL || this.identityServiceEndpoint;
33110
33079
  requestId = uuid();
33111
33080
  axiosRequestObj.headers = _objectSpread2(_objectSpread2({}, axiosRequestObj.headers || {}), {}, {
33112
33081
  'X-Request-ID': requestId
@@ -34312,15 +34281,17 @@ var TransactionHandler = /*#__PURE__*/function () {
34312
34281
  feePayerAccount,
34313
34282
  tx,
34314
34283
  rawTransaction,
34315
- sendRawTransaction,
34316
- txid,
34317
34284
  errorCode,
34318
34285
  error,
34286
+ sendRawTransaction,
34287
+ txid,
34288
+ _errorCode,
34289
+ _error,
34319
34290
  done,
34320
34291
  sendCount,
34321
34292
  startTime,
34322
- _errorCode,
34323
- _error,
34293
+ _errorCode2,
34294
+ _error2,
34324
34295
  _args5 = arguments;
34325
34296
 
34326
34297
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -34393,8 +34364,31 @@ var TransactionHandler = /*#__PURE__*/function () {
34393
34364
  });
34394
34365
  }
34395
34366
 
34396
- rawTransaction = tx.serialize(); // Send the txn
34367
+ _context5.prev = 21;
34368
+ rawTransaction = tx.serialize();
34369
+ _context5.next = 32;
34370
+ break;
34371
+
34372
+ case 25:
34373
+ _context5.prev = 25;
34374
+ _context5.t1 = _context5["catch"](21);
34375
+ logger.warn("transactionHandler: transaction serialization failed: ".concat(_context5.t1));
34376
+ errorCode = null;
34377
+ error = null;
34378
+
34379
+ if (_context5.t1 instanceof Error) {
34380
+ error = _context5.t1.message;
34381
+ errorCode = this._parseSolanaErrorCode(error);
34382
+ }
34383
+
34384
+ return _context5.abrupt("return", {
34385
+ res: null,
34386
+ error: error,
34387
+ errorCode: errorCode
34388
+ });
34397
34389
 
34390
+ case 32:
34391
+ // Send the txn
34398
34392
  sendRawTransaction = /*#__PURE__*/function () {
34399
34393
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
34400
34394
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -34424,35 +34418,35 @@ var TransactionHandler = /*#__PURE__*/function () {
34424
34418
  };
34425
34419
  }();
34426
34420
 
34427
- _context5.prev = 23;
34428
- _context5.next = 26;
34421
+ _context5.prev = 33;
34422
+ _context5.next = 36;
34429
34423
  return sendRawTransaction();
34430
34424
 
34431
- case 26:
34425
+ case 36:
34432
34426
  txid = _context5.sent;
34433
- _context5.next = 36;
34427
+ _context5.next = 46;
34434
34428
  break;
34435
34429
 
34436
- case 29:
34437
- _context5.prev = 29;
34438
- _context5.t1 = _context5["catch"](23);
34430
+ case 39:
34431
+ _context5.prev = 39;
34432
+ _context5.t2 = _context5["catch"](33);
34439
34433
  // Rarely, this intiial send will fail
34440
- logger.warn("transactionHandler: Initial send failed: ".concat(_context5.t1));
34441
- errorCode = null;
34442
- error = null;
34434
+ logger.warn("transactionHandler: Initial send failed: ".concat(_context5.t2));
34435
+ _errorCode = null;
34436
+ _error = null;
34443
34437
 
34444
- if (_context5.t1 instanceof Error) {
34445
- error = _context5.t1.message;
34446
- errorCode = this._parseSolanaErrorCode(error);
34438
+ if (_context5.t2 instanceof Error) {
34439
+ _error = _context5.t2.message;
34440
+ _errorCode = this._parseSolanaErrorCode(_error);
34447
34441
  }
34448
34442
 
34449
34443
  return _context5.abrupt("return", {
34450
34444
  res: null,
34451
- error: error,
34452
- errorCode: errorCode
34445
+ error: _error,
34446
+ errorCode: _errorCode
34453
34447
  });
34454
34448
 
34455
- case 36:
34449
+ case 46:
34456
34450
  done = false; // Start up resubmission loop
34457
34451
 
34458
34452
  sendCount = 0;
@@ -34499,11 +34493,11 @@ var TransactionHandler = /*#__PURE__*/function () {
34499
34493
  } // Await for tx confirmation
34500
34494
 
34501
34495
 
34502
- _context5.prev = 40;
34503
- _context5.next = 43;
34496
+ _context5.prev = 50;
34497
+ _context5.next = 53;
34504
34498
  return this._awaitTransactionSignatureConfirmation(txid, logger);
34505
34499
 
34506
- case 43:
34500
+ case 53:
34507
34501
  done = true;
34508
34502
  logger.info("transactionHandler: finished for txid ".concat(txid, " with ").concat(sendCount, " retries"));
34509
34503
  return _context5.abrupt("return", {
@@ -34512,31 +34506,31 @@ var TransactionHandler = /*#__PURE__*/function () {
34512
34506
  errorCode: null
34513
34507
  });
34514
34508
 
34515
- case 48:
34516
- _context5.prev = 48;
34517
- _context5.t2 = _context5["catch"](40);
34518
- logger.warn("transactionHandler: error in awaitTransactionSignature: ".concat(JSON.stringify(_context5.t2), ", ").concat(txid));
34509
+ case 58:
34510
+ _context5.prev = 58;
34511
+ _context5.t3 = _context5["catch"](50);
34512
+ logger.warn("transactionHandler: error in awaitTransactionSignature: ".concat(JSON.stringify(_context5.t3), ", ").concat(txid));
34519
34513
  done = true;
34520
- _errorCode = null;
34521
- _error = null;
34514
+ _errorCode2 = null;
34515
+ _error2 = null;
34522
34516
 
34523
- if (_context5.t2 instanceof Error) {
34524
- _error = _context5.t2.message;
34525
- _errorCode = this._parseSolanaErrorCode(_error);
34517
+ if (_context5.t3 instanceof Error) {
34518
+ _error2 = _context5.t3.message;
34519
+ _errorCode2 = this._parseSolanaErrorCode(_error2);
34526
34520
  }
34527
34521
 
34528
34522
  return _context5.abrupt("return", {
34529
34523
  res: null,
34530
- error: _error,
34531
- errorCode: _errorCode
34524
+ error: _error2,
34525
+ errorCode: _errorCode2
34532
34526
  });
34533
34527
 
34534
- case 56:
34528
+ case 66:
34535
34529
  case "end":
34536
34530
  return _context5.stop();
34537
34531
  }
34538
34532
  }
34539
- }, _callee5, this, [[23, 29], [40, 48]]);
34533
+ }, _callee5, this, [[21, 25], [33, 39], [50, 58]]);
34540
34534
  }));
34541
34535
 
34542
34536
  function _locallyConfirmTransaction(_x5, _x6, _x7, _x8) {