Skip to content

useMobileWallet

The useMobileWallet hook is the primary hook for interacting with the mobile wallet. Both variants support connect, disconnect, signing messages, and signing transactions, but the exposed client types and helper methods differ.

The wallet lifecycle methods are largely shared. The main differences are the client object returned by the hook, the transaction helper surface, and the account types.

NameTypeDescription
clientClientThe Solana RPC client with rpc and rpcSubscriptions.
identityAppIdentityThe app identity configured in MobileWalletProvider.
accountsAccount[] | nullAn array of all authorized accounts.
accountAccount | nullThe currently selected wallet account.
chainSolanaClusterIdThe current cluster identifier.
connect() => Promise<Account>Connect to a wallet.
connectAnd(cb: (wallet: AuthorizeAPI) => Promise<Account | void>) => Promise<Account | void>Connect and execute a callback.
disconnect() => Promise<void>Disconnect the current wallet.
deauthorizeSession(wallet: DeauthorizeAPI) => Promise<void>Deauthorize the current session.
getTransactionSigner(address: Address, minContextSlot: bigint) => TransactionSendingSignerReturn a signer for Kit transaction pipelines.
sendTransaction(instructions: Instruction[]) => Promise<string>Create, sign, and send a transaction from instructions.
signAndSendTransaction(transaction: Transaction | Transaction[], minContextSlot: bigint) => Promise<SignatureBytes[]>Sign and send one or more Kit transactions.
signTransaction(transaction: Transaction | Transaction[]) => Promise<Transaction | Transaction[]>Sign one or more Kit transactions without sending them.
signIn(signInPayload: SignInPayload) => Promise<Account>Sign in with a wallet.
signMessage(message: Uint8Array | Uint8Array[]) => Promise<Uint8Array | Uint8Array[]>Sign one or more messages.
NameTypeDescription
addressAddressThe wallet address as an Address type from @solana/kit.
addressBase64Base64EncodedAddressThe base64-encoded address.
iconWalletIconOptional. The wallet icon.
labelstring | undefinedAn optional, user-defined label for the account.
NameTypeDescription
rpcReturnType<typeof createSolanaRpc>The Solana RPC client.
rpcSubscriptionsReturnType<typeof createSolanaRpcSubscriptions>The Solana RPC subscriptions client.
import { useMobileWallet } from '@wallet-ui/react-native-kit';
import { useCallback } from 'react';
import { Button, Text, View } from 'react-native';
function WalletConnector() {
const { account, connect, disconnect } = useMobileWallet();
const handleConnect = useCallback(async () => {
await connect();
}, [connect]);
const handleDisconnect = useCallback(async () => {
await disconnect();
}, [disconnect]);
return (
<View>
{account ? (
<>
<Text>Connected to: {account.address}</Text>
<Button title="Disconnect" onPress={handleDisconnect} />
</>
) : (
<Button title="Connect Wallet" onPress={handleConnect} />
)}
</View>
);
}