@neutral-trade/sdk 0.4.3 → 0.4.5

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/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as SupportedToken, B as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, C as VaultRegistryEntry, D as UserBundleAccount, E as OracleData, F as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, G as getDefaultBundleProgramIdByCluster, H as assertAllowlistedBundleProgramId, I as BUNDLE_PROGRAM_ID_V2_MAINNET, K as isAllowlistedBundleProgramId, L as BundleCluster, M as getSolanaTokenDecimals, N as getSolanaTokenMint, O as UserBundleTempData, P as tokens, R as BundleProgram, S as VaultRegistry, T as BundleAccount, U as createAllowlistedBundleProgram, V as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, W as createBundleProgramById, _ as vaults, b as VaultBalanceData, d as NeutralTradeConfig, f as getBundleProgramId, g as isValidVaultAddress, h as getVaultRegistry, j as Token, k as SupportedChain, m as getVaultById, p as getVaultByAddress, t as NeutralTradeCoreContext, u as NeutralTrade, v as vaultsDevnet, w as VaultType, x as VaultCategory, y as UserBalanceResult, z as BundleProvider } from "./neutral-trade-core-ChBn3_UV.mjs";
1
+ import { A as SupportedToken, B as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, C as VaultRegistryEntry, D as UserBundleAccount, E as OracleData, F as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, G as getDefaultBundleProgramIdByCluster, H as assertAllowlistedBundleProgramId, I as BUNDLE_PROGRAM_ID_V2_MAINNET, K as isAllowlistedBundleProgramId, L as BundleCluster, M as getSolanaTokenDecimals, N as getSolanaTokenMint, O as UserBundleTempData, P as tokens, R as BundleProgram, S as VaultRegistry, T as BundleAccount, U as createAllowlistedBundleProgram, V as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, W as createBundleProgramById, _ as vaults, b as VaultBalanceData, d as NeutralTradeConfig, f as getBundleProgramId, g as isValidVaultAddress, h as getVaultRegistry, j as Token, k as SupportedChain, m as getVaultById, p as getVaultByAddress, t as NeutralTradeCoreContext, u as NeutralTrade, v as vaultsDevnet, w as VaultType, x as VaultCategory, y as UserBalanceResult, z as BundleProvider } from "./neutral-trade-core-BGjOiCsY.mjs";
2
2
  import { AnchorProvider, Wallet } from "@coral-xyz/anchor";
3
3
  import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
4
4
  import BN from "bn.js";
@@ -199,6 +199,51 @@ declare function parseAmountRawToBigInt(amountRaw: string): bigint;
199
199
  */
200
200
  declare function humanFloatToAmountRawString(human: number, decimals: number): string;
201
201
  //#endregion
202
+ //#region src/utils/bundle-fee-override.d.ts
203
+ /** Mirrors `bundle-sc` `FEE_OVERRIDE_*` bit flags. */
204
+ declare const FEE_OVERRIDE: {
205
+ readonly DEPOSIT: number;
206
+ readonly WITHDRAWAL: number;
207
+ readonly PERFORMANCE: number;
208
+ readonly MANAGEMENT: number;
209
+ };
210
+ interface EffectiveFeeBps {
211
+ depositFeeBps: number;
212
+ withdrawalFeeBps: number;
213
+ performanceFeeBps: number;
214
+ managementFeeBps: number;
215
+ }
216
+ /** Decimal fees matching frontend `VaultConfig` (`0.01` = 1%). */
217
+ interface EffectiveVaultFeeDecimals {
218
+ dfee: number;
219
+ wfee: number;
220
+ pfee: number;
221
+ mfee: number;
222
+ }
223
+ declare function bpsToFeeDecimal(bps: number): number;
224
+ declare function feeDecimalToBps(decimal: number): number;
225
+ declare function vaultFeeDecimalsToBps(fees: EffectiveVaultFeeDecimals): EffectiveFeeBps;
226
+ declare function effectiveFeeBpsToDecimals(fees: EffectiveFeeBps): EffectiveVaultFeeDecimals;
227
+ /**
228
+ * Apply per-user fee override flags onto default bps (bundle or vault-config defaults).
229
+ */
230
+ declare function resolveEffectiveFeeBpsFromDefaults(defaults: EffectiveFeeBps, user: UserBundleAccount): EffectiveFeeBps;
231
+ /**
232
+ * Mirror on-chain `resolve_effective_fees`. Returns fee rates in bps.
233
+ */
234
+ declare function resolveEffectiveFeeBps(bundle: BundleAccount, user: UserBundleAccount): EffectiveFeeBps;
235
+ /**
236
+ * Resolve effective fees for UI vault config defaults + optional user bundle account.
237
+ * Returns decimal fees (`0.01` = 1%).
238
+ */
239
+ declare function resolveEffectiveVaultFees(vaultDefaults: EffectiveVaultFeeDecimals, user?: UserBundleAccount | null): EffectiveVaultFeeDecimals;
240
+ declare function hasAnyFeeOverride(user?: UserBundleAccount | null): boolean;
241
+ declare function hasCustomFeeRate(effectiveFees: EffectiveVaultFeeDecimals, vaultDefaults: EffectiveVaultFeeDecimals): boolean;
242
+ declare function computeDepositFeePreview(grossAmount: number, depositFeeDecimal: number): {
243
+ feeAmount: number;
244
+ netAmount: number;
245
+ };
246
+ //#endregion
202
247
  //#region src/utils/request-withdraw-shares.d.ts
