卡米诺断层指令
套件也一样 args, accounts, programId? 指令构建器
结构为 @exponent-labs/klend-idl现有原出口IDL,字符串
PROGRAM_ID,以及 decodeVault)被保留.
@exponent-labs/kamino-vault-idl/instructions数字 :deposit, (中文(简体) ),withdraw,以及getVaultReserveAccounts的参数/账户类型.@exponent-labs/kamino-vault-idl/accounts数字 :fetchVaultReserves。 。 。 .
存款和提取账户布局与
上游 v 2.2.2 身份证
和主网程序上链IDL,2026-10-06检查. 捆绑的IDL的
退出条目包括所需 global_config 账户。 其余部分
捆绑的IDL保留了它现有的布局.
刷新和构建指令
import BN from "bn.js"
import { fetchVaultReserves } from "@exponent-labs/kamino-vault-idl/accounts"
import {
type DepositAccounts,
type WithdrawAccounts,
deposit,
getVaultReserveAccounts,
withdraw,
} from "@exponent-labs/kamino-vault-idl/instructions"
import { refreshReservesBatch } from "@exponent-labs/klend-idl/instructions"
// connection, vaultAddress, depositAccounts, and withdrawAccounts are caller inputs.
const reserves = await fetchVaultReserves(connection, vaultAddress)
const refreshIx = refreshReservesBatch({ skipPriceUpdates: true })
refreshIx.keys.push(
...reserves.flatMap(({ reserveAddress, marketAddress }) => [
{ pubkey: reserveAddress, isSigner: false, isWritable: true },
{ pubkey: marketAddress, isSigner: false, isWritable: false },
]),
)
const remainingAccounts = getVaultReserveAccounts(reserves)
const depositIx = deposit(
{ maxAmount: new BN("1000000") }, // 1 USDC, including crank fees
{ ...depositAccounts, remainingAccounts } satisfies DepositAccounts,
)
const withdrawIx = withdraw(
{ sharesAmount: new BN("936761") }, // Raw vault shares, not a USDC amount
{ ...withdrawAccounts, remainingAccounts } satisfies WithdrawAccounts,
)
发送 [refreshIx, depositIx] 或者说 [refreshIx, withdrawIx] 在一次交易中,
在任何需要的符号账户创建指令之后。 刷新和金库
指令需要在同一位置执行. skipPriceUpdates: true 累积数
保留利息而不获取甲骨文更新 .
KLend 刷新账户替换 储备,市场KVault的剩余账户 包含 所有储备,然后所有市场,按分配顺序排列。 反复出现的市场 必须保留.
fetchVaultReserves 验证账户所有权、歧视者和收益
reserveAddress, (中文(简体) ), marketAddress, (中文(简体) ), ctokenVault解码的 KLend account。 。 。 .
它跳过未用的分配槽,如果缺少活动储备会扔出.
收回IDL的巢穴 withdrawFromAvailable 财务报告和审定财务报表
withdrawFromReserveAccounts 账户组。 选择足够数量的储备
可取回的流动性;已解码的储备暴露其抵押薄荷和
流动资金供应。 向贷款市场提供种子
[Buffer.from("lma"), marketAddress.toBuffer()] 在 KLend 程序下。 衍生
globalConfig 与 [Buffer.from("global_config")] 根据KVault计划.
这些构建者返回单个指令; 保留选择,ATA创建,
任何农事都由打电话者处理 如果保险库需要
授权权限,在保留/市场块后附加其签名元.
运行 yarn workspace @exponent-labs/kamino-vault-idl build 财务报告和审定财务报表
yarn workspace @exponent-labs/kamino-vault-idl test 以验证约束.