otomato-sdk 2.0.72 → 2.0.73
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.
- package/dist/src/constants/Blocks.js +16 -16
- package/dist/src/constants/version.js +1 -1
- package/dist/src/models/Edge.js +2 -4
- package/dist/src/models/Node.js +2 -4
- package/dist/src/models/Workflow.js +10 -14
- package/dist/src/services/ApiService.js +4 -5
- package/dist/src/utils/WorkflowNodePositioner.js +5 -9
- package/dist/src/utils/externalVariables.js +2 -3
- package/dist/src/utils/typeValidator.js +2 -1
- package/dist/types/src/constants/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2765,7 +2765,7 @@ export const ACTIONS = {
|
|
|
2765
2765
|
},
|
|
2766
2766
|
{
|
|
2767
2767
|
"key": "amount",
|
|
2768
|
-
"value":
|
|
2768
|
+
"value": 100
|
|
2769
2769
|
},
|
|
2770
2770
|
{
|
|
2771
2771
|
"key": "slippage",
|
|
@@ -3040,7 +3040,7 @@ export const ACTIONS = {
|
|
|
3040
3040
|
},
|
|
3041
3041
|
{
|
|
3042
3042
|
"key": "abiParams.amount",
|
|
3043
|
-
"value":
|
|
3043
|
+
"value": 100
|
|
3044
3044
|
},
|
|
3045
3045
|
{
|
|
3046
3046
|
"key": "tokenToDeposit",
|
|
@@ -3145,7 +3145,7 @@ export const ACTIONS = {
|
|
|
3145
3145
|
},
|
|
3146
3146
|
{
|
|
3147
3147
|
"key": "abiParams.amount",
|
|
3148
|
-
"value":
|
|
3148
|
+
"value": 100
|
|
3149
3149
|
},
|
|
3150
3150
|
{
|
|
3151
3151
|
"key": "tokenToWithdraw",
|
|
@@ -3239,7 +3239,7 @@ export const ACTIONS = {
|
|
|
3239
3239
|
},
|
|
3240
3240
|
{
|
|
3241
3241
|
"key": "abiParams.amount",
|
|
3242
|
-
"value":
|
|
3242
|
+
"value": 100
|
|
3243
3243
|
},
|
|
3244
3244
|
{
|
|
3245
3245
|
"key": "tokenToBorrow",
|
|
@@ -3320,7 +3320,7 @@ export const ACTIONS = {
|
|
|
3320
3320
|
},
|
|
3321
3321
|
{
|
|
3322
3322
|
"key": "abiParams.amount",
|
|
3323
|
-
"value":
|
|
3323
|
+
"value": 100
|
|
3324
3324
|
},
|
|
3325
3325
|
{
|
|
3326
3326
|
"key": "tokenToRepay",
|
|
@@ -3480,7 +3480,7 @@ export const ACTIONS = {
|
|
|
3480
3480
|
},
|
|
3481
3481
|
{
|
|
3482
3482
|
"key": "abiParams.amount",
|
|
3483
|
-
"value":
|
|
3483
|
+
"value": 100
|
|
3484
3484
|
},
|
|
3485
3485
|
{
|
|
3486
3486
|
"key": "abiParams.onBehalfOf",
|
|
@@ -3569,7 +3569,7 @@ export const ACTIONS = {
|
|
|
3569
3569
|
},
|
|
3570
3570
|
{
|
|
3571
3571
|
"key": "abiParams.amount",
|
|
3572
|
-
"value":
|
|
3572
|
+
"value": 10
|
|
3573
3573
|
},
|
|
3574
3574
|
{
|
|
3575
3575
|
"key": "abiParams.to",
|
|
@@ -3723,7 +3723,7 @@ export const ACTIONS = {
|
|
|
3723
3723
|
},
|
|
3724
3724
|
{
|
|
3725
3725
|
"key": "abiParams.amount",
|
|
3726
|
-
"value":
|
|
3726
|
+
"value": 100
|
|
3727
3727
|
},
|
|
3728
3728
|
{
|
|
3729
3729
|
"key": "tokenToDeposit",
|
|
@@ -3780,7 +3780,7 @@ export const ACTIONS = {
|
|
|
3780
3780
|
},
|
|
3781
3781
|
{
|
|
3782
3782
|
"key": "abiParams.amount",
|
|
3783
|
-
"value":
|
|
3783
|
+
"value": 100
|
|
3784
3784
|
},
|
|
3785
3785
|
{
|
|
3786
3786
|
"key": "tokenToWithdraw",
|
|
@@ -3875,7 +3875,7 @@ export const ACTIONS = {
|
|
|
3875
3875
|
},
|
|
3876
3876
|
{
|
|
3877
3877
|
"key": "abiParams.amount",
|
|
3878
|
-
"value":
|
|
3878
|
+
"value": 100
|
|
3879
3879
|
},
|
|
3880
3880
|
{
|
|
3881
3881
|
"key": "tokenToBorrow",
|
|
@@ -3956,7 +3956,7 @@ export const ACTIONS = {
|
|
|
3956
3956
|
},
|
|
3957
3957
|
{
|
|
3958
3958
|
"key": "abiParams.amount",
|
|
3959
|
-
"value":
|
|
3959
|
+
"value": 100
|
|
3960
3960
|
},
|
|
3961
3961
|
{
|
|
3962
3962
|
"key": "tokenToRepay",
|
|
@@ -4081,7 +4081,7 @@ export const ACTIONS = {
|
|
|
4081
4081
|
},
|
|
4082
4082
|
{
|
|
4083
4083
|
"key": "abiParams.amount",
|
|
4084
|
-
"value":
|
|
4084
|
+
"value": 100
|
|
4085
4085
|
},
|
|
4086
4086
|
{
|
|
4087
4087
|
"key": "abiParams.asset",
|
|
@@ -4177,7 +4177,7 @@ export const ACTIONS = {
|
|
|
4177
4177
|
},
|
|
4178
4178
|
{
|
|
4179
4179
|
"key": "abiParams.amount",
|
|
4180
|
-
"value":
|
|
4180
|
+
"value": 100
|
|
4181
4181
|
},
|
|
4182
4182
|
{
|
|
4183
4183
|
"key": "abiParams.asset",
|
|
@@ -4307,7 +4307,7 @@ export const ACTIONS = {
|
|
|
4307
4307
|
},
|
|
4308
4308
|
{
|
|
4309
4309
|
"key": "abiParams.amount",
|
|
4310
|
-
"value":
|
|
4310
|
+
"value": 100
|
|
4311
4311
|
},
|
|
4312
4312
|
{
|
|
4313
4313
|
"key": "abiParams.onBehalfOf",
|
|
@@ -4396,7 +4396,7 @@ export const ACTIONS = {
|
|
|
4396
4396
|
},
|
|
4397
4397
|
{
|
|
4398
4398
|
"key": "abiParams.amount",
|
|
4399
|
-
"value":
|
|
4399
|
+
"value": 10
|
|
4400
4400
|
},
|
|
4401
4401
|
{
|
|
4402
4402
|
"key": "abiParams.to",
|
|
@@ -4566,7 +4566,7 @@ export const ACTIONS = {
|
|
|
4566
4566
|
},
|
|
4567
4567
|
{
|
|
4568
4568
|
"key": "amount",
|
|
4569
|
-
"value":
|
|
4569
|
+
"value": 100
|
|
4570
4570
|
},
|
|
4571
4571
|
{
|
|
4572
4572
|
"key": "slippage",
|
package/dist/src/models/Edge.js
CHANGED
|
@@ -2,14 +2,13 @@ import { Node } from './Node.js';
|
|
|
2
2
|
import { apiServices } from '../services/ApiService.js';
|
|
3
3
|
export class Edge {
|
|
4
4
|
constructor(edge) {
|
|
5
|
-
var _a;
|
|
6
5
|
if (!edge.source || !(edge.source instanceof Node)) {
|
|
7
6
|
throw new Error('Edge must have a valid source node.');
|
|
8
7
|
}
|
|
9
8
|
if (!edge.target || !(edge.target instanceof Node)) {
|
|
10
9
|
throw new Error('Edge must have a valid target node.');
|
|
11
10
|
}
|
|
12
|
-
this.id =
|
|
11
|
+
this.id = edge.id ?? null;
|
|
13
12
|
this.source = edge.source;
|
|
14
13
|
this.target = edge.target;
|
|
15
14
|
this.label = edge.label;
|
|
@@ -44,7 +43,6 @@ export class Edge {
|
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
45
|
async delete() {
|
|
47
|
-
var _a;
|
|
48
46
|
if (!this.id) {
|
|
49
47
|
throw new Error('Cannot delete an edge without an ID.');
|
|
50
48
|
}
|
|
@@ -54,7 +52,7 @@ export class Edge {
|
|
|
54
52
|
return { success: true };
|
|
55
53
|
}
|
|
56
54
|
else {
|
|
57
|
-
return { success: false, error:
|
|
55
|
+
return { success: false, error: response.data?.error || 'Unknown error' };
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
catch (error) {
|
package/dist/src/models/Node.js
CHANGED
|
@@ -172,7 +172,6 @@ export class Node {
|
|
|
172
172
|
return JSON.parse(JSON.stringify(json, serializeBigInt));
|
|
173
173
|
}
|
|
174
174
|
async delete() {
|
|
175
|
-
var _a;
|
|
176
175
|
if (!this.id) {
|
|
177
176
|
throw new Error('Cannot delete a node without an ID.');
|
|
178
177
|
}
|
|
@@ -182,7 +181,7 @@ export class Node {
|
|
|
182
181
|
return { success: true };
|
|
183
182
|
}
|
|
184
183
|
else {
|
|
185
|
-
return { success: false, error:
|
|
184
|
+
return { success: false, error: response.data?.error || 'Unknown error' };
|
|
186
185
|
}
|
|
187
186
|
}
|
|
188
187
|
catch (error) {
|
|
@@ -190,7 +189,6 @@ export class Node {
|
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
191
|
async update() {
|
|
193
|
-
var _a;
|
|
194
192
|
if (!this.id) {
|
|
195
193
|
throw new Error('Cannot update a node without an ID.');
|
|
196
194
|
}
|
|
@@ -200,7 +198,7 @@ export class Node {
|
|
|
200
198
|
return { success: true };
|
|
201
199
|
}
|
|
202
200
|
else {
|
|
203
|
-
return { success: false, error:
|
|
201
|
+
return { success: false, error: response.data?.error || 'Unknown error' };
|
|
204
202
|
}
|
|
205
203
|
}
|
|
206
204
|
catch (error) {
|
|
@@ -87,8 +87,8 @@ export class Workflow {
|
|
|
87
87
|
const newEdge = new Edge({
|
|
88
88
|
source: nodeBefore,
|
|
89
89
|
target: nodeToInsert,
|
|
90
|
-
label: edgeLabelBefore
|
|
91
|
-
value: edgeValueBefore
|
|
90
|
+
label: edgeLabelBefore ?? undefined,
|
|
91
|
+
value: edgeValueBefore ?? undefined
|
|
92
92
|
});
|
|
93
93
|
this.addEdge(newEdge);
|
|
94
94
|
// Recalculate positions
|
|
@@ -113,15 +113,15 @@ export class Workflow {
|
|
|
113
113
|
const newEdge1 = new Edge({
|
|
114
114
|
source: nodeBefore,
|
|
115
115
|
target: nodeToInsert,
|
|
116
|
-
label: edgeLabelBefore
|
|
117
|
-
value: edgeValueBefore
|
|
116
|
+
label: edgeLabelBefore ?? undefined,
|
|
117
|
+
value: edgeValueBefore ?? undefined
|
|
118
118
|
});
|
|
119
119
|
// 2) nodeToInsert->nodeAfter
|
|
120
120
|
const newEdge2 = new Edge({
|
|
121
121
|
source: nodeToInsert,
|
|
122
122
|
target: nodeAfter,
|
|
123
|
-
label: edgeLabelAfter
|
|
124
|
-
value: edgeValueAfter
|
|
123
|
+
label: edgeLabelAfter ?? undefined,
|
|
124
|
+
value: edgeValueAfter ?? undefined
|
|
125
125
|
});
|
|
126
126
|
this.addEdges([newEdge1, newEdge2]);
|
|
127
127
|
// Recalculate positions
|
|
@@ -285,7 +285,6 @@ export class Workflow {
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
async create() {
|
|
288
|
-
var _a;
|
|
289
288
|
try {
|
|
290
289
|
const response = await apiServices.post('/workflows', this.toJSON());
|
|
291
290
|
if (response.status === 201) {
|
|
@@ -310,7 +309,7 @@ export class Workflow {
|
|
|
310
309
|
return { success: true };
|
|
311
310
|
}
|
|
312
311
|
else {
|
|
313
|
-
return { success: false, error:
|
|
312
|
+
return { success: false, error: response.data?.error || 'Unknown error' };
|
|
314
313
|
}
|
|
315
314
|
}
|
|
316
315
|
catch (error) {
|
|
@@ -319,7 +318,6 @@ export class Workflow {
|
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
320
|
async update() {
|
|
322
|
-
var _a;
|
|
323
321
|
try {
|
|
324
322
|
const response = await apiServices.put(`/workflows/${this.id}`, this.toJSON());
|
|
325
323
|
if (response.status === 200) {
|
|
@@ -342,7 +340,7 @@ export class Workflow {
|
|
|
342
340
|
return { success: true };
|
|
343
341
|
}
|
|
344
342
|
else {
|
|
345
|
-
return { success: false, error:
|
|
343
|
+
return { success: false, error: response.data?.error || 'Unknown error' };
|
|
346
344
|
}
|
|
347
345
|
}
|
|
348
346
|
catch (error) {
|
|
@@ -375,7 +373,6 @@ export class Workflow {
|
|
|
375
373
|
return this.load(this.id);
|
|
376
374
|
}
|
|
377
375
|
async run() {
|
|
378
|
-
var _a;
|
|
379
376
|
if (!this.id) {
|
|
380
377
|
throw new Error('The workflow needs to be published first');
|
|
381
378
|
}
|
|
@@ -386,7 +383,7 @@ export class Workflow {
|
|
|
386
383
|
return { success: true };
|
|
387
384
|
}
|
|
388
385
|
else {
|
|
389
|
-
return { success: false, error:
|
|
386
|
+
return { success: false, error: response.data?.error || 'Unknown error' };
|
|
390
387
|
}
|
|
391
388
|
}
|
|
392
389
|
catch (error) {
|
|
@@ -394,7 +391,6 @@ export class Workflow {
|
|
|
394
391
|
}
|
|
395
392
|
}
|
|
396
393
|
async delete() {
|
|
397
|
-
var _a;
|
|
398
394
|
if (!this.id) {
|
|
399
395
|
throw new Error('Cannot delete a workflow without an ID.');
|
|
400
396
|
}
|
|
@@ -410,7 +406,7 @@ export class Workflow {
|
|
|
410
406
|
return { success: true };
|
|
411
407
|
}
|
|
412
408
|
else {
|
|
413
|
-
return { success: false, error:
|
|
409
|
+
return { success: false, error: response.data?.error || 'Unknown error' };
|
|
414
410
|
}
|
|
415
411
|
}
|
|
416
412
|
catch (error) {
|
|
@@ -66,8 +66,8 @@ class ApiServices {
|
|
|
66
66
|
}
|
|
67
67
|
const headers = { 'Authorization': this.auth };
|
|
68
68
|
// Set defaults for offset and limit if not provided
|
|
69
|
-
const finalOffset = offset
|
|
70
|
-
const finalLimit = limit
|
|
69
|
+
const finalOffset = offset ?? 0;
|
|
70
|
+
const finalLimit = limit ?? 8;
|
|
71
71
|
const params = new URLSearchParams();
|
|
72
72
|
params.append('offset', finalOffset.toString());
|
|
73
73
|
params.append('limit', finalLimit.toString());
|
|
@@ -84,7 +84,6 @@ class ApiServices {
|
|
|
84
84
|
return response.data;
|
|
85
85
|
}
|
|
86
86
|
async getSessionKeyPermissions(workflowId) {
|
|
87
|
-
var _a, _b, _c;
|
|
88
87
|
if (!this.auth) {
|
|
89
88
|
throw new Error('Authorization token is required');
|
|
90
89
|
}
|
|
@@ -95,8 +94,8 @@ class ApiServices {
|
|
|
95
94
|
return response.data; // Return the data from the response
|
|
96
95
|
}
|
|
97
96
|
catch (error) {
|
|
98
|
-
console.error('Error verifying contracts:',
|
|
99
|
-
throw new Error(
|
|
97
|
+
console.error('Error verifying contracts:', error.response?.data || error.message);
|
|
98
|
+
throw new Error(error.response?.data?.message || 'Failed to verify contracts');
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
}
|
|
@@ -188,7 +188,6 @@ export function positionWorkflowNodesAvoidOverlap(workflow) {
|
|
|
188
188
|
* The parent's x is now set exactly to the average of its children's x positions.
|
|
189
189
|
*/
|
|
190
190
|
function centerParentXPositions(workflow) {
|
|
191
|
-
var _a, _b;
|
|
192
191
|
const queue = identifyLeafNodes(workflow);
|
|
193
192
|
while (queue.length > 0) {
|
|
194
193
|
const child = queue.shift();
|
|
@@ -198,7 +197,7 @@ function centerParentXPositions(workflow) {
|
|
|
198
197
|
if (children.length) {
|
|
199
198
|
const xs = children.map(c => c.position.x);
|
|
200
199
|
const avgX = xs.reduce((acc, x) => acc + x, 0) / xs.length;
|
|
201
|
-
parent.setPosition(avgX,
|
|
200
|
+
parent.setPosition(avgX, parent.position?.y ?? 0);
|
|
202
201
|
}
|
|
203
202
|
if (!queue.includes(parent)) {
|
|
204
203
|
queue.push(parent);
|
|
@@ -235,11 +234,8 @@ export function getEdges(node, edges) {
|
|
|
235
234
|
export function getEndNodePositions(workflow) {
|
|
236
235
|
return workflow.nodes
|
|
237
236
|
.filter(node => getChildren(node, workflow.edges).length === 0)
|
|
238
|
-
.map(node => {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
y: ((_d = (_c = node.position) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0) + ySpacing,
|
|
243
|
-
});
|
|
244
|
-
});
|
|
237
|
+
.map(node => ({
|
|
238
|
+
x: node.position?.x ?? 0,
|
|
239
|
+
y: (node.position?.y ?? 0) + ySpacing,
|
|
240
|
+
}));
|
|
245
241
|
}
|
|
@@ -23,16 +23,15 @@ export function getExternalVariableFromParameters(prototype, parameters) {
|
|
|
23
23
|
const blockParams = block.parameters || [];
|
|
24
24
|
// 3. Build an array of final values in the same order as blockParams
|
|
25
25
|
const finalValues = blockParams.map((bp) => {
|
|
26
|
-
var _a, _b, _c, _d;
|
|
27
26
|
// Step 3a.Find a matching user parameter by exact key or "abiParams.{key}"
|
|
28
27
|
const userParam = parameters.find((up) => up.key === bp.key || `abiParams.${up.key}` === bp.key);
|
|
29
28
|
if (userParam) {
|
|
30
29
|
// Use the user-supplied value
|
|
31
|
-
return
|
|
30
|
+
return userParam.value?.toString() ?? "";
|
|
32
31
|
}
|
|
33
32
|
else if (bp.value != null) {
|
|
34
33
|
// Use the block's default value, if defined
|
|
35
|
-
return
|
|
34
|
+
return bp.value?.toString() ?? "";
|
|
36
35
|
}
|
|
37
36
|
else {
|
|
38
37
|
// No user-supplied or default => empty placeholder
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
+
const MAX_BIGINT = 115792089237316195423570985008687907853269984665640564039457584007913129639935n;
|
|
2
3
|
export function validateType(expectedType, value) {
|
|
3
4
|
if (typeof value === 'string' && isVariable(value)) {
|
|
4
5
|
return true; // Allow all variable strings
|
|
@@ -31,7 +32,7 @@ export function validateType(expectedType, value) {
|
|
|
31
32
|
case 'float':
|
|
32
33
|
case 'fixed':
|
|
33
34
|
case 'ufixed':
|
|
34
|
-
return typeof value === 'number';
|
|
35
|
+
return (typeof value === 'number') || value === MAX_BIGINT;
|
|
35
36
|
case 'percentage':
|
|
36
37
|
return typeof value === 'number' && value >= 0 && value <= 100;
|
|
37
38
|
case 'url':
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.73";
|
|
2
2
|
export declare function compareVersions(v1: string, v2: string): number;
|