Skip to content

Support Deployless Reads #4160

Closed Answered by tmm
hammeiam asked this question in Ideas
Jul 22, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

It's already supported, just hasn't been carried over to the Wagmi docs yet. (PR welcome for that!)

TypeScript Playground

import { encodeFunctionData, parseAbi } from 'viem'
import { useReadContract } from 'wagmi'

// Bytecode
const result = useReadContract({
  abi: parseAbi(['function name() view returns (string)']),
  code: '0x...', // Accessible here: https://etherscan.io/address/0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2#code
  functionName: 'name',
})

// Deploy Factory
const account = {
  address: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  abi: parseAbi(['function entryPoint() view returns (address)']),
} as const
const result2 = useReadContract({
  // Address of the Smart Acco…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hammeiam
Comment options

@tmm
Comment options

Answer selected by hammeiam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants