For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Solana wallet

After a user signs in on a Solana chain, useWeb3Auth().connection.solanaWallet is a Wallet Standard wallet backed by the user's Ed25519 key. It supports solana:signMessage, solana:signTransaction, and solana:signAndSendTransaction.

Use the hooks from @web3auth/react-native-sdk/solana instead of calling the wallet features directly. They need SolanaProvider and the Solana polyfills; see Solana hooks.

import { useSignMessage, useSolanaWallet } from '@web3auth/react-native-sdk/solana'
import { address } from '@solana/kit'
import { Button, View } from 'react-native'

function SolanaView() {
const { accounts, rpc } = useSolanaWallet()
const { signMessage } = useSignMessage()

const getBalance = async () => {
if (!rpc || !accounts?.[0]) return null
const { value: lamports } = await rpc.getBalance(address(accounts[0])).send()
return Number(lamports) / 1_000_000_000
}

return (
<View>
<Button title="Get balance" onPress={getBalance} />
<Button title="Sign message" onPress={() => signMessage('Hello')} />
</View>
)
}
On this page