@steerprotocol/data-connector-loader 3.0.1 → 3.1.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.
@@ -1,5 +1,5 @@
1
1
  import { WasmModule } from '@steerprotocol/app-loader';
2
- import { providers } from 'ethers';
2
+ import { ethers } from 'ethers';
3
3
  import { EtherRpcConfig, ExecutionContext } from '../types';
4
4
  export declare class BundleBase {
5
5
  module?: WasmModule;
@@ -9,12 +9,12 @@ export declare class BundleBase {
9
9
  [key: string]: any;
10
10
  };
11
11
  protected etherRpcConfig?: EtherRpcConfig;
12
- protected providerIdentity?: providers.Provider;
12
+ protected providerIdentity?: ethers.Provider;
13
13
  executionContext?: ExecutionContext & {
14
14
  epochTimestamp: number;
15
15
  };
16
16
  protected scheduleEpochTimestamp: number | undefined;
17
- constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: providers.Provider, etherRpcConfig?: EtherRpcConfig);
17
+ constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: ethers.Provider, etherRpcConfig?: EtherRpcConfig);
18
18
  load(): Promise<WasmModule>;
19
19
  loadSync(): WasmModule;
20
20
  execute(response: string): Promise<string>;
@@ -22,7 +22,7 @@ export declare class BundleBase {
22
22
  setExecutionContextStrategyExecution(executionContext: ExecutionContext): void;
23
23
  setExecutionContextDataConnector(executionContext: ExecutionContext): void;
24
24
  protected executeModule(response: string): Promise<string>;
25
- getProvider(config: any): providers.Provider | undefined;
25
+ getProvider(config: any): ethers.Provider | undefined;
26
26
  getResults(): string;
27
27
  version(): number;
28
28
  private subtractDate;
@@ -124,7 +124,7 @@ class BundleBase {
124
124
  chainId = config.chainId;
125
125
  }
126
126
  if (chainId && this.etherRpcConfig && this.etherRpcConfig[chainId]) {
127
- const provider = new ethers_1.providers.JsonRpcProvider(this.etherRpcConfig[chainId].url);
127
+ const provider = new ethers_1.ethers.JsonRpcProvider(this.etherRpcConfig[chainId].url);
128
128
  return provider;
129
129
  }
130
130
  else {
@@ -1,8 +1,8 @@
1
- import { providers } from 'ethers';
1
+ import { ethers } from 'ethers';
2
2
  import { EtherRpcConfig, ViewConfig } from '../types';
3
3
  import { BundleBase } from './bundleBase';
4
4
  export declare class DataConnector extends BundleBase {
5
- constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: providers.Provider, etherRpcConfig?: EtherRpcConfig);
5
+ constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: ethers.Provider, etherRpcConfig?: EtherRpcConfig);
6
6
  getRpcUrl(config: any): string | undefined;
7
7
  view(config: ViewConfig): Promise<string>;
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import { WasmModule } from '@steerprotocol/app-loader';
2
- import { providers } from 'ethers';
2
+ import { ethers } from 'ethers';
3
3
  import { EtherRpcConfig, ExecutionContext } from '../types';
4
4
  export declare class BundleBase {
5
5
  module?: WasmModule;
@@ -9,12 +9,12 @@ export declare class BundleBase {
9
9
  [key: string]: any;
10
10
  };
11
11
  protected etherRpcConfig?: EtherRpcConfig;
12
- protected providerIdentity?: providers.Provider;
12
+ protected providerIdentity?: ethers.Provider;
13
13
  executionContext?: ExecutionContext & {
14
14
  epochTimestamp: number;
15
15
  };
16
16
  protected scheduleEpochTimestamp: number | undefined;
17
- constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: providers.Provider, etherRpcConfig?: EtherRpcConfig);
17
+ constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: ethers.Provider, etherRpcConfig?: EtherRpcConfig);
18
18
  load(): Promise<WasmModule>;
19
19
  loadSync(): WasmModule;
20
20
  execute(response: string): Promise<string>;
