Skip to content

kanvgupta/simple-cast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChainView

A tool for sharing Foundry Cast commands with others.

Features

  • Share Cast commands via unique URLs
  • Group related commands into collections
  • Simple CLI tool for creating and managing commands

Getting Started

Installation

# Install globally from npm
npm install -g chainview

Create a Command

chainview submit "cast call --rpc-url=https://eth-mainnet.alchemyapi.io/v2/KEY 0xTOKEN 'function()' ARG" --title "My Command"

Create a Collection

chainview collection create "My Collection" --desc "Collection description"

Add a Command to a Collection

chainview collection add COLLECTION_ID "cast call ..." --title "New Command"

Self-Hosting

Installation

# Clone the repository
git clone https://github.com/kanvgupta/simple-cast.git
cd simple-cast

# Install dependencies
npm install

# Start the server
npm start

Environment Variables

Create a .env file with the following variables:

PORT=3000
DATABASE_URL=postgres://username:password@localhost:5432/chainview
NODE_ENV=production

Database Setup

The application uses PostgreSQL. Make sure you have it installed and running.

# Create a database
createdb chainview

The server will automatically create the necessary tables on startup.

API Endpoints

Commands

  • POST /api/commands - Create a command
  • GET /api/c/:id - View a command

Collections

  • POST /api/collections - Create a collection
  • GET /api/col/:id - View a collection
  • POST /api/collections/:id/commands - Add a command to a collection

Example Use Cases

ERC20 Collection

Create a collection of common ERC20 function calls:

# Create the collection
chainview collection create "ERC20 Functions" --desc "Common ERC20 token functions"

# Add balance check command
chainview collection add <collection-id> "cast call --rpc-url=https://eth-mainnet.alchemyapi.io/v2/KEY 0x6B175474E89094C44Da98b954EedeAC495271d0F 'balanceOf(address)' 0xWALLET" --title "Check DAI Balance"

# Add allowance check command
chainview collection add <collection-id> "cast call --rpc-url=https://eth-mainnet.alchemyapi.io/v2/KEY 0x6B175474E89094C44Da98b954EedeAC495271d0F 'allowance(address,address)' 0xOWNER 0xSPENDER" --title "Check DAI Allowance"

# Add total supply command
chainview collection add <collection-id> "cast call --rpc-url=https://eth-mainnet.alchemyapi.io/v2/KEY 0x6B175474E89094C44Da98b954EedeAC495271d0F 'totalSupply()'" --title "DAI Total Supply"

License

MIT

About

Github gist like Foundry Cast command sharing service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors