Skip to main content

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.

Stellar embedded wallets are available in SDK version 4.59.2 and later.

Installation

To use Stellar wallets, install the Stellar wallet connector package:
npm i @dynamic-labs/stellar

Setup

Include the Stellar wallet connector in your provider configuration:
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

import { isStellarWallet } from '@dynamic-labs/stellar';

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

Get the Stellar client

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

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