Purpose
This skill enables Claude to help users view, manage, and transfer NFTs (ERC721 and ERC1155 tokens) across EVM-compatible networks.
Supported Standards
- ERC721 - Standard NFTs (1 unique token per ID)
- ERC1155 - Multi-token standard (fungible + non-fungible in one contract)
Quick Start
Get NFT Information (ERC721)
import { createPublicClient, http } from 'viem'
import { bsc } from 'viem/chains'
const ERC721_ABI = [ { name: 'name', type: 'function', inputs: [], outputs: [{ name: '', type: 'string' }] }, { name: 'symbol', type: 'function', inputs: [], outputs: [{ name: '', type: 'string' }] }, { name: 'tokenURI', type: 'function', inputs: [{ name: 'tokenId', type: 'uint256' }], outputs: [{ name: '', type: 'string' }] }, { name: 'ownerOf', type: 'function', inputs: [{ name: 'tokenId', type: 'uint256' }], outputs: [{ name: '', type: 'address' }] } ]
const client = createPublicClient({ chain: bsc, transport: http() })
const nftAddress = '0x...' // NFT contract address const tokenId = 1234n
const [name, symbol, tokenURI, owner] = await Promise.all([ client.readContract({ address: nftAddress, abi: ERC721_ABI, functionName: 'name' }), client.readContract({ address: nftAddress, abi: ERC721_ABI, functionName: 'symbol' }), client.readContract({ address: nftAddress, abi: ERC721_ABI, functionName: 'tokenURI', args: [tokenId] }), client.readContract({ address: nftAddress, abi: ERC721_ABI, functionName: 'ownerOf', args: [tokenId] }) ])
console.log(Collection: ${name} (${symbol}))
console.log(Token URI: ${tokenURI})
console.log(Owner: ${owner})
### Transfer ERC721 NFT
```typescript
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { bsc } from 'viem/chains'
const ERC721_ABI = [
{
name: 'transferFrom',
type: 'function',
inputs: [
{ name: 'from', type: 'address' },
{ name: 'to', type: 'address' },
{ name: 'tokenId', type: 'uint256' }
],
outputs: []
},
{
name: 'safeTransferFrom',
type: 'function',
inputs: [
{ name: 'from', type: 'address' },
{ name: 'to', type: 'address' },
{ name: 'tokenId', type: 'uint256' }
],
outputs: []
}
]
const account = privateKeyToAccount('0x...')
const walletClient = createWalletClient({
account,
chain: bsc,
transport: http()
})
const hash = await walletClient.writeContract({
address: nftAddress,
abi: ERC721_ABI,
functionName: 'safeTransferFrom',
args: [account.address, '0xRecipient...', tokenId]
})
console.log('Transfer TX:', hash)
Transfer ERC1155 Token
const ERC1155_ABI = [
{
name: 'safeTransferFrom',
type: 'function',
inputs: [
{ name: 'from', type: 'address' },
{ name: 'to', type: 'address' },
{ name: 'id', type: 'uint256' },
{ name: 'amount', type: 'uint256' },
{ name: 'data', type: 'bytes' }
],
outputs: []
},
{
name: 'balanceOf',
type: 'function',
inputs: [
{ name: 'account', type: 'address' },
{ name: 'id', type: 'uint256' }
],
outputs: [{ name: '', type: 'uint256' }]
}
]
// Transfer 5 tokens of ID 1234
const hash = await walletClient.writeContract({
address: erc1155Address,
abi: ERC1155_ABI,
functionName: 'safeTransferFrom',
args: [account.address, '0xRecipient...', 1234n, 5n, '0x']
})
MCP Tools
| Tool | Description |
|---|---|
get_nft_info |
Get NFT details (name, symbol, URI, owner) |
get_erc1155_metadata |
Get ERC1155 token metadata |
transfer_nft |
Transfer an ERC721 NFT |
transfer_erc1155 |
Transfer ERC1155 tokens |
Common Operations
Check NFT Ownership
const owner = await client.readContract({
address: nftAddress,
abi: ERC721_ABI,
functionName: 'ownerOf',
args: [tokenId]
})
const isOwner = owner.toLowerCase() === myAddress.toLowerCase()
Get ERC1155 Balance
const balance = await client.readContract({
address: erc1155Address,
abi: ERC1155_ABI,
functionName: 'balanceOf',
args: [walletAddress, tokenId]
})
console.log(`You own ${balance} of token #${tokenId}`)
Fetch NFT Metadata
// Get token URI
const tokenURI = await client.readContract({
address: nftAddress,
abi: ERC721_ABI,
functionName: 'tokenURI',
args: [tokenId]
})
// If IPFS URI, convert to HTTP gateway
let metadataUrl = tokenURI
if (tokenURI.startsWith('ipfs://')) {
metadataUrl = tokenURI.replace('ipfs://', 'https://ipfs.io/ipfs/')
}
// Fetch metadata JSON
const response = await fetch(metadataUrl)
const metadata = await response.json()
console.log('Name:', metadata.name)
console.log('Description:', metadata.description)
console.log('Image:', metadata.image)
console.log('Attributes:', metadata.attributes)
Security Warnings
- Verify NFT authenticity - Check contract address on official sources
- Beware of scam NFTs - Don't interact with unknown airdrops
- Use safeTransferFrom - It checks if recipient can receive NFTs
- Double-check recipient - NFT transfers are irreversible
Popular NFT Marketplaces
- OpenSea (multi-chain)
- Blur (Ethereum)
- Element (BNB Chain)
- Magic Eden (multi-chain)