@anywalletkit/protocol-lending-kamino-solana 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -13
- package/dist/index.cjs +464 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +213 -21
- package/dist/index.d.ts +213 -21
- package/dist/index.js +461 -97
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -17,7 +17,8 @@ On npm: [@anywalletkit/protocol-lending-kamino-solana](https://www.npmjs.com/pac
|
|
|
17
17
|
- **`KaminoVaultProtocolSolana`** — one Kamino Earn vault (kVault): `supply`
|
|
18
18
|
deposits the vault's asset for shares (kept in the wallet, where the guard
|
|
19
19
|
proves they arrive; `skipFarm: false` stakes them in the vault farm as the
|
|
20
|
-
Kamino app does
|
|
20
|
+
Kamino app does — the guard then pins the stake to this vault's farm and the
|
|
21
|
+
wallet's farm state, but cannot count the shares), `withdraw` redeems shares for the
|
|
21
22
|
asset. The simplest Earn product; `borrow` / `repay` reject.
|
|
22
23
|
- **`KaminoMarketProtocolSolana`** — one Kamino Lend market (the Main Market
|
|
23
24
|
by default): `supply` / `withdraw` post and take collateral on the wallet's
|
|
@@ -34,21 +35,37 @@ The module never signs it as-is. The wallet's serialized-transaction guard
|
|
|
34
35
|
1. every program it invokes is on the Kamino allowlist — Kamino Lend, kVault,
|
|
35
36
|
Farms, the address-lookup-table program and the token / system / compute
|
|
36
37
|
budget / memo programs, nothing else;
|
|
37
|
-
2.
|
|
38
|
+
2. every instruction is one the operation takes (`marketRules` /
|
|
39
|
+
`vaultRules`), with the accounts that decide where value goes pinned: the
|
|
40
|
+
wallet, its vanilla obligation, the configured market or vault, the
|
|
41
|
+
reserve and mint the call names, the wallet's own token accounts, this
|
|
42
|
+
vault's farm. A deposit carries refreshes, set-up and the deposit; a
|
|
43
|
+
withdrawal inside it, a borrow inside a repay, a token transfer, an
|
|
44
|
+
`invest` or a reward harvest is refused (`unexpected-instruction`);
|
|
45
|
+
3. the compiled-transaction checks pass (this wallet is the fee payer, no
|
|
38
46
|
foreign co-signers, no authority or delegate changes);
|
|
39
|
-
|
|
47
|
+
4. a simulation with post-state accounts shows exactly the balance changes
|
|
40
48
|
the module declared: on a deposit the amount out and at most rent in SOL
|
|
41
|
-
on top, on a withdrawal / borrow the asset in at the
|
|
42
|
-
(`slippageBps`, default 0.5 %)
|
|
49
|
+
on top, on a withdrawal / borrow the asset in at the minimum
|
|
50
|
+
(`slippageBps`, default 0.5 %) — a borrow at most what was asked — no
|
|
51
|
+
other token account of ours touched.
|
|
43
52
|
|
|
44
|
-
Only after all
|
|
53
|
+
Only after all four does the account sign. A first Lend deposit also pays the
|
|
45
54
|
rent of the obligation, user metadata and a per-user lookup table
|
|
46
55
|
(`firstDepositAllowanceLamports`, default 0.045 SOL); later ones only the
|
|
47
|
-
usual `rentAllowanceLamports` (0.01 SOL).
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
usual `rentAllowanceLamports` (0.01 SOL). Whether it is a first deposit is
|
|
57
|
+
read from the chain (does the vanilla obligation's account exist).
|
|
58
|
+
|
|
59
|
+
The bounds come from the chain, read through the account
|
|
60
|
+
(`getAccountInfos`, `@anywalletkit/wallet-solana` 0.4+): a vault's share
|
|
61
|
+
price from its state and the reserves it invests in, the wallet's shares
|
|
62
|
+
from its shares account and farm stake, a Lend 'max' from the obligation
|
|
63
|
+
(debt with the reserve's accrued interest), and the reserve the API names
|
|
64
|
+
must be this market's and lend that token. An API figure that disagrees —
|
|
65
|
+
a `tokensPerShare` more than 1 % off, a reported deposit or debt that is not
|
|
66
|
+
the obligation's, any negative figure — is refused, never used. Reads
|
|
67
|
+
(`getVault`, `getPosition`, APY, TVL) stay the API's; mint decimals are read
|
|
68
|
+
when the account has an RPC, else taken from a table of Kamino's listed mints.
|
|
52
69
|
|
|
53
70
|
## Usage
|
|
54
71
|
|
|
@@ -95,7 +112,7 @@ reserves) resolves to the deepest one by supplied value; pin another with
|
|
|
95
112
|
| `slippageBps` | 50 | floor on what the wallet must receive (withdraw, borrow); ceiling on a repay |
|
|
96
113
|
| `rentAllowanceLamports` | 0.01 SOL | SOL a transaction may spend beyond the amount |
|
|
97
114
|
| `memo` | — | SPL memo the API adds |
|
|
98
|
-
| vault: `vault`, `asset`, `skipFarm` | — / — / true | the kVault; the asset it must take; keep shares in the wallet (`false`: stake them in
|
|
115
|
+
| vault: `vault`, `asset`, `skipFarm` | — / — / true | the kVault; the asset it must take; keep shares in the wallet (`false`: stake them in this vault's farm; the guard then proves the spend and pins the stake to the wallet's farm state) |
|
|
99
116
|
| market: `market`, `reserves`, `firstDepositAllowanceLamports` | Main Market / — / 0.045 SOL | |
|
|
100
117
|
|
|
101
118
|
## Verify
|
|
@@ -108,4 +125,7 @@ a read-only account (no keys, no writes).
|
|
|
108
125
|
Program ids: Kamino Lend `KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD`, kVault
|
|
109
126
|
`KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd`, Farms
|
|
110
127
|
`FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr`. `instructionName()` names the
|
|
111
|
-
Anchor instructions the API's transactions carry, for review screens
|
|
128
|
+
Anchor instructions the API's transactions carry, for review screens;
|
|
129
|
+
`decodeVault` / `decodeReserve` / `decodeObligation` / `decodeFarmUser` read
|
|
130
|
+
the accounts the bounds come from, and `vaultTokensPerShareWad` / `debtNow`
|
|
131
|
+
compute from them what the module does.
|