Skip to content

Commit 3ca53da

Browse files
authored
docs: fix example imports & twoslash (#2060)
* docs: fix example imports & twoslash * docs: fix example * chore: generate docs
1 parent fd3b7a6 commit 3ca53da

21 files changed

+80
-45
lines changed

account-kit/react/src/hooks/useAlchemyAccountContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { AlchemyAccountContextProps } from "../AlchemyAccountContext.js";
88
* This hook is meant to be consumed by other hooks exported by this package.
99
*
1010
* @example
11-
* ```tsx twoslash
11+
* ```ts twoslash
1212
* import { useAlchemyAccountContext } from "@account-kit/react";
1313
*
1414
* const { config, queryClient } = useAlchemyAccountContext();

account-kit/react/src/hooks/useAuthError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type UseAuthErrorResult = Error | undefined;
88
* @returns {UseAuthErrorResult} the current Error object
99
*
1010
* @example
11-
* ```tsx twoslash
11+
* ```ts twoslash
1212
* import { useAuthError } from "@account-kit/react";
1313
*
1414
* const error = useAuthError();

account-kit/react/src/hooks/usePrepareCalls.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ export type UsePrepareCallsResult = {
6565
* - `error`: Error from the last failed call preparation, if any
6666
*
6767
* @example
68-
* ```tsx twoslash
68+
* ```ts twoslash
69+
* import { usePrepareCalls } from "@account-kit/react";
70+
*
6971
* const { prepareCalls, prepareCallsAsync, isPreparingCalls, error } = usePrepareCalls();
7072
*
7173
* // Prepare calls

account-kit/react/src/hooks/useSendCalls.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ export type UseSendCallsResult<
8585
* - `error`: Error from the last failed call execution, if any
8686
*
8787
* @example
88-
* ```tsx twoslash
88+
* ```ts twoslash
89+
* import { useSendCalls } from "@account-kit/react";
90+
*
8991
* const { sendCalls, sendCallsAsync, isSendingCalls, error } = useSendCalls();
9092
*
9193
* // Send a single call

account-kit/react/src/hooks/useSendPreparedCalls.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,16 @@ export type UseSendPreparedCallsResult = {
6565
* - `error`: Error from the last failed prepared call execution, if any
6666
*
6767
* @example
68-
* ```tsx twoslash
68+
* ```ts twoslash
69+
* import { useSendPreparedCalls } from "@account-kit/react";
70+
*
6971
* const { sendPreparedCalls, sendPreparedCallsAsync, isSendingPreparedCalls, error } = useSendPreparedCalls();
7072
*
7173
* // Send prepared calls
7274
* await sendPreparedCallsAsync({
73-
* preparedCalls: [/* prepared call objects *\/]
75+
* preparedCalls: [
76+
* // prepared call objects
77+
* ]
7478
* });
7579
* ```
7680
*

account-kit/react/src/hooks/useSolanaConnection.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ export type SolanaConnectionHookParams = {
2828
* This hook is used for establishing a connection to Solana and returns the connection object and the signer object.
2929
*
3030
* @example
31-
* ```ts
32-
const {connection} = useSolanaConnection();
33-
31+
* ```ts twoslash
32+
* import { useSolanaConnection } from "@account-kit/react";
33+
*
34+
* const { connection } = useSolanaConnection();
3435
* ```
3536
* @param {SolanaConnectionHookParams} opts Options for the hook to get setup
3637
* @returns {SolanaConnection} The transaction hook.

account-kit/react/src/hooks/useSolanaSignMessage.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,17 @@ export type UseSolanaSignMessageParams = {
4747
* connected Solana wallets, falling back to the internal signer when not connected.
4848
*
4949
* @example
50-
* ```ts
50+
* ```ts twoslash
51+
* import { useSolanaSignMessage } from "@account-kit/react";
52+
*
5153
* const {
5254
* isPending: isSigningMessage,
5355
* mutate: signHello,
5456
* data: signature,
5557
* reset,
56-
* } = useSolanaSignMessage({
57-
* });
58-
* mutate({ message: "Hello" });
58+
* } = useSolanaSignMessage({});
59+
*
60+
* signHello({ message: "Hello" });
5961
* ```
6062
* @param {UseSolanaSignMessageParams} opts - Options for the hook to get setup.
6163
* @returns {SolanaSignedMessage} This should be hook mutations plus a few more. Used to get the end result of the signing and the callbacks.

account-kit/react/src/hooks/useSolanaTransaction.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,21 @@ export type SolanaTransactionHookParams = {
103103
* Supports sponsorship for both external wallets and internal signers.
104104
*
105105
* @example
106-
* ```ts
107-
const {mutate} = useSolanaTransaction({
108-
policyId: "<policyId>",
109-
});
110-
111-
mutate({
112-
transfer: {
113-
amount: <amount:number>,
114-
toAddress: "<toAddress>",
115-
},
106+
* ```ts twoslash
107+
* import { useSolanaTransaction } from "@account-kit/react";
108+
*
109+
* const { mutate } = useSolanaTransaction({
110+
* policyId: "<policyId>",
111+
* });
112+
*
113+
* mutate({
114+
* transfer: {
115+
* amount: 0,
116+
* toAddress: "<toAddress>",
117+
* },
118+
* });
116119
* ```
120+
*
117121
* @param {SolanaTransactionHookParams} opts Options for the hook to get setup, The transaction is required.
118122
* @returns {SolanaTransaction} The transaction hook.
119123
*/

account-kit/react/src/hooks/useSolanaWallet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const EMPTY_WALLET_CONTEXT_STATE: WalletContextState = Object.freeze({
6868
* frozen, safe no-op context when Solana is not configured.
6969
*
7070
* @example
71-
* ```ts
71+
* ```ts twoslash
7272
* import { useSolanaWallet } from "@account-kit/react";
7373
*
7474
* const wallet = useSolanaWallet();

account-kit/react/src/hooks/useUiConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function useUiConfig<T = UiConfigStore>(
7373
* @throws Will throw an error if the `UiConfigContext` is not present in the component tree
7474
*
7575
* @example
76-
* ```tsx twoslash
76+
* ```ts twoslash
7777
* import { useUiConfig } from "@account-kit/react";
7878
*
7979
* const { illustrationStyle, auth } = useUiConfig(({ illustrationStyle, auth }) => ({ illustrationStyle, auth }));

0 commit comments

Comments
 (0)