npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vue-solana/vue

v4.5.1

Published

Vue plugin and composables for Solana applications.

Readme

@vue-solana/vue

npm version npm downloads license docs

Solana wallet, RPC, account, message signing, and transaction composables for Vue 3.

Related packages

This package is part of the Vue Solana family. Choose based on your app framework:

  • @vue-solana/core — framework-agnostic Solana primitives: Kit RPC client helpers, wallet types, Android MWA registration, iOS browser wallet helpers, message signing, token account reads, and transaction helpers. Use this directly when you want shared RPC/wallet/transaction helpers without installing a Vue plugin (non-Vue apps, server/relayer code, or your own framework integration).

  • @vue-solana/vue — Vue 3 plugin plus composables for RPC, account, balance, wallet, message signing, live data, and transactions. Use this in plain Vue 3 apps (Vite, etc.). (This package.)

  • @vue-solana/nuxt — Nuxt module that installs the Vue plugin and auto-imports the composables. Use this in Nuxt 3/4 apps.

This package builds on @vue-solana/core; install @vue-solana/vue for plain Vue apps and @vue-solana/nuxt for Nuxt apps.

Use this package in Vue 3 apps that need Solana RPC access, balance reads, wallet state, message signing, and transaction helper state.

New to Solana? Start with the official docs and the project concepts guide:

Features

  • Vue plugin for shared Solana RPC and wallet context.

  • SSR-safe composables that return inert state when no client plugin context is available.

  • RPC status and latest blockhash reads.

  • Balance, account info, program account, signature status, token account, and token balance composables.

  • Unified wallet discovery and selection for browser extensions, Android Mobile Wallet Adapter, and supported iOS browser wallets.

  • Message signing helpers for wallet ownership and authentication challenges.

  • Sign In With Solana (SIWS) authentication through useSignIn().

  • App-wide selected wallet account context with persistence.

  • Transaction submission and confirmation state helpers, including batch signing and sign-and-send.

  • Solana Pay request building, QR rendering and scanning, and reference-based settlement confirmation (useSolanaPay, useSolanaPayConfirmation, useSolanaQrCode, useSolanaQrScanner).

  • Live data composables over Kit reactive stores (useRequest, useSubscription, useTrackedData) plus SWR cache adapters.

  • A generic async action state machine (useAction) built on @vue-solana/core/action.

  • Reactive Kit client signers (usePayer, useIdentity) and transaction planning (usePlanTransaction, usePlanTransactions) with fail-fast client capability assertions.

  • Client-sent transactions through the official Kit planner and RPC plan-sending executor installed by the default client.

  • Direct subpath exports for narrower imports.

Compatibility

| Requirement | Supported | | ------------- | ----------------------------------------------------------------- | | Vue | ^3.5.0 | | TypeScript | TypeScript 5.x recommended | | Solana client | Provided through @vue-solana/core | | Clusters | mainnet (alias mainnet-beta), devnet, testnet, localnet |

Install

pnpm add @vue-solana/vue
npm install @vue-solana/vue

Since v3.0.0 this package is ESM only. There is no require export condition and no top-level main, so require("@vue-solana/vue") fails with No "exports" main defined. Vite apps are unaffected; pin to @vue-solana/vue@^2 if you must stay on CommonJS.

Plugin Setup

import { createApp } from "vue";
import { createSolanaPlugin } from "@vue-solana/vue";
import App from "./App.vue";

const solana = createSolanaPlugin({
  cluster: "devnet",
  mobileWallet: {
    appIdentity: {
      name: "My Vue Solana App",
      uri: "https://example.com",
      icon: "favicon.ico",
    },
  },
});

createApp(App).use(solana).mount("#app");

// On teardown:
// app.unmount();
// solana.dispose();

Android Mobile Wallet Adapter registration is enabled by default on supported Android Chrome clients. Pass mobileWallet options to customize the MWA app identity, or pass mobileWallet: false to disable Android mobile wallet registration.

iOS browser wallet universal links for Phantom, Solflare, and Backpack are enabled by default on iOS browsers. Pass iosWallet options to customize the app identity and redirect URL, or pass iosWallet: false to disable iOS browser wallet entries.

You can also pass a custom RPC endpoint:

createApp(App).use(
  createSolanaPlugin({
    cluster: "mainnet",
    endpoint: "https://your-rpc.example.com",
    commitment: "confirmed",
  }),
);

Supported clusters are mainnet (legacy alias mainnet-beta), devnet, testnet, and localnet. Use mainnet for Solana mainnet; this is Solana's official mainnet cluster name.

payer and payerSecretKey are supported by direct Vue/core clients. A client-sent transaction requires a payer. Never put a raw secret or payerSecretKey in Nuxt public runtime config, and never ship a funded signing key to an end-user browser. The default createSolanaPlugin() client composes solanaRpc() followed by rpcAirdrop(); solanaRpc() installs rpcTransactionPlanner(), rpcTransactionPlanSigningExecutor(), and rpcTransactionPlanSendingExecutor() itself, so the client exposes RPC reads and subscriptions plus planTransaction(s), signTransaction(s), and sendTransaction(s) with no extra plugin. The old custom fallback sender is not used.

