@perena/vault-sdk 1.0.36 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +49 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -191,7 +191,13 @@ transaction and proposal. The member signs and submits that outer transaction;
|
|
|
191
191
|
the multisig must still approve and execute the proposal. When no route matches,
|
|
192
192
|
the helper returns the original instructions as a normal direct transaction.
|
|
193
193
|
The configured member must have Squads' `Initiate` permission, and the vault
|
|
194
|
-
program role must be assigned to the derived Squads vault PDA.
|
|
194
|
+
program role must be assigned to the derived Squads vault PDA. Before returning
|
|
195
|
+
a Squads transaction, `prepareVaultTransaction` simulates the inner instructions
|
|
196
|
+
with signature verification disabled so the derived vault PDA has the signer
|
|
197
|
+
privileges it will receive during execution. A failed simulation throws
|
|
198
|
+
`SquadsProposalExecutionSimulationError`, including the RPC error and program
|
|
199
|
+
logs. This dry run validates current program and account state, but not proposal
|
|
200
|
+
approvals or the Squads execution wrapper.
|
|
195
201
|
|
|
196
202
|
`VaultTransactionPlan` contains:
|
|
197
203
|
|
package/dist/index.d.ts
CHANGED
|
@@ -15115,6 +15115,13 @@ interface PreparedSquadsTransaction {
|
|
|
15115
15115
|
vaultTransactionPda: PublicKey;
|
|
15116
15116
|
}
|
|
15117
15117
|
type PreparedVaultTransaction = PreparedDirectTransaction | PreparedSquadsTransaction;
|
|
15118
|
+
type SquadsSimulationTransactionError = NonNullable<SimulatedTransactionResponse["err"]>;
|
|
15119
|
+
declare class SquadsProposalExecutionSimulationError extends Error {
|
|
15120
|
+
readonly transactionError: SquadsSimulationTransactionError;
|
|
15121
|
+
readonly logs: string[];
|
|
15122
|
+
readonly unitsConsumed?: number;
|
|
15123
|
+
constructor(transactionError: SquadsSimulationTransactionError, logs: readonly string[], unitsConsumed?: number);
|
|
15124
|
+
}
|
|
15118
15125
|
/** Resolve and validate a configured wallet route, including its vault PDA. */
|
|
15119
15126
|
declare function resolveSquadsWalletRoute(route: SquadsWalletRouteConfig): ResolvedSquadsWalletRoute;
|
|
15120
15127
|
/** Find the optional Squads route for a connected proposer wallet. */
|
|
@@ -15127,6 +15134,24 @@ declare function validateSquadsWalletRoutes(routes: readonly SquadsWalletRouteCo
|
|
|
15127
15134
|
* the wallet itself.
|
|
15128
15135
|
*/
|
|
15129
15136
|
declare function vaultAuthorityForWallet(wallet: PublicKey | string, routes: readonly SquadsWalletRouteConfig[]): PublicKey;
|
|
15137
|
+
/**
|
|
15138
|
+
* Simulate the instructions stored in a Squads proposal before creating it.
|
|
15139
|
+
*
|
|
15140
|
+
* Signature verification is intentionally disabled so the runtime treats the
|
|
15141
|
+
* Squads vault PDA's signer account meta as signed, matching the privileges it
|
|
15142
|
+
* receives from Squads' eventual `invoke_signed` execution. This validates the
|
|
15143
|
+
* inner instructions against current chain state; it does not validate Squads
|
|
15144
|
+
* approvals or the execution wrapper itself.
|
|
15145
|
+
*
|
|
15146
|
+
* Throws {@link SquadsProposalExecutionSimulationError} when the simulated
|
|
15147
|
+
* instructions fail.
|
|
15148
|
+
*/
|
|
15149
|
+
declare function simulateSquadsProposalExecution(args: {
|
|
15150
|
+
connection: Connection;
|
|
15151
|
+
feePayer: PublicKey;
|
|
15152
|
+
instructions: readonly TransactionInstruction[];
|
|
15153
|
+
recentBlockhash?: string;
|
|
15154
|
+
}): Promise<SimulatedTransactionResponse>;
|
|
15130
15155
|
/**
|
|
15131
15156
|
* Build either a normal transaction or a Squads proposal-creation transaction,
|
|
15132
15157
|
* based on whether `proposer` has a configured wallet route.
|
|
@@ -16726,4 +16751,4 @@ declare class IdleLiquidityService {
|
|
|
16726
16751
|
private executeSwap;
|
|
16727
16752
|
}
|
|
16728
16753
|
|
|
16729
|
-
export { ASSET_DECIMALS, ASSET_REBALANCE_COOLDOWN_SECS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AddAprCashflowUpdateParams, type AddCashflowUpdateParams, 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, CONSENSUS_ORACLE_VARIANT, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, 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, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_CU_PRICE_MICRO_LAMPORTS, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_MAX_ACCOUNTS, 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_VAULT_ID, type DecodedHolding, type DecodedVault, type DecodedVaultTrancheState, type DeleteAccountParams, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, EXTERNAL_POSITION_SAMPLES, 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, IDL, IDLE_RESERVE_FLOOR_BPS, IDLE_RESERVE_TARGET_BPS, type IdleLiquidityOptions, type IdleLiquidityResult, IdleLiquidityService, type IdleLiquidityStatus, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterBalanceSource, type JupiterBalanceSourceOptions, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoPositionProvider, LIVE_ORACLE_VARIANTS, LIVE_PRICE_REFRESH_INTERVAL_SECS, LOCAL_PROTOCOL_ADMIN, LargeBalanceChangeError, type LargeBalanceChangeViolation, type LiveConsensusOracleDepsOptions, LivePriceSource, type LivePriceSourceOptions, MAX_BALANCE_CHANGE_BPS, MAX_CONSENSUS_SIGNERS, MAX_MANAGER_WITHDRAW_DESTINATIONS, MAX_PRICE_STALENESS_THRESHOLD_SECS, MIN_EXTERNAL_POSITION_SAMPLES, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MintConfig, type MintIdentifier, type MintInfo, MintRegistry, type MintRegistryOptions, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, 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 NavYieldAccount, NestPriceSource, type NestPriceSourceOptions, 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, PdaClient, type PreparedDirectTransaction, type PreparedSquadsTransaction, type PreparedVaultTransaction, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, REPORTABLE_ORACLE_VARIANTS, type RefreshLiveOraclePricesParams, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type ResolvedSquadsWalletRoute, type RollingLimitConfig, type RollingRebalanceLimitConfig, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SYSTEM_PROGRAM, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, SetManagerWithdrawDestinationBuilder, type SetManagerWithdrawDestinationIxArgs, type SetManagerWithdrawDestinationTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, type SettleVaultParams, type SettleVaultResult, type SettlementSimulation, type SettlementSimulationSnapshot, type SimulateDryRunSettlementParams, type SimulateSettlementArgs, type SimulatedShareClass, type SquadsWalletRouteConfig, type StaleBalanceChangeBypass, StaticPositionProvider, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, 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_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 VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, type WalletBalanceSource, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, type WithdrawTrancheFeesIxArgs, type WithdrawTrancheFeesTxArgs, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldCashflow, type YieldPaymentResponse, type YieldPaymentSnapshot, type YieldTracker, type YieldValuationModel, accountingUnitPriceToUsd, addCashflowUpdate, applyEffectiveApy, assertNoLargeBalanceChanges, assertNoUnconfirmedYieldPayments, buildHoldingUpdate, buildUpdates, coerceBool, collectSamples, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, defaultKeypairPath, deleteAccount, discoverVaultsForSigner, fetchExternalPositions, fetchNestTokenPrice, fetchReceiptMints, filterTargetHoldings, findLargeBalanceChanges, findSquadsWalletRoute, formatSettlementSimulation, fromUiAmount, gatherPricingInputs, getAccount, getAccounts, getAprYield, getBalance, getCashflows, getNavValue, getRpcUrl, getTotalOutstandingYield, getTotalTrackedValue, getTotalYield, getTrackedValue, getVaultProgramId, getYield, getYieldPayments, indexConfigByMint, isNavAccountBalance, isNavAccountValue, isNavYieldAccount, isVaultEnv, keypairAddress, loadKeypair, logProspectiveApy, makeProvider, mintTokensTo, mints, mostFrequent, parseExternalLiquidityRefs, planRebalance, prepareVaultTransaction, priceInAccountingUnit, readI64LE, readSplMintSupply, refreshLiveOraclePrices, resolveKeypairPath, resolveSquadsWalletRoute, resolveTrackedAmounts, roundToNextUtcMidnight, runLiveConsensusOracle, selectReportableHoldings, settleVault, signerInOracleData, simulateConsensusOracleSettlement, simulateDryRunSettlement, sumPositionsByMint, systemClock, toBigInt, toUiAmount, trackedValueFromResponse, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, variantName, vaultAuthorityForWallet, withDiscoveredYieldAccounts };
|
|
16754
|
+
export { ASSET_DECIMALS, ASSET_REBALANCE_COOLDOWN_SECS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AddAprCashflowUpdateParams, type AddCashflowUpdateParams, 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, CONSENSUS_ORACLE_VARIANT, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, 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, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_CU_PRICE_MICRO_LAMPORTS, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_MAX_ACCOUNTS, 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_VAULT_ID, type DecodedHolding, type DecodedVault, type DecodedVaultTrancheState, type DeleteAccountParams, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, EXTERNAL_POSITION_SAMPLES, 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, IDL, IDLE_RESERVE_FLOOR_BPS, IDLE_RESERVE_TARGET_BPS, type IdleLiquidityOptions, type IdleLiquidityResult, IdleLiquidityService, type IdleLiquidityStatus, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterBalanceSource, type JupiterBalanceSourceOptions, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoPositionProvider, LIVE_ORACLE_VARIANTS, LIVE_PRICE_REFRESH_INTERVAL_SECS, LOCAL_PROTOCOL_ADMIN, LargeBalanceChangeError, type LargeBalanceChangeViolation, type LiveConsensusOracleDepsOptions, LivePriceSource, type LivePriceSourceOptions, MAX_BALANCE_CHANGE_BPS, MAX_CONSENSUS_SIGNERS, MAX_MANAGER_WITHDRAW_DESTINATIONS, MAX_PRICE_STALENESS_THRESHOLD_SECS, MIN_EXTERNAL_POSITION_SAMPLES, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MintConfig, type MintIdentifier, type MintInfo, MintRegistry, type MintRegistryOptions, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, 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 NavYieldAccount, NestPriceSource, type NestPriceSourceOptions, 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, PdaClient, type PreparedDirectTransaction, type PreparedSquadsTransaction, type PreparedVaultTransaction, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, REPORTABLE_ORACLE_VARIANTS, type RefreshLiveOraclePricesParams, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type ResolvedSquadsWalletRoute, type RollingLimitConfig, type RollingRebalanceLimitConfig, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SYSTEM_PROGRAM, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, SetManagerWithdrawDestinationBuilder, type SetManagerWithdrawDestinationIxArgs, type SetManagerWithdrawDestinationTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, type SettleVaultParams, type SettleVaultResult, type SettlementSimulation, type SettlementSimulationSnapshot, type SimulateDryRunSettlementParams, type SimulateSettlementArgs, type SimulatedShareClass, SquadsProposalExecutionSimulationError, type SquadsWalletRouteConfig, type StaleBalanceChangeBypass, StaticPositionProvider, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, 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_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 VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, type WalletBalanceSource, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, type WithdrawTrancheFeesIxArgs, type WithdrawTrancheFeesTxArgs, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldCashflow, type YieldPaymentResponse, type YieldPaymentSnapshot, type YieldTracker, type YieldValuationModel, accountingUnitPriceToUsd, addCashflowUpdate, applyEffectiveApy, assertNoLargeBalanceChanges, assertNoUnconfirmedYieldPayments, buildHoldingUpdate, buildUpdates, coerceBool, collectSamples, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, defaultKeypairPath, deleteAccount, discoverVaultsForSigner, fetchExternalPositions, fetchNestTokenPrice, fetchReceiptMints, filterTargetHoldings, findLargeBalanceChanges, findSquadsWalletRoute, formatSettlementSimulation, fromUiAmount, gatherPricingInputs, getAccount, getAccounts, getAprYield, getBalance, getCashflows, getNavValue, getRpcUrl, getTotalOutstandingYield, getTotalTrackedValue, getTotalYield, getTrackedValue, getVaultProgramId, getYield, getYieldPayments, indexConfigByMint, isNavAccountBalance, isNavAccountValue, isNavYieldAccount, isVaultEnv, keypairAddress, loadKeypair, logProspectiveApy, makeProvider, mintTokensTo, mints, mostFrequent, parseExternalLiquidityRefs, planRebalance, prepareVaultTransaction, priceInAccountingUnit, readI64LE, readSplMintSupply, refreshLiveOraclePrices, resolveKeypairPath, resolveSquadsWalletRoute, resolveTrackedAmounts, roundToNextUtcMidnight, runLiveConsensusOracle, selectReportableHoldings, settleVault, signerInOracleData, simulateConsensusOracleSettlement, simulateDryRunSettlement, simulateSquadsProposalExecution, sumPositionsByMint, systemClock, toBigInt, toUiAmount, trackedValueFromResponse, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, variantName, vaultAuthorityForWallet, withDiscoveredYieldAccounts };
|
package/dist/index.js
CHANGED
|
@@ -3335,6 +3335,7 @@ __export(index_exports, {
|
|
|
3335
3335
|
SetManagerWithdrawDestinationBuilder: () => SetManagerWithdrawDestinationBuilder,
|
|
3336
3336
|
SetProtocolFeeBuilder: () => SetProtocolFeeBuilder,
|
|
3337
3337
|
SetVaultConfigBuilder: () => SetVaultConfigBuilder,
|
|
3338
|
+
SquadsProposalExecutionSimulationError: () => SquadsProposalExecutionSimulationError,
|
|
3338
3339
|
StaticPositionProvider: () => StaticPositionProvider,
|
|
3339
3340
|
TOKEN_PROGRAM: () => TOKEN_PROGRAM,
|
|
3340
3341
|
TOKEN_PROGRAM_ID: () => TOKEN_PROGRAM_ID,
|
|
@@ -3436,6 +3437,7 @@ __export(index_exports, {
|
|
|
3436
3437
|
signerInOracleData: () => signerInOracleData,
|
|
3437
3438
|
simulateConsensusOracleSettlement: () => simulateConsensusOracleSettlement,
|
|
3438
3439
|
simulateDryRunSettlement: () => simulateDryRunSettlement,
|
|
3440
|
+
simulateSquadsProposalExecution: () => simulateSquadsProposalExecution,
|
|
3439
3441
|
sumPositionsByMint: () => sumPositionsByMint,
|
|
3440
3442
|
systemClock: () => systemClock,
|
|
3441
3443
|
toBigInt: () => toBigInt2,
|
|
@@ -19999,6 +20001,22 @@ function makeProvider(connection, payer) {
|
|
|
19999
20001
|
// src/utils/squads.ts
|
|
20000
20002
|
var squads = __toESM(require("@sqds/multisig"));
|
|
20001
20003
|
var import_web321 = require("@solana/web3.js");
|
|
20004
|
+
var SQUADS_SIMULATION_COMMITMENT = "processed";
|
|
20005
|
+
var SquadsProposalExecutionSimulationError = class extends Error {
|
|
20006
|
+
constructor(transactionError, logs, unitsConsumed) {
|
|
20007
|
+
const programLogs = logs.length > 0 ? `
|
|
20008
|
+
${logs.join("\n")}` : "";
|
|
20009
|
+
super(
|
|
20010
|
+
`Squads proposal execution simulation failed: ${JSON.stringify(
|
|
20011
|
+
transactionError
|
|
20012
|
+
)}${programLogs}`
|
|
20013
|
+
);
|
|
20014
|
+
this.name = "SquadsProposalExecutionSimulationError";
|
|
20015
|
+
this.transactionError = transactionError;
|
|
20016
|
+
this.logs = [...logs];
|
|
20017
|
+
this.unitsConsumed = unitsConsumed;
|
|
20018
|
+
}
|
|
20019
|
+
};
|
|
20002
20020
|
function validateVaultIndex(vaultIndex) {
|
|
20003
20021
|
if (!Number.isSafeInteger(vaultIndex) || vaultIndex < 0) {
|
|
20004
20022
|
throw new Error("Squads vaultIndex must be a non-negative safe integer");
|
|
@@ -20036,6 +20054,29 @@ function vaultAuthorityForWallet(wallet, routes) {
|
|
|
20036
20054
|
const walletKey = typeof wallet === "string" ? new import_web321.PublicKey(wallet) : wallet;
|
|
20037
20055
|
return findSquadsWalletRoute(walletKey, routes)?.vaultPda ?? walletKey;
|
|
20038
20056
|
}
|
|
20057
|
+
async function simulateSquadsProposalExecution(args) {
|
|
20058
|
+
const { connection, feePayer, instructions: instructions2 } = args;
|
|
20059
|
+
const recentBlockhash = args.recentBlockhash ?? (await connection.getLatestBlockhash(SQUADS_SIMULATION_COMMITMENT)).blockhash;
|
|
20060
|
+
const message2 = new import_web321.TransactionMessage({
|
|
20061
|
+
payerKey: feePayer,
|
|
20062
|
+
recentBlockhash,
|
|
20063
|
+
instructions: [...instructions2]
|
|
20064
|
+
}).compileToV0Message();
|
|
20065
|
+
const transaction = new import_web321.VersionedTransaction(message2);
|
|
20066
|
+
const { value } = await connection.simulateTransaction(transaction, {
|
|
20067
|
+
sigVerify: false,
|
|
20068
|
+
commitment: SQUADS_SIMULATION_COMMITMENT,
|
|
20069
|
+
innerInstructions: true
|
|
20070
|
+
});
|
|
20071
|
+
if (value.err) {
|
|
20072
|
+
throw new SquadsProposalExecutionSimulationError(
|
|
20073
|
+
value.err,
|
|
20074
|
+
value.logs ?? [],
|
|
20075
|
+
value.unitsConsumed
|
|
20076
|
+
);
|
|
20077
|
+
}
|
|
20078
|
+
return value;
|
|
20079
|
+
}
|
|
20039
20080
|
async function prepareVaultTransaction(args) {
|
|
20040
20081
|
const { connection, proposer, instructions: instructions2 } = args;
|
|
20041
20082
|
const route = findSquadsWalletRoute(proposer, args.squadsRoutes ?? []);
|
|
@@ -20068,6 +20109,12 @@ async function prepareVaultTransaction(args) {
|
|
|
20068
20109
|
}
|
|
20069
20110
|
const transactionIndex = BigInt(multisig.transactionIndex.toString()) + 1n;
|
|
20070
20111
|
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
20112
|
+
await simulateSquadsProposalExecution({
|
|
20113
|
+
connection,
|
|
20114
|
+
feePayer: proposer,
|
|
20115
|
+
instructions: instructions2,
|
|
20116
|
+
recentBlockhash: blockhash
|
|
20117
|
+
});
|
|
20071
20118
|
const transactionMessage = new import_web321.TransactionMessage({
|
|
20072
20119
|
payerKey: route.vaultPda,
|
|
20073
20120
|
recentBlockhash: blockhash,
|
|
@@ -24239,6 +24286,7 @@ var import_common53 = __toESM(require_dist());
|
|
|
24239
24286
|
SetManagerWithdrawDestinationBuilder,
|
|
24240
24287
|
SetProtocolFeeBuilder,
|
|
24241
24288
|
SetVaultConfigBuilder,
|
|
24289
|
+
SquadsProposalExecutionSimulationError,
|
|
24242
24290
|
StaticPositionProvider,
|
|
24243
24291
|
TOKEN_PROGRAM,
|
|
24244
24292
|
TOKEN_PROGRAM_ID,
|
|
@@ -24340,6 +24388,7 @@ var import_common53 = __toESM(require_dist());
|
|
|
24340
24388
|
signerInOracleData,
|
|
24341
24389
|
simulateConsensusOracleSettlement,
|
|
24342
24390
|
simulateDryRunSettlement,
|
|
24391
|
+
simulateSquadsProposalExecution,
|
|
24343
24392
|
sumPositionsByMint,
|
|
24344
24393
|
systemClock,
|
|
24345
24394
|
toBigInt,
|