Solana Wallet support is in beta. Please reach out if you run into any issues or need support integrating.
Solana is supported, enabling you to create embedded wallets, sign transactions, sponsor gas, and batch transactions on Solana. Create both EVM and Solana wallets with social login and use those wallets alongside existing Solana libraries like @solana/web3.js to build seamless, gasless user experiences!
Key features:
- Create Solana wallets with email, social login, passkeys, etc.
- Sign Solana messages and transactions
- Send Solana transactions
- Sponsor gas and rent for Solana transactions
- Batch multiple Solana instructions in a single transaction
This guide will walk you through setting up and using Smart Wallets on Solana.
- Set up social login methods and user authentication
- Install a Solana library, such as
@solana/web3.jsto handle transaction construction and submissionnpm install @solana/web3.js - Get an API key from the dashboard and enable Solana and EVM networks (you need both).
- Install the latest
@account-kitpackages:
yarn add @account-kit/infra @account-kit/reactFirst, set up user login and authentication if you haven't already.
Next, add Solana to your configuration by using the solana parameter when calling createConfig in the config.ts file and replace the API key with your key.
Note: It is required to set the chain parameter in the config. You can choose any EVM chain that your app has enabled like sepolia.
import { cookieStorage, createConfig } from "@account-kit/react";
import { Connection } from "@solana/web3.js";
import { sepolia } from "@account-kit/infra";
...
createConfig({
...otherConfig
chain: sepolia,
solana: {
connection: new Connection(
"https://solana-devnet.g.alchemy.com/v2/<API_KEY>",
{
wsEndpoint: "wss://api.devnet.solana.com",
commitment: "confirmed",
}
),
policyId: "<PolicyId>" // Optional - gas/rent sponsorship policy ID: https://dashboard.alchemy.com/gas-manager
}
}Once a user has been authenticated, you can retrieve their Solana wallet address in 2 ways:
If you only need the Solana wallet address and signer, use this hook.
import { useSolanaSigner } from "@account-kit/react";
function MyComponent() {
const signer = useSolanaSigner({});
if (!signer) {
return <div>Loading signer...</div>;
}
return <div>Solana Address: {signer.address}</div>;
}If you want to connect to a user’s Solana Wallet and send transactions, you should use the useSolanaTransaction hook. This hook also exposes the Solana wallet address through the signer.address parameter.
If you are not using React, use lower level libraries to convert your authentication instance into a Solana-compatible signer using the SolanaSigner class. See the Solana docs.