otomato-sdk 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 (47) hide show
  1. package/.mocharc.json +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +67 -0
  4. package/dist/examples/create-trigger-list.js +136 -0
  5. package/dist/examples/create-trigger.js +7 -0
  6. package/dist/src/constants/ActionBlocks.js +321 -0
  7. package/dist/src/constants/chains.js +5 -0
  8. package/dist/src/constants/tokens.js +82 -0
  9. package/dist/src/index.js +13 -0
  10. package/dist/src/models/Action.js +1 -0
  11. package/dist/src/models/Automation.js +1 -0
  12. package/dist/src/models/Condition.js +1 -0
  13. package/dist/src/models/Parameter.js +1 -0
  14. package/dist/src/models/Trigger.js +110 -0
  15. package/dist/src/services/ApiService.js +1 -0
  16. package/dist/src/services/AutomationService.js +1 -0
  17. package/dist/test/trigger.spec.js +72 -0
  18. package/dist/types/examples/create-trigger-list.d.ts +1 -0
  19. package/dist/types/examples/create-trigger.d.ts +1 -0
  20. package/dist/types/src/constants/ActionBlocks.d.ts +91 -0
  21. package/dist/types/src/constants/chains.d.ts +5 -0
  22. package/dist/types/src/constants/tokens.d.ts +11 -0
  23. package/dist/types/src/index.d.ts +10 -0
  24. package/dist/types/src/models/Action.d.ts +6 -0
  25. package/dist/types/src/models/Automation.d.ts +6 -0
  26. package/dist/types/src/models/Condition.d.ts +6 -0
  27. package/dist/types/src/models/Parameter.d.ts +6 -0
  28. package/dist/types/src/models/Trigger.d.ts +37 -0
  29. package/dist/types/src/services/ApiService.d.ts +6 -0
  30. package/dist/types/src/services/AutomationService.d.ts +6 -0
  31. package/dist/types/test/trigger.spec.d.ts +1 -0
  32. package/examples/create-trigger-list.ts +159 -0
  33. package/examples/create-trigger.ts +12 -0
  34. package/package.json +37 -0
  35. package/src/constants/ActionBlocks.ts +324 -0
  36. package/src/constants/chains.ts +5 -0
  37. package/src/constants/tokens.ts +97 -0
  38. package/src/index.ts +15 -0
  39. package/src/models/Action.ts +6 -0
  40. package/src/models/Automation.ts +6 -0
  41. package/src/models/Condition.ts +6 -0
  42. package/src/models/Parameter.ts +6 -0
  43. package/src/models/Trigger.ts +128 -0
  44. package/src/services/ApiService.ts +6 -0
  45. package/src/services/AutomationService.ts +6 -0
  46. package/test/trigger.spec.ts +86 -0
  47. package/tsconfig.json +16 -0