203
248
  /**
204
249
  * Shares to burn for `requestWithdrawal`, from integer token raw and on-chain totals.
@@ -281,4 +326,4 @@ declare function derivePendingAuthPDA(bundlePDA: PublicKey, programId: PublicKey
281
326
  */
282
327
  declare function getVaultDepositorAddressSync(programId: PublicKey, vault: PublicKey, authority: PublicKey): PublicKey;
283
328
  //#endregion
284
- export { ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, BUNDLE_PROGRAM_ID_V2_MAINNET, type BuildBundleDepositInstructionsParams, type BuildBundleRequestWithdrawInstructionParams, type BundleAccount, type BundleCluster, type BundleProgram, type BundleProvider, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, NeutralTrade, type NeutralTradeConfig, type NeutralTradeCoreContext, type OracleData, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, type Token, type UserBalanceResult, type UserBundleAccount, type UserBundleTempData, type VaultBalanceData, VaultCategory, VaultId, type VaultRegistry, type VaultRegistryEntry, VaultType, assertAllowlistedBundleProgramId, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, computeRequestWithdrawalSharesFromAmountRaw, createAllowlistedBundleProgram, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, humanFloatToAmountRawString, isAllowlistedBundleProgramId, isValidVaultAddress, parseAmountRawToBigInt, tokens, vaults, vaultsDevnet };
329
+ export { ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, BUNDLE_PROGRAM_ID_V2_MAINNET, type BuildBundleDepositInstructionsParams, type BuildBundleRequestWithdrawInstructionParams, type BundleAccount, type BundleCluster, type BundleProgram, type BundleProvider, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, type EffectiveFeeBps, type EffectiveVaultFeeDecimals, FEE_OVERRIDE, NeutralTrade, type NeutralTradeConfig, type NeutralTradeCoreContext, type OracleData, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, type Token, type UserBalanceResult, type UserBundleAccount, type UserBundleTempData, type VaultBalanceData, VaultCategory, VaultId, type VaultRegistry, type VaultRegistryEntry, VaultType, assertAllowlistedBundleProgramId, bpsToFeeDecimal, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, computeDepositFeePreview, computeRequestWithdrawalSharesFromAmountRaw, createAllowlistedBundleProgram, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, effectiveFeeBpsToDecimals, feeDecimalToBps, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, hasAnyFeeOverride, hasCustomFeeRate, humanFloatToAmountRawString, isAllowlistedBundleProgramId, isValidVaultAddress, parseAmountRawToBigInt, resolveEffectiveFeeBps, resolveEffectiveFeeBpsFromDefaults, resolveEffectiveVaultFees, tokens, vaultFeeDecimalsToBps, vaults, vaultsDevnet };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as SupportedChain, B as createAllowlistedBundleProgram, C as getVaultById, D as vaultsDevnet, E as vaults, F as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, H as getDefaultBundleProgramIdByCluster, I as BUNDLE_PROGRAM_ID_V2_MAINNET, L as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, M as getSolanaTokenDecimals, N as getSolanaTokenMint, O as VaultCategory, P as tokens, R as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, S as getVaultByAddress, T as isValidVaultAddress, U as isAllowlistedBundleProgramId, V as createBundleProgramById, W as createDummyWallet, _ as deriveUserPDA, a as buildBundleDepositInstructions, b as parseAmountRawToBigInt, d as SEED_PENDING_AUTH, f as SEED_TEMP, g as deriveTempDataPDA, h as derivePendingAuthPDA, i as initNeutralTradeCore, j as SupportedToken, k as VaultType, l as computeRequestWithdrawalSharesFromAmountRaw, m as deriveOraclePDA, n as buildRequestWithdrawInstructionForVaultId, o as buildBundleRequestWithdrawInstruction, p as SEED_USER, t as buildDepositInstructionsForVaultId, u as SEED_ORACLE, v as getVaultDepositorAddressSync, w as getVaultRegistry, x as getBundleProgramId, y as humanFloatToAmountRawString, z as assertAllowlistedBundleProgramId } from "./neutral-trade-core-CVl2TjD0.mjs";
1
+ import { A as SupportedChain, B as createAllowlistedBundleProgram, C as getVaultById, D as vaultsDevnet, E as vaults, F as ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, H as getDefaultBundleProgramIdByCluster, I as BUNDLE_PROGRAM_ID_V2_MAINNET, L as DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, M as getSolanaTokenDecimals, N as getSolanaTokenMint, O as VaultCategory, P as tokens, R as DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, S as getVaultByAddress, T as isValidVaultAddress, U as isAllowlistedBundleProgramId, V as createBundleProgramById, W as createDummyWallet, _ as deriveUserPDA, a as buildBundleDepositInstructions, b as parseAmountRawToBigInt, d as SEED_PENDING_AUTH, f as SEED_TEMP, g as deriveTempDataPDA, h as derivePendingAuthPDA, i as initNeutralTradeCore, j as SupportedToken, k as VaultType, l as computeRequestWithdrawalSharesFromAmountRaw, m as deriveOraclePDA, n as buildRequestWithdrawInstructionForVaultId, o as buildBundleRequestWithdrawInstruction, p as SEED_USER, t as buildDepositInstructionsForVaultId, u as SEED_ORACLE, v as getVaultDepositorAddressSync, w as getVaultRegistry, x as getBundleProgramId, y as humanFloatToAmountRawString, z as assertAllowlistedBundleProgramId } from "./neutral-trade-core-B8iDgu5K.mjs";
2
2
  import { PublicKey } from "@solana/web3.js";
