For the complete documentation index, see llms.txt. This page is also available as Markdown.

Solflare Wallet SDK

If your dApp does not use the Solana Wallet Adapter, you can integrate Solflare directly using the Solflare Wallet SDK.

First, install the package:

npm install @solflare-wallet/sdk@latest

Initialize the SDK:

import Solflare from '@solflare-wallet/sdk';

const wallet = new Solflare();

wallet.on('connect', () => {
    console.log('connected', wallet.publicKey.toString());
});
wallet.on('disconnect', () => {
    console.log('disconnected');
});

Connect to the wallet - this will trigger either the extension, web or mobile connection. The returned promise will resolve when the user accepted or rejected the connection.

await wallet.connect();

Send a Solana transaction:

If you only want to sign one or multiple transactions:

Sign a test message:

Last updated

Was this helpful?