bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 42쪽
ics.apy90d,
};
})
);
// Display all vault APYs
vaultMetrics.forEach((vault) => {
console.log(`\n${vault.address}:`);
console.log(` 7-day APY: ${(vault.apy7d * 100).toFixed(2)}%`);
console.log(` 30-day APY: ${(vault.apy30d * 100).toFixed(2)}%`);
console.log(` 90-day APY: ${(vault.apy90d * 100).toFixed(2)}%`);
});
```
<Info>
The `/kvaults/vaults/{pubkey}/metrics` endpoint returns historical APY data across multiple timeframes (7-day, 24-hour, 30-day, 90-day, 180-day, 365-day).
</Info>
<Check>
You now have APY data for all vaults across multiple timeframes.
</Check>
</Step>
</Steps>
</Tab>
<Tab title="SDK">
<Steps>
<Step>
### Import Dependencies
Import the required packages for Solana RPC communication and Kamino SDK.
```typescript theme={null}
import { createSolanaRpc } from '@solana/kit';
import { KaminoManager, KaminoVault } from '@kamino-finance/klend-sdk';
```
</Step>
<Step>
### Initialize SDK
Set up the RPC connection and create a Kamino Manager instance.
```typescript theme={null}
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
const kaminoManager = new KaminoManager(rpc, 400);
```
</Step>
<Step>
### Get All Vaults
Retrieve all available vaults using the Kamino Manager.
```typescript theme={null}
const vaults = await kaminoManager.getAllVaults();
```
</Step>
<Step>
### Get APYs for Each Vault
Fetch APY data for all vaults in parallel.
```typescript theme={null}
// Fetch APYs for all vaults in parallel
const vaultAPYs = await Promise.all(
vaults.map(async (vaultData) => {
const vault = new KaminoVault(rpc, vaultData.address);
const apys = await vault.getAPYs();
return {
address: vaultData.address.toString(),
name: vaultData.state?.name,
actualAPY: apys.actualAPY.netAPY,
theoreticalAPY: apys.theoreticalAPY.netAPY,
};
})
);
// Display all vault APYs
vaultAPYs.forEach((vault) => {
console.log(`\n${vault.address}:`);
console.log(` Actual APY: ${vault.actualAPY}`);
console.log(` Theoretical APY: ${vault.theoreticalAPY}`);
});
```
<Info>
The `vault.getAPYs()` method returns `theoreticalAPY` and `actualAPY`, each containing `grossAPY` and `netAPY` (after fees) calculated from on-chain state.
</Info>
<Check>
You've successfully fetched vault APYs using the Kamino SDK.
</Check>
</Step>
</Steps>
</Tab>
</Tabs>
## Related Resources
<CardGroup>
<Card title="Lending Vaults Concepts" icon="book" href="/docs/products/lending-vaults/concepts">
Learn how vaults work under the hood
</Card>
<Card title="Vault Data" icon="database" href="/docs/build/earn/vault-data-positions">
Query vault metrics and positions
</Card>
<Card title="Benchmark Rate" icon="chart-line" href="/docs/products/lending-vaults/benchmark-rate">
Compare vault yields to market baseline
</Card>
<Card title="Earn Deposit" icon="arrow-down" href="/docs/build/recipes/earn/earn-via-api">
Deposit into vaults via API
</Card>
</CardGroup>
# Get wallet earnings and growth history for all tokens
Source: https://kamino.com/docs/build/earn/get-wallet-earnings-and-growth-history-for-all-tokens
/kamino-api.json get /v3/earn/users/{userPubkey}/tokens/metrics/history
Get earn history grouped by token mint across vaults and lending deposits for the requested obligation types. Mints with no buckets in the range are omitted.
# Get wallet token earnings and growth history
Source: https://kamino.com/docs/build/earn/get-wallet-token-earnings-and-growth-history
/kamino-api.json get /v3/earn/users/{userPubkey}/tokens/{tokenMint}/metrics/history
Get total earn position value and interest earned per bucket across vaults and lending deposits for the requested obligation types.
# Earn
Source: https://kamino.com/docs/build/earn/index
Build products that turn idle assets into yield with Kamino
<div>
<div>
<div>
<img alt="" />
<div>
# Earn
<p>
Build products that turn idle assets into yield with Kamino.
</p>
<a href="/docs/build/developers/earn">
Developer guide
<Icon icon="arrow-right" />
</a>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p>Start Here</p>
<h2>How Earn Vaults Work</h2>
<p>
Earn Vaults put deposits to work across Kamino lending markets. Vault shares track each depositor's position as yield accrues.
</p>
<a href="/docs/curators/vaults/concepts/how-vaults-work">
See how Earn Vaults work
<Icon icon="arrow-right" />
</a>
</div>
<div>
<div>
<div>
<Icon icon="arrow-down-to-bracket" />
</div>
<p>Deposit</p>
<p>User deposits assets</p>
</div>
<div>
<Icon icon="arrow-right" />
</div>
<div>
<div>
<Icon icon="vault" />
</div>
<p>Earn Vault</p>
<p>Allocates across lending markets</p>
</div>
<div>
<Icon icon="arrow-right" />
</div>
<div>
<div>
<Icon icon="signal" />
</div>
<p>Lending Markets</p>
<p>Earn yield from multiple markets</p>
</div>
</div>
<div>
<div>
<Icon icon="arrow-down-to-bracket" />
<div>
<p>Deposit</p>
<p>User deposits assets</p>
</div>
</div>
<div>
<Icon icon="vault" />
<div>
<p>Earn Vault</p>
<p>Allocates across lending markets</p>
</div>
</div>
<div>
<Icon icon="signal" />
<div>
<p>Lending Markets</p>
<p>Earn yield from multiple markets</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
## Start with Your Goal
<div>
<a href="/docs/build/tutorials/earn">
<h3>Showcase Earn Vaults in your app</h3>
<p>Let users explore Kamino's vaults and put their assets to work.</p>
<span>Explore Earn integration</span>
</a>
<a href="/docs/build/earn/tutorials/earn-and-withdraw">
<h3>Earn yield on balances you manage</h3>
<p>Put idle funds or user deposits to work on behalf of your users.</p>
<span>Explore Earn tutorial</span>
</a>
<a href="/docs/build/earn/plan-your-vault">
<h3>Generate revenue from a vault</h3>
<p>Manage a paid and access-controlled vault as a curator.</p>
<span>Explore vault curation</span>
</a>
</div>
</div>
<div>
## Choose Your Tools
<p>
Find the right starting point for your build or vault operations.
</p>
<div>
<div>
<h3>Build in your app</h3>
<div>
<a href="/docs/build/api-reference/introduction">
<div>
<Icon icon="code" />
</div>
<div>
<p>REST API</p>
<p>Read vault data and request unsigned transactions.</p>
</div>
</a>
<a href="/docs/build/developers/api-vs-sdk">
<div>
<Icon icon="brackets-curly" />
</div>
<div>
<p>TypeScript SDK</p>
<p>Build custom transactions or create a vault in code.</p>
</div>
</a>
<a href="/docs/build/developers/api-vs-sdk">
<div>
<Icon icon="crab" />
</div>
<div>
<p>Rust crate</p>
<p>Build Rust clients and onchain integrations.</p>
</div>
</a>
</div>
</div>
<div>
<h3>Operate a vault</h3>
<div>
<a href="/docs/build/earn/tutorials/creating-a-vault">
<div>
<Icon icon="brackets-curly" />
</div>
<div>
<p>TypeScript SDK</p>
<p>Create and configure a vault in code.</p>
</div>
</a>
<a href="/docs/curators/vaults/guides/create-a-vault">
<div>
<Icon icon="browser" />
</div>
<div>
<p>Web interface</p>
<p>Create and configure a vault in Kamino's curator UI.</p>
</div>
</a>
<a href="/docs/curators/vaults/guides/create-a-vault#create-via-kamino-cli">
<div>
<Icon icon="cube" />
</div>
<div>
<p>Kamino CLI</p>
<p>Manage vaults from the command line.</p>
</div>
</a>
</div>
</div>
</div>
</div>
<div>
## Build the Experience
<p>
Guide users from vault discovery to share redemption.
</p>
<div>
<a href="/docs/build/earn/vault-data-positions">
<div>
<Icon icon="magnifying-glass" />
<p>Explore vaults</p>
</div>
<p>Show vault details so users can assess their options.</p>
</a>
<a href="/docs/build/earn/tutorials/earn-and-withdraw">
<div>
<Icon icon="arrow-right-arrow-left" />
<p>Deposit and withdraw</p>
</div>
<p>Build flows for entering and exiting a vault.</p>
</a>
<a href="/docs/build/earn/vault-data-positions#get-user-position">
<div>
<Icon icon="chart-line" />
<p>Track a position</p>
</div>
<p>Show each user's balance and accrued yield.</p>
</a>
<a href="/docs/build/earn/tutorials/claim-rewards">
<div>
<Icon icon="gift" />
<p>Claim rewards</p>
</div>
<p>Let users claim additional token rewards when available.</p>
</a>
</div>
</div>
</div>
# Plan Your Vault
Source: https://kamino.com/docs/build/earn/plan-your-vault
Understand the decisions a curator makes when designing and operating a Kamino lending vault
<Callout icon="circle-info">
A Kamino lending vault accepts a single deposit asset and allocates it across selected Kamino lending reserves. Depositors receive vault shares representing their portion of the vault and earn the yield generated by those reserves. The curator decides where capital can go and adjusts the strategy as conditions change.
</Callout>
<img alt="Kamino curators vault overview" />
A vault does not create a new lending market. It allocates deposits across existing reserves. The yield it generates depends on how those reserves perform and how the curator distributes capital between them.
<div>
<p>By the end of this guide</p>
Curators should understand:
* What a Kamino lending vault does and what vault shares represent.
* The settings that determine where capital is allocated and when it moves between reserves.
* What determines how much capital remains available for withdrawals.
* Which fees generate curator revenue and how farm rewards reach depositors.
* What the Insurance Pool and Whitelisted Reserves protect.
* Which vault responsibilities can be delegated and why administrative authority is transferred to a multisig.
* When changing vault conditions may require an adjustment.
</div>
***
## A Vault in One Example
Planning a vault starts with understanding how depositor capital moves through it. Consider a vault that accepts USDC and allocates it between two USDC reserves in different Kamino lending markets. Depositors supply USDC and receive vault shares. The vault distributes their USDC according to the curator's allocation targets.
When a depositor adds USDC, the vault issues vault shares (SPL tokens) representing their portion of its total assets. As the vault earns interest, the value of each share increases. The depositor later redeems those shares for USDC at the current exchange rate.
Suppose the vault holds \$1 million USDC and the curator sets a 60% allocation to one reserve and 40% to another. The vault targets \$600,000 in the first reserve and \$400,000 in the second. Because each reserve earns a different supply rate, the vault's yield reflects the amount allocated to each one.
As the vault's balance changes, the amount held in each reserve can move away from the 60/40 target allocation. A permissionless crank periodically moves available capital so each reserve moves closer to its target. The curator sets or updates the percentage assigned to each reserve instead of moving every deposit manually.
When a depositor withdraws, the vault redeems their shares for USDC. It first uses unallocated USDC and any capital available from its reserves. If the full amount cannot be returned immediately, the remainder enters a withdrawal queue and is paid as liquidity becomes available.
The curator can earn revenue through a performance fee on profits and an assets under management (AUM) fee on the vault's total assets. Both fees accrue in the vault's deposit asset, which is USDC in this example, and can be collected by the curator.
<div>
<p><Icon icon="circle-check" /> Knowledge Check</p>
A curator should be able to:
* Understand what vault shares represent.
* Understand how allocation percentages determine the amount assigned to each reserve.
* Understand the crank's role in moving available capital closer to the curator's target allocations.
* Explain how depositors withdraw from the vault.
* Understand the two fee types that generate curator revenue.
</div>
<CardGroup>
<Card title="How vaults work" icon="gear" href="/docs/curators/vaults/concepts/how-vaults-work">
Vault mechanics, share tokens, and the deposit-to-yield lifecycle.
</Card>
<Card title="Create a vault" icon="plus" href="/docs/curators/vaults/guides/create-a-vault">
Initialize a new vault and set its deposit asset.
</Card>
</CardGroup>
***
## Selecting Assets for a Vault
Each Kamino vault accepts a single asset. A USDC vault accepts USDC deposits and allocates them only to USDC reserves. It cannot allocate capital to SOL or any other asset.
The same asset may be available in several Kamino lending markets. Each market has its own borrowers, supply rate, utilization, and available liquidity. The curator selects which of these reserves the vault can allocate capital to.
The supply rate shown for a reserve can change as borrowing demand changes. A higher rate may reflect high utilization, which also leaves less liquidity available if the vault needs to withdraw capital. Farm incentives may also increase the displayed yield only while those rewards continue.
Using several reserves can spread capital across lending markets, but the number of allocations alone does not determine diversification. Reserves exposed to similar borrowers or market conditions may still carry similar risk.
<div>
<p>Worth checking</p>
* Whether the expected yield is supported by borrowing demand and how much remains if farm rewards end.
* Whether the selected reserves provide enough liquidity and meaningfully different exposure.
</div>
***
## Planning the Allocation Strategy
For each reserve, the curator sets rules for when capital can enter and how much it can receive. Together, these settings determine how the vault distributes capital as market conditions change.
A vault can allocate the same asset across several reserves, each offering a different way to earn yield. The curator decides whether capital should be placed in a reserve immediately or moved only when a borrower is ready to use it.
A **Standard** allocation places capital in a variable rate reserve, where it earns interest that changes with utilization. A **Conditional** allocation keeps that capital earning in a Standard reserve until it matches demand for a fixed rate loan. The capital then moves into the fixed rate reserve and is lent to the borrower.
For each Standard allocation, the **weight** sets the share of vault capital intended for that reserve. As the vault grows, the amount assigned to the reserve grows with it.
The curator can set a **vault allocation cap** to stop that amount from increasing beyond a chosen limit. This prevents the vault from placing too much of its capital in one reserve. The cap applies only to the vault and does not change the reserve's own settings.
### Allocation Settings
| Setting | What it determines |
| - | - |
| **Type** | Whether capital enters a reserve immediately through a Standard allocation or moves when fixed rate borrowing demand appears through a Conditional allocation. |
| **Weight** | The proportion of capital assigned to each Standard allocation. |
| **Cap** | The maximum amount of the vault asset that can be allocated to a reserve. |
| **Priority** | Which Standard allocations may supply capital when a Conditional allocation receives borrowing demand. |
<div>
<p>Worth checking</p>
* Whether the vault should hold capital in variable rate reserves, offer fixed rate loans through Conditional allocations, or support both.
* How much capital the vault should make available for fixed rate borrowing demand.
</div>
<CardGroup>
<Card title="Allocations" icon="chart-pie" href="/docs/curators/vaults/concepts/allocations">
Weight, cap, type, and priority mechanics.
</Card>
<Card title="Configure allocations" icon="sliders" href="/docs/curators/vaults/guides/configure-allocations">
Set and update allocation targets.
</Card>
<Card title="Fixed rates" icon="lock" href="/docs/curators/vaults/fixed-rates/index">
Conditional allocations and fixed rate lending.
</Card>
</CardGroup>
***
## Planning for Withdrawals
A curator decides how much deposited capital should remain available for withdrawals instead of being allocated to lending reserves. This is the vault's **unallocated buffer**. A larger buffer supports more immediate withdrawals, but the capital it holds does not earn lending yield.
The **UnallocatedWeight** allows the buffer to grow with the vault. The **UnallocatedTokensCap** stops that growth once the buffer is large enough, preventing too much depositor capital from sitting idle instead of earning yield.
When a depositor withdraws, the vault uses the unallocated buffer first. If the buffer cannot cover the full amount, the vault draws from available liquidity in its reserve allocations. Any amount that cannot be returned immediately enters the withdrawal queue and is paid as liquidity becomes available.
<Callout icon="circle-info">
**Vault shares and reserve receipts.** Depositors normally hold vault shares, also called kTokens, representing their portion of the vault. The vault holds cTokens representing capital supplied to its lending reserves. If a withdrawal must be queued, the remaining vault shares may be exchanged for cTokens until the underlying asset becomes available.
</Callout>
### Withdrawal Settings
| Setting | What it determines |
| - | - |
| **UnallocatedWeight** | The target share of vault capital kept available for withdrawals. |
| **UnallocatedTokensCap** | The maximum amount of capital the vault may hold in the unallocated buffer. |
<div>
<p>Worth checking</p>
* How much withdrawal activity the vault is expected to support.
* How much yield the vault can forgo to keep capital immediately available.
</div>
<CardGroup>
<Card title="Liquidity & withdrawals" icon="droplet" href="/docs/curators/vaults/concepts/liquidity-and-withdrawals">
Buffer sizing, withdrawal queue, and cToken mechanics.
</Card>
<Card title="Create a vault" icon="plus" href="/docs/curators/vaults/guides/create-a-vault">
Set buffer parameters during vault creation.
</Card>
</CardGroup>
***
## Vault Revenue and Depositor Rewards
A curator decides how the vault will generate revenue and whether depositors will receive rewards in addition to lending yield. These choices affect the return depositors keep and the income the curator earns for managing the vault.
### Setting Fees
Curator revenue comes from two fees. A **performance fee** charges a percentage of the vault's profits. An **assets under management (AUM) fee** charges an annual percentage of the vault's total assets, regardless of its performance. Both accrue in the vault's deposit asset and can be collected by the curator.
The vault also charges fees that do not generate curator revenue. The **withdrawal penalty** returns to the vault for the benefit of remaining depositors. The **crank fund fee** covers the protocol cost of allocating new deposits across reserves.
### Fee Settings
| Fee | How it is calculated | Curator revenue? |
| - | - | - |
| **Performance fee** | A percentage of the vault's profits. | Yes |
| **Assets under management (AUM) fee** | An annual percentage of the vault's total assets. | Yes |
| **Withdrawal penalty** | The greater of a percentage fee or a fixed token amount charged when a depositor withdraws. | No. It returns to the vault for remaining depositors. |
| **Crank fund fee** | A fixed amount charged for each reserve when a deposit is allocated. | No. It funds protocol operations. |
### Farm Rewards
Farm rewards are separate from curator fees. Where they come from determines whether depositors claim them directly or receive them through a higher vault share value.
| Reward type | Where it comes from | How depositors receive it | Curator revenue |
| - | - | - | - |
| **Vault Farm** | A reward token supplied by the curator or another sponsor. | Depositors claim rewards based on their vault share holdings during the reward period. | No |
| **Reserve farm** | An incentive program attached to a reserve where th프로젝트로 돌아가기