# Solflare Wallet SDK

If your dApp does not use the [Solana Wallet Adapter](/solflare/technical/integrate-solflare/using-the-solana-wallet-adapter.md), you can integrate Solflare directly using the Solflare Wallet SDK.

First, install the package:

```sh
npm install @solflare-wallet/sdk@latest
```

Initialize the SDK:

```typescript
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.

```typescript
await wallet.connect();
```

Send a Solana transaction:

```typescript
const transaction = new Transaction();
// add instructions

const txSignature: string = await wallet.signAndSendTransaction(transaction);
```

If you only want to sign one or multiple transactions:

```typescript
const signedTransaction: Transaction = await wallet.signTransaction(transaction);

const signedTransactions: Transaction[] = await wallet.signAllTransactions([
    transaction1,
    transaction2
]);
```

Sign a test message:

```typescript
const message = 'To verify your wallet on https://example.com, with this message';

const messageBytes = new TextEncoder().encode(message);

const signature: Uint8Array = await wallet.signMessage(messageBytes, 'utf8');
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.solflare.com/solflare/technical/integrate-solflare/solflare-wallet-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
