@steerprotocol/data-connector-loader 0.1.3 → 0.1.5
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/lib/dataConnector.d.ts +2 -0
- package/lib/dataConnector.js +14 -1
- package/package.json +4 -4
package/lib/dataConnector.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare class DataConnector {
|
|
|
15
15
|
etherRpcConfig?: EtherRpcConfig;
|
|
16
16
|
constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: ethers.providers.Provider, etherRpcConfig?: EtherRpcConfig);
|
|
17
17
|
load(): Promise<WasmModule>;
|
|
18
|
+
loadSync(): WasmModule;
|
|
19
|
+
reset(): void;
|
|
18
20
|
setExecutionContext(executionContext: ExecutionContext): void;
|
|
19
21
|
execute(response: string): Promise<string>;
|
|
20
22
|
getProvider(config: any): ethers.providers.Provider | undefined;
|
package/lib/dataConnector.js
CHANGED
|
@@ -29,6 +29,17 @@ class DataConnector {
|
|
|
29
29
|
return this.module;
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
loadSync() {
|
|
33
|
+
if (typeof this.wasmFile === "string")
|
|
34
|
+
throw new Error("Cannot load module synchronously unless wasmFile is of type ArrayBuffer");
|
|
35
|
+
this.module = (0, app_loader_1.loadWasmSync)(this.wasmFile, {});
|
|
36
|
+
return this.module;
|
|
37
|
+
}
|
|
38
|
+
reset() {
|
|
39
|
+
if (this.module && this.module["reset"]) {
|
|
40
|
+
this.module.reset();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
32
43
|
setExecutionContext(executionContext) {
|
|
33
44
|
var _a;
|
|
34
45
|
// Determine the timestamp for epoch
|
|
@@ -56,13 +67,14 @@ class DataConnector {
|
|
|
56
67
|
if (!this.module)
|
|
57
68
|
throw new Error('Module not initialized');
|
|
58
69
|
// Call the main function with the response
|
|
59
|
-
return this.module.execute(response);
|
|
70
|
+
return yield this.module.execute(response);
|
|
60
71
|
});
|
|
61
72
|
}
|
|
62
73
|
// This function returns a provider based on the chainId of the request
|
|
63
74
|
// The chainId is first checked in the data connector config, and if not found
|
|
64
75
|
// it is checked in the request config. If the chainId is found in either of
|
|
65
76
|
// these places, the provider is returned from the etherRpcConfig object
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
78
|
getProvider(config) {
|
|
67
79
|
let chainId;
|
|
68
80
|
// check if chainId is configured in data connector config
|
|
@@ -82,6 +94,7 @@ class DataConnector {
|
|
|
82
94
|
}
|
|
83
95
|
}
|
|
84
96
|
// Makes contract instance and calls, returns stringified result
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
98
|
view(config) {
|
|
86
99
|
var _a;
|
|
87
100
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steerprotocol/data-connector-loader",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "App Loader for Steer Protocol",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"boilerplate",
|
|
25
25
|
"typescript"
|
|
26
26
|
],
|
|
27
|
-
"author": "
|
|
27
|
+
"author": "Steer Protocol <contact@steer.finance>",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"bugs": {
|
|
30
30
|
"url": "https://github.com/SteerProtocol/data-connector-loader/issues"
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"lib/**/*"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@steerprotocol/app-loader": "0.
|
|
50
|
-
"@steerprotocol/strategy-utils": "^
|
|
49
|
+
"@steerprotocol/app-loader": "1.0.1",
|
|
50
|
+
"@steerprotocol/strategy-utils": "^3.1.1",
|
|
51
51
|
"axios": "^1.3.4",
|
|
52
52
|
"ethers": "^5.1.0",
|
|
53
53
|
"timestring": "^7.0.0"
|