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.
Checking if a wallet is a Solana wallet
import { isSolanaWallet } from '@dynamic-labs/solana';
if (!isSolanaWallet(wallet)) {
throw new Error('This wallet is not a Solana wallet');
}
Get Connection
import { useUserWallets } from '@dynamic-labs/sdk-react-core';
import { isSolanaWallet } from '@dynamic-labs/solana';
const wallets = useUserWallets();
const connection = wallets.find(wallet => isSolanaWallet(wallet))?.getConnection();
Get Signer
import { useUserWallets } from '@dynamic-labs/sdk-react-core';
import { isSolanaWallet } from '@dynamic-labs/solana';
const wallets = useUserWallets();
const signer = wallets.find(wallet => isSolanaWallet(wallet))?.getSigner();
Custom Connection (React only)
In some cases you would want to override the default settings of the Web3.js Connection.
React provides the SolanaWalletConnectorsWithConfig to customize Web3.js Connection configuration with commitment levels, HTTP headers, and custom RPC URLs.
import { DynamicContextProvider } from '@dynamic-labs/sdk-react-core';
import { SolanaWalletConnectorsWithConfig } from '@dynamic-labs/solana';
<DynamicContextProvider
settings={{
walletConnectors: [
SolanaWalletConnectorsWithConfig({
commitment: "confirmed",
httpHeaders: {
"X-Requested-With": "XMLHttpRequest",
},
customRpcUrls: {
solana: ["http://YOUR_URL"],
eclipse: ["http://YOUR_URL"],
},
}),
],
... // other settings
}}
>
{...}
</DynamicContextProvider>
Examples
You can find examples of how to interact with Solana wallets in the examples section: