@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.
- package/bundles/web.bundle.min.js +2 -2
- package/lib/cjs/common/ant.js +11 -5
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +11 -5
- package/lib/esm/version.js +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -1111
package/lib/cjs/common/ant.js
CHANGED
|
@@ -56,8 +56,12 @@ class AoANTReadable {
|
|
|
56
56
|
throw new index_js_2.InvalidContractConfigurationError();
|
|
57
57
|
}
|
|
58
58
|
this.processId = this.process.processId;
|
|
59
|
-
|
|
60
|
-
this
|
|
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
|
-
|
|
100
|
-
|
|
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);
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/ant.js
CHANGED
|
@@ -52,8 +52,12 @@ export class AoANTReadable {
|
|
|
52
52
|
throw new InvalidContractConfigurationError();
|
|
53
53
|
}
|
|
54
54
|
this.processId = this.process.processId;
|
|
55
|
-
|
|
56
|
-
this
|
|
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
|
-
|
|
96
|
-
|
|
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);
|
package/lib/esm/version.js
CHANGED
package/lib/types/version.d.ts
CHANGED