@steerprotocol/data-connector-loader 0.1.5 → 1.0.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.
Files changed (48) hide show
  1. package/lib/bundle/bundleBase.d.ts +29 -0
  2. package/lib/{dataConnector.js → bundle/bundleBase.js} +59 -42
  3. package/lib/bundle/bundleDataConnector.d.ts +8 -0
  4. package/lib/bundle/bundleDataConnector.js +73 -0
  5. package/lib/esm/bundle/bundleBase.d.ts +29 -0
  6. package/lib/esm/bundle/bundleBase.js +127 -0
  7. package/lib/esm/bundle/bundleDataConnector.d.ts +8 -0
  8. package/lib/esm/bundle/bundleDataConnector.js +57 -0
  9. package/lib/esm/execution/executionApp.d.ts +17 -0
  10. package/lib/esm/execution/executionApp.js +304 -0
  11. package/lib/esm/execution/executionBase.d.ts +14 -0
  12. package/lib/esm/execution/executionBase.js +95 -0
  13. package/lib/esm/execution/executionDataConnector.d.ts +9 -0
  14. package/lib/esm/execution/executionDataConnector.js +90 -0
  15. package/lib/esm/index.d.ts +5 -0
  16. package/lib/esm/index.js +5 -0
  17. package/lib/esm/package.json +1 -0
  18. package/lib/esm/types.d.ts +104 -0
  19. package/lib/esm/types.js +1 -0
  20. package/lib/esm/utils/blockFinder.js +20 -0
  21. package/lib/esm/utils/consts.d.ts +4 -0
  22. package/lib/esm/utils/consts.js +4 -0
  23. package/lib/esm/utils/pluginManager.js +67 -0
  24. package/lib/esm/utils/utils.d.ts +16 -0
  25. package/lib/esm/utils/utils.js +119 -0
  26. package/lib/execution/executionApp.d.ts +17 -0
  27. package/lib/execution/executionApp.js +323 -0
  28. package/lib/execution/executionBase.d.ts +14 -0
  29. package/lib/execution/executionBase.js +118 -0
  30. package/lib/execution/executionDataConnector.d.ts +9 -0
  31. package/lib/execution/executionDataConnector.js +110 -0
  32. package/lib/index.d.ts +5 -15
  33. package/lib/index.js +21 -197
  34. package/lib/types.d.ts +40 -0
  35. package/lib/utils/blockFinder.d.ts +8 -0
  36. package/lib/utils/consts.d.ts +4 -0
  37. package/lib/utils/consts.js +7 -0
  38. package/lib/utils/pluginManager.d.ts +11 -0
  39. package/lib/utils/utils.d.ts +16 -0
  40. package/lib/utils/utils.js +146 -0
  41. package/package.json +35 -5
  42. package/lib/dataConnector.d.ts +0 -27
  43. package/lib/utils.d.ts +0 -2
  44. package/lib/utils.js +0 -28
  45. /package/lib/{blockFinder.d.ts → esm/utils/blockFinder.d.ts} +0 -0
  46. /package/lib/{pluginManager.d.ts → esm/utils/pluginManager.d.ts} +0 -0
  47. /package/lib/{blockFinder.js → utils/blockFinder.js} +0 -0
  48. /package/lib/{pluginManager.js → utils/pluginManager.js} +0 -0
package/package.json CHANGED
@@ -1,11 +1,22 @@
1
1
  {
2
2
  "name": "@steerprotocol/data-connector-loader",
3
- "version": "0.1.5",
3
+ "version": "1.0.0",
4
4
  "description": "App Loader for Steer Protocol",
5
5
  "main": "lib/index.js",
6
+ "module": "lib/esm/index.js",
6
7
  "types": "lib/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/index.d.ts",
11
+ "import": "./lib/esm/index.js",
12
+ "require": "./lib/index.js"
13
+ },
14
+ "./*": "./lib/*"
15
+ },
7
16
  "scripts": {
8
- "build": "tsc",
17
+ "build": "npm run build:cjs && npm run build:esm",
18
+ "build:cjs": "tsc -p tsconfig.json",
19
+ "build:esm": "tsc -p tsconfig.esm.json && echo '{\"type\": \"module\"}' > lib/esm/package.json",
9
20
  "format": "prettier --write \"src/**/*.(js|ts)\"",
10
21
  "lint": "eslint src --ext .js,.ts",
11
22
  "lint:fix": "eslint src --fix --ext .js,.ts",
@@ -18,7 +29,10 @@
18
29
  },
19
30
  "repository": {
20
31
  "type": "git",
21
- "url": "git+https://github.com/SteerProtocol/data-connector-loader.git"
32
+ "url": "https://github.com/SteerProtocol/data-connector-loader.git"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
22
36
  },
