Skip to content

Commit 0db2508

Browse files
authored
docs: expand hook docs and fix hydration guard (#61)
1 parent 606d41b commit 0db2508

File tree

8 files changed

+460
-350
lines changed

8 files changed

+460
-350
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@solana/react-hooks': patch
3+
'@solana/client': patch
4+
---
5+
6+
Improve docs for all hooks, add SSR-safe connector hydration in `useWalletConnection`, and document client actions with JSDoc for clearer usage.

packages/client/src/actions.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,21 @@ import type {
1616
SolanaClient,
1717
} from './types';
1818

19+
/**
20+
* Connect to a registered wallet connector by id.
21+
*
22+
* @param client - Solana client instance.
23+
* @param params - Connector id and optional auto-connect preference.
24+
*/
1925
export function connectWallet(client: SolanaClient, params: ConnectWalletParameters): ConnectWalletReturnType {
2026
return client.actions.connectWallet(params.connectorId, params.options);
2127
}
2228

29+
/**
30+
* Disconnect the active wallet session (noop if already disconnected).
31+
*
32+
* @param client - Solana client instance.
33+
*/
2334
export function disconnectWallet(
2435
client: SolanaClient,
2536
_params?: DisconnectWalletParameters,
@@ -28,22 +39,52 @@ export function disconnectWallet(
2839
return client.actions.disconnectWallet();
2940
}
3041

42+
/**
43+
* Fetch and cache account data for an address.
44+
*
45+
* @param client - Solana client instance.
46+
* @param params - Address and optional commitment override.
47+
*/
3148
export function fetchAccount(client: SolanaClient, params: FetchAccountParameters): FetchAccountReturnType {
3249
return client.actions.fetchAccount(params.address, params.commitment);
3350
}
3451

52+
/**
53+
* Fetch and cache lamport balance for an address.
54+
*
55+
* @param client - Solana client instance.
56+
* @param params - Address and optional commitment override.
57+
*/
3558
export function fetchBalance(client: SolanaClient, params: FetchBalanceParameters): FetchBalanceReturnType {
3659
return client.actions.fetchBalance(params.address, params.commitment);
3760
}
3861

62+
/**
63+
* Request an airdrop to an address.
64+
*
65+
* @param client - Solana client instance.
66+
* @param params - Target address and lamports amount.
67+
*/
3968
export function requestAirdrop(client: SolanaClient, params: RequestAirdropParameters): RequestAirdropReturnType {
4069
return client.actions.requestAirdrop(params.address, params.lamports);
4170
}
4271

72+
/**
73+
* Send a prepared transaction through the client.
74+
*
75+
* @param client - Solana client instance.
76+
* @param params - Transaction and optional commitment override.
77+
*/
4378
export function sendTransaction(client: SolanaClient, params: SendTransactionParameters): SendTransactionReturnType {
4479
return client.actions.sendTransaction(params.transaction, params.commitment);
4580
}
4681

82+
/**
83+
* Reconfigure the client to target a new cluster endpoint (and optional websocket/commitment).
84+
*
85+
* @param client - Solana client instance.
86+
* @param params - Endpoint plus optional config overrides.
87+
*/
4788
export function setCluster(client: SolanaClient, params: SetClusterParameters): SetClusterReturnType {
4889
return client.actions.setCluster(params.endpoint, params.config);
4990
}

0 commit comments

Comments
 (0)