useDryRun
Usage
import { useDryRun, useContract } from 'useink'
import { pickTxInfo } from 'useink/utils'
export const MyContractView: React.FC = () => {
const contract = useContract('...address', metadata, 'zeitgeist')
const get = useDryRun<boolean>(contract, 'get')
return (
<>
<button onClick={() => get.send()}>
{get.isSubmitting ? 'Send Dry Run' : 'Sending...'}
</div>
<h2>Get the fee the hard way: {get.result.ok ? get.result.value.partialFee : '--'}</h2>
<h2>Or the easy way: {pickTxInfo(get.result)?.partialFee || '--'}</h2>
</>
)
}Calling with a default caller address
Return Value
Last updated