Reference
Advanced Usage
createVellarWallet is the paved road. For custom flows, the package also exports
the underlying building blocks it composes.
Lower-level building blocks
import {
createPasskeyKitConnector, // the WalletConnector (create/connect/sign)
createPaymentClient, // build → simulate → sign → submit
createSessionStore, // a session store (shared across surfaces)
WalletNotReadyError,
} from "vellar-sdk";
createPasskeyKitConnector(options)— returns aWalletConnectorwithcreateWallet,connectWallet, andsignTransaction. Use this if you want to drive the wallet lifecycle yourself.createPaymentClient(options)— returns aPaymentClientwhosepreparePayment(...)gives you a review object and aconfirm()you call after the user approves. Use this to insert your own review UI between build and sign.createSessionStore(adapter)— a session store with pluggable storage, for sharing session state across parts of your app.
The vellar.connector and vellar.payments getters expose the exact instances the
facade built, so you can mix the paved road with lower-level calls.
Subpath exports
Heavier or environment-specific helpers live behind subpaths so they stay out of bundles that don't need them:
import { formatTokenAmount, createBalanceService } from "vellar-sdk/balances";
import { createRpcBalanceReader } from "vellar-sdk/rpc"; // pulls in @stellar/stellar-sdk
vellar-sdk/balances— token amount formatting and the balance service.vellar-sdk/rpc— RPC-backed balance readers. Imported separately so@stellar/stellar-sdkstays out of bundles that don't read balances.
Custom review UI (example)
const prepared = await vellar.payments.preparePayment({
from: vellar.session!.accountId,
to,
token,
amount,
});
// show `prepared.review` in your own UI…
const { hash } = await prepared.confirm(); // signs + submits after approval
TypeScript
The package ships full type declarations. Domain types (Network,
WalletSession, CreateWalletInput, SignTransactionInput) are exported from
the package root.