Learn how you can use external wallets alongside your embedded wallets in your React app using Turnkey’s abstractions.
Authentication
Connecting
WalletProvider
.
A WalletProvider refers to an external wallet interface, such as a browser extension (e.g., MetaMask, Phantom) or a bridge like WalletConnect (if enabled). These providers act as the bridge between your app and the user’s wallet for signing, authentication, and transaction purposes.
You can retrieve available wallet providers by calling the getWalletProviders()
, which returns an array of WalletProvider instances available in the current environment.
getWalletProviders()
. To determine whether it’s connected, you can inspect the provider.connectedAddresses
property. This will list the currently connected addresses for that provider.
Note:
- Each
WalletProvider
can only maintain one active connection per namespace (e.g., one Ethereum address and one Solana address at a time).
- Example: if you connect a second Ethereum address in MetaMask, it will replace the currently connected one. The same applies for Solana.
- If a provider supports multiple namespaces (e.g., MetaMask supports both Ethereum and Solana), it will appear as two separate providers in the result of
getWalletProviders()
.
- They may share the same display name (e.g.,
"MetaMask"
), but they’ll have differentchainInfo
values and are treated independently in authentication and connection logic.- The duration of a connection depends on the provider’s behavior.
- Most providers maintain a session until it is explicitly disconnected, either from your app or manually via the wallet UI (e.g., disconnecting in MetaMask).
WalletProvider
objects are returned when both Ethereum, Solana, and WalletConnect are enabled.
interfaceType
– identifies where the provider came from:
chainInfo
– the blockchain namespace, and optionally a chain ID.info
– metadata about the provider, such as name, icon, and (sometimes) uuid or rdns.provider
– the underlying RPC provider injected by the wallet.connectedAddresses
– an array of currently connected addresses (populated after the user connects).namespace: "ethereum"
) - always includes a chainId
in chainInfo
(e.g., “0x1” for Mainnet, “0xaa36a7” for Sepolia).namespace: "solana"
) - never includes a chainId
, since Solana is a single-chain ecosystem.interfaceType: "wallet_connect"
) - includes a uri
property used for the session handshake.info
) - Native Ethereum providers may expose extra fields like uuid
and rdns
, while Native Solana providers usually only include a name
and icon
.