import { ContractInterface } from 'starknet'; import { BlockNumber } from 'starknet'; /** Call options. */ export interface UseStarknetCallOptions { /** Refresh data at every block. */ watch?: boolean; /** Block identifier used when performing call. */ blockIdentifier?: BlockNumber; } /** Arguments for `useStarknetCall`. */ export interface UseStarknetCallProps { /** The target contract. */ contract?: ContractInterface; /** The contract's method. */ method?: string; /** Call arguments. */ args?: T; /** Call options. */ options?: UseStarknetCallOptions; } /** Value returned from `useStarknetCall`. */ export interface UseStarknetCallResult { /** Value returned from call. */ data?: Array; /** True when performing call. */ loading: boolean; /** Error when performing call. */ error?: string; /** Manually trigger refresh of data. */ refresh: () => void; /** True when performing call. */ refreshing: boolean; } /** * Hook to perform a read-only contract call. * * @remarks * * The hook only performs a call if the target `contract`, * `method`, and `args` are not undefined. * * @example * This example shows how to fetch the user ERC-20 balance. * ```tsx * function Component() { * const { contract } = useContract({ * address: ethAddress, * abi: compiledErc20.abi * }) * const { address } = useAccount() * const { data, loading, error, refresh } = useStarknetCall({ * contract, * method: 'balanceOf', * args: [address], * options: { * watch: false * } * }) * * if (loading) return Loading... * if (error) return Error: {error} * * return ( *
* *

Balance: {JSON.stringify(data)}

*
* ) * } * ``` */ export declare function useStarknetCall({ contract, method, args, options, }: UseStarknetCallProps): UseStarknetCallResult;