otomato-sdk 1.5.16 → 1.5.18

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,11 +10,17 @@ 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
+ "output": {
14
+ "value": "uint256",
15
+ "from": "address",
16
+ "to": "address",
17
+ "transactionHash": "string"
18
+ },
13
19
  "parameters": [
14
20
  {
15
21
  "key": "chainId",
16
22
  "type": "chainId",
17
- "description": "Chain ID of the ETH blockchain",
23
+ "description": "Chain ID of the EVM blockchain",
18
24
  "mandatory": true
19
25
  },
20
26
  {
@@ -39,6 +45,22 @@ export const TRIGGERS = {
39
45
  "mandatory": true
40
46
  },
41
47
  ],
48
+ "examples": [
49
+ {
50
+ "name": "Mode transfer",
51
+ "description": "Gets triggered when someone transfers MODE",
52
+ "parameters": [
53
+ {
54
+ "key": "chainId",
55
+ "value": 34443
56
+ },
57
+ {
58
+ "key": "contractAddress",
59
+ "value": "0xDfc7C877a950e49D2610114102175A06C2e3167a"
60
+ }
61
+ ]
62
+ }
63
+ ],
42
64
  "blockId": 1,
43
65
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/ethereum.webp"
44
66
  },
@@ -48,11 +70,14 @@ export const TRIGGERS = {
48
70
  "type": 1,
49
71
  "method": "function balanceOf(address account) view returns (uint256)",
50
72
  "handler": "output => { const params=JSON.parse(output);const balance = BigInt(params)/1000000n; return {balance: Number(balance)}; }",
73
+ "output": {
74
+ "balance": "integer"
75
+ },
51
76
  "parameters": [
52
77
  {
53
78
  "key": "chainId",
54
79
  "type": "chainId",
55
- "description": "Chain ID of the ETH blockchain",
80
+ "description": "Chain ID of the EVM blockchain",
56
81
  "mandatory": true
57
82
  },
58
83
  {
@@ -80,6 +105,34 @@ export const TRIGGERS = {
80
105
  "mandatory": true
81
106
  },
82
107
  ],
108
+ "examples": [
109
+ {
110
+ "name": "Mode balance check",
111
+ "description": "Gets triggered when the MODE balance of vitalik.eth falls below 10,000",
112
+ "parameters": [
113
+ {
114
+ "key": "chainId",
115
+ "value": 34443
116
+ },
117
+ {
118
+ "key": "comparisonValue",
119
+ "value": 10000
120
+ },
121
+ {
122
+ "key": "condition",
123
+ "value": "lt"
124
+ },
125
+ {
126
+ "key": "contractAddress",
127
+ "value": "0xDfc7C877a950e49D2610114102175A06C2e3167a"
128
+ },
129
+ {
130
+ "key": "abiParams.account",
131
+ "value": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
132
+ }
133
+ ]
134
+ }
135
+ ],
83
136
  "blockId": 5,
84
137
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/ethereum.webp"
85
138
  }
@@ -97,6 +150,14 @@ export const TRIGGERS = {
97
150
  "description": "Swap in Splice Finance",
98
151
  "type": 0,
99
152
  "contractAddress": "0x7A3a94AE0fC1421A3eac23eA6371036ac8d8f448",
153
+ "output": {
154
+ "caller": "address",
155
+ "market": "address",
156
+ "receiver": "address",
157
+ "netPtToAccount": "int256",
158
+ "netSyToAccount": "int256",
159
+ "transactionHash": "string"
160
+ },
100
161
  "parameters": [
101
162
  {
102
163
  "key": "abiParams.caller",
@@ -132,6 +193,15 @@ export const TRIGGERS = {
132
193
  "description": "Liquidity removed in Splice Finance",
133
194
  "type": 0,
134
195
  "contractAddress": "0x7A3a94AE0fC1421A3eac23eA6371036ac8d8f448",
196
+ "output": {
197
+ "caller": "address",
198
+ "market": "address",
199
+ "receiver": "address",
200
+ "netLpToRemove": "uint256",
201
+ "netPtOut": "uint256",
202
+ "netSyOut": "uint256",
203
+ "transactionHash": "string"
204
+ },
135
205
  "parameters": [
136
206
  {
137
207
  "key": "abiParams.caller",
@@ -172,6 +242,14 @@ export const TRIGGERS = {
172
242
  "description": "Market creation in Splice Finance",
173
243
  "type": 0,
174
244
  "contractAddress": "0x7A3a94AE0fC1421A3eac23eA6371036ac8d8f448",
245
+ "output": {
246
+ "market": "address",
247
+ "PT": "erc20",
248
+ "scalarRoot": "int256",
249
+ "initialAnchor": "int256",
250
+ "lnFeeRateRoot": "uint256",
251
+ "transactionHash": "string"
252
+ },
175
253
  "parameters": [
176
254
  {
177
255
  "key": "abiParams.market",
@@ -207,6 +285,11 @@ export const TRIGGERS = {
207
285
  "description": "Interest rate update in Splice Finance",
208
286
  "type": 0,
209
287
  "contractAddress": "0x7A3a94AE0fC1421A3eac23eA6371036ac8d8f448",
288
+ "output": {
289
+ "timestamp": "uint256",
290
+ "lastLnImpliedRate": "int256",
291
+ "transactionHash": "string"
292
+ },
210
293
  "parameters": [
211
294
  {
212
295
  "key": "abiParams.timestamp",
@@ -248,7 +331,19 @@ export const TRIGGERS = {
248
331
  "description": "Lend recalled in Astaria",
249
332
  "type": 0,
250
333
  "contractAddress": "0x34cf9BF641bd5f34197060A3f3478a1f97f78f0a",
334
+ "output": {
335
+ "loanId": "uint256",
336
+ "recaller": "address",
337
+ "end": "uint256",
338
+ "transactionHash": "string"
339
+ },
251
340
  "parameters": [
341
+ {
342
+ "key": "chainId",
343
+ "type": "chainId",
344
+ "description": "Chain ID of the EVM blockchain",
345
+ "mandatory": true
346
+ },
252
347
  {
253
348
  "key": "abiParams.loanId",
254
349
  "type": "uint256",
@@ -265,6 +360,46 @@ export const TRIGGERS = {
265
360
  "description": "End time"
266
361
  },
267
362
  ],
363
+ "examples": [
364
+ {
365
+ "name": "Any loan recalled",
366
+ "description": "Gets triggered when a loan is recalled on Mode",
367
+ "parameters": [
368
+ {
369
+ "key": "chainId",
370
+ "value": 34443
371
+ }
372
+ ]
373
+ },
374
+ {
375
+ "name": "A specific loan recalled",
376
+ "description": "Gets triggered when loan #123 is recalled",
377
+ "parameters": [
378
+ {
379
+ "key": "chainId",
380
+ "value": 34443
381
+ },
382
+ {
383
+ "key": "abiParams.loanId",
384
+ "value": 123
385
+ }
386
+ ]
387
+ },
388
+ {
389
+ "name": "Recalled by specific address",
390
+ "description": "Gets triggered when vitalik.eth recalls a loan",
391
+ "parameters": [
392
+ {
393
+ "key": "chainId",
394
+ "value": 34443
395
+ },
396
+ {
397
+ "key": "abiParams.recaller",
398
+ "value": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
399
+ }
400
+ ]
401
+ }
402
+ ],
268
403
  "blockId": 8,
269
404
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/astaria.png"
270
405
  }
@@ -283,11 +418,20 @@ export const TRIGGERS = {
283
418
  "description": "Swap on Odos",
284
419
  "type": 0,
285
420
  "contractAddress": "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874",
421
+ "output": {
422
+ "sender": "address",
423
+ "inputAmount": "uint256",
424
+ "inputToken": "erc20",
425
+ "amountOut": "uint256",
426
+ "outputToken": "erc20",
427
+ "exchangeRate": "float",
428
+ "transactionHash": "string"
429
+ },
286
430
  "parameters": [
287
431
  {
288
432
  "key": "chainId",
289
433
  "type": "chainId",
290
- "description": "Chain ID of the ETH blockchain",
434
+ "description": "Chain ID of the EVM blockchain",
291
435
  "mandatory": true
292
436
  },
293
437
  {
@@ -316,7 +460,7 @@ export const TRIGGERS = {
316
460
  "description": "Output token address"
317
461
  },
318
462
  ],
319
- "templates": [
463
+ "examples": [
320
464
  {
321
465
  "name": "Any Odos swap",
322
466
  "description": "Gets triggered when someone does a swap on Mode using Odos",
@@ -365,6 +509,12 @@ export const TRIGGERS = {
365
509
  "description": "Name registered in Mode Name Service",
366
510
  "type": 0,
367
511
  "contractAddress": "0x2aD86eeEC513AC16804bb05310214C3Fd496835B",
512
+ "output": {
513
+ "id": "uint256",
514
+ "owner": "address",
515
+ "expires": "uint256",
516
+ "transactionHash": "string"
517
+ },
368
518
  "parameters": [
369
519
  {
370
520
  "key": "abiParams.id",
@@ -382,6 +532,7 @@ export const TRIGGERS = {
382
532
  "description": "Expiration time"
383
533
  },
384
534
  ],
535
+ "examples": [],
385
536
  "blockId": 3,
386
537
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/modens.png"
387
538
  }
@@ -396,6 +547,9 @@ export const TRIGGERS = {
396
547
  "type": 3,
397
548
  "url": "https://api.alternative.me/fng/",
398
549
  "handler": "async (res) => { return {value: res.data?.[0]?.value} }",
550
+ "output": {
551
+ "value": "integer"
552
+ },
399
553
  "parameters": [
400
554
  {
401
555
  "key": "condition",
@@ -410,6 +564,36 @@ export const TRIGGERS = {
410
564
  "mandatory": true
411
565
  },
412
566
  ],
567
+ "examples": [
568
+ {
569
+ "name": "Market in extreme fear",
570
+ "description": "Gets triggered when the index is below 20",
571
+ "parameters": [
572
+ {
573
+ "key": "condition",
574
+ "value": "lte"
575
+ },
576
+ {
577
+ "key": "comparisonValue",
578
+ "value": 20
579
+ }
580
+ ]
581
+ },
582
+ {
583
+ "name": "Market in greed",
584
+ "description": "Gets triggered when the index is above 65",
585
+ "parameters": [
586
+ {
587
+ "key": "condition",
588
+ "value": "gte"
589
+ },
590
+ {
591
+ "key": "comparisonValue",
592
+ "value": 65
593
+ }
594
+ ]
595
+ }
596
+ ],
413
597
  "blockId": 11,
414
598
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/modens.png"
415
599
  }
@@ -426,6 +610,9 @@ export const TRIGGERS = {
426
610
  "name": "On-Chain Price Movement Against Fiat Currency",
427
611
  "description": "This trigger activates when the on-chain price of an asset moves against a specified currency based on the given condition.",
428
612
  "type": 2,
613
+ "output": {
614
+ "price": "float"
615
+ },
429
616
  "parameters": [
430
617
  {
431
618
  "key": "chainId",
@@ -461,6 +648,86 @@ export const TRIGGERS = {
461
648
  "mandatory": true
462
649
  },
463
650
  ],
651
+ "examples": [
652
+ {
653
+ "name": "ETH > 2850$",
654
+ "description": "Gets triggered when ETH rises above 2850$ on Mode",
655
+ "parameters": [
656
+ {
657
+ "key": "chainId",
658
+ "value": 34443
659
+ },
660
+ {
661
+ "key": "comparisonValue",
662
+ "value": 2850
663
+ },
664
+ {
665
+ "key": "currency",
666
+ "value": "USD"
667
+ },
668
+ {
669
+ "key": "condition",
670
+ "value": "gt"
671
+ },
672
+ {
673
+ "key": "contractAddress",
674
+ "value": "0x0000000000000000000000000000000000000000"
675
+ }
676
+ ]
677
+ },
678
+ {
679
+ "name": "ETH < 2100$",
680
+ "description": "Gets triggered when ETH falls below 2100$ on Mode",
681
+ "parameters": [
682
+ {
683
+ "key": "chainId",
684
+ "value": 34443
685
+ },
686
+ {
687
+ "key": "comparisonValue",
688
+ "value": 2100
689
+ },
690
+ {
691
+ "key": "currency",
692
+ "value": "USD"
693
+ },
694
+ {
695
+ "key": "condition",
696
+ "value": "lt"
697
+ },
698
+ {
699
+ "key": "contractAddress",
700
+ "value": "0x0000000000000000000000000000000000000000"
701
+ }
702
+ ]
703
+ },
704
+ {
705
+ "name": "MODE < 0.01$",
706
+ "description": "Gets triggered when MODE falls below 0.01$ on Mode Network",
707
+ "parameters": [
708
+ {
709
+ "key": "chainId",
710
+ "value": 34443
711
+ },
712
+ {
713
+ "key": "comparisonValue",
714
+ "value": 0.01
715
+ },
716
+ {
717
+ "key": "currency",
718
+ "value": "USD"
719
+ },
720
+ {
721
+ "key": "condition",
722
+ "value": "lt"
723
+ },
724
+ {
725
+ "key": "contractAddress",
726
+ "value": "0xDfc7C877a950e49D2610114102175A06C2e3167a"
727
+ }
728
+ ]
729
+ }
730
+ ],
464
731
  "blockId": 10,
465
732
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/trend-up.png"
466
733
  }
@@ -476,6 +743,9 @@ export const ACTIONS = {
476
743
  "name": "Send message",
477
744
  "type": 0,
478
745
  "description": "Notifies you by sending a Slack message to the channel of your choice",
746
+ "output": {
747
+ "message": "string"
748
+ },
479
749
  "parameters": [
480
750
  {
481
751
  "key": "webhook",
@@ -491,6 +761,12 @@ export const ACTIONS = {
491
761
  "mandatory": true
492
762
  },
493
763
  ],
764
+ "template": {
765
+ "url": "{{webhook}}",
766
+ "body": {
767
+ "text": "{{message}}"
768
+ }
769
+ },
494
770
  "blockId": 100002,
495
771
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/slack.png"
496
772
  }
@@ -502,6 +778,9 @@ export const ACTIONS = {
502
778
  "name": "Send message",
503
779
  "type": 0,
504
780
  "description": "Notifies you by sending a Discord message to the channel of your choice",
781
+ "output": {
782
+ "message": "string"
783
+ },
505
784
  "parameters": [
506
785
  {
507
786
  "key": "webhook",
@@ -517,6 +796,12 @@ export const ACTIONS = {
517
796
  "mandatory": true
518
797
  },
519
798
  ],
799
+ "template": {
800
+ "url": "{{webhook}}",
801
+ "body": {
802
+ "content": "{{message}}"
803
+ }
804
+ },
520
805
  "blockId": 100003,
521
806
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/discord.png"
522
807
  }
@@ -528,6 +813,9 @@ export const ACTIONS = {
528
813
  "name": "Send message",
529
814
  "type": 0,
530
815
  "description": "Notifies you by sending a Telegram message to the chat of your choice",
816
+ "output": {
817
+ "message": "string"
818
+ },
531
819
  "parameters": [
532
820
  {
533
821
  "key": "webhook",
@@ -542,7 +830,21 @@ export const ACTIONS = {
542
830
  "description": "The text content to send",
543
831
  "mandatory": true
544
832
  },
833
+ {
834
+ "key": "chat_id",
835
+ "type": "string",
836
+ "description": "Channel id",
837
+ "mandatory": true,
838
+ "private": true
839
+ },
545
840
  ],
841
+ "template": {
842
+ "url": "{{webhook}}",
843
+ "body": {
844
+ "chat_id": "{{chat_id}}",
845
+ "text": "{{message}}"
846
+ }
847
+ },
546
848
  "blockId": 100001,
547
849
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/telegram.jpeg"
548
850
  }
@@ -560,6 +862,9 @@ export const ACTIONS = {
560
862
  "description": "Transfers an ERC20 token",
561
863
  "type": 1,
562
864
  "method": "function transfer(address from, address to, uint256 value)",
865
+ "output": {
866
+ "transactionHash": "string"
867
+ },
563
868
  "parameters": [
564
869
  {
565
870
  "key": "chainId",
@@ -588,13 +893,13 @@ export const ACTIONS = {
588
893
  ],
589
894
  "permissions": {
590
895
  "approvedTargets": [
591
- "$parameters.contractAddress"
896
+ "{{parameters.contractAddress}}"
592
897
  ],
593
898
  "label": [
594
- "Transfer $tokenSymbol($parameters.chainId, $parameters.contractAddress)"
899
+ "Transfer {{tokenSymbol({{parameters.chainId}}, {{parameters.contractAddress}})}}"
595
900
  ],
596
901
  "labelNotAuthorized": [
597
- "Transfer $otherTokenSymbol($parameters.chainId, $parameters.contractAddress)"
902
+ "Transfer {{otherTokenSymbol({{parameters.chainId}}, {{parameters.contractAddress}})}}"
598
903
  ]
599
904
  },
600
905
  "blockId": 100004,
@@ -642,20 +947,23 @@ export const ACTIONS = {
642
947
  ],
643
948
  "requiredApprovals": [
644
949
  {
645
- "address": "$parameters.contractAddress",
646
- "amount": "$parameters.mintAmount",
647
- "to": "$before.ionicTokenContractAddress"
950
+ "address": "{{parameters.contractAddress}}",
951
+ "amount": "{{parameters.mintAmount}}",
952
+ "to": "{{before.ionicTokenContractAddress}}"
648
953
  }
649
954
  ],
955
+ "output": {
956
+ "transactionHash": "string"
957
+ },
650
958
  "permissions": {
651
959
  "approvedTargets": [
652
- "$before.ionicTokenContractAddress"
960
+ "{{before.ionicTokenContractAddress}}"
653
961
  ],
654
962
  "label": [
655
- "Transfer $tokenSymbol($parameters.chainId, $parameters.contractAddress)"
963
+ "Transfer {{tokenSymbol({{parameters.chainId}}, {{parameters.contractAddress}})}}"
656
964
  ],
657
965
  "labelNotAuthorized": [
658
- "Transfer $otherTokenSymbol($parameters.chainId, $parameters.contractAddress)"
966
+ "Transfer {{otherTokenSymbol({{parameters.chainId}}, {{parameters.contractAddress}})}}"
659
967
  ]
660
968
  },
661
969
  "blockId": 100006,
@@ -677,11 +985,18 @@ export const ACTIONS = {
677
985
  "contractAddress": "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874",
678
986
  "requiredApprovals": [
679
987
  {
680
- "address": "$parameters.tokenIn",
681
- "amount": "$parameters.value",
988
+ "address": "{{parameters.tokenIn}}",
989
+ "amount": "{{parameters.value}}",
682
990
  "to": "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874"
683
991
  }
684
992
  ],
993
+ "output": {
994
+ "amountIn": "uint256",
995
+ "tokenIn": "erc20",
996
+ "amountOut": "uint256",
997
+ "tokenOut": "erc20",
998
+ "transactionHash": "string"
999
+ },
685
1000
  "parameters": [
686
1001
  {
687
1002
  "key": "chainId",
@@ -718,10 +1033,10 @@ export const ACTIONS = {
718
1033
  "permissions": {
719
1034
  "approvedTargets": [
720
1035
  "0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874",
721
- "$parameters.tokenIn"
1036
+ "{{parameters.tokenIn}}"
722
1037
  ],
723
1038
  "label": [
724
- "Swap $tokenSymbol($parameters.chainId, $parameters.tokenIn) to $tokenSymbol($parameters.chainId, $parameters.tokenOut)"
1039
+ "Swap {{tokenSymbol({{parameters.chainId}}, {{parameters.tokenIn}})}} to {{tokenSymbol({{parameters.chainId}}, {{parameters.tokenOut}})}}"
725
1040
  ],
726
1041
  "labelNotAuthorized": [
727
1042
  "Transfer ETH"
@@ -20,10 +20,7 @@ export class Action extends Node {
20
20
  if (!parentBlock.permissions)
21
21
  return null;
22
22
  const permissions = SessionKeyPermission.fromJSON(parentBlock.permissions);
23
- permissions.fill('contractAddress', this.getParameter('contractAddress'));
24
- permissions.fill('parameters.contractAddress', this.getParameter('contractAddress'));
25
- permissions.fill('chainId', this.getParameter('chainId'));
26
- permissions.fill('parameters.chainId', this.getParameter('chainId'));
23
+ permissions.fillParameters(this.getParameters());
27
24
  permissions.fillMethod();
28
25
  return permissions;
29
26
  }
@@ -20,6 +20,7 @@ export class Node {
20
20
  this.description = node.description;
21
21
  this.image = node.image;
22
22
  this.parameters = {};
23
+ this.outputs = node.output || {};
23
24
  this.keyMap = {};
24
25
  this.class = node.class;
25
26
  this.parentInfo = node.parentInfo;
@@ -105,6 +106,15 @@ export class Node {
105
106
  return acc;
106
107
  }, {});
107
108
  }
109
+ getOutputs() {
110
+ return this.outputs;
111
+ }
112
+ getOutputVariableName(outputKey) {
113
+ return `{{nodeMap.${this.getRef()}.output.${outputKey}}}`;
114
+ }
115
+ getParameterVariableName(parameterKey) {
116
+ return `{{nodeMap.${this.getRef()}.parameters.${parameterKey}}}`;
117
+ }
108
118
  toJSON() {
109
119
  const serializeBigInt = (key, value) => {
110
120
  if (typeof value === 'bigint') {
@@ -127,7 +137,7 @@ export class Node {
127
137
  blockId: this.blockId,
128
138
  type: this.class,
129
139
  state: this.state,
130
- parameters: Object.assign({}, this.getParameters()),
140
+ parameters: Object.assign({}, this.getParameters())
131
141
  };
132
142
  if (this.position) {
133
143
  json.position = this.position;
@@ -7,19 +7,30 @@ export class SessionKeyPermission {
7
7
  }
8
8
  fill(key, value) {
9
9
  const replacePlaceholder = (target) => {
10
- const placeholder = `$${key}`;
11
- if (target.includes(placeholder)) {
12
- return target.replace(placeholder, value);
13
- }
14
- return target;
10
+ const placeholder = new RegExp(`{{${key}}}`, 'g');
11
+ return target.replace(placeholder, value);
15
12
  };
16
13
  this.approvedTargets = this.approvedTargets.map(replacePlaceholder);
17
14
  this.label = this.label.map(replacePlaceholder);
18
15
  this.labelNotAuthorized = this.labelNotAuthorized.map(replacePlaceholder);
19
16
  }
17
+ fillParameters(params) {
18
+ var _a;
19
+ // 1. replace non abi params
20
+ for (let key in params) {
21
+ if (key !== 'abi') {
22
+ this.fill(`parameters.${key}`, params[key]);
23
+ }
24
+ }
25
+ // 2. replace abi params
26
+ const abiParams = (_a = params.abi) === null || _a === void 0 ? void 0 : _a.parameters;
27
+ for (let key in abiParams) {
28
+ this.fill(`parameters.abiParams.${key}`, abiParams[key]);
29
+ }
30
+ }
20
31
  fillMethod() {
21
32
  const executeMethod = (target) => {
22
- const methodPattern = /\$(\w+)\(([^)]+)\)/g;
33
+ const methodPattern = /\{\{(\w+)\(([^)]+)\)\}\}/g;
23
34
  return target.replace(methodPattern, (match, methodName, params) => {
24
35
  const paramList = params.split(',').map((param) => param.trim());
25
36
  switch (methodName) {
@@ -162,7 +162,7 @@ export class Workflow {
162
162
  }
163
163
  try {
164
164
  const response = yield apiServices.post(`/workflows/${this.id}/run`, this.toJSON());
165
- if (response.status === 204) {
165
+ if (response.status === 200) {
166
166
  this.state = 'active';
167
167
  return { success: true };
168
168
  }
@@ -9,7 +9,24 @@ export declare const TRIGGERS: {
9
9
  name: string;
10
10
  description: string;
11
11
  type: number;
12
+ output: {
13
+ value: string;
14
+ from: string;
15
+ to: string;
16
+ transactionHash: string;
17
+ };
12
18
  parameters: Parameter[];
19
+ examples: {
20
+ name: string;
21
+ description: string;
22
+ parameters: ({
23
+ key: string;
24
+ value: number;
25
+ } | {
26
+ key: string;
27
+ value: string;
28
+ })[];
29
+ }[];
13
30
  blockId: number;
14
31
  image: string;
15
32
  };
@@ -19,7 +36,21 @@ export declare const TRIGGERS: {
19
36
  type: number;
20
37
  method: string;
21
38
  handler: string;
39
+ output: {
40
+ balance: string;
41
+ };
22
42
  parameters: Parameter[];
43
+ examples: {
44
+ name: string;
45
+ description: string;
46
+ parameters: ({
47
+ key: string;
48
+ value: number;
49
+ } | {
50
+ key: string;
51
+ value: string;
52
+ })[];
53
+ }[];
23
54
  blockId: number;
24
55
  image: string;
25
56
  };
@@ -35,6 +66,14 @@ export declare const TRIGGERS: {
35
66
  description: string;
36
67
  type: number;
37
68
  contractAddress: string;
69
+ output: {
70
+ caller: string;
71
+ market: string;
72
+ receiver: string;
73
+ netPtToAccount: string;
74
+ netSyToAccount: string;
75
+ transactionHash: string;
76
+ };
38
77
  parameters: Parameter[];
39
78
  blockId: number;
40
79
  image: string;
@@ -44,6 +83,15 @@ export declare const TRIGGERS: {
44
83
  description: string;
45
84
  type: number;
46
85
  contractAddress: string;
86
+ output: {
87
+ caller: string;
88
+ market: string;
89
+ receiver: string;
90
+ netLpToRemove: string;
91
+ netPtOut: string;
92
+ netSyOut: string;
93
+ transactionHash: string;
94
+ };
47
95
  parameters: Parameter[];
48
96
  blockId: number;
49
97
  image: string;
@@ -53,6 +101,14 @@ export declare const TRIGGERS: {
53
101
  description: string;
54
102
  type: number;
55
103
  contractAddress: string;
104
+ output: {
105
+ market: string;
106
+ PT: string;
107
+ scalarRoot: string;
108
+ initialAnchor: string;
109
+ lnFeeRateRoot: string;
110
+ transactionHash: string;
111
+ };
56
112
  parameters: Parameter[];
57
113
  blockId: number;
58
114
  image: string;
@@ -62,6 +118,11 @@ export declare const TRIGGERS: {
62
118
  description: string;
63
119
  type: number;
64
120
  contractAddress: string;
121
+ output: {
122
+ timestamp: string;
123
+ lastLnImpliedRate: string;
124
+ transactionHash: string;
125
+ };
65
126
  parameters: Parameter[];
66
127
  blockId: number;
67
128
  image: string;
@@ -78,7 +139,24 @@ export declare const TRIGGERS: {
78
139
  description: string;
79
140
  type: number;
80
141
  contractAddress: string;
142
+ output: {
143
+ loanId: string;
144
+ recaller: string;
145
+ end: string;
146
+ transactionHash: string;
147
+ };
81
148
  parameters: Parameter[];
149
+ examples: {
150
+ name: string;
151
+ description: string;
152
+ parameters: ({
153
+ key: string;
154
+ value: number;
155
+ } | {
156
+ key: string;
157
+ value: string;
158
+ })[];
159
+ }[];
82
160
  blockId: number;
83
161
  image: string;
84
162
  };
@@ -94,8 +172,17 @@ export declare const TRIGGERS: {
94
172
  description: string;
95
173
  type: number;
96
174
  contractAddress: string;
175
+ output: {
176
+ sender: string;
177
+ inputAmount: string;
178
+ inputToken: string;
179
+ amountOut: string;
180
+ outputToken: string;
181
+ exchangeRate: string;
182
+ transactionHash: string;
183
+ };
97
184
  parameters: Parameter[];
98
- templates: {
185
+ examples: {
99
186
  name: string;
100
187
  description: string;
101
188
  parameters: ({
@@ -127,7 +214,14 @@ export declare const TRIGGERS: {
127
214
  description: string;
128
215
  type: number;
129
216
  contractAddress: string;
217
+ output: {
218
+ id: string;
219
+ owner: string;
220
+ expires: string;
221
+ transactionHash: string;
222
+ };
130
223
  parameters: Parameter[];
224
+ examples: never[];
131
225
  blockId: number;
132
226
  image: string;
133
227
  };
@@ -142,7 +236,21 @@ export declare const TRIGGERS: {
142
236
  type: number;
143
237
  url: string;
144
238
  handler: string;
239
+ output: {
240
+ value: string;
241
+ };
145
242
  parameters: Parameter[];
243
+ examples: {
244
+ name: string;
245
+ description: string;
246
+ parameters: ({
247
+ key: string;
248
+ value: string;
249
+ } | {
250
+ key: string;
251
+ value: number;
252
+ })[];
253
+ }[];
146
254
  blockId: number;
147
255
  image: string;
148
256
  };
@@ -157,7 +265,21 @@ export declare const TRIGGERS: {
157
265
  name: string;
158
266
  description: string;
159
267
  type: number;
268
+ output: {
269
+ price: string;
270
+ };
160
271
  parameters: Parameter[];
272
+ examples: {
273
+ name: string;
274
+ description: string;
275
+ parameters: ({
276
+ key: string;
277
+ value: number;
278
+ } | {
279
+ key: string;
280
+ value: string;
281
+ })[];
282
+ }[];
161
283
  blockId: number;
162
284
  image: string;
163
285
  };
@@ -173,7 +295,16 @@ export declare const ACTIONS: {
173
295
  name: string;
174
296
  type: number;
175
297
  description: string;
298
+ output: {
299
+ message: string;
300
+ };
176
301
  parameters: Parameter[];
302
+ template: {
303
+ url: string;
304
+ body: {
305
+ text: string;
306
+ };
307
+ };
177
308
  blockId: number;
178
309
  image: string;
179
310
  };
@@ -185,7 +316,16 @@ export declare const ACTIONS: {
185
316
  name: string;
186
317
  type: number;
187
318
  description: string;
319
+ output: {
320
+ message: string;
321
+ };
188
322
  parameters: Parameter[];
323
+ template: {
324
+ url: string;
325
+ body: {
326
+ content: string;
327
+ };
328
+ };
189
329
  blockId: number;
190
330
  image: string;
191
331
  };
@@ -197,7 +337,17 @@ export declare const ACTIONS: {
197
337
  name: string;
198
338
  type: number;
199
339
  description: string;
340
+ output: {
341
+ message: string;
342
+ };
200
343
  parameters: Parameter[];
344
+ template: {
345
+ url: string;
346
+ body: {
347
+ chat_id: string;
348
+ text: string;
349
+ };
350
+ };
201
351
  blockId: number;
202
352
  image: string;
203
353
  };
@@ -213,6 +363,9 @@ export declare const ACTIONS: {
213
363
  description: string;
214
364
  type: number;
215
365
  method: string;
366
+ output: {
367
+ transactionHash: string;
368
+ };
216
369
  parameters: Parameter[];
217
370
  permissions: {
218
371
  approvedTargets: string[];
@@ -240,6 +393,9 @@ export declare const ACTIONS: {
240
393
  amount: string;
241
394
  to: string;
242
395
  }[];
396
+ output: {
397
+ transactionHash: string;
398
+ };
243
399
  permissions: {
244
400
  approvedTargets: string[];
245
401
  label: string[];
@@ -265,6 +421,13 @@ export declare const ACTIONS: {
265
421
  amount: string;
266
422
  to: string;
267
423
  }[];
424
+ output: {
425
+ amountIn: string;
426
+ tokenIn: string;
427
+ amountOut: string;
428
+ tokenOut: string;
429
+ transactionHash: string;
430
+ };
268
431
  parameters: Parameter[];
269
432
  permissions: {
270
433
  approvedTargets: string[];
@@ -7,6 +7,9 @@ export declare class Action extends Node {
7
7
  name: string;
8
8
  description: string;
9
9
  parameters: Parameter[];
10
+ output?: {
11
+ [key: string]: string;
12
+ };
10
13
  image: string;
11
14
  ref?: string;
12
15
  position?: Position;
@@ -17,6 +17,9 @@ export declare abstract class Node {
17
17
  parameters: {
18
18
  [key: string]: Parameter;
19
19
  };
20
+ outputs: {
21
+ [key: string]: string;
22
+ };
20
23
  keyMap: {
21
24
  [key: string]: string;
22
25
  };
@@ -31,6 +34,9 @@ export declare abstract class Node {
31
34
  name: string;
32
35
  description: string;
33
36
  parameters: Parameter[];
37
+ output?: {
38
+ [key: string]: string;
39
+ };
34
40
  ref?: string;
35
41
  position?: Position;
36
42
  class: string;
@@ -51,6 +57,11 @@ export declare abstract class Node {
51
57
  getParameters(): {
52
58
  [key: string]: any;
53
59
  };
60
+ getOutputs(): {
61
+ [key: string]: string;
62
+ };
63
+ getOutputVariableName(outputKey: string): string;
64
+ getParameterVariableName(parameterKey: string): string;
54
65
  toJSON(): {
55
66
  [key: string]: any;
56
67
  };
@@ -8,6 +8,9 @@ export declare class SessionKeyPermission {
8
8
  labelNotAuthorized?: string[];
9
9
  });
10
10
  fill(key: string, value: any): void;
11
+ fillParameters(params: {
12
+ [key: string]: any;
13
+ }): void;
11
14
  fillMethod(): void;
12
15
  toJSON(): {
13
16
  [key: string]: any;
@@ -8,6 +8,9 @@ export declare class Trigger extends Node {
8
8
  description: string;
9
9
  type: number;
10
10
  parameters: Parameter[];
11
+ output?: {
12
+ [key: string]: string;
13
+ };
11
14
  image: string;
12
15
  ref?: string;
13
16
  position?: Position;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "1.5.16",
3
+ "version": "1.5.18",
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",