@perena/vault-sdk 1.0.18 → 1.0.19

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.
Files changed (4) hide show
  1. package/README.md +63 -7
  2. package/dist/index.d.ts +2613 -497
  3. package/dist/index.js +2721 -546
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -152,6 +152,9 @@ const ixArgs = {
152
152
  feeVault,
153
153
  feeVaultAta,
154
154
  userShareAta,
155
+ // Optional: selects execute_deposit_fee_exempt and is included in ix data.
156
+ // Include every invoke_signed seed, with the bump as the final seed.
157
+ addressSeeds,
155
158
  };
156
159
 
157
160
  const accounts = client.tx.executeDeposit.getIxAccounts(ixArgs);
@@ -167,21 +170,65 @@ const cpiPayload = {
167
170
  ),
168
171
  data: {
169
172
  amount: data.amount.toString(),
173
+ addressSeeds: data.addressSeeds,
170
174
  },
171
175
  };
172
176
  ```
173
177
 
174
178
  In Rust, map those account addresses into the matching Anchor CPI account struct
175
179
  and pass the data fields into the generated CPI method. For example,
176
- `executeDeposit.getIxData(...)` returns `{ amount }`, which corresponds to the
177
- `amount` argument on the vault program's `execute_deposit` CPI.
180
+ `executeDeposit.getIxData(...)` returns `{ amount, addressSeeds }`. Without
181
+ `addressSeeds`, it corresponds to `execute_deposit`; with seeds, the builder
182
+ selects `execute_deposit_fee_exempt`.
183
+
184
+ ### Fee-exempt program integrations
185
+
186
+ The deposit, withdrawal, tranche deposit, tranche withdrawal, and queued junior
187
+ fulfillment builders accept optional `addressSeeds` in both their `TxArgs` and
188
+ resolved `IxArgs`. Providing this field selects the corresponding
189
+ `*_fee_exempt` instruction; omitting it always selects the standard fee-bearing
190
+ instruction. External-liquidity withdrawals select
191
+ `execute_withdraw_from_external_fee_exempt` when both external withdrawal data
192
+ and `addressSeeds` are present.
193
+
194
+ Pass the exact seed slices used by the integrating program's `invoke_signed`,
195
+ including the one-byte bump as the final seed:
196
+
197
+ ```typescript
198
+ import { PublicKey } from "@solana/web3.js";
199
+
200
+ const baseSeeds = [Buffer.from("authority"), new PublicKey(vault).toBuffer()];
201
+ const [authority, bump] = PublicKey.findProgramAddressSync(
202
+ baseSeeds,
203
+ integrationProgramId
204
+ );
205
+ const addressSeeds = [...baseSeeds, Buffer.from([bump])];
206
+
207
+ const ixArgs = await client.tx.executeDeposit.getIxData({
208
+ ...resolvedDepositIxArgs,
209
+ user: authority.toBase58() as Address,
210
+ addressSeeds,
211
+ });
212
+
213
+ // ixArgs.addressSeeds is forwarded to execute_deposit_fee_exempt.
214
+ ```
215
+
216
+ On-chain exemption succeeds only when the authority is a signer, its owner is
217
+ the vault program or an allowlisted integration program, and
218
+ `create_program_address(addressSeeds, authority.owner)` equals the authority
219
+ address. The integrating program must invoke the vault instruction using
220
+ `invoke_signed` with those same seeds. A PDA cannot call the fee-exempt route as
221
+ a directly submitted top-level transaction.
222
+
223
+ For `fulfillJuniorTrancheWithdraw`, the fee-exempt signer must also be the queue
224
+ owner; a separate fulfiller cannot waive that owner's fee.
178
225
 
179
226
  ## Quoting conversions
180
227
 
181
228
  Use `client.quote.quote(...)` to calculate expected output amounts before
182
- building a transaction. Quotes fetch the current vault/tranche state, calculate
183
- using the same fee formulas as the program, and require a `signer` address so
184
- the SDK can check whether the signer is owned by a fee-exempt program.
229
+ building a transaction. Quotes fetch the current vault/tranche state and use the
230
+ same fee formulas as the program. To quote a fee-exempt route, provide the same
231
+ `addressSeeds`; owner allowlisting by itself does not make a quote fee-exempt.
185
232
 
186
233
  All amounts are base units. `expectedAmountOut` is the net amount after fees;
187
234
  `grossAmountOut`, `feeAmount`, `feeBps`, and `feeExempt` explain the quote.
@@ -200,7 +247,17 @@ const depositQuote = await client.quote.quote({
200
247
  });
201
248
 
202
249
  console.log(depositQuote.expectedAmountOut); // regular shares to receive
203
- console.log(depositQuote.feeExempt); // true when signer owner is whitelisted
250
+ console.log(depositQuote.feeExempt); // false: no addressSeeds were supplied
251
+
252
+ const exemptDepositQuote = await client.quote.quote({
253
+ shareClass: "regular",
254
+ direction: "deposit",
255
+ signer,
256
+ vault,
257
+ assetMint,
258
+ amount: 1_000_000n,
259
+ addressSeeds,
260
+ });
204
261
 
205
262
  // Regular vault shares -> asset
206
263
  const withdrawQuote = await client.quote.quote({
@@ -331,7 +388,6 @@ await client.sendTransaction(
331
388
  curator,
332
389
  shareMint,
333
390
  strictAssetMint: assetMint,
334
- assetDecimals: 6,
335
391
  })
336
392
  );
337
393