Plugin Options

| Option | Type | Default | Description | | ---------------- | -------------------------------------------------------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------- | | cluster | "mainnet" \| "mainnet-beta" \| "devnet" \| "testnet" \| "localnet" | "devnet" | Solana cluster used when endpoint is omitted. | | endpoint | string | Public endpoint for cluster | HTTP RPC endpoint. Use a dedicated RPC provider for production apps. | | wsEndpoint | string | Derived from endpoint | WebSocket RPC endpoint. | | commitment | Solana commitment | Solana client default | Default commitment for created connections. | | autoConnect | boolean | false | Reconnects only a previously selected discovered wallet identity when it is discovered again. | | payer | TransactionSigner | None | Client fee payer and signer for client-sent transactions. | | payerSecretKey | string | None | Base64 64-byte Ed25519 keypair, secret key first, resolved at client creation. | | wallet | SolanaWallet | Disabled | Custom wallet adapter, useful for tests or custom integrations. | | mobileWallet | MobileWalletOptions \| false | Enabled on supported Android clients | Configures or disables Android Mobile Wallet Adapter registration. | | iosWallet | iOSWalletOptions \| false | Enabled on iOS browsers | Configures or disables iOS browser wallet universal links (Phantom, Solflare, Backpack). |

The root export remains supported. For composables, prefer direct subpath imports in new code so bundlers can avoid evaluating unrelated package entry code:

import { useRpc } from "@vue-solana/vue/useRpc";
import { useWallet } from "@vue-solana/vue/useWallet";
import { useSignMessage } from "@vue-solana/vue/useSignMessage";

Client and Plugin Lifecycle

createSolanaPlugin() builds the Kit client once, during install(). Create the plugin at module scope and reuse the instance:

// solana.ts
import { createSolanaPlugin } from "@vue-solana/vue";

export const solana = createSolanaPlugin({ cluster: "devnet" });

Calling createSolanaPlugin() again builds a new client and context, discarding the existing wallet selection and RPC state. If your config is reactive — a cluster toggle, for example — memoize on the config so a new plugin (and client) is built only when the value actually changes, not on every render:

import { computed, ref } from "vue";

const cluster = ref<SolanaCluster>("devnet");
const plugin = computed(() => createSolanaPlugin({ cluster: cluster.value }));

A Kit client runs its createClient().use(...) plugins during construction. When one of those plugins is async, the client — and any context built from it — only activates after that promise resolves. Defer real RPC and wallet work to client lifecycle hooks or user actions after hydration rather than running it during setup or SSR.

For development, use devnet and request free test SOL from the official faucet:

https://faucet.solana.com

Read RPC State

<script setup lang="ts">
import { useRpc } from "@vue-solana/vue/useRpc";

const { cluster, endpoint, status, error, latestBlockhash, checkConnection } = useRpc();
</script>

<template>
  <section>
    <p>Cluster: {{ cluster }}</p>
    <p>Endpoint: {{ endpoint }}</p>
    <p>Status: {{ status }}</p>
    <p>Latest blockhash: {{ latestBlockhash }}</p>
    <p v-if="error">Error: {{ error }}</p>
    <button type="button" @click="checkConnection">Check RPC</button>
  </section>
</template>

Read Balance

<script setup lang="ts">
import { ref } from "vue";
import { useBalance } from "@vue-solana/vue/useBalance";

const address = ref("PASTE_A_SOLANA_ADDRESS");
const { balance, loading, error, refresh } = useBalance(address);
</script>

<template>
  <section>
    <p>Lamports: {{ balance }}</p>
    <p v-if="loading">Loading...</p>
    <pre v-if="error">{{ error }}</pre>
    <button type="button" @click="refresh">Refresh</button>
  </section>
</template>

Airdrop on Test Networks

useAirdrop() sends SOL to an account on devnet, testnet, or a local validator. The default Vue client includes the RPC and airdrop capabilities; a custom client can install them with createClient().use(solanaRpc({ ... })).use(rpcAirdrop()) from @solana/kit-plugin-rpc.

import { lamports } from "@vue-solana/vue/kit";
import { useAirdrop } from "@vue-solana/vue/useAirdrop";

const { data, status, error, dispatch } = useAirdrop();
await dispatch(address, lamports(1_000_000_000)); // 1 SOL

Each dispatch(address, amount) runs a fresh airdrop and aborts the previous in-flight call. data resolves to the transaction Signature, or to undefined when the network applies the airdrop without a transaction (some local validators, e.g. LiteSVM).

Airdrops to a single address are rate-limited (public devnets commonly return HTTP 429, and 1 SOL requires enough devnet balance); wait before dispatching again or use a fresh address. Errors surface through error / the error state.

Read Account Data

import { useAccountInfo } from "@vue-solana/vue/useAccountInfo";
import { useProgramAccounts } from "@vue-solana/vue/useProgramAccounts";
import { useSignatureStatus } from "@vue-solana/vue/useSignatureStatus";