3
3
 
4
4
  //#region src/constants/vault-ids.ts
@@ -184,6 +184,99 @@ let DevnetVaultId = /* @__PURE__ */ function(DevnetVaultId$1) {
184
184
  return DevnetVaultId$1;
185
185
  }({});
186
186
 
187
+ //#endregion
188
+ //#region src/utils/bundle-fee-override.ts
189
+ /** Mirrors `bundle-sc` `FEE_OVERRIDE_*` bit flags. */
190
+ const FEE_OVERRIDE = {
191
+ DEPOSIT: 1,
192
+ WITHDRAWAL: 2,
193
+ PERFORMANCE: 4,
194
+ MANAGEMENT: 8
195
+ };
196
+ const FEE_EPS = 1e-9;
197
+ function bpsToFeeDecimal(bps) {
198
+ return bps / 1e4;
199
+ }
200
+ function feeDecimalToBps(decimal) {
201
+ return Math.round(decimal * 1e4);
202
+ }
203
+ function toNum(value) {
204
+ if (typeof value === "number") return value;
205
+ if (typeof value === "bigint") return Number(value);
206
+ if (typeof value === "object" && value !== null && "toNumber" in value) return value.toNumber();
207
+ return Number(String(value ?? 0));
208
+ }
209
+ function bundleDefaultFeeBps(bundle) {
210
+ const b = bundle;
211
+ return {
212
+ depositFeeBps: toNum(b.depositFee),
213
+ withdrawalFeeBps: toNum(b.withdrawalFee),
214
+ performanceFeeBps: toNum(b.performanceFee),
215
+ managementFeeBps: toNum(b.managementFeeBps)
216
+ };
217
+ }
218
+ function vaultFeeDecimalsToBps(fees) {
219
+ return {
220
+ depositFeeBps: feeDecimalToBps(fees.dfee),
221
+ withdrawalFeeBps: feeDecimalToBps(fees.wfee),
222
+ performanceFeeBps: feeDecimalToBps(fees.pfee),
223
+ managementFeeBps: feeDecimalToBps(fees.mfee)
224
+ };
225
+ }
226
+ function effectiveFeeBpsToDecimals(fees) {
227
+ return {
228
+ dfee: bpsToFeeDecimal(fees.depositFeeBps),
229
+ wfee: bpsToFeeDecimal(fees.withdrawalFeeBps),
230
+ pfee: bpsToFeeDecimal(fees.performanceFeeBps),
231
+ mfee: bpsToFeeDecimal(fees.managementFeeBps)
232
+ };
233
+ }
234
+ /**
235
+ * Apply per-user fee override flags onto default bps (bundle or vault-config defaults).
236
+ */
237
+ function resolveEffectiveFeeBpsFromDefaults(defaults, user) {
238
+ const flags = toNum(user.feeOverrideFlags);
239
+ if (flags === 0) return defaults;
240
+ return {
241
+ depositFeeBps: (flags & FEE_OVERRIDE.DEPOSIT) !== 0 ? toNum(user.customDepositFeeBps) : defaults.depositFeeBps,
242
+ withdrawalFeeBps: (flags & FEE_OVERRIDE.WITHDRAWAL) !== 0 ? toNum(user.customWithdrawalFeeBps) : defaults.withdrawalFeeBps,
243
+ performanceFeeBps: (flags & FEE_OVERRIDE.PERFORMANCE) !== 0 ? toNum(user.customPerformanceFeeBps) : defaults.performanceFeeBps,
244
+ managementFeeBps: (flags & FEE_OVERRIDE.MANAGEMENT) !== 0 ? toNum(user.customManagementFeeBps) : defaults.managementFeeBps
245
+ };
246
+ }
247
+ /**
248
+ * Mirror on-chain `resolve_effective_fees`. Returns fee rates in bps.
249
+ */
250
+ function resolveEffectiveFeeBps(bundle, user) {
251
+ return resolveEffectiveFeeBpsFromDefaults(bundleDefaultFeeBps(bundle), user);
252
+ }
253
+ /**
254
+ * Resolve effective fees for UI vault config defaults + optional user bundle account.
255
+ * Returns decimal fees (`0.01` = 1%).
256
+ */
257
+ function resolveEffectiveVaultFees(vaultDefaults, user) {
258
+ if (!user) return vaultDefaults;
259
+ return effectiveFeeBpsToDecimals(resolveEffectiveFeeBpsFromDefaults(vaultFeeDecimalsToBps(vaultDefaults), user));
260
+ }
261
+ function hasAnyFeeOverride(user) {
262
+ if (!user) return false;
263
+ return toNum(user.feeOverrideFlags) !== 0;
264
+ }
265
+ function hasCustomFeeRate(effectiveFees, vaultDefaults) {
266
+ return Math.abs(effectiveFees.dfee - vaultDefaults.dfee) > FEE_EPS || Math.abs(effectiveFees.wfee - vaultDefaults.wfee) > FEE_EPS || Math.abs(effectiveFees.pfee - vaultDefaults.pfee) > FEE_EPS || Math.abs(effectiveFees.mfee - vaultDefaults.mfee) > FEE_EPS;
267
+ }
268
+ function computeDepositFeePreview(grossAmount, depositFeeDecimal) {
269
+ if (grossAmount <= 0 || depositFeeDecimal <= 0) return {
270
+ feeAmount: 0,
271
+ netAmount: grossAmount
272
+ };
273
+ const feeAmount = grossAmount * depositFeeDecimal;
274
+ return {
275
+ feeAmount,
276
+ netAmount: grossAmount - feeAmount
277
+ };
278
+ }
279
+
187
280
  //#endregion
188
281
  //#region src/utils/bundle.ts
189
282
  const SECONDS_PER_YEAR = 365n * 24n * 60n * 60n;
@@ -202,8 +295,9 @@ function estimatePendingBundleFeeToken({ oracleData, bundleData, userBundle, ass
202
295
  const extra = bundleData;
203
296
  const assetPrec = extra.assetPrecision != null ? BigInt(extra.assetPrecision.toString()) : BigInt(10 ** assetDecimals);
204
297
  const sharePrice = totalShares > 0n ? totalAssets * assetPrec / totalShares : assetPrec;
205
- const managementFeeBps = BigInt(Number(extra.managementFeeBps ?? 0));
206
- const performanceFeeBps = BigInt(Number(extra.performanceFee ?? 0));
298
+ const effectiveFees = resolveEffectiveFeeBps(bundleData, userBundle);
299
+ const managementFeeBps = BigInt(effectiveFees.managementFeeBps);
300
+ const performanceFeeBps = BigInt(effectiveFees.performanceFeeBps);
207
301
  const lastMgmtTs = bnToBigInt(userBundle.lastManagementFeeTimestamp);
208
302
  const nowTs = BigInt(nowUnixSeconds);
209
303
  let managementFeeShares = 0n;
@@ -406,4 +500,4 @@ var NeutralTrade = class NeutralTrade {
406
500
  };
407
501
 
408
502
  //#endregion
409
- export { ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, BUNDLE_PROGRAM_ID_V2_MAINNET, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, NeutralTrade, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, VaultCategory, VaultId, VaultType, assertAllowlistedBundleProgramId, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, computeRequestWithdrawalSharesFromAmountRaw, createAllowlistedBundleProgram, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, humanFloatToAmountRawString, isAllowlistedBundleProgramId, isValidVaultAddress, parseAmountRawToBigInt, tokens, vaults, vaultsDevnet };
503
+ export { ALLOWLISTED_BUNDLE_PROGRAM_IDS_BY_CLUSTER, BUNDLE_PROGRAM_ID_V2_MAINNET, DEFAULT_BUNDLE_PROGRAM_ID_DEVNET, DEFAULT_BUNDLE_PROGRAM_ID_MAINNET, DevnetVaultId, FEE_OVERRIDE, NeutralTrade, SEED_ORACLE, SEED_PENDING_AUTH, SEED_TEMP, SEED_USER, SupportedChain, SupportedToken, VaultCategory, VaultId, VaultType, assertAllowlistedBundleProgramId, bpsToFeeDecimal, buildBundleDepositInstructions, buildBundleRequestWithdrawInstruction, computeDepositFeePreview, computeRequestWithdrawalSharesFromAmountRaw, createAllowlistedBundleProgram, createBundleProgramById, createDummyWallet, deriveOraclePDA, derivePendingAuthPDA, deriveTempDataPDA, deriveUserPDA, effectiveFeeBpsToDecimals, feeDecimalToBps, getBundleProgramId, getDefaultBundleProgramIdByCluster, getSolanaTokenDecimals, getSolanaTokenMint, getVaultByAddress, getVaultById, getVaultDepositorAddressSync, getVaultRegistry, hasAnyFeeOverride, hasCustomFeeRate, humanFloatToAmountRawString, isAllowlistedBundleProgramId, isValidVaultAddress, parseAmountRawToBigInt, resolveEffectiveFeeBps, resolveEffectiveFeeBpsFromDefaults, resolveEffectiveVaultFees, tokens, vaultFeeDecimalsToBps, vaults, vaultsDevnet };
@@ -1,2 +1,2 @@
1
- import { a as initNeutralTradeCore, c as buildBundleDepositInstructionsWithVault, i as getBundleProgramForVault, l as buildBundleRequestWithdrawInstructionWithVault, n as buildDepositInstructionsForVaultId, o as BuildBundleDepositInstructionsCoreParams, r as buildRequestWithdrawInstructionForVaultId, s as BuildBundleRequestWithdrawInstructionCoreParams, t as NeutralTradeCoreContext } from "./neutral-trade-core-ChBn3_UV.mjs";
1
+ import { a as initNeutralTradeCore, c as buildBundleDepositInstructionsWithVault, i as getBundleProgramForVault, l as buildBundleRequestWithdrawInstructionWithVault, n as buildDepositInstructionsForVaultId, o as BuildBundleDepositInstructionsCoreParams, r as buildRequestWithdrawInstructionForVaultId, s as BuildBundleRequestWithdrawInstructionCoreParams, t as NeutralTradeCoreContext } from "./neutral-trade-core-BGjOiCsY.mjs";
2
2
  export { type BuildBundleDepositInstructionsCoreParams, type BuildBundleRequestWithdrawInstructionCoreParams, type NeutralTradeCoreContext, buildBundleDepositInstructionsWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
package/dist/internal.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { c as buildBundleRequestWithdrawInstructionWithVault, i as initNeutralTradeCore, n as buildRequestWithdrawInstructionForVaultId, r as getBundleProgramForVault, s as buildBundleDepositInstructionsWithVault, t as buildDepositInstructionsForVaultId } from "./neutral-trade-core-CVl2TjD0.mjs";
1
+ import { c as buildBundleRequestWithdrawInstructionWithVault, i as initNeutralTradeCore, n as buildRequestWithdrawInstructionForVaultId, r as getBundleProgramForVault, s as buildBundleDepositInstructionsWithVault, t as buildDepositInstructionsForVaultId } from "./neutral-trade-core-B8iDgu5K.mjs";
2
2
 
3
3
  export { buildBundleDepositInstructionsWithVault, buildBundleRequestWithdrawInstructionWithVault, buildDepositInstructionsForVaultId, buildRequestWithdrawInstructionForVaultId, getBundleProgramForVault, initNeutralTradeCore };
@@ -31,7 +31,7 @@ function createAnchorProvider(connection, wallet) {
31
31
  //#endregion
32
32
  //#region src/idl/ntbundle.json
33
33
  var ntbundle_default = {
34
- address: "BUNDDh4P5XviMm1f3gCvnq2qKx6TGosAGnoUK12e7cXU",
34
+ address: "5qzXRABspP6QEFKyVddfvp3uGtz9ZGUk5YACZKrZhisK",
35
35
  metadata: {
36
36
  "name": "ntbundle",
37
37
  "version": "0.1.0",
@@ -281,6 +281,62 @@ var ntbundle_default = {
281
281
  "type": "pubkey"
282
282
  }]
283
283
  },
284
+ {
285
+ "name": "clear_user_fee_override",
286
+ "discriminator": [
287
+ 97,
288
+ 227,
289
+ 92,
290
+ 191,
291
+ 205,
292
+ 0,
293
+ 154,
294
+ 77
295
+ ],
296
+ "accounts": [
297
+ {
298
+ "name": "manager",
299
+ "writable": true,
300
+ "signer": true
301
+ },
302
+ { "name": "user_bundle_account_owner" },
303
+ {
304
+ "name": "user_bundle_account",
305
+ "writable": true,
306
+ "pda": { "seeds": [
307
+ {
308
+ "kind": "const",
309
+ "value": [
310
+ 85,
311
+ 83,
312
+ 69,
313
+ 82,
314
+ 95,
315
+ 66,
316
+ 85,
317
+ 78,
318
+ 68,
319
+ 76,
320
+ 69
321
+ ]
322
+ },
323
+ {
324
+ "kind": "account",
325
+ "path": "user_bundle_account_owner"
326
+ },
327
+ {
328
+ "kind": "account",
329
+ "path": "bundle_account"
330
+ }
331
+ ] }
332
+ },
333
+ { "name": "bundle_account" }
334
+ ],
335
+ "args": [{
336
+ "name": "clear_mask",
337
+ "type": "u8"
338
+ }]
339
+ },
284
340
  {
285
341
  "name": "close_user_bundle_account",
286
342
  "discriminator": [
@@ -3501,6 +3557,80 @@ var ntbundle_default = {
3501
3557
  "type": "i64"
3502
3558
  }]
3503
3559
  },
3560
+ {
3561
+ "name": "set_user_fee_override",
3562
+ "discriminator": [
3563
+ 207,
3564
+ 40,
3565
+ 210,
3566
+ 198,
3567
+ 66,
3568
+ 33,
3569
+ 153,
3570
+ 209
3571
+ ],
3572
+ "accounts": [
3573
+ {
3574
+ "name": "manager",
3575
+ "writable": true,
3576
+ "signer": true
3577
+ },
3578
+ { "name": "user_bundle_account_owner" },
3579
+ {
3580
+ "name": "user_bundle_account",
3581
+ "writable": true,
3582
+ "pda": { "seeds": [
3583
+ {
3584
+ "kind": "const",
3585
+ "value": [
3586
+ 85,
3587
+ 83,
3588
+ 69,
3589
+ 82,
3590
+ 95,
3591
+ 66,
3592
+ 85,
3593
+ 78,
3594
+ 68,
3595
+ 76,
3596
+ 69
3597
+ ]
3598
+ },
3599
+ {
3600
+ "kind": "account",
3601
+ "path": "user_bundle_account_owner"
3602
+ },
3603
+ {
3604
+ "kind": "account",
3605
+ "path": "bundle_account"
3606
+ }
3607
+ ] }
3608
+ },
3609
+ { "name": "bundle_account" }
3610
+ ],
3611
+ "args": [
3612
+ {
3613
+ "name": "override_mask",
3614
+ "type": "u8"
3615
+ },
3616
+ {
3617
+ "name": "custom_deposit_fee_bps",
3618
+ "type": "u32"
3619
+ },
3620
+ {
3621
+ "name": "custom_withdrawal_fee_bps",
3622
+ "type": "u32"
3623
+ },
3624
+ {
3625
+ "name": "custom_performance_fee_bps",
3626
+ "type": "u32"
3627
+ },
3628
+ {
3629
+ "name": "custom_management_fee_bps",
3630
+ "type": "u32"
3631
+ }
3632
+ ]
3633
+ },
3504
3634
  {
3505
3635
  "name": "set_withdrawal_redemption_schedule",
3506
3636
  "discriminator": [
@@ -4355,6 +4485,32 @@ var ntbundle_default = {
4355
4485
  183
4356
4486
  ]
4357
4487
  },
4488
+ {
4489
+ "name": "UserFeeOverrideCleared",
4490
+ "discriminator": [
4491
+ 109,
4492
+ 200,
4493
+ 134,
4494
+ 162,
4495
+ 195,
4496
+ 197,
4497
+ 177,
4498
+ 189
4499
+ ]
4500
+ },
4501
+ {
4502
+ "name": "UserFeeOverrideSet",
4503
+ "discriminator": [
4504
+ 194,
4505
+ 56,
4506
+ 240,
4507
+ 83,
4508
+ 158,
4509
+ 247,
4510
+ 78,
4511
+ 66
4512
+ ]
4513
+ },
4358
4514
  {
4359
4515
  "name": "VaultNeutralFeeIncrementerSet",
4360
4516
  "discriminator": [
@@ -4763,6 +4919,21 @@ var ntbundle_default = {
4763
4919
  "code": 6070,
4764
4920
  "name": "InvalidWithdrawalRedemptionSchedule",
4765
4921
  "msg": "Invalid withdrawal redemption schedule"
4922
+ },
4923
+ {
4924
+ "code": 6071,
4925
+ "name": "InvalidUserFeeConfig",
4926
+ "msg": "Invalid user fee configuration"
4927
+ },
4928
+ {
4929
+ "code": 6072,
4930
+ "name": "EmptyUserFeeClearRequest",
4931
+ "msg": "Empty user fee clear request"
4932
+ },
4933
+ {
4934
+ "code": 6073,
4935
+ "name": "NoUserFeeOverrideToClear",
4936
+ "msg": "No user fee override to clear"
4766
4937
  }
4767
4938
  ],
4768
4939
  types: [
@@ -5757,9 +5928,29 @@ var ntbundle_default = {
5757
5928
  "name": "total_fee_charged",
5758
5929
  "type": "u64"
5759
5930
  },
5931
+ {
5932
+ "name": "custom_deposit_fee_bps",
5933
+ "type": "u32"
5934
+ },
5935
+ {
5936
+ "name": "custom_withdrawal_fee_bps",
5937
+ "type": "u32"
5938
+ },
5939
+ {
5940
+ "name": "custom_performance_fee_bps",
5941
+ "type": "u32"
5942
+ },
5943
+ {
5944
+ "name": "custom_management_fee_bps",
5945
+ "type": "u32"
5946
+ },
5947
+ {
5948
+ "name": "fee_override_flags",
5949
+ "type": "u8"
5950
+ },
5760
5951
  {
5761
5952
  "name": "padding",
5762
- "type": { "array": ["u8", 264] }
5953
+ "type": { "array": ["u8", 247] }
5763
5954
  }
5764
5955
  ]
5765
5956
  }
@@ -5784,6 +5975,94 @@ var ntbundle_default = {
5784
5975
  ]
5785
5976
  }
5786
5977
  },
5978
+ {
5979
+ "name": "UserFeeOverrideCleared",
5980
+ "type": {
5981
+ "kind": "struct",
5982
+ "fields": [
5983
+ {
5984
+ "name": "manager",
5985
+ "type": "pubkey"
5986
+ },
5987
+ {
5988
+ "name": "user",
5989
+ "type": "pubkey"
5990
+ },
5991
+ {
5992
+ "name": "bundle_account_key",
5993
+ "type": "pubkey"
5994
+ },
5995
+ {
5996
+ "name": "clear_mask",
5997
+ "type": "u8"
5998
+ },
5999
+ {
6000
+ "name": "previous_flags",
6001
+ "type": "u8"
6002
+ },
6003
+ {
6004
+ "name": "new_flags",
6005
+ "type": "u8"
6006
+ },
6007
+ {
6008
+ "name": "timestamp",
6009
+ "type": "i64"
6010
+ }
6011
+ ]
6012
+ }
6013
+ },
6014
+ {
6015
+ "name": "UserFeeOverrideSet",
6016
+ "type": {
6017
+ "kind": "struct",
6018
+ "fields": [
6019
+ {
6020
+ "name": "manager",
6021
+ "type": "pubkey"
6022
+ },
6023
+ {
6024
+ "name": "user",
6025
+ "type": "pubkey"
6026
+ },
6027
+ {
6028
+ "name": "bundle_account_key",
6029
+ "type": "pubkey"
6030
+ },
6031
+ {
6032
+ "name": "override_mask",
6033
+ "type": "u8"
6034
+ },
6035
+ {
6036
+ "name": "previous_flags",
6037
+ "type": "u8"
6038
+ },
6039
+ {
6040
+ "name": "new_flags",
6041
+ "type": "u8"
6042
+ },
6043
+ {
6044
+ "name": "custom_deposit_fee_bps",
6045
+ "type": "u32"
6046
+ },
6047
+ {
6048
+ "name": "custom_withdrawal_fee_bps",
6049
+ "type": "u32"
6050
+ },
6051
+ {
6052
+ "name": "custom_performance_fee_bps",
6053
+ "type": "u32"
6054
+ },
6055
+ {
6056
+ "name": "custom_management_fee_bps",
6057
+ "type": "u32"
6058
+ },
6059
+ {
6060
+ "name": "timestamp",
6061
+ "type": "i64"
6062
+ }
6063
+ ]
6064
+ }
6065
+ },
5787
6066
  {
5788
6067
  "name": "VaultNeutralFeeIncrementerSet",
5789
6068
  "type": {
@@ -144,6 +144,37 @@ interface Ntbundle {
144
144
  name: 'newManager';
145
145
  type: 'pubkey';
146
146
  }];
147
+ }, {
148
+ name: 'clearUserFeeOverride';
149
+ discriminator: [97, 227, 92, 191, 205, 0, 154, 77];
150
+ accounts: [{
151
+ name: 'manager';
152
+ writable: true;
153
+ signer: true;
154
+ }, {
155
+ name: 'userBundleAccountOwner';
156
+ }, {
157
+ name: 'userBundleAccount';
158
+ writable: true;
159
+ pda: {
160
+ seeds: [{
161
+ kind: 'const';
162
+ value: [85, 83, 69, 82, 95, 66, 85, 78, 68, 76, 69];
163
+ }, {
164
+ kind: 'account';
165
+ path: 'userBundleAccountOwner';
166
+ }, {
167
+ kind: 'account';
168
+ path: 'bundleAccount';
169
+ }];
170
+ };
171
+ }, {
172
+ name: 'bundleAccount';
173
+ }];
174
+ args: [{
175
+ name: 'clearMask';
176
+ type: 'u8';
177
+ }];
147
178
  }, {
148
179
  name: 'closeUserBundleAccount';
149
180
  discriminator: [201, 195, 126, 228, 9, 173, 79, 215];
@@ -1532,6 +1563,49 @@ interface Ntbundle {
1532
1563
  name: 'oracleUpdateTimeLimit';
1533
1564
  type: 'i64';
1534
1565
  }];
1566
+ }, {
1567
+ name: 'setUserFeeOverride';
1568
+ discriminator: [207, 40, 210, 198, 66, 33, 153, 209];
1569
+ accounts: [{
1570
+ name: 'manager';
1571
+ writable: true;
1572
+ signer: true;
1573
+ }, {
1574
+ name: 'userBundleAccountOwner';
1575
+ }, {
1576
+ name: 'userBundleAccount';
1577
+ writable: true;
1578
+ pda: {
1579
+ seeds: [{
1580
+ kind: 'const';
1581
+ value: [85, 83, 69, 82, 95, 66, 85, 78, 68, 76, 69];
1582
+ }, {
1583
+ kind: 'account';
1584
+ path: 'userBundleAccountOwner';
1585
+ }, {
1586
+ kind: 'account';
1587
+ path: 'bundleAccount';
1588
+ }];
1589
+ };
1590
+ }, {
1591
+ name: 'bundleAccount';
1592
+ }];
1593
+ args: [{
1594
+ name: 'overrideMask';
1595
+ type: 'u8';
1596
+ }, {
1597
+ name: 'customDepositFeeBps';
1598
+ type: 'u32';
1599
+ }, {
1600
+ name: 'customWithdrawalFeeBps';
1601
+ type: 'u32';
1602
+ }, {
1603
+ name: 'customPerformanceFeeBps';
1604
+ type: 'u32';
1605
+ }, {
1606
+ name: 'customManagementFeeBps';
1607
+ type: 'u32';
1608
+ }];
1535
1609
  }, {
1536
1610
  name: 'setWithdrawalRedemptionSchedule';
1537
1611
  discriminator: [134, 108, 237, 103, 185, 13, 177, 105];
@@ -1804,6 +1878,12 @@ interface Ntbundle {
1804
1878
  }, {
1805
1879
  name: 'userBundleAccountClosed';
1806
1880
  discriminator: [111, 102, 134, 54, 238, 23, 157, 183];
1881
+ }, {
1882
+ name: 'userFeeOverrideCleared';
1883
+ discriminator: [109, 200, 134, 162, 195, 197, 177, 189];
1884
+ }, {
1885
+ name: 'userFeeOverrideSet';
1886
+ discriminator: [194, 56, 240, 83, 158, 247, 78, 66];
1807
1887
  }, {
1808
1888
  name: 'vaultNeutralFeeIncrementerSet';
1809
1889
  discriminator: [7, 53, 169, 104, 118, 22, 134, 207];
@@ -2101,6 +2181,18 @@ interface Ntbundle {
2101
2181
  code: 6070;
2102
2182
  name: 'invalidWithdrawalRedemptionSchedule';
2103
2183
  msg: 'Invalid withdrawal redemption schedule';
2184
+ }, {
2185
+ code: 6071;
2186
+ name: 'invalidUserFeeConfig';
2187
+ msg: 'Invalid user fee configuration';
2188
+ }, {
2189
+ code: 6072;
2190
+ name: 'emptyUserFeeClearRequest';
2191
+ msg: 'Empty user fee clear request';
2192
+ }, {
2193
+ code: 6073;
2194
+ name: 'noUserFeeOverrideToClear';
2195
+ msg: 'No user fee override to clear';
2104
2196
  }];
2105
2197
  types: [{
2106
2198
  name: 'allocated';
@@ -2911,10 +3003,25 @@ interface Ntbundle {
2911
3003
  }, {
2912
3004
  name: 'totalFeeCharged';
2913
3005
  type: 'u64';
3006
+ }, {
3007
+ name: 'customDepositFeeBps';
3008
+ type: 'u32';
3009
+ }, {
3010
+ name: 'customWithdrawalFeeBps';
3011
+ type: 'u32';
3012
+ }, {
3013
+ name: 'customPerformanceFeeBps';
3014
+ type: 'u32';
3015
+ }, {
3016
+ name: 'customManagementFeeBps';
3017
+ type: 'u32';
3018
+ }, {
3019
+ name: 'feeOverrideFlags';
3020
+ type: 'u8';
2914
3021
  }, {
2915
3022
  name: 'padding';
2916
3023
  type: {
2917
- array: ['u8', 264];
3024
+ array: ['u8', 247];
2918
3025
  };
2919
3026
  }];
2920
3027
  };
@@ -2933,6 +3040,72 @@ interface Ntbundle {
2933
3040
  type: 'pubkey';
2934
3041
  }];
2935
3042
  };
3043
+ }, {
3044
+ name: 'userFeeOverrideCleared';
3045
+ type: {
3046
+ kind: 'struct';
3047
+ fields: [{
3048
+ name: 'manager';
3049
+ type: 'pubkey';
3050
+ }, {
3051
+ name: 'user';
3052
+ type: 'pubkey';
3053
+ }, {
3054
+ name: 'bundleAccountKey';
3055
+ type: 'pubkey';
3056
+ }, {
3057
+ name: 'clearMask';
3058
+ type: 'u8';
3059
+ }, {
3060
+ name: 'previousFlags';
3061
+ type: 'u8';
3062
+ }, {
3063
+ name: 'newFlags';
3064
+ type: 'u8';
3065
+ }, {
3066
+ name: 'timestamp';
3067
+ type: 'i64';
3068
+ }];
3069
+ };
3070
+ }, {
3071
+ name: 'userFeeOverrideSet';
3072
+ type: {
3073
+ kind: 'struct';
3074
+ fields: [{
3075
+ name: 'manager';
3076
+ type: 'pubkey';
3077
+ }, {
3078
+ name: 'user';
3079
+ type: 'pubkey';
3080
+ }, {
3081
+ name: 'bundleAccountKey';
3082
+ type: 'pubkey';
3083
+ }, {
3084
+ name: 'overrideMask';
3085
+ type: 'u8';
3086
+ }, {
3087
+ name: 'previousFlags';
3088
+ type: 'u8';
3089
+ }, {
3090
+ name: 'newFlags';
3091
+ type: 'u8';
3092
+ }, {
3093
+ name: 'customDepositFeeBps';
3094
+ type: 'u32';
3095
+ }, {
3096
+ name: 'customWithdrawalFeeBps';
3097
+ type: 'u32';
3098
+ }, {
3099
+ name: 'customPerformanceFeeBps';
3100
+ type: 'u32';
3101
+ }, {
3102
+ name: 'customManagementFeeBps';
3103
+ type: 'u32';
3104
+ }, {
3105
+ name: 'timestamp';
3106
+ type: 'i64';
3107
+ }];
3108
+ };
2936
3109
  }, {
2937
3110
  name: 'vaultNeutralFeeIncrementerSet';
2938
3111
  type: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neutral-trade/sdk",
3
3
  "type": "module",
4
- "version": "0.4.3",
4
+ "version": "0.4.5",
5
5
  "description": "SDK for Neutral Trade vaults",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/neutral-trade/sdk#readme",