uninstallFilter
Destroys a filter and frees server resources
Loading...
Destroys a filter and frees server resources
Destroys a filter and frees server resources.
Filters timeout when they aren't requested with eth_getFilterChanges for a period of time, so this is mainly useful for cleanup when you're done with a filter early.
Import the public actions package so you can call this action.
import "github.com/ChefBingbong/viem-go/actions/public"An example showing how to create a filter, then uninstall it when you are finished.
import ( "context" "log"
"github.com/ChefBingbong/viem-go/actions/public" "github.com/ChefBingbong/viem-go/client" "github.com/ChefBingbong/viem-go/client/transport" "github.com/ChefBingbong/viem-go/chain/definitions")
ctx := context.Background()
publicClient, err := client.CreatePublicClient(client.PublicClientConfig{ Chain: definitions.Mainnet, Transport: transport.HTTP("https://eth.llamarpc.com"),})if err != nil { log.Fatal(err)}defer func() { _ = publicClient.Close() }()
filter, err := public.CreatePendingTransactionFilter(ctx, publicClient)if err != nil { log.Fatal(err)}
success, err := public.UninstallFilter(ctx, publicClient, filter.ID)if err != nil { log.Fatal(err)}if success { log.Println("Filter successfully uninstalled")}bool
A boolean indicating if the filter was successfully uninstalled.
Configuration options accepted by this action.
FilterIDThe filter identifier to uninstall.
filter, err := public.CreatePendingTransactionFilter(ctx, publicClient)if err != nil { log.Fatal(err)}
success, err := public.UninstallFilter(ctx, publicClient, filter.ID)Underlying JSON-RPC method used by this action.