const account = useAccountInfo(address, { watch: true });
const programAccounts = useProgramAccounts(programId, {
  dataSlice: { offset: 0, length: 32 },
  filters: [{ dataSize: 165 }],
});
const signatureStatus = useSignatureStatus(signature, {
  pollIntervalMs: 2_000,
  searchTransactionHistory: true,
});

There is no per-call commitment option for useSignatureStatus(); getSignatureStatuses takes no per-call commitment, so reads use the commitment baked into the endpoint. Polling uses chained timeouts and stopPolling() prevents further ticks until the watched signature changes (which restarts polling). Invalid pollIntervalMs values return an INVALID_INPUT SolanaError.

Read SPL token accounts and balances through Kit RPC jsonParsed:

import { useTokenAccounts } from "@vue-solana/vue/useTokenAccounts";
import { useTokenBalance } from "@vue-solana/vue/useTokenBalance";

const tokenAccounts = useTokenAccounts(ownerAddress, { commitment: "confirmed" });
const tokenBalance = useTokenBalance(mintAddress, ownerAddress);

useProgramAccounts() can be expensive on public RPC nodes. Prefer narrow filters, use dataSlice when you only need part of account data, and avoid polling broad program scans.

Wallet State

<script setup lang="ts">
import { useWallet } from "@vue-solana/vue/useWallet";
import { useWallets } from "@vue-solana/vue/useWallets";

const { wallets, selectedWallet, selectWallet, refreshWallets } = useWallets();
const { publicKey, connected, connecting, canSignMessage, connect, disconnect } = useWallet();
</script>

<template>
  <section>
    <button type="button" @click="refreshWallets">Refresh Wallets</button>
    <button
      v-for="wallet in wallets"
      :key="wallet.name"
      type="button"
      @click="selectWallet(wallet)"
    >
      {{ wallet.name }}
    </button>
    <p>Selected: {{ selectedWallet?.name ?? "None" }}</p>
    <p>Connected: {{ connected }}</p>
    <p>Public key: {{ publicKey }}</p>
    <p>Can sign messages: {{ canSignMessage }}</p>
    <p v-if="connecting">Connecting...</p>
    <button type="button" :disabled="!selectedWallet || connected || connecting" @click="connect">
      Connect
    </button>
    <button type="button" :disabled="!connected" @click="disconnect">Disconnect</button>
  </section>
</template>

Browser extension wallets are discovered through the Solana Wallet Standard. Android Mobile Wallet Adapter wallets are registered through @solana-mobile/wallet-standard-mobile and exposed through the same useWallets() list on supported Android Chrome clients. iOS Phantom, Solflare, and Backpack entries are exposed through wallet-specific universal links on iOS browsers. connect() works after selecting a discovered wallet or configuring a custom SolanaWallet.

Connecting a wallet also disconnects every other discovered wallet through its standard:disconnect feature, so only one wallet stays authorized for the app. An extension the user authorized in an earlier page session can otherwise keep answering signing requests, which is the usual cause of the wrong wallet prompting for a signMessage confirmation. A wallet that fails or never answers its disconnect is ignored after a 2 second timeout, and connect() resolves only after the sweep finishes.

Selected discovered wallets are persisted under localStorage["vue-solana:selected-wallet"] as non-sensitive identity metadata: name, platform/source when available, and connected: true while the wallet is connected. On reload, Vue Solana restores the selected wallet if the same wallet is discovered again. A wallet the user left connected is restored after a reload even without autoConnect, through a silent connect (connect({ silent: true })) that does not prompt or launch a wallet app for wallets that honour the Wallet Standard silent hint (a wallet that ignores it can prompt on page load); an explicit disconnect() forgets that session. Pass autoConnect: true to also connect a restored wallet that was only selected; arbitrary installed wallets are never auto-connected. Calling selectWallet(null) or setWallet(customWallet) clears the stored selection.

Desktop native app wallet adapters are planned but not implemented yet.

Composables return inert SSR-safe state when no plugin context is available. Real RPC and wallet operations still require the plugin-provided client context.

Message Signing

<script setup lang="ts">
import { computed } from "vue";
import { useSignMessage } from "@vue-solana/vue/useSignMessage";
import { useWallet } from "@vue-solana/vue/useWallet";

const { connected, canSignMessage } = useWallet();
const { signature, status, error, execute } = useSignMessage();

const message = computed(() => new TextEncoder().encode("Sign in to My Vue Solana App"));

async function signIn() {
  await execute(message.value);
}
</script>

<template>
  <section>
    <button type="button" :disabled="!connected || !canSignMessage" @click="signIn">
      Sign message
    </button>
    <p>Status: {{ status }}</p>
    <p v-if="signature">Signature bytes: {{ signature.length }}</p>
    <pre v-if="error">{{ error.message }}</pre>
  </section>
</template>

Message signing proves wallet ownership for flows like authentication challenges. It does not sign, submit, or authorize Solana transactions. For authentication, issue a server-generated nonce, include domain and expiration details in the message, and verify the returned signature server-side. The adapter also checks the signature against the account's public key before resolving, where Ed25519 (WebCrypto) is available — a best-effort client-side guard that rejects with INVALID_SIGNATURE, not a replacement for server-side verification.

