@perena/vault-sdk 1.0.68 → 1.0.70

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
@@ -445,6 +445,7 @@ Use `client.quote.quote(...)` to calculate expected output amounts before
445
445
  building a transaction. Quotes fetch the current vault/tranche state and use the
446
446
  same fee formulas as the program. To quote a fee-exempt route, provide the same
447
447
  `addressSeeds`; owner allowlisting by itself does not make a quote fee-exempt.
448
+ Allowlisted wallets receive their exemption automatically without PDA seeds.
448
449
 
449
450
  All amounts are base units. `expectedAmountOut` is the net amount after fees;
450
451
  `grossAmountOut`, `feeAmount`, `feeBps`, and `feeExempt` explain the quote.
@@ -463,7 +464,7 @@ const depositQuote = await client.quote.quote({
463
464
  });
464
465
 
465
466
  console.log(depositQuote.expectedAmountOut); // regular shares to receive
466
- console.log(depositQuote.feeExempt); // false: no addressSeeds were supplied
467
+ console.log(depositQuote.feeExempt); // false for a non-allowlisted wallet
467
468
 
468
469
  const exemptDepositQuote = await client.quote.quote({
469
470
  shareClass: "regular",
@@ -490,6 +491,11 @@ console.log(withdrawQuote.expectedAmountOut); // asset tokens to receive
490
491
 
491
492
  ### Junior and senior tranches
492
493
 
494
+ Both tranche deposit types use the same vault `mintFeeBps` as regular deposits,
495
+ with fees accruing as pending curator shares. Quotes follow each path's integer
496
+ rounding: regular deposits deduct the fee from gross shares, while tranche
497
+ deposits deduct it from the deposit's accounting value before minting shares.
498
+
493
499
  ```typescript
494
500
  // Asset -> junior tranche shares
495
501
  const juniorDepositQuote = await client.quote.quote({
@@ -514,8 +520,9 @@ const seniorDepositQuote = await client.quote.quote({
514
520
 
515
521
  For junior withdrawals, pass `withdrawalMode: "instant"` to quote
516
522
  `executeTrancheWithdraw`, or `withdrawalMode: "queued"` to quote
517
- `fulfillJuniorTrancheWithdraw` after lockup. Senior withdrawals are already
518
- fee-free, but still support the same quote shape.
523
+ `fulfillJuniorTrancheWithdraw` after lockup. Senior withdrawals use the vault's
524
+ `burnFeeBps`, like regular withdrawals, and accrue the fee as pending curator
525
+ shares. The existing wallet and approved-PDA fee exemptions still apply.
519
526
 
520
527
  ```typescript
521
528
  // Junior tranche shares -> asset through instant withdrawal.
@@ -665,18 +672,30 @@ await client.sendTransaction(payer, plan);
665
672
 
666
673
  ### Example: async regular-share redemption
667
674
 
668
- Regular shares default to synchronous redemption. The curator can set
669
- `redemptionMode: { asyncOnly: {} }` through `setVaultConfig` (or restore
670
- `{ synchronous: {} }`). Configure `fulfiller` using the existing role timelock
671
- before processing requests. Async-only mode blocks direct regular withdrawals,
672
- including fee-exempt/external variants, and regular-to-tranche share swaps.
673
- Junior and senior tranche redemption policies are unchanged.
675
+ New vaults default to hybrid redemption for regular shares. The curator can
676
+ choose a `redemptionMode` through `setVaultConfig`:
677
+
678
+ | Mode | Immediate withdrawals and regular-to-tranche share swaps | New async requests |
679
+ | --- | --- | --- |
680
+ | `{ synchronous: {} }` | Allowed | Rejected |
681
+ | `{ asyncOnly: {} }` | Rejected | Allowed |
682
+ | `{ hybrid: {} }` (default) | Allowed | Allowed |
683
+
684
+ Hybrid mode lets users choose immediate withdrawal or queue a request on the
685
+ same vault without switching modes. Immediate withdrawals still require enough
686
+ available liquidity; they do not automatically create an async request on failure.
687
+ Existing vaults retain their configured mode until the curator changes it.
688
+ Configure `fulfiller` using the existing role timelock before processing requests.
689
+ Async-only mode also blocks fee-exempt and external regular withdrawals.
690
+ Junior and senior tranche redemption policies are unchanged. Upgrade the program
691
+ and SDK before setting hybrid mode; older SDKs cannot decode its new enum variant.
674
692
 
675
693
  ```typescript
676
694
  await client.sendTransaction(curator, await client.tx.setVaultConfig.getTx({
677
695
  curator: fromWeb3Pk(curator.publicKey),
678
696
  vault,
679
- redemptionMode: { asyncOnly: {} },
697
+ redemptionMode: { hybrid: {} },
698
+ redemptionPeriodSecs: 3_600n, // one hour for new async requests
680
699
  }));
681
700
 
682
701
  await client.sendTransaction(user, await client.tx.requestAsyncWithdraw.getTx({
@@ -707,7 +726,16 @@ await client.sendTransaction(fulfiller, await client.tx.fulfillAsyncWithdraw.get
707
726
  ```
708
727
 
709
728
  Requests escrow shares without changing supply or NAV. Only the configured
710
- fulfiller can settle regular requests, with no minimum settlement delay.
729
+ fulfiller can settle regular requests after their stored `expiryTs`.
730
+
731
+ The curator sets `redemptionPeriodSecs` through `setVaultConfig` (or the CLI's
732
+ `--redemption-period-secs` flag). It is a non-negative integer number of seconds;
733
+ `0` is the default and permits immediate settlement. Each new async request stores
734
+ `expiryTs = requestTs + redemptionPeriodSecs`. Later config changes affect only
735
+ new requests. Synchronous withdrawals in Hybrid mode remain immediate, and the
736
+ separate 30-day cancellation rule is unchanged. The field uses reserved account
737
+ space, so existing vaults retain their size and default to zero delay. Upgrade
738
+ the program before using this setting; older programs ignore the appended option.
711
739
  Unpriced requests use current NAV, asset prices, and burn fees. The HW manager
712
740
  can price a request once, recording `request.outputAmount` in output-token
713
741
  atomic units, `pricedTs`, and `feeShareAmount`. A positive `pricedTs` marks a
@@ -741,13 +769,22 @@ remain fulfillable after switching back to synchronous mode. Service snapshots
741
769
  include nullable `outputAmount` and `pricedTs`; fulfillment always refreshes
742
770
  the queue before building its instruction.
743
771
 
744
- Only the request owner can cancel a regular-share request, and only when chain
745
- time is **strictly more than 30 days** after `requestTs`, whether priced or
746
- unpriced. `cancelAsyncWithdraw.getTx({ user, vault, queueId })` recreates a
747
- missing owner share ATA, returns all escrow shares (including surplus), and
748
- refunds queue/escrow rent to the recorded payer without charging redemption fees.
749
- The legacy `cancelJuniorTrancheWithdraw` route enforces the same delay for
750
- regular shares; junior queue cancellation retains its existing behavior.
772
+ The keeper processes regular-share requests oldest-first by `requestTs` within
773
+ each vault, using PDA address to break same-second ties deterministically. The
774
+ `queueId` remains a reusable owner slot (0–255). An unfunded or not-yet-ready
775
+ request blocks later regular requests in that keeper run; the keeper logs
776
+ `skipped-no-liquidity` and continues with other vaults and junior queues. It uses
777
+ on-chain time for readiness. Ordering is a keeper policy: the program allows an
778
+ authorized fulfiller to settle any ready request directly.
779
+
780
+ Only the request owner can cancel, at any time **before the HW manager locks the
781
+ payout** (`pricedTs == 0`). A locked zero payout also cannot be cancelled. There
782
+ is no cancellation waiting period. `cancelAsyncWithdraw.getTx({ user, vault,
783
+ queueId })` recreates a missing owner share ATA, returns all escrow shares
784
+ (including surplus), and refunds queue/escrow rent to the recorded payer without
785
+ charging redemption fees. The legacy junior cancellation route enforces the
786
+ same payout lock for regular shares; junior cancellation keeps its existing
787
+ behavior. Requests are independent and need no neighbouring queue accounts.
751
788
 
752
789
  The curator console's **Redemptions** tab shows pending regular-share requests,
753
790
  their locked payouts and pricing timestamps, and owner cancellation eligibility.
@@ -756,15 +793,14 @@ uses the HW-manager wallet's `signAllTransactions` where supported. Each request
756
793
  is priced when its transaction executes; separate transactions are not a single
757
794
  atomic snapshot. Failed batches remain pending and can be refreshed and retried.
758
795
 
759
- The redemption mode occupies an existing zeroed vault padding byte, preserving
760
- account size and offsets. Pricing fields reuse three words of queue padding:
761
- existing queues decode as unpriced, and queue accounts remain 296 bytes including
762
- the discriminator. No account migration is needed. Deploy the updated program
763
- and publish a new SDK release, then update and rebuild the backend fulfiller
764
- with that release (including its package lock) before enabling manager pricing.
765
- SDK 1.0.67 predates the pricing fields and cannot reliably prepare liquidity
766
- accounts for a locked payout. Existing config payloads that omit the trailing
767
- mode option remain valid.
796
+ The redemption mode and redemption period reuse reserved vault space; pricing
797
+ fields reuse queue padding. Existing vault account sizes and prior field offsets
798
+ are unchanged, and queue accounts remain 296 bytes including the discriminator.
799
+ No FIFO state or account migration is needed.
800
+
801
+ Deploy the updated program and publish SDK 1.0.70, then update all consumers
802
+ before enabling regular-share async requests. Existing config payloads omitting
803
+ the trailing options remain valid.
768
804
 
769
805
  ### Example: junior withdrawal queue
770
806
 
package/dist/index.d.ts CHANGED
@@ -68,8 +68,6 @@ declare const MAX_PRICE_STALENESS_THRESHOLD_SECS: number;
68
68
  declare const DEFAULT_VAULT_ID = 0;
69
69
  declare const DEFAULT_MAX_ACCEPTABLE_APY_BPS = 10000;
70
70
  declare const DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS: number;
71
- /** Cancellation requires age strictly greater than this interval. */
72
- declare const ASYNC_REDEMPTION_CANCEL_DELAY_SECS: number;
73
71
  declare const DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS = 100;
74
72
  declare const DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS = 50;
75
73
  /** Mainnet USDC mint address. */
@@ -9445,7 +9443,8 @@ type Bankineco = {
9445
9443
  {
9446
9444
  "name": "redemptionMode";
9447
9445
  "docs": [
9448
- "Redemption policy for regular vault shares. Zero preserves existing vault behavior."
9446
+ "Redemption policy for regular vault shares. Zero preserves existing vault behavior.",
9447
+ "Numeric layout is part of the account and instruction formats; only append variants."
9449
9448
  ];
9450
9449
  "repr": {
9451
9450
  "kind": "rust";
@@ -9458,6 +9457,9 @@ type Bankineco = {
9458
9457
  },
9459
9458
  {
9460
9459
  "name": "asyncOnly";
9460
+ },
9461
+ {
9462
+ "name": "hybrid";
9461
9463
  }
9462
9464
  ];
9463
9465
  };
@@ -9934,6 +9936,15 @@ type Bankineco = {
9934
9936
  };
9935
9937
  };
9936
9938
  };
9939
+ },
9940
+ {
9941
+ "name": "redemptionPeriodSecs";
9942
+ "docs": [
9943
+ "Minimum delay in seconds for new regular-share async requests. Zero disables the delay."
9944
+ ];
9945
+ "type": {
9946
+ "option": "i64";
9947
+ };
9937
9948
  }
