Configuration
Actions are configured in tenderly.yaml file. If you initialized the actions project using tenderly actions init, this file is already created.
1
# We'll only focus on the actions section of tenderly.yaml.
2
actions:
3
# This is a project identifier. You can have multiple actions project
4
# in the same directory, just run tenderly actions init again and choose
5
# a different project and different source directory.
6
tenderly/actions-example:
7
# Runtime version. Currently, only v1 is supported and represents Node 14.
8
runtime: v1
9
# This is a path to the directory with implementation. You can change this, but
10
# you must rename the directory as well. This path is relative to the location of
11
# tenderly.yaml file.
12
sources: actions
13
# Following is a list of actions for this project.
14
# "specs" is a map from action name to action configuration.
15
# To add a new action, just add an entry to the specs map.
16
specs:
17
# This is the action name. Action name must be unique in the project.
18
# If an action with the same name is created, it will override the existing action.
19
# If the action is renamed, a new action will be created.
20
# If you want to delete the action, you must do it through the dashboard.
21
blockHelloWorld:
22
# Optional description. Visible in the dashboard.
23
description: This is just an example, but you can publish this action.
24
# This is a function locator.
25
# First part of locator defines a file, relative
26
# to configured sources directory, in this case actions/block.{ts|js}.
27
# The file location is a path, so if you have src/ directory inside actions
28
# this might be src/block:blockHelloWorldFn
29
# Second part of the locator is the function name.
30
# The function must be exported from specified file.
31
function: block:blockHelloWorldFn
32
# This is a trigger configuration. Triggers are covered in the next section.
33
trigger:
34
# Trigger must have a type, which is one of
35
# {transaction, block, periodic, webhook}.
36
type: block
37
# In this case, a trigger is not configured, just a type is selected.
38
# To configure a block trigger, we must add a block section here. More
39
# about configuring triggers in the next section.
40
# An example of second action configuration in the same project.
41
anotherBlockHelloWorld:
42
# You can reuse same function in multiple actions.
43
function: block:blockHelloWorldfn
44
trigger:
45
type: block
46
# This is block trigger configuration. See Triggers section for
47
# details on this and configuration of other trigger types.
48
block:
49
network: 1
50
blocks: 100
51
โ€‹
Copied!
You can not specify multiple triggers for action. But you can reuse the function for multiple actions! Reusing function in actions with different trigger types is discouraged.
โ€‹
Next, we are going to describe how to configure a trigger for your action.
Last modified 29d ago
Copy link