Transaction State

import { useSignAndSendTransaction } from "@vue-solana/vue/useSignAndSendTransaction";

const { signature, confirmation, status, loading, error, execute } = useSignAndSendTransaction();

await execute(transaction, {
  confirm: true,
  confirmation: { commitment: "confirmed" },
  skipPreflight: false,
});

The current wallet must be connected and support either signAndSendTransaction or signTransaction. Android Mobile Wallet Adapter wallets prefer signTransaction plus app-side RPC submission when available. This avoids a mobile handoff edge case where the wallet sends successfully but the browser page does not receive the wallet adapter's returned signature.

Without confirm: true, execute() returns after submission and sets status to sent. With confirmation enabled, status moves through sending, confirming, and then processed, confirmed, or finalized to match the requested commitment. If confirmation times out or fails, the submitted signature remains available so the app can link to an explorer.

Use useTransactionConfirmation() when you already have a submitted signature and want to wait for confirmation separately:

import { useTransactionConfirmation } from "@vue-solana/vue/useTransactionConfirmation";

const confirmation = useTransactionConfirmation({ commitment: "finalized" });

await confirmation.confirm(signature);

useSignAndSendTransaction() also clears loading if a wallet adapter never returns a result. In that stale case, error is set and the chain status may be unknown, so check the connected wallet or an explorer before retrying.

Wallet Request Inputs and Returns

Wallet signing flows accept transaction input as raw Uint8Array wire bytes that conform to the Solana transaction schema. Build them with the Kit helpers from @vue-solana/vue/kit (or decode them from a base64/base58 RPC response); base64 strings, transaction objects, and instruction lists are not accepted here.

import { compileTransaction, getTransactionEncoder } from "@vue-solana/vue/kit";

const transaction: Uint8Array = getTransactionEncoder().encode(compileTransaction(message));
await execute(transaction);

useSignMessage() takes the raw message bytes to sign. Every wallet send request also accepts the Kit SendTransactionOptions:

| Option | Description | | --------------------- | ------------------------------------------------------------------------------------------------------------- | | skipPreflight | Skip preflight simulation before sending. | | maxRetries | RPC node retry count (bigint). | | minContextSlot | Slot at which any blockhash or nonce in the transaction is known to exist; sending before it can be rejected. | | preflightCommitment | Commitment used for preflight simulation. |

Return shapes:

  • useSignMessage().execute(bytes) resolves to { signedMessage, signature }, both Uint8Array.

  • useSignTransactions().execute(transactions) resolves to the signed Uint8Array[] (also exposed as signedTransactions); pass a single-element array for one transaction.

  • useSignAndSendTransaction().execute(transaction) resolves to the submitted signature string; with confirm: true it also fills confirmation.

  • useSignAndSendTransactions().execute(transactions) resolves to a string[] of signatures (also exposed as signatures).

A wallet may modify the message or transaction before signing — for example to add its own instruction or change the fee payer — and the Wallet Standard explicitly allows it. Re-read the returned signedMessage or signed transaction bytes instead of assuming they match your input byte-for-byte.

Sending with the Client (no wallet popup)

useSendTransaction() and useSendTransactions() send through the Kit client's transaction-sending capability (ClientWithTransactionSending) instead of the connected wallet. The client plans the transaction from your input, signs it with its own signers — typically the client identity or payer keypair, e.g. a relayer — submits it, and returns the result. There is no wallet extension and no approval popup. The official executor waits for confirmed commitment before resolving.

Configure a direct client with payer or payerSecretKey. payerSecretKey is a base64 64-byte Ed25519 keypair and must stay in a trusted server or development context. Never put it in Nuxt public runtime config or ship a funded key to an end-user browser.

Which to use:

| Flow | useSendTransaction(s) (client) | useSignAndSendTransaction(s) (wallet) | | --------------------- | ------------------------------------------------------------ | ----------------------------------------- | | Who authorizes | The client's fee payer / signer keypairs | The connected wallet (user approves) | | Environment | Server-side, relayer, or automated flows (no browser wallet) | Browser dapps where the user must approve | | Popup | None | Wallet approval popup / mobile handoff | | Input | Instructions, instruction plans, transaction messages, plans | Raw transaction bytes (Uint8Array) | | Multiple transactions | Yes, as a batch in one call | Yes, one or more wallet requests |

Use the client flow for automated or server-backed signing (airdrop faucet, cron jobs, relayer fees paid by your keypair), and the wallet flow when the end user must own and approve each transaction.

Default client composition. createSolanaPlugin() and createSolanaClient() compose solanaRpc() followed by rpcAirdrop() by default; solanaRpc() installs rpcTransactionPlanner(), rpcTransactionPlanSigningExecutor(), and rpcTransactionPlanSendingExecutor() itself. The old custom fallback sender is not used, so useSendTransaction() and useSendTransactions() do not need a second manual plugin installation. The official executor waits for confirmed commitment before execute() resolves and the composable reports sent. A custom client must still provide the planner and sending executor and a payer.

