@solana/react-hooks 0.2.5 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/index.browser.cjs +233 -496
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +224 -483
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs +224 -483
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs +233 -496
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +224 -483
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/QueryProvider.d.ts.map +1 -1
- package/dist/types/SolanaProvider.d.ts.map +1 -1
- package/dist/types/context.d.ts +3 -0
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +59 -14
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/index.d.ts +9 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/query.d.ts +2 -1
- package/dist/types/query.d.ts.map +1 -1
- package/dist/types/queryHooks.d.ts +18 -10
- package/dist/types/queryHooks.d.ts.map +1 -1
- package/dist/types/queryKeys.d.ts +8 -0
- package/dist/types/queryKeys.d.ts.map +1 -0
- package/dist/types/ui.d.ts +10 -8
- package/dist/types/ui.d.ts.map +1 -1
- package/dist/types/useClientStore.d.ts +4 -3
- package/dist/types/useClientStore.d.ts.map +1 -1
- package/package.json +2 -7
- package/dist/types/walletStandardHooks.d.ts +0 -78
- package/dist/types/walletStandardHooks.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -285,6 +285,10 @@ Wrap a subtree with `<SolanaQueryProvider>` and call hooks like `useLatestBlockh
|
|
|
285
285
|
Suspense later? Pass `suspense` to `SolanaQueryProvider` and wrap just the section that should pause in a
|
|
286
286
|
local `<Suspense>` boundary—no hook changes required:
|
|
287
287
|
|
|
288
|
+
The query provider ships SWR v2-aligned defaults: `revalidateOnFocus`/`revalidateOnReconnect`/`revalidateIfStale`
|
|
289
|
+
are `true`, `dedupingInterval` is `2000`, and `focusThrottleInterval` is `5000`. Override them per-provider via the
|
|
290
|
+
`query.config` prop or per-hook via the `swr` option.
|
|
291
|
+
|
|
288
292
|
```tsx
|
|
289
293
|
import { SolanaQueryProvider, useBalance } from '@solana/react-hooks';
|
|
290
294
|
import { Suspense } from 'react';
|
|
@@ -393,8 +397,16 @@ function SimulationLogs({ transaction }) {
|
|
|
393
397
|
|
|
394
398
|
## Going further
|
|
395
399
|
|
|
396
|
-
-
|
|
397
|
-
|
|
400
|
+
- Wallet connection UI: `useWalletConnection` gives you the current wallet, connect/disconnect
|
|
401
|
+
helpers, and the connector list from `client.connectors` (or an explicit override). Pair it with
|
|
402
|
+
your preferred UI, or `WalletConnectionManager` for a simple modal state helper.
|
|
403
|
+
- Signing helpers: the wallet session returned by `useWallet` exposes `signMessage`,
|
|
404
|
+
`signTransaction`, and `sendTransaction` when supported by the connector. These connector methods
|
|
405
|
+
replace the deprecated Wallet Standard shims.
|
|
406
|
+
- Query hooks keep SWR options under `swr` for consistency (for example,
|
|
407
|
+
`useProgramAccounts(address, { swr: { revalidateOnFocus: false } })`) and expose typed parameter
|
|
408
|
+
and return aliases across all hooks.
|
|
409
|
+
- Type helpers: use `UseHookNameParameters` / `UseHookNameReturnType` for public hooks.
|
|
398
410
|
- Looking for examples? See `examples/react-hooks` for a ready-to-run, tabbed playground that wires
|
|
399
411
|
the provider, hooks, and mock UIs together across wallet/state, transaction, and query demos.
|
|
400
412
|
|