> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# getSuiClient

# getSuiClient

Retrieves a SuiClient instance from a wallet account, allowing you to interact with the Sui blockchain.

## Usage

```javascript theme={"system"}
import { getSuiClient, isSuiWalletAccount } from "@dynamic-labs-sdk/sui";
import { getPrimaryWalletAccount } from "@dynamic-labs-sdk/client";

const walletAccount = getPrimaryWalletAccount();

if (walletAccount && isSuiWalletAccount(walletAccount)) {
  const suiClient = await getSuiClient({ walletAccount });

  // Use the client to interact with the Sui blockchain
  const balance = await suiClient.getBalance({
    owner: walletAccount.address,
  });

  console.log("Balance:", balance);
}
```

## Parameters

| Parameter       | Type                       | Description                                                             |
| --------------- | -------------------------- | ----------------------------------------------------------------------- |
| `walletAccount` | `SuiWalletAccount`         | The wallet account to get the Sui client for                            |
| `client`        | `DynamicClient` (optional) | The Dynamic client instance. Only required when using multiple clients. |

## Returns

`Promise<SuiClient>` - A promise that resolves to a SuiClient instance from `@mysten/sui`.

## Errors

| Error                 | Description                                                   |
| --------------------- | ------------------------------------------------------------- |
| `NotSuiProviderError` | Thrown if the wallet account's provider is not a Sui provider |

## React

```tsx theme={"system"}
import { getSuiClient, isSuiWalletAccount } from '@dynamic-labs-sdk/sui';
import { useGetWalletAccounts } from '@dynamic-labs-sdk/react-hooks';
import { useEffect, useState } from 'react';

function SuiBalance() {
  const { data: walletAccounts = [] } = useGetWalletAccounts();
  const walletAccount = walletAccounts.find(isSuiWalletAccount);
  const [balance, setBalance] = useState(null);

  useEffect(() => {
    if (!walletAccount) return;
    getSuiClient({ walletAccount }).then(async (client) => {
      const bal = await client.getBalance({ owner: walletAccount.address });
      setBalance(bal);
    });
  }, [walletAccount]);

  return <p>SUI balance: {balance?.totalBalance ?? '...'}</p>;
}
```

## Related functions

* [isSuiWalletAccount](/javascript/reference/sui/checking-sui-wallet-account-type) - Check if a wallet account is a Sui account
* [signAndExecuteTransaction](/javascript/reference/sui/sign-and-execute-transaction) - Sign and execute a transaction