import { useSendTransaction } from "@vue-solana/vue/useSendTransaction";
import { useSendTransactions } from "@vue-solana/vue/useSendTransactions";

const single = useSendTransaction();
const batch = useSendTransactions();

useSendTransaction().execute() accepts flexible input and resolves to the successful transaction result:

const { data, status, error, execute } = useSendTransaction();

// A raw list of instructions
await execute(instructions);

// A planned instruction plan or a single transaction plan
await execute(plan);

// A single transaction message
await execute(transactionMessage);

// data.context.signature is the submitted Signature

useSendTransactions().execute() plans, signs, and sends one or more messages at once — parallel where possible, sequential where dependencies require it — and resolves to the full plan result tree:

const { data, status, error, execute } = useSendTransactions();

// A batch of transaction messages
await execute([messageA, messageB]);

// A message, a plan, or a nested batch of messages/plans
await execute(nestedBatch);

Both composables surface status (idle, sending, sent, error), loading, error, and data. Starting a new execute() while one is in flight aborts the previous call; the stale attempt rejects and its state is discarded. Pass an { abortSignal } to additionally cancel from outside (unmounting the owning component also aborts in-flight work).

Because signing keypairs live on the client, reserve useSendTransaction(s) for trusted contexts (your relayer, automated flows). Do not register app-signing keypairs on a client exposed to end-user browsers, where a compromised page could spend funds.

Superseded or aborted attempts reject with a wrapped error. To tell "superseded or cancelled" apart from a real failure, inspect the rejection's cause:

try {
  await execute(instructions);
} catch (cause) {
  if (cause?.cause instanceof DOMException && cause.cause.name === "AbortError") {
    // superseded by a newer call or cancelled via abortSignal / unmount
  }
}

Live Data

useRequest() fetches once per change and revalidates stale data in the background. Pass a request function, a pending Kit RPC request, or a ref/computed of either:

import { useSolanaClient } from "@vue-solana/vue/useSolanaClient";
import { useRequest } from "@vue-solana/vue/useRequest";

const { client } = useSolanaClient();
const { data, error, status, refresh } = useRequest(() => client.rpc.getSlot().send());

useSubscription() streams live slots from rpcSubscriptions reactive stores:

import { useSubscription } from "@vue-solana/vue/useSubscription";

const subscription = useSubscription(() => client.rpcSubscriptions.slotNotifications());
subscription.data; // { value: { slot: number } }
subscription.reconnect();

useTrackedData() pairs a slot-tracking request with a subscription, reusing a single subscription for concurrent mounts:

import { useTrackedData } from "@vue-solana/vue/useTrackedData";

const balance = useTrackedData({
  rpcRequest: client.rpc.getBalance(address),
  rpcSubscriptionRequest: client.rpcSubscriptions.balanceNotifications(address),
  rpcValueMapper: (response) => response.value,
});

The swr adapters seed fresh mounts from the last-known value for the same cache key:

import { useRequestSwr } from "@vue-solana/vue/swr";

const balance = useRequestSwr(["balance", address], () => client.rpc.getBalance(address).send());

The SWR cache is module-level and shared across the whole app, including across SSR requests. Namespace cache keys per request (for example by including a request or session id) or call clearSwrCache() at the start of each server request to avoid leaking one request's cached data into another. On the client the cache is intentionally shared for stale-while-revalidate seeding. It is capped at 1024 entries with oldest-first eviction. Use deleteSwrKey(key) to evict a single entry by its full cache key (including the adapter prefix like request:).

The cache is keyed off key, not off the fetcher's identity. A function source is unwrapped from its ref/computed (or used as-is when it is bare), so an inline closure is fine and there is no useCallback-style memoization to maintain. To swap the source or the spec — a different account, mint, or filter — change the key with it: a new key starts a new cache entry, while keeping the old key reuses the stale seed even though the function now does something else.

Cancellation flows through unchanged. getAbortSignal is read on every attempt, including the initial fire, any revalidation the underlying hook performs, and a manual refresh() / reconnect(). Those methods also forward their per-call { abortSignal } override, which replaces the factory for that attempt only — the next attempt goes back to getAbortSignal, so there is no persistent mutation-time override. Without getAbortSignal the attempt still gets a fresh internal signal that is never aborted by a timeout; when a newer attempt supersedes it the composable aborts the attempt, and the cache keeps the last-known value because a superseded result never writes back.

There is deliberately no action SWR adapter. React's useSWRMutation exists because SWR owns the mutation half of its cache; here actions are already imperative (useAction, useSendTransaction, useSignAndSendTransaction), so an adapter would add a layer without a cache entry to revalidate. Call the action, then refresh() the affected SWR key if the mutation changes a cached read.

Cancellation & Timeouts

useRequest(), useSubscription(), and useTrackedData() accept a getAbortSignal option — a factory called once per attempt (request) or connection (subscription/tracked data). It is the natural place for a timeout:

const { data, refresh } = useRequest(source, {
  getAbortSignal: (attempt) => AbortSignal.timeout(10_000),
});

await refresh({ abortSignal: AbortSignal.timeout(2_000) });

