@steerprotocol/data-connector-loader 5.0.0-next.1 → 5.0.0-next.10
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/README.md +102 -0
- package/lib/bundle/bundleBase.d.ts +11 -14
- package/lib/bundle/bundleBase.js +56 -88
- package/lib/bundle/bundleDataConnector.d.ts +2 -6
- package/lib/bundle/bundleDataConnector.js +22 -47
- package/lib/esm/bundle/bundleBase.d.ts +11 -14
- package/lib/esm/bundle/bundleBase.js +77 -91
- package/lib/esm/bundle/bundleDataConnector.d.ts +2 -6
- package/lib/esm/bundle/bundleDataConnector.js +26 -49
- package/lib/esm/execution/executionApp.d.ts +16 -15
- package/lib/esm/execution/executionApp.js +364 -321
- package/lib/esm/execution/executionBase.d.ts +7 -7
- package/lib/esm/execution/executionBase.js +27 -13
- package/lib/esm/execution/executionDataConnector.d.ts +6 -3
- package/lib/esm/execution/executionDataConnector.js +128 -69
- package/lib/esm/index.d.ts +7 -7
- package/lib/esm/index.js +4 -4
- package/lib/esm/types.d.ts +20 -24
- package/lib/esm/types.js +5 -5
- package/lib/esm/utils/blockFinder.d.ts +2 -2
- package/lib/esm/utils/blockFinder.js +3 -3
- package/lib/esm/utils/consts.js +39 -39
- package/lib/esm/utils/pluginManager.d.ts +1 -1
- package/lib/esm/utils/pluginManager.js +6 -5
- package/lib/esm/utils/replace-old-subgraphs.js +79 -61
- package/lib/esm/utils/rpc.d.ts +4 -0
- package/lib/esm/utils/rpc.js +32 -0
- package/lib/esm/utils/utils.d.ts +8 -11
- package/lib/esm/utils/utils.js +61 -55
- package/lib/execution/executionApp.d.ts +16 -15
- package/lib/execution/executionApp.js +353 -315
- package/lib/execution/executionBase.d.ts +7 -7
- package/lib/execution/executionBase.js +27 -13
- package/lib/execution/executionDataConnector.d.ts +6 -3
- package/lib/execution/executionDataConnector.js +130 -64
- package/lib/index.d.ts +7 -7
- package/lib/index.js +1 -1
- package/lib/types.d.ts +20 -24
- package/lib/types.js +5 -5
- package/lib/utils/blockFinder.d.ts +2 -2
- package/lib/utils/blockFinder.js +3 -3
- package/lib/utils/consts.js +39 -39
- package/lib/utils/pluginManager.d.ts +1 -1
- package/lib/utils/pluginManager.js +5 -4
- package/lib/utils/replace-old-subgraphs.js +79 -61
- package/lib/utils/rpc.d.ts +4 -0
- package/lib/utils/rpc.js +47 -0
- package/lib/utils/utils.d.ts +8 -11
- package/lib/utils/utils.js +55 -60
- package/package.json +15 -15
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
import { loadWasm, loadWasmSync } from
|
|
2
|
-
import {
|
|
3
|
-
const UNSTABLE_RPC_PATTERNS = [/drpc\.org/i];
|
|
4
|
-
function createFallbackRpcProvider(urls) {
|
|
5
|
-
const seen = new Set();
|
|
6
|
-
const preferred = [];
|
|
7
|
-
const deprioritized = [];
|
|
8
|
-
for (const url of urls) {
|
|
9
|
-
const trimmed = url.trim();
|
|
10
|
-
if (trimmed.length === 0 || seen.has(trimmed)) {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
seen.add(trimmed);
|
|
14
|
-
if (UNSTABLE_RPC_PATTERNS.some((pattern) => pattern.test(trimmed))) {
|
|
15
|
-
deprioritized.push(trimmed);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
preferred.push(trimmed);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const prioritized = preferred.length > 0 ? [...preferred, ...deprioritized] : [...preferred, ...deprioritized];
|
|
22
|
-
if (prioritized.length === 0) {
|
|
23
|
-
throw new Error('No RPC URLs configured');
|
|
24
|
-
}
|
|
25
|
-
const providers = prioritized.map((url) => new ethers.JsonRpcProvider(url));
|
|
26
|
-
return providers.length === 1 ? providers[0] : new ethers.FallbackProvider(providers);
|
|
27
|
-
}
|
|
1
|
+
import { loadWasm, loadWasmSync } from "@steerprotocol/app-loader";
|
|
2
|
+
import { createRpcClient } from "../utils/rpc.js";
|
|
28
3
|
function bigIntReplacer(_key, value) {
|
|
29
|
-
return typeof value ===
|
|
4
|
+
return typeof value === "bigint" ? value.toString() : value;
|
|
30
5
|
}
|
|
31
6
|
export class BundleBase {
|
|
32
|
-
constructor(wasmFile,
|
|
7
|
+
constructor({ wasmFile, config, executionConfig, rpc, }) {
|
|
33
8
|
this.wasmFile = wasmFile;
|
|
34
|
-
this.config =
|
|
35
|
-
this.configObj = JSON.parse(
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.executionAppConfig = executionAppConfig;
|
|
9
|
+
this.config = config;
|
|
10
|
+
this.configObj = JSON.parse(config);
|
|
11
|
+
this.rpc = rpc;
|
|
12
|
+
this.executionAppConfig = executionConfig;
|
|
39
13
|
}
|
|
40
14
|
async load() {
|
|
41
15
|
const instance = await loadWasm(this.wasmFile, {});
|
|
@@ -44,15 +18,15 @@ export class BundleBase {
|
|
|
44
18
|
return this.module;
|
|
45
19
|
}
|
|
46
20
|
loadSync() {
|
|
47
|
-
if (typeof this.wasmFile ===
|
|
48
|
-
throw new Error(
|
|
21
|
+
if (typeof this.wasmFile === "string") {
|
|
22
|
+
throw new Error("Cannot load module synchronously unless wasmFile is of type ArrayBuffer");
|
|
49
23
|
}
|
|
50
24
|
this.module = loadWasmSync(this.wasmFile, {});
|
|
51
25
|
return this.module;
|
|
52
26
|
}
|
|
53
27
|
async execute(response) {
|
|
54
28
|
if (!this.executionContext) {
|
|
55
|
-
throw new Error(
|
|
29
|
+
throw new Error("Execution context missing");
|
|
56
30
|
}
|
|
57
31
|
// If the module is not initialized, try to load it
|
|
58
32
|
if (!this.module) {
|
|
@@ -60,18 +34,20 @@ export class BundleBase {
|
|
|
60
34
|
await this.load();
|
|
61
35
|
}
|
|
62
36
|
catch {
|
|
63
|
-
throw new Error(
|
|
37
|
+
throw new Error("Module not initialized");
|
|
64
38
|
}
|
|
65
39
|
}
|
|
66
40
|
// If the module is still not initialized, throw an error
|
|
67
41
|
if (!this.module)
|
|
68
|
-
throw new Error(
|
|
69
|
-
return response === undefined
|
|
42
|
+
throw new Error("Module not initialized");
|
|
43
|
+
return response === undefined
|
|
44
|
+
? await this.executeModuleWithResult()
|
|
45
|
+
: await this.executeModuleWithResult(response);
|
|
70
46
|
}
|
|
71
47
|
// For dynamic job data connector
|
|
72
48
|
async transform() {
|
|
73
49
|
if (!this.executionContext) {
|
|
74
|
-
throw new Error(
|
|
50
|
+
throw new Error("Execution context missing");
|
|
75
51
|
}
|
|
76
52
|
// If the module is not initialized, try to load it
|
|
77
53
|
if (!this.module) {
|
|
@@ -79,18 +55,18 @@ export class BundleBase {
|
|
|
79
55
|
await this.load();
|
|
80
56
|
}
|
|
81
57
|
catch {
|
|
82
|
-
throw new Error(
|
|
58
|
+
throw new Error("Module not initialized");
|
|
83
59
|
}
|
|
84
60
|
}
|
|
85
61
|
// If the module is still not initialized, throw an error
|
|
86
62
|
if (!this.module)
|
|
87
|
-
throw new Error(
|
|
63
|
+
throw new Error("Module not initialized");
|
|
88
64
|
// Call the main function with the response
|
|
89
65
|
return await this.module.transform();
|
|
90
66
|
}
|
|
91
67
|
async executeBundle(data) {
|
|
92
68
|
if (!this.executionContext) {
|
|
93
|
-
throw new Error(
|
|
69
|
+
throw new Error("Execution context missing");
|
|
94
70
|
}
|
|
95
71
|
// If the module is not initialized, try to load it
|
|
96
72
|
if (!this.module) {
|
|
@@ -98,21 +74,21 @@ export class BundleBase {
|
|
|
98
74
|
await this.load();
|
|
99
75
|
}
|
|
100
76
|
catch {
|
|
101
|
-
throw new Error(
|
|
77
|
+
throw new Error("Module not initialized");
|
|
102
78
|
}
|
|
103
79
|
}
|
|
104
80
|
// If the module is still not initialized, throw an error
|
|
105
81
|
if (!this.module)
|
|
106
|
-
throw new Error(
|
|
82
|
+
throw new Error("Module not initialized");
|
|
107
83
|
const result = await this.executeModuleWithResult(...data);
|
|
108
84
|
if (result === null) {
|
|
109
|
-
throw new Error(
|
|
85
|
+
throw new Error("Module execution returned null");
|
|
110
86
|
}
|
|
111
87
|
return result;
|
|
112
88
|
}
|
|
113
89
|
async executeDynamicJobBundle(data) {
|
|
114
90
|
if (!this.executionContext) {
|
|
115
|
-
throw new Error(
|
|
91
|
+
throw new Error("Execution context missing");
|
|
116
92
|
}
|
|
117
93
|
// If the module is not initialized, try to load it
|
|
118
94
|
if (!this.module) {
|
|
@@ -120,108 +96,118 @@ export class BundleBase {
|
|
|
120
96
|
await this.load();
|
|
121
97
|
}
|
|
122
98
|
catch {
|
|
123
|
-
throw new Error(
|
|
99
|
+
throw new Error("Module not initialized");
|
|
124
100
|
}
|
|
125
101
|
}
|
|
126
102
|
// If the module is still not initialized, throw an error
|
|
127
103
|
if (!this.module)
|
|
128
|
-
throw new Error(
|
|
104
|
+
throw new Error("Module not initialized");
|
|
129
105
|
const result = await this.executeModuleWithResult(...data);
|
|
130
106
|
if (result === null) {
|
|
131
|
-
throw new Error(
|
|
107
|
+
throw new Error("Module execution returned null");
|
|
132
108
|
}
|
|
133
109
|
return result;
|
|
134
110
|
}
|
|
135
111
|
reset() {
|
|
136
|
-
if (this.module && this.module[
|
|
112
|
+
if (this.module && this.module["reset"]) {
|
|
137
113
|
this.module.reset();
|
|
138
114
|
}
|
|
139
115
|
}
|
|
140
116
|
setExecutionContextStrategyExecution(executionContext, forceDeposit) {
|
|
117
|
+
if (!this.module)
|
|
118
|
+
throw new Error("Module not initialized");
|
|
141
119
|
// Determine the timestamp for epoch
|
|
142
120
|
const timestamp = this.subtractDate(executionContext.executionTimestamp, Number(executionContext.epochLength)).getTime();
|
|
143
121
|
// Divide milliseconds data to seconds for transformation bundle
|
|
144
122
|
const timestampInSecs = Math.floor(timestamp / 1000);
|
|
145
|
-
this.executionContext = {
|
|
146
|
-
|
|
147
|
-
|
|
123
|
+
this.executionContext = {
|
|
124
|
+
...executionContext,
|
|
125
|
+
epochTimestamp: timestampInSecs,
|
|
126
|
+
};
|
|
127
|
+
const completeConfig = {
|
|
128
|
+
...JSON.parse(this.config),
|
|
129
|
+
...this.executionContext,
|
|
130
|
+
};
|
|
148
131
|
if (completeConfig.triggerStyle && forceDeposit === true) {
|
|
149
|
-
completeConfig.triggerStyle =
|
|
132
|
+
completeConfig.triggerStyle = "None";
|
|
133
|
+
}
|
|
134
|
+
if (this.module.initialize(JSON.stringify(completeConfig, bigIntReplacer)) ===
|
|
135
|
+
false) {
|
|
136
|
+
throw new Error("Strategy initialization failed");
|
|
150
137
|
}
|
|
151
|
-
this.module?.initialize(JSON.stringify(completeConfig, bigIntReplacer));
|
|
152
138
|
}
|
|
153
139
|
/**
|
|
154
140
|
* Initializes a strategy from an already resolved SDK context. Unlike the
|
|
155
141
|
* legacy setter this deliberately does not derive a timestamp or block.
|
|
156
142
|
*/
|
|
157
143
|
initializeStrategyWithContext(executionContext, forceDeposit) {
|
|
144
|
+
if (!this.module)
|
|
145
|
+
throw new Error("Module not initialized");
|
|
158
146
|
this.executionContext = executionContext;
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
const completeConfig = {
|
|
148
|
+
...JSON.parse(this.config),
|
|
149
|
+
...executionContext,
|
|
150
|
+
};
|
|
161
151
|
if (completeConfig.triggerStyle && forceDeposit === true) {
|
|
162
|
-
completeConfig.triggerStyle =
|
|
152
|
+
completeConfig.triggerStyle = "None";
|
|
153
|
+
}
|
|
154
|
+
if (this.module.initialize(JSON.stringify(completeConfig, bigIntReplacer)) ===
|
|
155
|
+
false) {
|
|
156
|
+
throw new Error("Strategy initialization failed");
|
|
163
157
|
}
|
|
164
|
-
this.module?.initialize(JSON.stringify(completeConfig, bigIntReplacer));
|
|
165
158
|
}
|
|
166
159
|
setExecutionContextDataConnector(executionContext) {
|
|
167
160
|
// Determine the timestamp for epoch
|
|
168
161
|
const timestamp = this.subtractDate(executionContext.executionTimestamp, Number(executionContext.epochLength)).getTime();
|
|
169
162
|
// Divide milliseconds data to seconds for transformation bundle
|
|
170
163
|
const timestampInSecs = Math.floor(timestamp / 1000);
|
|
171
|
-
this.executionContext = {
|
|
172
|
-
|
|
173
|
-
|
|
164
|
+
this.executionContext = {
|
|
165
|
+
...executionContext,
|
|
166
|
+
epochTimestamp: timestampInSecs,
|
|
167
|
+
};
|
|
168
|
+
const completeConfig = {
|
|
169
|
+
...JSON.parse(this.config),
|
|
170
|
+
executionContext: this.executionContext,
|
|
171
|
+
};
|
|
174
172
|
this.module?.initialize(JSON.stringify(completeConfig, bigIntReplacer));
|
|
175
173
|
}
|
|
176
174
|
/** Initializes a data connector with an immutable SDK anchor. */
|
|
177
175
|
initializeDataConnectorWithContext(executionContext) {
|
|
176
|
+
if (!this.module)
|
|
177
|
+
throw new Error("Module not initialized");
|
|
178
178
|
this.executionContext = executionContext;
|
|
179
|
-
this.scheduleEpochTimestamp = executionContext.epochTimestamp;
|
|
180
179
|
const completeConfig = { ...JSON.parse(this.config), executionContext };
|
|
181
|
-
this.module
|
|
180
|
+
if (this.module.initialize(JSON.stringify(completeConfig, bigIntReplacer)) ===
|
|
181
|
+
false) {
|
|
182
|
+
throw new Error("Data connector initialization failed");
|
|
183
|
+
}
|
|
182
184
|
}
|
|
183
185
|
async executeModule(response) {
|
|
184
186
|
if (!this.module) {
|
|
185
|
-
throw new Error(
|
|
187
|
+
throw new Error("Module not initialized");
|
|
186
188
|
}
|
|
187
189
|
return await this.executeModuleWithResult(response);
|
|
188
190
|
}
|
|
189
191
|
async executeModuleWithResult(...params) {
|
|
190
192
|
if (!this.module) {
|
|
191
|
-
throw new Error(
|
|
193
|
+
throw new Error("Module not initialized");
|
|
192
194
|
}
|
|
193
195
|
return await this.module.execute(...params);
|
|
194
196
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
let chainId;
|
|
201
|
-
// check if chainId is configured in data connector config
|
|
202
|
-
if (this.configObj.chainId) {
|
|
203
|
-
chainId = this.configObj.chainId;
|
|
204
|
-
}
|
|
205
|
-
else if (config && config.chainId) {
|
|
206
|
-
// if chainId is in the request config from dataconnector execution
|
|
207
|
-
chainId = config.chainId;
|
|
208
|
-
}
|
|
209
|
-
if (chainId && this.etherRpcConfig && this.etherRpcConfig[chainId]) {
|
|
210
|
-
const rpcConfig = this.etherRpcConfig[chainId];
|
|
211
|
-
return createFallbackRpcProvider(rpcConfig.urls ?? [rpcConfig.url]);
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
return this.providerIdentity;
|
|
215
|
-
}
|
|
197
|
+
getClient() {
|
|
198
|
+
if (!this.rpc)
|
|
199
|
+
return undefined;
|
|
200
|
+
this.rpcClient ?? (this.rpcClient = createRpcClient(this.rpc, this.executionAppConfig.chainId));
|
|
201
|
+
return this.rpcClient;
|
|
216
202
|
}
|
|
217
203
|
getResults() {
|
|
218
204
|
if (!this.module)
|
|
219
|
-
throw new Error(
|
|
205
|
+
throw new Error("Module not initialized");
|
|
220
206
|
return this.module.transform();
|
|
221
207
|
}
|
|
222
208
|
version() {
|
|
223
209
|
if (!this.module)
|
|
224
|
-
throw new Error(
|
|
210
|
+
throw new Error("Module not initialized");
|
|
225
211
|
return Number(this.module.version());
|
|
226
212
|
}
|
|
227
213
|
subtractDate(timestamp, epochLength) {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import type { EtherRpcConfig, ViewConfig } from '../types.js';
|
|
4
|
-
import { BundleBase } from './bundleBase.js';
|
|
1
|
+
import type { ViewConfig } from "../types.js";
|
|
2
|
+
import { BundleBase } from "./bundleBase.js";
|
|
5
3
|
export declare class DataConnector extends BundleBase {
|
|
6
|
-
constructor(wasmFile: string | ArrayBuffer, _config: string, executionAppConfig: ExecutionAppConfig, identity?: ethers.Provider, etherRpcConfig?: EtherRpcConfig);
|
|
7
|
-
getRpcUrl(config: any): string | undefined;
|
|
8
4
|
view(config: ViewConfig): Promise<string>;
|
|
9
5
|
}
|
|
@@ -1,56 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { callWithRetry } from '../utils/utils.js';
|
|
4
|
-
import { BundleBase } from './bundleBase.js';
|
|
1
|
+
import { readContract } from "../utils/utils.js";
|
|
2
|
+
import { BundleBase } from "./bundleBase.js";
|
|
5
3
|
export class DataConnector extends BundleBase {
|
|
6
|
-
// Identity should come from the node's IdentityManager.wallet
|
|
7
|
-
constructor(wasmFile, _config, executionAppConfig, identity, etherRpcConfig) {
|
|
8
|
-
super(wasmFile, _config, executionAppConfig, identity, etherRpcConfig);
|
|
9
|
-
}
|
|
10
|
-
// get rpc url from configuration
|
|
11
|
-
getRpcUrl(config) {
|
|
12
|
-
let chainId;
|
|
13
|
-
// check if chainId is configured in data connector config
|
|
14
|
-
if (this.configObj.chainId) {
|
|
15
|
-
chainId = this.configObj.chainId;
|
|
16
|
-
}
|
|
17
|
-
else if (config && config.chainId) {
|
|
18
|
-
// if chainId is in the request config from dataconnector execution
|
|
19
|
-
chainId = config.chainId;
|
|
20
|
-
}
|
|
21
|
-
if (chainId && this.etherRpcConfig && this.etherRpcConfig[chainId]) {
|
|
22
|
-
return this.etherRpcConfig[chainId].url;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
4
|
// Makes contract instance and calls, returns stringified result
|
|
29
5
|
async view(config) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
6
|
+
const executionContext = this.executionContext && {
|
|
7
|
+
...this.executionContext,
|
|
8
|
+
};
|
|
9
|
+
const pinnedChainId = executionContext?.chainId;
|
|
10
|
+
const chainId = this.configObj.chainId ?? config.chainId ?? pinnedChainId;
|
|
11
|
+
if (pinnedChainId !== undefined &&
|
|
12
|
+
((chainId !== undefined && Number(chainId) !== pinnedChainId) ||
|
|
13
|
+
(config.chainId !== undefined &&
|
|
14
|
+
Number(config.chainId) !== pinnedChainId))) {
|
|
15
|
+
throw new Error("EXECUTION_CONTEXT_MISMATCH: contract request chain does not match supplied context.");
|
|
40
16
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
arguments: paramsArray,
|
|
48
|
-
method: config.method,
|
|
49
|
-
rpcUrl: this.getRpcUrl(config),
|
|
50
|
-
};
|
|
51
|
-
result = await callWithRetry(viewContractConfig);
|
|
17
|
+
const provider = this.getClient();
|
|
18
|
+
if (!provider)
|
|
19
|
+
throw new Error("Provider not initialized");
|
|
20
|
+
if (pinnedChainId !== undefined &&
|
|
21
|
+
(await provider.getChainId()) !== pinnedChainId) {
|
|
22
|
+
throw new Error("EXECUTION_CONTEXT_MISMATCH: provider chain does not match supplied context.");
|
|
52
23
|
}
|
|
53
|
-
|
|
54
|
-
|
|
24
|
+
return readContract({
|
|
25
|
+
address: config.address,
|
|
26
|
+
abi: config.abi,
|
|
27
|
+
functionName: config.method,
|
|
28
|
+
contractArguments: config.arguments,
|
|
29
|
+
provider,
|
|
30
|
+
currentExecutionContext: executionContext,
|
|
31
|
+
});
|
|
55
32
|
}
|
|
56
33
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import { ExecutionBase } from './executionBase.js';
|
|
1
|
+
import type { ExecuteWithContextOptions, JobDetails, RpcAccess } from "../types.js";
|
|
2
|
+
import { ExecutionBase } from "./executionBase.js";
|
|
4
3
|
export interface ExecutionAppConfig {
|
|
5
4
|
/** Vault address used for execution context and subgraph queries. */
|
|
6
5
|
vault: string;
|
|
7
6
|
/** Chain ID used to resolve RPC configuration and on-chain reads. */
|
|
8
7
|
chainId: number;
|
|
9
|
-
/**
|
|
10
|
-
steerSubgraph
|
|
11
|
-
|
|
8
|
+
/** Required by execute() for protocol discovery queries. */
|
|
9
|
+
steerSubgraph?: string;
|
|
10
|
+
/** Required by execute() for pool discovery; unused by executeWithContext(). */
|
|
11
|
+
poolType?: {
|
|
12
12
|
/** Set true when the pool uses Algebra v1 semantics. */
|
|
13
13
|
isAlgebraPool: boolean;
|
|
14
14
|
/** Set true when the pool uses Algebra Integral semantics. */
|
|
@@ -20,11 +20,11 @@ export interface ExecutionAppConfig {
|
|
|
20
20
|
/** Set true when the pool uses Aerodrome semantics. */
|
|
21
21
|
isAerodromePool: boolean;
|
|
22
22
|
};
|
|
23
|
-
apiKeys
|
|
24
|
-
/**
|
|
25
|
-
subgraphStudioKey
|
|
23
|
+
apiKeys?: {
|
|
24
|
+
/** Host-only Graph credential; never added to WASM configuration. */
|
|
25
|
+
subgraphStudioKey?: string;
|
|
26
26
|
/** API key for Sentio endpoints, if applicable. */
|
|
27
|
-
sentioApiKey
|
|
27
|
+
sentioApiKey?: string;
|
|
28
28
|
};
|
|
29
29
|
/** Maximum number of retries for execution operations. */
|
|
30
30
|
maxRetries?: number;
|
|
@@ -38,22 +38,23 @@ export declare class ExecutionApp extends ExecutionBase {
|
|
|
38
38
|
isDirectionalPool: boolean;
|
|
39
39
|
isPoolSharkPool: boolean;
|
|
40
40
|
isAerodromePool: boolean;
|
|
41
|
-
subgraphStudioKey: string;
|
|
42
41
|
sentioApiKey: string;
|
|
43
42
|
config: ExecutionAppConfig;
|
|
44
43
|
constructor(config: ExecutionAppConfig);
|
|
45
|
-
execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>,
|
|
44
|
+
execute<T = unknown>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, rpc?: RpcAccess, forceDeposit?: boolean): Promise<T | "continue">;
|
|
46
45
|
/**
|
|
47
46
|
* Executes a strategy against a supplied execution context.
|
|
48
47
|
* This is the recommended API for new consumers. It intentionally bypasses
|
|
49
48
|
* all legacy vault, pool, subgraph, clock, and block-estimation reads.
|
|
50
49
|
*/
|
|
51
|
-
executeWithContext<T>(options: ExecuteWithContextOptions): Promise<
|
|
50
|
+
executeWithContext<T = unknown>(options: ExecuteWithContextOptions): Promise<T | "continue">;
|
|
51
|
+
/** T is the complete decoded JSON result. Only the exact sentinel skips JSON decoding. */
|
|
52
|
+
private parseStrategyResult;
|
|
52
53
|
private parseVaultConfig;
|
|
53
54
|
private validateExecutionContext;
|
|
54
55
|
private redactError;
|
|
55
|
-
executeStabilityVault<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>,
|
|
56
|
-
executeDynamicJobs<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _job: JobDetails,
|
|
56
|
+
executeStabilityVault<T = unknown>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, rpc?: RpcAccess, forceDeposit?: boolean): Promise<T | "continue">;
|
|
57
|
+
executeDynamicJobs<T = unknown>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _job: JobDetails, rpc?: RpcAccess, forceDeposit?: boolean): Promise<T | "continue">;
|
|
57
58
|
private getSmartPoolExecutionContext;
|
|
58
59
|
private getPoolCurrentTick;
|
|
59
60
|
private getTickSpacing;
|