| Crates.io | glin-forge |
| lib.rs | glin-forge |
| version | 0.2.1 |
| created_at | 2025-10-05 13:41:45.023551+00 |
| updated_at | 2025-10-10 08:27:10.800275+00 |
| description | Smart contract development CLI for GLIN Network - Build, deploy, and interact with ink! smart contracts |
| homepage | https://glinforge.com |
| repository | https://github.com/glin-ai/glin-forge |
| max_upload_size | |
| id | 1869062 |
| size | 1,967,091 |
Smart contract development CLI for GLIN Network
glin-forge is the official command-line tool for developing, deploying, and interacting with ink! smart contracts on the GLIN Network. Inspired by tools like GitHub CLI (gh) and Hardhat, it provides a seamless developer experience for blockchain development.
cargo install glin-forge
git clone https://github.com/glin-ai/glin-forge
cd glin-forge
cargo install --path .
Download pre-built binaries from GitHub Releases:
cargo install cargo-contract --force# Create from ERC20 template
glin-forge new my-token --template erc20
cd my-token
glin-forge build
glin-forge deploy \
--network testnet \
--account alice
# Query (read-only, no gas)
glin-forge query 5ContractAddr... balanceOf 5Account...
# Call (transaction, costs gas)
glin-forge call 5ContractAddr... transfer 5Recipient... 1000 \
--account alice
glin-forge typegen --output ./frontend/src/types
glin-forge buildCompile the ink! smart contract.
glin-forge build [OPTIONS]
Options:
-p, --path <PATH> Path to contract project [default: .]
--release Build in release mode
--verify Verify contract after building
glin-forge deployDeploy contract to a network.
glin-forge deploy [OPTIONS]
Options:
-w, --wasm <WASM> Path to WASM file
-m, --metadata <METADATA> Path to metadata JSON
-c, --args <ARGS> Constructor arguments (comma-separated)
-v, --value <VALUE> Value to send (in GLIN) [default: 0]
-n, --network <NETWORK> Network [default: testnet]
-a, --account <ACCOUNT> Deploying account
-g, --gas-limit <GAS_LIMIT> Gas limit override
--salt <SALT> Salt for deterministic deployment
-y, --yes Skip confirmation prompt
glin-forge queryQuery contract state (read-only).
glin-forge query <ADDRESS> <METHOD> [ARGS]...
Arguments:
<ADDRESS> Contract address
<METHOD> Method name
[ARGS]... Method arguments
Options:
-n, --network <NETWORK> Network [default: testnet]
-m, --metadata <METADATA> Path to contract metadata
--json Output as JSON
Example:
glin-forge query 5GrwvaEF... balanceOf 5Account... --json
glin-forge callExecute contract transaction (state-changing).
glin-forge call <ADDRESS> <METHOD> [ARGS]...
Arguments:
<ADDRESS> Contract address
<METHOD> Method name
[ARGS]... Method arguments
Options:
-n, --network <NETWORK> Network [default: testnet]
-a, --account <ACCOUNT> Calling account
-v, --value <VALUE> Value to send [default: 0]
-m, --metadata <METADATA> Path to contract metadata
-g, --gas-limit <GAS_LIMIT> Gas limit override
-y, --yes Skip confirmation
--wait Wait for finalization
Example:
glin-forge call 5GrwvaEF... transfer 5Recipient... 1000 \
--account alice \
--network testnet \
--wait
glin-forge typegenGenerate TypeScript types from contract ABI.
glin-forge typegen [OPTIONS]
Options:
-a, --abi <ABI> Path to ABI JSON
-c, --contract <CONTRACT> Contract address (fetch ABI from chain)
-o, --output <OUTPUT> Output directory [default: ./types]
-n, --network <NETWORK> Network [default: testnet]
--hooks Generate React hooks
Example:
# Generate from local ABI
glin-forge typegen --abi ./target/ink/metadata.json --output ./frontend/src/types
# Generate with React hooks
glin-forge typegen --abi ./target/ink/metadata.json --hooks
Generated Output:
// Generated TypeScript interface
export interface MyTokenContract {
query: {
balanceOf: (account: string) => Promise<bigint>
totalSupply: () => Promise<bigint>
}
tx: {
transfer: (to: string, amount: bigint) => Promise<TxResult>
approve: (spender: string, amount: bigint) => Promise<TxResult>
}
}
glin-forge uploadUpload WASM code without instantiation.
glin-forge upload --wasm contract.wasm --account alice
glin-forge instantiateInstantiate contract from uploaded code hash.
glin-forge instantiate <CODE_HASH> --account alice --args 1000000
glin-forge watchWatch contract events in real-time.
glin-forge watch 5ContractAddr... Transfer --follow
glin-forge verifyVerify contract on block explorer.
glin-forge verify 5ContractAddr... \
--wasm contract.wasm \
--metadata metadata.json \
--network testnet
glin-forge configManage network and account configuration.
# Set network RPC
glin-forge config set-network mainnet wss://rpc.glin.network
# Set default account
glin-forge config set-account alice
# View configuration
glin-forge config show
glin-forge networkManage networks.
# List networks
glin-forge network list
# Add custom network
glin-forge network add custom wss://my-node.com
# Switch network
glin-forge network use testnet
glin-forge accountManage accounts.
# Import account
glin-forge account import alice --keystore ./alice.json
# List accounts
glin-forge account list
# Export account
glin-forge account export alice
glin-forge balanceCheck account balance.
glin-forge balance 5GrwvaEF... --network testnet
Create glin-forge.toml in your project root:
[project]
name = "my-token"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
[contract]
path = "./lib.rs"
output = "./target/ink"
[networks.testnet]
rpc = "wss://testnet.glin.network"
explorer = "https://explorer-testnet.glin.network"
[networks.mainnet]
rpc = "wss://rpc.glin.network"
explorer = "https://explorer.glin.network"
[accounts]
alice = { keystore = "~/.glin/keystore/alice.json" }
Available contract templates:
Create from template:
glin-forge new my-project --template erc20
# 1. Create new contract
glin-forge new my-token --template erc20
cd my-token
# 2. Build contract
glin-forge build --release
# 3. Deploy to testnet
glin-forge deploy \
--network testnet \
--account alice \
--args "1000000,MyToken,MTK" \
--value 1
# 4. Query total supply
glin-forge query <CONTRACT_ADDR> totalSupply
# 5. Transfer tokens
glin-forge call <CONTRACT_ADDR> transfer <RECIPIENT> 100 \
--account alice \
--wait
# 6. Generate TypeScript types
glin-forge typegen --output ./frontend/src/contracts
After generating types:
import { useMyToken } from './contracts/useMyToken'
import { useContractTx } from '@glin-ai/sdk-react'
function TransferButton() {
const { contract } = useMyToken('5ContractAddress...')
const { execute, loading } = useContractTx({
contract,
method: 'transfer'
})
const handleTransfer = async () => {
await execute('5Recipient...', 1000n)
}
return (
<button onClick={handleTransfer} disabled={loading}>
Transfer
</button>
)
}
Pre-configured networks:
| Network | RPC | Explorer |
|---|---|---|
| testnet | wss://testnet.glin.network |
https://explorer-testnet.glin.network |
| mainnet | wss://rpc.glin.network |
https://explorer.glin.network |
| local | ws://localhost:9944 |
- |
cargo install cargo-contract --force
Check your network configuration:
glin-forge config show
Test RPC connection:
glin-forge balance 5GrwvaEF... --network testnet
Manually specify gas limit:
glin-forge call ... --gas-limit 5000000000
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
# Clone repository
git clone https://github.com/glin-ai/glin-forge
cd glin-forge
# Build
cargo build
# Run tests
cargo test
# Install locally
cargo install --path .
Apache-2.0 - see LICENSE for details.
Built with ❤️ by the GLIN team