Skip to content

lens-protocol/lens-post-action-boilerplate

Repository files navigation

Lens Protocol Post Action Boilerplate

This repository contains a boilerplate for creating custom post actions for the Lens Protocol using Hardhat. The example implementation includes a simple boolean voting action (Yes/No polls).

Table of Contents

Requirements

  • Node.js: >= v20
  • Yarn: v3.2.4

Node.js

If you use nvm to manage your Node.js versions, you can run:

nvm use

to switch to the correct Node.js version.

See the installation guide for other ways to install Node.js.

Yarn

Enable Corepack, if it isn't already; this will add the Yarn binary to your PATH:

corepack enable

See the installation guide for other ways to install Yarn.

Initial Setup

Install dependencies:

yarn install

Create a .env file copying the .env.example file:

cp .env.example .env

Update the .env file with the correct values.

Usage

Metadata Configuration

The contract uses metadata stored on IPFS to describe the action's interface and parameters. The metadata is defined directly in the deployment script (deploy/deploy-simple-poll-vote-action.ts) and contains:

  • Action name and description
  • Author information
  • Source repository
  • Execution parameters with their types and keccak256 keys

The deployment script automatically uploads this metadata to IPFS when deploying the contract.

To update the metadata, modify the metadata object in the deployment script.

Compile

yarn compile

Clean

yarn clean

Lint

yarn lint

Test

Run tests on the Hardhat Network powered by a [ZKsync In-memory Node]((https://docs.zksync.io/build/test-and-debug/in-memory-node).

yarn test

To run tests on a specific network:

yarn test [--network <network-name>]

For example, to run tests on the lensTestnet network:

yarn test --network lensTestnet

Tip

zkSync In-memory Node currently supports only the L2 node. If contracts also need L1, use another testing environment like Dockerized Node.

Deploy

yarn deploy --script <deploy-script.ts> --network <network-name>

For example:

yarn deploy --script deploy-simple-poll-vote-action.ts --network lensTestnet

Networks

  • lensTestnet: Lens Development Network (37111).
  • hardhat: runs on a ZKsync In-Memory Node for testing.

License

Lens Protocol Post Action Boilerplate MIT licensed

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •