> ## 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.

# Using Stellar wallets

<Card title="Recommended: JavaScript SDK with React Hooks" icon="react" color="#4779FE">
  For new React apps, we recommend the JavaScript SDK with React Hooks (`@dynamic-labs-sdk/react-hooks`) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the [React quickstart (JavaScript SDK)](/javascript/reference/react-quickstart) to get started.
</Card>

<Info>
  Stellar embedded wallets are available in SDK version 4.59.2 and later.
</Info>

## Installation

To use Stellar wallets, install the Stellar wallet connector package:

```bash theme={"system"}
npm i @dynamic-labs/stellar
```

## Setup

Include the Stellar wallet connector in your provider configuration:

```tsx theme={"system"}
import { DynamicContextProvider } from '@dynamic-labs/sdk-react-core';
import { StellarWalletConnectors } from '@dynamic-labs/stellar';

<DynamicContextProvider
  settings={{
    walletConnectors: [StellarWalletConnectors],
    // ... other settings
  }}
>
  {/* Your app components */}
</DynamicContextProvider>
```

## Checking if a wallet is a Stellar wallet

```tsx theme={"system"}
import { isStellarWallet } from '@dynamic-labs/stellar';

if (!isStellarWallet(wallet)) {
  throw new Error('This wallet is not a Stellar wallet');
}
```

## Get the Stellar client

```tsx theme={"system"}
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
import { isStellarWallet } from '@dynamic-labs/stellar';

const { primaryWallet } = useDynamicContext();

if (!primaryWallet || !isStellarWallet(primaryWallet)) {
  throw new Error('This wallet is not a Stellar wallet');
}

const stellarClient = await primaryWallet.getStellarClient();
```

## Sign a transaction

```tsx theme={"system"}
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
import { isStellarWallet } from '@dynamic-labs/stellar';

const { primaryWallet } = useDynamicContext();

if (!primaryWallet || !isStellarWallet(primaryWallet)) {
  throw new Error('This wallet is not a Stellar wallet');
}

// Sign a transaction
const signedTransaction = await primaryWallet.signTransaction(transaction);
```

## Resources

* [Stellar SDK Documentation](https://developers.stellar.org/docs)
* [Stellar Network Overview](https://developers.stellar.org/docs/learn/fundamentals/networks)