package/.mocharc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extension": ["ts"],
3
+ "spec": ["test/**/*.spec.ts"],
4
+ "node-option": [
5
+ "experimental-specifier-resolution=node",
6
+ "loader=ts-node/esm"
7
+ ]
8
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Otomato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+
2
+ # Otomato SDK
3
+
4
+ The Otomato SDK provides a set of tools to create and manage automations, triggers, and actions in your applications. It is designed to work in both frontend and backend environments using TypeScript.
5
+
6
+ ## Installation
7
+
8
+ To install the Otomato SDK, run:
9
+
10
+ ```bash
11
+ npm install otomato-sdk
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ### Create an Automation
17
+
18
+ ### Create a Trigger
19
+
20
+ #### Example
21
+
22
+ Here's how to create a trigger using the Otomato SDK:
23
+
24
+ ```typescript
25
+ import { TRIGGERS, CHAINS, getToken, Trigger } from 'otomato-sdk';
26
+
27
+ // get notified when vitalik.eth transfers USDC
28
+ const transferTrigger = new Trigger(TRIGGERS.ETHEREUM.ERC20.TRANSFER);
29
+
30
+ transferTrigger.setChainId(CHAINS.ETHEREUM);
31
+ transferTrigger.setParams("from", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
32
+ transferTrigger.setContractAddress(getToken(CHAINS.ETHEREUM, 'USDC').contractAddress);
33
+
34
+ console.log(transferTrigger.getParameters());
35
+ console.log(transferTrigger.toJSON());
36
+ ```
37
+
38
+ ## Contributing
39
+
40
+ We welcome contributions to the Otomato SDK. Please make sure you have Node.js v20 installed.
41
+
42
+ ### Development Setup
43
+
44
+ 1. Clone the repository:
45
+ ```bash
46
+ git clone https://github.com/otomatorg/otomato-sdk.git
47
+ cd otomato-sdk
48
+ ```
49
+
50
+ 2. Install dependencies:
51
+ ```bash
52
+ npm install
53
+ ```
54
+
55
+ 3. Build the project:
56
+ ```bash
57
+ npm run build
58
+ ```
59
+
60
+ 4. Run an example:
61
+ ```bash
62
+ node dist/examples/create-trigger.js
63
+ ```
64
+
65
+ ## License
66
+
67
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,136 @@
1
+ import { TRIGGERS, getToken, TOKENS, CHAINS, Trigger } from '../src/index.js';
2
+ const generateDefaultTriggers = () => {
3
+ const triggersList = [];
4
+ const createDefaultTrigger = (trigger) => {
5
+ const triggerInstance = new Trigger(trigger);
6
+ // Set common parameters if they exist
7
+ if (trigger.parameters.some((p) => p.key === "chainId")) {
8
+ triggerInstance.setChainId(CHAINS.ETHEREUM);
9
+ }
10
+ if (trigger.parameters.some((p) => p.key === "contractAddress")) {
11
+ triggerInstance.setContractAddress(getToken(CHAINS.ETHEREUM, 'USDC').contractAddress);
12
+ }
13
+ if (trigger.parameters.some((p) => p.key === "condition")) {
14
+ triggerInstance.setCondition('>');
15
+ }
16
+ if (trigger.parameters.some((p) => p.key === "comparisonValue")) {
17
+ triggerInstance.setComparisonValue(1000);
18
+ }
19
+ if (trigger.parameters.some((p) => p.key === "interval")) {
20
+ triggerInstance.setInterval(60000); // 1 minute interval
21
+ }
22
+ if (trigger.parameters.some((p) => p.key === "abiParams.account")) {
23
+ triggerInstance.setParams('account', '0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6');
24
+ }
25
+ return triggerInstance.toJSON();
26
+ };
27
+ // Explicitly create each trigger
28
+ triggersList.push(createDefaultTrigger(TRIGGERS.TOKENS.ERC20.TRANSFER));
29
+ triggersList.push(createDefaultTrigger(TRIGGERS.YIELD.SPLICE_FI.SWAP));
30
+ triggersList.push(createDefaultTrigger(TRIGGERS.YIELD.SPLICE_FI.LIQUIDITY_REMOVED));
31
+ triggersList.push(createDefaultTrigger(TRIGGERS.YIELD.SPLICE_FI.MARKET_CREATION));
32
+ triggersList.push(createDefaultTrigger(TRIGGERS.YIELD.SPLICE_FI.INTEREST_RATE_UPDATE));
33
+ triggersList.push(createDefaultTrigger(TRIGGERS.LENDING.ASTARIA.LEND_RECALLED));
34
+ triggersList.push(createDefaultTrigger(TRIGGERS.DEXES.ODOS.SWAP));
35
+ triggersList.push(createDefaultTrigger(TRIGGERS.SOCIALS.MODE_NAME_SERVICE.NAME_REGISTERED));
36
+ return triggersList;
37
+ };
38
+ function generateTriggersForAllTokens(chain) {
39
+ if (!(chain in TOKENS)) {
40
+ throw new Error(`Unsupported chain: ${chain}`);
41
+ }
42
+ const tokens = TOKENS[chain];
43
+ const triggersList = [];
44
+ tokens.forEach(token => {
45
+ // Generate transfer trigger
46
+ const transferTrigger = new Trigger(TRIGGERS.TOKENS.ERC20.TRANSFER);
47
+ transferTrigger.setChainId(chain);
48
+ // transferTrigger.setParams("value", 1000);
49
+ // transferTrigger.setParams("to", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
50
+ transferTrigger.setContractAddress(token.contractAddress);
51
+ triggersList.push(transferTrigger);
52
+ // Generate balance trigger
53
+ const balanceTrigger = new Trigger(TRIGGERS.TOKENS.ERC20.BALANCE);
54
+ balanceTrigger.setChainId(chain);
55
+ balanceTrigger.setParams("account", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
56
+ balanceTrigger.setContractAddress(token.contractAddress);
57
+ balanceTrigger.setCondition(">");
58
+ balanceTrigger.setComparisonValue(10);
59
+ balanceTrigger.setInterval(5000);
60
+ triggersList.push(balanceTrigger);
61
+ });
62
+ return triggersList.map(t => t.toJSON());
63
+ }
64
+ const generateSpecificTriggers = () => {
65
+ // Create individual triggers
66
+ const transferTrigger = new Trigger(TRIGGERS.TOKENS.ERC20.TRANSFER);
67
+ transferTrigger.setChainId(CHAINS.ETHEREUM);
68
+ transferTrigger.setParams("value", 1000);
69
+ transferTrigger.setParams("to", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
70
+ transferTrigger.setContractAddress(getToken(CHAINS.ETHEREUM, 'USDC').contractAddress);
71
+ const balanceTrigger = new Trigger(TRIGGERS.TOKENS.ERC20.BALANCE);
72
+ balanceTrigger.setChainId(CHAINS.ETHEREUM);
73
+ balanceTrigger.setParams("account", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
74
+ balanceTrigger.setContractAddress(getToken(CHAINS.ETHEREUM, 'USDC').contractAddress);
75
+ balanceTrigger.setCondition(">");
76
+ balanceTrigger.setComparisonValue(45000);
77
+ balanceTrigger.setInterval(5000);
78
+ const spliceFiSwapTrigger = new Trigger(TRIGGERS.YIELD.SPLICE_FI.SWAP);
79
+ spliceFiSwapTrigger.setParams("caller", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
80
+ spliceFiSwapTrigger.setParams("market", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
81
+ spliceFiSwapTrigger.setParams("receiver", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
82
+ spliceFiSwapTrigger.setParams("netPtToAccount", 1000);
83
+ spliceFiSwapTrigger.setParams("netSyToAccount", 2000);
84
+ const liquidityRemovedTrigger = new Trigger(TRIGGERS.YIELD.SPLICE_FI.LIQUIDITY_REMOVED);
85
+ liquidityRemovedTrigger.setParams("caller", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
86
+ liquidityRemovedTrigger.setParams("market", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
87
+ liquidityRemovedTrigger.setParams("receiver", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
88
+ liquidityRemovedTrigger.setParams("netLpToRemove", 1000);
89
+ liquidityRemovedTrigger.setParams("netPtOut", 500);
90
+ liquidityRemovedTrigger.setParams("netSyOut", 1500);
91
+ const marketCreationTrigger = new Trigger(TRIGGERS.YIELD.SPLICE_FI.MARKET_CREATION);
92
+ marketCreationTrigger.setParams("market", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
93
+ marketCreationTrigger.setParams("PT", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
94
+ marketCreationTrigger.setParams("scalarRoot", 1234);
95
+ marketCreationTrigger.setParams("initialAnchor", 5678);
96
+ marketCreationTrigger.setParams("lnFeeRateRoot", 91011);
97
+ const interestRateUpdateTrigger = new Trigger(TRIGGERS.YIELD.SPLICE_FI.INTEREST_RATE_UPDATE);
98
+ interestRateUpdateTrigger.setParams("timestamp", 1627848271);
99
+ interestRateUpdateTrigger.setParams("lastLnImpliedRate", 123456);
100
+ interestRateUpdateTrigger.setContractAddress("0xDE95511418EBD8Bd36294B11C86314DdFA50e212");
101
+ const lendRecalledTrigger = new Trigger(TRIGGERS.LENDING.ASTARIA.LEND_RECALLED);
102
+ lendRecalledTrigger.setParams("loanId", 123456);
103
+ lendRecalledTrigger.setParams("recaller", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
104
+ lendRecalledTrigger.setParams("end", 1627848271);
105
+ const odosSwapTrigger = new Trigger(TRIGGERS.DEXES.ODOS.SWAP);
106
+ odosSwapTrigger.setChainId(CHAINS.ETHEREUM);
107
+ odosSwapTrigger.setParams("sender", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
108
+ odosSwapTrigger.setParams("inputAmount", 1000);
109
+ odosSwapTrigger.setParams("inputToken", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
110
+ odosSwapTrigger.setParams("amountOut", 500);
111
+ odosSwapTrigger.setParams("outputToken", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
112
+ odosSwapTrigger.setParams("exchangeRate", 1.23);
113
+ const nameRegisteredTrigger = new Trigger(TRIGGERS.SOCIALS.MODE_NAME_SERVICE.NAME_REGISTERED);
114
+ nameRegisteredTrigger.setParams("id", 123456);
115
+ nameRegisteredTrigger.setParams("owner", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
116
+ nameRegisteredTrigger.setParams("expires", 1627848271);
117
+ return [
118
+ transferTrigger.toJSON(),
119
+ balanceTrigger.toJSON(),
120
+ spliceFiSwapTrigger.toJSON(),
121
+ liquidityRemovedTrigger.toJSON(),
122
+ marketCreationTrigger.toJSON(),
123
+ interestRateUpdateTrigger.toJSON(),
124
+ lendRecalledTrigger.toJSON(),
125
+ odosSwapTrigger.toJSON(),
126
+ nameRegisteredTrigger.toJSON(),
127
+ ];
128
+ };
129
+ // Collect all triggers in a list
130
+ const triggersList = [
131
+ ...generateTriggersForAllTokens(CHAINS.ETHEREUM),
132
+ ...generateTriggersForAllTokens(CHAINS.MODE),
133
+ ...generateDefaultTriggers(),
134
+ ...generateSpecificTriggers()
135
+ ];
136
+ console.log(JSON.stringify(triggersList));
@@ -0,0 +1,7 @@
1
+ import { TRIGGERS, getToken, CHAINS, Trigger } from '../src/index.js';
2
+ const transferTrigger = new Trigger(TRIGGERS.TOKENS.ERC20.TRANSFER);
3
+ transferTrigger.setChainId(CHAINS.ETHEREUM);
4
+ // transferTrigger.setParams("value", 1000);
5
+ // transferTrigger.setParams("to", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
6
+ transferTrigger.setContractAddress(getToken(CHAINS.ETHEREUM, 'USDC').contractAddress);
7
+ console.log(transferTrigger.toJSON());
@@ -0,0 +1,321 @@
1
+ import { CHAINS } from './chains.js';
2
+ const TRIGGER_TYPE = {
3
+ SUBSCRIPTION: 0,
4
+ POLLING: 1,
5
+ };
6
+ export const TRIGGERS = {
7
+ TOKENS: {
8
+ ERC20: {
9
+ CHAINS: [CHAINS.ALL],
10
+ TRANSFER: {
11
+ id: 1,
12
+ name: "Transfer token",
13
+ description: "Transfer an ERC-20 token",
14
+ type: TRIGGER_TYPE.SUBSCRIPTION,
15
+ parameters: [
16
+ {
17
+ key: "chainId",
18
+ type: "int",
19
+ description: "Chain ID of the ETH blockchain"
20
+ },
21
+ {
22
+ key: "abiParams.value",
23
+ type: "uint256",
24
+ description: "Amount of crypto to transfer"
25
+ },
26
+ {
27
+ key: "abiParams.to",
28
+ type: "address",
29
+ description: "Address to transfer crypto to"
30
+ },
31
+ {
32
+ key: "contractAddress",
33
+ type: "address",
34
+ description: "The contract address of the ERC20"
35
+ }
36
+ ]
37
+ },
38
+ BALANCE: {
39
+ id: 1000,
40
+ name: "ERC20 balance check",
41
+ description: "Fetches the balance of an ERC20 and checks it against the specified condition.",
42
+ type: TRIGGER_TYPE.POLLING,
43
+ parameters: [
44
+ {
45
+ key: "chainId",
46
+ type: "int",
47
+ description: "Chain ID of the ETH blockchain"
48
+ },
49
+ {
50
+ key: "abiParams.account",
51
+ type: "address",
52
+ description: "Amount of crypto to transfer"
53
+ },
54
+ {
55
+ key: "contractAddress",
56
+ type: "address",
57
+ description: "The contract address of the ERC20"
58
+ },
59
+ {
60
+ key: "condition",
61
+ type: "logic_operator",
62
+ description: "Logic operator used for the comparison: <, >, <=, >=, ==, ..."
63
+ },
64
+ // todo: it should be in the same type as the output of the function
65
+ {
66
+ key: "comparisonValue",
67
+ type: "any",
68
+ description: "The value to compare to"
69
+ },
70
+ {
71
+ key: "interval",
72
+ type: "integer",
73
+ description: "The waiting time between each polling"
74
+ },
75
+ ],
76
+ }
77
+ },
78
+ },
79
+ YIELD: {
80
+ SPLICE_FI: {
81
+ CHAINS: [CHAINS.MODE],
82
+ SWAP: {
83
+ id: 2,
84
+ name: "Splice Finance Swap",
85
+ description: "Swap in Splice Finance",
86
+ type: TRIGGER_TYPE.SUBSCRIPTION,
87
+ parameters: [
88
+ {
89
+ key: "abiParams.caller",
90
+ type: "address",
91
+ description: "Caller address"
92
+ },
93
+ {
94
+ key: "abiParams.market",
95
+ type: "address",
96
+ description: "Market address"
97
+ },
98
+ {
99
+ key: "abiParams.receiver",
100
+ type: "address",
101
+ description: "Receiver address"
102
+ },
103
+ {
104
+ key: "abiParams.netPtToAccount",
105
+ type: "int256",
106
+ description: "Net PT to account"
107
+ },
108
+ {
109
+ key: "abiParams.netSyToAccount",
110
+ type: "int256",
111
+ description: "Net SY to account"
112
+ }
113
+ ]
114
+ },
115
+ LIQUIDITY_REMOVED: {
116
+ id: 6,
117
+ name: "Liquidity Removed",
118
+ description: "Liquidity removed in Splice Finance",
119
+ type: TRIGGER_TYPE.SUBSCRIPTION,
120
+ parameters: [
121
+ {
122
+ key: "abiParams.caller",
123
+ type: "address",
124
+ description: "Caller address"
125
+ },
126
+ {
127
+ key: "abiParams.market",
128
+ type: "address",
129
+ description: "Market address"
130
+ },
131
+ {
132
+ key: "abiParams.receiver",
133
+ type: "address",
134
+ description: "Receiver address"
135
+ },
136
+ {
137
+ key: "abiParams.netLpToRemove",
138
+ type: "uint256",
139
+ description: "Net LP to remove"
140
+ },
141
+ {
142
+ key: "abiParams.netPtOut",
143
+ type: "uint256",
144
+ description: "Net PT out"
145
+ },
146
+ {
147
+ key: "abiParams.netSyOut",
148
+ type: "uint256",
149
+ description: "Net SY out"
150
+ }
151
+ ]
152
+ },
153
+ MARKET_CREATION: {
154
+ id: 7,
155
+ name: "Market Creation",
156
+ description: "Market creation in Splice Finance",
157
+ type: TRIGGER_TYPE.SUBSCRIPTION,
158
+ parameters: [
159
+ {
160
+ key: "abiParams.market",
161
+ type: "address",
162
+ description: "Market address"
163
+ },
164
+ {
165
+ key: "abiParams.PT",
166
+ type: "address",
167
+ description: "PT address"
168
+ },
169
+ {
170
+ key: "abiParams.scalarRoot",
171
+ type: "int256",
172
+ description: "Scalar root"
173
+ },
174
+ {
175
+ key: "abiParams.initialAnchor",
176
+ type: "int256",
177
+ description: "Initial anchor"
178
+ },
179
+ {
180
+ key: "abiParams.lnFeeRateRoot",
181
+ type: "uint256",
182
+ description: "LN fee rate root"
183
+ }
184
+ ]
185
+ },
186
+ INTEREST_RATE_UPDATE: {
187
+ id: 9,
188
+ name: "Interest Rate Update",
189
+ description: "Interest rate update in Splice Finance",
190
+ type: TRIGGER_TYPE.SUBSCRIPTION,
191
+ parameters: [
192
+ {
193
+ key: "abiParams.timestamp",
194
+ type: "uint256",
195
+ description: "Timestamp"
196
+ },
197
+ {
198
+ key: "abiParams.lastLnImpliedRate",
199
+ type: "int256",
200
+ description: "Last LN implied rate"
201
+ },
202
+ {
203
+ key: "contractAddress",
204
+ type: "address",
205
+ description: "Contract address to monitor",
206
+ enum: [
207
+ "0xDE95511418EBD8Bd36294B11C86314DdFA50e212", // wrsETH
208
+ "0x34cf9BF641bd5f34197060A3f3478a1f97f78f0a", // ezETH
209
+ "0xb950A73Ea0842B0Cd06D0e369aE974799BB346f1", // MODE
210
+ "0xbF14932e1A7962C77D0b31be80075936bE1A43D4" // weETH
211
+ ]
212
+ }
213
+ ]
214
+ }
215
+ }
216
+ },
217
+ LENDING: {
218
+ ASTARIA: {
219
+ CHAINS: [CHAINS.MODE],
220
+ LEND_RECALLED: {
221
+ id: 8,
222
+ name: "Lend Recalled",
223
+ description: "Lend recalled in Astaria",
224
+ type: TRIGGER_TYPE.SUBSCRIPTION,
225
+ parameters: [
226
+ {
227
+ key: "abiParams.loanId",
228
+ type: "uint256",
229
+ description: "Loan ID"
230
+ },
231
+ {
232
+ key: "abiParams.recaller",
233
+ type: "address",
234
+ description: "Recaller address"
235
+ },
236
+ {
237
+ key: "abiParams.end",
238
+ type: "uint256",
239
+ description: "End time"
240
+ }
241
+ ]
242
+ }
243
+ }
244
+ },
245
+ DEXES: {
246
+ ODOS: {
247
+ CHAINS: [CHAINS.MODE, CHAINS.ETHEREUM],
248
+ SWAP: {
249
+ id: 4,
250
+ name: "Odos Swap",
251
+ description: "Swap on Odos",
252
+ type: TRIGGER_TYPE.SUBSCRIPTION,
253
+ parameters: [
254
+ {
255
+ key: "chainId",
256
+ type: "int",
257
+ description: "Chain ID of the ETH blockchain"
258
+ },
259
+ {
260
+ key: "abiParams.sender",
261
+ type: "address",
262
+ description: "Sender address"
263
+ },
264
+ {
265
+ key: "abiParams.inputAmount",
266
+ type: "uint256",
267
+ description: "Input amount"
268
+ },
269
+ {
270
+ key: "abiParams.inputToken",
271
+ type: "address",
272
+ description: "Input token address"
273
+ },
274
+ {
275
+ key: "abiParams.amountOut",
276
+ type: "uint256",
277
+ description: "Output amount"
278
+ },
279
+ {
280
+ key: "abiParams.outputToken",
281
+ type: "address",
282
+ description: "Output token address"
283
+ },
284
+ {
285
+ key: "abiParams.exchangeRate",
286
+ type: "float",
287
+ description: "Exchange rate"
288
+ }
289
+ ]
290
+ }
291
+ }
292
+ },
293
+ SOCIALS: {
294
+ MODE_NAME_SERVICE: {
295
+ CHAINS: [CHAINS.MODE],
296
+ NAME_REGISTERED: {
297
+ id: 3,
298
+ name: "Name Registered",
299
+ description: "Name registered in Mode Name Service",
300
+ type: TRIGGER_TYPE.SUBSCRIPTION,
301
+ parameters: [
302
+ {
303
+ key: "abiParams.id",
304
+ type: "uint256",
305
+ description: "ID of the name registered"
306
+ },
307
+ {
308
+ key: "abiParams.owner",
309
+ type: "address",
310
+ description: "Owner address"
311
+ },
312
+ {
313
+ key: "abiParams.expires",
314
+ type: "uint256",
315
+ description: "Expiration time"
316
+ }
317
+ ]
318
+ }
319
+ }
320
+ }
321
+ };
@@ -0,0 +1,5 @@
1
+ export const CHAINS = {
2
+ ALL: 0,
3
+ ETHEREUM: 1,
4
+ MODE: 43334,
5
+ };
@@ -0,0 +1,82 @@
1
+ export const TOKENS = {
2
+ 1: [
3
+ {
4
+ contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
5
+ name: "USDC",
6
+ symbol: "USDC",
7
+ decimals: 6
8
+ },
9
+ ],
10
+ 43334: [
11
+ {
12
+ contractAddress: "0x0000000000000000000000000000000000000000",
13
+ name: "ETH",
14
+ symbol: "ETH",
15
+ decimals: 18
16
+ },
17
+ {
18
+ contractAddress: "0xd988097fb8612cc24eeC14542bC03424c656005f",
19
+ name: "USDC",
20
+ symbol: "USDC",
21
+ decimals: 6
22
+ },
23
+ {
24
+ contractAddress: '0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF',
25
+ symbol: 'WBTC',
26
+ name: 'Wrapped BTC',
27
+ decimals: 8
28
+ },
29
+ {
30
+ contractAddress: '0xf0F161fDA2712DB8b566946122a5af183995e2eD',
31
+ symbol: 'USDT',
32
+ name: 'USDT',
33
+ decimals: 6
34
+ },
35
+ {
36
+ contractAddress: '0xDfc7C877a950e49D2610114102175A06C2e3167a',
37
+ symbol: 'MODE',
38
+ name: 'Mode',
39
+ decimals: 18
40
+ },
41
+ {
42
+ contractAddress: '0x71ef7EDa2Be775E5A7aa8afD02C45F059833e9d2',
43
+ symbol: 'ionWETH',
44
+ name: 'Ionic Wrapped Ether',
45
+ decimals: 18
46
+ },
47
+ {
48
+ contractAddress: '0x4200000000000000000000000000000000000006',
49
+ symbol: 'WETH',
50
+ name: 'Wrapped Ether',
51
+ decimals: 18
52
+ },
53
+ {
54
+ contractAddress: '0x59e710215d45F584f44c0FEe83DA6d43D762D857',
55
+ symbol: 'ionezETH',
56
+ name: 'Ionic Renzo Restaked ETH',
57
+ decimals: 18
58
+ },
59
+ {
60
+ contractAddress: '0x2416092f143378750bb29b79eD961ab195CcEea5',
61
+ symbol: 'ezETH',
62
+ name: 'Renzo Restaked ETH',
63
+ decimals: 18
64
+ },
65
+ {
66
+ contractAddress: '0x9c29a8eC901DBec4fFf165cD57D4f9E03D4838f7',
67
+ symbol: 'ironETH',
68
+ name: 'Ironclad ETH',
69
+ decimals: 18
70
+ },
71
+ ]
72
+ };
73
+ export function getToken(chain, symbol) {
74
+ if (!(chain in TOKENS)) {
75
+ throw new Error(`Unsupported chain: ${chain}`);
76
+ }
77
+ const token = TOKENS[chain].find(token => token.symbol === symbol);
78
+ if (!token) {
79
+ throw new Error(`Token ${symbol} not found on chain ${chain}`);
80
+ }
81
+ return token;
82
+ }
@@ -0,0 +1,13 @@
1
+ // Exporting constants
2
+ export * from './constants/ActionBlocks.js';
3
+ export * from './constants/chains.js';
4
+ export * from './constants/tokens.js';
5
+ // Exporting models
6
+ export * from './models/Action.js';
7
+ export * from './models/Automation.js';
8
+ export * from './models/Condition.js';
9
+ export * from './models/Parameter.js';
10
+ export * from './models/Trigger.js';
11
+ // Exporting services
12
+ export * from './services/ApiService.js';
13
+ export * from './services/AutomationService.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};