Follow a step-by-step guide and a cheat sheet of CLI commands for initializing, building, and deploying Web3 Actions.
This guide shows the commands you need to initialize, build, and deploy a Web3 Action project using Tenderly CLI.
Step 1: Install the Tenderly CLI
curlcommand to download and install the Tenderly CLI binary on your local machine.
Install on macOS:
curl https://raw.githubusercontent.com/Tenderly/tenderly-cli/master/scripts/install-macos.sh | sh
Install on Linux:
curl https://raw.githubusercontent.com/Tenderly/tenderly-cli/master/scripts/install-linux.sh | sh
Step 2: Log in to Tenderly via the CLI
Log into the Tenderly CLI with your credentials by running this command:
Step 3: Initialize a Web3 Actions project
To initialize a Web3 Action project, run this command:
tenderly actions init
You can change the default initialization settings with two flags: change the name of the root Web3 Actions folder (default:
actions) and the language for writing Action functions (default:
tenderly actions init --sources=actions --language=typescript
You’ll be prompted to add your Web3 Actions to a Tenderly project. You can either create a new project or pick an existing one.
Step 3: Install any NPM dependency you need
tenderly init, you have an NPM project at your disposal, so you can install any NPM library you need in a familiar way.
npm i --save-dev axios ethers
Step 4: Build and deploy Web3 Actions
After you have written your function and trigger configuration in tenderly.yaml, you can run these commands to build and deploy the Web3 Action.
# run within the folder containing tenderly.yaml
# Build the project (optional)
tenderly actions build
# Publish the project to Tenderly without running it (start manually)
tenderly actions publish
# Deploy the project to Tenderly Runtime (or re-deploy any changes you make)
tenderly actions deploy
Shortly after running
publish, your Web3 Action is available in the Dashboard and listening to events per your configuration.
Optional: Using Tenderly Runtime locally
Assuming you're already in an npm project, run the following:
npm install @tenderly/actions-test