polyforge v0.1.1
PolyForge
š ļø A powerful CLI tool for Polygon and Ethereum developers, streamlining the process of deploying, interacting with, and testing smart contracts on various networks including Polygon (PoS), zkEVM, and Ethereum testnets.
Features
- š Secure key management with encryption
- š Support for multiple networks (Polygon PoS, zkEVM, Ethereum)
- š Simple contract deployment and interaction
- ā” Fast and efficient testing tools
- š Easy network switching
- āļø Configurable RPC endpoints
Requirements
- Node.js 14.x or higher
- npm 6.x or higher
- A wallet with test tokens for contract deployment
Quick Start
# Install globally
npm install -g polyforge
# Check current network
polyforge network
# Add your private key (encrypted)
polyforge key add default
# Deploy a contract
polyforge deploy ./contracts/MyContract.json -n sepolia
# Interact with contract
polyforge interact <contract-address> ./contracts/MyContract.json getValue
Documentation
Installation
npm install -g polyforge
To update an existing installation:
npm update -g polyforge
To verify the installation:
polyforge --version
Setup
After installation, you need to set up your configuration and add your private keys:
- Run
polyforge network
to view your current network configuration. - Add your private key:
You will be prompted to enter your private key securely. The key will be encrypted and stored safely.polyforge key add default
Important: Never share or commit your private keys. The key management system securely encrypts your keys.
Usage
Deploy
Deploy a smart contract to the network:
polyforge deploy ./path/to/YourContract.json -n network -k keyname
Options:
-n, --network <network>
: Specify the network (pos, amoy, zkevm, zkevm_testnet, sepolia)-k, --key <keyName>
: Specify the key to use for deployment (default: "default")
Example:
polyforge deploy ./contracts/MyToken.json -n sepolia -k default
Interact
Interact with a deployed contract:
polyforge interact <contractAddress> ./path/to/ContractABI.json <methodName> [params...]
Examples:
# Read contract state
polyforge interact 0x1234...5678 ./MyToken.json balanceOf 0xabcd...efgh
# Write to contract
polyforge interact 0x1234...5678 ./MyToken.json transfer 0xabcd...efgh 1000
The tool will automatically wait for write transactions to be mined and confirm their success.
Networks
Available networks:
- Polygon Mainnet:
pos
- Polygon zkEVM:
zkevm
- Polygon Amoy Testnet:
amoy
- Polygon zkEVM Testnet:
zkevm_testnet
- Ethereum Sepolia:
sepolia
Switch networks using:
polyforge switch <network>
Configuration
Configuration file location: ~/.polyforge/config.json
Default RPC endpoints are provided, but you can customize them:
{
"currentNetwork": "sepolia",
"networks": {
"sepolia": {
"rpcUrl": "https://rpc.sepolia.org",
"chainId": 11155111
}
}
}
Security
PolyForge takes security seriously:
- š Private keys are never stored in plain text
- š Keys are encrypted with a password you provide
- š No sensitive data in environment files
- ā Automatic gitignore for sensitive files
Support
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
MIT Ā© Your Name