Example repository for web3 actions, accompanying tutorials and how-to guides.
To run these examples which deploy Web3 Actions, you need to have Tenderly CLI.
If you haven't already, install Tenderly CLI.
Before you go on, you need to login with CLI, using your Tenderly credentials:
tenderly loginFirst cd into an example you're interested in and cd actions. Then run npm i:
cd tic-tac-toe/actions
npm install
cd ..To build/deploy run, cd into example you're interested in and then run the CLI.
cd tic-tac-toe
tenderly build # stays on your machine
tenderly deploy # deploys and activates the actionAll examples were generated via
tenderly actions initEach example root has the following structure:
- It contains
tenderly.yaml - It contains relevant smart contracts and a corresponding JSON file (if any are present).
- It contains
actionsdirectory you'd get when you initialize Web3 Actions project using Tenderly CLIactionsis a node project (package.json)actionsis a typescript project (tsconfig.json)
- Examples use
ethers, which is an arbitrary decision.
What doesn't come out of the box with CLI setup is:
- Support for ethers.js or any other library, you need to add it yourself:
cd actions
npm install --save-dev axios ethers @types/node
cd ..- Importing contract's JSON file. You have to configure TS for this:
{
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "out",
"sourceMap": true,
"strict": true,
"target": "es2020",
+ "resolveJsonModule": true,
+ "esModuleInterop": true
},
"include": [
"**/*"
]
}