otomato-sdk 1.5.13 → 1.5.15

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.
@@ -47,37 +47,37 @@ export const TRIGGERS = {
47
47
  "description": "Fetches the balance of an ERC20 and checks it against the specified condition.",
48
48
  "type": 1,
49
49
  "method": "function balanceOf(address account) view returns (uint256)",
50
- "handler": "output => { const params=JSON.parse(output);const balance = BigInt(params)/1000000n; return Number(balance); }",
50
+ "handler": "output => { const params=JSON.parse(output);const balance = BigInt(params)/1000000n; return {balance: Number(balance)}; }",
51
51
  "parameters": [
52
52
  {
53
53
  "key": "chainId",
54
54
  "type": "chainId",
55
- "description": "Chain ID of the ETH blockchain"
55
+ "description": "Chain ID of the ETH blockchain",
56
+ "mandatory": true
56
57
  },
57
58
  {
58
59
  "key": "abiParams.account",
59
60
  "type": "address",
60
- "description": "Amount of crypto to transfer"
61
+ "description": "Amount of crypto to transfer",
62
+ "mandatory": true
61
63
  },
62
64
  {
63
65
  "key": "contractAddress",
64
66
  "type": "address",
65
- "description": "The contract address of the ERC20"
67
+ "description": "The contract address of the ERC20",
68
+ "mandatory": true
66
69
  },
67
70
  {
68
71
  "key": "condition",
69
72
  "type": "logic_operator",
70
- "description": "Logic operator used for the comparison: <, >, <=, >=, ==, ..."
73
+ "description": "Logic operator used for the comparison: <, >, <=, >=, ==, ...",
74
+ "mandatory": true
71
75
  },
72
76
  {
73
77
  "key": "comparisonValue",
74
78
  "type": "any",
75
- "description": "The value to compare to"
76
- },
77
- {
78
- "key": "interval",
79
- "type": "integer",
80
- "description": "The waiting time between each polling"
79
+ "description": "The value to compare to",
80
+ "mandatory": true
81
81
  },
82
82
  ],
83
83
  "blockId": 5,
@@ -220,8 +220,8 @@ export const TRIGGERS = {
220
220
  },
221
221
  {
222
222
  "key": "contractAddress",
223
- "type": "address",
224
- "description": "Contract address to monitor",
223
+ "type": "erc20",
224
+ "description": "Token to monitor",
225
225
  "mandatory": true,
226
226
  "enum": [
227
227
  "0xDE95511418EBD8Bd36294B11C86314DdFA50e212",
@@ -316,6 +316,38 @@ export const TRIGGERS = {
316
316
  "description": "Output token address"
317
317
  },
318
318
  ],
319
+ "templates": [
320
+ {
321
+ "name": "Any Odos swap",
322
+ "description": "Gets triggered when someone does a swap on Mode using Odos",
323
+ "parameters": [
324
+ {
325
+ "key": "chainId",
326
+ "value": 34443
327
+ }
328
+ ]
329
+ },
330
+ {
331
+ "name": "Sell ETH",
332
+ "description": "Gets triggered when someone sells ETH on Mode using Odos",
333
+ "parameters": [
334
+ {
335
+ "key": "chainId",
336
+ "value": 34443
337
+ },
338
+ {
339
+ "key": "abiParams.inputToken",
340
+ "value": {
341
+ "contractAddress": "0x4200000000000000000000000000000000000006",
342
+ "symbol": "WETH",
343
+ "name": "Wrapped Ether",
344
+ "decimals": 18,
345
+ "image": "https://static.debank.com/image/mtr_token/logo_url/0x79a61d3a28f8c8537a3df63092927cfa1150fb3c/61844453e63cf81301f845d7864236f6.png"
346
+ }
347
+ }
348
+ ]
349
+ }
350
+ ],
319
351
  "blockId": 4,
320
352
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.jpg"
321
353
  }
@@ -363,17 +395,19 @@ export const TRIGGERS = {
363
395
  "description": "Fetches the Fear and Greed Index from the specified API and processes the result.",
364
396
  "type": 3,
365
397
  "url": "https://api.alternative.me/fng/",
366
- "handler": "async (res) => { return res.data?.[0]?.value }",
398
+ "handler": "async (res) => { return {value: res.data?.[0]?.value} }",
367
399
  "parameters": [
368
400
  {
369
401
  "key": "condition",
370
402
  "type": "logic_operator",
371
- "description": "Logic operator used for the comparison: <, >, <=, >=, ==, ..."
403
+ "description": "Logic operator used for the comparison: <, >, <=, >=, ==, ...",
404
+ "mandatory": true
372
405
  },
373
406
  {
374
407
  "key": "comparisonValue",
375
408
  "type": "integer",
376
- "description": "The value to compare to"
409
+ "description": "The value to compare to",
410
+ "mandatory": true
377
411
  },
378
412
  ],
379
413
  "blockId": 11,
@@ -396,12 +430,14 @@ export const TRIGGERS = {
396
430
  {
397
431
  "key": "chainId",
398
432
  "type": "chainId",
399
- "description": "Chain ID of the blockchain to monitor"
433
+ "description": "Chain ID of the blockchain to monitor",
434
+ "mandatory": true
400
435
  },
401
436
  {
402
437
  "key": "comparisonValue",
403
438
  "type": "float",
404
- "description": "The price to compare against"
439
+ "description": "The price to compare against",
440
+ "mandatory": true
405
441
  },
406
442
  {
407
443
  "key": "currency",
@@ -409,17 +445,20 @@ export const TRIGGERS = {
409
445
  "description": "The currency in which the comparison price is denominated",
410
446
  "enum": [
411
447
  "USD"
412
- ]
448
+ ],
449
+ "mandatory": true
413
450
  },
414
451
  {
415
452
  "key": "condition",
416
453
  "type": "logic_operator",
417
- "description": "The logic operator used for the comparison (e.g., >, <, >=, <=, ==, !=)"
454
+ "description": "The logic operator used for the comparison (e.g., >, <, >=, <=, ==, !=)",
455
+ "mandatory": true
418
456
  },
419
457
  {
420
458
  "key": "contractAddress",
421
459
  "type": "erc20",
422
- "description": "The asset that you want to track"
460
+ "description": "The asset that you want to track",
461
+ "mandatory": true
423
462
  },
424
463
  ],
425
464
  "blockId": 10,
@@ -441,12 +480,15 @@ export const ACTIONS = {
441
480
  {
442
481
  "key": "webhook",
443
482
  "type": "url",
444
- "description": "The webhook URL for the Slack channel"
483
+ "description": "The webhook URL for the Slack channel (e.g https://hooks.slack.com/services/T087SUVQ0DA/B07DEEGF9PK/FKkRaqagLR)",
484
+ "mandatory": true,
485
+ "private": true
445
486
  },
446
487
  {
447
488
  "key": "message",
448
489
  "type": "paragraph",
449
- "description": "The text content to send"
490
+ "description": "The text content to send",
491
+ "mandatory": true
450
492
  },
451
493
  ],
452
494
  "blockId": 100002,
@@ -464,12 +506,15 @@ export const ACTIONS = {
464
506
  {
465
507
  "key": "webhook",
466
508
  "type": "url",
467
- "description": "The webhook URL for the Discord channel"
509
+ "description": "The webhook URL for the Discord channel",
510
+ "mandatory": true,
511
+ "private": true
468
512
  },
469
513
  {
470
514
  "key": "message",
471
515
  "type": "paragraph",
472
- "description": "The text content to send"
516
+ "description": "The text content to send",
517
+ "mandatory": true
473
518
  },
474
519
  ],
475
520
  "blockId": 100003,
@@ -487,12 +532,15 @@ export const ACTIONS = {
487
532
  {
488
533
  "key": "webhook",
489
534
  "type": "url",
490
- "description": "The webhook URL for the Telegram bot"
535
+ "description": "The webhook URL for the Telegram bot",
536
+ "mandatory": true,
537
+ "private": true
491
538
  },
492
539
  {
493
540
  "key": "message",
494
541
  "type": "paragraph",
495
- "description": "The text content to send"
542
+ "description": "The text content to send",
543
+ "mandatory": true
496
544
  },
497
545
  ],
498
546
  "blockId": 100001,
@@ -511,43 +559,177 @@ export const ACTIONS = {
511
559
  "name": "Transfer token",
512
560
  "description": "Transfers an ERC20 token",
513
561
  "type": 1,
514
- "method": "Transfer(address from, address to, uint256 value)",
562
+ "method": "function transfer(address from, address to, uint256 value)",
515
563
  "parameters": [
516
564
  {
517
565
  "key": "chainId",
518
566
  "type": "chainId",
519
- "description": "Chain ID of the network"
567
+ "description": "Chain ID of the network",
568
+ "mandatory": true
520
569
  },
521
570
  {
522
571
  "key": "abiParams.value",
523
572
  "type": "uint256",
524
- "description": "Amount of crypto to transfer"
573
+ "description": "Amount of crypto to transfer",
574
+ "mandatory": true
525
575
  },
526
576
  {
527
577
  "key": "abiParams.to",
528
578
  "type": "address",
529
- "description": "Address to transfer crypto to"
579
+ "description": "Address to transfer crypto to",
580
+ "mandatory": true
530
581
  },
531
582
  {
532
583
  "key": "contractAddress",
533
584
  "type": "erc20",
534
- "description": "The contract address of the ERC20"
585
+ "description": "The contract address of the ERC20",
586
+ "mandatory": true
535
587
  },
536
588
  ],
537
589
  "permissions": {
538
590
  "approvedTargets": [
539
- "$contractAddress"
591
+ "$parameters.contractAddress"
540
592
  ],
541
593
  "label": [
542
- "Transfer $tokenSymbol($chainId, $contractAddress)"
594
+ "Transfer $tokenSymbol($parameters.chainId, $parameters.contractAddress)"
543
595
  ],
544
596
  "labelNotAuthorized": [
545
- "Transfer $otherTokenSymbol($chainId, $contractAddress)"
597
+ "Transfer $otherTokenSymbol($parameters.chainId, $parameters.contractAddress)"
546
598
  ]
547
599
  },
548
600
  "blockId": 100004,
549
601
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/ethereum.webp"
550
602
  }
551
603
  }
604
+ },
605
+ "LENDING": {
606
+ "IONIC": {
607
+ "description": "#1 money market for Yield Bearing Assets on the OP Superchain",
608
+ "chains": [
609
+ 34443
610
+ ],
611
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/ionic.jpg",
612
+ "DEPOSIT": {
613
+ "name": "Lend asset",
614
+ "description": "Deposit token in any Ionic lending pool",
615
+ "type": 1,
616
+ "method": "function mint(uint256 mintAmount) public returns (uint256)",
617
+ "parameters": [
618
+ {
619
+ "key": "chainId",
620
+ "type": "chainId",
621
+ "description": "Chain ID of the network",
622
+ "mandatory": true
623
+ },
624
+ {
625
+ "key": "abiParams.mintAmount",
626
+ "type": "uint256",
627
+ "description": "Amount of crypto to deposit",
628
+ "mandatory": true
629
+ },
630
+ {
631
+ "key": "contractAddress",
632
+ "type": "erc20",
633
+ "description": "The token to deposit",
634
+ "mandatory": true,
635
+ "enum": [
636
+ "0xf0F161fDA2712DB8b566946122a5af183995e2eD",
637
+ "0xd988097fb8612cc24eeC14542bC03424c656005f",
638
+ "0x4200000000000000000000000000000000000006",
639
+ "0x2416092f143378750bb29b79eD961ab195CcEea5"
640
+ ]
641
+ },
642
+ ],
643
+ "requiredApprovals": [
644
+ {
645
+ "address": "$parameters.contractAddress",
646
+ "amount": "$parameters.mintAmount",
647
+ "to": "$before.ionicTokenContractAddress"
648
+ }
649
+ ],
650
+ "permissions": {
651
+ "approvedTargets": [
652
+ "$before.ionicTokenContractAddress"
653
+ ],
654
+ "label": [
655
+ "Transfer $tokenSymbol($parameters.chainId, $parameters.contractAddress)"
656
+ ],
657
+ "labelNotAuthorized": [
658
+ "Transfer $otherTokenSymbol($parameters.chainId, $parameters.contractAddress)"
659
+ ]
660
+ },
661
+ "blockId": 100006,
662
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/ionic.jpg"
663
+ }
664
+ }
665
+ },
666
+ "SWAP": {
667
+ "ODOS": {
668
+ "description": "Smart Order Routing across multiple blockchain protocols, 700+ Liquidity Sources and thousands of token pairs, delivering ultimate savings to users",
669
+ "chains": [
670
+ 34443
671
+ ],
672
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.jpg",
673
+ "SWAP": {
674
+ "name": "Odos swap",
675
+ "description": "Swap on Odos to get the best market rates accross multiple pools",
676
+ "type": 1,
677
+ "contractAddress": "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874",
678
+ "requiredApprovals": [
679
+ {
680
+ "address": "$parameters.tokenIn",
681
+ "amount": "$parameters.value",
682
+ "to": "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874"
683
+ }
684
+ ],
685
+ "parameters": [
686
+ {
687
+ "key": "chainId",
688
+ "type": "chainId",
689
+ "description": "Chain ID of the network",
690
+ "mandatory": true
691
+ },
692
+ {
693
+ "key": "tokenIn",
694
+ "type": "erc20",
695
+ "description": "Token to sell",
696
+ "mandatory": true
697
+ },
698
+ {
699
+ "key": "tokenOut",
700
+ "type": "erc20",
701
+ "description": "Token to buy",
702
+ "mandatory": true
703
+ },
704
+ {
705
+ "key": "amount",
706
+ "type": "uint256",
707
+ "description": "Amount to sell",
708
+ "mandatory": true
709
+ },
710
+ {
711
+ "key": "slippage",
712
+ "type": "percentage",
713
+ "description": "The maximum allowable difference between the expected price and the actual price at the time of execution, expressed as a percentage. This protects the transaction from significant price fluctuations.",
714
+ "value": 0.3,
715
+ "mandatory": true
716
+ },
717
+ ],
718
+ "permissions": {
719
+ "approvedTargets": [
720
+ "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874",
721
+ "$parameters.tokenIn"
722
+ ],
723
+ "label": [
724
+ "Swap $tokenSymbol($parameters.chainId, $parameters.tokenIn) to $tokenSymbol($parameters.chainId, $parameters.tokenOut)"
725
+ ],
726
+ "labelNotAuthorized": [
727
+ "Transfer ETH"
728
+ ]
729
+ },
730
+ "blockId": 100005,
731
+ "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.jpg"
732
+ }
733
+ }
552
734
  }