9938
9949
  ];
9939
9950
  };
@@ -10592,12 +10603,19 @@ type Bankineco = {
10592
10603
  ];
10593
10604
  "type": "u64";
10594
10605
  },
10606
+ {
10607
+ "name": "redemptionPeriodSecs";
10608
+ "docs": [
10609
+ "Minimum delay for new regular-share async withdrawals; zero allows immediate settlement."
10610
+ ];
10611
+ "type": "i64";
10612
+ },
10595
10613
  {
10596
10614
  "name": "padding3";
10597
10615
  "type": {
10598
10616
  "array": [
10599
10617
  "u64",
10600
- 21
10618
+ 20
10601
10619
  ];
10602
10620
  };
10603
10621
  }
@@ -12041,7 +12059,8 @@ type VaultQuoteArgs = (BaseQuoteArgs & {
12041
12059
  direction: "withdraw";
12042
12060
  /**
12043
12061
  * Junior withdrawals use the early fee for instant withdrawals and the
12044
- * standard fee for queued fulfillment. Senior withdrawals are fee-free.
12062
+ * standard fee for queued fulfillment. Senior withdrawals use the vault's
12063
+ * burn fee regardless of this option.
12045
12064
  */
12046
12065
  withdrawalMode?: JuniorWithdrawalMode;
12047
12066
  });
@@ -12453,6 +12472,8 @@ type RedemptionModeArgs = {
12453
12472
  synchronous: {};
12454
12473
  } | {
12455
12474
  asyncOnly: {};
12475
+ } | {
12476
+ hybrid: {};
12456
12477
  };
