import { createPublicClient, getContract, http, parseAbi } from 'viem'
import { mainnet } from 'viem/chains'
const publicClient = createPublicClient({
chain: mainnet,
transport: http(),
})
const contract = getContract({
address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
abi: parseAbi([
'function balanceOf(address owner) view returns (uint256)',
'function ownerOf(uint256 tokenId) view returns (address)',
'function totalSupply() view returns (uint256)',
]),
publicClient,
})
Generated using TypeDoc
Gets type-safe interface for performing contract-related actions with a specific
abi
andaddress
.Using Contract Instances can make it easier to work with contracts if you don't want to pass the
abi
andaddress
properites every time you perform contract actions, e.g.readContract
,writeContract
,estimateContractGas
, etc.