@vue-solana/core contains framework-agnostic Solana primitives used by the Vue Solana packages.
Use this package directly when you want Kit clients, endpoint helpers, shared wallet types, Android Mobile Wallet Adapter registration helpers, iOS browser wallet helpers, token account reads, and transaction helpers without installing the Vue plugin.
@vue-solana/core builds on the modern @solana/kit. createSolanaClient() lives on the @vue-solana/core/kit subpath, which re-exports all of @solana/kit. The legacy @solana/web3-compat API and the web3 subpath were removed in v2.0.0 — see Kit Migration for the full before/after map.
Install
pnpm add @vue-solana/core
The package is ESM only. A CommonJS require("@vue-solana/core") fails with No "exports" main defined; make the importing module ESM, or stay on @vue-solana/core@^2, which still ships a .cjs build. See Upgrading v2 to v3.
Quick Start
import { address } from "@vue-solana/core/kit";
import { createSolanaContext } from "@vue-solana/core/rpc";
const solana = createSolanaContext({ cluster: "devnet" });
const { value: latestBlockhash } = await solana.client.rpc.getLatestBlockhash().send();
console.log(solana.endpoint, latestBlockhash.blockhash);
You can also create a Kit client directly:
import { createSolanaClient } from "@vue-solana/core/kit";
const client = createSolanaClient({ cluster: "devnet" });
const slot = await client.rpc.getSlot().send();
console.log(slot); // bigint
createSolanaContext() returns { cluster, endpoint, wsEndpoint, client }; the client carries client.rpc and client.rpcSubscriptions.
The root export remains supported. Direct subpath exports are also available, so you can import just the helpers a module owns:
import { createSolanaClient } from "@vue-solana/core/kit";
import { createSolanaContext } from "@vue-solana/core/rpc";
import { parseAddress } from "@vue-solana/core/address";
import { getTokenBalance } from "@vue-solana/core/token-accounts";
import type { SolanaConfig } from "@vue-solana/core/types";
Direct subpaths:
@vue-solana/core/address@vue-solana/core/action@vue-solana/core/buffer-polyfill@vue-solana/core/types@vue-solana/core/clusters@vue-solana/core/diagnostics@vue-solana/core/errors@vue-solana/core/fee-policy@vue-solana/core/ios-wallet@vue-solana/core/ios-wallet-discovery@vue-solana/core/kit@vue-solana/core/mobile-wallet@vue-solana/core/mobile-wallet-support@vue-solana/core/program-client@vue-solana/core/rpc@vue-solana/core/timeout@vue-solana/core/transaction@vue-solana/core/transaction-history@vue-solana/core/wallet@vue-solana/core/wallet-standard@vue-solana/core/token-accounts@vue-solana/core/token-portfolio@vue-solana/core/token-portfolio-2022@vue-solana/core/solana-pay@vue-solana/core/solana-pay-confirmation@vue-solana/core/solana-pay-status
Related Guides
- RPC and Clusters: configure cluster names, custom RPC endpoints, WebSocket endpoints, and client helpers.
- Wallets: discover Wallet Standard wallets, register mobile wallet sources, and check wallet capabilities.
- Transactions: sign, send, confirm, and handle transaction timeouts safely.
- Solana Pay: encode payment requests, render and scan QR codes, and confirm settlement by reference.
- Errors: branch on stable
SolanaErrorcodes and keep raw causes out of user-facing UI.
Configuration
type SolanaCluster = "mainnet" | "mainnet-beta" | "testnet" | "devnet" | "localnet";
interface SolanaConfig {
cluster?: SolanaCluster;
endpoint?: string;
wsEndpoint?: string;
commitment?: Commitment;
autoConnect?: boolean;
payer?: TransactionSigner;
payerSecretKey?: string;
}
Supported clusters are mainnet (legacy alias mainnet-beta), testnet, devnet, and localnet. Wallet helpers use Wallet Standard chain identifiers such as solana:devnet, which are derived from clusters by getSolanaChain(). If endpoint is omitted, the package uses the public Solana RPC endpoint for the selected cluster. If wsEndpoint is omitted, it is derived from the RPC endpoint.
autoConnect defaults to false. When enabled through the Vue plugin or Nuxt module, Vue Solana reconnects only a wallet identity that the user previously selected and that is discovered again on the client. It stores only wallet identity metadata under localStorage["vue-solana:selected-wallet"]: name, and platform/source when available. It never stores private keys, session data, or transaction data, and it never connects an arbitrary installed wallet.
payer is a Kit TransactionSigner used as the client's fee payer and signer for client-sent transactions. payerSecretKey is a base64-encoded 64-byte Ed25519 keypair with the secret key first; the client derives its address at creation and imports the signing key on first use, so a keypair whose public half does not match its seed is rejected at the first signature instead of at client creation. The address comes from the unverified public half, so treat payer.address as unconfirmed until the first signature succeeds. Signing imports the key through WebCrypto, which browsers expose only in a secure context (https, or http on localhost); outside one, the first signTransactions() call throws rather than returning a generic invalid-key error. Both options are supported by direct core and Vue clients.
createSolanaClient() composes the official @solana/kit-plugin-rpc stack by default: solanaRpc() followed by rpcAirdrop() when no commitment is configured (a configured commitment builds the same stack explicitly so it reaches the RPC layer). 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. Its official sending executor adds a fresh blockhash, resource-limit and preflight handling, signs with the available client signers, submits the transaction, and waits for confirmed commitment before the send resolves. A client send requires a payer signer.
Never put a raw secret or payerSecretKey in Nuxt public runtime config. Do not ship a funded signing key to an end-user browser; use a server or relayer boundary, or an ephemeral unfunded signer for demos.
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 https://api.mainnet.solana.com endpoint.
Context
interface SolanaContext {
cluster: SolanaCluster;
endpoint: string;
wsEndpoint: string;
client: SolanaClient;
}
client is a @solana/kit client built by createSolanaClient() and exposes client.rpc, client.rpcSubscriptions, planTransaction(s), and sendTransaction(s).
Wallet Interface
interface SolanaWallet {
publicKey: Address | null;
connected: boolean;
connecting?: boolean;
disconnecting?: boolean;
platform?: SolanaWalletInfo["platform"];
source?: SolanaWalletInfo["source"];
connect: () => Promise<void>;
disconnect: () => Promise<void>;
signMessage?: (message: Uint8Array) => Promise<SolanaSignMessageResult>;
signTransaction?: (transaction: SolanaTransaction) => Promise<SolanaTransaction>;
signAllTransactions?: (transactions: SolanaTransaction[]) => Promise<SolanaTransaction[]>;
signAndSendTransaction?: (
transaction: SolanaTransaction,
options?: SendTransactionOptions,
) => Promise<{ signature: Signature }>;
}
Browser wallets discovered through the Solana Wallet Standard and supported iOS browser wallet links are adapted into this interface. You can also provide a custom object that implements SolanaWallet. A discovered wallet remains disconnected until connect() resolves successfully, even if the browser extension exposes previously authorized accounts.
publicKey is the base58-encoded Kit Address (a string) of the connected account. SolanaTransaction is Uint8Array — raw wire transaction bytes that the wallet signs as-is; the leading byte distinguishes legacy from versioned transactions.
Android Mobile Wallet Adapter is registered through @solana-mobile/wallet-standard-mobile and then adapted through the same Wallet Standard adapter.
Wallet Metadata
interface SolanaWalletInfo {
name: string;
icon: string;
chains: readonly string[];
platform?: "browser" | "mobile" | "desktop";
source?: "wallet-standard" | "mobile-wallet-adapter" | "deep-link" | "protocol-link";
appUrl?: string;
installUrl?: string;
callbackUrl?: string;
capabilities?: {
connect?: boolean;
disconnect?: boolean;
signMessage?: boolean;
signTransaction?: boolean;
signAllTransactions?: boolean;
signAndSendTransaction?: boolean;
};
accounts: readonly SolanaWalletAccountInfo[];
wallet: unknown;
}
Current metadata values:
- Browser extension wallets use
platform: "browser"andsource: "wallet-standard". - Android Mobile Wallet Adapter uses
platform: "mobile"andsource: "mobile-wallet-adapter". - iOS browser wallets use
platform: "mobile"andsource: "deep-link". protocol-linkis reserved for possible future desktop native wallet adapters.
Wallet Standard Helpers
type SolanaChain = "solana:mainnet" | "solana:testnet" | "solana:devnet" | "solana:localnet";
SolanaChain is the Wallet Standard chain identifier used by wallet discovery, mobile wallet registration, iOS wallet links, and wallet adapter signing options. Use getSolanaChain(cluster) when you need to derive one from a configured Solana cluster.
getSolanaChain(cluster): mapsmainnet-betaormainnet,devnet,testnet, orlocalnetto a Solana Wallet Standard chain ID.isSolanaStandardWallet(wallet): checks whether a Wallet Standard wallet supports Solana.getRegisteredSolanaWallets(): returns discovered Solana Wallet Standard wallets in browser environments, including Android Mobile Wallet Adapter after it is registered on supported clients.subscribeSolanaWallets(listener): subscribes to Wallet Standard register/unregister events.adaptSolanaStandardWallet(walletInfo, options?): adapts a discovered Wallet Standard wallet intoSolanaWallet.disconnectSolanaStandardWallet(walletInfo): disconnects a discovered Wallet Standard wallet through its ownstandard:disconnectfeature without adapting it, so a wallet the app never selects gets nochangesubscription. Resolvesfalsewhen the wallet exposes no disconnect feature, and rejects with the wallet's own error.
Mobile Wallet Helpers
registerSolanaMobileWallet(options?): registers Android Mobile Wallet Adapter through Wallet Standard on supported Android Chrome clients.isSolanaMobileWalletSupported(): returns whether the current runtime supports Android MWA web registration.getDefaultMobileWalletAppIdentity(): derives a default Mobile Wallet Adapter app identity from the current document.getSolanaIosWallets(options?): returns Phantom, Solflare, and Backpack iOS browser wallet entries on iOS browsers.adaptSolanaIosWallet(walletInfo, options?): adapts an iOS deep-link wallet entry intoSolanaWallet.handleSolanaIosWalletCallback(options?): validates and decrypts iOS wallet redirect callbacks.waitForRedirect(options?): settles the wait for an iOS wallet redirect. It intentionally never resolves in-page (the redirect reloads the page and bootstrap handles the callback); it rejects withREDIRECT_TIMEOUTaftertimeoutMs(default 10 minutes) or with the signal's reason whensignalaborts, so a custom deep-link flow can resetconnectingstate instead of hanging.isSolanaIosBrowserWalletSupported(): returns whether the current runtime should expose iOS browser wallet links.
These helpers are SSR-safe. Android registration returns without registering when window is unavailable, when the page is not in a secure context, or when the browser is not Android. iOS wallet discovery returns an empty list when the browser is not an iOS browser runtime.
Helpers
The root @vue-solana/core export re-exports the public helpers below. Use direct subpaths when you want to import just one helper's module instead of the whole barrel:
| Import path | What it contains | Use it when |
|---|---|---|
@vue-solana/core/action | createSolanaActionStore(), SolanaActionState, and isSolanaActionAborted(). | You need a framework-agnostic async action state machine with abort-on-redispatch for Solana work. |
@vue-solana/core/address | parseAddress() and address input types. | You accept a Solana address as a string, ref-like object, or getter and need a validated, normalized Address. |
@vue-solana/core/clusters | Default cluster and endpoint helpers. | You need the package's built-in RPC or WebSocket endpoint for mainnet, mainnet-beta, testnet, devnet, or localnet. |
@vue-solana/core/diagnostics | buildDiagnosticReport() and its createTransactionDiagnostics() alias. | You need one pure, RPC-free summary of a failed transaction from history, simulation, error, and fee-budget data. |
@vue-solana/core/errors | SolanaError, error factories, and error guards. | You need stable error codes for user-facing wallet, RPC, address, transaction, timeout, or storage failures. |
@vue-solana/core/fee-policy | resolveFeePolicy() and explainable compute-budget types. | You need locally capped compute-unit and priority-fee estimates without signing or sending a transaction. |
@vue-solana/core/ios-wallet | iOS browser wallet discovery, deep-link adapters, and callback handling. | You are wiring iOS wallet links without the Vue plugin's unified wallet flow. |
@vue-solana/core/ios-wallet-discovery | Crypto-free iOS discovery, adapter, and browser helpers for plugin bootstrap. | You need the iOS wallet list or adapter without loading tweetnacl or callback/deep-link code. |
@vue-solana/core/kit | createSolanaClient(), createReadOnlySolanaClient(), and the entire @solana/kit surface. | You want the modern Kit API without installing @solana/kit in your own package.json. |
@vue-solana/core/mobile-wallet | Android Mobile Wallet Adapter registration helpers. | You need to register Android MWA before reading Wallet Standard wallets. |
@vue-solana/core/rpc | createSolanaContext(). | You want a configured Kit client and resolved cluster endpoints without installing the Vue plugin. |
@vue-solana/core/timeout | Promise timeout helpers that produce Solana timeout errors. | You need timeout behavior consistent with transaction confirmation helpers. |
@vue-solana/core/transaction | Transaction simulation, send, and confirmation helpers. | You need to preview a transaction, use a wallet-aware send path, or confirm an existing signature. |
@vue-solana/core/transaction-history | Signature metadata reads without transaction bodies (getTransactionHistory(), TransactionHistoryItem, TransactionHistoryResult). | You need paginated activity or a before cursor for older pages. |
@vue-solana/core/token-accounts | Stateless SPL Token account reads (getTokenAccountsByOwner, getTokenAccount, getTokenBalance). | You need token account or balance reads through the Kit RPC jsonParsed API. |
@vue-solana/core/token-portfolio | getTokenPortfolio() and normalized portfolio types for classic SPL accounts. | You need a read-only account list grouped by mint with decimals, UI amounts, and totals. |
@vue-solana/core/token-portfolio-2022 | getTokenPortfolio2022() for opt-in Token-2022 portfolio reads. | Your app holds Token-2022 accounts and wants them in a separate entry point. |
@vue-solana/core/types | Shared TypeScript types. | You need SolanaConfig, SolanaContext, SolanaWallet, wallet metadata, or transaction option types. |
@vue-solana/core/wallet | Wallet state assertions and wallet capability errors. | You need to validate that a selected wallet is connected or supports signing before calling wallet methods. |
@vue-solana/core/wallet-standard | Wallet Standard chain mapping, discovery, subscriptions, and adapter helpers. | You are building your own wallet discovery layer on top of Solana Wallet Standard. |
Clusters and RPC
DEFAULT_CLUSTER: default cluster, currentlydevnet.getClusterEndpoint(cluster?): returns the HTTP RPC endpoint for a cluster.getClusterWebSocketEndpoint(cluster?): returns the WebSocket endpoint for a cluster.getWebSocketEndpoint(endpoint): convertshttp/httpsRPC URLs tows/wssURLs.resolveSolanaEndpoints(config?): returns{ cluster, endpoint, wsEndpoint }with the same defaults and derivation rules as client construction.createSolanaClient(config?): creates a@solana/kitclient whoserpcis wired to the resolved endpoint and WebSocket subscriptions, with the official planner and transaction-sending executor installed by default.createReadOnlySolanaClient(config?): creates a subscription-free client with onlyrpc. Use it in Node/Nitro code so Kit's WebSocket channel and itswsdependency can be tree-shaken out of the server bundle.createSolanaContext(config?): creates{ cluster, endpoint, wsEndpoint, client }for framework-agnostic app setup.
import { createSolanaClient } from "@vue-solana/core/kit";
const client = createSolanaClient({ cluster: "devnet" });
const slot = await client.rpc.getSlot().send();
The createSolanaContext equivalent:
import { createSolanaContext } from "@vue-solana/core/rpc";
const solana = createSolanaContext({ cluster: "devnet" });
const slot = await solana.client.rpc.getSlot().send();
Kit
The @vue-solana/core/kit subpath re-exports all of @solana/kit — the full public surface, values and types — so you never install @solana/kit in your own package.json:
import { address, lamports } from "@vue-solana/core/kit";
import type { Address, Commitment, Lamports, Signature, SolanaRpcApi } from "@vue-solana/core/kit";
createSolanaClient(config?): builds a Kit client for the givenSolanaConfig. Reusesclusters.tsendpoint resolution, wiresrpcSubscriptionsUrlfrom the resolved WebSocket endpoint, and installs the official RPC planner and transaction-sending executor by default.client.rpcexposes the full Solana read API (getSlot,getBalance,getBlockHeight,getSignatureStatuses, and more) as RPC functions called with.send().address(value): validates and returns anAddress(base58 string brand) — the Kit replacement fornew PublicKey(...).lamports(value: bigint): returns aLamportsvalue — the Kit replacement for raw lamport numbers.- Commonly used types:
Address,Commitment,Lamports,Rpc,Signature,SolanaRpcApi,SolanaClient. The subpath re-exports every type@solana/kitexports, not just these. - Four names exist in both Kit and this library. They resolve to this library's version from the root barrel (
@vue-solana/core) and to Kit's version from the/kitsubpath:SolanaError,SolanaErrorCode,isSolanaError, andTransactionStatus. ImportisSolanaErrorfrom@vue-solana/core/kitwhen you are inspecting an error thrown by Kit itself, because the root barrel's guard does not match Kit's error class.
RPC numeric results are bigint, and account data is Uint8Array rather than Buffer. See Kit Migration for details.
Actions
createSolanaActionStore() wraps any async function that receives a fresh AbortSignal per call into a framework-agnostic action state machine. UI frameworks bridge the returned store into reactive state; the Vue composable useAction() is built on this store.
import { createSolanaActionStore, isSolanaActionAborted } from "@vue-solana/core/action";
const { dispatch, getState, subscribe, reset, withSignal } = createSolanaActionStore(
(signal, address: Address) => client.rpc.getBalance(address).send(),
);
await dispatch(address);
- Each
dispatchaborts the previous in-flight call with a freshAbortSignal; superseded calls reject with an abort error and never corrupt state. getState()/subscribe(listener): snapshot and stream ofSolanaActionState(status,data, anderror).withSignal(signal, ...args): composes a caller-provided cancellation source for a single dispatch (per-attempt timeouts, shared kill switches).isSolanaActionAborted(error): checks whether a rejection came from an aborted or superseded call.
Addresses
parseAddress(value): parses an address string, ref-like value, or getter and returnsnullfor nullish input. ThrowsINVALID_ADDRESSfor an invalid base58 string. AcceptsAddressvalues unchanged.
import { parseAddress } from "@vue-solana/core/address";
const address = parseAddress("11111111111111111111111111111111");
const balance = address ? await client.rpc.getBalance(address).send() : null;
Wallets
isWalletConnected(wallet): checks whether a wallet is connected and has a public key.assertWalletConnected(wallet): throwsWALLET_NOT_CONNECTEDif the wallet is not connected.assertWalletCanSign(wallet): throws if the wallet is disconnected or does not supportsignTransaction.assertWalletCanSignMessage(wallet): throws if the wallet is disconnected or does not supportsignMessage.
import { assertWalletCanSign } from "@vue-solana/core/wallet";
assertWalletCanSign(wallet);
const signedTransaction = await wallet.signTransaction(transaction);
Transactions
signAndSendTransaction(client, wallet, transaction, options?): signs and sends raw wire transaction bytes using a configured wallet and returns the RPC signature. Wallets that exposesignAndSendTransactionare delegated to; otherwise the transaction is signed withwallet.signTransactionand submitted throughclient.rpc.sendTransaction(...).send(). Android Mobile Wallet Adapter wallets prefer signing plus app-side RPC submission so the app owns submission and reliably returns the RPC signature after the wallet handoff.simulateTransaction(client, transaction, options?): simulates raw wire transaction bytes without submitting them. Returns normalizederr,logs,fee, lamport and token balance changes, loaded addresses, return data, replacement blockhash, and units consumed. A non-nullerris a failed simulation returned as data, not a thrown error. Acceptscommitment,minContextSlot,sigVerify,replaceRecentBlockhash, andabortSignal;sigVerifyandreplaceRecentBlockhashare mutually exclusive and throwINVALID_INPUTwhen combined. Malformed bytes also throwINVALID_INPUT, while transport failures throwRPC_FAILURE.getTransactionHistory(client, address, options?)from@vue-solana/core/transaction-history: lists signature metadata for an address without fetching transaction bodies. Returns newest-firstitemswithsignature,slot, optionalblockTime,err, optionalmemo, and optionalconfirmationStatus, plushasMoreand anextBeforecursor for older pages. Acceptsbefore,until,limit(1–1000, default 50),commitment(processedis not allowed), andabortSignal. Invalid limits throwINVALID_INPUT, missing or invalid addresses throwINVALID_ADDRESS, and transport failures throwRPC_FAILURE.confirmTransactionSignature(client, signature, options?): waits for a submitted signature to reach a requested commitment. Defaults toconfirmedcommitment, a 60 second timeout, a 1500 ms poll interval, and pollingclient.rpc.getSignatureStatuses([signature]).send(). AcceptspollIntervalMs(must be greater than0),abortSignal, andsearchTransactionHistory. A failed transaction throwsTRANSACTION_FAILED, a signature that never appears throwsTRANSACTION_NOT_FOUND, and an exhausted wait throwsTRANSACTION_TIMEOUT. PasssearchTransactionHistory: truewhen the signature may have left the recent status cache — without it an older signature never appears in results and resolves toTRANSACTION_NOT_FOUNDafter the timeout.
The client-sent flow is separate from this wallet-aware helper. The client exposes sendTransaction() and sendTransactions() through the official rpcTransactionPlanSendingExecutor() that solanaRpc() installs inside createSolanaClient(); the Vue composables wrap those methods. They plan, sign, submit, and wait for confirmed commitment; the sent status is set only after that send-and-confirm operation completes. A single result exposes the submitted signature at data.context.signature, while a batch result contains the full plan result tree. The official sender does not show a wallet popup.
import { confirmTransactionSignature, signAndSendTransaction } from "@vue-solana/core/transaction";
const signature = await signAndSendTransaction(client, wallet, transaction);
await confirmTransactionSignature(client, signature, { commitment: "confirmed" });
SPL Token
Token reads use the Kit RPC jsonParsed API — no @solana/spl-token dependency.
getTokenAccountsByOwner(client, owner, options?): returns all SPL Token and Token-2022 accounts for an owner asTokenAccountInfo[]({ address, mint, owner, amount: bigint, decimals, state, isNative }). PassprogramIdto limit to a single program.getTokenAccount(client, address, commitment?): returns a single parsed token account (TokenAccountInfo | null). Returnsnullwhen the account does not exist or is not a token account.getTokenBalance(client, mint, owner, commitment?): reads the owner's token account for the given mint and returns{ amount, decimals }. Returnsnullwhen no token account exists.getTokenPortfolio(client, owner, options?)from@vue-solana/core/token-portfolio: aggregates classic SPL accounts into{ accounts, byMint, totals, unresolvedMints }, resolving mint decimals where available and falling back to parsed account decimals otherwise. It acceptscommitment,abortSignal, andprogramId(default: classic SPL Token). Token-2022 accounts are a separate opt-in read throughgetTokenPortfolio2022()from@vue-solana/core/token-portfolio-2022.
import { getTokenBalance } from "@vue-solana/core/token-accounts";
const balance = await getTokenBalance(client, mint, owner);
if (balance) {
console.log(`${balance.amount} (${balance.decimals} decimals)`);
}
Solana Pay
The Solana Pay helpers are implemented directly on @solana/kit; no extra Solana Pay or gill package is required.
encodeURL(fields)/encodeTransferRequestURL(fields)/encodeTransactionRequestURL(fields): buildsolana:transfer or transaction request URLs.amountis abigintin lamports and is encoded as a decimal SOL string.parseURL(value): validates and parses a transfer request into typedrecipient,amount,splToken,reference,label,message, andmemofields. ThrowsParseURLErrorfor an invalid protocol, recipient, token mint, reference, amount, or malformed URL.createQR(url, size?, background?, color?): renders a QR code as an SVG string.createQRDataURL()andcreateQRCanvas()provide alternative render targets. Theqrcodeencoder is loaded lazily, so URL-only consumers do not bundle it.createRecipient(address),createSPLToken(address),isValidSolanaAddress(value): address validation helpers.createSolanaPayReference()andverifySolanaPayPayment()live in@vue-solana/core/solana-pay-confirmation;getSolanaPayPaymentStatus()lives in@vue-solana/core/solana-pay-status.
import { createQR, encodeURL, parseURL } from "@vue-solana/core/solana-pay";
import { address } from "@vue-solana/core/kit";
const url = encodeURL({
recipient: address("PASTE_A_SOLANA_ADDRESS"),
amount: 100_000_000n,
label: "Example store",
});
const parsed = parseURL(url.toString());
const svg = await createQR(url);
Reference values are Kit Address strings. Parse scanner output with parseURL() and show the recipient, amount, token, label, and message to the user before signing anything.
Errors and Timeouts
SolanaError: normalized error class with a stablecodeand optional originalcause.createSolanaError(code, message, options?): creates a normalized Solana error.isSolanaError(error): narrows unknown errors toSolanaError.normalizeSolanaError(cause, fallbackCode, fallbackMessage?, options?): converts unknown failures intoSolanaErrorand maps common wallet rejections toUSER_REJECTED.withTimeout(promise, timeoutMs, createError?, options?): races a promise against a caller-provided timeout error. RejectsINVALID_INPUTforNaN/negative timeouts;{ signal }aborts the wait with the signal's reason, and{ code, message }sets the default timeout error.withSolanaTimeout(promise, timeoutMs, message): races a promise against aTRANSACTION_TIMEOUTerror.
Error Model
Vue Solana normalizes common wallet, RPC, address, transaction, and storage failures into SolanaError. Apps should branch on the stable error.code value instead of parsing adapter or RPC messages.
import { isSolanaError } from "@vue-solana/core/errors";
try {
await signAndSendTransaction(client, wallet, transaction);
} catch (error) {
if (isSolanaError(error)) {
switch (error.code) {
case "USER_REJECTED":
// The user declined a wallet prompt.
break;
case "TRANSACTION_TIMEOUT":
// The operation timed out; check signature state before retrying.
break;
case "TRANSACTION_NOT_FOUND":
// The signature never landed; safe to retry.
break;
case "TRANSACTION_FAILED":
// The transaction errored on-chain; see error.cause.
break;
case "RPC_FAILURE":
// RPC or confirmation failed.
console.error(error.cause);
break;
}
}
}
Stable error codes are:
NO_WALLET_SELECTEDWALLET_NOT_CONNECTEDWALLET_FEATURE_UNSUPPORTEDWALLET_FAILUREUSER_REJECTEDINVALID_SIGNATUREINVALID_ADDRESSINVALID_INPUTTRANSACTION_TIMEOUTTRANSACTION_NOT_FOUNDTRANSACTION_FAILEDREDIRECT_TIMEOUTDECRYPTION_FAILEDMISSING_CLIENT_CAPABILITYRPC_FAILURESTORAGE_FAILURE
SolanaError.cause preserves the original wallet adapter, RPC, parsing, or storage error for debugging. Do not show raw cause details to end users unless the app explicitly trusts that source.
Buffer Polyfill
Browser code that serializes Solana transactions may need a Node-compatible Buffer global. Initialize it before transaction code with installSolanaBufferPolyfill() from @vue-solana/core/buffer-polyfill. The only remaining package-owned type shim covers the browser buffer/ subpath this polyfill imports from.
All three packages are marked "sideEffects": false, so bundlers may drop any import whose bindings are unused. Import the polyfill as a named import and call it, as in the snippet above. A bare side-effect import such as import "@vue-solana/core/buffer-polyfill" installs nothing, because the subpath only exports the function.