@defisaver/automation-sdk 1.0.1
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/.babelrc +3 -0
- package/.editorconfig +9 -0
- package/.eslintignore +7 -0
- package/.eslintrc.js +104 -0
- package/esm/abis/Erc20.json +223 -0
- package/esm/abis/SubStorage.json +17 -0
- package/esm/abis/UniMulticall.json +14 -0
- package/esm/abis/index.d.ts +9 -0
- package/esm/abis/index.js +18 -0
- package/esm/abis/legacy_AaveV2Subscriptions.json +8 -0
- package/esm/abis/legacy_AuthCheck.json +8 -0
- package/esm/abis/legacy_CompoundV2Subscriptions.json +9 -0
- package/esm/abis/legacy_MakerSubscriptions.json +9 -0
- package/esm/automation/private/Automation.d.ts +12 -0
- package/esm/automation/private/Automation.js +39 -0
- package/esm/automation/private/LegacyAutomation.d.ts +25 -0
- package/esm/automation/private/LegacyAutomation.js +102 -0
- package/esm/automation/private/LegacyProtocol.d.ts +20 -0
- package/esm/automation/private/LegacyProtocol.js +34 -0
- package/esm/automation/private/Protocol.d.ts +20 -0
- package/esm/automation/private/Protocol.js +34 -0
- package/esm/automation/private/StrategiesAutomation.d.ts +24 -0
- package/esm/automation/private/StrategiesAutomation.js +111 -0
- package/esm/automation/public/ArbitrumStrategies.d.ts +5 -0
- package/esm/automation/public/ArbitrumStrategies.js +7 -0
- package/esm/automation/public/EthereumStrategies.d.ts +5 -0
- package/esm/automation/public/EthereumStrategies.js +7 -0
- package/esm/automation/public/OptimismStrategies.d.ts +5 -0
- package/esm/automation/public/OptimismStrategies.js +7 -0
- package/esm/automation/public/legacy/LegacyAaveAutomation.d.ts +6 -0
- package/esm/automation/public/legacy/LegacyAaveAutomation.js +14 -0
- package/esm/automation/public/legacy/LegacyCompoundAutomation.d.ts +6 -0
- package/esm/automation/public/legacy/LegacyCompoundAutomation.js +14 -0
- package/esm/automation/public/legacy/LegacyMakerAutomation.d.ts +6 -0
- package/esm/automation/public/legacy/LegacyMakerAutomation.js +14 -0
- package/esm/configuration.d.ts +1 -0
- package/esm/configuration.js +9 -0
- package/esm/constants/index.d.ts +23 -0
- package/esm/constants/index.js +153 -0
- package/esm/index.d.ts +20 -0
- package/esm/index.js +22 -0
- package/esm/services/contractService.d.ts +11 -0
- package/esm/services/contractService.js +40 -0
- package/esm/services/ethereumService.d.ts +7 -0
- package/esm/services/ethereumService.js +34 -0
- package/esm/services/strategiesService.d.ts +2 -0
- package/esm/services/strategiesService.js +244 -0
- package/esm/services/strategySubService.d.ts +32 -0
- package/esm/services/strategySubService.js +91 -0
- package/esm/services/subDataService.d.ts +62 -0
- package/esm/services/subDataService.js +148 -0
- package/esm/services/triggerService.d.ts +89 -0
- package/esm/services/triggerService.js +141 -0
- package/esm/services/utils.d.ts +24 -0
- package/esm/services/utils.js +78 -0
- package/esm/types/contracts/generated/Erc20.d.ts +53 -0
- package/esm/types/contracts/generated/Erc20.js +4 -0
- package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.d.ts +129 -0
- package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.js +4 -0
- package/esm/types/contracts/generated/Legacy_AuthCheck.d.ts +20 -0
- package/esm/types/contracts/generated/Legacy_AuthCheck.js +4 -0
- package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.d.ts +128 -0
- package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.js +4 -0
- package/esm/types/contracts/generated/Legacy_MakerSubscriptions.d.ts +246 -0
- package/esm/types/contracts/generated/Legacy_MakerSubscriptions.js +4 -0
- package/esm/types/contracts/generated/SubStorage.d.ts +114 -0
- package/esm/types/contracts/generated/SubStorage.js +4 -0
- package/esm/types/contracts/generated/UniMulticall.d.ts +55 -0
- package/esm/types/contracts/generated/UniMulticall.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +7 -0
- package/esm/types/contracts/generated/index.js +1 -0
- package/esm/types/contracts/generated/types.d.ts +54 -0
- package/esm/types/contracts/generated/types.js +1 -0
- package/esm/types/enums.d.ts +97 -0
- package/esm/types/enums.js +113 -0
- package/esm/types/index.d.ts +180 -0
- package/esm/types/index.js +1 -0
- package/package.json +66 -0
- package/scripts/generateContractTypes.js +39 -0
- package/src/abis/Erc20.json +223 -0
- package/src/abis/SubStorage.json +17 -0
- package/src/abis/UniMulticall.json +14 -0
- package/src/abis/index.ts +28 -0
- package/src/abis/legacy_AaveV2Subscriptions.json +8 -0
- package/src/abis/legacy_AuthCheck.json +8 -0
- package/src/abis/legacy_CompoundV2Subscriptions.json +9 -0
- package/src/abis/legacy_MakerSubscriptions.json +9 -0
- package/src/automation/private/Automation.ts +44 -0
- package/src/automation/private/LegacyAutomation.ts +124 -0
- package/src/automation/private/LegacyProtocol.ts +45 -0
- package/src/automation/private/Protocol.ts +45 -0
- package/src/automation/private/StrategiesAutomation.ts +157 -0
- package/src/automation/public/ArbitrumStrategies.ts +10 -0
- package/src/automation/public/EthereumStrategies.ts +10 -0
- package/src/automation/public/OptimismStrategies.ts +10 -0
- package/src/automation/public/legacy/LegacyAaveAutomation.ts +20 -0
- package/src/automation/public/legacy/LegacyCompoundAutomation.ts +20 -0
- package/src/automation/public/legacy/LegacyMakerAutomation.ts +20 -0
- package/src/configuration.ts +11 -0
- package/src/constants/index.ts +173 -0
- package/src/index.ts +38 -0
- package/src/services/contractService.ts +65 -0
- package/src/services/ethereumService.ts +55 -0
- package/src/services/strategiesService.ts +336 -0
- package/src/services/strategySubService.ts +202 -0
- package/src/services/subDataService.ts +212 -0
- package/src/services/triggerService.ts +173 -0
- package/src/services/utils.ts +101 -0
- package/src/types/contracts/generated/Erc20.ts +95 -0
- package/src/types/contracts/generated/Legacy_AaveV2Subscriptions.ts +207 -0
- package/src/types/contracts/generated/Legacy_AuthCheck.ts +41 -0
- package/src/types/contracts/generated/Legacy_CompoundV2Subscriptions.ts +205 -0
- package/src/types/contracts/generated/Legacy_MakerSubscriptions.ts +338 -0
- package/src/types/contracts/generated/SubStorage.ts +196 -0
- package/src/types/contracts/generated/UniMulticall.ts +83 -0
- package/src/types/contracts/generated/index.ts +10 -0
- package/src/types/contracts/generated/types.ts +73 -0
- package/src/types/enums.ts +108 -0
- package/src/types/index.ts +217 -0
- package/src/types/typings/process.d.ts +9 -0
- package/tsconfig.json +79 -0
- package/umd/web3.d.ts +28961 -0
- package/webpack.umd.js +52 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export enum ChainId {
|
|
2
|
+
Ethereum = 1,
|
|
3
|
+
Optimism = 10,
|
|
4
|
+
Arbitrum = 42161,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export enum RatioState {
|
|
8
|
+
OVER = 0,
|
|
9
|
+
UNDER = 1,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export enum BundleProtocols {
|
|
13
|
+
MStable = 'mstable',
|
|
14
|
+
Yearn = 'yearn',
|
|
15
|
+
Rari = 'rari',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @dev Follow the naming convention:
|
|
20
|
+
* - Enum name consists of two parts, name and version
|
|
21
|
+
* - Name should be human-readable name of the protocol, it can include spaces or any characters needed
|
|
22
|
+
* - Version should be separated from the name with double underscores `__` (If there is no version leave it out)
|
|
23
|
+
* - Example `Name of ThePROTOCOL__v1` (Without version `Name of ThePROTOCOL`)
|
|
24
|
+
*/
|
|
25
|
+
export namespace ProtocolIdentifiers {
|
|
26
|
+
export enum StrategiesAutomation {
|
|
27
|
+
MakerDAO = 'MakerDAO__MCD',
|
|
28
|
+
Liquity = 'Liquity',
|
|
29
|
+
ChickenBonds = 'ChickenBonds',
|
|
30
|
+
CompoundV3 = 'Compound__V3',
|
|
31
|
+
AaveV3 = 'Aave__V3',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export enum LegacyAutomation {
|
|
35
|
+
MakerDAO = 'MakerDAO__MCD',
|
|
36
|
+
CompoundV2 = 'Compound__V2',
|
|
37
|
+
AaveV2 = 'Aave__V2',
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export namespace Strategies {
|
|
42
|
+
export enum MainnetIds {
|
|
43
|
+
MAKER_CLOSE_ON_PRICE_TO_DAI = 7,
|
|
44
|
+
MAKER_CLOSE_ON_PRICE_TO_COLL = 9,
|
|
45
|
+
LIQUITY_CLOSE_ON_PRICE_TO_COLL_DEPRECATED = 10, // replaced with 14
|
|
46
|
+
MAKER_TRAILING_STOP_LOSS_TO_COLL = 11,
|
|
47
|
+
MAKER_TRAILING_STOP_LOSS_TO_DAI = 12,
|
|
48
|
+
LIQUITY_TRAILING_STOP_LOSS_TO_COLL = 13,
|
|
49
|
+
LIQUITY_CLOSE_ON_PRICE_TO_COLL = 14,
|
|
50
|
+
CHICKEN_BONDS_REBOND = 31,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export enum OptimismIds {}
|
|
54
|
+
|
|
55
|
+
export enum ArbitrumIds {}
|
|
56
|
+
|
|
57
|
+
export enum Identifiers {
|
|
58
|
+
SavingsLiqProtection = 'smart-savings-liquidation-protection',
|
|
59
|
+
Repay = 'repay',
|
|
60
|
+
EoaRepay = 'eoa-repay',
|
|
61
|
+
Boost = 'boost',
|
|
62
|
+
EoaBoost = 'eoa-boost',
|
|
63
|
+
CloseToDebt = 'close-to-debt',
|
|
64
|
+
CloseToCollateral = 'close-to-collateral',
|
|
65
|
+
CloseOnPriceToDebt = 'close-on-price-to-debt',
|
|
66
|
+
CloseOnPriceToColl = 'close-on-price-to-collateral',
|
|
67
|
+
TrailingStopToColl = 'trailing-stop-to-collateral',
|
|
68
|
+
TrailingStopToDebt = 'trailing-stop-to-debt',
|
|
69
|
+
Rebond = 'rebond',
|
|
70
|
+
BondProtection = 'bond-protection',
|
|
71
|
+
}
|
|
72
|
+
export enum IdOverrides {
|
|
73
|
+
TakeProfit = 'take-profit',
|
|
74
|
+
StopLoss = 'stop-loss',
|
|
75
|
+
TrailingStop = 'trailing-stop',
|
|
76
|
+
LeverageManagement = 'leverage-management',
|
|
77
|
+
EoaLeverageManagement = 'leverage-management-eoa',
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export namespace Bundles {
|
|
82
|
+
export enum MainnetIds {
|
|
83
|
+
MAKER_REPAY_FROM_SMART_SAVINGS_YEARN = 0,
|
|
84
|
+
MAKER_REPAY_FROM_SMART_SAVINGS_MSTABLE = 1,
|
|
85
|
+
MAKER_REPAY_FROM_SMART_SAVINGS_RARI = 2,
|
|
86
|
+
COMP_V3_SW_REPAY_BUNDLE = 3,
|
|
87
|
+
COMP_V3_SW_BOOST_BUNDLE = 4,
|
|
88
|
+
COMP_V3_EOA_REPAY_BUNDLE = 5,
|
|
89
|
+
COMP_V3_EOA_BOOST_BUNDLE = 6,
|
|
90
|
+
LIQUITY_PAYBACK_USING_CHICKEN_BOND = 7,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export enum OptimismIds {
|
|
94
|
+
AAVE_V3_REPAY = 0,
|
|
95
|
+
AAVE_V3_BOOST = 1,
|
|
96
|
+
AAVE_V3_CLOSE_TO_DEBT = 2,
|
|
97
|
+
AAVE_V3_CLOSE_TO_COLLATERAL = 3,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export enum ArbitrumIds {
|
|
101
|
+
AAVE_V3_REPAY = 0,
|
|
102
|
+
AAVE_V3_BOOST = 1,
|
|
103
|
+
AAVE_V3_CLOSE_TO_DEBT = 2,
|
|
104
|
+
AAVE_V3_CLOSE_TO_COLLATERAL = 3,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type Web3 from 'web3';
|
|
2
|
+
import type { AbiItem } from 'web3-utils';
|
|
3
|
+
import type { BaseContract, BlockType } from './contracts/generated/types';
|
|
4
|
+
import type { Subscribe, StrategyModel } from './contracts/generated/SubStorage';
|
|
5
|
+
import type {
|
|
6
|
+
ChainId, Strategies, Bundles, ProtocolIdentifiers,
|
|
7
|
+
RatioState,
|
|
8
|
+
} from './enums';
|
|
9
|
+
|
|
10
|
+
export type PlaceholderType = any; // TODO - fix any types
|
|
11
|
+
|
|
12
|
+
export type EthereumAddress = string;
|
|
13
|
+
|
|
14
|
+
export type BlockNumber = BlockType;
|
|
15
|
+
|
|
16
|
+
export declare namespace Utils {
|
|
17
|
+
type WithOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
18
|
+
|
|
19
|
+
type WithRequired<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
|
|
20
|
+
|
|
21
|
+
type ValuesOf<E> = E[keyof E];
|
|
22
|
+
|
|
23
|
+
type EnumUnion<T> = {
|
|
24
|
+
[k in keyof T]: ValuesOf<T[k]>;
|
|
25
|
+
}[keyof T];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare namespace Contract {
|
|
29
|
+
interface Json {
|
|
30
|
+
abi: AbiItem[],
|
|
31
|
+
networks?: {
|
|
32
|
+
[key in ChainId as string]: {
|
|
33
|
+
createdBlock?: number,
|
|
34
|
+
address: EthereumAddress,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface WithMeta<T> {
|
|
40
|
+
abi: AbiItem[],
|
|
41
|
+
address: EthereumAddress,
|
|
42
|
+
createdBlock: BlockNumber,
|
|
43
|
+
contract: T,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export declare namespace Multicall {
|
|
48
|
+
interface Calls {
|
|
49
|
+
abiItem: AbiItem,
|
|
50
|
+
target: EthereumAddress,
|
|
51
|
+
gasLimit?: number,
|
|
52
|
+
params: any[],
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface FormattedCalls {
|
|
56
|
+
callData: string,
|
|
57
|
+
target: EthereumAddress,
|
|
58
|
+
gasLimit: number,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type Payload = any[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface SubscriptionOptions {
|
|
65
|
+
toBlock: BlockNumber,
|
|
66
|
+
fromBlock: BlockNumber,
|
|
67
|
+
mergeWithSameId?: boolean,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export declare namespace Interfaces {
|
|
71
|
+
interface ProtocolBase {
|
|
72
|
+
id: ProtocolIdentifiers.StrategiesAutomation | ProtocolIdentifiers.LegacyAutomation,
|
|
73
|
+
name: string,
|
|
74
|
+
fullName: string,
|
|
75
|
+
version: string,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface Protocol extends ProtocolBase {
|
|
79
|
+
id: ProtocolIdentifiers.StrategiesAutomation,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface LegacyProtocol extends ProtocolBase {
|
|
83
|
+
id: ProtocolIdentifiers.LegacyAutomation,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface Automation {
|
|
87
|
+
provider: Web3,
|
|
88
|
+
}
|
|
89
|
+
interface LegacyAutomation<T extends BaseContract> {
|
|
90
|
+
provider: Web3,
|
|
91
|
+
monitorAddress: EthereumAddress,
|
|
92
|
+
protocol: Interfaces.LegacyProtocol,
|
|
93
|
+
subscriptionsJson: Contract.WithMeta<T>,
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface Strategy {
|
|
98
|
+
strategyId: Strategies.Identifiers | Strategies.IdOverrides,
|
|
99
|
+
protocol: Interfaces.Protocol,
|
|
100
|
+
isBundle?: boolean,
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface BundleOrStrategy extends Strategy {
|
|
104
|
+
bundleId?: string,
|
|
105
|
+
bundleName?: string,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type TriggerData = StrategyModel.StrategySubStructOutputStruct['triggerData'];
|
|
109
|
+
export type SubData = StrategyModel.StrategySubStructOutputStruct['subData'];
|
|
110
|
+
|
|
111
|
+
export declare namespace Position {
|
|
112
|
+
namespace Specific {
|
|
113
|
+
interface Base {
|
|
114
|
+
subId1?: number,
|
|
115
|
+
subId2?: number,
|
|
116
|
+
mergeWithSameId?: boolean
|
|
117
|
+
}
|
|
118
|
+
interface RatioProtection extends Base {
|
|
119
|
+
minRatio?: number,
|
|
120
|
+
minOptimalRatio?: number,
|
|
121
|
+
repayEnabled?: boolean,
|
|
122
|
+
maxRatio?: number,
|
|
123
|
+
maxOptimalRatio?: number,
|
|
124
|
+
boostEnabled?: boolean,
|
|
125
|
+
}
|
|
126
|
+
interface CloseOnPrice extends Base {
|
|
127
|
+
price: string,
|
|
128
|
+
closeToAssetAddr: EthereumAddress,
|
|
129
|
+
}
|
|
130
|
+
interface CloseOnPriceAave extends Base {
|
|
131
|
+
collAsset: EthereumAddress,
|
|
132
|
+
collAssetId: number,
|
|
133
|
+
debtAsset: EthereumAddress,
|
|
134
|
+
debtAssetId: number,
|
|
135
|
+
baseToken: EthereumAddress,
|
|
136
|
+
quoteToken: EthereumAddress,
|
|
137
|
+
price: string,
|
|
138
|
+
ratioState: RatioState,
|
|
139
|
+
}
|
|
140
|
+
interface TrailingStop extends Base {
|
|
141
|
+
roundId: number,
|
|
142
|
+
triggerPercentage: number,
|
|
143
|
+
closeToAssetAddr: EthereumAddress,
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface Automated {
|
|
148
|
+
chainId: ChainId,
|
|
149
|
+
owner: EthereumAddress,
|
|
150
|
+
subId: number,
|
|
151
|
+
subIds?: number[],
|
|
152
|
+
isEnabled?: boolean,
|
|
153
|
+
protocol: Interfaces.Protocol,
|
|
154
|
+
strategy: BundleOrStrategy,
|
|
155
|
+
strategyData: {
|
|
156
|
+
encoded: {
|
|
157
|
+
triggerData: TriggerData,
|
|
158
|
+
subData: SubData,
|
|
159
|
+
},
|
|
160
|
+
decoded: { // TODO type this?
|
|
161
|
+
triggerData: PlaceholderType,
|
|
162
|
+
subData: PlaceholderType,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
specific: Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave,
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
interface LegacyAutomated {
|
|
169
|
+
chainId: ChainId,
|
|
170
|
+
owner: EthereumAddress,
|
|
171
|
+
isEnabled: boolean,
|
|
172
|
+
protocol: Interfaces.LegacyProtocol,
|
|
173
|
+
specific: any,
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
type StrategyInfo<T extends number> = Record<T, Strategy>;
|
|
179
|
+
export type MainnetStrategiesInfo = StrategyInfo<Strategies.MainnetIds>;
|
|
180
|
+
export type OptimismStrategiesInfo = StrategyInfo<Strategies.OptimismIds>;
|
|
181
|
+
export type ArbitrumStrategiesInfo = StrategyInfo<Strategies.ArbitrumIds>;
|
|
182
|
+
|
|
183
|
+
type BundleInfo<T extends number> = Record<T, BundleOrStrategy>;
|
|
184
|
+
export type MainnetBundleInfo = BundleInfo<Bundles.MainnetIds>;
|
|
185
|
+
export type OptimismBundleInfo = BundleInfo<Bundles.OptimismIds>;
|
|
186
|
+
export type ArbitrumBundleInfo = BundleInfo<Bundles.ArbitrumIds>;
|
|
187
|
+
|
|
188
|
+
export interface StrategiesInfo {
|
|
189
|
+
[ChainId.Ethereum]: MainnetStrategiesInfo,
|
|
190
|
+
[ChainId.Optimism]: OptimismStrategiesInfo,
|
|
191
|
+
[ChainId.Arbitrum]: ArbitrumStrategiesInfo
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface BundlesInfo {
|
|
195
|
+
[ChainId.Ethereum]: MainnetBundleInfo,
|
|
196
|
+
[ChainId.Optimism]: OptimismBundleInfo,
|
|
197
|
+
[ChainId.Arbitrum]: ArbitrumBundleInfo
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export type StrategyOrBundleIds =
|
|
201
|
+
Strategies.MainnetIds & Strategies.OptimismIds & Strategies.ArbitrumIds
|
|
202
|
+
& Bundles.MainnetIds & Bundles.OptimismIds & Bundles.ArbitrumIds;
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
export interface ParseData {
|
|
206
|
+
chainId: ChainId,
|
|
207
|
+
subscriptionEventData: Subscribe['returnValues']
|
|
208
|
+
strategiesSubsData: StrategyModel.StoredSubDataStructOutputStruct,
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
type MapToProtocolVersion<T> = {
|
|
212
|
+
[i in ProtocolIdentifiers.StrategiesAutomation]: {
|
|
213
|
+
[key in Strategies.Identifiers as string]: T
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export type StrategiesToProtocolVersionMapping = MapToProtocolVersion<(position: Position.Automated, parseData: ParseData) => Position.Automated>;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Basic Options */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
"target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
+
"module": "ESNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
+
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
|
+
"allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
+
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
+
// "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
13
|
+
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
+
// "emitDeclarationOnly": false,
|
|
15
|
+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
16
|
+
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
17
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
18
|
+
"outDir": "./esm/", /* Redirect output structure to the directory. */
|
|
19
|
+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
20
|
+
// "composite": true, /* Enable project compilation */
|
|
21
|
+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
22
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
23
|
+
// "noEmit": true, /* Do not emit outputs. */
|
|
24
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
25
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
26
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
27
|
+
|
|
28
|
+
/* Strict Type-Checking Options */
|
|
29
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
30
|
+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
31
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
32
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
33
|
+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
34
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
35
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
36
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
37
|
+
"resolveJsonModule": true,
|
|
38
|
+
|
|
39
|
+
/* Additional Checks */
|
|
40
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
41
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
42
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
43
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
44
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
45
|
+
|
|
46
|
+
/* Module Resolution Options */
|
|
47
|
+
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
48
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
49
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
50
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
51
|
+
//"typeRoots": ["utils.ts"], /* List of folders to include type definitions from. */
|
|
52
|
+
//"types": ["./src/utils.ts"], /* Type declaration files to be included in compilation. */
|
|
53
|
+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
54
|
+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
55
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
56
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
57
|
+
|
|
58
|
+
/* Source Map Options */
|
|
59
|
+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
60
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
61
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
62
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
63
|
+
|
|
64
|
+
/* Experimental Options */
|
|
65
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
66
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
67
|
+
|
|
68
|
+
/* Advanced Options */
|
|
69
|
+
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
|
70
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
71
|
+
},
|
|
72
|
+
"include": [
|
|
73
|
+
"./src/**/*",
|
|
74
|
+
],
|
|
75
|
+
"typedocOptions": {
|
|
76
|
+
"entryPoints": ["./src/index.ts"],
|
|
77
|
+
"out": "docs",
|
|
78
|
+
}
|
|
79
|
+
}
|