@perena/vault-sdk 1.0.63 → 1.0.64
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 +21 -13
- package/dist/index.js +59 -34
- package/package.json +1 -1
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
|
|
14427
|
+
/** Optional manager base balances, included on every pass by the live runtime. */
|
|
14428
14428
|
managerWalletBalances?: ManagerWalletBalanceSource;
|
|
14429
|
-
/** MPC base tokens and Marginfi deposits,
|
|
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
|
-
/**
|
|
14460
|
+
/** Observed manager base tokens (base units), independent of pending Nest. */
|
|
14461
14461
|
managerWalletAmount?: bigint;
|
|
14462
|
-
/** MPC base tokens
|
|
14462
|
+
/** Observed MPC base tokens (base units). */
|
|
14463
14463
|
mpcWalletAmount?: bigint;
|
|
14464
|
-
/** MPC Marginfi base-asset deposits
|
|
14464
|
+
/** Observed MPC Marginfi base-asset deposits (base units). */
|
|
14465
14465
|
mpcMarginfiAmount?: bigint;
|
|
14466
|
-
/** Withdrawn nPERENA retained until
|
|
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,21 @@ 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
|
-
/**
|
|
14864
|
+
/** @deprecated Wallet balances are now read on every pass. */
|
|
14865
14865
|
declare const MANAGER_WALLET_NAV_DROP_TRIGGER_BPS = 10n;
|
|
14866
|
-
/**
|
|
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;
|
|
14868
14870
|
/** Previous physical NAV, including banked APY, adjusted for recorded cash flows. */
|
|
14869
14871
|
declare function previousPhysicalNav(state: DecodedVault): bigint;
|
|
14870
14872
|
/** Same per-holding integer valuation as the program's gross_nav_from_holdings. */
|
|
14871
14873
|
declare function candidateGrossNav(state: DecodedVault, updates: readonly HoldingUpdatePreview[]): bigint;
|
|
14872
14874
|
interface ManagerWalletReconciliation {
|
|
14875
|
+
/** True only when wallet USDC replaces the carried pending Nest claim. */
|
|
14873
14876
|
accepted: boolean;
|
|
14877
|
+
/** Even zero balances must be rechecked before publishing a live report. */
|
|
14878
|
+
walletBalancesChecked: boolean;
|
|
14874
14879
|
updates: HoldingUpdatePreview[];
|
|
14875
14880
|
previousNav: bigint;
|
|
14876
14881
|
candidateNav: bigint;
|
|
@@ -14888,6 +14893,8 @@ declare function reconcileManagerWalletBalances({ vault, vaultState, updates, so
|
|
|
14888
14893
|
mpcSource?: MpcWalletBalanceSource;
|
|
14889
14894
|
log?: (message: string) => void;
|
|
14890
14895
|
}): Promise<ManagerWalletReconciliation>;
|
|
14896
|
+
/** Exempt only the matched Nest-to-USDC conversion from the per-asset guard. */
|
|
14897
|
+
declare function walletReconciliationGuardUpdates(state: DecodedVault, reconciliation: ManagerWalletReconciliation): HoldingUpdatePreview[];
|
|
14891
14898
|
/** The vault fields whose changes would invalidate a wallet reconciliation. */
|
|
14892
14899
|
declare function managerReconciliationStateKey(state: DecodedVault): string;
|
|
14893
14900
|
|
|
@@ -14970,8 +14977,9 @@ declare function discoverVaultsForSigner(client: VaultClient, signer: Keypair, o
|
|
|
14970
14977
|
|
|
14971
14978
|
/**
|
|
14972
14979
|
* Fail closed while any configured yield account has an unsettled payment.
|
|
14973
|
-
* Confirmed payments reduce tracked value
|
|
14974
|
-
*
|
|
14980
|
+
* Confirmed payments reduce tracked value. Proceeds in the manager or configured
|
|
14981
|
+
* MPC wallet are counted separately by wallet reconciliation; arbitrary payout
|
|
14982
|
+
* destinations are not discovered from payment records.
|
|
14975
14983
|
*/
|
|
14976
14984
|
declare function assertNoUnconfirmedYieldPayments(yieldTracker: YieldTracker | undefined, target: ConsensusOracleTarget): Promise<void>;
|
|
14977
14985
|
/**
|
|
@@ -15310,7 +15318,7 @@ declare function formatSettlementSimulation(simulation: SettlementSimulation): s
|
|
|
15310
15318
|
|
|
15311
15319
|
interface LiveConsensusOracleDepsOptions {
|
|
15312
15320
|
log?: (msg: string) => void;
|
|
15313
|
-
/** @deprecated Ignored.
|
|
15321
|
+
/** @deprecated Ignored. Manager-wallet balances are always included. */
|
|
15314
15322
|
rpcOnly?: boolean;
|
|
15315
15323
|
includeExternalPositions?: boolean;
|
|
15316
15324
|
}
|
|
@@ -15321,7 +15329,7 @@ interface RunLiveConsensusOracleOptions extends RunOptions {
|
|
|
15321
15329
|
rpcUrl?: string;
|
|
15322
15330
|
/** Override the vault program id. Defaults to the environment's configured program. */
|
|
15323
15331
|
programId?: Address;
|
|
15324
|
-
/** @deprecated Ignored.
|
|
15332
|
+
/** @deprecated Ignored. Manager-wallet balances are always included. */
|
|
15325
15333
|
rpcOnly?: boolean;
|
|
15326
15334
|
/** Include live Kamino/Marginfi positions in external amount updates. Defaults to true. */
|
|
15327
15335
|
includeExternalPositions?: boolean;
|
|
@@ -15771,4 +15779,4 @@ declare function collectVaultLookupTableAccounts(client: VaultClient, vault: Add
|
|
|
15771
15779
|
extraAccounts?: Address[];
|
|
15772
15780
|
}): Promise<Address[]>;
|
|
15773
15781
|
|
|
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 };
|
|
15782
|
+
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, 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, 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,
|
|
@@ -2320,6 +2321,7 @@ __export(index_exports, {
|
|
|
2320
2321
|
validateSquadsWalletRoutes: () => validateSquadsWalletRoutes,
|
|
2321
2322
|
variantName: () => variantName2,
|
|
2322
2323
|
vaultAuthorityForWallet: () => vaultAuthorityForWallet,
|
|
2324
|
+
walletReconciliationGuardUpdates: () => walletReconciliationGuardUpdates,
|
|
2323
2325
|
withDiscoveredYieldAccounts: () => withDiscoveredYieldAccounts,
|
|
2324
2326
|
withVaultLookupTables: () => withVaultLookupTables,
|
|
2325
2327
|
withdrawalComputeBudget: () => withdrawalComputeBudget
|
|
@@ -21491,6 +21493,7 @@ var NestPriceSource = class {
|
|
|
21491
21493
|
// src/services/consensusOracle/pipeline/managerWalletReconciliation.ts
|
|
21492
21494
|
var MANAGER_WALLET_NAV_DROP_TRIGGER_BPS = 10n;
|
|
21493
21495
|
var MANAGER_WALLET_NAV_TOLERANCE_BPS = 5n;
|
|
21496
|
+
var NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS = 500n;
|
|
21494
21497
|
var BPS = 10000n;
|
|
21495
21498
|
var U64_MAX2 = 0xffffffffffffffffn;
|
|
21496
21499
|
function previousPhysicalNav(state) {
|
|
@@ -21556,24 +21559,15 @@ async function reconcileManagerWalletBalances({
|
|
|
21556
21559
|
throw new Error("Manager reconciliation requires fresh source amounts");
|
|
21557
21560
|
}
|
|
21558
21561
|
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
21562
|
const candidateNav = candidateGrossNav(vaultState, updates);
|
|
21568
21563
|
const result = {
|
|
21569
21564
|
accepted: false,
|
|
21565
|
+
walletBalancesChecked: false,
|
|
21570
21566
|
updates: pendingUpdates,
|
|
21571
21567
|
previousNav,
|
|
21572
21568
|
candidateNav
|
|
21573
21569
|
};
|
|
21574
|
-
if (
|
|
21575
|
-
return result;
|
|
21576
|
-
}
|
|
21570
|
+
if (!source) return result;
|
|
21577
21571
|
const baseUpdates = updates.filter(
|
|
21578
21572
|
(update) => coerceBool3(vaultState.holdings[update.holdingIndex].isBase)
|
|
21579
21573
|
);
|
|
@@ -21594,7 +21588,7 @@ async function reconcileManagerWalletBalances({
|
|
|
21594
21588
|
throw new Error("Invalid manager wallet for NAV reconciliation");
|
|
21595
21589
|
}
|
|
21596
21590
|
log(
|
|
21597
|
-
`vault ${vault}:
|
|
21591
|
+
`vault ${vault}: checking manager ${manager} and configured MPC base balances`
|
|
21598
21592
|
);
|
|
21599
21593
|
const [amounts, mpc] = await Promise.all([
|
|
21600
21594
|
source.fetchBalances(manager, mints2),
|
|
@@ -21617,10 +21611,9 @@ async function reconcileManagerWalletBalances({
|
|
|
21617
21611
|
mpc?.marginfi.get(update.mint) ?? 0n,
|
|
21618
21612
|
"MPC Marginfi"
|
|
21619
21613
|
);
|
|
21620
|
-
|
|
21621
|
-
|
|
21622
|
-
|
|
21623
|
-
);
|
|
21614
|
+
log(
|
|
21615
|
+
`vault ${vault}: mint ${update.mint}: manager=${amount}` + (mpc ? ` MPC ${mpc.wallet}: tokens=${mpcTokens} marginfi=${mpcMarginfi}` : "")
|
|
21616
|
+
);
|
|
21624
21617
|
return {
|
|
21625
21618
|
...update,
|
|
21626
21619
|
managerWalletAmount: amount,
|
|
@@ -21628,21 +21621,52 @@ async function reconcileManagerWalletBalances({
|
|
|
21628
21621
|
externalAmount: update.externalAmount + amount + mpcTokens + mpcMarginfi
|
|
21629
21622
|
};
|
|
21630
21623
|
});
|
|
21631
|
-
const
|
|
21632
|
-
const
|
|
21624
|
+
const pendingNestValue = candidateGrossNav(vaultState, pendingUpdates) - candidateNav;
|
|
21625
|
+
const walletUsdcValue = candidateGrossNav(
|
|
21626
|
+
vaultState,
|
|
21627
|
+
updates.map(
|
|
21628
|
+
(update, index) => update.mint === USDC_MINT ? adjusted[index] : update
|
|
21629
|
+
)
|
|
21630
|
+
) - candidateNav;
|
|
21631
|
+
const delta = walletUsdcValue - pendingNestValue;
|
|
21633
21632
|
const absoluteDelta = delta < 0n ? -delta : delta;
|
|
21634
|
-
const accepted =
|
|
21633
|
+
const accepted = pendingNestValue > 0n && absoluteDelta * BPS <= pendingNestValue * NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS;
|
|
21634
|
+
const finalUpdates = accepted ? adjusted : retainPendingNestShares(vaultState, adjusted);
|
|
21635
|
+
const adjustedNav = candidateGrossNav(vaultState, finalUpdates);
|
|
21635
21636
|
log(
|
|
21636
|
-
`vault ${vault}:
|
|
21637
|
+
`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
21638
|
);
|
|
21638
21639
|
return {
|
|
21639
21640
|
accepted,
|
|
21640
|
-
|
|
21641
|
+
walletBalancesChecked: true,
|
|
21642
|
+
updates: finalUpdates,
|
|
21641
21643
|
previousNav,
|
|
21642
21644
|
candidateNav,
|
|
21643
21645
|
adjustedNav
|
|
21644
21646
|
};
|
|
21645
21647
|
}
|
|
21648
|
+
function walletReconciliationGuardUpdates(state, reconciliation) {
|
|
21649
|
+
if (!reconciliation.accepted) return reconciliation.updates;
|
|
21650
|
+
return reconciliation.updates.map((update) => {
|
|
21651
|
+
const previous = toBigInt2(
|
|
21652
|
+
state.holdings[update.holdingIndex].externalAmount
|
|
21653
|
+
);
|
|
21654
|
+
if (update.mint === NEST_RWA_SHARE_MINT) {
|
|
21655
|
+
return {
|
|
21656
|
+
...update,
|
|
21657
|
+
externalAmount: previous > update.externalAmount ? previous : update.externalAmount
|
|
21658
|
+
};
|
|
21659
|
+
}
|
|
21660
|
+
if (update.mint !== USDC_MINT || update.externalAmount <= previous)
|
|
21661
|
+
return update;
|
|
21662
|
+
const walletAmount = (update.managerWalletAmount ?? 0n) + (update.mpcWalletAmount ?? 0n) + (update.mpcMarginfiAmount ?? 0n);
|
|
21663
|
+
const increase = update.externalAmount - previous;
|
|
21664
|
+
return {
|
|
21665
|
+
...update,
|
|
21666
|
+
externalAmount: update.externalAmount - (walletAmount < increase ? walletAmount : increase)
|
|
21667
|
+
};
|
|
21668
|
+
});
|
|
21669
|
+
}
|
|
21646
21670
|
function managerReconciliationStateKey(state) {
|
|
21647
21671
|
return JSON.stringify({
|
|
21648
21672
|
manager: (0, import_common55.fromWeb3Pk)(state.roles.manager),
|
|
@@ -23903,20 +23927,19 @@ var ConsensusOracleService = class {
|
|
|
23903
23927
|
log
|
|
23904
23928
|
});
|
|
23905
23929
|
const updates = reconciliation.updates;
|
|
23906
|
-
const needsRevalidation = reconciliation.
|
|
23930
|
+
const needsRevalidation = reconciliation.walletBalancesChecked || // A new withdrawal can be queued after the first vault read, too.
|
|
23907
23931
|
updates.some((update) => update.mint === NEST_RWA_SHARE_MINT);
|
|
23908
23932
|
const reconciliationStateKey = needsRevalidation ? managerReconciliationStateKey(vaultState) : void 0;
|
|
23909
|
-
|
|
23910
|
-
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23915
|
-
|
|
23916
|
-
|
|
23917
|
-
} else {
|
|
23933
|
+
assertNoLargeBalanceChanges(
|
|
23934
|
+
target.vault,
|
|
23935
|
+
vaultState,
|
|
23936
|
+
walletReconciliationGuardUpdates(vaultState, reconciliation),
|
|
23937
|
+
this.nowSecs(),
|
|
23938
|
+
log
|
|
23939
|
+
);
|
|
23940
|
+
if (reconciliation.accepted) {
|
|
23918
23941
|
log(
|
|
23919
|
-
`vault ${target.vault}:
|
|
23942
|
+
`vault ${target.vault}: wallet USDC matches pending Nest within \xB15%; allowing that conversion's external balance changes`
|
|
23920
23943
|
);
|
|
23921
23944
|
}
|
|
23922
23945
|
if (dryRun) {
|
|
@@ -23977,7 +24000,7 @@ var ConsensusOracleService = class {
|
|
|
23977
24000
|
"Vault changed during manager-wallet reconciliation; retry with fresh inputs"
|
|
23978
24001
|
);
|
|
23979
24002
|
}
|
|
23980
|
-
if (!reconciliation.
|
|
24003
|
+
if (!reconciliation.walletBalancesChecked) return;
|
|
23981
24004
|
const fresh = await reconcileManagerWalletBalances({
|
|
23982
24005
|
vault: target.vault,
|
|
23983
24006
|
vaultState: freshState,
|
|
@@ -23985,7 +24008,7 @@ var ConsensusOracleService = class {
|
|
|
23985
24008
|
source: this.deps.managerWalletBalances,
|
|
23986
24009
|
mpcSource: this.deps.mpcWalletBalances
|
|
23987
24010
|
});
|
|
23988
|
-
if (!fresh.accepted || fresh.updates.some(
|
|
24011
|
+
if (!fresh.walletBalancesChecked || fresh.accepted !== reconciliation.accepted || fresh.updates.some(
|
|
23989
24012
|
(update, index) => update.externalAmount !== updates[index].externalAmount || update.managerWalletAmount !== updates[index].managerWalletAmount || update.mpcWalletAmount !== updates[index].mpcWalletAmount || update.mpcMarginfiAmount !== updates[index].mpcMarginfiAmount
|
|
23990
24013
|
)) {
|
|
23991
24014
|
throw new Error(
|
|
@@ -26093,6 +26116,7 @@ var import_common68 = __toESM(require_dist());
|
|
|
26093
26116
|
NEST_API_BASE_URL,
|
|
26094
26117
|
NEST_RWA_SHARE_MINT,
|
|
26095
26118
|
NEST_VAULT_SLUG,
|
|
26119
|
+
NEST_WITHDRAWAL_MATCH_TOLERANCE_BPS,
|
|
26096
26120
|
NestApiError,
|
|
26097
26121
|
NestPriceSource,
|
|
26098
26122
|
ORACLE_ENTRIES_OFFSET,
|
|
@@ -26280,6 +26304,7 @@ var import_common68 = __toESM(require_dist());
|
|
|
26280
26304
|
validateSquadsWalletRoutes,
|
|
26281
26305
|
variantName,
|
|
26282
26306
|
vaultAuthorityForWallet,
|
|
26307
|
+
walletReconciliationGuardUpdates,
|
|
26283
26308
|
withDiscoveredYieldAccounts,
|
|
26284
26309
|
withVaultLookupTables,
|
|
26285
26310
|
withdrawalComputeBudget
|