@perena/vault-sdk 1.0.63 → 1.0.65

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.ts CHANGED
@@ -14424,9 +14424,9 @@ interface ConsensusOracleDeps {
14424
14424
  priceSource: PriceSource;
14425
14425
  /** Optional; omitted ⇒ no live-LP balances are folded in. */
14426
14426
  externalPositions?: ExternalPositionProvider;
14427
- /** Optional NAV-drop recovery source; configured by the live runtime. */
14427
+ /** Optional manager base balances, included on every pass by the live runtime. */
14428
14428
  managerWalletBalances?: ManagerWalletBalanceSource;
14429
- /** MPC base tokens and Marginfi deposits, subject to the same NAV gate. */
14429
+ /** MPC base tokens and Marginfi deposits, included independently of pending Nest. */
14430
14430
  mpcWalletBalances?: MpcWalletBalanceSource;
14431
14431
  /** Optional; omitted ⇒ no yield accrual is folded in. */
14432
14432
  yieldTracker?: YieldTracker;
@@ -14457,13 +14457,13 @@ interface HoldingUpdatePreview {
14457
14457
  trackedPrincipalAmount: bigint;
14458
14458
  /** Complete tracked value, including NAV accounts (base units). */
14459
14459
  trackedValueAmount: bigint;
14460
- /** Manager base tokens admitted by the ±0.05% NAV reconciliation (base units). */
14460
+ /** Observed manager base tokens (base units), independent of pending Nest. */
14461
14461
  managerWalletAmount?: bigint;
14462
- /** MPC base tokens admitted by the same reconciliation (base units). */
14462
+ /** Observed MPC base tokens (base units). */
14463
14463
  mpcWalletAmount?: bigint;
14464
- /** MPC Marginfi base-asset deposits admitted by reconciliation (base units). */
14464
+ /** Observed MPC Marginfi base-asset deposits (base units). */
14465
14465
  mpcMarginfiAmount?: bigint;
14466
- /** Withdrawn nPERENA retained until the wallet NAV rule matches proceeds. */
14466
+ /** Withdrawn nPERENA retained until wallet USDC matches its value within ±5%. */
14467
14467
  pendingNestAmount?: bigint;
14468
14468
  /** LP + tracked value + pending Nest + manager tokens + MPC tokens/deposits. */
14469
14469
  externalAmount: bigint;
@@ -14861,16 +14861,23 @@ interface RefreshLiveOraclePricesParams {
14861
14861
  /** Returns true when at least one price was actually refreshed on-chain. */
14862
14862
  declare function refreshLiveOraclePrices({ oracle, signer, vault, vaultState, nowSecs, log, dryRun, }: RefreshLiveOraclePricesParams): Promise<boolean>;
14863
14863
 
14864
- /** A NAV drop of at least 0.1% triggers the manager-wallet lookup. */
14864
+ /** @deprecated Wallet balances are now read on every pass. */
14865
14865
  declare const MANAGER_WALLET_NAV_DROP_TRIGGER_BPS = 10n;
14866
- /** The adjusted NAV must be within ±0.05%, including both boundaries. */
14866
+ /** @deprecated Total NAV no longer gates wallet inclusion or Nest replacement. */
14867
14867
  declare const MANAGER_WALLET_NAV_TOLERANCE_BPS = 5n;
14868
+ /** Wallet USDC must match pending Nest value within ±5%, inclusively. */
14869
+ declare const NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS = 500n;
14870
+ /** Maximum per-holding external-value drift while preparing a report. */
14871
+ declare const RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS = 3n;
14868
14872
  /** Previous physical NAV, including banked APY, adjusted for recorded cash flows. */
14869
14873
  declare function previousPhysicalNav(state: DecodedVault): bigint;
14870
14874
  /** Same per-holding integer valuation as the program's gross_nav_from_holdings. */
14871
14875
  declare function candidateGrossNav(state: DecodedVault, updates: readonly HoldingUpdatePreview[]): bigint;
14872
14876
  interface ManagerWalletReconciliation {
14877
+ /** True only when wallet USDC replaces the carried pending Nest claim. */
14873
14878
  accepted: boolean;
14879
+ /** Even zero balances must be rechecked before publishing a live report. */
14880
+ walletBalancesChecked: boolean;
14874
14881
  updates: HoldingUpdatePreview[];
14875
14882
  previousNav: bigint;
14876
14883
  candidateNav: bigint;
@@ -14888,8 +14895,18 @@ declare function reconcileManagerWalletBalances({ vault, vaultState, updates, so
14888
14895
  mpcSource?: MpcWalletBalanceSource;
14889
14896
  log?: (message: string) => void;
14890
14897
  }): Promise<ManagerWalletReconciliation>;
14891
- /** The vault fields whose changes would invalidate a wallet reconciliation. */
14898
+ /** Exempt only the matched Nest-to-USDC conversion from the per-asset guard. */
14899
+ declare function walletReconciliationGuardUpdates(state: DecodedVault, reconciliation: ManagerWalletReconciliation): HoldingUpdatePreview[];
14900
+ /** Holding identities and local token balances must still match exactly. */
14892
14901
  declare function managerReconciliationStateKey(state: DecodedVault): string;
14902
+ /**
14903
+ * Capture immutable external amount × price numerators, optionally overlaying
14904
+ * the report. Decimal scales cancel in a per-holding comparison; keeping the
14905
+ * numerators avoids rounding away changes in small or high-precision holdings.
14906
+ */
14907
+ declare function reconciliationExternalValues(state: DecodedVault, updates?: readonly HoldingUpdatePreview[]): bigint[];
14908
+ /** Inclusive ±3 bps against each initial value; zero must remain zero. */
14909
+ declare function assertReconciliationExternalValues(initial: readonly bigint[], current: readonly bigint[], errorPrefix: string): void;
14893
14910
 
14894
14911
  declare function gatherPricingInputs(deps: ConsensusOracleDeps, target: ConsensusOracleTarget, vaultState: DecodedVault, reportableHoldings: ConsensusHoldingEntry[], log?: (msg: string) => void): Promise<VaultPricingInputs>;
14895
14912
  /**
@@ -14970,8 +14987,9 @@ declare function discoverVaultsForSigner(client: VaultClient, signer: Keypair, o
14970
14987
 
14971
14988
  /**
14972
14989
  * Fail closed while any configured yield account has an unsettled payment.
14973
- * Confirmed payments reduce tracked value; the oracle does not add the payout's
14974
- * destination balance to the reported external amount.
14990
+ * Confirmed payments reduce tracked value. Proceeds in the manager or configured
14991
+ * MPC wallet are counted separately by wallet reconciliation; arbitrary payout
14992
+ * destinations are not discovered from payment records.
14975
14993
  */
14976
14994
  declare function assertNoUnconfirmedYieldPayments(yieldTracker: YieldTracker | undefined, target: ConsensusOracleTarget): Promise<void>;
14977
14995
  /**
@@ -15310,7 +15328,7 @@ declare function formatSettlementSimulation(simulation: SettlementSimulation): s
15310
15328
 
15311
15329
  interface LiveConsensusOracleDepsOptions {
15312
15330
  log?: (msg: string) => void;
15313
- /** @deprecated Ignored. The NAV-gated manager-wallet check is always enabled. */
15331
+ /** @deprecated Ignored. Manager-wallet balances are always included. */
15314
15332
  rpcOnly?: boolean;
15315
15333
  includeExternalPositions?: boolean;
15316
15334
  }
@@ -15321,7 +15339,7 @@ interface RunLiveConsensusOracleOptions extends RunOptions {
15321
15339
  rpcUrl?: string;
15322
15340
  /** Override the vault program id. Defaults to the environment's configured program. */
15323
15341
  programId?: Address;
15324
- /** @deprecated Ignored. The NAV-gated manager-wallet check is always enabled. */
15342
+ /** @deprecated Ignored. Manager-wallet balances are always included. */
15325
15343
  rpcOnly?: boolean;
15326
15344
  /** Include live Kamino/Marginfi positions in external amount updates. Defaults to true. */
15327
15345
  includeExternalPositions?: boolean;
@@ -15771,4 +15789,4 @@ declare function collectVaultLookupTableAccounts(client: VaultClient, vault: Add
15771
15789
  extraAccounts?: Address[];
15772
15790
  }): Promise<Address[]>;
15773
15791
 
15774
- 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, 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, 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, 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, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, REPORTABLE_ORACLE_VARIANTS, type RealizedApySimulation, type RefreshLiveOraclePricesParams, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, ReportIncentiveV3Builder, type ReportIncentiveV3IxArgs, type ReportIncentiveV3TxArgs, 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, 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, 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, readI64LE, readSplMintSupply, reconcileManagerWalletBalances, 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, withDiscoveredYieldAccounts, withVaultLookupTables, withdrawalComputeBudget };
15792
+ 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, 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, 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, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS, REPORTABLE_ORACLE_VARIANTS, type RealizedApySimulation, type RefreshLiveOraclePricesParams, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, ReportIncentiveV3Builder, type ReportIncentiveV3IxArgs, type ReportIncentiveV3TxArgs, 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, 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, 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
@@ -2133,6 +2133,7 @@ __export(index_exports, {
2133
2133
  NEST_API_BASE_URL: () => import_nest2.NEST_API_BASE_URL,
2134
2134
  NEST_RWA_SHARE_MINT: () => NEST_RWA_SHARE_MINT,
2135
2135
  NEST_VAULT_SLUG: () => NEST_VAULT_SLUG,
2136
+ NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS: () => NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS,
2136
2137
  NestApiError: () => import_nest4.NestApiError,
2137
2138
  NestPriceSource: () => NestPriceSource,
2138
2139
  ORACLE_ENTRIES_OFFSET: () => ORACLE_ENTRIES_OFFSET,
@@ -2146,6 +2147,7 @@ __export(index_exports, {
2146
2147
  PST_TO_USDC_MAX_SLIPPAGE_BPS: () => PST_TO_USDC_MAX_SLIPPAGE_BPS,
2147
2148
  PdaClient: () => PdaClient,
2148
2149
  ProtocolInteractionBuilder: () => ProtocolInteractionBuilder,
2150
+ RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS: () => RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS,
2149
2151
  REPORTABLE_ORACLE_VARIANTS: () => REPORTABLE_ORACLE_VARIANTS,
2150
2152
  RemoveAssetHoldingBuilder: () => RemoveAssetHoldingBuilder,
2151
2153
  ReportIncentiveV3Builder: () => ReportIncentiveV3Builder,
@@ -2202,6 +2204,7 @@ __export(index_exports, {
2202
2204
  assertNoLargeBalanceChanges: () => assertNoLargeBalanceChanges,
2203
2205
  assertNoUnconfirmedYieldPayments: () => assertNoUnconfirmedYieldPayments,
2204
2206
  assertOracleImpliedApy: () => assertOracleImpliedApy,
2207
+ assertReconciliationExternalValues: () => assertReconciliationExternalValues,
2205
2208
  buildHoldingUpdate: () => buildHoldingUpdate,
2206
2209
  buildKaminoDepositInteraction: () => buildKaminoDepositInteraction,
2207
2210
  buildKaminoWithdrawInteraction: () => buildKaminoWithdrawInteraction,
@@ -2293,6 +2296,7 @@ __export(index_exports, {
2293
2296
  readI64LE: () => readI64LE,
2294
2297
  readSplMintSupply: () => readSplMintSupply,
2295
2298
  reconcileManagerWalletBalances: () => reconcileManagerWalletBalances,
2299
+ reconciliationExternalValues: () => reconciliationExternalValues,
2296
2300
  refreshLiveOraclePrices: () => refreshLiveOraclePrices,
2297
2301
  resolveExternalWithdraw: () => resolveExternalWithdraw,
2298
2302
  resolveKeypairPath: () => resolveKeypairPath,
@@ -2320,6 +2324,7 @@ __export(index_exports, {
2320
2324
  validateSquadsWalletRoutes: () => validateSquadsWalletRoutes,
2321
2325
  variantName: () => variantName2,
2322
2326
  vaultAuthorityForWallet: () => vaultAuthorityForWallet,
2327
+ walletReconciliationGuardUpdates: () => walletReconciliationGuardUpdates,
2323
2328
  withDiscoveredYieldAccounts: () => withDiscoveredYieldAccounts,
2324
2329
  withVaultLookupTables: () => withVaultLookupTables,
2325
2330
  withdrawalComputeBudget: () => withdrawalComputeBudget
@@ -21491,6 +21496,8 @@ var NestPriceSource = class {
21491
21496
  // src/services/consensusOracle/pipeline/managerWalletReconciliation.ts
21492
21497
  var MANAGER_WALLET_NAV_DROP_TRIGGER_BPS = 10n;
21493
21498
  var MANAGER_WALLET_NAV_TOLERANCE_BPS = 5n;
21499
+ var NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS = 500n;
21500
+ var RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS = 3n;
21494
21501
  var BPS = 10000n;
21495
21502
  var U64_MAX2 = 0xffffffffffffffffn;
21496
21503
  function previousPhysicalNav(state) {
@@ -21556,24 +21563,15 @@ async function reconcileManagerWalletBalances({
21556
21563
  throw new Error("Manager reconciliation requires fresh source amounts");
21557
21564
  }
21558
21565
  const pendingUpdates = retainPendingNestShares(vaultState, updates);
21559
- if (!source || previousNav <= 0n) {
21560
- return {
21561
- accepted: false,
21562
- updates: pendingUpdates,
21563
- previousNav,
21564
- candidateNav: 0n
21565
- };
21566
- }
21567
21566
  const candidateNav = candidateGrossNav(vaultState, updates);
21568
21567
  const result = {
21569
21568
  accepted: false,
21569
+ walletBalancesChecked: false,
21570
21570
  updates: pendingUpdates,
21571
21571
  previousNav,
21572
21572
  candidateNav
21573
21573
  };
21574
- if ((previousNav - candidateNav) * BPS < previousNav * MANAGER_WALLET_NAV_DROP_TRIGGER_BPS) {
21575
- return result;
21576
- }
21574
+ if (!source) return result;
21577
21575
  const baseUpdates = updates.filter(
21578
21576
  (update) => coerceBool3(vaultState.holdings[update.holdingIndex].isBase)
21579
21577
  );
@@ -21594,7 +21592,7 @@ async function reconcileManagerWalletBalances({
21594
21592
  throw new Error("Invalid manager wallet for NAV reconciliation");
21595
21593
  }
21596
21594
  log(
21597
- `vault ${vault}: NAV ${candidateNav} is at least 0.1% below ${previousNav}; checking manager ${manager}`
21595
+ `vault ${vault}: checking manager ${manager} and configured MPC base balances`
21598
21596
  );
21599
21597
  const [amounts, mpc] = await Promise.all([
21600
21598
  source.fetchBalances(manager, mints2),
@@ -21617,10 +21615,9 @@ async function reconcileManagerWalletBalances({
21617
21615
  mpc?.marginfi.get(update.mint) ?? 0n,
21618
21616
  "MPC Marginfi"
21619
21617
  );
21620
- if (mpc)
21621
- log(
21622
- `vault ${vault}: MPC ${mpc.wallet} mint ${update.mint}: tokens=${mpcTokens} marginfi=${mpcMarginfi}`
21623
- );
21618
+ log(
21619
+ `vault ${vault}: mint ${update.mint}: manager=${amount}` + (mpc ? ` MPC ${mpc.wallet}: tokens=${mpcTokens} marginfi=${mpcMarginfi}` : "")
21620
+ );
21624
21621
  return {
21625
21622
  ...update,
21626
21623
  managerWalletAmount: amount,
@@ -21628,36 +21625,97 @@ async function reconcileManagerWalletBalances({
21628
21625
  externalAmount: update.externalAmount + amount + mpcTokens + mpcMarginfi
21629
21626
  };
21630
21627
  });
21631
- const adjustedNav = candidateGrossNav(vaultState, adjusted);
21632
- const delta = adjustedNav - previousNav;
21628
+ const pendingNestValue = candidateGrossNav(vaultState, pendingUpdates) - candidateNav;
21629
+ const walletUsdcValue = candidateGrossNav(
21630
+ vaultState,
21631
+ updates.map(
21632
+ (update, index) => update.mint === USDC_MINT ? adjusted[index] : update
21633
+ )
21634
+ ) - candidateNav;
21635
+ const delta = walletUsdcValue - pendingNestValue;
21633
21636
  const absoluteDelta = delta < 0n ? -delta : delta;
21634
- const accepted = adjustedNav > candidateNav && absoluteDelta * BPS <= previousNav * MANAGER_WALLET_NAV_TOLERANCE_BPS;
21637
+ const accepted = pendingNestValue > 0n && absoluteDelta * BPS <= pendingNestValue * NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS;
21638
+ const finalUpdates = accepted ? adjusted : retainPendingNestShares(vaultState, adjusted);
21639
+ const adjustedNav = candidateGrossNav(vaultState, finalUpdates);
21635
21640
  log(
21636
- `vault ${vault}: manager${mpc ? " + MPC wallets" : " wallet"} ${accepted ? "accepted" : "rejected"}; adjusted NAV ${adjustedNav}, previous NAV ${previousNav}, allowed difference \xB10.05%`
21641
+ `vault ${vault}: wallet balances included; pending Nest ${accepted ? "replaced by wallet USDC" : "retained"}; wallet USDC value=${walletUsdcValue}, pending Nest value=${pendingNestValue}, replacement tolerance \xB15%; adjusted NAV ${adjustedNav}, previous NAV ${previousNav}`
21637
21642
  );
21638
21643
  return {
21639
21644
  accepted,
21640
- updates: accepted ? adjusted : pendingUpdates,
21645
+ walletBalancesChecked: true,
21646
+ updates: finalUpdates,
21641
21647
  previousNav,
21642
21648
  candidateNav,
21643
21649
  adjustedNav
21644
21650
  };
21645
21651
  }
21652
+ function walletReconciliationGuardUpdates(state, reconciliation) {
21653
+ if (!reconciliation.accepted) return reconciliation.updates;
21654
+ return reconciliation.updates.map((update) => {
21655
+ const previous = toBigInt2(
21656
+ state.holdings[update.holdingIndex].externalAmount
21657
+ );
21658
+ if (update.mint === NEST_RWA_SHARE_MINT) {
21659
+ return {
21660
+ ...update,
21661
+ externalAmount: previous > update.externalAmount ? previous : update.externalAmount
21662
+ };
21663
+ }
21664
+ if (update.mint !== USDC_MINT || update.externalAmount <= previous)
21665
+ return update;
21666
+ const walletAmount = (update.managerWalletAmount ?? 0n) + (update.mpcWalletAmount ?? 0n) + (update.mpcMarginfiAmount ?? 0n);
21667
+ const increase = update.externalAmount - previous;
21668
+ return {
21669
+ ...update,
21670
+ externalAmount: update.externalAmount - (walletAmount < increase ? walletAmount : increase)
21671
+ };
21672
+ });
21673
+ }
21646
21674
  function managerReconciliationStateKey(state) {
21647
21675
  return JSON.stringify({
21648
21676
  manager: (0, import_common55.fromWeb3Pk)(state.roles.manager),
21649
- previousNav: previousPhysicalNav(state).toString(),
21677
+ assetDecimals: state.config.assetDecimals,
21650
21678
  holdings: state.holdings.map((holding) => [
21651
21679
  (0, import_common55.fromWeb3Pk)(holding.mint),
21652
21680
  holding.decimals,
21653
21681
  variantName2(holding.priceOracleType),
21682
+ holding.priceOracleAccount ? (0, import_common55.fromWeb3Pk)(holding.priceOracleAccount) : void 0,
21654
21683
  coerceBool3(holding.isBase),
21655
- toBigInt2(holding.localAmount).toString(),
21656
- toBigInt2(holding.externalAmount).toString(),
21657
- toBigInt2(holding.price).toString()
21684
+ toBigInt2(holding.localAmount).toString()
21658
21685
  ])
21659
21686
  });
21660
21687
  }
21688
+ function reconciliationExternalValues(state, updates = []) {
21689
+ const byIndex = new Map(
21690
+ updates.map((update) => [update.holdingIndex, update])
21691
+ );
21692
+ return state.holdings.map((holding, index) => {
21693
+ const update = byIndex.get(index);
21694
+ const amount = update?.externalAmount ?? toBigInt2(holding.externalAmount);
21695
+ const price = update && variantName2(holding.priceOracleType).toLowerCase() === CONSENSUS_ORACLE_VARIANT ? update.price : toBigInt2(holding.price);
21696
+ if (amount < 0n || amount > U64_MAX2 || price < 0n || amount > 0n && price === 0n) {
21697
+ throw new Error(`Invalid external value for holding #${index}`);
21698
+ }
21699
+ return amount * price;
21700
+ });
21701
+ }
21702
+ function assertReconciliationExternalValues(initial, current, errorPrefix) {
21703
+ if (initial.length !== current.length) {
21704
+ throw new Error(
21705
+ `${errorPrefix}: holding count changed; retry with fresh inputs`
21706
+ );
21707
+ }
21708
+ for (let index = 0; index < initial.length; index++) {
21709
+ const before = initial[index];
21710
+ const after = current[index];
21711
+ const delta = after >= before ? after - before : before - after;
21712
+ if (before < 0n || after < 0n || delta * BPS > before * RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS) {
21713
+ throw new Error(
21714
+ `${errorPrefix}: holding #${index} external value changed by more than ${RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS} bps; retry with fresh inputs`
21715
+ );
21716
+ }
21717
+ }
21718
+ }
21661
21719
 
21662
21720
  // src/services/consensusOracle/pipeline/pricingInputs.ts
21663
21721
  var import_common56 = __toESM(require_dist());
@@ -23903,20 +23961,21 @@ var ConsensusOracleService = class {
23903
23961
  log
23904
23962
  });
23905
23963
  const updates = reconciliation.updates;
23906
- const needsRevalidation = reconciliation.accepted || // A new withdrawal can be queued after the first vault read, too.
23964
+ const needsRevalidation = reconciliation.walletBalancesChecked || // A new withdrawal can be queued after the first vault read, too.
23907
23965
  updates.some((update) => update.mint === NEST_RWA_SHARE_MINT);
23908
23966
  const reconciliationStateKey = needsRevalidation ? managerReconciliationStateKey(vaultState) : void 0;
23909
- if (!reconciliation.accepted) {
23910
- assertNoLargeBalanceChanges(
23911
- target.vault,
23912
- vaultState,
23913
- updates,
23914
- this.nowSecs(),
23915
- log
23916
- );
23917
- } else {
23967
+ const initialExternalValues = needsRevalidation ? reconciliationExternalValues(vaultState) : [];
23968
+ const initialReportExternalValues = needsRevalidation ? reconciliationExternalValues(vaultState, updates) : [];
23969
+ assertNoLargeBalanceChanges(
23970
+ target.vault,
23971
+ vaultState,
23972
+ walletReconciliationGuardUpdates(vaultState, reconciliation),
23973
+ this.nowSecs(),
23974
+ log
23975
+ );
23976
+ if (reconciliation.accepted) {
23918
23977
  log(
23919
- `vault ${target.vault}: manager NAV reconciliation passed; allowing cross-asset external balance changes`
23978
+ `vault ${target.vault}: wallet USDC matches pending Nest within \xB15%; allowing that conversion's external balance changes`
23920
23979
  );
23921
23980
  }
23922
23981
  if (dryRun) {
@@ -23977,21 +24036,56 @@ var ConsensusOracleService = class {
23977
24036
  "Vault changed during manager-wallet reconciliation; retry with fresh inputs"
23978
24037
  );
23979
24038
  }
23980
- if (!reconciliation.accepted) return;
23981
- const fresh = await reconcileManagerWalletBalances({
24039
+ assertReconciliationExternalValues(
24040
+ initialExternalValues,
24041
+ reconciliationExternalValues(freshState),
24042
+ "Vault changed during manager-wallet reconciliation"
24043
+ );
24044
+ if (reconciliation.walletBalancesChecked) {
24045
+ const fresh = await reconcileManagerWalletBalances({
24046
+ vault: target.vault,
24047
+ vaultState: freshState,
24048
+ updates: sourcedUpdates,
24049
+ source: this.deps.managerWalletBalances,
24050
+ mpcSource: this.deps.mpcWalletBalances
24051
+ });
24052
+ if (!fresh.walletBalancesChecked || fresh.accepted !== reconciliation.accepted) {
24053
+ throw new Error(
24054
+ "Manager wallet changed or MPC balances changed during reconciliation; retry with fresh inputs"
24055
+ );
24056
+ }
24057
+ assertReconciliationExternalValues(
24058
+ initialReportExternalValues,
24059
+ reconciliationExternalValues(freshState, fresh.updates),
24060
+ "Manager wallet changed or MPC balances changed during reconciliation"
24061
+ );
24062
+ }
24063
+ assertNoLargeBalanceChanges(
24064
+ target.vault,
24065
+ freshState,
24066
+ walletReconciliationGuardUpdates(freshState, reconciliation),
24067
+ this.nowSecs(),
24068
+ log
24069
+ );
24070
+ const simulations = await simulateOraclePublication({
24071
+ client: this.client,
24072
+ signer,
23982
24073
  vault: target.vault,
23983
24074
  vaultState: freshState,
23984
- updates: sourcedUpdates,
23985
- source: this.deps.managerWalletBalances,
23986
- mpcSource: this.deps.mpcWalletBalances
24075
+ updates,
24076
+ nowSecs: this.nowSecs()
23987
24077
  });
23988
- if (!fresh.accepted || fresh.updates.some(
23989
- (update, index) => update.externalAmount !== updates[index].externalAmount || update.managerWalletAmount !== updates[index].managerWalletAmount || update.mpcWalletAmount !== updates[index].mpcWalletAmount || update.mpcMarginfiAmount !== updates[index].mpcMarginfiAmount
23990
- )) {
23991
- throw new Error(
23992
- "Manager wallet changed or MPC balances changed during reconciliation; retry with fresh inputs"
24078
+ assertOracleImpliedApy(
24079
+ target.vault,
24080
+ simulations.proposed,
24081
+ "proposed report"
24082
+ );
24083
+ if (simulations.consensus.realizedApy)
24084
+ assertOracleImpliedApy(
24085
+ target.vault,
24086
+ simulations.consensus,
24087
+ "current consensus"
23993
24088
  );
23994
- }
23995
24089
  } : void 0
23996
24090
  });
23997
24091
  return {
@@ -26093,6 +26187,7 @@ var import_common68 = __toESM(require_dist());
26093
26187
  NEST_API_BASE_URL,
26094
26188
  NEST_RWA_SHARE_MINT,
26095
26189
  NEST_VAULT_SLUG,
26190
+ NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS,
26096
26191
  NestApiError,
26097
26192
  NestPriceSource,
26098
26193
  ORACLE_ENTRIES_OFFSET,
@@ -26106,6 +26201,7 @@ var import_common68 = __toESM(require_dist());
26106
26201
  PST_TO_USDC_MAX_SLIPPAGE_BPS,
26107
26202
  PdaClient,
26108
26203
  ProtocolInteractionBuilder,
26204
+ RECONCILIATION_EXTERNAL_VALUE_TOLERANCE_BPS,
26109
26205
  REPORTABLE_ORACLE_VARIANTS,
26110
26206
  RemoveAssetHoldingBuilder,
26111
26207
  ReportIncentiveV3Builder,
@@ -26162,6 +26258,7 @@ var import_common68 = __toESM(require_dist());
26162
26258
  assertNoLargeBalanceChanges,
26163
26259
  assertNoUnconfirmedYieldPayments,
26164
26260
  assertOracleImpliedApy,
26261
+ assertReconciliationExternalValues,
26165
26262
  buildHoldingUpdate,
26166
26263
  buildKaminoDepositInteraction,
26167
26264
  buildKaminoWithdrawInteraction,
@@ -26253,6 +26350,7 @@ var import_common68 = __toESM(require_dist());
26253
26350
  readI64LE,
26254
26351
  readSplMintSupply,
26255
26352
  reconcileManagerWalletBalances,
26353
+ reconciliationExternalValues,
26256
26354
  refreshLiveOraclePrices,
26257
26355
  resolveExternalWithdraw,
26258
26356
  resolveKeypairPath,
@@ -26280,6 +26378,7 @@ var import_common68 = __toESM(require_dist());
26280
26378
  validateSquadsWalletRoutes,
26281
26379
  variantName,
26282
26380
  vaultAuthorityForWallet,
26381
+ walletReconciliationGuardUpdates,
26283
26382
  withDiscoveredYieldAccounts,
26284
26383
  withVaultLookupTables,
26285
26384
  withdrawalComputeBudget
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perena/vault-sdk",
3
- "version": "1.0.63",
3
+ "version": "1.0.65",
4
4
  "description": "Vault program helpers for Bankineco integrations.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",