otomato-sdk 2.0.309 → 2.0.311

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.
@@ -6830,7 +6830,7 @@ export const TRIGGERS = {
6830
6830
  "image": "https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/blur.jpg",
6831
6831
  "LISTING": {
6832
6832
  "name": "NFT Listing",
6833
- "dynamicName": "async (env, { otomatoSDK }) => {\n const { getDynamicNameWrapperHTML, shortenAddress } = otomatoSDK;\n return getDynamicNameWrapperHTML(\n `On ${shortenAddress(env.parameters.contract)} listing`,\n `rarity ${getComparisonString(env.parameters.rarityCondition, env.parameters.rarity)}`,\n `${env.parameters.price ? `price > ${env.parameters.price}` : ''}`,\n );\n }",
6833
+ "dynamicName": "async (env, { otomatoSDK }) => {\n const { getDynamicNameWrapperHTML, shortenAddress, getComparisonString } = otomatoSDK;\n return getDynamicNameWrapperHTML(\n `On ${shortenAddress(env.parameters.contract)} listing`,\n `rarity ${getComparisonString(env.parameters.rarityCondition, env.parameters.rarity)}`,\n `${env.parameters.price ? `price > ${env.parameters.price}` : ''}`,\n );\n }",
6834
6834
  "description": "Subscribe to live NFT listing events based on filters.",
6835
6835
  "type": 5,
6836
6836
  "blockData": "\n async (env) => {\n const { parameters, fieldFunctionName, contract } = env;\n\n const PARAMETERS_TYPE = {\"BOOLEAN\":\"boolean\",\"INTEGER\":\"integer\",\"INT8\":\"int8\",\"INT16\":\"int16\",\"INT32\":\"int32\",\"INT64\":\"int64\",\"INT128\":\"int128\",\"INT256\":\"int256\",\"UINT8\":\"uint8\",\"UINT16\":\"uint16\",\"UINT32\":\"uint32\",\"UINT64\":\"uint64\",\"UINT128\":\"uint128\",\"UINT256\":\"uint256\",\"FLOAT\":\"float\",\"PERCENTAGE\":\"percentage\",\"FIXED\":\"fixed\",\"UFIXED\":\"ufixed\",\"ERC20\":\"erc20\",\"NFT_COLLECTION\":\"nftCollection\",\"ADDRESS\":\"address\",\"STRING\":\"string\",\"URL\":\"url\",\"PHONE_NUMBER\":\"phone_number\",\"EMAIL\":\"email\",\"PARAGRAPH\":\"paragraph\",\"ARRAY_OF_ADDRESSES\":\"addresses_array\",\"ARRAY_OF_STRINGS\":\"string_array\",\"ARRAY_OF_ARRAYS\":\"arrays_array\",\"RENDER_ENUM\":\"render_enum\",\"RENDER_JSON\":\"render_json\",\"CHAIN_ID\":\"chainId\",\"LOGIC_OPERATOR\":\"logic_operator\",\"AND_OR\":\"and_or\",\"CONDITION_GROUPS\":\"condition_groups\",\"MATH_OPERATORS\":\"string\",\"ANY\":\"any\",\"POLYMARKET\":\"polymarket\"};\n \n if (fieldFunctionName === 'renderJSONData') {\n try {\n const response = await fetch(`https://api.reservoir.tools/collections/${contract}/attributes/all/v1`);\n\n if (!response.ok) {\n console.error('Failed to fetch Blur traits');\n return [];\n }\n\n const data = await response.json();\n\n if (!data.attributes) {\n throw new Error('Invalid response from Blur API');\n }\n const traits = data.attributes;\n const traitJSONData = [];\n\n for (const trait of traits) {\n const traitValues = trait.values.map(value => value.value);\n traitJSONData.push({\n key: trait.key,\n type: PARAMETERS_TYPE.STRING,\n description: `The ${trait.key.toLowerCase()} of the NFT.`,\n enum: traitValues\n });\n }\n\n return {\n renderJSONData: {\n traits: traitJSONData,\n },\n };\n } catch (error) {\n throw new Error('Error fetching Blur traits: ' + error);\n }\n } else if (fieldFunctionName === 'totalSupply') {\n try {\n const response = await fetch(`https://api.reservoir.tools/collections/v7?id=${contract}`);\n const data = await response.json();\n return {\n totalSupply: data.collections[0].supply,\n };\n } catch (error) {\n throw new Error('Error fetching Blur total supply: ' + error);\n }\n }\n\n return null;\n }",
@@ -8,8 +8,40 @@ export const WORKFLOW_TEMPLATES_TAGS = {
8
8
  NOTIFICATIONS: 'Notifications',
9
9
  ABSTRACT: 'Abstract',
10
10
  DEXES: 'Dexes',
11
- LENDING: 'Lending'
11
+ LENDING: 'Lending',
12
+ IEXEC: 'Iexec'
12
13
  };
14
+ const yieldUpdateMessage = `Daily Yield Report 🚀
15
+
16
+ ------------------ USDC ------------------------
17
+
18
+ 📍 On Base
19
+ • IONIC: {{external.functions.ionicLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}%
20
+ • AAVE: {{external.functions.aaveLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}%
21
+ • Compound: {{external.functions.compoundLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,0)}}%
22
+ • Ironclad: {{external.functions.ironcladLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}%
23
+ • Moonwell: {{external.functions.moonwellLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}%
24
+
25
+ 📍 On Arbitrum
26
+ • AAVE: {{external.functions.aaveLendingRate(42161,0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8)}}%
27
+ • Compound: {{external.functions.compoundLendingRate(42161,0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8,0)}}%
28
+
29
+ ------------------ ETH ------------------------
30
+
31
+ 📍 On Base
32
+ • IONIC: {{external.functions.ionicLendingRate(8453,0x4200000000000000000000000000000000000006)}}%
33
+ • AAVE: {{external.functions.aaveLendingRate(8453,0x4200000000000000000000000000000000000006)}}%
34
+ • Compound: {{external.functions.compoundLendingRate(8453,0x4200000000000000000000000000000000000006,0)}}%
35
+ • Ironclad: {{external.functions.ironcladLendingRate(8453,0x4200000000000000000000000000000000000006)}}%
36
+ • Moonwell: {{external.functions.moonwellLendingRate(8453,0x4200000000000000000000000000000000000006)}}%
37
+
38
+ 📍 On Arbitrum
39
+ • AAVE: {{external.functions.aaveLendingRate(42161,0x82aF49447D8a07e3bd95BD0d56f35241523fBab1)}}%
40
+ • Compound: {{external.functions.compoundLendingRate(42161,0x82aF49447D8a07e3bd95BD0d56f35241523fBab1,0)}}%
41
+
42
+ The gas price on Ethereum is currently {{external.functions.mainnetGasPrice(,)}} gwei.
43
+
44
+ See you tomorrow!`;
13
45
  const createModeTransferNotificationWorkflow = () => {
14
46
  const cbBTCTransferTrigger = new Trigger(TRIGGERS.TOKENS.TRANSFER.TRANSFER);
15
47
  cbBTCTransferTrigger.setChainId(CHAINS.BASE);
@@ -147,29 +179,7 @@ const dailyYieldEmail = async () => {
147
179
  trigger.setParams('period', 86400000);
148
180
  trigger.setParams('limit', 30);
149
181
  const notificationAction = new Action(ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL);
150
- notificationAction.setParams("body", `Daily Yield Report 🚀
151
-
152
- ------------------ USDC ------------------------
153
-
154
- 📍 On Base
155
- • IONIC: {{external.functions.ionicLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}%
156
- • AAVE: {{external.functions.aaveLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}%
157
- • Compound: {{external.functions.compoundLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,0)}}%
158
- • Ironclad: {{external.functions.ironcladLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}%
159
- • Moonwell: {{external.functions.moonwellLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}%
160
-
161
- ------------------ ETH ------------------------
162
-
163
- 📍 On Base
164
- • IONIC: {{external.functions.ionicLendingRate(8453,0x4200000000000000000000000000000000000006)}}%
165
- • AAVE: {{external.functions.aaveLendingRate(8453,0x4200000000000000000000000000000000000006)}}%
166
- • Compound: {{external.functions.compoundLendingRate(8453,0x4200000000000000000000000000000000000006,0)}}%
167
- • Ironclad: {{external.functions.ironcladLendingRate(8453,0x4200000000000000000000000000000000000006)}}%
168
- • Moonwell: {{external.functions.moonwellLendingRate(8453,0x4200000000000000000000000000000000000006)}}%
169
-
170
- The gas price on Ethereum is currently {{external.functions.mainnetGasPrice(,)}} gwei.
171
-
172
- See you tomorrow!`);
182
+ notificationAction.setParams("body", yieldUpdateMessage);
173
183
  notificationAction.setParams("subject", "Daily yield updates");
174
184
  notificationAction.setPosition(400, 240);
175
185
  const edge = new Edge({ source: trigger, target: notificationAction });
@@ -549,6 +559,49 @@ const createMonitorHyperliquidFundingRatesWorkflow = () => {
549
559
  const workflow = new Workflow(`Save Hyperliquid hourly funding rates in a Google Sheet`, [trigger, gsheetAction], [edge]);
550
560
  return workflow;
551
561
  };
562
+ const createNFTSaleNotificationWorkflow = () => {
563
+ const trigger = new Trigger(TRIGGERS.NFTS.BLUR.NFT_SALE_TRIGGER);
564
+ trigger.setPosition(400, 120);
565
+ const telegramAction = new Action(ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE);
566
+ telegramAction.setParams('message', `New NFT sale detected on Blur: ${trigger.getOutputVariableName('message')}`);
567
+ telegramAction.setPosition(400, 360);
568
+ const edge1 = new Edge({ source: trigger, target: telegramAction });
569
+ const workflow = new Workflow('Get notified when a NFT is sold on Blur', [trigger, telegramAction], [edge1]);
570
+ return workflow;
571
+ };
572
+ const createPudgyPenguinsSaleNotificationWorkflow = () => {
573
+ const trigger = new Trigger(TRIGGERS.NFTS.BLUR.NFT_SALE_TRIGGER);
574
+ trigger.setParams('contract', '0xbd3531da5cf5857e7cfaa92426877b022e612cf8');
575
+ const telegramAction = new Action(ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE);
576
+ telegramAction.setParams('message', `New Pudgy Penguins sale detected on Blur: ${trigger.getOutputVariableName('message')}`);
577
+ const edge1 = new Edge({ source: trigger, target: telegramAction });
578
+ const workflow = new Workflow('Get notified when a Pudgy Penguins is sold on Blur', [trigger, telegramAction], [edge1]);
579
+ return workflow;
580
+ };
581
+ const createDailyHealthrateMonitoringWorkflow = () => {
582
+ // Trigger: every 24 hours (1 day)
583
+ const trigger = new Trigger(TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD);
584
+ trigger.setParams('period', 86400000); // 24 hours in milliseconds
585
+ trigger.setParams('limit', 90); // 90 days
586
+ // Action: send message to IexecTelegram
587
+ const telegramAction = new Action(ACTIONS.NOTIFICATIONS.IEXEC.SEND_WEB3_TELEGRAM);
588
+ telegramAction.setParams('content', `Your daily healthrate from Hyperbeat: {{external.functions.healthRatio(,0x1da89208e6cb5173e97a83461853b8400de4f7c37542cf010a10579a5f7ca451,,)}}`);
589
+ // Edges
590
+ const edge1 = new Edge({ source: trigger, target: telegramAction });
591
+ // Workflow
592
+ const workflow = new Workflow('Daily Hyperbeat healthrate monitoring', [trigger, telegramAction], [edge1]);
593
+ return workflow;
594
+ };
595
+ const dailyYieldIexecEmail = async () => {
596
+ const trigger = new Trigger(TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD);
597
+ trigger.setParams('period', 86400000);
598
+ trigger.setParams('limit', 30);
599
+ const notificationAction = new Action(ACTIONS.NOTIFICATIONS.IEXEC.SEND_WEB3MAIL);
600
+ notificationAction.setParams("content", yieldUpdateMessage);
601
+ notificationAction.setParams("subject", "Daily yield updates");
602
+ const edge = new Edge({ source: trigger, target: notificationAction });
603
+ return new Workflow('Daily yield updates', [trigger, notificationAction], [edge]);
604
+ };
552
605
  export const WORKFLOW_TEMPLATES = [
553
606
  {
554
607
  'id': 1,
@@ -1068,4 +1121,68 @@ export const WORKFLOW_TEMPLATES = [
1068
1121
  ],
1069
1122
  createWorkflow: createModeTransferNotificationWorkflow
1070
1123
  },
1124
+ {
1125
+ 'id': 36,
1126
+ 'name': 'Daily yield updates',
1127
+ 'description': 'Receive daily yield updates',
1128
+ 'tags': [WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING, WORKFLOW_TEMPLATES_TAGS.NOTIFICATIONS, WORKFLOW_TEMPLATES_TAGS.IEXEC],
1129
+ 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/dailyYieldUpdates.jpg',
1130
+ 'image': [
1131
+ TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD.image,
1132
+ ACTIONS.NOTIFICATIONS.IEXEC.SEND_WEB3MAIL.image
1133
+ ],
1134
+ 'blockIDs': [
1135
+ TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD.blockId,
1136
+ ACTIONS.NOTIFICATIONS.IEXEC.SEND_WEB3MAIL.blockId
1137
+ ],
1138
+ createWorkflow: dailyYieldIexecEmail
1139
+ },
1140
+ {
1141
+ 'id': 37,
1142
+ 'name': 'Daily Hyperbeat healthrate monitoring',
1143
+ 'description': 'Receive daily Hyperbeat healthrate monitoring on hbUSDT/USR market',
1144
+ 'tags': [WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING, WORKFLOW_TEMPLATES_TAGS.NOTIFICATIONS, WORKFLOW_TEMPLATES_TAGS.IEXEC],
1145
+ 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/hyperbeat.webp',
1146
+ 'image': [
1147
+ TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD.image,
1148
+ ACTIONS.NOTIFICATIONS.IEXEC.SEND_WEB3_TELEGRAM.image
1149
+ ],
1150
+ 'blockIDs': [
1151
+ TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD.blockId,
1152
+ ACTIONS.NOTIFICATIONS.IEXEC.SEND_WEB3_TELEGRAM.blockId
1153
+ ],
1154
+ createWorkflow: createDailyHealthrateMonitoringWorkflow
1155
+ },
1156
+ {
1157
+ 'id': 38,
1158
+ 'name': 'Get notified when a Pudgy Penguins is sold',
1159
+ 'description': 'Receive notifications when a Pudgy Penguins is sold',
1160
+ 'tags': [WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING, WORKFLOW_TEMPLATES_TAGS.NOTIFICATIONS, WORKFLOW_TEMPLATES_TAGS.NFTS],
1161
+ 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/pudgy_penguins.webp',
1162
+ 'image': [
1163
+ TRIGGERS.NFTS.BLUR.NFT_SALE_TRIGGER.image,
1164
+ ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE.image
1165
+ ],
1166
+ 'blockIDs': [
1167
+ TRIGGERS.NFTS.BLUR.NFT_SALE_TRIGGER.blockId,
1168
+ ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE.blockId
1169
+ ],
1170
+ createWorkflow: createPudgyPenguinsSaleNotificationWorkflow
1171
+ },
1172
+ {
1173
+ 'id': 39,
1174
+ 'name': 'Get notified when my NFT is sold',
1175
+ 'description': 'Receive notifications when my NFT is sold',
1176
+ 'tags': [WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING, WORKFLOW_TEMPLATES_TAGS.NOTIFICATIONS, WORKFLOW_TEMPLATES_TAGS.NFTS],
1177
+ 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/my_nft_sale.webp',
1178
+ 'image': [
1179
+ TRIGGERS.NFTS.BLUR.NFT_SALE_TRIGGER.image,
1180
+ ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE.image
1181
+ ],
1182
+ 'blockIDs': [
1183
+ TRIGGERS.NFTS.BLUR.NFT_SALE_TRIGGER.blockId,
1184
+ ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE.blockId
1185
+ ],
1186
+ createWorkflow: createNFTSaleNotificationWorkflow
1187
+ },
1071
1188
  ];
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = '2.0.309';
1
+ export const SDK_VERSION = '2.0.311';
2
2
  export function compareVersions(v1, v2) {
3
3
  // Split the version strings into parts
4
4
  const v1Parts = v1.split('.').map(Number);
@@ -9,6 +9,7 @@ export declare const WORKFLOW_TEMPLATES_TAGS: {
9
9
  ABSTRACT: string;
10
10
  DEXES: string;
11
11
  LENDING: string;
12
+ IEXEC: string;
12
13
  };
13
14
  export declare const WORKFLOW_TEMPLATES: ({
14
15
  id: number;
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.0.309";
1
+ export declare const SDK_VERSION = "2.0.311";
2
2
  export declare function compareVersions(v1: string, v2: string): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "2.0.309",
3
+ "version": "2.0.311",
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",