otomato-sdk 2.0.28 → 2.0.30
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.
|
@@ -164,6 +164,45 @@ const gasMonitoring = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
164
164
|
const edge = new Edge({ source: trigger, target: notificationAction });
|
|
165
165
|
return new Workflow('Get notified when the gas price on Ethereum drops below 6 gwei', [trigger, notificationAction], [edge]);
|
|
166
166
|
});
|
|
167
|
+
const dailyYieldEmail = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
168
|
+
const trigger = new Trigger(TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD);
|
|
169
|
+
const notificationAction = new Action(ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL);
|
|
170
|
+
notificationAction.setParams("body", `Daily Yield Report 🚀
|
|
171
|
+
|
|
172
|
+
------------------ USDC ------------------------
|
|
173
|
+
|
|
174
|
+
📍 On Base
|
|
175
|
+
• IONIC: {{external.functions.ionicLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}
|
|
176
|
+
• AAVE: {{external.functions.aaveLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}
|
|
177
|
+
• Compound: {{external.functions.compoundLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,0)}}
|
|
178
|
+
• Ironclad: {{external.functions.ironcladLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}
|
|
179
|
+
• Moonwell: {{external.functions.moonwellLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}
|
|
180
|
+
|
|
181
|
+
📍 On Mode
|
|
182
|
+
• IONIC: {{external.functions.ionicLendingRate(34443,0xd988097fb8612cc24eeC14542bC03424c656005f)}}
|
|
183
|
+
• Ironclad: {{external.functions.ironcladLendingRate(34443,0xd988097fb8612cc24eeC14542bC03424c656005f)}}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
------------------ ETH ------------------------
|
|
187
|
+
|
|
188
|
+
📍 On Base
|
|
189
|
+
• IONIC: {{external.functions.ionicLendingRate(8453,0x4200000000000000000000000000000000000006)}}
|
|
190
|
+
• AAVE: {{external.functions.aaveLendingRate(8453,0x4200000000000000000000000000000000000006)}}
|
|
191
|
+
• Compound: {{external.functions.compoundLendingRate(8453,0x4200000000000000000000000000000000000006,0)}}
|
|
192
|
+
• Ironclad: {{external.functions.ironcladLendingRate(8453,0x4200000000000000000000000000000000000006)}}
|
|
193
|
+
• Moonwell: {{external.functions.moonwellLendingRate(8453,0x4200000000000000000000000000000000000006)}}
|
|
194
|
+
|
|
195
|
+
📍 On Mode
|
|
196
|
+
• IONIC: {{external.functions.ionicLendingRate(34443,0x4200000000000000000000000000000000000006)}}
|
|
197
|
+
• Ironclad: {{external.functions.ironcladLendingRate(34443,0x4200000000000000000000000000000000000006)}}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
See you tomorrow!`);
|
|
201
|
+
notificationAction.setParams("subject", "Daily yield updates");
|
|
202
|
+
notificationAction.setPosition(400, 240);
|
|
203
|
+
const edge = new Edge({ source: trigger, target: notificationAction });
|
|
204
|
+
return new Workflow('Daily yield updates', [trigger, notificationAction], [edge]);
|
|
205
|
+
});
|
|
167
206
|
export const WORKFLOW_TEMPLATES = [
|
|
168
207
|
{
|
|
169
208
|
'name': 'MODE transfer notification',
|
|
@@ -266,5 +305,16 @@ export const WORKFLOW_TEMPLATES = [
|
|
|
266
305
|
ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL.image
|
|
267
306
|
],
|
|
268
307
|
createWorkflow: gasMonitoring
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
'name': 'Daily yield updates',
|
|
311
|
+
'description': 'Receive an email every day with a recap from all the money market yields for ETH and USDC.',
|
|
312
|
+
'tags': [WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING, WORKFLOW_TEMPLATES_TAGS.NOTIFICATIONS],
|
|
313
|
+
'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/gasMonitoring.jpg',
|
|
314
|
+
'image': [
|
|
315
|
+
TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD.image,
|
|
316
|
+
ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL.image
|
|
317
|
+
],
|
|
318
|
+
createWorkflow: dailyYieldEmail
|
|
269
319
|
}
|
|
270
320
|
];
|
|
@@ -22,20 +22,34 @@ export function positionWorkflowNodes(workflow) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
export function positionNode(node, edges, xSpacing, ySpacing, workflow) {
|
|
25
|
-
// Get children of the node
|
|
26
25
|
const parents = getParents(node, edges);
|
|
27
26
|
// todo: what if we have multiple parents?
|
|
28
27
|
const children = getChildren(parents[0], edges);
|
|
29
|
-
const
|
|
28
|
+
const sortedChildren = children.sort((a, b) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const edgeA = edges.find(edge => edge.source === parents[0] && edge.target === a);
|
|
31
|
+
const edgeB = edges.find(edge => edge.source === parents[0] && edge.target === b);
|
|
32
|
+
const labelA = (_a = edgeA === null || edgeA === void 0 ? void 0 : edgeA.label) !== null && _a !== void 0 ? _a : "";
|
|
33
|
+
const labelB = (_b = edgeB === null || edgeB === void 0 ? void 0 : edgeB.label) !== null && _b !== void 0 ? _b : "";
|
|
34
|
+
if (labelA === "true" && labelB !== "true")
|
|
35
|
+
return -1;
|
|
36
|
+
if (labelB === "true" && labelA !== "true")
|
|
37
|
+
return 1;
|
|
38
|
+
if (labelA === "false" && labelB !== "false")
|
|
39
|
+
return 1;
|
|
40
|
+
if (labelB === "false" && labelA !== "false")
|
|
41
|
+
return -1;
|
|
42
|
+
return 0;
|
|
43
|
+
});
|
|
44
|
+
const childrenCountOfParent = sortedChildren.length;
|
|
30
45
|
const parentX = parents.reduce((sum, parent) => { var _a, _b; return sum + ((_b = (_a = parent.position) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : ROOT_X); }, 0) / parents.length;
|
|
31
46
|
const parentY = Math.max(...parents.map(parent => { var _a, _b; return (_b = (_a = parent.position) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : ROOT_Y; }));
|
|
32
|
-
// Compute position based on parent children count
|
|
33
47
|
if (childrenCountOfParent === 1) {
|
|
34
48
|
node.setPosition(parentX, parentY + ySpacing);
|
|
35
49
|
}
|
|
36
50
|
else {
|
|
37
|
-
const index =
|
|
38
|
-
const totalChildren =
|
|
51
|
+
const index = sortedChildren.indexOf(node); // Get the position of this node among its siblings
|
|
52
|
+
const totalChildren = sortedChildren.length;
|
|
39
53
|
// Compute the x position for this node
|
|
40
54
|
const offset = index - (totalChildren - 1) / 2; // Center the children around the parent
|
|
41
55
|
node.setPosition(parentX + offset * xSpacing, parentY + ySpacing);
|
|
@@ -58,21 +72,38 @@ export function positionWorkflowNodesAvoidOverlap(workflow) {
|
|
|
58
72
|
addToLevel(node);
|
|
59
73
|
}
|
|
60
74
|
});
|
|
61
|
-
// 3) Resolve horizontal overlaps
|
|
75
|
+
// 3) Resolve horizontal overlaps and enforce parent grouping
|
|
62
76
|
levels.forEach((nodes, level) => {
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
// Group nodes by their parent
|
|
78
|
+
const parentGroups = new Map();
|
|
79
|
+
nodes.forEach((node) => {
|
|
80
|
+
const parents = getParents(node, workflow.edges);
|
|
81
|
+
if (parents.length > 0) {
|
|
82
|
+
const parent = parents[0]; // Assuming single parent for simplicity
|
|
83
|
+
if (!parentGroups.has(parent)) {
|
|
84
|
+
parentGroups.set(parent, []);
|
|
85
|
+
}
|
|
86
|
+
parentGroups.get(parent).push(node);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
// Flatten the groups back into a sorted array
|
|
90
|
+
const groupedNodes = [];
|
|
91
|
+
parentGroups.forEach((group) => {
|
|
92
|
+
groupedNodes.push(...group);
|
|
93
|
+
});
|
|
94
|
+
// Sort nodes by x within each group to detect overlaps
|
|
95
|
+
groupedNodes.sort((a, b) => { var _a, _b; return ((_a = a.position.x) !== null && _a !== void 0 ? _a : 0) - ((_b = b.position.x) !== null && _b !== void 0 ? _b : 0); });
|
|
96
|
+
// Shift nodes within groups to resolve overlaps
|
|
97
|
+
for (let i = 1; i < groupedNodes.length; i++) {
|
|
98
|
+
const prev = groupedNodes[i - 1];
|
|
99
|
+
const current = groupedNodes[i];
|
|
69
100
|
if (current.position.x - prev.position.x < xSpacing) {
|
|
70
101
|
const shift = xSpacing - (current.position.x - prev.position.x);
|
|
71
102
|
moveNodeAndChildren(current, shift, workflow.edges);
|
|
72
103
|
}
|
|
73
104
|
}
|
|
74
105
|
});
|
|
75
|
-
// 4) **Center each parent over its children** (the
|
|
106
|
+
// 4) **Center each parent over its children** (the existing step)
|
|
76
107
|
centerParentXPositions(workflow);
|
|
77
108
|
}
|
|
78
109
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.29";
|
|
2
2
|
export declare function compareVersions(v1: string, v2: string): number;
|