@audius/sdk 3.0.3-beta.76 → 3.0.3-beta.77

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.
@@ -1,4 +1,4 @@
1
- import type { EthContracts } from '../ethContracts';
1
+ import { EthContracts } from '../ethContracts';
2
2
  import { ServiceSelection, ServiceSelectionConfig } from '../../service-selection';
3
3
  import { ServiceName, Timing, Logger } from '../../utils';
4
4
  import { DECISION_TREE_STATE } from './constants';
@@ -1,5 +1,5 @@
1
1
  import { Decision, ServiceSelection, ServiceSelectionConfig } from '../../service-selection';
2
- import type { EthContracts } from '../ethContracts';
2
+ import { EthContracts } from '../ethContracts';
3
3
  import type { AxiosResponse } from 'axios';
4
4
  import type { Maybe, Nullable } from '../../utils';
5
5
  import type { LocalStorage } from '../../utils/localStorage';
@@ -71,12 +71,6 @@ export declare class EthContracts {
71
71
  * @param version2 string 2
72
72
  */
73
73
  isValidSPVersion(version1: string, version2: string): boolean;
74
- /**
75
- * Determines whether the major and minor versions are equal
76
- * @param version1 string 1
77
- * @param version2 string 2
78
- */
79
- hasSameMajorAndMinorVersion(version1: string, version2: string): boolean;
80
74
  getServiceProviderList(spType: string): Promise<{
81
75
  owner: any;
82
76
  endpoint: any;
@@ -93,3 +87,10 @@ export declare class EthContracts {
93
87
  maxStake: import("bn.js");
94
88
  }>;
95
89
  }
90
+ /**
91
+ * Determines whether version2's major/minor versions are greater than or
92
+ * equal to version1's major/minor.
93
+ * @param version1 string 1
94
+ * @param version2 string 2
95
+ */
96
+ export declare const isVersionAtLeastSameMajorMinor: (version1: string, version2: string) => boolean;
package/dist/web-libs.js CHANGED
@@ -31869,9 +31869,9 @@ var EthWeb3Manager = /*#__PURE__*/function () {
31869
31869
  }();
31870
31870
 
31871
31871
  var name = "@audius/sdk";
31872
- var version = "3.0.3-beta.76";
31872
+ var version = "3.0.3-beta.77";
31873
31873
  var audius = {
31874
- releaseSHA: "07f7bd9792bda432d89e46e2bfb4912afab8a223"
31874
+ releaseSHA: "b23d5a6956c2cc4882e10534b00f9c169d03d73a"
31875
31875
  };
31876
31876
  var description = "Audius SDK";
31877
31877
  var main = "dist/index.cjs.js";
@@ -47687,17 +47687,6 @@ var EthContracts = /*#__PURE__*/function () {
47687
47687
  value: function isValidSPVersion(version1, version2) {
47688
47688
  return semver__default["default"].major(version1) === semver__default["default"].major(version2) && semver__default["default"].minor(version1) === semver__default["default"].minor(version2) && semver__default["default"].patch(version2) >= semver__default["default"].patch(version1);
47689
47689
  }
47690
- /**
47691
- * Determines whether the major and minor versions are equal
47692
- * @param version1 string 1
47693
- * @param version2 string 2
47694
- */
47695
-
47696
- }, {
47697
- key: "hasSameMajorAndMinorVersion",
47698
- value: function hasSameMajorAndMinorVersion(version1, version2) {
47699
- return semver__default["default"].major(version1) === semver__default["default"].major(version2) && semver__default["default"].minor(version1) === semver__default["default"].minor(version2);
47700
- }
47701
47690
  }, {
47702
47691
  key: "getServiceProviderList",
47703
47692
  value: function () {
@@ -47814,6 +47803,18 @@ var EthContracts = /*#__PURE__*/function () {
47814
47803
 
47815
47804
  return EthContracts;
47816
47805
  }();
47806
+ /**
47807
+ * Determines whether version2's major/minor versions are greater than or
47808
+ * equal to version1's major/minor.
47809
+ * @param version1 string 1
47810
+ * @param version2 string 2
47811
+ */
47812
+
47813
+ var isVersionAtLeastSameMajorMinor = function isVersionAtLeastSameMajorMinor(version1, version2) {
47814
+ var version1MajorMinor = "".concat(semver__default["default"].major(version1), ".").concat(semver__default["default"].minor(version1), ".0");
47815
+ var version2MajorMinor = "".concat(semver__default["default"].major(version2), ".").concat(semver__default["default"].minor(version2), ".0");
47816
+ return semver__default["default"].gte(version2MajorMinor, version1MajorMinor);
47817
+ };
47817
47818
 
47818
47819
  /**
47819
47820
  * Converts a BN to a Uint8Array of length 8, in little endian notation.
@@ -58113,9 +58114,7 @@ var CreatorNodeSelection = /*#__PURE__*/function (_ServiceSelection) {
58113
58114
 
58114
58115
  if (resp.response) {
58115
58116
  var isUp = resp.response.status === 200;
58116
-
58117
- var versionIsUpToDate = _this2.ethContracts.hasSameMajorAndMinorVersion(_this2.currentVersion, resp.response.data.data.version);
58118
-
58117
+ var versionIsUpToDate = isVersionAtLeastSameMajorMinor(_this2.currentVersion, resp.response.data.data.version);
58119
58118
  var isHealthyStatus = resp.response.data.data.healthy;
58120
58119
  var _resp$response$data$d = resp.response.data.data,
58121
58120
  storagePathSize = _resp$response$data$d.storagePathSize,
@@ -59348,9 +59347,9 @@ var DiscoveryProviderSelection = /*#__PURE__*/function (_ServiceSelection) {
59348
59347
 
59349
59348
  if (status !== 200) return false;
59350
59349
  if (service !== DISCOVERY_SERVICE_NAME) return false;
59351
- if (!semver__default["default"].valid(version)) return false; // If this service is not the same major/minor as what's on chain, reject
59350
+ if (!semver__default["default"].valid(version)) return false; // If this service is not at least the version on chain, reject
59352
59351
 
59353
- if (!this.ethContracts.hasSameMajorAndMinorVersion(this.currentVersion, version)) {
59352
+ if (!isVersionAtLeastSameMajorMinor(this.currentVersion, version)) {
59354
59353
  return false;
59355
59354
  } // If this service is behind by patches, add it as a backup and reject
59356
59355
 
@@ -59481,7 +59480,7 @@ var DiscoveryProviderSelection = /*#__PURE__*/function (_ServiceSelection) {
59481
59480
  for (var _i = 0; _i < _this3.validVersions.length; ++_i) {
59482
59481
  var _this3$validVersions;
59483
59482
 
59484
- if (_this3.ethContracts.hasSameMajorAndMinorVersion((_this3$validVersions = _this3.validVersions) === null || _this3$validVersions === void 0 ? void 0 : _this3$validVersions[_i], version)) {
59483
+ if (isVersionAtLeastSameMajorMinor((_this3$validVersions = _this3.validVersions) === null || _this3$validVersions === void 0 ? void 0 : _this3$validVersions[_i], version)) {
59485
59484
  isVersionOk = true;
59486
59485
  break;
59487
59486
  }