Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion account-kit/react/src/hooks/useAlchemyAccountContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { AlchemyAccountContextProps } from "../AlchemyAccountContext.js";
* This hook is meant to be consumed by other hooks exported by this package.
*
* @example
* ```tsx twoslash
* ```ts twoslash
* import { useAlchemyAccountContext } from "@account-kit/react";
*
* const { config, queryClient } = useAlchemyAccountContext();
Expand Down
2 changes: 1 addition & 1 deletion account-kit/react/src/hooks/useAuthError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type UseAuthErrorResult = Error | undefined;
* @returns {UseAuthErrorResult} the current Error object
*
* @example
* ```tsx twoslash
* ```ts twoslash
* import { useAuthError } from "@account-kit/react";
*
* const error = useAuthError();
Expand Down
4 changes: 3 additions & 1 deletion account-kit/react/src/hooks/usePrepareCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export type UsePrepareCallsResult = {
* - `error`: Error from the last failed call preparation, if any
*
* @example
* ```tsx twoslash
* ```ts twoslash
* import { usePrepareCalls } from "@account-kit/react";
*
* const { prepareCalls, prepareCallsAsync, isPreparingCalls, error } = usePrepareCalls();
*
* // Prepare calls
Expand Down
4 changes: 3 additions & 1 deletion account-kit/react/src/hooks/useSendCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export type UseSendCallsResult<
* - `error`: Error from the last failed call execution, if any
*
* @example
* ```tsx twoslash
* ```ts twoslash
* import { useSendCalls } from "@account-kit/react";
*
* const { sendCalls, sendCallsAsync, isSendingCalls, error } = useSendCalls();
*
* // Send a single call
Expand Down
8 changes: 6 additions & 2 deletions account-kit/react/src/hooks/useSendPreparedCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ export type UseSendPreparedCallsResult = {
* - `error`: Error from the last failed prepared call execution, if any
*
* @example
* ```tsx twoslash
* ```ts twoslash
* import { useSendPreparedCalls } from "@account-kit/react";
*
* const { sendPreparedCalls, sendPreparedCallsAsync, isSendingPreparedCalls, error } = useSendPreparedCalls();
*
* // Send prepared calls
* await sendPreparedCallsAsync({
* preparedCalls: [/* prepared call objects *\/]
* preparedCalls: [
* // prepared call objects
* ]
* });
* ```
*
Expand Down
7 changes: 4 additions & 3 deletions account-kit/react/src/hooks/useSolanaConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ export type SolanaConnectionHookParams = {
* This hook is used for establishing a connection to Solana and returns the connection object and the signer object.
*
* @example
* ```ts
const {connection} = useSolanaConnection();

* ```ts twoslash
* import { useSolanaConnection } from "@account-kit/react";
*
* const { connection } = useSolanaConnection();
* ```
* @param {SolanaConnectionHookParams} opts Options for the hook to get setup
* @returns {SolanaConnection} The transaction hook.
Expand Down
10 changes: 6 additions & 4 deletions account-kit/react/src/hooks/useSolanaSignMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ export type UseSolanaSignMessageParams = {
* connected Solana wallets, falling back to the internal signer when not connected.
*
* @example
* ```ts
* ```ts twoslash
* import { useSolanaSignMessage } from "@account-kit/react";
*
* const {
* isPending: isSigningMessage,
* mutate: signHello,
* data: signature,
* reset,
* } = useSolanaSignMessage({
* });
* mutate({ message: "Hello" });
* } = useSolanaSignMessage({});
*
* signHello({ message: "Hello" });
* ```
* @param {UseSolanaSignMessageParams} opts - Options for the hook to get setup.
* @returns {SolanaSignedMessage} This should be hook mutations plus a few more. Used to get the end result of the signing and the callbacks.
Expand Down
24 changes: 14 additions & 10 deletions account-kit/react/src/hooks/useSolanaTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,21 @@ export type SolanaTransactionHookParams = {
* Supports sponsorship for both external wallets and internal signers.
*
* @example
* ```ts
const {mutate} = useSolanaTransaction({
policyId: "<policyId>",
});

mutate({
transfer: {
amount: <amount:number>,
toAddress: "<toAddress>",
},
* ```ts twoslash
* import { useSolanaTransaction } from "@account-kit/react";
*
* const { mutate } = useSolanaTransaction({
* policyId: "<policyId>",
* });
*
* mutate({
* transfer: {
* amount: 0,
* toAddress: "<toAddress>",
* },
* });
* ```
*
* @param {SolanaTransactionHookParams} opts Options for the hook to get setup, The transaction is required.
* @returns {SolanaTransaction} The transaction hook.
*/
Expand Down
2 changes: 1 addition & 1 deletion account-kit/react/src/hooks/useSolanaWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const EMPTY_WALLET_CONTEXT_STATE: WalletContextState = Object.freeze({
* frozen, safe no-op context when Solana is not configured.
*
* @example
* ```ts
* ```ts twoslash
* import { useSolanaWallet } from "@account-kit/react";
*
* const wallet = useSolanaWallet();
Expand Down
2 changes: 1 addition & 1 deletion account-kit/react/src/hooks/useUiConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function useUiConfig<T = UiConfigStore>(
* @throws Will throw an error if the `UiConfigContext` is not present in the component tree
*
* @example
* ```tsx twoslash
* ```ts twoslash
* import { useUiConfig } from "@account-kit/react";
*
* const { illustrationStyle, auth } = useUiConfig(({ illustrationStyle, auth }) => ({ illustrationStyle, auth }));
Expand Down
1 change: 0 additions & 1 deletion account-kit/react/src/hooks/useUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export type UseUserResult = (User & { type: "eoa" | "sca" }) | null;
* type UseUserResult = (User & { type: "eoa" | "sca" }) | null;
*
* const user = useUser();
*
* ```
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useAlchemyAccountContext } from "@account-kit/react";

## Usage

```tsx twoslash
```ts twoslash
import { useAlchemyAccountContext } from "@account-kit/react";

const { config, queryClient } = useAlchemyAccountContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useAuthError } from "@account-kit/react";

## Usage

```tsx twoslash
```ts twoslash
import { useAuthError } from "@account-kit/react";

const error = useAuthError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import { usePrepareCalls } from "@account-kit/react";

## Usage

```tsx twoslash
```ts twoslash
import { usePrepareCalls } from "@account-kit/react";

const { prepareCalls, prepareCallsAsync, isPreparingCalls, error } =
usePrepareCalls();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import { useSendCalls } from "@account-kit/react";

## Usage

```tsx twoslash
```ts twoslash
import { useSendCalls } from "@account-kit/react";

const { sendCalls, sendCallsAsync, isSendingCalls, error } = useSendCalls();

// Send a single call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,21 @@ import { useSendPreparedCalls } from "@account-kit/react";

## Usage

```tsx twoslash
const { sendPreparedCalls, sendPreparedCallsAsync, isSendingPreparedCalls, error } = useSendPreparedCalls();
```ts twoslash
import { useSendPreparedCalls } from "@account-kit/react";

const {
sendPreparedCalls,
sendPreparedCallsAsync,
isSendingPreparedCalls,
error,
} = useSendPreparedCalls();

// Send prepared calls
await sendPreparedCallsAsync({
preparedCalls: [/* prepared call objects *\/]
preparedCalls: [
// prepared call objects
],
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import { useSolanaConnection } from "@account-kit/react";

## Usage

```ts
```ts twoslash
import { useSolanaConnection } from "@account-kit/react";

const { connection } = useSolanaConnection();
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ import { useSolanaSignMessage } from "@account-kit/react";

## Usage

```ts
```ts twoslash
import { useSolanaSignMessage } from "@account-kit/react";

const {
isPending: isSigningMessage,
mutate: signHello,
data: signature,
reset,
} = useSolanaSignMessage({});
mutate({ message: "Hello" });

signHello({ message: "Hello" });
```

## Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ import { useSolanaTransaction } from "@account-kit/react";

## Usage

```ts
const {mutate} = useSolanaTransaction({
policyId: "<policyId>",
```ts twoslash
import { useSolanaTransaction } from "@account-kit/react";

const { mutate } = useSolanaTransaction({
policyId: "<policyId>",
});

mutate({
transfer: {
amount: <amount:number>,
toAddress: "<toAddress>",
},
transfer: {
amount: 0,
toAddress: "<toAddress>",
},
});
```

## Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { useSolanaWallet } from "@account-kit/react";

## Usage

```ts
```ts twoslash
import { useSolanaWallet } from "@account-kit/react";

const wallet = useSolanaWallet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useUiConfig } from "@account-kit/react";

## Usage

```tsx twoslash
```ts twoslash
import { useUiConfig } from "@account-kit/react";

const { illustrationStyle, auth } = useUiConfig(
Expand Down
Loading