useTxPaymentInfo
A hook for getting the partial fee and weight for a transaction before signing and sending. See useink/utils helpers for compatible functions that work well with this hook.
Usage
import { useTxPaymentInfo } from 'useink'
export const MyContractView: React.FC = () => {
const contract = useContract('..address', metadata, 'astar')
const get = useTxPaymentInfo<boolean>(contract, 'get')
return (
<button onClick={get.send} disabled={get.isSubmitting}>
{get.result?.paritalFee ? (
`Gas price: ${get.result?.paritialFee.toString()}`
) : '--'}
</button>
)
}Calling with a default caller address
You must first define a default caller in configuration, then call the contract with options:
Return Value
Last updated
Was this helpful?