The factory is read fresh from the latest render on every attempt, so inline closures work without useCallback-style wrapping. Each manual refresh or reconnect can instead pass a single { abortSignal } override that replaces the factory for that attempt; pass AbortSignal explicitly as undefined to skip caller cancellation entirely. Aborting the composed signal fails only that attempt — previous data is kept and status drops back to error.

To kill the data hook entirely, set its source to null (status becomes disabled and in-flight work is cancelled) or unmount the component that owns it.

Actions with useAction

useAction() and its derivatives (useAirdrop(), useSignAndSendTransaction() themes) manage one async action at a time:

const { data, status, error, dispatch } = useAction(async (signal, input) => {
  /* ... */
});

dispatch(inputA); // runs
await dispatch(inputB); // aborts dispatch(inputA) before starting
  • useAction keeps the handler in a ref — every dispatch runs the latest closure, so there is no deps array to keep in sync. In-flight calls keep running with the closure they started with.

  • dispatch returns a Promise<TResult>. If a newer dispatch supersedes it, the older promise rejects with an abort error; awaiters should treat that as "superseded", not a failure, and fresh awaits win.

  • Calling dispatch again aborts the prior in-flight call with a fresh AbortSignal, and resets state to idle before the new run starts.

Sign In With Solana

useSignIn() triggers the SIWS flow when the connected wallet supports the solana:signIn feature:

import { useSignIn } from "@vue-solana/vue/useSignIn";

const { signInResult, status, loading, error, signIn } = useSignIn();
await signIn(); // { account, signedMessage, signature } — verify server-side

Selected Wallet Account

useSelectedWalletAccount() requires a provider. Use the SelectedWalletAccountProvider component (or Nuxt's app-wide context) and read the shared selection anywhere in its subtree:

<script setup lang="ts">
import { SelectedWalletAccountProvider } from "@vue-solana/vue";
import { useSelectedWalletAccount } from "@vue-solana/vue/useSelectedWalletAccount";

const [selectedAccount, setSelectedAccount] = useSelectedWalletAccount();
</script>

<template>
  <SelectedWalletAccountProvider>
    <span>Active account: {{ selectedAccount?.address }}</span>
  </SelectedWalletAccountProvider>
</template>

The provider accepts two options:

  • filterWallet(walletName, account) restricts filteredWallets and the accounts that can be selected. Return false for accounts the app cannot use (for example, a wallet whose chains do not include the cluster you target); a wallet whose accounts are all filtered out disappears from the list. Selection is not cleared when the current account becomes filtered — call setSelectedAccount(null) yourself if that combination matters.
  • stateSync persists the selection through { storeSelectedWallet, getSelectedWallet, deleteSelectedWallet }. The default writes to localStorage under vue-solana:selected-wallet-account; pass null to disable persistence. The persisted value is ${walletName}:${account.address}, and a wallet name that itself contains : is safe because the key is split on the last separator. Restoring is best-effort: wallets and their accounts are discovered asynchronously, so a key that cannot be resolved on the first read stays pending and is retried on every wallet change. On the client, a storage event from another tab applies that tab's selection here.

Both options are read once during setup; changing them after mount requires remounting the provider.

Batch Transactions

useSignTransactions() and useSignAndSendTransactions() batch wallet requests and fall back to singular calls when the wallet only supports one at a time:

import { useSignAndSendTransactions } from "@vue-solana/vue/useSignAndSendTransactions";

const { signatures, status, loading, error, execute } = useSignAndSendTransactions();
await execute([transactionOne, transactionTwo]); // signatures: string[]

When a wallet falls back to sequential signing and a later send fails, useSignAndSendTransactions() throws a PartialSignAndSendError whose signatures field lists the sends that already landed.

Wallet Account Signers

Three composables expose a wallet account as a Kit signer, so it can be passed anywhere @solana/kit expects a MessageModifyingSigner, TransactionModifyingSigner, or TransactionSendingSigner:

import { useSelectedWalletAccount } from "@vue-solana/vue/useSelectedWalletAccount";
import { useWalletAccountMessageSigner } from "@vue-solana/vue/useWalletAccountMessageSigner";
import { useWalletAccountTransactionSendingSigner } from "@vue-solana/vue/useWalletAccountTransactionSendingSigner";
import { useWalletAccountTransactionSigner } from "@vue-solana/vue/useWalletAccountTransactionSigner";

const [selectedAccount] = useSelectedWalletAccount();
const messageSigner = useWalletAccountMessageSigner(selectedAccount);
const transactionSigner = useWalletAccountTransactionSigner(selectedAccount, "solana:devnet");
const sendingSigner = useWalletAccountTransactionSendingSigner(selectedAccount, "solana:devnet");
  • The account is either the account object from useWallets() / useSelectedWalletAccount() ({ address, publicKey, chains, … }) or its address, optionally inside a ref or getter. The signer's address is reactive, so passing the selected-account ref lets one signer follow an account switch. An empty ref (nothing selected yet) makes both address and signing throw INVALID_INPUT.
  • The message and transaction signers deliberately promise the modifying interfaces (modifyAndSignMessages / modifyAndSignTransactions), because a wallet may rewrite the message before signing (fee payer, priority fee, or its own authentication envelope). They sign one message or transaction per request; a batch rejects with WALLET_FEATURE_UNSUPPORTED instead of silently opening one wallet prompt per item.
  • The sending signer submits through the wallet and resolves signature bytes. For one transaction it prefers the singular signAndSendTransaction request when available; otherwise it uses the batch request, or falls back to one singular request per transaction in sequence. A fallback that fails partway throws PartialSignAndSendError listing the signatures that already landed. Each send request times out after 120 seconds with TRANSACTION_TIMEOUT.
  • Signing goes through the connected wallet, so the account must be the connected one: no wallet throws NO_WALLET_SELECTED, a disconnected wallet throws WALLET_NOT_CONNECTED, and a different connected account throws INVALID_INPUT.
  • chain must be a Solana chain identifier (solana:mainnet, solana:devnet, …). It is validated at creation and not forwarded with the request, because the adapter already selected a chain when the wallet was adapted. When the account is passed as an object that declares chains, the signer also rejects a chain the account does not support.
  • The transaction-modifying signer keeps the lifetime constraint the caller attached, or derives a fresh one from the signed message when the wallet rewrote the message bytes.

Example App

This README includes small snippets for quick reference. For a complete runnable Vue + Vite flow, see the example app:

pnpm dev:vue

Docs: examples/vue-vite

Live demo: vue-solana-docs.vercel.app/demo

AI Agent Skill

If you use an AI coding agent, install the Vue Solana Agent Skill for plugin setup, composable imports, wallet flow guidance, transaction gotchas, and verification commands:

npx skills add vue-solana/vue-solana --skill vue-solana

Docs: Vue Solana Agent Skill

API

| API | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | createSolanaPlugin(options?) | Installs the Vue Solana context and returns { install, context, dispose }. dispose() stops wallet discovery/subscriptions. | | VueSolana | Alias for createSolanaPlugin. | | useSolana() | Returns the full injected Solana context; throws when no plugin context is available (SSR fallback uses a fresh inert context per call). | | tryUseSolana() | Returns the injected Solana context or null when no plugin context is available (SSR-safe). | | MissingClientCapabilityError | Thrown by useClientCapability() (and client-sent composables) when the configured client lacks a required capability; its code is MISSING_CLIENT_CAPABILITY. | | useRpc() | Returns cluster, endpoint, connection status, latest blockhash, the Kit client, and checkConnection(). | | useSolanaClient() | Returns the injected Kit client as { client, rpc }. The recommended RPC path. | | useConnection() | Returns the Kit client. Deprecated in favor of useSolanaClient(). | | useWallet() | Returns wallet refs, computed connection state, and wallet actions. | | useWalletAccountMessageSigner(account) | Kit MessageModifyingSigner for a wallet account, with a reactive address and wallet-backed modifyAndSignMessages(). | | useWalletAccountTransactionSigner(account, chain) | Kit TransactionModifyingSigner that signs one wire transaction per request and keeps or re-derives its lifetime constraint. | | useWalletAccountTransactionSendingSigner(account, chain) | Kit TransactionSendingSigner: the wallet signs and submits, resolving signature bytes. | | useWallets() | Returns discovered browser extension wallets, Android MWA wallets, iOS browser wallet links, and wallet selection actions. | | useSignMessage() | Signs arbitrary message bytes through the connected wallet when message signing is supported. | | useBalance(address, commitment?) | Loads lamport balance for an address string. | | useAirdrop() | Airdrops SOL on devnet/testnet/localnets; data is the Signature, or undefined when applied directly. | | useAccountInfo(address, options?) | Loads normalized account info (executable, lamports, owner, space, data bytes). | | useProgramAccounts(programId, config?) | Loads accounts owned by a program with optional filters, commitment, and dataSlice. | | useTransaction(handler, options?) | Generic async transaction state helper with optional timeout settings. | | useTransactionConfirmation(options?) | Confirms a submitted signature with reactive status and timeout/error state. | | useSignatureStatus(signature, options?) | Reads a transaction signature status with optional polling. | | useSignAndSendTransaction() | Signs and sends a transaction through the configured wallet, with optional confirmation waiting. | | useTokenAccounts(owner, options?) | Reads SPL token accounts for an owner. | | useTokenBalance(mint, owner, commitment?) | Reads the token balance for a mint/owner pair. | | useAction(handler, options?) | Generic async action state machine; each dispatch aborts the prior in-flight call. | | useRequest(source, options?) | One-shot Kit request that re-fires when its source changes, preserving the previous data while revalidating. | | useSubscription(source, options?) | Live data over a Kit reactive stream store (e.g. RPC subscriptions), torn down on unmount. | | useTrackedData(source, options?) | Slot-deduplicated fetch plus subscription over Kit's slot-tracking store. | | useRequestSwr(key, ...) / useSubscriptionSwr(key, ...) / useTrackedDataSwr(key, ...) | Cache-keyed SWR adapters seeding fresh mounts from the last-known result. | | clearSwrCache() | Clears every cached SWR entry. | | deleteSwrKey(key) | Removes a single cached SWR entry by full cache key (including adapter prefix). | | useSignIn(input?) | Sign In With Solana (SIWS) trigger returning { account, signedMessage, signature } for server-side verification. | | useSolanaPay() | Builds/parses Solana Pay transfer request URLs, generates a reference, and verifies settlement against it. | | useSolanaPayConfirmation() | Polls payment status for a Solana Pay reference. | | useSolanaQrCode() | Renders a Solana Pay URL as an SVG QR code. | | useSolanaQrScanner() | Scans Solana Pay QR codes through the camera and BarcodeDetector. | | useSelectedWalletAccount() | App-wide selected wallet account context: [selectedAccount, setSelectedAccount, filteredWallets]. | | SelectedWalletAccountProvider | Component that provides the selected wallet account context to its subtree. | | useSignTransactions() | Batch-signs transactions through the wallet, preferring signTransactions and falling back to signAllTransactions. | | useSignAndSendTransactions() | Signs and sends multiple transactions, returning one signature each, with a singular sequential fallback. | | useClientCapability(capability, options?) | Fails fast with a clear error when the configured Solana client lacks a requested capability. | | tryUseSolana() | Returns the injected Solana context or null when no plugin context is available (SSR-safe). | | usePayer() | Reactive Kit client payer signer ref. The default client exposes a configured payer when supplied. | | useIdentity() | Reactive Kit client identity signer ref (requires an identity signer on a custom client). | | usePlanTransaction() | Plans a single transaction message from instruction inputs without signing or sending; the default client includes the official planner. | | usePlanTransactions() | Plans a batch of transaction messages from instruction inputs. | | useSendTransaction() | Uses the official client transaction-sending capability to plan, sign, submit, and wait for confirmed commitment (no wallet). | | useSendTransactions() | Sends a batch through the same official capability, waiting for confirmed commitment. |

Direct composable subpaths:

  • @vue-solana/vue/useSolana

  • @vue-solana/vue/useSolanaClient

  • @vue-solana/vue/useRpc

  • @vue-solana/vue/useConnection

  • @vue-solana/vue/useAccountInfo

  • @vue-solana/vue/useAirdrop

  • @vue-solana/vue/useBalance

  • @vue-solana/vue/useProgramAccounts

  • @vue-solana/vue/useWallet

  • @vue-solana/vue/useWalletAccountMessageSigner

  • @vue-solana/vue/useWalletAccountTransactionSendingSigner

  • @vue-solana/vue/useWalletAccountTransactionSigner

  • @vue-solana/vue/useWallets

  • @vue-solana/vue/useSignMessage

  • @vue-solana/vue/useTransaction

  • @vue-solana/vue/useTransactionConfirmation

  • @vue-solana/vue/useSignatureStatus

  • @vue-solana/vue/useSignAndSendTransaction

  • @vue-solana/vue/useTokenAccounts

  • @vue-solana/vue/useTokenBalance

  • @vue-solana/vue/useAction

  • @vue-solana/vue/useRequest

  • @vue-solana/vue/useSubscription

  • @vue-solana/vue/useTrackedData

  • @vue-solana/vue/useSignIn

  • @vue-solana/vue/useSolanaPay

  • @vue-solana/vue/useSolanaPayConfirmation

  • @vue-solana/vue/useSolanaQrCode

  • @vue-solana/vue/useSolanaQrScanner

  • @vue-solana/vue/useSelectedWalletAccount

  • @vue-solana/vue/useSignTransactions

  • @vue-solana/vue/useSignAndSendTransactions

  • @vue-solana/vue/useClientCapability

  • @vue-solana/vue/usePayer

  • @vue-solana/vue/useIdentity

  • @vue-solana/vue/usePlanTransaction

  • @vue-solana/vue/usePlanTransactions

  • @vue-solana/vue/useSendTransaction

  • @vue-solana/vue/useSendTransactions

Other direct subpaths:

  • @vue-solana/vue/swr

  • @vue-solana/vue/kit

  • @vue-solana/vue/buffer-polyfill

Caveats

  • Wallet and RPC operations require the plugin-provided client context. Composables are SSR-safe, but real wallet work should run after hydration or in user actions.

  • Public Solana RPC endpoints are useful for development, but production apps should use dedicated RPC infrastructure.

  • Broad useProgramAccounts() scans can be expensive or blocked on public RPC nodes. Prefer narrow filters and dataSlice.

  • Use mainnet for Solana mainnet. This is Solana's official mainnet cluster name; the legacy mainnet-beta spelling is still accepted and redirects to the same endpoint.

  • v2.0.0 removed @solana/web3-compat and the web3 subpaths. Build transaction messages with @vue-solana/vue/kit and pass raw Uint8Array wire bytes to wallet flows. See the Kit Migration guide for migrating from v1.

  • Desktop native app wallets are planned but not implemented yet.

Status

This package provides RPC, balance, account, token, browser extension wallet, Android mobile wallet, iOS browser wallet, message signing, SIWS, live data, and transaction composables.