0.1.1 • Published 7 months ago

polyforge v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

PolyForge

npm version License: MIT PRs Welcome

šŸ› ļø 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:

  1. Run polyforge network to view your current network configuration.
  2. Add your private key:
    polyforge key add default
    You will be prompted to enter your private key securely. The key will be encrypted and stored safely.

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

0.1.1

7 months ago

0.1.0

11 months ago