@ar.io/sdk 3.14.0-alpha.9 → 3.14.0

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.
@@ -56,8 +56,12 @@ class AoANTReadable {
56
56
  throw new index_js_2.InvalidContractConfigurationError();
57
57
  }
58
58
  this.processId = this.process.processId;
59
- this.hyperbeamUrl = new URL(config.hyperbeamUrl || 'https://hyperbeam.ario.permaweb.services').toString();
60
- this.checkHyperBeamPromise = this.checkHyperBeamCompatibility();
59
+ // only use hyperbeam if the client has provided a hyperbeamUrl
60
+ // this will avoid overwhelming the HyperBeam node with requests
61
+ // as we shift using HyperBEAM for all ANT operations
62
+ if (config.hyperbeamUrl) {
63
+ this.hyperbeamUrl = new URL(config.hyperbeamUrl).toString();
64
+ }
61
65
  }
62
66
  /**
63
67
  * Check if the process is HyperBeam compatible. If so, we'll use the HyperBeam node to fetch the state.
@@ -65,6 +69,9 @@ class AoANTReadable {
65
69
  * @returns {Promise<boolean>} True if the process is HyperBeam compatible, false otherwise.
66
70
  */
67
71
  async checkHyperBeamCompatibility() {
72
+ if (!this.hyperbeamUrl) {
73
+ return false;
74
+ }
68
75
  if (this.checkHyperBeamPromise !== undefined) {
69
76
  return this.checkHyperBeamPromise;
70
77
  }
@@ -96,9 +103,8 @@ class AoANTReadable {
96
103
  }
97
104
  const unnormalizedState = (await res.json());
98
105
  if (!(0, ant_js_2.isHyperBeamANTState)(unnormalizedState)) {
99
- throw new Error('Invalid HyperBeam ANT state', {
100
- cause: { state: unnormalizedState },
101
- });
106
+ // don't retry if the state is bad, fallback to the CU
107
+ break;
102
108
  }
103
109
  // normalize and return the state
104
110
  return (0, ant_js_2.convertHyperBeamStateToAoANTState)(unnormalizedState);
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '3.14.0-alpha.8';
20
+ exports.version = '3.14.0';
@@ -52,8 +52,12 @@ export class AoANTReadable {
52
52
  throw new InvalidContractConfigurationError();
53
53
  }
54
54
  this.processId = this.process.processId;
55
- this.hyperbeamUrl = new URL(config.hyperbeamUrl || 'https://hyperbeam.ario.permaweb.services').toString();
56
- this.checkHyperBeamPromise = this.checkHyperBeamCompatibility();
55
+ // only use hyperbeam if the client has provided a hyperbeamUrl
56
+ // this will avoid overwhelming the HyperBeam node with requests
57
+ // as we shift using HyperBEAM for all ANT operations
58
+ if (config.hyperbeamUrl) {
59
+ this.hyperbeamUrl = new URL(config.hyperbeamUrl).toString();
60
+ }
57
61
  }
58
62
  /**
59
63
  * Check if the process is HyperBeam compatible. If so, we'll use the HyperBeam node to fetch the state.
@@ -61,6 +65,9 @@ export class AoANTReadable {
61
65
  * @returns {Promise<boolean>} True if the process is HyperBeam compatible, false otherwise.
62
66
  */
63
67
  async checkHyperBeamCompatibility() {
68
+ if (!this.hyperbeamUrl) {
69
+ return false;
70
+ }
64
71
  if (this.checkHyperBeamPromise !== undefined) {
65
72
  return this.checkHyperBeamPromise;
66
73
  }
@@ -92,9 +99,8 @@ export class AoANTReadable {
92
99
  }
93
100
  const unnormalizedState = (await res.json());
94
101
  if (!isHyperBeamANTState(unnormalizedState)) {
95
- throw new Error('Invalid HyperBeam ANT state', {
96
- cause: { state: unnormalizedState },
97
- });
102
+ // don't retry if the state is bad, fallback to the CU
103
+ break;
98
104
  }
99
105
  // normalize and return the state
100
106
  return convertHyperBeamStateToAoANTState(unnormalizedState);
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.14.0-alpha.8';
17
+ export const version = '3.14.0';
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "3.14.0-alpha.8";
16
+ export declare const version = "3.14.0-alpha.9";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.14.0-alpha.9",
3
+ "version": "3.14.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"