553
735
  };
@@ -21,7 +21,9 @@ export class Action extends Node {
21
21
  return null;
22
22
  const permissions = SessionKeyPermission.fromJSON(parentBlock.permissions);
23
23
  permissions.fill('contractAddress', this.getParameter('contractAddress'));
24
+ permissions.fill('parameters.contractAddress', this.getParameter('contractAddress'));
24
25
  permissions.fill('chainId', this.getParameter('chainId'));
26
+ permissions.fill('parameters.chainId', this.getParameter('chainId'));
25
27
  permissions.fillMethod();
26
28
  return permissions;
27
29
  }
@@ -95,6 +95,23 @@ export declare const TRIGGERS: {
95
95
  type: number;
96
96
  contractAddress: string;
97
97
  parameters: Parameter[];
98
+ templates: {
99
+ name: string;
100
+ description: string;
101
+ parameters: ({
102
+ key: string;
103
+ value: number;
104
+ } | {
105
+ key: string;
106
+ value: {
107
+ contractAddress: string;
108
+ symbol: string;
109
+ name: string;
110
+ decimals: number;
111
+ image: string;
112
+ };
113
+ })[];
114
+ }[];
98
115
  blockId: number;
99
116
  image: string;
100
117
  };
@@ -207,4 +224,56 @@ export declare const ACTIONS: {
207
224
  };
