useMobileWallet hook. Make sure you have completed the Installation and Setup steps first.
Stay on the tab for the Solana library you installed.
Connect / Disconnect
Useconnect to initiate a wallet connection and disconnect to end it. The account field holds the selected wallet account.
- @solana/kit
- @solana/web3.js
Sign Message
UsesignMessages to request the wallet to sign an arbitrary byte payload. This is useful for off-chain signature verification.
- @solana/kit
- @solana/web3.js
signMessages takes bytes, not a string. Use TextEncoder to encode text — a
base64 helper such as toUint8Array will decode your text as base64 and sign
the wrong payload.Sign In with Solana (SIWS)
UsesignIn to connect to a wallet and verify ownership in a single step. This combines authorization and message signing into one user interaction. Read the account from the returned result — the hook’s account is not updated until the next render.
- @solana/kit
- @solana/web3.js
signIn works whether or not the user is already connected. Omit address to
let the wallet pick the account and sign in as part of the same prompt.Sign and Send Transaction
Request the wallet to sign a transaction and submit it to the Solana network. Both examples send a memo instruction — swap it for whichever instructions your app builds.- @solana/kit
- @solana/web3.js
sendTransactions takes instructions and handles fetching the blockhash, compiling the transaction, signing, and sending.Next steps
Advanced: Invoke MWA Sessions Directly
Learn the low-level transact() API for direct MWA session control.
Sample Apps
Browse reference apps to jumpstart your development.
