SDK ReferenceVeilClient

VeilClient

The main SDK entry point for interacting with the Veil program.

Constructor

import { VeilClient } from "@veil-dev/sdk";
import { Connection } from "@solana/web3.js";
import { Wallet } from "@coral-xyz/anchor";
 
const client = new VeilClient({
  connection: Connection,
  wallet: Wallet,
});

Parameters:

  • connection - Solana RPC connection
  • wallet - Anchor wallet used as the signer

Properties

client.connection
client.wallet
client.provider
client.program

Methods Overview

Vault Operations

  • initVault(tokenMint: PublicKey) - create a vault for the current wallet and mint
  • deposit(amount: BN, tokenMint: PublicKey) - deposit tokens into the vault
  • withdraw(amount: BN, tokenMint: PublicKey) - withdraw available balance
  • getVault(tokenMint: PublicKey, employer?: PublicKey) - fetch vault state

Schedule Operations

  • createSchedule(params: CreateScheduleParams) - create a schedule from prepared parameters
  • createScheduleFromRecipients(params) - build the Merkle root and create the schedule
  • updateSchedule(schedulePda: PublicKey, params: UpdateScheduleParams) - update a paused schedule from prepared parameters
  • updateScheduleFromRecipients(params) - rebuild the Merkle root and update a paused schedule
  • pauseSchedule(schedulePda: PublicKey, pause: boolean) - pause or resume a schedule
  • cancelSchedule(schedulePda: PublicKey) - cancel a schedule and release reserved funds
  • getSchedule(schedulePda: PublicKey) - fetch schedule state

Config Operations

  • getConfig() - fetch global protocol configuration
  • initConfig(...) - initialize governance, ER authority, whitelist, and limits
  • updateMintWhitelist(whitelistEnabled: boolean, allowedMints: PublicKey[]) - update allowed mints

Claim Operation

  • claimPayment(...) - execute a Merkle-proof-backed claim, typically by the ER authority flow

Example

import { VeilClient } from "@veil-dev/sdk";
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
import { Wallet } from "@coral-xyz/anchor";
 
const connection = new Connection("https://api.devnet.solana.com");
const keypair = Keypair.fromSecretKey(/* your secret key */);
const wallet = new Wallet(keypair);
const client = new VeilClient({ connection, wallet });
 
const tokenMint = new PublicKey("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU");
await client.initVault(tokenMint);

Scope of the SDK

The SDK talks to the on-chain program directly. Coordinator-only features such as:

  • schedule registration
  • execution history
  • dashboard CSV / Excel imports
  • saved dashboard templates

live outside VeilClient and are handled by the coordinator or dashboard layers.