VeilClient
The main client class for interacting with Veil.
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 (must be signer)
Properties
client.connection // Solana Connection
client.wallet // Anchor Wallet
client.program // Anchor Program instanceMethods Overview
Vault Operations
initVault(mint: PublicKey)- Create a vaultdeposit(amount: BN, mint: PublicKey)- Deposit tokenswithdraw(amount: BN, mint: PublicKey)- Withdraw tokensgetVault()- Get vault state
Schedule Operations
createSchedule(params)- Create schedule (advanced)createScheduleFromRecipients(params)- Create schedule (simple)pauseSchedule(schedulePda: PublicKey, paused: boolean)- Pause/resumecancelSchedule(schedulePda: PublicKey)- Cancel schedulegetSchedule(schedulePda: PublicKey)- Get schedule state
Config
getConfig()- Get global protocol config
Claim Payment
claimPayment(...)- Claim payment (for ER authority)
Example
import { VeilClient } from "@veil-dev/sdk";
import { Connection, Keypair } from "@solana/web3.js";
import { Wallet } from "@coral-xyz/anchor";
const connection = new Connection("https://api.devnet.solana.com");
const wallet = new Wallet(keypair);
const client = new VeilClient({ connection, wallet });
// Use client methods...
await client.initVault(tokenMint);