otomato-sdk 1.5.26 → 1.5.28

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.
@@ -10,7 +10,6 @@ export const TRIGGERS = {
10
10
  "name": "Transfer token",
11
11
  "description": "This block gets triggered when someone transfers the ERC20 configured in the params",
12
12
  "type": 0,
13
- "after": "async (params) => { return params }",
14
13
  "output": {
15
14
  "value": "uint256",
16
15
  "from": "address",
@@ -79,7 +78,6 @@ export const TRIGGERS = {
79
78
  "description": "Fetches the balance of an ERC20 and checks it against the specified condition.",
80
79
  "type": 1,
81
80
  "method": "function balanceOf(address account) view returns (uint256)",
82
- "after": "(output) => { const params=JSON.parse(output);const balance = BigInt(params)/1000000n; return {balance: Number(balance), comparisonValue: Number(balance)}; }",
83
81
  "output": {
84
82
  "balance": "integer"
85
83
  },
@@ -158,6 +156,112 @@ export const TRIGGERS = {
158
156
  }
159
157
  },
160
158
  "YIELD": {
159
+ "ETHENA": {
160
+ "description": "Ethena is a synthetic dollar protocol built on Ethereum that provides a crypto-native solution for money not reliant on traditional banking system infrastructure",
161
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/ethena.svg",
162
+ "SUSDE_YIELD": {
163
+ "name": "sUSDE yield",
164
+ "description": "Fetches Ethena's sUSDE yield",
165
+ "type": 3,
166
+ "url": "https://app.ethena.fi/api/yields/protocol-and-staking-yield",
167
+ "output": {
168
+ "yield": "float"
169
+ },
170
+ "parameters": [
171
+ {
172
+ "key": "condition",
173
+ "type": "logic_operator",
174
+ "description": "Logic operator used for the comparison: <, >, <=, >=, ==, ...",
175
+ "mandatory": true,
176
+ "category": 0
177
+ },
178
+ {
179
+ "key": "comparisonValue",
180
+ "type": "float",
181
+ "description": "The value to compare to",
182
+ "mandatory": true,
183
+ "category": 0
184
+ },
185
+ ],
186
+ "examples": [
187
+ {
188
+ "name": "Yield decreasing below 8%",
189
+ "description": "Gets triggered when the yield is below 8%",
190
+ "parameters": [
191
+ {
192
+ "key": "condition",
193
+ "value": "lte"
194
+ },
195
+ {
196
+ "key": "comparisonValue",
197
+ "value": 8
198
+ }
199
+ ]
200
+ },
201
+ {
202
+ "name": "Yield increasing above 20%",
203
+ "description": "Gets triggered when the yield is above 20%",
204
+ "parameters": [
205
+ {
206
+ "key": "condition",
207
+ "value": "gte"
208
+ },
209
+ {
210
+ "key": "comparisonValue",
211
+ "value": 20
212
+ }
213
+ ]
214
+ }
215
+ ],
216
+ "blockId": 12,
217
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/ethena.svg"
218
+ },
219
+ "TVL": {
220
+ "name": "USDE supply",
221
+ "description": "Fetches Ethena's USDE supply",
222
+ "type": 1,
223
+ "method": "function totalSupply() public view virtual override returns (uint256)",
224
+ "output": {
225
+ "supply": "integer"
226
+ },
227
+ "contractAddress": "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
228
+ "chainId": 1,
229
+ "parameters": [
230
+ {
231
+ "key": "condition",
232
+ "type": "logic_operator",
233
+ "description": "Logic operator used for the comparison: <, >, <=, >=, ==, ...",
234
+ "mandatory": true,
235
+ "category": 0
236
+ },
237
+ {
238
+ "key": "comparisonValue",
239
+ "type": "integer",
240
+ "description": "The value to compare to",
241
+ "mandatory": true,
242
+ "category": 0
243
+ },
244
+ ],
245
+ "examples": [
246
+ {
247
+ "name": "Supply above 3B$",
248
+ "description": "Gets triggered when the USDE supply is above 3B$",
249
+ "parameters": [
250
+ {
251
+ "key": "comparisonValue",
252
+ "value": 3000000000
253
+ },
254
+ {
255
+ "key": "condition",
256
+ "value": "gt"
257
+ }
258
+ ]
259
+ }
260
+ ],
261
+ "blockId": 13,
262
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/ethena.svg"
263
+ }
264
+ },
161
265
  "SPLICE_FI": {
162
266
  "description": "Split any yield-bearing asset into separate yield and principal components",
163
267
  "chains": [
@@ -169,7 +273,6 @@ export const TRIGGERS = {
169
273
  "description": "Swap in Splice Finance",
170
274
  "type": 0,
171
275
  "contractAddress": "0x7A3a94AE0fC1421A3eac23eA6371036ac8d8f448",
172
- "after": "async (params) => { return params }",
173
276
  "output": {
174
277
  "caller": "address",
175
278
  "market": "address",
@@ -219,7 +322,6 @@ export const TRIGGERS = {
219
322
  "description": "Liquidity removed in Splice Finance",
220
323
  "type": 0,
221
324
  "contractAddress": "0x7A3a94AE0fC1421A3eac23eA6371036ac8d8f448",
222
- "after": "async (params) => { return params }",
223
325
  "output": {
224
326
  "caller": "address",
225
327
  "market": "address",
@@ -276,7 +378,6 @@ export const TRIGGERS = {
276
378
  "description": "Market creation in Splice Finance",
277
379
  "type": 0,
278
380
  "contractAddress": "0x7A3a94AE0fC1421A3eac23eA6371036ac8d8f448",
279
- "after": "async (params) => { return params }",
280
381
  "output": {
281
382
  "market": "address",
282
383
  "PT": "erc20",
@@ -326,7 +427,6 @@ export const TRIGGERS = {
326
427
  "description": "Interest rate update in Splice Finance",
327
428
  "type": 0,
328
429
  "contractAddress": "0x7A3a94AE0fC1421A3eac23eA6371036ac8d8f448",
329
- "after": "async (params) => { return params }",
330
430
  "output": {
331
431
  "timestamp": "uint256",
332
432
  "lastLnImpliedRate": "int256",
@@ -559,7 +659,6 @@ export const TRIGGERS = {
559
659
  "description": "Name registered in Mode Name Service",
560
660
  "type": 0,
561
661
  "contractAddress": "0x2aD86eeEC513AC16804bb05310214C3Fd496835B",
562
- "after": "async (params) => { return params }",
563
662
  "output": {
564
663
  "id": "uint256",
565
664
  "owner": "address",
@@ -600,7 +699,6 @@ export const TRIGGERS = {
600
699
  "description": "Fetches the Fear and Greed Index from the specified API and processes the result.",
601
700
  "type": 3,
602
701
  "url": "https://api.alternative.me/fng/",
603
- "after": "async (res) => { return {value: res.data?.[0]?.value, comparisonValue: res.data?.[0]?.value} }",
604
702
  "output": {
605
703
  "value": "integer"
606
704
  },
@@ -794,6 +892,69 @@ export const TRIGGERS = {
794
892
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/trend-up.png"
795
893
  }
796
894
  }
895
+ },
896
+ "ETFS": {
897
+ "IBIT": {
898
+ "description": "IBIT is Blackrock's Bitcoin ETF",
899
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/blackrock.jpeg",
900
+ "AUM": {
901
+ "name": "Assets under management",
902
+ "description": "Fetches IBIT net assets (USD)",
903
+ "type": 3,
904
+ "url": "https://www.alphavantage.co/query?function=ETF_PROFILE&symbol=IBIT&apikey=V343UMWZF0715R3A",
905
+ "output": {
906
+ "yield": "float"
907
+ },
908
+ "parameters": [
909
+ {
910
+ "key": "condition",
911
+ "type": "logic_operator",
912
+ "description": "Logic operator used for the comparison: <, >, <=, >=, ==, ...",
913
+ "mandatory": true,
914
+ "category": 0
915
+ },
916
+ {
917
+ "key": "comparisonValue",
918
+ "type": "integer",
919
+ "description": "The value to compare to",
920
+ "mandatory": true,
921
+ "category": 0
922
+ },
923
+ ],
924
+ "examples": [
925
+ {
926
+ "name": "AUM above 30B$",
927
+ "description": "Gets triggered when the assets under management are above 30B$",
928
+ "parameters": [
929
+ {
930
+ "key": "condition",
931
+ "value": "gte"
932
+ },
933
+ {
934
+ "key": "comparisonValue",
935
+ "value": 30000000000
936
+ }
937
+ ]
938
+ },
939
+ {
940
+ "name": "AUM below 15B$",
941
+ "description": "Gets triggered when the assets under management are below 15B$",
942
+ "parameters": [
943
+ {
944
+ "key": "condition",
945
+ "value": "lt"
946
+ },
947
+ {
948
+ "key": "comparisonValue",
949
+ "value": 15000000000
950
+ }
951
+ ]
952
+ }
953
+ ],
954
+ "blockId": 14,
955
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/blackrock.jpeg"
956
+ }
957
+ }
797
958
  }
798
959
  };
799
960
  export const ACTIONS = {
@@ -829,7 +990,7 @@ export const ACTIONS = {
829
990
  ]
830
991
  }
831
992
  ],
832
- "blockId": 100007,
993
+ "blockId": 100010,
833
994
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/discord.png"
834
995
  },
835
996
  "WAIT_UNTIL": {
@@ -860,7 +1021,7 @@ export const ACTIONS = {
860
1021
  ]
861
1022
  }
862
1023
  ],
863
- "blockId": 100008,
1024
+ "blockId": 100011,
864
1025
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/discord.png"
865
1026
  }
866
1027
  }
@@ -1435,7 +1596,7 @@ export const ACTIONS = {
1435
1596
  "mandatory": true,
1436
1597
  "category": 0,
1437
1598
  "erc20FormattedAmount": {
1438
- "contractAddress": "{{parameters.contractAddress}}",
1599
+ "contractAddress": "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874",
1439
1600
  "chain": "{{parameters.chainId}}"
1440
1601
  }
1441
1602
  },
@@ -1467,7 +1628,7 @@ export const ACTIONS = {
1467
1628
  },
1468
1629
  {
1469
1630
  "key": "amount",
1470
- "value": "100000000000000000000n"
1631
+ "value": "100000000n"
1471
1632
  },
1472
1633
  {
1473
1634
  "key": "slippage",
@@ -1,4 +1,13 @@
1
- import { Workflow, Trigger, Action, Edge, TRIGGERS, ACTIONS, CHAINS, getTokenFromSymbol } from '../index.js';
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Workflow, Trigger, Action, Edge, TRIGGERS, ACTIONS, CHAINS, getTokenFromSymbol, convertToTokenUnitsFromSymbol } from '../index.js';
2
11
  export const WORKFLOW_TEMPLATES_TAGS = {
3
12
  NFTS: 'NFTs',
4
13
  SOCIALS: 'Socials',
@@ -28,6 +37,36 @@ const createETHFearAndGreedBuy = () => {
28
37
  const edge = new Edge({ source: trigger, target: telegramAction });
29
38
  return new Workflow('Buy ETH when the market sentiment is extremely fearful', [trigger, telegramAction], [edge]);
30
39
  };
40
+ const createSUsdeYieldBuy = () => __awaiter(void 0, void 0, void 0, function* () {
41
+ const trigger = new Trigger(TRIGGERS.YIELD.ETHENA.SUSDE_YIELD);
42
+ trigger.setCondition('gt');
43
+ trigger.setComparisonValue(20);
44
+ trigger.setPosition(400, 120);
45
+ const odosAction = new Action(ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE);
46
+ const chain = CHAINS.ETHEREUM;
47
+ odosAction.setChainId(chain);
48
+ odosAction.setParams("tokenIn", getTokenFromSymbol(chain, 'USDC').contractAddress);
49
+ odosAction.setParams("tokenOut", getTokenFromSymbol(chain, 'sUSDE').contractAddress);
50
+ odosAction.setParams("amount", yield convertToTokenUnitsFromSymbol(100, chain, 'USDC'));
51
+ odosAction.setPosition(400, 240);
52
+ const edge = new Edge({ source: trigger, target: odosAction });
53
+ return new Workflow('Buy sUSDE when the yield is above 20%', [trigger, odosAction], [edge]);
54
+ });
55
+ const createSusdeYieldShortEna = () => __awaiter(void 0, void 0, void 0, function* () {
56
+ const trigger = new Trigger(TRIGGERS.YIELD.ETHENA.SUSDE_YIELD);
57
+ trigger.setCondition('lt');
58
+ trigger.setComparisonValue(0);
59
+ trigger.setPosition(400, 120);
60
+ const odosAction = new Action(ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE);
61
+ const chain = CHAINS.ETHEREUM;
62
+ odosAction.setChainId(chain);
63
+ odosAction.setParams("tokenIn", getTokenFromSymbol(chain, 'USDC').contractAddress);
64
+ odosAction.setParams("tokenOut", getTokenFromSymbol(chain, 'sUSDE').contractAddress);
65
+ odosAction.setParams("amount", yield convertToTokenUnitsFromSymbol(100, chain, 'USDC'));
66
+ odosAction.setPosition(400, 240);
67
+ const edge = new Edge({ source: trigger, target: odosAction });
68
+ return new Workflow('Short ENA when sUSDE yield is negative', [trigger, odosAction], [edge]);
69
+ });
31
70
  export const WORKFLOW_TEMPLATES = [
32
71
  {
33
72
  'name': 'MODE transfer notification',
@@ -40,7 +79,21 @@ export const WORKFLOW_TEMPLATES = [
40
79
  'name': 'Buy ETH when the market sentiment is extremely fearful',
41
80
  'description': 'Buy ETH when the Bitcoin Fear and Greed Index is below 30',
42
81
  'tags': [WORKFLOW_TEMPLATES_TAGS.TRADING, WORKFLOW_TEMPLATES_TAGS.SOCIALS],
43
- 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/fear-and-greed-eth-buy.png',
82
+ 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/fear_and_greed.jpg',
44
83
  createWorkflow: createETHFearAndGreedBuy
45
84
  },
85
+ {
86
+ 'name': 'Buy sUSDE when the yield is above 20%',
87
+ 'description': 'Buy sUSDE when the yield is above 20%',
88
+ 'tags': [WORKFLOW_TEMPLATES_TAGS.TRADING, WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING],
89
+ 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/buySusde.jpg',
90
+ createWorkflow: createSUsdeYieldBuy
91
+ },
92
+ {
93
+ 'name': 'Short ENA when sUSDE yield is negative',
94
+ 'description': 'Short ENA when sUSDE yield is negative',
95
+ 'tags': [WORKFLOW_TEMPLATES_TAGS.TRADING, WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING],
96
+ 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/shortEna.jpg',
97
+ createWorkflow: createSusdeYieldShortEna
98
+ },
46
99
  ];
@@ -113,7 +113,15 @@ export class Node {
113
113
  return `{{nodeMap.${this.getRef()}.output.${outputKey}}}`;
114
114
  }
115
115
  getParameterVariableName(parameterKey) {
116
- return `{{nodeMap.${this.getRef()}.parameters.${parameterKey}}}`;
116
+ const parameters = this.getParameters();
117
+ if (parameters.abi && parameters.abi.parameters && parameters.abi.parameters.hasOwnProperty(parameterKey)) {
118
+ // If the key is inside abi.parameters, format accordingly
119
+ return `{{nodeMap.${this.getRef()}.parameters.abi.parameters.${parameterKey}}}`;
120
+ }
121
+ else {
122
+ // If the key is not inside abi.parameters, use the default format
123
+ return `{{nodeMap.${this.getRef()}.parameters.${parameterKey}}}`;
124
+ }
117
125
  }
118
126
  toJSON() {
119
127
  const serializeBigInt = (key, value) => {
@@ -9,7 +9,6 @@ export declare const TRIGGERS: {
9
9
  name: string;
10
10
  description: string;
11
11
  type: number;
12
- after: string;
13
12
  output: {
14
13
  value: string;
15
14
  from: string;
@@ -36,7 +35,6 @@ export declare const TRIGGERS: {
36
35
  description: string;
37
36
  type: number;
38
37
  method: string;
39
- after: string;
40
38
  output: {
41
39
  balance: string;
42
40
  };
@@ -58,6 +56,58 @@ export declare const TRIGGERS: {
58
56
  };
59
57
  };
60
58
  YIELD: {
59
+ ETHENA: {
60
+ description: string;
61
+ image: string;
62
+ SUSDE_YIELD: {
63
+ name: string;
64
+ description: string;
65
+ type: number;
66
+ url: string;
67
+ output: {
68
+ yield: string;
69
+ };
70
+ parameters: Parameter[];
71
+ examples: {
72
+ name: string;
73
+ description: string;
74
+ parameters: ({
75
+ key: string;
76
+ value: string;
77
+ } | {
78
+ key: string;
79
+ value: number;
80
+ })[];
81
+ }[];
82
+ blockId: number;
83
+ image: string;
84
+ };
85
+ TVL: {
86
+ name: string;
87
+ description: string;
88
+ type: number;
89
+ method: string;
90
+ output: {
91
+ supply: string;
92
+ };
93
+ contractAddress: string;
94
+ chainId: number;
95
+ parameters: Parameter[];
96
+ examples: {
97
+ name: string;
98
+ description: string;
99
+ parameters: ({
100
+ key: string;
101
+ value: number;
102
+ } | {
103
+ key: string;
104
+ value: string;
105
+ })[];
106
+ }[];
107
+ blockId: number;
108
+ image: string;
109
+ };
110
+ };
61
111
  SPLICE_FI: {
62
112
  description: string;
63
113
  chains: number[];
@@ -67,7 +117,6 @@ export declare const TRIGGERS: {
67
117
  description: string;
68
118
  type: number;
69
119
  contractAddress: string;
70
- after: string;
71
120
  output: {
72
121
  caller: string;
73
122
  market: string;
@@ -86,7 +135,6 @@ export declare const TRIGGERS: {
86
135
  description: string;
87
136
  type: number;
88
137
  contractAddress: string;
89
- after: string;
90
138
  output: {
91
139
  caller: string;
92
140
  market: string;
@@ -106,7 +154,6 @@ export declare const TRIGGERS: {
106
154
  description: string;
107
155
  type: number;
108
156
  contractAddress: string;
109
- after: string;
110
157
  output: {
111
158
  market: string;
112
159
  PT: string;
@@ -125,7 +172,6 @@ export declare const TRIGGERS: {
125
172
  description: string;
126
173
  type: number;
127
174
  contractAddress: string;
128
- after: string;
129
175
  output: {
130
176
  timestamp: string;
131
177
  lastLnImpliedRate: string;
@@ -217,7 +263,6 @@ export declare const TRIGGERS: {
217
263
  description: string;
218
264
  type: number;
219
265
  contractAddress: string;
220
- after: string;
221
266
  output: {
222
267
  id: string;
223
268
  owner: string;
@@ -239,7 +284,6 @@ export declare const TRIGGERS: {
239
284
  description: string;
240
285
  type: number;
241
286
  url: string;
242
- after: string;
243
287
  output: {
244
288
  value: string;
245
289
  };
@@ -289,6 +333,35 @@ export declare const TRIGGERS: {
289
333
  };
290
334
  };
291
335
  };
336
+ ETFS: {
337
+ IBIT: {
338
+ description: string;
339
+ image: string;
340
+ AUM: {
341
+ name: string;
342
+ description: string;
343
+ type: number;
344
+ url: string;
345
+ output: {
346
+ yield: string;
347
+ };
348
+ parameters: Parameter[];
349
+ examples: {
350
+ name: string;
351
+ description: string;
352
+ parameters: ({
353
+ key: string;
354
+ value: string;
355
+ } | {
356
+ key: string;
357
+ value: number;
358
+ })[];
359
+ }[];
360
+ blockId: number;
361
+ image: string;
362
+ };
363
+ };
364
+ };
292
365
  };
293
366
  export declare const ACTIONS: {
294
367
  CORE: {
@@ -5,10 +5,16 @@ export declare const WORKFLOW_TEMPLATES_TAGS: {
5
5
  TRADING: string;
6
6
  ON_CHAIN_MONITORING: string;
7
7
  };
8
- export declare const WORKFLOW_TEMPLATES: {
8
+ export declare const WORKFLOW_TEMPLATES: ({
9
9
  name: string;
10
10
  description: string;
11
11
  tags: string[];
12
12
  thumbnail: string;
13
13
  createWorkflow: () => Workflow;
14
- }[];
14
+ } | {
15
+ name: string;
16
+ description: string;
17
+ tags: string[];
18
+ thumbnail: string;
19
+ createWorkflow: () => Promise<Workflow>;
20
+ })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "1.5.26",
3
+ "version": "1.5.28",
4
4
  "description": "An SDK for building and managing automations on Otomato",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/types/src/index.d.ts",