evm_approve_nft
Approve a spender to transfer a specific NFT or all NFTs in a collection. Use single-token approval for direct sales or operator approval so marketplace contracts can manage the collection.
Instructions
Approve address to spend specific NFT or operate on entire collection.
Two approval modes: single token (approve) or all tokens (setApprovalForAll). Single approval for specific sales. Operator approval for marketplace contracts to manage all NFTs.
CRITICAL RULES:
Must own NFT for single approval
Operator approval affects ALL NFTs in collection
Requires gas for transaction
Previous approvals overwritten
Revoke by approving zero address
Marketplace contracts need operator approval
PARAMETERS:
chain: EVM chain to execute on (required)
Must have gas in native token
contractAddress: NFT collection address (required)
Must be valid ERC721 contract
Format: "0x..." (42 characters)
spender: Address to approve (required)
Marketplace contract or buyer address
Format: "0x..." (42 characters)
tokenId: Token ID for single approval (optional)
Mutually exclusive with approveAll
Must own this token
approveAll: Approve all NFTs flag (optional)
Set true for operator approval
Mutually exclusive with tokenId
privateKey: Owner's private key (required)
Must own the NFT(s)
Format: "0x..." (64 hex characters)
EXAMPLES: ✅ Approve single NFT for sale: {chain: "polygon", contractAddress: "0x7227E4D7...", spender: "0x742d35Cc...", tokenId: "42", privateKey: "0xac0974..."}
✅ Approve marketplace as operator: {chain: "ethereum", contractAddress: "0xBC4CA0E...", spender: "0xMarketplace...", approveAll: true, privateKey: "0xac0974..."}
❌ Invalid - both tokenId and approveAll: {chain: "polygon", contractAddress: "0x7227E4D7...", spender: "0x742d35Cc...", tokenId: "42", approveAll: true, privateKey: "0xac0974..."}
SUPPORTED EVM CHAINS (7 networks): • ethereum (Sepolia) - EIP-1559 enabled, ~12s blocks, moderate gas costs • polygon (Amoy) - Low fees, fast finality (~2s), layer 2 • avalanche (Fuji C-Chain) - Sub-second finality, dynamic fees • bsc (BNB Testnet) - 3s blocks, low gas costs, Binance ecosystem • arbitrum (Sepolia) - Optimistic rollup, low fees, Ethereum security • base (Sepolia) - Coinbase layer 2, EIP-1559, low fees • worldchain (World Sepolia) - World Network testnet, EIP-1559
CRITICAL GAS CONSIDERATIONS:
Ethereum: High gas costs, use gas oracle for timing
Polygon/BSC: Very low gas, safe for frequent transactions
Arbitrum/Base: L2 optimizations, ~10-50x cheaper than Ethereum
Avalanche: Dynamic fees, can spike during congestion
Always check gas price before executing transactions
TESTNET TOKENS: All chains use testnet tokens with NO REAL VALUE. Faucets available for all supported networks.
OUTPUT STRUCTURE: • success: Approval confirmation • transactionHash: On-chain transaction hash • approvalType: "single" or "operator" • spender: Approved address • tokenId: Approved token (if single)
COMMON MISTAKES:
Using operator approval for single sale (unnecessary)
Not revoking operator approval after use
Approving without verifying spender address
Forgetting approval expires on transfer
USE CASES:
List NFT on marketplace
Enable marketplace to manage collection
Pre-approve buyer for direct sale
Grant operator rights to auction contract
Revoke previous approvals
Running on Linux.
LINUX-SPECIFIC NOTES:
Package manager: apt (Ubuntu/Debian), yum (RHEL/CentOS), or pacman (Arch)
Python 3 is typically 'python3' command
GNU tools are standard
Use 'xdg-open' command to open files/applications
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"chain": "<chain>",
"contractAddress": "<contractAddress>",
"spender": "<spender>",
"privateKey": "<privateKey>"
},
"name": "evm_approve_nft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | EVM chain to execute on | |
| spender | Yes | Spender address to approve (0x...) | |
| tokenId | No | Optional: Token ID for single token approval | |
| approveAll | No | Optional: Set true to approve all NFTs for operator | |
| privateKey | Yes | Owner private key (0x...) | |
| contractAddress | Yes | NFT contract address (0x...) |