@@ -22,7 +22,7 @@ export declare class BundleBase {
22
22
  setExecutionContextStrategyExecution(executionContext: ExecutionContext): void;
23
23
  setExecutionContextDataConnector(executionContext: ExecutionContext): void;
24
24
  protected executeModule(response: string): Promise<string>;
25
- getProvider(config: any): providers.Provider | undefined;
25
+ getProvider(config: any): ethers.Provider | undefined;
26
26
  getResults(): string;
27
27
  version(): number;
28
28
  private subtractDate;
@@ -1,5 +1,5 @@
1
1
  import { loadWasm, loadWasmSync } from '@steerprotocol/app-loader';
2
- import { providers } from 'ethers';
2
+ import { ethers } from 'ethers';
3
3
  export class BundleBase {
4
4
  constructor(wasmFile, _config, identity, etherRpcConfig) {
5
5
  this.wasmFile = wasmFile;
@@ -102,7 +102,7 @@ export class BundleBase {
102
102
  chainId = config.chainId;
103
103
  }
104
104
  if (chainId && this.etherRpcConfig && this.etherRpcConfig[chainId]) {
105
- const provider = new providers.JsonRpcProvider(this.etherRpcConfig[chainId].url);
105
+ const provider = new ethers.JsonRpcProvider(this.etherRpcConfig[chainId].url);
106
106
  return provider;
107
107
  }
108
108
  else {
@@ -1,8 +1,8 @@
1
- import { providers } from 'ethers';
1
+ import { ethers } from 'ethers';
2
2
  import { EtherRpcConfig, ViewConfig } from '../types';
3
3
  import { BundleBase } from './bundleBase';
4
4
  export declare class DataConnector extends BundleBase {
5
- constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: providers.Provider, etherRpcConfig?: EtherRpcConfig);
5
+ constructor(wasmFile: string | ArrayBuffer, _config: string, identity?: ethers.Provider, etherRpcConfig?: EtherRpcConfig);
6
6
  getRpcUrl(config: any): string | undefined;
7
7
  view(config: ViewConfig): Promise<string>;
8
8
  }
@@ -8,7 +8,7 @@ export declare class ExecutionApp extends ExecutionBase {
8
8
  isDirectionalPool: boolean;
9
9
  chainId: number;
10
10
  constructor(vault: string, steerSubgraph: string, isAlgebraPool: boolean, isDirectionalPool: boolean, chainId: number, maxRetries?: number);
11
- execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _identity?: ethers.providers.Provider, _etherRpcConfig?: EtherRpcConfig): Promise<Array<T>>;
11
+ execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _identity?: ethers.Provider, _etherRpcConfig?: EtherRpcConfig): Promise<Array<T>>;
12
12
  private getSmartPoolExecutionContext;
13
13
  private getPoolCurrentTick;
14
14
  private getVaultPoolAddress;
@@ -7,8 +7,8 @@ export declare class ExecutionBase {
7
7
  protected delay(ms: number): Promise<void>;
8
8
  protected log(...args: any[]): void;
9
9
  protected getExecutionContext(dataConnector: DataConnector, vaultConfig: VaultConfigPayload): Promise<ExecutionContext>;
10
- execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _identity?: ethers.providers.Provider, _etherRpcConfig?: EtherRpcConfig): Promise<Array<T>>;
10
+ execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _identity?: ethers.Provider, _etherRpcConfig?: EtherRpcConfig): Promise<Array<T>>;
11
11
  protected getDataConnectorVersion(dataConnector: DataConnector): Promise<number>;
12
- getAverageBlockTime(provider: ethers.providers.Provider, blockCount?: number): Promise<number>;
13
- getBlockNumberFromAvgBlockTime(provider: ethers.providers.Provider, targetTimestamp: number, avgBlockTime: number): Promise<number>;
12
+ getAverageBlockTime(provider: ethers.Provider, blockCount?: number): Promise<number>;
13
+ getBlockNumberFromAvgBlockTime(provider: ethers.Provider, targetTimestamp: number, avgBlockTime: number): Promise<number>;
14
14
  }
