otomato-sdk 2.0.6 → 2.0.8

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.
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = '2.0.6';
1
+ export const SDK_VERSION = '2.0.8';
2
2
  export function compareVersions(v1, v2) {
3
3
  // Split the version strings into parts
4
4
  const v1Parts = v1.split('.').map(Number);
package/dist/src/index.js CHANGED
@@ -13,6 +13,7 @@ export * from './models/conditions/ConditionGroup.js';
13
13
  export * from './models/Parameter.js';
14
14
  export * from './models/Trigger.js';
15
15
  export * from './models/Node.js';
16
+ export * from './models/Note.js';
16
17
  export * from './models/Edge.js';
17
18
  export * from './models/SessionKeyPermission.js';
18
19
  export * from './models/Authorization.js';
@@ -1,6 +1,6 @@
1
1
  export class Note {
2
- constructor(text, position) {
3
- this.id = Date.now().toString(); // Assign the current timestamp as the ID
2
+ constructor(text, position, id) {
3
+ this.id = id || Date.now().toString(); // Use provided ID or fallback to timestamp
4
4
  this.text = text;
5
5
  this.position = position;
6
6
  }
@@ -14,4 +14,8 @@ export class Note {
14
14
  position: this.position,
15
15
  };
16
16
  }
17
+ // Static method to create a Note instance from JSON
18
+ static fromJSON(json) {
19
+ return new Note(json.text, json.position, json.id);
20
+ }
17
21
  }
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { Node } from './Node.js';
11
11
  import { Edge } from './Edge.js';
12
12
  import { apiServices } from '../services/ApiService.js';
13
+ import { Note } from './Note.js';
13
14
  export class Workflow {
14
15
  constructor(name = '', nodes = [], edges = []) {
15
16
  this.id = null;
@@ -173,6 +174,7 @@ export class Workflow {
173
174
  this.dateModified = response.dateModified;
174
175
  this.nodes = yield Promise.all(response.nodes.map((nodeData) => __awaiter(this, void 0, void 0, function* () { return yield Node.fromJSON(nodeData); })));
175
176
  this.edges = response.edges.map((edgeData) => Edge.fromJSON(edgeData, this.nodes));
177
+ this.notes = response.notes.map((noteData) => Note.fromJSON(noteData));
176
178
  return this;
177
179
  }
178
180
  catch (error) {
@@ -79,18 +79,26 @@ class ApiServices {
79
79
  return response.data;
80
80
  });
81
81
  }
82
- getWorkflowsOfUser(offset, limit) {
82
+ getWorkflowsOfUser(offset, limit, isActive, query) {
83
83
  return __awaiter(this, void 0, void 0, function* () {
84
84
  if (!this.auth) {
85
85
  throw new Error('Authorization token is required');
86
86
  }
87
87
  const headers = { 'Authorization': this.auth };
88
- // Set defaults if offset and limit are not provided
88
+ // Set defaults for offset and limit if not provided
89
89
  const finalOffset = offset !== null && offset !== void 0 ? offset : 0;
90
90
  const finalLimit = limit !== null && limit !== void 0 ? limit : 8;
91
91
  const params = new URLSearchParams();
92
92
  params.append('offset', finalOffset.toString());
93
93
  params.append('limit', finalLimit.toString());
94
+ // Add isActive filter if provided
95
+ if (isActive !== undefined) {
96
+ params.append('isActive', isActive.toString());
97
+ }
98
+ // add a query to filter by name
99
+ if (query) {
100
+ params.append('q', query);
101
+ }
94
102
  const url = `/workflows?${params.toString()}`;
95
103
  const response = yield axiosInstance.get(url, { headers });
96
104
  return response.data;
@@ -14,6 +14,10 @@ export function convertToTokenUnits(amount, chainId, contractAddress) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
15
15
  const token = yield getToken(chainId, contractAddress);
16
16
  const decimals = token.decimals;
17
+ // Max BigInt - For Withdraw All from protocols
18
+ if (amount.toString() === "115792089237316195423570985008687907853269984665640564039457584007913129639935n") {
19
+ return amount;
20
+ }
17
21
  // Calculate the result as a number first
18
22
  const result = amount * Math.pow(10, decimals);
19
23
  // Check if the result is an integer
@@ -352,6 +352,17 @@ export declare const TRIGGERS: {
352
352
  output: {
353
353
  lendingRate: string;
354
354
  };
355
+ examples: {
356
+ name: string;
357
+ description: string;
358
+ parameters: ({
359
+ key: string;
360
+ value: number;
361
+ } | {
362
+ key: string;
363
+ value: string;
364
+ })[];
365
+ }[];
355
366
  blockId: number;
356
367
  image: string;
357
368
  };
@@ -365,6 +376,17 @@ export declare const TRIGGERS: {
365
376
  output: {
366
377
  borrowingRate: string;
367
378
  };
379
+ examples: {
380
+ name: string;
381
+ description: string;
382
+ parameters: ({
383
+ key: string;
384
+ value: number;
385
+ } | {
386
+ key: string;
387
+ value: string;
388
+ })[];
389
+ }[];
368
390
  blockId: number;
369
391
  image: string;
370
392
  };
@@ -382,7 +404,23 @@ export declare const TRIGGERS: {
382
404
  parameters: Parameter[];
383
405
  output: {
384
406
  lendingRate: string;
407
+ incentives: string;
408
+ underlyingPrice: string;
409
+ totalSupply: string;
410
+ supplyRate: string;
411
+ exchangeRate: string;
385
412
  };
413
+ examples: {
414
+ name: string;
415
+ description: string;
416
+ parameters: ({
417
+ key: string;
418
+ value: number;
419
+ } | {
420
+ key: string;
421
+ value: string;
422
+ })[];
423
+ }[];
386
424
  blockId: number;
387
425
  image: string;
388
426
  };
@@ -394,7 +432,78 @@ export declare const TRIGGERS: {
394
432
  method: string;
395
433
  parameters: Parameter[];
396
434
  output: {
435
+ collateralFactor: string;
397
436
  borrowingRate: string;
437
+ incentives: string;
438
+ underlyingPrice: string;
439
+ totalBorrows: string;
440
+ borrowRate: string;
441
+ };
442
+ examples: {
443
+ name: string;
444
+ description: string;
445
+ parameters: ({
446
+ key: string;
447
+ value: number;
448
+ } | {
449
+ key: string;
450
+ value: string;
451
+ })[];
452
+ }[];
453
+ blockId: number;
454
+ image: string;
455
+ };
456
+ };
457
+ COMPOUND: {
458
+ description: string;
459
+ chains: number[];
460
+ image: string;
461
+ LENDING_RATE: {
462
+ name: string;
463
+ description: string;
464
+ prototype: string;
465
+ type: number;
466
+ method: string;
467
+ parameters: Parameter[];
468
+ examples: {
469
+ name: string;
470
+ description: string;
471
+ parameters: ({
472
+ key: string;
473
+ value: number;
474
+ } | {
475
+ key: string;
476
+ value: string;
477
+ })[];
478
+ }[];
479
+ output: {
480
+ lendingRate: string;
481
+ supplyRate: string;
482
+ };
483
+ blockId: number;
484
+ image: string;
485
+ };
486
+ BORROWING_RATES: {
487
+ name: string;
488
+ description: string;
489
+ type: number;
490
+ prototype: string;
491
+ method: string;
492
+ parameters: Parameter[];
493
+ examples: {
494
+ name: string;
495
+ description: string;
496
+ parameters: ({
497
+ key: string;
498
+ value: number;
499
+ } | {
500
+ key: string;
501
+ value: string;
502
+ })[];
503
+ }[];
504
+ output: {
505
+ borrowingRate: string;
506
+ borrowRate: string;
398
507
  };
399
508
  blockId: number;
400
509
  image: string;
@@ -410,7 +519,6 @@ export declare const TRIGGERS: {
410
519
  name: string;
411
520
  description: string;
412
521
  type: number;
413
- contractAddress: string;
414
522
  output: {
415
523
  sender: string;
416
524
  inputAmount: string;
@@ -626,7 +734,6 @@ export declare const ACTIONS: {
626
734
  name: string;
627
735
  description: string;
628
736
  type: number;
629
- contractAddress: string;
630
737
  requiredApprovals: {
631
738
  address: string;
632
739
  amount: string;
@@ -1038,6 +1145,17 @@ export declare const ACTIONS: {
1038
1145
  contractAddress: string;
1039
1146
  amount: string;
1040
1147
  }[];
1148
+ examples: {
1149
+ name: string;
1150
+ description: string;
1151
+ parameters: ({
1152
+ key: string;
1153
+ value: number;
1154
+ } | {
1155
+ key: string;
1156
+ value: string;
1157
+ })[];
1158
+ }[];
1041
1159
  output: {
1042
1160
  transactionHash: string;
1043
1161
  };
@@ -1055,6 +1173,17 @@ export declare const ACTIONS: {
1055
1173
  type: number;
1056
1174
  method: string;
1057
1175
  parameters: Parameter[];
1176
+ examples: {
1177
+ name: string;
1178
+ description: string;
1179
+ parameters: ({
1180
+ key: string;
1181
+ value: number;
1182
+ } | {
1183
+ key: string;
1184
+ value: string;
1185
+ })[];
1186
+ }[];
1058
1187
  output: {
1059
1188
  transactionHash: string;
1060
1189
  amountWithdrawn: string;
@@ -1064,6 +1193,12 @@ export declare const ACTIONS: {
1064
1193
  label: string[];
1065
1194
  labelNotAuthorized: string[];
1066
1195
  };
1196
+ checks: {
1197
+ type: number;
1198
+ chainId: string;
1199
+ contractAddress: string;
1200
+ amount: string;
1201
+ }[];
1067
1202
  blockId: number;
1068
1203
  image: string;
1069
1204
  };
@@ -1110,6 +1245,17 @@ export declare const ACTIONS: {
1110
1245
  };
1111
1246
  };
1112
1247
  }[];
1248
+ examples: {
1249
+ name: string;
1250
+ description: string;
1251
+ parameters: ({
1252
+ key: string;
1253
+ value: number;
1254
+ } | {
1255
+ key: string;
1256
+ value: string;
1257
+ })[];
1258
+ }[];
1113
1259
  blockId: number;
1114
1260
  image: string;
1115
1261
  };
@@ -1119,6 +1265,17 @@ export declare const ACTIONS: {
1119
1265
  type: number;
1120
1266
  method: string;
1121
1267
  parameters: Parameter[];
1268
+ examples: {
1269
+ name: string;
1270
+ description: string;
1271
+ parameters: ({
1272
+ key: string;
1273
+ value: number;
1274
+ } | {
1275
+ key: string;
1276
+ value: string;
1277
+ })[];
1278
+ }[];
1122
1279
  requiredApprovals: never[];
1123
1280
  output: {
1124
1281
  transactionHash: string;
@@ -1143,6 +1300,17 @@ export declare const ACTIONS: {
1143
1300
  type: number;
1144
1301
  method: string;
1145
1302
  parameters: Parameter[];
1303
+ examples: {
1304
+ name: string;
1305
+ description: string;
1306
+ parameters: ({
1307
+ key: string;
1308
+ value: number;
1309
+ } | {
1310
+ key: string;
1311
+ value: string;
1312
+ })[];
1313
+ }[];
1146
1314
  requiredApprovals: never[];
1147
1315
  output: {
1148
1316
  transactionHash: string;
@@ -1167,6 +1335,17 @@ export declare const ACTIONS: {
1167
1335
  contractAddress: string;
1168
1336
  amount: string;
1169
1337
  }[];
1338
+ examples: {
1339
+ name: string;
1340
+ description: string;
1341
+ parameters: ({
1342
+ key: string;
1343
+ value: number;
1344
+ } | {
1345
+ key: string;
1346
+ value: string;
1347
+ })[];
1348
+ }[];
1170
1349
  requiredApprovals: {
1171
1350
  address: string;
1172
1351
  amount: string;
@@ -1200,6 +1379,85 @@ export declare const ACTIONS: {
1200
1379
  image: string;
1201
1380
  };
1202
1381
  };
1382
+ COMPOUND: {
1383
+ description: string;
1384
+ chains: number[];
1385
+ image: string;
1386
+ DEPOSIT: {
1387
+ name: string;
1388
+ description: string;
1389
+ type: number;
1390
+ method: string;
1391
+ parameters: Parameter[];
1392
+ examples: {
1393
+ name: string;
1394
+ description: string;
1395
+ parameters: ({
1396
+ key: string;
1397
+ value: number;
1398
+ } | {
1399
+ key: string;
1400
+ value: string;
1401
+ })[];
1402
+ }[];
1403
+ checks: {
1404
+ type: number;
1405
+ chainId: string;
1406
+ contractAddress: string;
1407
+ amount: string;
1408
+ }[];
1409
+ requiredApprovals: {
1410
+ address: string;
1411
+ amount: string;
1412
+ to: string;
1413
+ }[];
1414
+ output: {
1415
+ transactionHash: string;
1416
+ };
1417
+ permissions: {
1418
+ approvedTargets: string[];
1419
+ label: string[];
1420
+ labelNotAuthorized: string[];
1421
+ };
1422
+ blockId: number;
1423
+ image: string;
1424
+ };
1425
+ WITHDRAW: {
1426
+ name: string;
1427
+ description: string;
1428
+ type: number;
1429
+ method: string;
1430
+ parameters: Parameter[];
1431
+ checks: {
1432
+ type: number;
1433
+ chainId: string;
1434
+ contractAddress: string;
1435
+ amount: string;
1436
+ }[];
1437
+ examples: {
1438
+ name: string;
1439
+ description: string;
1440
+ parameters: ({
1441
+ key: string;
1442
+ value: number;
1443
+ } | {
1444
+ key: string;
1445
+ value: string;
1446
+ })[];
1447
+ }[];
1448
+ requiredApprovals: never[];
1449
+ output: {
1450
+ transactionHash: string;
1451
+ };
1452
+ permissions: {
1453
+ approvedTargets: string[];
1454
+ label: string[];
1455
+ labelNotAuthorized: string[];
1456
+ };
1457
+ blockId: number;
1458
+ image: string;
1459
+ };
1460
+ };
1203
1461
  };
1204
1462
  SWAP: {
1205
1463
  ODOS: {
@@ -1210,7 +1468,6 @@ export declare const ACTIONS: {
1210
1468
  name: string;
1211
1469
  description: string;
1212
1470
  type: number;
1213
- contractAddress: string;
1214
1471
  requiredApprovals: {
1215
1472
  address: string;
1216
1473
  amount: string;
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.0.6";
1
+ export declare const SDK_VERSION = "2.0.8";
2
2
  export declare function compareVersions(v1: string, v2: string): number;
@@ -11,6 +11,7 @@ export * from './models/conditions/ConditionGroup.js';
11
11
  export * from './models/Parameter.js';
12
12
  export * from './models/Trigger.js';
13
13
  export * from './models/Node.js';
14
+ export * from './models/Note.js';
14
15
  export * from './models/Edge.js';
15
16
  export * from './models/SessionKeyPermission.js';
16
17
  export * from './models/Authorization.js';
@@ -3,11 +3,16 @@ export declare class Note {
3
3
  id: string;
4
4
  text: string;
5
5
  position: Position;
6
- constructor(text: string, position: Position);
6
+ constructor(text: string, position: Position, id?: string);
7
7
  setPosition(x: number, y: number): void;
8
8
  toJSON(): {
9
9
  id: string;
10
10
  text: string;
11
11
  position: Position;
12
12
  };
13
+ static fromJSON(json: {
14
+ id: string;
15
+ text: string;
16
+ position: Position;
17
+ }): Note;
13
18
  }
@@ -11,7 +11,7 @@ declare class ApiServices {
11
11
  token: any;
12
12
  }>;
13
13
  verifyToken(token: string): Promise<any>;
14
- getWorkflowsOfUser(offset?: number, limit?: number): Promise<any>;
14
+ getWorkflowsOfUser(offset?: number, limit?: number, isActive?: boolean, query?: string): Promise<any>;
15
15
  getSessionKeyPermissions(workflowId: string): Promise<any>;
16
16
  }
17
17
  export declare const apiServices: ApiServices;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
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",