@ar.io/sdk 3.14.0-alpha.9 → 3.14.1-alpha.1
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 +15 -6
- package/lib/cjs/common/contracts/ao-process.js +3 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +15 -6
- package/lib/esm/common/contracts/ao-process.js +3 -1
- 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,15 +56,25 @@ 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 !== undefined) {
|
|
63
|
+
this.hyperbeamUrl = new URL(config.hyperbeamUrl);
|
|
64
|
+
this.logger.debug(`Using HyperBEAM node for process ${this.processId}`, {
|
|
65
|
+
hyperbeamUrl: this.hyperbeamUrl,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
69
|
/**
|
|
63
70
|
* Check if the process is HyperBeam compatible. If so, we'll use the HyperBeam node to fetch the state.
|
|
64
71
|
*
|
|
65
72
|
* @returns {Promise<boolean>} True if the process is HyperBeam compatible, false otherwise.
|
|
66
73
|
*/
|
|
67
|
-
|
|
74
|
+
checkHyperBeamCompatibility() {
|
|
75
|
+
if (this.hyperbeamUrl === undefined) {
|
|
76
|
+
return Promise.resolve(false);
|
|
77
|
+
}
|
|
68
78
|
if (this.checkHyperBeamPromise !== undefined) {
|
|
69
79
|
return this.checkHyperBeamPromise;
|
|
70
80
|
}
|
|
@@ -96,9 +106,8 @@ class AoANTReadable {
|
|
|
96
106
|
}
|
|
97
107
|
const unnormalizedState = (await res.json());
|
|
98
108
|
if (!(0, ant_js_2.isHyperBeamANTState)(unnormalizedState)) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
});
|
|
109
|
+
// don't retry if the state is bad, fallback to the CU
|
|
110
|
+
break;
|
|
102
111
|
}
|
|
103
112
|
// normalize and return the state
|
|
104
113
|
return (0, ant_js_2.convertHyperBeamStateToAoANTState)(unnormalizedState);
|
|
@@ -77,7 +77,9 @@ class AOProcess {
|
|
|
77
77
|
processId: this.processId,
|
|
78
78
|
ao: JSON.stringify(this.ao),
|
|
79
79
|
});
|
|
80
|
-
throw new Error(`Failed to evaluate
|
|
80
|
+
throw new Error(`Failed to evaluate dry-run on process ${this.processId}.`, {
|
|
81
|
+
cause: error,
|
|
82
|
+
});
|
|
81
83
|
}
|
|
82
84
|
// exponential backoff
|
|
83
85
|
await new Promise((resolve) => setTimeout(resolve, 2 ** attempts * 1000));
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/ant.js
CHANGED
|
@@ -52,15 +52,25 @@ 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 !== undefined) {
|
|
59
|
+
this.hyperbeamUrl = new URL(config.hyperbeamUrl);
|
|
60
|
+
this.logger.debug(`Using HyperBEAM node for process ${this.processId}`, {
|
|
61
|
+
hyperbeamUrl: this.hyperbeamUrl,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
/**
|
|
59
66
|
* Check if the process is HyperBeam compatible. If so, we'll use the HyperBeam node to fetch the state.
|
|
60
67
|
*
|
|
61
68
|
* @returns {Promise<boolean>} True if the process is HyperBeam compatible, false otherwise.
|
|
62
69
|
*/
|
|
63
|
-
|
|
70
|
+
checkHyperBeamCompatibility() {
|
|
71
|
+
if (this.hyperbeamUrl === undefined) {
|
|
72
|
+
return Promise.resolve(false);
|
|
73
|
+
}
|
|
64
74
|
if (this.checkHyperBeamPromise !== undefined) {
|
|
65
75
|
return this.checkHyperBeamPromise;
|
|
66
76
|
}
|
|
@@ -92,9 +102,8 @@ export class AoANTReadable {
|
|
|
92
102
|
}
|
|
93
103
|
const unnormalizedState = (await res.json());
|
|
94
104
|
if (!isHyperBeamANTState(unnormalizedState)) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
105
|
+
// don't retry if the state is bad, fallback to the CU
|
|
106
|
+
break;
|
|
98
107
|
}
|
|
99
108
|
// normalize and return the state
|
|
100
109
|
return convertHyperBeamStateToAoANTState(unnormalizedState);
|
|
@@ -74,7 +74,9 @@ export class AOProcess {
|
|
|
74
74
|
processId: this.processId,
|
|
75
75
|
ao: JSON.stringify(this.ao),
|
|
76
76
|
});
|
|
77
|
-
throw new Error(`Failed to evaluate
|
|
77
|
+
throw new Error(`Failed to evaluate dry-run on process ${this.processId}.`, {
|
|
78
|
+
cause: error,
|
|
79
|
+
});
|
|
78
80
|
}
|
|
79
81
|
// exponential backoff
|
|
80
82
|
await new Promise((resolve) => setTimeout(resolve, 2 ** attempts * 1000));
|
package/lib/esm/version.js
CHANGED
package/lib/types/version.d.ts
CHANGED