import React from 'react'; /** A transaction managed by the transaction manager. * * @typeParam M - the metadata type. */ export interface ManagedTransaction { /** The transaction hash. */ hash: string; /** Metadata associated with the transaction. */ metadata?: M; } /** Transaction manager state. */ export interface TransactionManagerState { /** The transactions being managed. */ transactions: ManagedTransaction[]; /** Hashes of the transactions being managed. */ hashes: string[]; /** Add a transaction to the managed transactions. */ addTransaction: ({ hash, metadata }: { hash: string; metadata?: M; }) => void; /** Remove a transaction from the managed transactions. */ removeTransaction: ({ hash }: { hash: string; }) => void; } /** Transaction manager context. */ export declare const TransactionManagerContext: React.Context>; /** * Hook to manage transaction across different components. * * @remarks * * This hook only manages the hashes of the transactions, use the * `useTransactions` hook to fetch the state of the transactions. * * @example * This example shows how to fetch the state of tracked transactions * and how to add new transactions to the manager. * * Notice that the transaction manager only accepts the same transaction once. * ```tsx * function Component() { * const { hashes, addTransaction } = useTransactionManager() * const transactions = useTransactions({ hashes }) * * return ( * <> * *
    * {transactions.map(({ data }, i) => ( *
  • {data && data.transaction_hash}
  • * ))} *
* * ) * } * ``` */ export declare function useTransactionManager(): TransactionManagerState; export interface TransactionManagerProviderProps { children: React.ReactNode; } /** Context provider for `useTransactionManager`. */ export declare function TransactionManagerProvider({ children, }: TransactionManagerProviderProps): JSX.Element;