Skip to Content
TypeScript SDKInstruction Builders

Instruction Builders

All functions are in lib/veil/instructions.ts and return a TransactionInstruction.

Core Lending

initializeIx( payer: PublicKey, authority: PublicKey, pool: PublicKey, tokenMint: PublicKey, vault: PublicKey, poolBump: number, authorityBump: number, vaultBump: number, ): TransactionInstruction depositIx( user: PublicKey, userToken: PublicKey, vault: PublicKey, pool: PublicKey, userPosition: PublicKey, poolAuthority: PublicKey, amount: bigint, positionBump: number, ): TransactionInstruction withdrawIx( user: PublicKey, userToken: PublicKey, vault: PublicKey, pool: PublicKey, userPosition: PublicKey, poolAuthority: PublicKey, shares: bigint, ): TransactionInstruction borrowIx( user: PublicKey, userToken: PublicKey, vault: PublicKey, pool: PublicKey, userPosition: PublicKey, poolAuthority: PublicKey, amount: bigint, ): TransactionInstruction repayIx( user: PublicKey, userToken: PublicKey, vault: PublicKey, pool: PublicKey, userPosition: PublicKey, amount: bigint, // pass 2n**64n - 1n to repay all ): TransactionInstruction liquidateIx( liquidator: PublicKey, liquidatorToken: PublicKey, borrowerToken: PublicKey, vault: PublicKey, pool: PublicKey, borrowerPosition: PublicKey, poolAuthority: PublicKey, protocolTreasury: PublicKey, ): TransactionInstruction

Flash Loans

flashBorrowIx( borrower: PublicKey, borrowerToken: PublicKey, vault: PublicKey, pool: PublicKey, poolAuthority: PublicKey, amount: bigint, ): TransactionInstruction flashRepayIx( borrower: PublicKey, borrowerToken: PublicKey, vault: PublicKey, pool: PublicKey, amount: bigint, ): TransactionInstruction

Oracle & Admin

updateOraclePriceIx( pool: PublicKey, pythPriceFeed: PublicKey, ): TransactionInstruction updatePoolIx( authority: PublicKey, pool: PublicKey, params: { baseRate: bigint, optimalUtilization: bigint, slope1: bigint, slope2: bigint, reserveFactor: bigint, ltv: bigint, liquidationThreshold: bigint, liquidationBonus: bigint, protocolLiqFee: bigint, closeFactor: bigint, flashFeeBps: bigint, }, ): TransactionInstruction pausePoolIx(authority: PublicKey, pool: PublicKey): TransactionInstruction resumePoolIx(authority: PublicKey, pool: PublicKey): TransactionInstruction collectFeesIx( authority: PublicKey, pool: PublicKey, vault: PublicKey, treasury: PublicKey, poolAuthority: PublicKey, ): TransactionInstruction
Last updated on