VELLARSDK
GitHubOpen Vellar Wallet

Reference

API Reference

The single public entry point. Composes the passkey engine, token client, and your backend into one wallet handle.

import { createVellarWallet } from "vellar-sdk";

const vellar = createVellarWallet(config);

Config

interface VellarWalletConfig {
  network: "testnet" | "mainnet";
  appName: string;
  kit: PasskeyKit;
  sac: SACClient;
  backend: Backend;
  isValidAddress: (address: string) => boolean;
  signedToXdr?: (signed: unknown) => string;
}
FieldTypeDescription
network"testnet" | "mainnet"Which Stellar network this client operates on.
appNamestringDisplay name shown in the platform passkey prompt (WebAuthn RP name).
kitPasskeyKitThe passkey smart-wallet engine. Supplied by you so browser-only code isn't imported during SSR.
sacSACClientSoroban token client, used to build payment transfers.
backendBackendYour server endpoints for submission and lookup (holds relayer/sponsor secrets — never the SDK).
isValidAddress(address) => booleanValidates a recipient before a payment is ever signed.
signedToXdr?(signed) => stringAdvanced/test hook: convert the kit's signed output to XDR. Defaults to handling strings and objects with toXDR().

The backend contract

interface Backend {
  submitWalletCreation(input: {
    keyId: string;
    contractId: string;
    network: "testnet" | "mainnet";
    signedTx: unknown;
  }): Promise<{ sessionId: string }>;

  lookupContractId(input: {
    keyId: string;
    network: "testnet" | "mainnet";
  }): Promise<{ contractId: string; sessionId: string } | undefined>;

  submitTransaction(input: {
    signedXdr: string;
    network: "testnet" | "mainnet";
  }): Promise<{ hash: string }>;
}

These forward to your server, which holds the relayer/sponsor credentials and submits to the network. See Installation and How It Works.

Returns

A VellarWallet handle.