@@ -1,4 +1,4 @@
1
- import { ContractInterface } from 'ethers';
1
+ import { InterfaceAbi } from 'ethers';
2
2
  export type VaultInput = {
3
3
  _id?: string;
4
4
  tokenId: string;
@@ -76,7 +76,7 @@ export type EtherRpcConfig = {
76
76
  };
77
77
  export interface ViewConfig {
78
78
  address: string;
79
- abi: ContractInterface;
79
+ abi: InterfaceAbi;
80
80
  method: string;
81
81
  arguments: unknown[];
82
82
  }
@@ -5,4 +5,4 @@ import { ethers } from 'ethers';
5
5
  * @param timestamp
6
6
  * @param Idenity
7
7
  */
8
- export declare function getBlockFromTimestamp(timestamp: number, provider: ethers.providers.Provider): Promise<number>;
8
+ export declare function getBlockFromTimestamp(timestamp: number, provider: ethers.Provider): Promise<number>;
@@ -1,4 +1,3 @@
1
- // import { providers, } from "ethers";
2
1
  /**
3
2
  * Iterates down from current block to find the block previous or equal to the given timestamp
4
3
  * Not the most efficient for far past timestamps, a binary search could be used for better performance
@@ -1,7 +1,7 @@
1
1
  import { Candle } from '@steerprotocol/app-loader';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { ExecutionContext, ViewContractConfig } from '../types';
4
- import { providers } from 'ethers';
4
+ import { Provider } from 'ethers';
5
5
  export declare const extendOHLCV: (rawData: Candle[], period: number, endTimestamp: number) => Candle[];
6
6
  export declare function fetchData(request: AxiosRequestConfig, attempts: number): Promise<any>;
7
7
  export declare function readSlot0Contract({ address, abi, currentExecutionContext, functionName, provider, rpc, chainId, }: {
@@ -9,7 +9,7 @@ export declare function readSlot0Contract({ address, abi, currentExecutionContex
9
9
  abi: any;
10
10
  currentExecutionContext: ExecutionContext;
11
11
  functionName: string;
12
- provider: providers.Provider;
12
+ provider: Provider;
13
13
  rpc: string;
14
14
  chainId: number;
15
15
  }): Promise<any>;
@@ -8,7 +8,7 @@ export declare class ExecutionApp extends ExecutionBase {
8
8
  isDirectionalPool: boolean;
9
9
  chainId: number;
10
10
  constructor(vault: string, steerSubgraph: string, isAlgebraPool: boolean, isDirectionalPool: boolean, chainId: number, maxRetries?: number);
11
- execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _identity?: ethers.providers.Provider, _etherRpcConfig?: EtherRpcConfig): Promise<Array<T>>;
11
+ execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _identity?: ethers.Provider, _etherRpcConfig?: EtherRpcConfig): Promise<Array<T>>;
12
12
  private getSmartPoolExecutionContext;
13
13
  private getPoolCurrentTick;
14
14
  private getVaultPoolAddress;
@@ -7,8 +7,8 @@ export declare class ExecutionBase {
7
7
  protected delay(ms: number): Promise<void>;
8
8
  protected log(...args: any[]): void;
9
9
  protected getExecutionContext(dataConnector: DataConnector, vaultConfig: VaultConfigPayload): Promise<ExecutionContext>;
10
- execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _identity?: ethers.providers.Provider, _etherRpcConfig?: EtherRpcConfig): Promise<Array<T>>;
10
+ execute<T>(_wasmFile: string | ArrayBuffer, _vaultConfig: string, _data: Array<any>, _identity?: ethers.Provider, _etherRpcConfig?: EtherRpcConfig): Promise<Array<T>>;
11
11
  protected getDataConnectorVersion(dataConnector: DataConnector): Promise<number>;
12
- getAverageBlockTime(provider: ethers.providers.Provider, blockCount?: number): Promise<number>;
13
- getBlockNumberFromAvgBlockTime(provider: ethers.providers.Provider, targetTimestamp: number, avgBlockTime: number): Promise<number>;
12
+ getAverageBlockTime(provider: ethers.Provider, blockCount?: number): Promise<number>;
13
+ getBlockNumberFromAvgBlockTime(provider: ethers.Provider, targetTimestamp: number, avgBlockTime: number): Promise<number>;
14
14
  }
package/lib/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ContractInterface } from 'ethers';
1
+ import { InterfaceAbi } from 'ethers';
2
2
  export type VaultInput = {
3
3
  _id?: string;
4
4
  tokenId: string;
@@ -76,7 +76,7 @@ export type EtherRpcConfig = {
76
76
  };
77
77
  export interface ViewConfig {
78
78
  address: string;
79
- abi: ContractInterface;
79
+ abi: InterfaceAbi;
80
80
  method: string;
81
81
  arguments: unknown[];
82
82
  }
@@ -5,4 +5,4 @@ import { ethers } from 'ethers';
5
5
  * @param timestamp
6
6
  * @param Idenity
7
7
  */
8
- export declare function getBlockFromTimestamp(timestamp: number, provider: ethers.providers.Provider): Promise<number>;
8
+ export declare function getBlockFromTimestamp(timestamp: number, provider: ethers.Provider): Promise<number>;
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getBlockFromTimestamp = void 0;
13
- // import { providers, } from "ethers";
14
13
  /**
15
14
  * Iterates down from current block to find the block previous or equal to the given timestamp
16
15
  * Not the most efficient for far past timestamps, a binary search could be used for better performance
@@ -1,7 +1,7 @@
1
1
  import { Candle } from '@steerprotocol/app-loader';
2
2
  import { AxiosRequestConfig } from 'axios';
3
3
  import { ExecutionContext, ViewContractConfig } from '../types';
4
- import { providers } from 'ethers';
4
+ import { Provider } from 'ethers';
5
5
  export declare const extendOHLCV: (rawData: Candle[], period: number, endTimestamp: number) => Candle[];
6
6
  export declare function fetchData(request: AxiosRequestConfig, attempts: number): Promise<any>;
7
7
  export declare function readSlot0Contract({ address, abi, currentExecutionContext, functionName, provider, rpc, chainId, }: {
@@ -9,7 +9,7 @@ export declare function readSlot0Contract({ address, abi, currentExecutionContex
9
9
  abi: any;
10
10
  currentExecutionContext: ExecutionContext;
11
11
  functionName: string;
12
- provider: providers.Provider;
12
+ provider: Provider;
13
13
  rpc: string;
14
14
  chainId: number;
15
15
  }): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steerprotocol/data-connector-loader",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "App Loader for Steer Protocol",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -76,10 +76,10 @@
76
76
  "lib/**/*"
77
77
  ],
78
78
  "dependencies": {
79
- "@steerprotocol/app-loader": "^2.0.0",
79
+ "@steerprotocol/app-loader": "^2.1.0",
80
80
  "@steerprotocol/strategy-utils": "^3.1.2",
81
81
  "axios": "^1.3.4",
82
- "ethers": "^5.1.0",
82
+ "ethers": "^6.16.0",
83
83
  "timestring": "^7.0.0"
84
84
  }
85
85
  }