useContractStream
useContractStream(
options):UseContractStreamResult
Defined in: packages/react/src/hooks/useContractStream.ts:100
Hook for streaming live contract updates
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Example
Section titled “Example”function ContractList() { const { contracts, isLoading, count } = useContractStream({ templateFilter: { packageName: 'splice-wallet-payment', moduleName: 'Splice.Wallet.Payment', entityName: 'TransferPreapproval', }, pollingInterval: 2000, })
if (isLoading) return <p>Loading contracts...</p>
return ( <div> <h2>{count} Contracts</h2> <ul> {contracts.map(contract => ( <li key={contract.contractId} className={contract.isNew ? 'animate-in' : contract.isRemoving ? 'animate-out' : ''} > {contract.templateId} </li> ))} </ul> </div> )}