import { InvokeFunctionResponse } from 'starknet'; /** Represents a contract call. */ export interface Call { /** The address of the contract. */ contractAddress: string; /** The selector of the function to invoke. */ entrypoint: string; /** The raw calldata. */ calldata: unknown[]; } /** Arguments for `useStarknetExecute`. */ export interface UseStarknetExecuteArgs { /** List of smart contract calls to execute. */ calls?: Call | Call[]; /** Metadata associated with the transaction. */ metadata?: any; } /** Value returned from `useStarknetExecute` */ export interface UseStarknetExecute { /** Data returned from the execute call. */ data?: string; /** True if the execute call is being executed. */ loading: boolean; /** Error while running execute. */ error?: unknown; /** Reset the hook state. */ reset: () => void; /** Execute the calls. */ execute: () => Promise; } /** * Hook to perform a StarkNet multicall. * * @remarks * * Multicalls are used to submit multiple transactions in a single * call to improve user experience. * * @example * This example shows how to dynamically add transactions to the multicall. * ```tsx * function Component() { * const { address } = useAccount() * const [count, setCount] = useState(0) * * const calls = useMemo(() => { * const tx = { * contractAddress: ethAddress, * entrypoint: 'transfer', * calldata: [address, 1, 0] * } * return Array(count).fill(tx) * }, [address, count]) * * const { execute } = useStarknetExecute({ calls }) * * const inc = useCallback( * () => setCount(c => c + 1), * [setCount] * ) * const dec = useCallback( * () => setCount(c => Math.max(c - 1, 0)), * [setCount] * ) * * return ( * <> *

Sending {count} transactions

*

* * *

*

* *

* * ) * } * ``` */ export declare function useStarknetExecute({ calls, metadata }: UseStarknetExecuteArgs): { data: InvokeFunctionResponse | undefined; loading: boolean; error: unknown; reset: () => void; execute: import("@tanstack/react-query").UseMutateAsyncFunction; };