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 connectionwallet- Anchor wallet used as the signer
Properties
client.connection
client.wallet
client.provider
client.programMethods Overview
Vault Operations
initVault(tokenMint: PublicKey)- create a vault for the current wallet and mintdeposit(amount: BN, tokenMint: PublicKey)- deposit tokens into the vaultwithdraw(amount: BN, tokenMint: PublicKey)- withdraw available balancegetVault(tokenMint: PublicKey, employer?: PublicKey)- fetch vault state
Schedule Operations
createSchedule(params: CreateScheduleParams)- create a schedule from prepared parameterscreateScheduleFromRecipients(params)- build the Merkle root and create the scheduleupdateSchedule(schedulePda: PublicKey, params: UpdateScheduleParams)- update a paused schedule from prepared parametersupdateScheduleFromRecipients(params)- rebuild the Merkle root and update a paused schedulepauseSchedule(schedulePda: PublicKey, pause: boolean)- pause or resume a schedulecancelSchedule(schedulePda: PublicKey)- cancel a schedule and release reserved fundsgetSchedule(schedulePda: PublicKey)- fetch schedule state
Config Operations
getConfig()- fetch global protocol configurationinitConfig(...)- initialize governance, ER authority, whitelist, and limitsupdateMintWhitelist(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.