@steerprotocol/app-loader 0.2.0 → 0.2.2
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/index.d.ts +0 -10
- package/lib/index.js +49 -23
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -11,16 +11,6 @@ export type WasmModule = {
|
|
|
11
11
|
responseHandler: typeof responseHandler;
|
|
12
12
|
initialize: typeof initialize;
|
|
13
13
|
execute: typeof execute;
|
|
14
|
-
"execute(param_1: string)": typeof execute;
|
|
15
|
-
"execute(param_1: string, param_2: string)": typeof execute;
|
|
16
|
-
"execute(param_1: string, param_2: string, param_3: string)": typeof execute;
|
|
17
|
-
"execute(param_1: string, param_2: string, param_3: string, param_4: string)": typeof execute;
|
|
18
|
-
"execute(param_1: string, param_2: string, param_3: string, param_4: string, param_5: string)": typeof execute;
|
|
19
|
-
"execute(param_1: string, param_2: string, param_3: string, param_4: string, param_5: string, param_6: string)": typeof execute;
|
|
20
|
-
"execute(param_1: string, param_2: string, param_3: string, param_4: string, param_5: string, param_6: string, param_7: string)": typeof execute;
|
|
21
|
-
"execute(param_1: string, param_2: string, param_3: string, param_4: string, param_5: string, param_6: string, param_7: string, param_8: string)": typeof execute;
|
|
22
|
-
"execute(param_1: string, param_2: string, param_3: string, param_4: string, param_5: string, param_6: string, param_7: string, param_8: string, param_9: string)": typeof execute;
|
|
23
|
-
"execute(param_1: string, param_2: string, param_3: string, param_4: string, param_5: string, param_6: string, param_7: string, param_8: string, param_9: string, param_10: string)": typeof execute;
|
|
24
14
|
config: typeof config;
|
|
25
15
|
version: typeof version;
|
|
26
16
|
transform: typeof transform;
|
package/lib/index.js
CHANGED
|
@@ -45,6 +45,7 @@ const RawTradeData_1 = require("./RawTradeData");
|
|
|
45
45
|
Object.defineProperty(exports, "RawTradeData", { enumerable: true, get: function () { return RawTradeData_1.RawTradeData; } });
|
|
46
46
|
let _fetchGETSyncPtr = 0;
|
|
47
47
|
let _fetchPOSTSyncPtr = 0;
|
|
48
|
+
let _ohlcvPtr = 0;
|
|
48
49
|
let ASYNCIFY_PTR = 0;
|
|
49
50
|
let ASYNCIFY_MEM;
|
|
50
51
|
let _exports;
|
|
@@ -53,6 +54,12 @@ function instantiate(module, imports = {}) {
|
|
|
53
54
|
const adaptedImports = {
|
|
54
55
|
// @ts-ignore
|
|
55
56
|
env: Object.assign(Object.create(globalThis), imports.env || {}, {
|
|
57
|
+
_initAsyncify(frame_ptr, stack_ptr) {
|
|
58
|
+
ASYNCIFY_PTR = frame_ptr;
|
|
59
|
+
ASYNCIFY_MEM[ASYNCIFY_PTR >> 2] = ASYNCIFY_PTR + 8;
|
|
60
|
+
// I don't know if I need to reserve all this memory...
|
|
61
|
+
ASYNCIFY_MEM[ASYNCIFY_PTR + 4 >> 2] = stack_ptr;
|
|
62
|
+
},
|
|
56
63
|
abort(message, fileName, lineNumber, columnNumber) {
|
|
57
64
|
(() => {
|
|
58
65
|
throw Error(`${__liftString(message)} in ${__liftString(fileName)}:${lineNumber}:${columnNumber}`);
|
|
@@ -94,31 +101,50 @@ function instantiate(module, imports = {}) {
|
|
|
94
101
|
'console.log': (text) => {
|
|
95
102
|
console.log(__liftString(text));
|
|
96
103
|
},
|
|
97
|
-
ccxt_fetchOHLCV: (exchangeId, symbol, timeframe, limit, since) =>
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
ccxt_fetchOHLCV: (exchangeId, symbol, timeframe, limit, since) => {
|
|
105
|
+
// @ts-ignore
|
|
106
|
+
const currentState = _exports.asyncify_get_state();
|
|
107
|
+
if (currentState === 2) {
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
_exports.asyncify_stop_rewind();
|
|
110
|
+
return _ohlcvPtr;
|
|
111
|
+
}
|
|
112
|
+
else if (currentState === 0) {
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
_exports.asyncify_start_unwind(ASYNCIFY_PTR);
|
|
115
|
+
const _exchangeId = __liftString(exchangeId);
|
|
116
|
+
const _symbol = __liftString(symbol);
|
|
117
|
+
const _timeframe = __liftString(timeframe);
|
|
118
|
+
const _since = since;
|
|
119
|
+
const _limit = limit;
|
|
120
|
+
if (_exchangeId &&
|
|
121
|
+
_symbol &&
|
|
122
|
+
_timeframe &&
|
|
123
|
+
_since &&
|
|
124
|
+
_limit) {
|
|
125
|
+
try {
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
_exports.asyncify_stop_unwind();
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
new ccxt_1.default[exchangeId]({
|
|
130
|
+
apiKey: "",
|
|
131
|
+
secret: ""
|
|
132
|
+
}).fetchOHLCV(_symbol, _timeframe, _limit, _since).then((data) => {
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
_exports.asyncify_start_rewind(ASYNCIFY_PTR);
|
|
135
|
+
_ohlcvPtr = __lowerString(JSON.stringify(data));
|
|
136
|
+
_exports.execute();
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
// @ts-ignore
|
|
141
|
+
_exports.asyncify_start_rewind(ASYNCIFY_PTR);
|
|
142
|
+
process.env.DEBUG && console.error(e);
|
|
143
|
+
_exports.execute();
|
|
144
|
+
}
|
|
118
145
|
}
|
|
119
146
|
}
|
|
120
|
-
|
|
121
|
-
})
|
|
147
|
+
}
|
|
122
148
|
}),
|
|
123
149
|
'as-fetch': {
|
|
124
150
|
_initAsyncify(frame_ptr, stack_ptr) {
|