208
225
  };
209
226
  };
227
+ LENDING: {
228
+ IONIC: {
229
+ description: string;
230
+ chains: number[];
231
+ image: string;
232
+ DEPOSIT: {
233
+ name: string;
234
+ description: string;
235
+ type: number;
236
+ method: string;
237
+ parameters: Parameter[];
238
+ requiredApprovals: {
239
+ address: string;
240
+ amount: string;
241
+ to: string;
242
+ }[];
243
+ permissions: {
244
+ approvedTargets: string[];
245
+ label: string[];
246
+ labelNotAuthorized: string[];
247
+ };
248
+ blockId: number;
249
+ image: string;
250
+ };
251
+ };
252
+ };
253
+ SWAP: {
254
+ ODOS: {
255
+ description: string;
256
+ chains: number[];
257
+ image: string;
258
+ SWAP: {
259
+ name: string;
260
+ description: string;
261
+ type: number;
262
+ contractAddress: string;
263
+ requiredApprovals: {
264
+ address: string;
265
+ amount: string;
266
+ to: string;
267
+ }[];
268
+ parameters: Parameter[];
269
+ permissions: {
270
+ approvedTargets: string[];
271
+ label: string[];
272
+ labelNotAuthorized: string[];
273
+ };
274
+ blockId: number;
275
+ image: string;
276
+ };
277
+ };
278
+ };
210
279
  };
@@ -3,4 +3,5 @@ export interface Parameter {
3
3
  type: string;
4
4
  description: string;
5
5
  value?: any;
6
+ mandatory?: boolean;
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "1.5.13",
3
+ "version": "1.5.15",
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",
@@ -32,6 +32,7 @@
32
32
  "@types/chai": "^4.3.16",
33
33
  "@types/jsonwebtoken": "^9.0.6",
34
34
  "@types/mocha": "^10.0.6",
35
+ "@types/mustache": "^4.2.5",
35
36
  "@types/node": "^20.14.2",
36
37
  "chai": "^5.1.1",
37
38
  "mocha": "^10.4.0",
@@ -41,6 +42,7 @@
41
42
  "dependencies": {
42
43
  "axios": "^1.7.2",
43
44
  "ethers": "^6.13.1",
44
- "jsonwebtoken": "^9.0.2"
45
+ "jsonwebtoken": "^9.0.2",
46
+ "mustache": "^4.2.0"
45
47
  }
46
48
  }