Integrate ArcNames
into your app
Resolve human-readable .arc names to wallet addresses with a single contract read. No API keys, no backend — just onchain.
Forward resolve
name → address
Reverse lookup
address → name
Domain info
owner, expiry, status
Resolve a name to an address
Given a .arc name, get the wallet address it points to. Use viem for a clean TypeScript experience.
import { createPublicClient, http } from 'viem'
import { defineChain } from 'viem'
const arcTestnet = defineChain({
id: 5042002,
name: 'Arc',
nativeCurrency: { name: 'USDC', symbol: 'USDC', decimals: 18 },
rpcUrls: { default: { http: ['https://rpc.testnet.arc.network'] } },
})
const client = createPublicClient({ chain: arcTestnet, transport: http() })
const ABI = [
{
name: 'resolve',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'name', type: 'string' }],
outputs: [{ type: 'address' }],
},
] as const
// Resolve a .arc name → wallet address
const address = await client.readContract({
address: '0x1975252e53f342a40D6D22403b7E5D1e0d2a7F1f',
abi: ABI,
functionName: 'resolve',
args: ['yourname'], // without .arc
})
console.log(address) // 0xabc...Reverse lookup — address to name
Show a .arc name instead of a raw 0x address in your UI. Falls back gracefully if the user has no name set.
const ABI = [
{
name: 'reverseLookup',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'wallet', type: 'address' }],
outputs: [{ type: 'string' }],
},
] as const
// Reverse lookup: wallet address → .arc name
const name = await client.readContract({
address: '0x1975252e53f342a40D6D22403b7E5D1e0d2a7F1f',
abi: ABI,
functionName: 'reverseLookup',
args: ['0xYourWalletAddress'],
})
console.log(name ? `${name}.arc` : 'No name set')Using wagmi in React
If your app already uses wagmi, plug in useReadContract directly. No extra setup needed.
import { useReadContract } from 'wagmi'
const ABI = [
{
name: 'resolve',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'name', type: 'string' }],
outputs: [{ type: 'address' }],
},
{
name: 'reverseLookup',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'wallet', type: 'address' }],
outputs: [{ type: 'string' }],
},
] as const
// In your React component:
// Resolve name → address
const { data: address } = useReadContract({
address: '0x1975252e53f342a40D6D22403b7E5D1e0d2a7F1f',
abi: ABI,
functionName: 'resolve',
args: ['sukanto'],
})
// Reverse lookup: address → name
const { data: arcName } = useReadContract({
address: '0x1975252e53f342a40D6D22403b7E5D1e0d2a7F1f',
abi: ABI,
functionName: 'reverseLookup',
args: [userAddress],
query: { enabled: !!userAddress },
})
// Display: show name if available, fallback to address
const displayName = arcName ? `${arcName}.arc` : shortenAddress(userAddress)Using ethers.js
Prefer ethers? The contract reads work identically — just swap in your provider.
import { ethers } from 'ethers'
const provider = new ethers.JsonRpcProvider('https://rpc.testnet.arc.network')
const ABI = [
'function resolve(string name) view returns (address)',
'function reverseLookup(address wallet) view returns (string)',
]
const contract = new ethers.Contract('0x1975252e53f342a40D6D22403b7E5D1e0d2a7F1f', ABI, provider)
// Resolve
const address = await contract.resolve('sukanto')
// Reverse
const name = await contract.reverseLookup('0xYourAddress')Full domain info
Need owner, expiry date, or active status? getDomainInfo returns everything in one call.
const ABI = [
{
name: 'getDomainInfo',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'name', type: 'string' }],
outputs: [{
type: 'tuple',
components: [
{ name: 'name', type: 'string' },
{ name: 'owner', type: 'address' },
{ name: 'resolvedAddress', type: 'address' },
{ name: 'expiry', type: 'uint256' },
{ name: 'active', type: 'bool' },
],
}],
},
] as const
const info = await client.readContract({
address: '0x1975252e53f342a40D6D22403b7E5D1e0d2a7F1f',
abi: ABI,
functionName: 'getDomainInfo',
args: ['sukanto'],
})
console.log(info.owner) // 0xabc...
console.log(info.active) // true
console.log(info.expiry) // Unix timestamp (BigInt)Network info
Using an AI agent or LLM?
Point your agent to our machine-readable reference — full ABI, code examples, and a ready-made system prompt snippet.
Questions or need help integrating?
Ask on X