@perena/bankineco-sdk 1.0.145 → 1.0.147

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 CHANGED
@@ -78,7 +78,7 @@ const usdStarPrice = await getLatestUsdStarUiPrice(rpcUrl, "prod");
78
78
  ### Get Quote
79
79
 
80
80
  ```typescript
81
- const vault = this.getVault(USDC_MINT);
81
+ const vault = client.getVault(USDC_MINT);
82
82
 
83
83
  // Calculate the amount of USD* you will get from the USDC provided
84
84
  const { amount: usdStarOutput, details: mintDetails } =
@@ -92,6 +92,38 @@ const { amount: usdcOutput, details: burnDetails } =
92
92
  );
93
93
  ```
94
94
 
95
+ **Junior unstake fee quote (`fetchUnstakeFee`):** pass the number of **junior shares** as `amount` (same raw units as `requestUnstakeJuniorTx` / `instantUnstakeJuniorTx`). Use `early: true` when the user will pay the early fee (instant unstake, or fulfilling a queue before lockup expires); use `early: false` for a standard queued unstake after lockup.
96
+
97
+ - **Junior → USD\* (bank mint / senior):** do not set `targetMint`. `feeAmount`, `amountAfterFee`, and `burningFeeAmount` are denominated in **USD\*** (bank mint) raw units; `burningFeeBps` stays zero because there is no vault burn on that path.
98
+
99
+ - **Junior → yielding mint (e.g. USDC):** set `targetMint` to the yielding mint for an **idle vault the client supports** (the same mint you would pass to `requestUnstakeJuniorTx`). The SDK values the redemption in that mint and includes the vault **burn** fee, so `feeAmount` and `amountAfterFee` are in **that mint’s** raw units. Check `burningFeeBps` / `burningFeeAmount` for the burn portion.
100
+
101
+ ```typescript
102
+ // Junior → USD* — standard vs early unstake fee only (amounts in USD* raw units)
103
+ const juniorToUsdStar = await client.fetchUnstakeFee({
104
+ amount: fromUiAmount(5, USD_STAR_DECIMALS),
105
+ early: false,
106
+ });
107
+
108
+ const juniorToUsdStarEarly = await client.fetchUnstakeFee({
109
+ amount: fromUiAmount(5, USD_STAR_DECIMALS),
110
+ early: true,
111
+ });
112
+
113
+ // Junior → USDC — unstake fee + burn fee (amounts in USDC raw units)
114
+ const juniorToUsdc = await client.fetchUnstakeFee({
115
+ amount: fromUiAmount(5, USD_STAR_DECIMALS),
116
+ early: false,
117
+ targetMint: USDC_MINT,
118
+ });
119
+
120
+ const juniorToUsdcEarly = await client.fetchUnstakeFee({
121
+ amount: fromUiAmount(5, USD_STAR_DECIMALS),
122
+ early: true,
123
+ targetMint: USDC_MINT,
124
+ });
125
+ ```
126
+
95
127
  ### Staking (Junior Tranche)
96
128
 
97
129
  Stake USD\* into the junior tranche to earn leveraged yield. Staked tokens are represented by junior share tokens.
@@ -148,6 +180,29 @@ const { transaction: fulfillTx } = await client.fulfillUnstakeJuniorTx({
148
180
  const transaction = new Transaction().add(requestTx, fulfillTx);
149
181
  ```
150
182
 
183
+ ### Instant unstake (Junior) — `instantUnstakeJuniorTx`
184
+
185
+ To exit the junior tranche in **one transaction** without using the withdrawal queue, use `instantUnstakeJuniorTx`. The program always applies the **early unstake fee** (same idea as fulfilling a queued request before lockup expires). Use `fetchUnstakeFee` with `early: true` if you want a fee quote first.
186
+
187
+ ```typescript
188
+ const { transaction, lookupTables } = await client.instantUnstakeJuniorTx({
189
+ shares: fromUiAmount(5, USD_STAR_DECIMALS),
190
+ user: anchorWallet.publicKey,
191
+ });
192
+ ```
193
+
194
+ To receive a yielding asset (e.g. USDC) instead of USD\*, set `targetMint`. For vaults that need extra accounts on redeem (for example marginfi), pass `remainingAccounts` as you would for `requestUnstakeJuniorTx`.
195
+
196
+ ```typescript
197
+ const { transaction, lookupTables } = await client.instantUnstakeJuniorTx({
198
+ shares: fromUiAmount(5, USD_STAR_DECIMALS),
199
+ targetMint: USDC_MINT,
200
+ user: anchorWallet.publicKey,
201
+ });
202
+ ```
203
+
204
+ The returned `transaction` should be signed and sent like other client helpers; attach `lookupTables` when building/sending the versioned transaction if your stack requires it.
205
+
151
206
  ### Reading Withdrawal Queues
152
207
 
153
208
  After requesting an unstake, you can fetch all withdrawal queue entries for a given owner to check amounts awaiting unstake and how much time remains until each lockup expires.
@@ -36,8 +36,8 @@ export declare function fetchGlowUsdtTokenPrice(): Promise<number>;
36
36
  */
37
37
  export declare function getGlowUsdtShareHolderAta(owner: PublicKey): PublicKey;
38
38
  /**
39
- * Fetches the USDT value owed by the Glow usdt vault position (share balance × share price).
40
- * Used for uncollateralized external yield oracle: report this as pending yield in USDT base units.
39
+ * Fetches the USDT value of the Glow usdt vault position (share balance × share price).
40
+ * For oracle pending yield, subtract the vault's `external_yielding_amount` principal (see Kamino/MarginFi oracles).
41
41
  */
42
42
  export declare function fetchGlowUsdtOwed(connection: Connection, shareHolder: PublicKey): Promise<BN>;
43
43
  export declare function createGlowUsdtDepositTransaction(args: CreateGlowUsdtDepositTransactionArgs): Promise<CreateGlowUsdtTransactionResponse>;
@@ -95,8 +95,8 @@ function getGlowUsdtShareHolderAta(owner) {
95
95
  return deriveAta(constants_1.GLOW_USDT_SHARE_MINT, spl_token_1.TOKEN_2022_PROGRAM_ID, vaultUser);
96
96
  }
97
97
  /**
98
- * Fetches the USDT value owed by the Glow usdt vault position (share balance × share price).
99
- * Used for uncollateralized external yield oracle: report this as pending yield in USDT base units.
98
+ * Fetches the USDT value of the Glow usdt vault position (share balance × share price).
99
+ * For oracle pending yield, subtract the vault's `external_yielding_amount` principal (see Kamino/MarginFi oracles).
100
100
  */
101
101
  async function fetchGlowUsdtOwed(connection, shareHolder) {
102
102
  const sharePrice = await fetchGlowUsdtTokenPrice();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perena/bankineco-sdk",
3
- "version": "1.0.145",
3
+ "version": "1.0.147",
4
4
  "description": "SDK for interacting with Bankineco program on Solana.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build": "rm -rf dist && tsc -p tsconfig.json",
24
24
  "deploy": "npm publish --access public --userconfig ~/.npmrc.perena",
25
- "set-latest": "npm --userconfig ~/.npmrc.perena dist-tag add @perena/bankineco-sdk@1.0.120 latest"
25
+ "set-latest": "npm --userconfig ~/.npmrc.perena dist-tag add @perena/bankineco-sdk@1.0.147 latest"
26
26
  },
27
27
  "dependencies": {
28
28
  "@coral-xyz/anchor": "=0.30.1",