12457
12478
  interface SetVaultConfigIxArgs {
12458
12479
  curator: Address;
@@ -12472,6 +12493,7 @@ interface SetVaultConfigIxArgs {
12472
12493
  tvlLimit: BN | null;
12473
12494
  lossesEnabled: boolean | null;
12474
12495
  redemptionMode?: RedemptionModeArgs | null;
12496
+ redemptionPeriodSecs?: BN | null;
12475
12497
  priceStalenessThresholdSecs: BN | null;
12476
12498
  newCurator: Address | null;
12477
12499
  userBurnLimit: {
@@ -12489,8 +12511,10 @@ interface SetVaultConfigIxArgs {
12489
12511
  };
12490
12512
  }
12491
12513
  interface SetVaultConfigTxArgs {
12492
- /** Regular-share policy. Default on chain is synchronous; omit to leave unchanged. */
12514
+ /** Regular-share policy. New vaults default to hybrid; omit to leave unchanged. */
12493
12515
  redemptionMode?: RedemptionModeArgs;
12516
+ /** Minimum wait for new regular-share async withdrawals, in seconds. Zero disables it. */
12517
+ redemptionPeriodSecs?: bigint;
12494
12518
  curator: Address;
12495
12519
  vault: Address;
12496
12520
  vaultOracle?: Address;
@@ -13019,7 +13043,7 @@ interface SetExternalLiquidityTxArgs {
13019
13043
  userAccount: Address;
13020
13044
  lookupTables?: Address[];
13021
13045
  }
13022
- /** Escrow regular shares in an async-only vault. Burned at fulfillment, optionally priced earlier. */
13046
+ /** Escrow regular shares in an async-enabled vault. Burned at fulfillment, optionally priced earlier. */
13023
13047
  type RequestAsyncWithdrawIxArgs = Omit<RequestJuniorTrancheWithdrawIxArgs, "vaultTrancheState">;
13024
13048
  interface RequestAsyncWithdrawTxArgs extends Omit<RequestJuniorTrancheWithdrawTxArgs, "vaultTrancheState" | "juniorShareMint"> {
13025
13049
  shareMint?: Address;
@@ -14853,8 +14877,8 @@ onAccountValue?: (accountName: string, value: TrackedAccountValue) => void): Pro
14853
14877
  * and the `fulfill-junior-withdraw` CLI can all share one implementation.
14854
14878
  *
14855
14879
  * Requests escrow shares until fulfillment or cancellation. Junior queues become
14856
- * due after their lockup; regular queues are immediately eligible for the vault's
14857
- * configured fulfiller. Dispatch uses the input mint, including queues that remain
14880
+ * due after their lockup; regular queues settle oldest-first after their notice
14881
+ * period through the vault's configured fulfiller. Dispatch uses the input mint, including queues that remain
14858
14882
  * pending after a vault switches back to synchronous redemption.
14859
14883
  */
14860
14884
 
@@ -14881,6 +14905,8 @@ interface WithdrawalQueueSnapshot {
14881
14905
  interface FulfillSummary {
14882
14906
  fulfilled: number;
14883
14907
  skippedNotDue: number;
14908
+ skippedBlocked: number;
14909
+ skippedNoLiquidity: number;
14884
14910
  failed: number;
14885
14911
  signatures: string[];
14886
14912
  }
@@ -14907,8 +14933,8 @@ declare class WithdrawalQueueService {
14907
14933
  */
14908
14934
  fulfill(signer: Keypair, queue: WithdrawalQueueSnapshot): Promise<string>;
14909
14935
  /**
14910
- * Fulfill every due queue, optionally scoped to a single vault. Non-fatal:
14911
- * a failure on one queue is logged and the rest still run.
14936
+ * Fulfill regular queues oldest-first by request timestamp. An older pending
14937
+ * request blocks later regular requests; junior queues and other vaults continue.
14912
14938
  */
14913
14939
  fulfillAllDue(signer: Keypair, opts?: {
14914
14940
  vault?: Address;
@@ -14956,6 +14982,23 @@ interface NavCrankResult {
14956
14982
  reason?: string;
14957
14983
  readiness: NavCrankReadiness;
14958
14984
  }
14985
+ interface ConsensusAssetUpdateArgs {
14986
+ vault: Address;
14987
+ updates: {
14988
+ holdingIndex: number;
14989
+ mint?: Address;
14990
+ price: bigint;
14991
+ externalAmount: bigint;
14992
+ }[];
14993
+ assetMint?: Address;
14994
+ assetTokenProgram?: Address;
14995
+ }
14996
+ interface ConsensusOraclePublicationResult {
14997
+ updateSignature: string;
14998
+ /** The same signature as updateSignature when NAV was settled atomically. */
14999
+ crankSignature?: string;
15000
+ crankSkippedReason?: string;
15001
+ }
14959
15002
  /** A holding to refresh via `update_asset_price` (Pyth / nested-vault priced). */
14960
15003
  interface AssetPriceRefreshTarget {
14961
15004
  mint: Address;
@@ -14977,17 +15020,14 @@ declare class OracleService {
14977
15020
  * update only to register a new consensus holding (pass `assetMint` too). NAV is
14978
15021
  * NOT settled here — call {@link crankNav} afterward.
14979
15022
  */
14980
- updateAssetConsensusPrice(signer: Keypair, args: {
14981
- vault: Address;
14982
- updates: {
14983
- holdingIndex: number;
14984
- mint?: Address;
14985
- price: bigint;
14986
- externalAmount: bigint;
14987
- }[];
14988
- assetMint?: Address;
14989
- assetTokenProgram?: Address;
14990
- }, log?: LogFn$3): Promise<string>;
15023
+ updateAssetConsensusPrice(signer: Keypair, args: ConsensusAssetUpdateArgs, log?: LogFn$3): Promise<string>;
15024
+ /**
15025
+ * Simulate the update followed by NAV settlement in one transaction. If the
15026
+ * combined plan cannot be built or simulated successfully, publish only the
15027
+ * report. The caller must first verify that the report will reach consensus;
15028
+ * a successful crank alone can still settle unchanged holdings.
15029
+ */
15030
+ updateAssetConsensusPriceAndCrankNavIfReady(signer: Keypair, args: ConsensusAssetUpdateArgs, log?: LogFn$3, beforeSubmit?: () => Promise<void>): Promise<ConsensusOraclePublicationResult>;
14991
15031
  /** Settle the vault NAV from its current holdings (permissionless). */
14992
15032
  crankNav(cranker: Keypair, args: {
14993
15033
  vault: Address;
@@ -15205,7 +15245,7 @@ interface VaultOracleResult {
15205
15245
  settlementSimulationError?: string;
15206
15246
  /** `update_consensus_oracle` signature (absent on dry runs / no holdings). */
15207
15247
  updateSignature?: string;
15208
- /** `crank_nav` signature (absent on dry runs / no holdings / skipped crank). */
15248
+ /** Same as updateSignature when bundled; absent on dry runs / skipped crank. */
15209
15249
  crankSignature?: string;
15210
15250
  /** Reason `crank_nav` was skipped after a successful oracle update. */
15211
15251
  crankSkippedReason?: string;
@@ -15655,14 +15695,10 @@ declare function fetchExternalPositions(deps: ConsensusOracleDeps, target: Conse
15655
15695
  declare function fetchReceiptMints(client: VaultClient, vault: Address, vaultState: DecodedVault): Promise<Set<string>>;
15656
15696
 
15657
15697
  /**
15658
- * Settlement step: push the consensus report for all holdings, then crank NAV.
15698
+ * Settlement step: publish the report and, when ready, settle NAV atomically.
15659
15699
  */
15660
15700
 
15661
- interface SettleVaultResult {
15662
- updateSignature: string;
15663
- crankSignature?: string;
15664
- crankSkippedReason?: string;
15665
- }
15701
+ type SettleVaultResult = ConsensusOraclePublicationResult;
15666
15702
  interface SettleVaultParams {
15667
15703
  client: VaultClient;
15668
15704
  oracle: OracleService;
@@ -15676,7 +15712,7 @@ interface SettleVaultParams {
15676
15712
  /** Revalidate a wallet attribution after projections and before publication. */
15677
15713
  beforeSubmit?: () => Promise<void>;
15678
15714
  }
15679
- /** Push the consensus report for all holdings, then settle NAV. */
15715
+ /** Publish only the report unless consensus and the combined crank can pass. */
15680
15716
  declare function settleVault({ client, oracle, yieldTracker, signer, target, updates, vaultState, nowSecs, log, beforeSubmit, }: SettleVaultParams): Promise<SettleVaultResult>;
15681
15717
  interface LogProspectiveApyParams {
15682
15718
  client: VaultClient;
@@ -16005,7 +16041,7 @@ declare class MockYieldTracker implements YieldTracker {
16005
16041
  }
16006
16042
 
16007
16043
  /**
16008
- * Pure dry-run simulator for the two transactions emitted by the consensus
16044
+ * Pure dry-run simulator for the two instructions emitted by the consensus
16009
16045
  * oracle service:
16010
16046
  *
16011
16047
  * 1. `update_consensus_oracle` overlays this signer's report and averages all
@@ -16516,4 +16552,4 @@ declare function collectVaultLookupTableAccounts(client: VaultClient, vault: Add
16516
16552
  extraAccounts?: Address[];
16517
16553
  }): Promise<Address[]>;
16518
16554
 
16519
- export { ASSET_DECIMALS, ASSET_REBALANCE_COOLDOWN_SECS, ASYNC_REDEMPTION_CANCEL_DELAY_SECS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AddAprCashflowUpdateParams, type AddCashflowUpdateParams, type AddIncentiveRecipientArgs, AddIncentiveRecipientBuilder, type AddIncentiveRecipientIxArgs, AddIncentiveRecipientV3Builder, type AddIncentiveRecipientV3IxArgs, type AddIncentiveRecipientV3TxArgs, type AddNavCashflowUpdateParams, type AprAccountBalanceResponse, type AprAccountYieldResponse, type AssetPriceOracleConfigIxArgs, type AssetPriceOracleConfigTxArgs, type AssetPriceRefreshTarget, type AssetRefreshResult, type AssetType, BALANCE_CHANGE_BASELINE_MAX_AGE_SECS, type Bankineco, type BasicAuthCredentials, type Bigintish, type BuildMarginfiWithdrawInteractionArgs, CONSENSUS_ORACLE_VARIANT, CancelAsyncWithdrawBuilder, type CancelAsyncWithdrawIxArgs, type CancelAsyncWithdrawTxArgs, type CancelIncentiveProposalArgs, CancelIncentiveProposalBuilder, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, ClaimIncentiveBuilder, type ClaimIncentiveIxArgs, type ClaimIncentiveTxArgs, ClaimIncentiveV3Builder, type ClaimIncentiveV3IxArgs, type ClaimIncentiveV3TxArgs, type Clock, type CollectSamplesOptions, type ConsensusAssetUpdate, type ConsensusHoldingEntry, type ConsensusHoldingSimulation, type ConsensusOracleDeps, type ConsensusOracleHoldingConfig, ConsensusOracleService, type ConsensusOracleTarget, CrankNavBuilder, type CrankNavIxArgs, type CrankNavTxArgs, CrankPerformanceFeesBuilder, type CrankPerformanceFeesIxArgs, type CrankPerformanceFeesTxArgs, type CreateAccountParams, CreateAssetHoldingBuilder, type CreateAssetHoldingIxArgs, type CreateAssetHoldingTxArgs, CreateIncentiveBuilder, type CreateIncentiveIxArgs, type CreateIncentiveTxArgs, CreateIncentiveV3Builder, type CreateIncentiveV3IxArgs, type CreateIncentiveV3TxArgs, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_CU_PRICE_MICRO_LAMPORTS, DEFAULT_EXTERNAL_WEIGHT_BAND_BPS, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MARGINFI_WEIGHT_BPS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_MINTS, DEFAULT_MIN_AMOUNT_UI, DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS, DEFAULT_PRICE_ORACLE_ACCOUNT, DEFAULT_PRICE_STALENESS_SECS, DEFAULT_PRICE_STALENESS_THRESHOLD_SECS, DEFAULT_REBALANCE_BAND_BPS, DEFAULT_SLIPPAGE_BPS, DEFAULT_TARGET_LOCAL_BPS, DEFAULT_TARGET_LOCAL_USDC_TVL_BPS, DEFAULT_VAULT_ID, type DecodedHolding, type DecodedVault, type DecodedVaultTrancheState, type DeleteAccountParams, DepositCuratorFeesBuilder, type DepositCuratorFeesIxArgs, type DepositCuratorFeesTxArgs, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, DistributeIncentiveBuilder, type DistributeIncentiveIxArgs, type DistributeIncentiveTxArgs, DistributeIncentiveV3Builder, type DistributeIncentiveV3IxArgs, type DistributeIncentiveV3TxArgs, EXTERNAL_POSITION_SAMPLES, type EvmCallArg, type EvmContractCall, type EvmContractNavPriceConfig, ExecuteDepositBuilder, type ExecuteDepositIxArgs, type ExecuteDepositTxArgs, ExecuteShareSwapBuilder, type ExecuteShareSwapIxArgs, type ExecuteShareSwapTxArgs, ExecuteTrancheDepositBuilder, type ExecuteTrancheDepositIxArgs, type ExecuteTrancheDepositTxArgs, ExecuteTrancheWithdrawBuilder, type ExecuteTrancheWithdrawIxArgs, type ExecuteTrancheWithdrawTxArgs, ExecuteWithdrawBuilder, type ExecuteWithdrawIxArgs, type ExecuteWithdrawTxArgs, type ExternalLiquidityIntegrityOptions, type ExternalLiquidityIntegrityResult, ExternalLiquidityIntegrityService, type ExternalLiquidityIntegritySummary, type ExternalLiquiditySlot, type ExternalLiquiditySourceArgs, type ExternalPosition, type ExternalPositionContext, type ExternalPositionProvider, type ExternalPositionRef, ExternalPositionRegistry, FEE_VAULT_CACHE_CATEGORY, type FeeVaultAccountData, type FetchNestTokenPriceOptions, FulfillAsyncWithdrawBuilder, type FulfillAsyncWithdrawIxArgs, type FulfillAsyncWithdrawTxArgs, FulfillJuniorTrancheWithdrawBuilder, type FulfillJuniorTrancheWithdrawIxArgs, type FulfillJuniorTrancheWithdrawTxArgs, type FulfillSummary, type HoldingNavContribution, type HoldingUpdatePreview, type HttpJsonNavPriceConfig, IDL, IDLE_RESERVE_FLOOR_BPS, IDLE_RESERVE_TARGET_BPS, type IdleLiquidityOptions, type IdleLiquidityResult, IdleLiquidityService, type IdleLiquidityStatus, type IncentiveRecipient, type IncentiveTotals, type IncentiveUsdUpdateArgs, type IncentiveV3OracleState, type IncentiveV3Recipient, type IncentiveV3Totals, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoLendPositionProvider, KaminoPositionProvider, LIVE_ORACLE_VARIANTS, LIVE_PRICE_REFRESH_INTERVAL_SECS, LOCAL_PROTOCOL_ADMIN, LargeBalanceChangeError, type LargeBalanceChangeViolation, type LiveConsensusOracleDepsOptions, LivePriceSource, type LivePriceSourceOptions, MANAGER_WALLET_NAV_DROP_TRIGGER_BPS, MANAGER_WALLET_NAV_TOLERANCE_BPS, MAX_APY_ANCHOR_WINDOW_SECS, MAX_APY_PREVIOUS_ANCHOR_AGE_SECS, MAX_BALANCE_CHANGE_BPS, MAX_CONSENSUS_SIGNERS, MAX_INCENTIVE_RECIPIENTS, MAX_INCENTIVE_REPORT_TTL, MAX_LUT_ADDRESSES, MAX_MANAGER_WITHDRAW_DESTINATIONS, MAX_ORACLE_IMPLIED_APY_BPS, MAX_PRICE_STALENESS_THRESHOLD_SECS, MIN_EXTERNAL_POSITION_SAMPLES, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, type ManagerWalletBalanceSource, type ManagerWalletReconciliation, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MaxApyAnchorSnapshot, type MintConfig, type MintIdentifier, type MintInfo, MintRegistry, type MintRegistryOptions, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, type MpcWalletBalanceSource, type MpcWalletBalances, type MpcWalletConfig, NEST_API_BASE_URL, NEST_RWA_SHARE_MINT, NEST_VAULT_SLUG, NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS, type NavAccountBalanceResponse, type NavAccountValueResponse, type NavCrankBlocker, type NavCrankBlockerReason, type NavCrankReadiness, type NavCrankResult, type NavPriceConfig, type NavPricePreview, type NavPriceProvenance, type NavYieldAccount, NestApiError, type NestApiOptions, type NestDepositPlan, NestPriceSource, type NestPriceSourceOptions, type NestRedemptionQuote, type NestRedemptionStatus, ORACLE_ENTRIES_OFFSET, ORACLE_ENTRY_SIZE, ORACLE_SETTLED_NAV_TS_OFFSET, OracleService, PRICE_ORACLE_TYPES_BY_INDEX, PROGRAM_FEE_EXEMPT_OWNER_WHITELIST, PROTOCOL_ADMIN, PROTOCOL_FEE_RECIPIENT, PST_TO_USDC_MAX_SLIPPAGE_BPS, PdaClient, type PendingConsensusSignerSet, type PreparedDirectTransaction, type PreparedSquadsTransaction, type PreparedVaultTransaction, type PreviewNavPriceParams, PriceAsyncWithdrawBuilder, type PriceAsyncWithdrawIxArgs, type PriceAsyncWithdrawTxArgs, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS, REPORTABLE_ORACLE_VARIANTS, type RealizedApySimulation, type RedemptionModeArgs, type RefreshLiveOraclePricesParams, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, ReportIncentiveV3Builder, type ReportIncentiveV3IxArgs, type ReportIncentiveV3TxArgs, RequestAsyncWithdrawBuilder, type RequestAsyncWithdrawIxArgs, type RequestAsyncWithdrawTxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type ResolveExternalWithdrawArgs, type ResolvedExternalWithdraw, type ResolvedSquadsWalletRoute, type RollingLimitConfig, type RollingRebalanceLimitConfig, RpcManagerWalletBalanceSource, RpcMpcWalletBalanceSource, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SYSTEM_PROGRAM, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, type SetIncentiveLimitsArgs, SetIncentiveLimitsBuilder, type SetIncentiveLimitsV3Args, SetIncentiveLimitsV3Builder, SetManagerWithdrawDestinationBuilder, type SetManagerWithdrawDestinationIxArgs, type SetManagerWithdrawDestinationTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, SettleIncentiveV3Builder, type SettleIncentiveV3IxArgs, type SettleIncentiveV3TxArgs, type SettleVaultParams, type SettleVaultResult, type SettlementSimulation, type SettlementSimulationSnapshot, type SimulateDryRunSettlementParams, type SimulateSettlementArgs, type SimulatedShareClass, SquadsProposalExecutionSimulationError, type SquadsProposalUpload, type SquadsWalletRouteConfig, type StaleBalanceChangeBypass, StaticPositionProvider, SubmitIncentiveBuilder, type SubmitIncentiveIxArgs, type SubmitIncentiveTxArgs, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, type TimelockSettlementKind, type TimelockSettlementOptions, type TimelockSettlementRecord, TimelockSettlementService, type TimelockSettlementSummary, type TrackedAccountValue, type TrancheKindArgs, type TransactionBuilder, TransactionClient, USDC_MINT, USD_STAR_JUNIOR_MINT, USD_STAR_MINT, USD_STAR_PRINCIPAL_MINT, type UpdateAccountParams, UpdateAssetPriceBuilder, type UpdateAssetPriceIxArgs, type UpdateAssetPriceTxArgs, UpdateConsensusOracleBuilder, type UpdateConsensusOracleIxArgs, type UpdateConsensusOracleTxArgs, UpdateConsensusSignersBuilder, type UpdateConsensusSignersIxArgs, type UpdateConsensusSignersTxArgs, type UpdateDynamicAprParams, UpdateTrancheConfigBuilder, type UpdateTrancheConfigIxArgs, type UpdateTrancheConfigTxArgs, VAULT_CACHE_CATEGORY, VAULT_CREATOR_WHITELIST, VAULT_ENVIRONMENTS, VAULT_LOOKUP_TABLES, VAULT_ORACLE_CACHE_CATEGORY, VAULT_PROGRAM_ID, VAULT_PROGRAM_IDS, VAULT_PROGRAM_PUBLIC_KEY, VAULT_ROLE_UPDATE_TIMELOCK_SECS, VAULT_TRANCHE_STATE_CACHE_CATEGORY, VAULT_TRANCHE_WITHDRAWAL_QUEUE_CACHE_CATEGORY, type Vault, type VaultAccountData, VaultBuilderBase, type VaultBuilderContext, type VaultCacheInvalidation, VaultClient, type VaultClientBundle, type VaultEnv, type VaultIncentiveAccount, type VaultIncentiveAccountData, type VaultIncentiveV3Account, type VaultIncentiveV3AccountData, type VaultLookupTableMap, VaultLutManager, type VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, type VaultWithdrawalQueueAccount, type VaultWithdrawalQueueAccountData, WALLET_FEE_EXEMPT_WHITELIST, WITHDRAWABLE_RESERVE_FLOOR_BPS, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, type WithdrawalLeg, type WithdrawalPlan, type WithdrawalPricing, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldCashflow, type YieldPaymentResponse, type YieldPaymentSnapshot, type YieldTracker, type YieldValuationModel, accountingUnitPriceToUsd, addCashflowUpdate, applyEffectiveApy, assertNoLargeBalanceChanges, assertNoUnconfirmedYieldPayments, assertOracleImpliedApy, assertReconciliationExternalValues, buildHoldingUpdate, buildKaminoDepositInteraction, buildKaminoWithdrawInteraction, buildMarginfiWithdrawInteraction, buildNestDepositRequest, buildNestWithdrawalRequest, buildUpdates, candidateGrossNav, coerceBool, collectSamples, collectVaultLookupTableAccounts, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, decodeNestDepositRequest, decodeNestWithdrawalRequest, decodePendingConsensusSigners, defaultKeypairPath, deleteAccount, discoverVaultsForSigner, externalWithdrawComputeBudget, externalWithdrawLookupTables, fetchExternalPositions, fetchNestRedemptionQuote, fetchNestRedemptionStatus, fetchNestTokenPrice, fetchReceiptMints, filterTargetHoldings, findLargeBalanceChanges, findSquadsWalletRoute, formatSettlementSimulation, fromUiAmount, gatherPricingInputs, getAccount, getAccounts, getAprYield, getBalance, getCashflows, getIncentiveRecipientShareAtas, getIncentiveRecipients, getIncentiveReportRecipients, getIncentiveTotals, getIncentiveV3OracleState, getIncentiveV3RecipientShareAtas, getIncentiveV3Recipients, getIncentiveV3Totals, getNavValue, getRpcUrl, getTotalOutstandingYield, getTotalTrackedValue, getTotalYield, getTrackedValue, getVaultLookupTables, getVaultProgramId, getYield, getYieldPayments, indexConfigByMint, isEvmNavPriceConfig, isNavAccountBalance, isNavAccountValue, isNavYieldAccount, isVaultEnv, keypairAddress, loadKaminoDeposit, loadKaminoWithdrawal, loadKeypair, logProspectiveApy, makeProvider, managerReconciliationStateKey, mintTokensTo, mints, mostFrequent, parseExternalLiquidityRefs, planExternalAllocation, planRebalance, planWithdrawalLegs, prepareSquadsProposalUpload, prepareVaultTransaction, previewNavPrice, previousPhysicalNav, priceInAccountingUnit, publishedConsensusBlockers, quoteWithdrawalPayout, readI64LE, readSplMintSupply, reconcileManagerWalletBalances, reconciliationExternalValues, refreshLiveOraclePrices, resolveExternalWithdraw, resolveKeypairPath, resolveSquadsWalletRoute, resolveTrackedAmounts, resolveWithdrawalPlan, roundToNextUtcMidnight, runLiveConsensusOracle, selectReportableHoldings, settleVault, signerInOracleData, simulateConsensusOracleSettlement, simulateDryRunSettlement, simulateOraclePublication, simulateSquadsProposalExecution, sumPositionsByMint, systemClock, toBigInt, toUiAmount, toWeb3AccountMeta, trackedValueFromResponse, uniqueLutAddresses, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, variantName, vaultAuthorityForWallet, walletReconciliationGuardUpdates, withDiscoveredYieldAccounts, withVaultLookupTables, withdrawalComputeBudget };
16555
+ export { ASSET_DECIMALS, ASSET_REBALANCE_COOLDOWN_SECS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AddAprCashflowUpdateParams, type AddCashflowUpdateParams, type AddIncentiveRecipientArgs, AddIncentiveRecipientBuilder, type AddIncentiveRecipientIxArgs, AddIncentiveRecipientV3Builder, type AddIncentiveRecipientV3IxArgs, type AddIncentiveRecipientV3TxArgs, type AddNavCashflowUpdateParams, type AprAccountBalanceResponse, type AprAccountYieldResponse, type AssetPriceOracleConfigIxArgs, type AssetPriceOracleConfigTxArgs, type AssetPriceRefreshTarget, type AssetRefreshResult, type AssetType, BALANCE_CHANGE_BASELINE_MAX_AGE_SECS, type Bankineco, type BasicAuthCredentials, type Bigintish, type BuildMarginfiWithdrawInteractionArgs, CONSENSUS_ORACLE_VARIANT, CancelAsyncWithdrawBuilder, type CancelAsyncWithdrawIxArgs, type CancelAsyncWithdrawTxArgs, type CancelIncentiveProposalArgs, CancelIncentiveProposalBuilder, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, ClaimIncentiveBuilder, type ClaimIncentiveIxArgs, type ClaimIncentiveTxArgs, ClaimIncentiveV3Builder, type ClaimIncentiveV3IxArgs, type ClaimIncentiveV3TxArgs, type Clock, type CollectSamplesOptions, type ConsensusAssetUpdate, type ConsensusAssetUpdateArgs, type ConsensusHoldingEntry, type ConsensusHoldingSimulation, type ConsensusOracleDeps, type ConsensusOracleHoldingConfig, type ConsensusOraclePublicationResult, ConsensusOracleService, type ConsensusOracleTarget, CrankNavBuilder, type CrankNavIxArgs, type CrankNavTxArgs, CrankPerformanceFeesBuilder, type CrankPerformanceFeesIxArgs, type CrankPerformanceFeesTxArgs, type CreateAccountParams, CreateAssetHoldingBuilder, type CreateAssetHoldingIxArgs, type CreateAssetHoldingTxArgs, CreateIncentiveBuilder, type CreateIncentiveIxArgs, type CreateIncentiveTxArgs, CreateIncentiveV3Builder, type CreateIncentiveV3IxArgs, type CreateIncentiveV3TxArgs, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_CU_PRICE_MICRO_LAMPORTS, DEFAULT_EXTERNAL_WEIGHT_BAND_BPS, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MARGINFI_WEIGHT_BPS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_MINTS, DEFAULT_MIN_AMOUNT_UI, DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS, DEFAULT_PRICE_ORACLE_ACCOUNT, DEFAULT_PRICE_STALENESS_SECS, DEFAULT_PRICE_STALENESS_THRESHOLD_SECS, DEFAULT_REBALANCE_BAND_BPS, DEFAULT_SLIPPAGE_BPS, DEFAULT_TARGET_LOCAL_BPS, DEFAULT_TARGET_LOCAL_USDC_TVL_BPS, DEFAULT_VAULT_ID, type DecodedHolding, type DecodedVault, type DecodedVaultTrancheState, type DeleteAccountParams, DepositCuratorFeesBuilder, type DepositCuratorFeesIxArgs, type DepositCuratorFeesTxArgs, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, DistributeIncentiveBuilder, type DistributeIncentiveIxArgs, type DistributeIncentiveTxArgs, DistributeIncentiveV3Builder, type DistributeIncentiveV3IxArgs, type DistributeIncentiveV3TxArgs, EXTERNAL_POSITION_SAMPLES, type EvmCallArg, type EvmContractCall, type EvmContractNavPriceConfig, ExecuteDepositBuilder, type ExecuteDepositIxArgs, type ExecuteDepositTxArgs, ExecuteShareSwapBuilder, type ExecuteShareSwapIxArgs, type ExecuteShareSwapTxArgs, ExecuteTrancheDepositBuilder, type ExecuteTrancheDepositIxArgs, type ExecuteTrancheDepositTxArgs, ExecuteTrancheWithdrawBuilder, type ExecuteTrancheWithdrawIxArgs, type ExecuteTrancheWithdrawTxArgs, ExecuteWithdrawBuilder, type ExecuteWithdrawIxArgs, type ExecuteWithdrawTxArgs, type ExternalLiquidityIntegrityOptions, type ExternalLiquidityIntegrityResult, ExternalLiquidityIntegrityService, type ExternalLiquidityIntegritySummary, type ExternalLiquiditySlot, type ExternalLiquiditySourceArgs, type ExternalPosition, type ExternalPositionContext, type ExternalPositionProvider, type ExternalPositionRef, ExternalPositionRegistry, FEE_VAULT_CACHE_CATEGORY, type FeeVaultAccountData, type FetchNestTokenPriceOptions, FulfillAsyncWithdrawBuilder, type FulfillAsyncWithdrawIxArgs, type FulfillAsyncWithdrawTxArgs, FulfillJuniorTrancheWithdrawBuilder, type FulfillJuniorTrancheWithdrawIxArgs, type FulfillJuniorTrancheWithdrawTxArgs, type FulfillSummary, type HoldingNavContribution, type HoldingUpdatePreview, type HttpJsonNavPriceConfig, IDL, IDLE_RESERVE_FLOOR_BPS, IDLE_RESERVE_TARGET_BPS, type IdleLiquidityOptions, type IdleLiquidityResult, IdleLiquidityService, type IdleLiquidityStatus, type IncentiveRecipient, type IncentiveTotals, type IncentiveUsdUpdateArgs, type IncentiveV3OracleState, type IncentiveV3Recipient, type IncentiveV3Totals, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoLendPositionProvider, KaminoPositionProvider, LIVE_ORACLE_VARIANTS, LIVE_PRICE_REFRESH_INTERVAL_SECS, LOCAL_PROTOCOL_ADMIN, LargeBalanceChangeError, type LargeBalanceChangeViolation, type LiveConsensusOracleDepsOptions, LivePriceSource, type LivePriceSourceOptions, MANAGER_WALLET_NAV_DROP_TRIGGER_BPS, MANAGER_WALLET_NAV_TOLERANCE_BPS, MAX_APY_ANCHOR_WINDOW_SECS, MAX_APY_PREVIOUS_ANCHOR_AGE_SECS, MAX_BALANCE_CHANGE_BPS, MAX_CONSENSUS_SIGNERS, MAX_INCENTIVE_RECIPIENTS, MAX_INCENTIVE_REPORT_TTL, MAX_LUT_ADDRESSES, MAX_MANAGER_WITHDRAW_DESTINATIONS, MAX_ORACLE_IMPLIED_APY_BPS, MAX_PRICE_STALENESS_THRESHOLD_SECS, MIN_EXTERNAL_POSITION_SAMPLES, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, type ManagerWalletBalanceSource, type ManagerWalletReconciliation, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MaxApyAnchorSnapshot, type MintConfig, type MintIdentifier, type MintInfo, MintRegistry, type MintRegistryOptions, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, type MpcWalletBalanceSource, type MpcWalletBalances, type MpcWalletConfig, NEST_API_BASE_URL, NEST_RWA_SHARE_MINT, NEST_VAULT_SLUG, NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS, type NavAccountBalanceResponse, type NavAccountValueResponse, type NavCrankBlocker, type NavCrankBlockerReason, type NavCrankReadiness, type NavCrankResult, type NavPriceConfig, type NavPricePreview, type NavPriceProvenance, type NavYieldAccount, NestApiError, type NestApiOptions, type NestDepositPlan, NestPriceSource, type NestPriceSourceOptions, type NestRedemptionQuote, type NestRedemptionStatus, ORACLE_ENTRIES_OFFSET, ORACLE_ENTRY_SIZE, ORACLE_SETTLED_NAV_TS_OFFSET, OracleService, PRICE_ORACLE_TYPES_BY_INDEX, PROGRAM_FEE_EXEMPT_OWNER_WHITELIST, PROTOCOL_ADMIN, PROTOCOL_FEE_RECIPIENT, PST_TO_USDC_MAX_SLIPPAGE_BPS, PdaClient, type PendingConsensusSignerSet, type PreparedDirectTransaction, type PreparedSquadsTransaction, type PreparedVaultTransaction, type PreviewNavPriceParams, PriceAsyncWithdrawBuilder, type PriceAsyncWithdrawIxArgs, type PriceAsyncWithdrawTxArgs, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS, REPORTABLE_ORACLE_VARIANTS, type RealizedApySimulation, type RedemptionModeArgs, type RefreshLiveOraclePricesParams, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, ReportIncentiveV3Builder, type ReportIncentiveV3IxArgs, type ReportIncentiveV3TxArgs, RequestAsyncWithdrawBuilder, type RequestAsyncWithdrawIxArgs, type RequestAsyncWithdrawTxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type ResolveExternalWithdrawArgs, type ResolvedExternalWithdraw, type ResolvedSquadsWalletRoute, type RollingLimitConfig, type RollingRebalanceLimitConfig, RpcManagerWalletBalanceSource, RpcMpcWalletBalanceSource, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SYSTEM_PROGRAM, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, type SetIncentiveLimitsArgs, SetIncentiveLimitsBuilder, type SetIncentiveLimitsV3Args, SetIncentiveLimitsV3Builder, SetManagerWithdrawDestinationBuilder, type SetManagerWithdrawDestinationIxArgs, type SetManagerWithdrawDestinationTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, SettleIncentiveV3Builder, type SettleIncentiveV3IxArgs, type SettleIncentiveV3TxArgs, type SettleVaultParams, type SettleVaultResult, type SettlementSimulation, type SettlementSimulationSnapshot, type SimulateDryRunSettlementParams, type SimulateSettlementArgs, type SimulatedShareClass, SquadsProposalExecutionSimulationError, type SquadsProposalUpload, type SquadsWalletRouteConfig, type StaleBalanceChangeBypass, StaticPositionProvider, SubmitIncentiveBuilder, type SubmitIncentiveIxArgs, type SubmitIncentiveTxArgs, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, type TimelockSettlementKind, type TimelockSettlementOptions, type TimelockSettlementRecord, TimelockSettlementService, type TimelockSettlementSummary, type TrackedAccountValue, type TrancheKindArgs, type TransactionBuilder, TransactionClient, USDC_MINT, USD_STAR_JUNIOR_MINT, USD_STAR_MINT, USD_STAR_PRINCIPAL_MINT, type UpdateAccountParams, UpdateAssetPriceBuilder, type UpdateAssetPriceIxArgs, type UpdateAssetPriceTxArgs, UpdateConsensusOracleBuilder, type UpdateConsensusOracleIxArgs, type UpdateConsensusOracleTxArgs, UpdateConsensusSignersBuilder, type UpdateConsensusSignersIxArgs, type UpdateConsensusSignersTxArgs, type UpdateDynamicAprParams, UpdateTrancheConfigBuilder, type UpdateTrancheConfigIxArgs, type UpdateTrancheConfigTxArgs, VAULT_CACHE_CATEGORY, VAULT_CREATOR_WHITELIST, VAULT_ENVIRONMENTS, VAULT_LOOKUP_TABLES, VAULT_ORACLE_CACHE_CATEGORY, VAULT_PROGRAM_ID, VAULT_PROGRAM_IDS, VAULT_PROGRAM_PUBLIC_KEY, VAULT_ROLE_UPDATE_TIMELOCK_SECS, VAULT_TRANCHE_STATE_CACHE_CATEGORY, VAULT_TRANCHE_WITHDRAWAL_QUEUE_CACHE_CATEGORY, type Vault, type VaultAccountData, VaultBuilderBase, type VaultBuilderContext, type VaultCacheInvalidation, VaultClient, type VaultClientBundle, type VaultEnv, type VaultIncentiveAccount, type VaultIncentiveAccountData, type VaultIncentiveV3Account, type VaultIncentiveV3AccountData, type VaultLookupTableMap, VaultLutManager, type VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, type VaultWithdrawalQueueAccount, type VaultWithdrawalQueueAccountData, WALLET_FEE_EXEMPT_WHITELIST, WITHDRAWABLE_RESERVE_FLOOR_BPS, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, type WithdrawalLeg, type WithdrawalPlan, type WithdrawalPricing, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldCashflow, type YieldPaymentResponse, type YieldPaymentSnapshot, type YieldTracker, type YieldValuationModel, accountingUnitPriceToUsd, addCashflowUpdate, applyEffectiveApy, assertNoLargeBalanceChanges, assertNoUnconfirmedYieldPayments, assertOracleImpliedApy, assertReconciliationExternalValues, buildHoldingUpdate, buildKaminoDepositInteraction, buildKaminoWithdrawInteraction, buildMarginfiWithdrawInteraction, buildNestDepositRequest, buildNestWithdrawalRequest, buildUpdates, candidateGrossNav, coerceBool, collectSamples, collectVaultLookupTableAccounts, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, decodeNestDepositRequest, decodeNestWithdrawalRequest, decodePendingConsensusSigners, defaultKeypairPath, deleteAccount, discoverVaultsForSigner, externalWithdrawComputeBudget, externalWithdrawLookupTables, fetchExternalPositions, fetchNestRedemptionQuote, fetchNestRedemptionStatus, fetchNestTokenPrice, fetchReceiptMints, filterTargetHoldings, findLargeBalanceChanges, findSquadsWalletRoute, formatSettlementSimulation, fromUiAmount, gatherPricingInputs, getAccount, getAccounts, getAprYield, getBalance, getCashflows, getIncentiveRecipientShareAtas, getIncentiveRecipients, getIncentiveReportRecipients, getIncentiveTotals, getIncentiveV3OracleState, getIncentiveV3RecipientShareAtas, getIncentiveV3Recipients, getIncentiveV3Totals, getNavValue, getRpcUrl, getTotalOutstandingYield, getTotalTrackedValue, getTotalYield, getTrackedValue, getVaultLookupTables, getVaultProgramId, getYield, getYieldPayments, indexConfigByMint, isEvmNavPriceConfig, isNavAccountBalance, isNavAccountValue, isNavYieldAccount, isVaultEnv, keypairAddress, loadKaminoDeposit, loadKaminoWithdrawal, loadKeypair, logProspectiveApy, makeProvider, managerReconciliationStateKey, mintTokensTo, mints, mostFrequent, parseExternalLiquidityRefs, planExternalAllocation, planRebalance, planWithdrawalLegs, prepareSquadsProposalUpload, prepareVaultTransaction, previewNavPrice, previousPhysicalNav, priceInAccountingUnit, publishedConsensusBlockers, quoteWithdrawalPayout, readI64LE, readSplMintSupply, reconcileManagerWalletBalances, reconciliationExternalValues, refreshLiveOraclePrices, resolveExternalWithdraw, resolveKeypairPath, resolveSquadsWalletRoute, resolveTrackedAmounts, resolveWithdrawalPlan, roundToNextUtcMidnight, runLiveConsensusOracle, selectReportableHoldings, settleVault, signerInOracleData, simulateConsensusOracleSettlement, simulateDryRunSettlement, simulateOraclePublication, simulateSquadsProposalExecution, sumPositionsByMint, systemClock, toBigInt, toUiAmount, toWeb3AccountMeta, trackedValueFromResponse, uniqueLutAddresses, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, variantName, vaultAuthorityForWallet, walletReconciliationGuardUpdates, withDiscoveredYieldAccounts, withVaultLookupTables, withdrawalComputeBudget };
package/dist/index.js CHANGED
@@ -2048,7 +2048,6 @@ var index_exports = {};
2048
2048
  __export(index_exports, {
2049
2049
  ASSET_DECIMALS: () => ASSET_DECIMALS,
2050
2050
  ASSET_REBALANCE_COOLDOWN_SECS: () => ASSET_REBALANCE_COOLDOWN_SECS,
2051
- ASYNC_REDEMPTION_CANCEL_DELAY_SECS: () => ASYNC_REDEMPTION_CANCEL_DELAY_SECS,
2052
2051
  AccountClient: () => AccountClient,
2053
2052
  ActivateCircuitBreakerBuilder: () => ActivateCircuitBreakerBuilder,
2054
2053
  AddIncentiveRecipientBuilder: () => AddIncentiveRecipientBuilder,
@@ -2387,7 +2386,6 @@ var MAX_PRICE_STALENESS_THRESHOLD_SECS = 7 * 24 * 60 * 60;
2387
2386
  var DEFAULT_VAULT_ID = 0;
2388
2387
  var DEFAULT_MAX_ACCEPTABLE_APY_BPS = 1e4;
2389
2388
  var DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS = 7 * 24 * 60 * 60;
2390
- var ASYNC_REDEMPTION_CANCEL_DELAY_SECS = 30 * 24 * 60 * 60;
2391
2389
  var DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS = 100;
2392
2390
  var DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS = 50;
2393
2391
  var USDC_MINT = (0, import_kit.address)(
@@ -11657,7 +11655,8 @@ var IDL = {
11657
11655
  {
11658
11656
  "name": "RedemptionMode",
11659
11657
  "docs": [
11660
- "Redemption policy for regular vault shares. Zero preserves existing vault behavior."
11658
+ "Redemption policy for regular vault shares. Zero preserves existing vault behavior.",
11659
+ "Numeric layout is part of the account and instruction formats; only append variants."
11661
11660
  ],
11662
11661
  "repr": {
11663
11662
  "kind": "rust"
@@ -11670,6 +11669,9 @@ var IDL = {
11670
11669
  },
11671
11670
  {
11672
11671
  "name": "AsyncOnly"
11672
+ },
11673
+ {
11674
+ "name": "Hybrid"
11673
11675
  }
11674
11676
  ]
11675
11677
  }
@@ -12146,6 +12148,15 @@ var IDL = {
12146
12148
  }
12147
12149
  }
12148
12150
  }
12151
+ },
12152
+ {
12153
+ "name": "redemption_period_secs",
12154
+ "docs": [
12155
+ "Minimum delay in seconds for new regular-share async requests. Zero disables the delay."
12156
+ ],
12157
+ "type": {
12158
+ "option": "i64"
12159
+ }
12149
12160
  }
12150
12161
  ]
12151
12162
  }
@@ -12804,12 +12815,19 @@ var IDL = {
12804
12815
  ],
12805
12816
  "type": "u64"
12806
12817
  },
12818
+ {
12819
+ "name": "redemption_period_secs",
12820
+ "docs": [
12821
+ "Minimum delay for new regular-share async withdrawals; zero allows immediate settlement."
12822
+ ],
12823
+ "type": "i64"
12824
+ },
12807
12825
  {
12808
12826
  "name": "_padding3",
12809
12827
  "type": {
12810
12828
  "array": [
12811
12829
  "u64",
12812
- 21
12830
+ 20
12813
12831
  ]
12814
12832
  }
12815
12833
  }
@@ -14423,6 +14441,7 @@ var VaultQuoteClient = class {
14423
14441
  return info ? (0, import_kit5.address)(info.owner.toBase58()) : null;
14424
14442
  }
14425
14443
  isFeeExemptSigner(signer, owner, seeds) {
14444
+ if (!seeds && WALLET_FEE_EXEMPT_WHITELIST.includes(signer)) return true;
14426
14445
  if (!owner || !seeds) return false;
14427
14446
  const ownerString = owner.toString();
14428
14447
  const approvedOwner = ownerString === this.programId.toString() || PROGRAM_FEE_EXEMPT_OWNER_WHITELIST.some(
@@ -14476,10 +14495,9 @@ var VaultQuoteClient = class {
14476
14495
  totalSupply2,
14477
14496
  backingValue
14478
14497
  );
14479
- const expectedAmountOut = sharesForDeposit(
14480
- netAccountingAmount,
14481
- totalSupply2,
14482
- backingValue
14498
+ const expectedAmountOut = checkedSub(
14499
+ grossAmountOut2,
14500
+ feeForBps(grossAmountOut2, feeBps2)
14483
14501
  );
14484
14502
  return {
14485
14503
  shareClass: args.shareClass,
@@ -14534,7 +14552,16 @@ var VaultQuoteClient = class {
14534
14552
  classValue
14535
14553
  );
14536
14554
  const feeBps2 = feeExempt ? 0 : numberFrom(vault.config.fees.mintFeeBps);
14537
- const feeAmount2 = feeForBps(grossAmountOut2, feeBps2);
14555
+ const netAccountingAmount = checkedSub(
14556
+ accountingAmount,
14557
+ feeForBps(accountingAmount, feeBps2)
14558
+ );
14559
+ const expectedAmountOut = sharesForDeposit(
14560
+ netAccountingAmount,
14561
+ totalSupply,
14562
+ classValue
14563
+ );
14564
+ const feeAmount2 = checkedSub(grossAmountOut2, expectedAmountOut);
14538
14565
  return {
14539
14566
  shareClass: args.shareClass,
14540
14567
  direction: args.direction,
@@ -14543,7 +14570,7 @@ var VaultQuoteClient = class {
14543
14570
  feeExempt,
14544
14571
  feeBps: feeBps2,
14545
14572
  amountIn,
14546
- expectedAmountOut: checkedSub(grossAmountOut2, feeAmount2),
14573
+ expectedAmountOut,
14547
14574
  grossAmountOut: grossAmountOut2,
14548
14575
  feeAmount: feeAmount2,
14549
14576
  feeAmountUnit: "share",
@@ -14555,7 +14582,7 @@ var VaultQuoteClient = class {
14555
14582
  toBigint(trancheClass.value),
14556
14583
  toBigint(trancheClass.totalSupply)
14557
14584
  );
14558
- const feeBps = trancheWithdrawFeeBps(args, trancheState, feeExempt);
14585
+ const feeBps = trancheWithdrawFeeBps(args, vault, trancheState, feeExempt);
14559
14586
  const feeAmount = feeForBps(grossAmountOut, feeBps);
14560
14587
  return {
14561
14588
  shareClass: args.shareClass,
@@ -14573,8 +14600,10 @@ var VaultQuoteClient = class {
14573
14600
  };
14574
14601
  }
14575
14602
  };
14576
- function trancheWithdrawFeeBps(args, trancheState, feeExempt) {
14577
- if (feeExempt || args.shareClass === "senior") return 0;
14603
+ function trancheWithdrawFeeBps(args, vault, trancheState, feeExempt) {
14604
+ if (feeExempt) return 0;
14605
+ if (args.shareClass === "senior")
14606
+ return numberFrom(vault.config.fees.burnFeeBps);
14578
14607
  return args.withdrawalMode === "queued" ? numberFrom(trancheState.config.standardUnstakeFeeBps) : numberFrom(trancheState.config.earlyUnstakeFeeBps);
14579
14608
  }
14580
14609
  function accountingAmountForAsset(vault, mint, tokenAmount) {
@@ -15745,6 +15774,7 @@ function toAnchorSetVaultConfigArgs(args) {
15745
15774
  tvlLimit: args.tvlLimit,
15746
15775
  lossesEnabled: args.lossesEnabled,
15747
15776
  redemptionMode: args.redemptionMode ?? null,
15777
+ redemptionPeriodSecs: args.redemptionPeriodSecs ?? null,
15748
15778
  priceStalenessThresholdSecs: args.priceStalenessThresholdSecs,
15749
15779
  userBurnLimit: args.userBurnLimit,
15750
15780
  managerPullLimit: args.managerPullLimit,
@@ -15944,6 +15974,7 @@ var SetVaultConfigBuilder = class extends VaultBuilderBase {
15944
15974
  tvlLimit: txArgs.tvlLimit !== void 0 ? new import_core7.BN(txArgs.tvlLimit.toString()) : null,
15945
15975
  lossesEnabled: txArgs.lossesEnabled ?? null,
15946
15976
  redemptionMode: txArgs.redemptionMode ?? null,
15977
+ redemptionPeriodSecs: txArgs.redemptionPeriodSecs !== void 0 ? new import_core7.BN(txArgs.redemptionPeriodSecs.toString()) : null,
15947
15978
  priceStalenessThresholdSecs: txArgs.priceStalenessThresholdSecs !== void 0 ? new import_core7.BN(txArgs.priceStalenessThresholdSecs.toString()) : null,
15948
15979
  userBurnLimit: txArgs.userBurnLimit !== void 0 ? {
15949
15980
  windowLimit: new import_core7.BN(
@@ -17381,8 +17412,9 @@ async function resolveWithdrawalPlan(args) {
17381
17412
  ),
17382
17413
  args.addressSeeds ? args.connection.getAccountInfo(new import_web317.PublicKey(args.user), "confirmed") : null
17383
17414
  ]);
17384
- let feeExempt = false;
17415
+ let feeExempt = WALLET_FEE_EXEMPT_WHITELIST.includes(args.user);
17385
17416
  if (args.addressSeeds) {
17417
+ feeExempt = false;
17386
17418
  if (!signer)
17387
17419
  throw new Error("Missing fee-exempt withdrawal signer account");
17388
17420
  const owner = signer.owner.toBase58();
@@ -17415,7 +17447,8 @@ async function resolveWithdrawalPlan(args) {
17415
17447
  const state = args.shareClass === "junior" ? tranche.junior : tranche.senior;
17416
17448
  pricing.supply = BigInt(state.totalSupply.toString());
17417
17449
  pricing.value = BigInt(state.value.toString());
17418
- pricing.feeBps = feeExempt || args.shareClass === "senior" ? 0 : tranche.config.earlyUnstakeFeeBps;
17450
+ if (args.shareClass === "junior")
17451
+ pricing.feeBps = feeExempt ? 0 : tranche.config.earlyUnstakeFeeBps;
17419
17452
  }
17420
17453
  }
17421
17454
  const index = args.externalLiquiditySource;
@@ -20460,8 +20493,8 @@ var WithdrawalQueueService = class {
20460
20493
  return this.client.sendTransaction(signer, plan);
20461
20494
  }
20462
20495
  /**
20463
- * Fulfill every due queue, optionally scoped to a single vault. Non-fatal:
20464
- * a failure on one queue is logged and the rest still run.
20496
+ * Fulfill regular queues oldest-first by request timestamp. An older pending
20497
+ * request blocks later regular requests; junior queues and other vaults continue.
20465
20498
  */
20466
20499
  async fulfillAllDue(signer, opts = {}) {
20467
20500
  const { vault, log } = opts;
@@ -20469,31 +20502,77 @@ var WithdrawalQueueService = class {
20469
20502
  const summary = {
20470
20503
  fulfilled: 0,
20471
20504
  skippedNotDue: 0,
20505
+ skippedBlocked: 0,
20506
+ skippedNoLiquidity: 0,
20472
20507
  failed: 0,
20473
20508
  signatures: []
20474
20509
  };
20475
- const now = this.now();
20510
+ const now = Number(await this.client.account.fetchClockUnixTimestamp());
20511
+ const byVault = /* @__PURE__ */ new Map();
20476
20512
  for (const queue of queues) {
20477
- if (!this.isDue(queue, now)) {
20478
- summary.skippedNotDue += 1;
20479
- log?.(
20480
- `skip ${queue.pda} (owner ${queue.owner}) \u2014 due in ${this.secondsUntilDue(queue, now)}s`
20481
- );
20482
- continue;
20483
- }
20513
+ const group = byVault.get(queue.vault) ?? [];
20514
+ group.push(queue);
20515
+ byVault.set(queue.vault, group);
20516
+ }
20517
+ for (const [vault2, group] of byVault) {
20518
+ let regularBlocked = false;
20519
+ let regularMint;
20484
20520
  try {
20485
- log?.(
20486
- `fulfilling ${queue.pda} \u2014 paying ${queue.inputAmount} shares worth of ${queue.outputMint} to owner ${queue.owner}`
20521
+ regularMint = (0, import_common53.fromWeb3Pk)(
20522
+ (await this.client.account.fetchVault(vault2, { fresh: true })).mint
20487
20523
  );
20488
- const sig = await this.fulfill(signer, queue);
20489
- summary.fulfilled += 1;
20490
- summary.signatures.push(sig);
20491
- log?.(`fulfilled ${queue.pda} (owner ${queue.owner}): ${sig}`);
20492
20524
  } catch (err) {
20493
- summary.failed += 1;
20525
+ summary.failed += group.length;
20494
20526
  log?.(
20495
- `FAILED ${queue.pda} (owner ${queue.owner}): ${err instanceof Error ? err.message : String(err)}`
20527
+ `FAILED vault ${vault2}: ${err instanceof Error ? err.message : String(err)}`
20496
20528
  );
20529
+ continue;
20530
+ }
20531
+ const regularQueues = group.filter((q) => q.inputMint === regularMint).sort(
20532
+ (a, b) => a.requestTs - b.requestTs || (a.pda < b.pda ? -1 : a.pda > b.pda ? 1 : 0)
20533
+ );
20534
+ for (const queue of [
20535
+ ...regularQueues,
20536
+ ...group.filter((q) => q.inputMint !== regularMint)
20537
+ ]) {
20538
+ const regular = queue.inputMint === regularMint;
20539
+ if (regular && regularBlocked) {
20540
+ summary.skippedBlocked += 1;
20541
+ log?.(
20542
+ `skipped-blocked ${queue.pda}: an older request is still pending`
20543
+ );
20544
+ continue;
20545
+ }
20546
+ if (!this.isDue(queue, now)) {
20547
+ summary.skippedNotDue += 1;
20548
+ if (regular) regularBlocked = true;
20549
+ log?.(
20550
+ `skip ${queue.pda} (owner ${queue.owner}) \u2014 due in ${this.secondsUntilDue(queue, now)}s`
20551
+ );
20552
+ continue;
20553
+ }
20554
+ try {
20555
+ log?.(
20556
+ `fulfilling ${queue.pda} \u2014 paying ${queue.inputAmount} shares worth of ${queue.outputMint} to owner ${queue.owner}`
20557
+ );
20558
+ const sig = await this.fulfill(signer, queue);
20559
+ summary.fulfilled += 1;
20560
+ summary.signatures.push(sig);
20561
+ log?.(`fulfilled ${queue.pda} (owner ${queue.owner}): ${sig}`);
20562
+ } catch (err) {
20563
+ if (regular) regularBlocked = true;
20564
+ const message2 = err instanceof Error ? err.message : String(err);
20565
+ const logs = err?.logs ?? [];
20566
+ if (/InsufficientVaultLiquidity/.test([message2, ...logs].join("\n"))) {
20567
+ summary.skippedNoLiquidity += 1;
20568
+ log?.(
20569
+ `skipped-no-liquidity ${queue.pda} (owner ${queue.owner}): ${message2}`
20570
+ );
20571
+ } else {
20572
+ summary.failed += 1;
20573
+ log?.(`FAILED ${queue.pda} (owner ${queue.owner}): ${message2}`);
20574
+ }
20575
+ }
20497
20576
  }
20498
20577
  }
20499
20578
  return summary;
@@ -20596,6 +20675,64 @@ var OracleService = class {
20596
20675
  );
20597
20676
  return sig;
20598
20677
  }
20678
+ /**
20679
+ * Simulate the update followed by NAV settlement in one transaction. If the
20680
+ * combined plan cannot be built or simulated successfully, publish only the
20681
+ * report. The caller must first verify that the report will reach consensus;
20682
+ * a successful crank alone can still settle unchanged holdings.
20683
+ */
20684
+ async updateAssetConsensusPriceAndCrankNavIfReady(signer, args, log, beforeSubmit) {
20685
+ const updatePlan = await this.client.tx.updateConsensusOracle.getTx({
20686
+ signer: (0, import_common54.fromWeb3Pk)(signer.publicKey),
20687
+ ...args
20688
+ });
20689
+ let plan = updatePlan;
20690
+ let crankSkippedReason;
20691
+ try {
20692
+ const crankPlan = await this.client.tx.crankNav.getTx({
20693
+ cranker: (0, import_common54.fromWeb3Pk)(signer.publicKey),
20694
+ vault: args.vault
20695
+ });
20696
+ const combinedPlan = {
20697
+ instructions: [...updatePlan.instructions, ...crankPlan.instructions],
20698
+ lookupTables: [
20699
+ .../* @__PURE__ */ new Set([
20700
+ ...updatePlan.lookupTables ?? [],
20701
+ ...crankPlan.lookupTables ?? []
20702
+ ])
20703
+ ],
20704
+ postSuccessCacheInvalidations: [
20705
+ ...updatePlan.postSuccessCacheInvalidations ?? [],
20706
+ ...crankPlan.postSuccessCacheInvalidations ?? []
20707
+ ]
20708
+ };
20709
+ const simulation = await this.client.simulateTransaction(
20710
+ signer,
20711
+ combinedPlan
20712
+ );
20713
+ if (simulation.err) {
20714
+ crankSkippedReason = `combined update and NAV crank simulation failed: ${JSON.stringify(
20715
+ simulation.err
20716
+ )}`;
20717
+ for (const line of simulation.logs ?? []) log?.(` | ${line}`);
20718
+ } else {
20719
+ plan = combinedPlan;
20720
+ }
20721
+ } catch (error) {
20722
+ crankSkippedReason = `could not prepare combined update and NAV crank: ${error instanceof Error ? error.message : String(error)}`;
20723
+ }
20724
+ await beforeSubmit?.();
20725
+ const updateSignature = await this.client.sendTransaction(signer, plan);
20726
+ if (crankSkippedReason) {
20727
+ log?.(`record consensus assets ${args.vault}: ${updateSignature}`);
20728
+ log?.(`skip crank nav ${args.vault}: ${crankSkippedReason}`);
20729
+ return { updateSignature, crankSkippedReason };
20730
+ }
20731
+ log?.(
20732
+ `record consensus assets and crank nav ${args.vault}: ${updateSignature}`
20733
+ );
20734
+ return { updateSignature, crankSignature: updateSignature };
20735
+ }
20599
20736
  // ── Permissionless NAV crank ──────────────────────────────────────────────
20600
20737
  /** Settle the vault NAV from its current holdings (permissionless). */
20601
20738
  async crankNav(cranker, args, log) {
@@ -23020,51 +23157,47 @@ async function settleVault2({
23020
23157
  assertOracleImpliedApy(vault, simulations.proposed, "proposed report");
23021
23158
  if (simulations.consensus.realizedApy)
23022
23159
  assertOracleImpliedApy(vault, simulations.consensus, "current consensus");
23023
- await assertNoUnconfirmedYieldPayments(yieldTracker, target);
23024
- await beforeSubmit?.();
23160
+ const consensusBlockers = updates.flatMap((update) => {
23161
+ const holding = vaultState.holdings[update.holdingIndex];
23162
+ const result = simulations.consensus.consensus.find(
23163
+ (item) => item.holdingIndex === update.holdingIndex
23164
+ );
23165
+ if (holding && result?.mint === update.mint && result.settledExternalAmount !== void 0 && (result.wouldUpdateHolding || toBigInt2(holding.externalAmount) === result.settledExternalAmount && (result.settledPrice === void 0 || toBigInt2(holding.price) === result.settledPrice))) {
23166
+ return [];
23167
+ }
23168
+ return [
23169
+ `holding #${update.holdingIndex}: ${result?.reason ?? "no consensus"}`
23170
+ ];
23171
+ });
23172
+ const crankSkippedReason = consensusBlockers.length ? `waiting for consensus after submission: ${consensusBlockers.join("; ")}` : !simulations.consensus.canSettle ? `NAV settlement blocked: ${simulations.consensus.blockers.join("; ")}` : void 0;
23173
+ const publicationArgs = {
23174
+ vault,
23175
+ updates: updates.map((u) => ({
23176
+ holdingIndex: u.holdingIndex,
23177
+ price: u.price,
23178
+ externalAmount: u.externalAmount
23179
+ }))
23180
+ };
23181
+ const revalidateBeforeSubmit = async () => {
23182
+ await assertNoUnconfirmedYieldPayments(yieldTracker, target);
23183
+ await beforeSubmit?.();
23184
+ };
23185
+ if (!crankSkippedReason) {
23186
+ return oracle.updateAssetConsensusPriceAndCrankNavIfReady(
23187
+ signer,
23188
+ publicationArgs,
23189
+ log,
23190
+ revalidateBeforeSubmit
23191
+ );
23192
+ }
23193
+ await revalidateBeforeSubmit();
23025
23194
  const updateSignature = await oracle.updateAssetConsensusPrice(
23026
23195
  signer,
23027
- {
23028
- vault,
23029
- updates: updates.map((u) => ({
23030
- holdingIndex: u.holdingIndex,
23031
- price: u.price,
23032
- externalAmount: u.externalAmount
23033
- }))
23034
- },
23196
+ publicationArgs,
23035
23197
  log
23036
23198
  );
23037
- let crankSkippedReason;
23038
- try {
23039
- const [publishedVault, publishedOracle, publishedAt] = await Promise.all([
23040
- client.account.fetchVault(vault, { fresh: true }),
23041
- client.account.fetchVaultOracleForVault(vault, { fresh: true }),
23042
- client.account.fetchClockUnixTimestamp()
23043
- ]);
23044
- const blockers = publishedConsensusBlockers({
23045
- vault: publishedVault,
23046
- oracleData: publishedOracle.data,
23047
- updates,
23048
- signer: (0, import_common63.fromWeb3Pk)(signer.publicKey),
23049
- nowTs: publishedAt
23050
- });
23051
- if (blockers.length)
23052
- crankSkippedReason = `waiting for published consensus: ${blockers.join(
23053
- "; "
23054
- )}`;
23055
- } catch (error) {
23056
- crankSkippedReason = `could not verify published consensus: ${error instanceof Error ? error.message : String(error)}`;
23057
- }
23058
- if (crankSkippedReason) {
23059
- log(`skip crank nav ${vault}: ${crankSkippedReason}`);
23060
- return { updateSignature, crankSkippedReason };
23061
- }
23062
- const crankResult = await oracle.crankNavIfReady(signer, { vault }, log);
23063
- return {
23064
- updateSignature,
23065
- crankSignature: crankResult.signature,
23066
- crankSkippedReason: crankResult.reason
23067
- };
23199
+ log(`skip crank nav ${vault}: ${crankSkippedReason}`);
23200
+ return { updateSignature, crankSkippedReason };
23068
23201
  }
23069
23202
  async function logProspectiveApy({
23070
23203
  client,
@@ -27200,7 +27333,6 @@ var import_common72 = __toESM(require_dist());
27200
27333
  0 && (module.exports = {
27201
27334
  ASSET_DECIMALS,
27202
27335
  ASSET_REBALANCE_COOLDOWN_SECS,
27203
- ASYNC_REDEMPTION_CANCEL_DELAY_SECS,
27204
27336
  AccountClient,
27205
27337
  ActivateCircuitBreakerBuilder,
27206
27338
  AddIncentiveRecipientBuilder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perena/vault-sdk",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "description": "Vault program helpers for Bankineco integrations.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",