23
37
  "keywords": [
24
38
  "boilerplate",
@@ -30,7 +44,22 @@
30
44
  "url": "https://github.com/SteerProtocol/data-connector-loader/issues"
31
45
  },
32
46
  "homepage": "https://github.com/SteerProtocol/data-connector-loader#readme",
47
+ "release": {
48
+ "branches": [
49
+ "main"
50
+ ],
51
+ "plugins": [
52
+ "@semantic-release/commit-analyzer",
53
+ "@semantic-release/release-notes-generator",
54
+ "@semantic-release/npm",
55
+ "@semantic-release/github"
56
+ ]
57
+ },
33
58
  "devDependencies": {
59
+ "@semantic-release/commit-analyzer": "^13.0.1",
60
+ "@semantic-release/github": "^10.3.5",
61
+ "@semantic-release/npm": "^12.0.2",
62
+ "@semantic-release/release-notes-generator": "^14.1.0",
34
63
  "@types/jest": "29.2.4",
35
64
  "@typescript-eslint/eslint-plugin": "5.46.0",
36
65
  "@typescript-eslint/parser": "5.47.1",
@@ -39,6 +68,7 @@
39
68
  "eslint-plugin-jest": "27.1.7",
40
69
  "jest": "29.3.1",
41
70
  "prettier": "2.8.1",
71
+ "semantic-release": "^24.2.9",
42
72
  "ts-jest": "29.0.3",
43
73
  "typescript": "4.9.4"
44
74
  },
@@ -46,8 +76,8 @@
46
76
  "lib/**/*"
47
77
  ],
48
78
  "dependencies": {
49
- "@steerprotocol/app-loader": "1.0.1",
50
- "@steerprotocol/strategy-utils": "^3.1.1",
79
+ "@steerprotocol/app-loader": "1.1.0",
80
+ "@steerprotocol/strategy-utils": "^3.1.2",
51
81
  "axios": "^1.3.4",
52
82
  "ethers": "^5.1.0",
53
83
  "timestring": "^7.0.0"
@@ -1,27 +0,0 @@
1
- import { WasmModule } from '@steerprotocol/app-loader';
2
- import { ethers } from 'ethers';
3
- import { EtherRpcConfig, ExecutionContext } from './types';
4
- export declare class DataConnector {
5
- private wasmFile;
6
- module?: WasmModule;
7
- config: string;
8
- configObj: {
9
- [key: string]: any;
10
- };
11
- executionContext?: ExecutionContext & {
12
- epochTimestamp: number;
13
- };
14
- providerIdentity?: ethers.providers.Provider;
15
- etherRpcConfig?: EtherRpcConfig;
16
- constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: ethers.providers.Provider, etherRpcConfig?: EtherRpcConfig);
17
- load(): Promise<WasmModule>;
18
- loadSync(): WasmModule;
19
- reset(): void;
20
- setExecutionContext(executionContext: ExecutionContext): void;
21
- execute(response: string): Promise<string>;
22
- getProvider(config: any): ethers.providers.Provider | undefined;
23
- view(config: any): Promise<string>;
24
- getResults(): string;
25
- version(): number;
26
- private subtractDate;
27
- }
package/lib/utils.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { Candle } from "@steerprotocol/app-loader";
2
- export declare const extendOHLCV: (rawData: Candle[], period: number, endTimestamp: number) => Candle[];
package/lib/utils.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extendOHLCV = void 0;
4
- // The purpose of this function is to look at the end timestamp and extend the current candle array so that it backfills any missing candles up to the end timestamp
5
- const extendOHLCV = (rawData, period, endTimestamp) => {
6
- // Sort rawData by timestamp
7
- const sortedData = rawData.sort((a, b) => a.timestamp - b.timestamp);
8
- const lastCandle = sortedData[sortedData.length - 1];
9
- const startTimestamp = lastCandle ? lastCandle.timestamp : endTimestamp;
10
- // Calculate the number of periods to backfill
11
- const periodsToBackfill = Math.floor(((endTimestamp - startTimestamp)) / 1000 / period);
12
- // Backfill the candles
13
- for (let i = 0; i < periodsToBackfill; i++) {
14
- const candleWidth = (period * (i + 1));
15
- const newCandle = {
16
- timestamp: startTimestamp + candleWidth,
17
- open: lastCandle.open,
18
- high: lastCandle.open,
19
- low: lastCandle.open,
20
- close: lastCandle.open,
21
- volume: 0, // You may need to replace these with appropriate logic
22
- };
23
- sortedData.push(newCandle);
24
- }
25
- // Return the converted data
26
- return sortedData;
27
- };
28
- exports.extendOHLCV = extendOHLCV;
File without changes