# Intro

The kit provides hooks for developers to interact with smart contracts like VeBetterDAO, VePassport, veDelegate, and price oracles.

The hooks in this package provide a standardized way to interact with various blockchain and web services. All hooks are built using [TanStack Query](https://tanstack.com/query) (formerly React Query), which provides powerful data-fetching and caching capabilities.

### Common Features

Every hook in the `@api` directory returns a consistent interface that includes:

* `data`: The fetched data
* `isLoading`: Boolean indicating if the request is in progress
* `isError`: Boolean indicating if the request failed
* `error`: Error object if the request failed
* `refetch`: Function to manually trigger a new fetch
* `isRefetching`: Boolean indicating if a refetch is in progress

Additionally, these hooks integrate with TanStack Query's global features:

* Automatic background refetching
* Cache invalidation
* Optimistic updates
* Infinite queries (for pagination)
* Parallel queries
* Query retrying
* Query polling

### Query Invalidation

All hooks use consistent query key patterns, making it easy to invalidate related queries. For example:

```typescript
const queryClient = useQueryClient();
// Invalidate all blockchain queries
queryClient.invalidateQueries({ queryKey: ['VECHAIN_KIT'] });
// Invalidate specific query
queryClient.invalidateQueries({ queryKey: ['VECHAIN_KIT', 'CURRENT_BLOCK'] });
```

### Caching Behavior

By default, most queries are configured with:

* `staleTime`: How long the data remains "fresh"
* `cacheTime`: How long inactive data remains in cache
* `refetchInterval`: For automatic background updates (if applicable)

These can be customized using TanStack Query's global configuration or per-hook options.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vechainkit.vechain.org/hooks/intro.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
