otomato-sdk 1.2.0 → 1.2.1
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/examples/create-action.js +2 -2
- package/dist/examples/create-automation.js +2 -8
- package/dist/examples/create-trigger.js +2 -2
- package/dist/examples/sandbox.js +9 -0
- package/dist/src/constants/Blocks.js +379 -284
- package/dist/src/models/Node.js +11 -4
- package/dist/src/models/Trigger.js +6 -3
- package/dist/src/utils/typeValidator.js +2 -1
- package/dist/test/action.spec.js +19 -16
- package/dist/test/automation.spec.js +7 -6
- package/dist/test/node.spec.js +8 -12
- package/dist/test/trigger.spec.js +7 -2
- package/dist/test/typeValidator.spec.js +2 -1
- package/dist/types/examples/sandbox.d.ts +1 -0
- package/dist/types/src/constants/Blocks.d.ts +52 -14
- package/dist/types/src/models/Parameter.d.ts +1 -1
- package/dist/types/src/models/Trigger.d.ts +1 -0
- package/examples/create-action.ts +2 -2
- package/examples/create-automation.ts +2 -8
- package/examples/create-trigger.ts +2 -2
- package/examples/sandbox.ts +12 -0
- package/package.json +1 -1
- package/src/constants/Blocks.ts +379 -283
- package/src/models/Node.ts +10 -4
- package/src/models/Parameter.ts +1 -1
- package/src/models/Trigger.ts +8 -4
- package/src/utils/typeValidator.ts +2 -1
- package/test/action.spec.ts +10 -8
- package/test/automation.spec.ts +7 -6
- package/test/node.spec.ts +8 -12
- package/test/trigger.spec.ts +7 -2
- package/test/typeValidator.spec.ts +2 -1
- package/src/constants/json.json +0 -16
|
@@ -8,12 +8,12 @@ const createAction = () => {
|
|
|
8
8
|
transferAction.setContractAddress(getToken(CHAINS.ETHEREUM, 'USDC').contractAddress);
|
|
9
9
|
console.log(transferAction.toJSON());
|
|
10
10
|
// Create an SMS notification action
|
|
11
|
-
const smsAction = new Action(ACTIONS.NOTIFICATIONS.
|
|
11
|
+
const smsAction = new Action(ACTIONS.NOTIFICATIONS.DISCORD.SEND_MESSAGE);
|
|
12
12
|
smsAction.setParams("phoneNumber", "+1234567890");
|
|
13
13
|
smsAction.setParams("text", "This is a test message");
|
|
14
14
|
console.log(smsAction.toJSON());
|
|
15
15
|
// Create a Slack notification action
|
|
16
|
-
const slackAction = new Action(ACTIONS.NOTIFICATIONS.SLACK);
|
|
16
|
+
const slackAction = new Action(ACTIONS.NOTIFICATIONS.SLACK.SEND_MESSAGE);
|
|
17
17
|
slackAction.setParams("webhook", "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX");
|
|
18
18
|
slackAction.setParams("text", "This is a test message");
|
|
19
19
|
console.log(slackAction.toJSON());
|
|
@@ -20,15 +20,9 @@ const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
20
20
|
usdcTransferTrigger.setChainId(CHAINS.ETHEREUM);
|
|
21
21
|
usdcTransferTrigger.setContractAddress(getToken(CHAINS.ETHEREUM, 'USDC').contractAddress);
|
|
22
22
|
usdcTransferTrigger.setPosition(0, 0);
|
|
23
|
-
const slackAction = new Action(
|
|
24
|
-
id: ACTIONS.NOTIFICATIONS.SLACK.id,
|
|
25
|
-
name: ACTIONS.NOTIFICATIONS.SLACK.name,
|
|
26
|
-
description: ACTIONS.NOTIFICATIONS.SLACK.description,
|
|
27
|
-
parameters: ACTIONS.NOTIFICATIONS.SLACK.parameters,
|
|
28
|
-
// not forced to provide a ref id, it will generate it
|
|
29
|
-
});
|
|
23
|
+
const slackAction = new Action(ACTIONS.NOTIFICATIONS.SLACK.SEND_MESSAGE);
|
|
30
24
|
slackAction.setParams("webhook", "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX");
|
|
31
|
-
slackAction.setParams("
|
|
25
|
+
slackAction.setParams("message", "USDC has been transferred!");
|
|
32
26
|
slackAction.setPosition(0, -10);
|
|
33
27
|
const automation = new Automation("USDC Transfer Notification", [usdcTransferTrigger, slackAction]);
|
|
34
28
|
const edge = new Edge({
|
|
@@ -2,6 +2,6 @@ import { TRIGGERS, getToken, CHAINS, Trigger } from '../src/index.js';
|
|
|
2
2
|
const transferTrigger = new Trigger(TRIGGERS.TOKENS.ERC20.TRANSFER);
|
|
3
3
|
transferTrigger.setChainId(CHAINS.ETHEREUM);
|
|
4
4
|
// transferTrigger.setParams("value", 1000);
|
|
5
|
-
|
|
5
|
+
transferTrigger.setParams("to", "0xe1432599B51d9BE1b5A27E2A2FB8e5dF684749C6");
|
|
6
6
|
transferTrigger.setContractAddress(getToken(CHAINS.ETHEREUM, 'USDC').contractAddress);
|
|
7
|
-
console.log(transferTrigger.toJSON());
|
|
7
|
+
console.log(JSON.stringify(transferTrigger.toJSON(), null, 2));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TRIGGERS, getToken, CHAINS, Trigger } from '../src/index.js';
|
|
2
|
+
const trigger = new Trigger(TRIGGERS.PRICE_ACTION.ON_CHAIN_PRICE_MOVEMENT.PRICE_MOVEMENT_AGAINST_CURRENCY);
|
|
3
|
+
trigger.setChainId(CHAINS.MODE);
|
|
4
|
+
trigger.setComparisonValue(3200);
|
|
5
|
+
trigger.setCondition("gte");
|
|
6
|
+
trigger.setParams('currency', 'USD');
|
|
7
|
+
trigger.setParams('contractAddress', getToken(CHAINS.MODE, 'MODE').contractAddress);
|
|
8
|
+
trigger.setPosition(1, 0);
|
|
9
|
+
console.log(JSON.stringify(trigger.toJSON(), null, 2));
|