Composable Ecosystem
AppKit provides a comprehensive set of Vue composables that work together to provide a complete wallet connection and blockchain interaction experience. These composables can be categorized into several functional groups:- Connection Composables: Manage wallet connections and user authentication (
useAppKit
,useAppKitAccount
,useAppKitProvider
,useDisconnect
) - Network Composables: Handle blockchain network selection and information (
useAppKitNetwork
) - UI Control Composables: Control the modal and UI elements (
useAppKitState
,useAppKitTheme
) - Data Access Composables: Access wallet and blockchain data (
useWalletInfo
) - Event Composables: Subscribe to wallet and connection events (
useAppKitEvents
) - Payment Composables: Handle crypto payments and exchange integrations (
usePay
,useAvailableExchanges
,usePayUrlActions
,useExchangeBuyStatus
) - Multi-Wallet Composables: Manage multiple wallet connections (
useAppKitConnections
,useAppKitConnection
) - Authentication Composables: Handle authentication and user management (
useAppKitUpdateEmail
,useAppKitSIWX
) - Solana-Specific Composables: Solana blockchain interactions (
useAppKitConnection
from Solana adapter)
useAppKit
Composable function for controlling the modal.Returns
open
: Function to open the modalclose
: Function to close the modal
Parameters
You can also select the modal’s view when calling theopen
function
useAppKitAccount
Composable function for accessing account data and connection status.Returns
accountData.value.address
: The current account addressaccountData.value.caipAddress
: The current account address in CAIP formataccountData.value.isConnected
: Boolean that indicates if the user is connectedaccountData.value.status
: The current connection status
Getting Bitcoin Public Keys
When working with Bitcoin accounts, you can extract public keys from the connected accounts:useAppKitNetwork
Composable function for accessing network data and methods.Returns
networkData.caipNetwork
: The current network objectnetworkData.caipNetworkId
: The current network id in CAIP formatnetworkData.chainId
: The current chain idnetworkData.switchNetwork
: Function to switch the network. Accepts acaipNetwork
object as argument.
switchNetwork Usage
See how to import or create a networks
here.
useAppKitState
Composable function for getting the current value of the modal’s state.Returns
stateData.initialized
: Boolean that indicates if AppKit has been initialized. This sets to true when all controllers, adapters and internal state is readystateData.loading
: Boolean that indicates if AppKit is loadingstateData.open
: Boolean that indicates if the modal is openstateData.selectedNetworkId
: The current chain id selected by the user in CAIP-2 formatstateData.activeChain
: The active chain namespace (e.g., ‘eip155’, ‘solana’, ‘bip122’)
Example Usage
useAppKitTheme
Composable function for controlling the modal’s theme.Returns
themeAction.themeMode
: Get theme Mode.themeAction.themeVariables
: Get theme variables.themeAction.setThemeMode
: Set theme Mode. Accepts a string as parameter (‘dark’ | ‘light’)themeAction.setThemeVariables
: Set theme variables. Check the example usage.
Example Usage
useAppKitEvents
Composable function for subscribing to modal events.Returns
events.timestamp
: Get the timestamp of the eventevents.data.event
: Get string of the event.events.data.properties
: get more information from the event.
useDisconnect
Composable function for disconnecting the session.Parameters
namespace
(optional): The specific chain namespace to disconnect from. If not provided, disconnects from all connected namespaces.
Use Cases
- Implementing a “Disconnect Wallet” button
- Handling logout flows in your application
- Cleaning up resources when a user disconnects
- Resetting application state after disconnection
- Disconnecting from specific chains in multi-chain applications
useWalletInfo
Composable function for accessing wallet information.useAppKitProvider
Composable function that returns thewalletProvider
and the WalletProviderType
for interacting with the connected wallet across different blockchain adapters.
Use Cases
- Direct wallet interactions (signing messages, sending transactions)
- Access to wallet-specific methods and properties
- Integration with blockchain libraries (Ethers, Wagmi, Solana Web3.js)
Examples
Returns
walletProvider
: The wallet provider instance for the specified chain namespacewalletProviderType
: The type of wallet provider currently connected
useAppKitConnections
Composable function that manages multiple wallet connections and provides access to all connected wallets. Use this composable when building applications that support multiple simultaneous wallet connections.Use Cases
- Managing multiple wallet connections simultaneously
- Building multi-wallet dashboards or portfolio views
- Implementing wallet comparison features
- Creating advanced wallet management interfaces
Returns
connections
: Reactive reference to array of all connected wallet connectionsdisconnect
: Function to disconnect a specific wallet connection
Related composables: useAppKitConnection, useAppKitAccount
useAppKitConnection
Composable function that manages the active wallet connection and provides connection switching capabilities. Use this composable when you need to work with the currently active connection or switch between multiple connections.Use Cases
- Switching between multiple connected wallets
- Accessing the currently active wallet connection
- Building connection management interfaces
- Implementing wallet-specific features based on the active connection
Returns
connection
: Reactive reference to the currently active wallet connectionswitchConnection
: Function to switch to a different connected wallet
Related composables: useAppKitConnections, useAppKitAccount
usePay
Composable function that manages payment modal interactions and handles crypto payment flows. Use this composable when implementing payment features with exchange integrations.Use Cases
- Implementing crypto payment flows in your application
- Handling payment success and error states
- Integrating with centralized exchanges for payments
- Building custom payment interfaces
Parameters
onSuccess
: Optional callback function called when payment succeedsonError
: Optional callback function called when payment fails
Returns
pay
: Function to initiate a payment with specified parametersisLoading
: Reactive reference to boolean indicating if a payment is in progresserror
: Reactive reference to error object if payment fails
Related composables: useAvailableExchanges, usePayUrlActions
useAvailableExchanges
Composable function that fetches and manages the state for available exchanges. Use this composable when you need to display available payment options or filter exchanges based on criteria.Use Cases
- Displaying available exchanges to users
- Filtering exchanges based on asset or network
- Building custom exchange selection interfaces
- Implementing exchange comparison features
Parameters
isFetchOnInit
: Whether to fetch exchanges on composable initializationasset
: Filter exchanges by specific assetamount
: Filter exchanges by minimum amountnetwork
: Filter exchanges by network support
Returns
data
: Reactive reference to array of available exchangesisLoading
: Reactive reference to boolean indicating if exchanges are being fetchederror
: Reactive reference to error object if fetching failsfetch
: Function to manually refetch exchanges
Related composables: usePay, usePayUrlActions
usePayUrlActions
Composable function that provides functions to interact with specific exchange URLs, returning the sessionId needed for status tracking. Use this composable when implementing custom exchange flows.Use Cases
- Building custom exchange integration flows
- Implementing exchange URL generation
- Creating custom payment interfaces
- Tracking exchange sessions for status monitoring
Returns
getUrl
: Function that returns exchange URL and session IDopenUrl
: Function that opens exchange URL and returns session data
Related composables: useExchangeBuyStatus, useAvailableExchanges
useExchangeBuyStatus
Composable function that fetches and polls for the status of a headless payment transaction using exchangeId and sessionId. Use this composable to track payment progress and handle completion.Use Cases
- Tracking payment transaction status
- Implementing payment progress indicators
- Handling payment completion and failure states
- Building real-time payment monitoring
Parameters
exchangeId
: The exchange identifiersessionId
: The session ID from payment URL actionspollingInterval
: How often to check status (in milliseconds)isEnabled
: Whether to enable status pollingonSuccess
: Callback for successful payment completiononError
: Callback for payment errors
Returns
data
: Reactive reference to current payment status dataisLoading
: Reactive reference to boolean indicating if status is being fetchederror
: Reactive reference to error object if status fetching failsrefetch
: Function to manually refetch status
Related composables: usePayUrlActions, usePay
useAppKitUpdateEmail
Composable function that updates user email address with success and error handling. Use this composable when implementing email update functionality for user accounts.Use Cases
- Implementing email update functionality
- Building user profile management interfaces
- Handling email verification flows
- Creating account settings pages
Parameters
onSuccess
: Optional callback function called when email update succeedsonError
: Optional callback function called when email update fails
Returns
data
: Reactive reference to updated email data objecterror
: Reactive reference to error object if update failsisPending
: Reactive reference to boolean indicating if update is in progressisError
: Reactive reference to boolean indicating if there was an errorisSuccess
: Reactive reference to boolean indicating if update was successfulupdateEmail
: Function to trigger email update
Related composables: useAppKitAccount, useWalletInfo
useAppKitSIWX
Composable function that provides access to Sign In With X (SIWX) configuration and state. Use this composable when implementing custom authentication flows with various blockchain protocols.Use Cases
- Implementing custom Sign In With X flows
- Accessing SIWX configuration for custom authentication
- Building protocol-specific authentication interfaces
- Handling multi-protocol sign-in scenarios
Returns
siwxConfig
: Reactive reference to the current SIWX configuration object, or undefined if not configured
Related composables: useAppKitAccount, useAppKitUpdateEmail
useAppKitConnection (Solana)
Solana-specific composable function that provides access to the Solana connection instance for blockchain interactions. Use this composable when building Solana-specific features.Use Cases
- Accessing Solana connection for blockchain interactions
- Building Solana-specific transaction flows
- Implementing Solana program interactions
- Creating Solana wallet features
Returns
connection
: Reactive reference to the Solana connection instance, or undefined if not connected
This is the Solana-specific version of useAppKitConnection. For general connection management, see useAppKitConnection.
Ethereum/Solana Library
You can use Wagmi actions to sign messages, interact with smart contracts, and much more.
getAccount
Action for accessing account data and connection status.signMessage
Action for signing messages with connected account.useAppKitProvider
Hook that returns thewalletProvider
and the WalletProviderType
.