otomato-sdk 1.5.45 → 1.5.47
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.
|
@@ -669,7 +669,7 @@ export const TRIGGERS = {
|
|
|
669
669
|
34443,
|
|
670
670
|
1
|
|
671
671
|
],
|
|
672
|
-
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.
|
|
672
|
+
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.png",
|
|
673
673
|
"SWAP": {
|
|
674
674
|
"name": "Odos Swap",
|
|
675
675
|
"description": "Swap on Odos",
|
|
@@ -750,7 +750,7 @@ export const TRIGGERS = {
|
|
|
750
750
|
}
|
|
751
751
|
],
|
|
752
752
|
"blockId": 4,
|
|
753
|
-
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.
|
|
753
|
+
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.png"
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
},
|
|
@@ -1155,8 +1155,8 @@ export const ACTIONS = {
|
|
|
1155
1155
|
"chains": [
|
|
1156
1156
|
34443
|
|
1157
1157
|
],
|
|
1158
|
-
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/swap.png",
|
|
1159
1158
|
"SWAP": {
|
|
1159
|
+
"id": 100013,
|
|
1160
1160
|
"name": "Swap",
|
|
1161
1161
|
"description": "Swap two assets using the best market rates accross multiple pools",
|
|
1162
1162
|
"type": 1,
|
|
@@ -1223,7 +1223,7 @@ export const ACTIONS = {
|
|
|
1223
1223
|
"value": 1,
|
|
1224
1224
|
"mandatory": true,
|
|
1225
1225
|
"category": 1
|
|
1226
|
-
}
|
|
1226
|
+
}
|
|
1227
1227
|
],
|
|
1228
1228
|
"examples": [
|
|
1229
1229
|
{
|
|
@@ -1264,10 +1264,9 @@ export const ACTIONS = {
|
|
|
1264
1264
|
"labelNotAuthorized": [
|
|
1265
1265
|
"Transfer ETH"
|
|
1266
1266
|
]
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
}
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
"blockId": 100013
|
|
1271
1270
|
}
|
|
1272
1271
|
},
|
|
1273
1272
|
"NOTIFICATIONS": {
|
|
@@ -1393,7 +1392,7 @@ export const ACTIONS = {
|
|
|
1393
1392
|
"chains": [
|
|
1394
1393
|
34443
|
|
1395
1394
|
],
|
|
1396
|
-
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/
|
|
1395
|
+
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/Transfer.svg",
|
|
1397
1396
|
"TRANSFER": {
|
|
1398
1397
|
"name": "Transfer token",
|
|
1399
1398
|
"description": "Transfers an ERC20 token",
|
|
@@ -1480,7 +1479,7 @@ export const ACTIONS = {
|
|
|
1480
1479
|
]
|
|
1481
1480
|
},
|
|
1482
1481
|
"blockId": 100004,
|
|
1483
|
-
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/
|
|
1482
|
+
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/Transfer.svg"
|
|
1484
1483
|
}
|
|
1485
1484
|
}
|
|
1486
1485
|
},
|
|
@@ -1885,7 +1884,7 @@ export const ACTIONS = {
|
|
|
1885
1884
|
"chains": [
|
|
1886
1885
|
34443
|
|
1887
1886
|
],
|
|
1888
|
-
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.
|
|
1887
|
+
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.png",
|
|
1889
1888
|
"SWAP": {
|
|
1890
1889
|
"name": "Odos swap",
|
|
1891
1890
|
"description": "Swap on Odos to get the best market rates accross multiple pools",
|
|
@@ -1996,7 +1995,7 @@ export const ACTIONS = {
|
|
|
1996
1995
|
]
|
|
1997
1996
|
},
|
|
1998
1997
|
"blockId": 100005,
|
|
1999
|
-
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.
|
|
1998
|
+
"image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/odos.png"
|
|
2000
1999
|
}
|
|
2001
2000
|
}
|
|
2002
2001
|
},
|
|
@@ -45,7 +45,7 @@ const createETHFearAndGreedBuy = () => __awaiter(void 0, void 0, void 0, functio
|
|
|
45
45
|
const createETHFearAndGreedCapitalEfficientBuy = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
46
|
const trigger = new Trigger(TRIGGERS.SOCIALS.FEAR_AND_GREED.GET_FEAR_AND_GREED_INDEX);
|
|
47
47
|
trigger.setCondition('lt');
|
|
48
|
-
trigger.setComparisonValue(
|
|
48
|
+
trigger.setComparisonValue(45);
|
|
49
49
|
trigger.setPosition(400, 120);
|
|
50
50
|
const chain = CHAINS.MODE;
|
|
51
51
|
const tokenIn = 'USDC';
|
|
@@ -7,7 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { CHAINS } from "../constants/chains.js";
|
|
11
|
+
import { getToken, getTokenFromSymbol } from "../constants/tokens.js";
|
|
11
12
|
export class SessionKeyPermission {
|
|
12
13
|
constructor({ approvedTargets = [], label = [], labelNotAuthorized = [], } = {}) {
|
|
13
14
|
this.approvedTargets = approvedTargets;
|
|
@@ -31,22 +32,30 @@ export class SessionKeyPermission {
|
|
|
31
32
|
*/
|
|
32
33
|
fillBeforeVariables(beforeCode, parameters) {
|
|
33
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
console.log("filling before variable");
|
|
34
36
|
try {
|
|
35
|
-
// Prepare the
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// Prepare the otomatoSdk object with required functions
|
|
38
|
+
const otomatoSdk = {
|
|
39
|
+
getToken,
|
|
40
|
+
getTokenFromSymbol,
|
|
41
|
+
CHAINS
|
|
42
|
+
// Include any other functions you need from otomato-sdk
|
|
43
|
+
};
|
|
44
|
+
// Prepare the environment with parameters and otomatoSdk
|
|
45
|
+
const env = { parameters, otomatoSdk };
|
|
46
|
+
// Replace the dynamic import in beforeCode
|
|
47
|
+
const beforeCodeUpdated = beforeCode.replace(/const\s+otomatoSdk\s*=\s*await\s*import\(['"]otomato-sdk['"]\);/, 'const otomatoSdk = env.otomatoSdk;');
|
|
39
48
|
// Wrap the beforeCode in an async function and immediately invoke it
|
|
40
49
|
const asyncBeforeFn = new Function('env', `
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
return (async function() {
|
|
51
|
+
return await (${beforeCodeUpdated})(env);
|
|
52
|
+
})();
|
|
53
|
+
`);
|
|
45
54
|
// Execute the async function and await the result
|
|
46
55
|
const beforeResult = yield asyncBeforeFn(env);
|
|
47
56
|
// Replace placeholders like {{before.variableName}} with the corresponding values
|
|
48
57
|
if (beforeResult && typeof beforeResult === 'object') {
|
|
49
|
-
Object.keys(beforeResult).forEach(key => {
|
|
58
|
+
Object.keys(beforeResult).forEach((key) => {
|
|
50
59
|
this.fill(`before.${key}`, beforeResult[key]);
|
|
51
60
|
});
|
|
52
61
|
}
|
|
@@ -55,7 +64,7 @@ export class SessionKeyPermission {
|
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
66
|
catch (error) {
|
|
58
|
-
console.error(
|
|
67
|
+
console.error("Error executing before code:", error);
|
|
59
68
|
}
|
|
60
69
|
});
|
|
61
70
|
}
|
|
@@ -458,8 +458,8 @@ export declare const ACTIONS: {
|
|
|
458
458
|
SWAP: {
|
|
459
459
|
description: string;
|
|
460
460
|
chains: number[];
|
|
461
|
-
image: string;
|
|
462
461
|
SWAP: {
|
|
462
|
+
id: number;
|
|
463
463
|
name: string;
|
|
464
464
|
description: string;
|
|
465
465
|
type: number;
|
|
@@ -482,7 +482,34 @@ export declare const ACTIONS: {
|
|
|
482
482
|
tokenOut: string;
|
|
483
483
|
transactionHash: string;
|
|
484
484
|
};
|
|
485
|
-
parameters:
|
|
485
|
+
parameters: ({
|
|
486
|
+
key: string;
|
|
487
|
+
type: string;
|
|
488
|
+
description: string;
|
|
489
|
+
mandatory: boolean;
|
|
490
|
+
category: number;
|
|
491
|
+
erc20FormattedAmount?: undefined;
|
|
492
|
+
value?: undefined;
|
|
493
|
+
} | {
|
|
494
|
+
key: string;
|
|
495
|
+
type: string;
|
|
496
|
+
description: string;
|
|
497
|
+
mandatory: boolean;
|
|
498
|
+
category: number;
|
|
499
|
+
erc20FormattedAmount: {
|
|
500
|
+
contractAddress: string;
|
|
501
|
+
chain: string;
|
|
502
|
+
};
|
|
503
|
+
value?: undefined;
|
|
504
|
+
} | {
|
|
505
|
+
key: string;
|
|
506
|
+
type: string;
|
|
507
|
+
description: string;
|
|
508
|
+
value: number;
|
|
509
|
+
mandatory: boolean;
|
|
510
|
+
category: number;
|
|
511
|
+
erc20FormattedAmount?: undefined;
|
|
512
|
+
})[];
|
|
486
513
|
examples: {
|
|
487
514
|
name: string;
|
|
488
515
|
description: string;
|
|
@@ -499,9 +526,8 @@ export declare const ACTIONS: {
|
|
|
499
526
|
label: string[];
|
|
500
527
|
labelNotAuthorized: string[];
|
|
501
528
|
};
|
|
502
|
-
blockId: number;
|
|
503
|
-
image: string;
|
|
504
529
|
};
|
|
530
|
+
blockId: number;
|
|
505
531
|
};
|
|
506
532
|
};
|
|
507
533
|
NOTIFICATIONS: {
|