otomato-sdk 2.0.195 → 2.0.196
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 +1 -1
- package/dist/src/constants/WorkflowTemplates.js +24 -0
- package/dist/src/constants/version.js +1 -1
- package/dist/src/utils/typeValidator.js +11 -0
- package/dist/types/examples/General/Transfer/eth_transfer.d.ts +1 -0
- package/dist/types/src/constants/WorkflowTemplates.d.ts +8 -0
- package/dist/types/src/constants/version.d.ts +1 -1
- package/dist/types/src/utils/typeValidator.d.ts +1 -0
- package/package.json +1 -1
|
@@ -547,7 +547,7 @@ export const TRIGGERS = {
|
|
|
547
547
|
{
|
|
548
548
|
"key": "threshold",
|
|
549
549
|
"type": "float",
|
|
550
|
-
"description": "
|
|
550
|
+
"description": "This threshold is useful not to take into account events related to balance change due to gas related spending, spamming or micro payments.",
|
|
551
551
|
"category": 0,
|
|
552
552
|
"mandatory": true
|
|
553
553
|
},
|
|
@@ -192,6 +192,19 @@ const abstractGetNotifiedWhenStreamerIsLive = async () => {
|
|
|
192
192
|
const edge = new Edge({ source: trigger, target: telegramAction });
|
|
193
193
|
return new Workflow('Get notified when a given streamer goes live', [trigger, telegramAction], [edge]);
|
|
194
194
|
};
|
|
195
|
+
const createEthereumFoundationTransferNotificationWorkflow = () => {
|
|
196
|
+
const ethTransferTrigger = new Trigger(TRIGGERS.TOKENS.NATIVE_TRANSFER.ETH_TRANSFER);
|
|
197
|
+
ethTransferTrigger.setChainId(CHAINS.ETHEREUM);
|
|
198
|
+
ethTransferTrigger.setParams('wallet', '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe');
|
|
199
|
+
ethTransferTrigger.setParams('threshold', 0.004);
|
|
200
|
+
ethTransferTrigger.setPosition(400, 120);
|
|
201
|
+
const notificationAction = new Action(ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL);
|
|
202
|
+
notificationAction.setParams("body", `The Ethereum foundation has sold ${ethTransferTrigger.getOutputVariableName('amount')} ETH`);
|
|
203
|
+
notificationAction.setParams("subject", "Ethereum foundation sells ETH");
|
|
204
|
+
notificationAction.setPosition(400, 240);
|
|
205
|
+
const edge = new Edge({ source: ethTransferTrigger, target: notificationAction });
|
|
206
|
+
return new Workflow('Ethereum Foundation transfer notification', [ethTransferTrigger, notificationAction], [edge]);
|
|
207
|
+
};
|
|
195
208
|
export const WORKFLOW_TEMPLATES = [
|
|
196
209
|
{
|
|
197
210
|
'name': 'Get Notified When Ethereum Gas drops below 6 Gwei',
|
|
@@ -349,6 +362,17 @@ export const WORKFLOW_TEMPLATES = [
|
|
|
349
362
|
],
|
|
350
363
|
createWorkflow: abstractGetNotifiedWhenStreamerIsLive
|
|
351
364
|
},
|
|
365
|
+
{
|
|
366
|
+
name: 'When the Ethereum foundation sells ETH, notify me',
|
|
367
|
+
description: 'Notify me when the Ethereum foundation (0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe) sells ETH',
|
|
368
|
+
tags: [WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING, WORKFLOW_TEMPLATES_TAGS.NOTIFICATIONS, WORKFLOW_TEMPLATES_TAGS.TRADING],
|
|
369
|
+
thumbnail: 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/transfer-monitoring.png',
|
|
370
|
+
image: [
|
|
371
|
+
TRIGGERS.TOKENS.NATIVE_TRANSFER.ETH_TRANSFER.image,
|
|
372
|
+
ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL.image
|
|
373
|
+
],
|
|
374
|
+
createWorkflow: createEthereumFoundationTransferNotificationWorkflow
|
|
375
|
+
},
|
|
352
376
|
/*{
|
|
353
377
|
'name': 'Buy ETH when the market sentiment is extremely fearful',
|
|
354
378
|
'description': 'Buy ETH when the Bitcoin Fear and Greed Index is below 30',
|
|
@@ -45,6 +45,8 @@ export function validateType(expectedType, value) {
|
|
|
45
45
|
case 'paragraph':
|
|
46
46
|
case 'render_enum':
|
|
47
47
|
return typeof value === 'string';
|
|
48
|
+
case 'json':
|
|
49
|
+
return (typeof value === 'string' && isValidJson(value)) || (typeof value === 'object' && value !== null);
|
|
48
50
|
case 'logic_operator':
|
|
49
51
|
const validOperators = new Set(['gte', 'gt', 'lte', 'lt', 'eq', 'neq']);
|
|
50
52
|
return typeof value === 'string' && validOperators.has(value);
|
|
@@ -205,6 +207,15 @@ export function isValidPhoneNumber(value) {
|
|
|
205
207
|
export function isValidEmail(value) {
|
|
206
208
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
207
209
|
}
|
|
210
|
+
export function isValidJson(value) {
|
|
211
|
+
try {
|
|
212
|
+
JSON.parse(value);
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
catch (_) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
208
219
|
/**
|
|
209
220
|
* Checks if a string is numeric (represents a valid number).
|
|
210
221
|
* @param value - The string to check.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -24,4 +24,12 @@ export declare const WORKFLOW_TEMPLATES: ({
|
|
|
24
24
|
image: string[];
|
|
25
25
|
blockIDs: number[];
|
|
26
26
|
createWorkflow: () => Workflow;
|
|
27
|
+
} | {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
tags: string[];
|
|
31
|
+
thumbnail: string;
|
|
32
|
+
image: string[];
|
|
33
|
+
createWorkflow: () => Workflow;
|
|
34
|
+
blockIDs?: undefined;
|
|
27
35
|
})[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.196";
|
|
2
2
|
export declare function compareVersions(v1: string, v2: string): number;
|
|
@@ -12,6 +12,7 @@ export declare function isAddress(value: string): boolean;
|
|
|
12
12
|
export declare function isValidUrl(value: string): boolean;
|
|
13
13
|
export declare function isValidPhoneNumber(value: string): boolean;
|
|
14
14
|
export declare function isValidEmail(value: string): boolean;
|
|
15
|
+
export declare function isValidJson(value: string): boolean;
|
|
15
16
|
/**
|
|
16
17
|
* Checks if a string is numeric (represents a valid number).
|
|
17
18
|
* @param value - The string to check.
|