@perena/vault-sdk 1.0.41 → 1.0.42
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 +12 -64
- package/dist/index.js +113 -185
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -11345,7 +11345,10 @@ declare class VaultClient {
|
|
|
11345
11345
|
readonly account: AccountClient;
|
|
11346
11346
|
readonly tx: TransactionClient;
|
|
11347
11347
|
readonly quote: VaultQuoteClient;
|
|
11348
|
-
|
|
11348
|
+
readonly skipSimulation: boolean;
|
|
11349
|
+
constructor(provider: AnchorProvider, programId?: Address, options?: {
|
|
11350
|
+
skipSimulation?: boolean;
|
|
11351
|
+
});
|
|
11349
11352
|
/**
|
|
11350
11353
|
* Sign, send, and confirm a transaction plan built from {@link TransactionClient}.
|
|
11351
11354
|
* Pass `extraSigners` for accounts created in the same tx (e.g. a new share mint).
|
|
@@ -11401,6 +11404,8 @@ declare function loadKeypair(keypairPath: string): Keypair;
|
|
|
11401
11404
|
*/
|
|
11402
11405
|
declare function defaultKeypairPath(env: VaultEnv, role?: string): string;
|
|
11403
11406
|
interface CreateVaultClientOptions {
|
|
11407
|
+
/** Skip optional transaction simulations and RPC send preflight. */
|
|
11408
|
+
skipSimulation?: boolean;
|
|
11404
11409
|
/** Explicit RPC endpoint; otherwise resolved from env vars. */
|
|
11405
11410
|
rpcUrl?: string;
|
|
11406
11411
|
/** Keypair file path; defaults to {@link defaultKeypairPath}. Ignored if `keypair` is set. */
|
|
@@ -11982,7 +11987,7 @@ declare class OracleService {
|
|
|
11982
11987
|
* The orchestrator ({@link ConsensusOracleService}) depends only on these
|
|
11983
11988
|
* interfaces, so it carries no network/RPC/protocol dependencies of its own and
|
|
11984
11989
|
* can be unit-tested with in-memory fakes. Concrete implementations
|
|
11985
|
-
* (
|
|
11990
|
+
* (price feeds, the mock yield tracker, live-LP providers) are
|
|
11986
11991
|
* injected by the caller.
|
|
11987
11992
|
*/
|
|
11988
11993
|
|
|
@@ -11994,10 +11999,6 @@ interface PriceSource {
|
|
|
11994
11999
|
*/
|
|
11995
12000
|
fetchUsdPrices(mints: Address[]): Promise<Record<string, number>>;
|
|
11996
12001
|
}
|
|
11997
|
-
/** Supplies an owner's SPL token balances (raw base units), keyed by mint. */
|
|
11998
|
-
interface WalletBalanceSource {
|
|
11999
|
-
fetchBalances(owner: Address): Promise<Record<string, bigint>>;
|
|
12000
|
-
}
|
|
12001
12002
|
/** A balance deployed outside vault-owned token accounts, in the mint's base units. */
|
|
12002
12003
|
interface ExternalPosition {
|
|
12003
12004
|
mint: Address;
|
|
@@ -12015,8 +12016,6 @@ interface ExternalPositionRef {
|
|
|
12015
12016
|
}
|
|
12016
12017
|
interface ExternalPositionContext {
|
|
12017
12018
|
vault: Address;
|
|
12018
|
-
/** The vault's manager wallet (positions are usually held against it). */
|
|
12019
|
-
manager: Address;
|
|
12020
12019
|
/** Position descriptors gathered from the target config for this vault. */
|
|
12021
12020
|
refs: ExternalPositionRef[];
|
|
12022
12021
|
}
|
|
@@ -12099,7 +12098,6 @@ interface ConsensusOracleTarget {
|
|
|
12099
12098
|
/** Injected collaborators for {@link ConsensusOracleService}. */
|
|
12100
12099
|
interface ConsensusOracleDeps {
|
|
12101
12100
|
priceSource: PriceSource;
|
|
12102
|
-
balanceSource: WalletBalanceSource;
|
|
12103
12101
|
/** Optional; omitted ⇒ no live-LP balances are folded in. */
|
|
12104
12102
|
externalPositions?: ExternalPositionProvider;
|
|
12105
12103
|
/** Optional; omitted ⇒ no yield accrual is folded in. */
|
|
@@ -12123,8 +12121,6 @@ interface HoldingUpdatePreview {
|
|
|
12123
12121
|
usdPrice: number;
|
|
12124
12122
|
/** Price in the vault's accounting unit, fixed-point (scaled by assetDecimals). */
|
|
12125
12123
|
price: bigint;
|
|
12126
|
-
/** Manager-wallet balance of this mint (base units). */
|
|
12127
|
-
walletAmount: bigint;
|
|
12128
12124
|
/** Summed live-LP positions for this mint (base units). */
|
|
12129
12125
|
lpAmount: bigint;
|
|
12130
12126
|
/** Accrued yield attributed to this holding (base units). */
|
|
@@ -12133,7 +12129,7 @@ interface HoldingUpdatePreview {
|
|
|
12133
12129
|
trackedPrincipalAmount: bigint;
|
|
12134
12130
|
/** Complete tracked value, including NAV accounts (base units). */
|
|
12135
12131
|
trackedValueAmount: bigint;
|
|
12136
|
-
/** Total external balance pushed =
|
|
12132
|
+
/** Total external balance pushed = LP + complete tracked value. */
|
|
12137
12133
|
externalAmount: bigint;
|
|
12138
12134
|
}
|
|
12139
12135
|
interface VaultOracleResult {
|
|
@@ -12283,6 +12279,8 @@ interface SettlementSimulation {
|
|
|
12283
12279
|
* until the vault config is updated.
|
|
12284
12280
|
*/
|
|
12285
12281
|
projectionRequiresMaxApyDisabled?: boolean;
|
|
12282
|
+
/** Hypothetical projection with losses enabled; the real crank remains blocked. */
|
|
12283
|
+
projectionRequiresLossesEnabled?: boolean;
|
|
12286
12284
|
projected?: SettlementSimulationSnapshot;
|
|
12287
12285
|
performanceFees?: {
|
|
12288
12286
|
curator: bigint;
|
|
@@ -12301,7 +12299,6 @@ interface VaultPricingInputs {
|
|
|
12301
12299
|
assetDecimals: number;
|
|
12302
12300
|
baseUsd: number;
|
|
12303
12301
|
usdPrices: Record<string, number>;
|
|
12304
|
-
walletBalances: Record<string, bigint>;
|
|
12305
12302
|
lpByMint: Map<string, bigint>;
|
|
12306
12303
|
configByMint: Map<string, ConsensusOracleHoldingConfig>;
|
|
12307
12304
|
}
|
|
@@ -12425,7 +12422,6 @@ interface LargeBalanceChangeViolation {
|
|
|
12425
12422
|
valueChange: bigint;
|
|
12426
12423
|
tvl: bigint;
|
|
12427
12424
|
thresholdBps: bigint;
|
|
12428
|
-
walletAmount: bigint;
|
|
12429
12425
|
lpAmount: bigint;
|
|
12430
12426
|
trackedPrincipalAmount: bigint;
|
|
12431
12427
|
trackedValueAmount: bigint;
|
|
@@ -12489,11 +12485,6 @@ interface RefreshLiveOraclePricesParams {
|
|
|
12489
12485
|
/** Returns true when at least one price was actually refreshed on-chain. */
|
|
12490
12486
|
declare function refreshLiveOraclePrices({ oracle, signer, vault, vaultState, nowSecs, log, dryRun, }: RefreshLiveOraclePricesParams): Promise<boolean>;
|
|
12491
12487
|
|
|
12492
|
-
/**
|
|
12493
|
-
* Sourcing step: fetch every external input the per-holding updates draw on —
|
|
12494
|
-
* USD spot prices, manager wallet balances, and live external LP positions.
|
|
12495
|
-
*/
|
|
12496
|
-
|
|
12497
12488
|
declare function gatherPricingInputs(deps: ConsensusOracleDeps, target: ConsensusOracleTarget, vaultState: DecodedVault, reportableHoldings: ConsensusHoldingEntry[], log?: (msg: string) => void): Promise<VaultPricingInputs>;
|
|
12498
12489
|
/**
|
|
12499
12490
|
* Live-LP balances for the target, summed by mint (empty if no provider).
|
|
@@ -12503,7 +12494,7 @@ declare function gatherPricingInputs(deps: ConsensusOracleDeps, target: Consensu
|
|
|
12503
12494
|
* or hit a lagging RPC node, and this value is reported on-chain as
|
|
12504
12495
|
* `external_amount`.
|
|
12505
12496
|
*/
|
|
12506
|
-
declare function fetchExternalPositions(deps: ConsensusOracleDeps, target: ConsensusOracleTarget,
|
|
12497
|
+
declare function fetchExternalPositions(deps: ConsensusOracleDeps, target: ConsensusOracleTarget, vaultState: DecodedVault, log?: (msg: string) => void): Promise<Map<string, bigint>>;
|
|
12507
12498
|
|
|
12508
12499
|
/**
|
|
12509
12500
|
* Receipt mints issued by a vault are liabilities/shares, not underlying assets
|
|
@@ -12581,24 +12572,6 @@ declare function assertNoUnconfirmedYieldPayments(yieldTracker: YieldTracker | u
|
|
|
12581
12572
|
*/
|
|
12582
12573
|
declare function withDiscoveredYieldAccounts(yieldTracker: YieldTracker | undefined, target: ConsensusOracleTarget, vaultState: DecodedVault, excludedMints: ReadonlySet<string>, log: (msg: string) => void): Promise<ConsensusOracleTarget>;
|
|
12583
12574
|
|
|
12584
|
-
/**
|
|
12585
|
-
* Wallet token balances, from the Jupiter Ultra balances API with an on-chain
|
|
12586
|
-
* RPC fallback.
|
|
12587
|
-
*
|
|
12588
|
-
* Jupiter: GET https://lite-api.jup.ag/ultra/v1/balances/{owner}
|
|
12589
|
-
* → { "<mint>": { amount, uiAmount, slot, isFrozen }, "SOL": {…} }
|
|
12590
|
-
* RPC: `getParsedTokenAccountsByOwner` over the SPL Token and Token-2022
|
|
12591
|
-
* programs, summed per mint.
|
|
12592
|
-
*
|
|
12593
|
-
* Amounts are raw base units in both paths — no decimal conversion is applied.
|
|
12594
|
-
* Native SOL is skipped; these are SPL holdings only.
|
|
12595
|
-
*/
|
|
12596
|
-
|
|
12597
|
-
interface FetchJupiterBalancesOptions {
|
|
12598
|
-
baseUrl?: string;
|
|
12599
|
-
fetchFn?: typeof fetch;
|
|
12600
|
-
}
|
|
12601
|
-
|
|
12602
12575
|
/**
|
|
12603
12576
|
* Jupiter price API (`GET /price/v3`).
|
|
12604
12577
|
*
|
|
@@ -12682,28 +12655,6 @@ declare class LivePriceSource implements PriceSource {
|
|
|
12682
12655
|
fetchUsdPrices(mints: Address[]): Promise<Record<string, number>>;
|
|
12683
12656
|
}
|
|
12684
12657
|
|
|
12685
|
-
/**
|
|
12686
|
-
* {@link WalletBalanceSource} adapter over the `jupiter` package's balances API.
|
|
12687
|
-
*
|
|
12688
|
-
* The Jupiter call and the RPC fallback both live in
|
|
12689
|
-
* `jupiter/src/balancesApi.ts`; this file owns the policy — try Jupiter first,
|
|
12690
|
-
* fall back to RPC on failure or an empty result — plus logging.
|
|
12691
|
-
*/
|
|
12692
|
-
|
|
12693
|
-
interface JupiterBalanceSourceOptions extends FetchJupiterBalancesOptions {
|
|
12694
|
-
/** Skip the Jupiter call and read straight from RPC. */
|
|
12695
|
-
rpcOnly?: boolean;
|
|
12696
|
-
log?: (msg: string) => void;
|
|
12697
|
-
}
|
|
12698
|
-
declare class JupiterBalanceSource implements WalletBalanceSource {
|
|
12699
|
-
private readonly connection;
|
|
12700
|
-
private readonly rpcOnly;
|
|
12701
|
-
private readonly log;
|
|
12702
|
-
private readonly apiOptions;
|
|
12703
|
-
constructor(connection: Connection, opts?: JupiterBalanceSourceOptions);
|
|
12704
|
-
fetchBalances(owner: Address): Promise<Record<string, bigint>>;
|
|
12705
|
-
}
|
|
12706
|
-
|
|
12707
12658
|
/**
|
|
12708
12659
|
* Aggregation of {@link ExternalPositionProvider}s plus a trivial static
|
|
12709
12660
|
* provider. Concrete live-LP providers (Kamino, Marginfi) wrap protocol SDKs,
|
|
@@ -12855,7 +12806,6 @@ declare function formatSettlementSimulation(simulation: SettlementSimulation): s
|
|
|
12855
12806
|
|
|
12856
12807
|
interface LiveConsensusOracleDepsOptions {
|
|
12857
12808
|
log?: (msg: string) => void;
|
|
12858
|
-
rpcOnly?: boolean;
|
|
12859
12809
|
includeExternalPositions?: boolean;
|
|
12860
12810
|
}
|
|
12861
12811
|
declare function createLiveConsensusOracleDeps(connection: Connection, opts?: LiveConsensusOracleDepsOptions): ConsensusOracleDeps;
|
|
@@ -12865,8 +12815,6 @@ interface RunLiveConsensusOracleOptions extends RunOptions {
|
|
|
12865
12815
|
rpcUrl?: string;
|
|
12866
12816
|
/** Override the vault program id. Defaults to the environment's configured program. */
|
|
12867
12817
|
programId?: Address;
|
|
12868
|
-
/** Skip Jupiter balances and use RPC token-account balances only. */
|
|
12869
|
-
rpcOnly?: boolean;
|
|
12870
12818
|
/** Include live Kamino/Marginfi positions in external amount updates. Defaults to true. */
|
|
12871
12819
|
includeExternalPositions?: boolean;
|
|
12872
12820
|
}
|
|
@@ -13201,4 +13149,4 @@ declare class TimelockSettlementService {
|
|
|
13201
13149
|
private execute;
|
|
13202
13150
|
}
|
|
13203
13151
|
|
|
13204
|
-
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, 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, 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, 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, DistributeIncentiveBuilder, type DistributeIncentiveIxArgs, type DistributeIncentiveTxArgs, 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, type IncentiveRecipient, type IncentiveTotals, 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_INCENTIVE_RECIPIENTS, 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 PendingConsensusSignerSet, 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 ResolveExternalWithdrawArgs, type ResolvedExternalWithdraw, 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, type SetIncentiveLimitsArgs, SetIncentiveLimitsBuilder, 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, 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_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 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, 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, buildMarginfiWithdrawInteraction, buildUpdates, coerceBool, collectSamples, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, decodePendingConsensusSigners, defaultKeypairPath, deleteAccount, discoverVaultsForSigner, fetchExternalPositions, fetchNestTokenPrice, fetchReceiptMints, filterTargetHoldings, findLargeBalanceChanges, findSquadsWalletRoute, formatSettlementSimulation, fromUiAmount, gatherPricingInputs, getAccount, getAccounts, getAprYield, getBalance, getCashflows, getIncentiveRecipientShareAtas, getIncentiveRecipients, getIncentiveReportRecipients, getIncentiveTotals, 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, resolveExternalWithdraw, resolveKeypairPath, resolveSquadsWalletRoute, resolveTrackedAmounts, roundToNextUtcMidnight, runLiveConsensusOracle, selectReportableHoldings, settleVault, signerInOracleData, simulateConsensusOracleSettlement, simulateDryRunSettlement, simulateSquadsProposalExecution, sumPositionsByMint, systemClock, toBigInt, toUiAmount, toWeb3AccountMeta, trackedValueFromResponse, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, variantName, vaultAuthorityForWallet, withDiscoveredYieldAccounts };
|
|
13152
|
+
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, 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, 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, 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, DistributeIncentiveBuilder, type DistributeIncentiveIxArgs, type DistributeIncentiveTxArgs, 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, type IncentiveRecipient, type IncentiveTotals, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, 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_INCENTIVE_RECIPIENTS, 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 PendingConsensusSignerSet, 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 ResolveExternalWithdrawArgs, type ResolvedExternalWithdraw, 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, type SetIncentiveLimitsArgs, SetIncentiveLimitsBuilder, 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, 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_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 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 WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, 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, buildMarginfiWithdrawInteraction, buildUpdates, coerceBool, collectSamples, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, decodePendingConsensusSigners, defaultKeypairPath, deleteAccount, discoverVaultsForSigner, fetchExternalPositions, fetchNestTokenPrice, fetchReceiptMints, filterTargetHoldings, findLargeBalanceChanges, findSquadsWalletRoute, formatSettlementSimulation, fromUiAmount, gatherPricingInputs, getAccount, getAccounts, getAprYield, getBalance, getCashflows, getIncentiveRecipientShareAtas, getIncentiveRecipients, getIncentiveReportRecipients, getIncentiveTotals, 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, resolveExternalWithdraw, resolveKeypairPath, resolveSquadsWalletRoute, resolveTrackedAmounts, roundToNextUtcMidnight, runLiveConsensusOracle, selectReportableHoldings, settleVault, signerInOracleData, simulateConsensusOracleSettlement, simulateDryRunSettlement, simulateSquadsProposalExecution, sumPositionsByMint, systemClock, toBigInt, toUiAmount, toWeb3AccountMeta, trackedValueFromResponse, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, variantName, vaultAuthorityForWallet, withDiscoveredYieldAccounts };
|
package/dist/index.js
CHANGED
|
@@ -611,7 +611,7 @@ var require_transaction = __commonJS({
|
|
|
611
611
|
searchTransactionHistory: true
|
|
612
612
|
})).value[0];
|
|
613
613
|
}
|
|
614
|
-
async function sendVersionedTransaction({ connection, payer, instructions: instructions2, lookupTables }) {
|
|
614
|
+
async function sendVersionedTransaction({ connection, payer, instructions: instructions2, lookupTables, skipPreflight = true }) {
|
|
615
615
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
616
616
|
const lookupTableAccounts = await fetchLookupTables3(connection, lookupTables);
|
|
617
617
|
const message2 = new web3_js_1.TransactionMessage({
|
|
@@ -622,9 +622,12 @@ var require_transaction = __commonJS({
|
|
|
622
622
|
const tx = new web3_js_1.VersionedTransaction(message2);
|
|
623
623
|
tx.sign([payer]);
|
|
624
624
|
const signature = await connection.sendRawTransaction(tx.serialize(), {
|
|
625
|
-
skipPreflight
|
|
625
|
+
skipPreflight
|
|
626
626
|
});
|
|
627
|
-
await connection.confirmTransaction({ signature, blockhash, lastValidBlockHeight }, "confirmed");
|
|
627
|
+
const confirmation = await connection.confirmTransaction({ signature, blockhash, lastValidBlockHeight }, "confirmed");
|
|
628
|
+
if (confirmation.value.err) {
|
|
629
|
+
throw new Error(`Transaction ${signature} failed: ${JSON.stringify(confirmation.value.err)}`);
|
|
630
|
+
}
|
|
628
631
|
return signature;
|
|
629
632
|
}
|
|
630
633
|
}
|
|
@@ -1412,7 +1415,12 @@ var require_positions = __commonJS({
|
|
|
1412
1415
|
return out;
|
|
1413
1416
|
}
|
|
1414
1417
|
async function createMarginfiReadClient2(connection, preloadedBankAddresses = []) {
|
|
1415
|
-
return marginfi_client_v2_1.MarginfiClient.fetch((0, marginfi_client_v2_1.getConfig)("production"), void 0, connection, {
|
|
1418
|
+
return marginfi_client_v2_1.MarginfiClient.fetch((0, marginfi_client_v2_1.getConfig)("production"), void 0, connection, {
|
|
1419
|
+
preloadedBankAddresses,
|
|
1420
|
+
// Balance readers use on-chain shares and bank addresses, not metadata.
|
|
1421
|
+
// An explicit map skips the SDK's optional bank/staked-bank cache downloads.
|
|
1422
|
+
bankMetadataMap: {}
|
|
1423
|
+
});
|
|
1416
1424
|
}
|
|
1417
1425
|
async function readMarginfiBankBalance2(client, marginfiAccount, marginfiBank) {
|
|
1418
1426
|
const account = await marginfi_client_v2_1.MarginfiAccountWrapper.fetch(marginfiAccount, client);
|
|
@@ -2681,12 +2689,11 @@ var require_constants4 = __commonJS({
|
|
|
2681
2689
|
"../jupiter/dist/constants.js"(exports2) {
|
|
2682
2690
|
"use strict";
|
|
2683
2691
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2684
|
-
exports2.DEFAULT_EXCLUDED_DEXES = exports2.DEFAULT_MAX_ACCOUNTS = exports2.DEFAULT_SLIPPAGE_BPS = exports2.
|
|
2692
|
+
exports2.DEFAULT_EXCLUDED_DEXES = exports2.DEFAULT_MAX_ACCOUNTS = exports2.DEFAULT_SLIPPAGE_BPS = exports2.JUPITER_PRICE_API_URL = exports2.JUPITER_API_URL = exports2.JUPITER_V6_PROGRAM_ID = void 0;
|
|
2685
2693
|
var kit_1 = require("@solana/kit");
|
|
2686
2694
|
exports2.JUPITER_V6_PROGRAM_ID = (0, kit_1.address)("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4");
|
|
2687
2695
|
exports2.JUPITER_API_URL = "https://lite-api.jup.ag";
|
|
2688
2696
|
exports2.JUPITER_PRICE_API_URL = `${exports2.JUPITER_API_URL}/price/v3`;
|
|
2689
|
-
exports2.JUPITER_BALANCES_API_URL = `${exports2.JUPITER_API_URL}/ultra/v1/balances`;
|
|
2690
2697
|
exports2.DEFAULT_SLIPPAGE_BPS = 500;
|
|
2691
2698
|
exports2.DEFAULT_MAX_ACCOUNTS = 20;
|
|
2692
2699
|
exports2.DEFAULT_EXCLUDED_DEXES = [
|
|
@@ -2772,68 +2779,6 @@ var require_api = __commonJS({
|
|
|
2772
2779
|
}
|
|
2773
2780
|
});
|
|
2774
2781
|
|
|
2775
|
-
// ../jupiter/dist/balancesApi.js
|
|
2776
|
-
var require_balancesApi = __commonJS({
|
|
2777
|
-
"../jupiter/dist/balancesApi.js"(exports2) {
|
|
2778
|
-
"use strict";
|
|
2779
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2780
|
-
exports2.fetchJupiterWalletBalances = fetchJupiterWalletBalances2;
|
|
2781
|
-
exports2.fetchWalletBalancesFromRpc = fetchWalletBalancesFromRpc2;
|
|
2782
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
2783
|
-
var spl_token_1 = require("@solana/spl-token");
|
|
2784
|
-
var constants_1 = require_constants4();
|
|
2785
|
-
async function fetchJupiterWalletBalances2(owner, opts = {}) {
|
|
2786
|
-
const baseUrl = opts.baseUrl ?? constants_1.JUPITER_BALANCES_API_URL;
|
|
2787
|
-
const fetchFn = opts.fetchFn ?? fetch;
|
|
2788
|
-
const res = await fetchFn(`${baseUrl}/${owner.toString()}`);
|
|
2789
|
-
if (!res.ok) {
|
|
2790
|
-
throw new Error(`Jupiter balances API ${res.status}`);
|
|
2791
|
-
}
|
|
2792
|
-
const body = await res.json();
|
|
2793
|
-
if (!body || typeof body !== "object") {
|
|
2794
|
-
throw new Error("Jupiter balances API returned a non-object body");
|
|
2795
|
-
}
|
|
2796
|
-
const out = {};
|
|
2797
|
-
for (const [key, value] of Object.entries(body)) {
|
|
2798
|
-
if (key === "SOL")
|
|
2799
|
-
continue;
|
|
2800
|
-
if (!value || typeof value !== "object")
|
|
2801
|
-
continue;
|
|
2802
|
-
const amount = value.amount;
|
|
2803
|
-
if (amount === void 0 || amount === null)
|
|
2804
|
-
continue;
|
|
2805
|
-
try {
|
|
2806
|
-
const raw = BigInt(String(amount));
|
|
2807
|
-
if (raw > 0n)
|
|
2808
|
-
out[key] = raw;
|
|
2809
|
-
} catch {
|
|
2810
|
-
}
|
|
2811
|
-
}
|
|
2812
|
-
return out;
|
|
2813
|
-
}
|
|
2814
|
-
async function fetchWalletBalancesFromRpc2(connection, owner) {
|
|
2815
|
-
const ownerPk = owner instanceof web3_js_1.PublicKey ? owner : new web3_js_1.PublicKey(owner.toString());
|
|
2816
|
-
const out = {};
|
|
2817
|
-
for (const programId of [spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.TOKEN_2022_PROGRAM_ID]) {
|
|
2818
|
-
const { value } = await connection.getParsedTokenAccountsByOwner(ownerPk, {
|
|
2819
|
-
programId: new web3_js_1.PublicKey(programId)
|
|
2820
|
-
});
|
|
2821
|
-
for (const { account } of value) {
|
|
2822
|
-
const info = account.data.parsed?.info;
|
|
2823
|
-
const mint = info?.mint;
|
|
2824
|
-
const amount = info?.tokenAmount?.amount;
|
|
2825
|
-
if (!mint || amount === void 0)
|
|
2826
|
-
continue;
|
|
2827
|
-
const raw = BigInt(amount);
|
|
2828
|
-
if (raw > 0n)
|
|
2829
|
-
out[mint] = (out[mint] ?? 0n) + raw;
|
|
2830
|
-
}
|
|
2831
|
-
}
|
|
2832
|
-
return out;
|
|
2833
|
-
}
|
|
2834
|
-
}
|
|
2835
|
-
});
|
|
2836
|
-
|
|
2837
2782
|
// ../jupiter/dist/extract.js
|
|
2838
2783
|
var require_extract = __commonJS({
|
|
2839
2784
|
"../jupiter/dist/extract.js"(exports2) {
|
|
@@ -3185,7 +3130,6 @@ var require_dist3 = __commonJS({
|
|
|
3185
3130
|
};
|
|
3186
3131
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3187
3132
|
__exportStar(require_api(), exports2);
|
|
3188
|
-
__exportStar(require_balancesApi(), exports2);
|
|
3189
3133
|
__exportStar(require_client(), exports2);
|
|
3190
3134
|
__exportStar(require_constants4(), exports2);
|
|
3191
3135
|
__exportStar(require_priceApi(), exports2);
|
|
@@ -3297,7 +3241,6 @@ __export(index_exports, {
|
|
|
3297
3241
|
IDLE_RESERVE_TARGET_BPS: () => IDLE_RESERVE_TARGET_BPS,
|
|
3298
3242
|
IdleLiquidityService: () => IdleLiquidityService,
|
|
3299
3243
|
InitializeVaultRolesBuilder: () => InitializeVaultRolesBuilder,
|
|
3300
|
-
JupiterBalanceSource: () => JupiterBalanceSource,
|
|
3301
3244
|
JupiterPriceSource: () => JupiterPriceSource,
|
|
3302
3245
|
JupiterSwapBuilder: () => JupiterSwapBuilder,
|
|
3303
3246
|
KaminoPositionProvider: () => KaminoPositionProvider,
|
|
@@ -16376,8 +16319,9 @@ var TransactionClient = class {
|
|
|
16376
16319
|
|
|
16377
16320
|
// src/client/client.ts
|
|
16378
16321
|
var VaultClient = class {
|
|
16379
|
-
constructor(provider, programId = VAULT_PROGRAM_ID) {
|
|
16322
|
+
constructor(provider, programId = VAULT_PROGRAM_ID, options = {}) {
|
|
16380
16323
|
this.provider = provider;
|
|
16324
|
+
this.skipSimulation = options.skipSimulation ?? false;
|
|
16381
16325
|
const idl = { ...IDL, address: programId };
|
|
16382
16326
|
this.program = new import_core18.Program(idl, provider);
|
|
16383
16327
|
this.pda = new PdaClient((0, import_kit9.address)(this.program.programId.toBase58()));
|
|
@@ -16410,13 +16354,20 @@ var VaultClient = class {
|
|
|
16410
16354
|
const signature = await this.provider.connection.sendRawTransaction(
|
|
16411
16355
|
tx.serialize(),
|
|
16412
16356
|
{
|
|
16413
|
-
skipPreflight:
|
|
16357
|
+
skipPreflight: this.skipSimulation
|
|
16414
16358
|
}
|
|
16415
16359
|
);
|
|
16416
|
-
await this.provider.connection.confirmTransaction(
|
|
16360
|
+
const confirmation = await this.provider.connection.confirmTransaction(
|
|
16417
16361
|
{ signature, blockhash, lastValidBlockHeight },
|
|
16418
16362
|
"confirmed"
|
|
16419
16363
|
);
|
|
16364
|
+
if (confirmation.value.err) {
|
|
16365
|
+
throw new Error(
|
|
16366
|
+
`Transaction ${signature} failed: ${JSON.stringify(
|
|
16367
|
+
confirmation.value.err
|
|
16368
|
+
)}`
|
|
16369
|
+
);
|
|
16370
|
+
}
|
|
16420
16371
|
this.applyCacheInvalidations(plan);
|
|
16421
16372
|
return signature;
|
|
16422
16373
|
}
|
|
@@ -16526,7 +16477,8 @@ function createVaultClient(env, opts = {}) {
|
|
|
16526
16477
|
});
|
|
16527
16478
|
const client = new VaultClient(
|
|
16528
16479
|
provider,
|
|
16529
|
-
opts.programId ?? getVaultProgramId(env)
|
|
16480
|
+
opts.programId ?? getVaultProgramId(env),
|
|
16481
|
+
{ skipSimulation: opts.skipSimulation }
|
|
16530
16482
|
);
|
|
16531
16483
|
return {
|
|
16532
16484
|
env,
|
|
@@ -17720,7 +17672,6 @@ function evaluateBalanceChanges(vaultState, updates, thresholdBps, nowSecs) {
|
|
|
17720
17672
|
valueChange: valueNumerator / amountScale,
|
|
17721
17673
|
tvl,
|
|
17722
17674
|
thresholdBps,
|
|
17723
|
-
walletAmount: update.walletAmount,
|
|
17724
17675
|
lpAmount: update.lpAmount,
|
|
17725
17676
|
trackedPrincipalAmount: update.trackedPrincipalAmount,
|
|
17726
17677
|
trackedValueAmount: update.trackedValueAmount,
|
|
@@ -17782,10 +17733,7 @@ function assertNoLargeBalanceChanges(vault, vaultState, updates, nowSecs, log =
|
|
|
17782
17733
|
violation.decimals
|
|
17783
17734
|
)}, value_change=${violation.valueChange} accounting_base_units (${percentOfTvl} of TVL ${violation.tvl} accounting_base_units; threshold=${formatBpsAsPercent(
|
|
17784
17735
|
violation.thresholdBps
|
|
17785
|
-
)}), sources=[
|
|
17786
|
-
violation.walletAmount,
|
|
17787
|
-
violation.decimals
|
|
17788
|
-
)} lp=${formatTokenAmount(
|
|
17736
|
+
)}), sources=[lp=${formatTokenAmount(
|
|
17789
17737
|
violation.lpAmount,
|
|
17790
17738
|
violation.decimals
|
|
17791
17739
|
)} tracked=${formatTokenAmount(
|
|
@@ -17988,50 +17936,30 @@ function simulateConsensusOracleSettlement(args) {
|
|
|
17988
17936
|
} catch (error) {
|
|
17989
17937
|
const blocker = message(error);
|
|
17990
17938
|
blockers.push(blocker);
|
|
17991
|
-
|
|
17992
|
-
|
|
17993
|
-
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
|
|
17997
|
-
|
|
17998
|
-
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
|
|
18002
|
-
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
18006
|
-
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18010
|
-
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
...consensusSummary,
|
|
18016
|
-
canSettle: false,
|
|
18017
|
-
blockers,
|
|
18018
|
-
warnings,
|
|
18019
|
-
consensus,
|
|
18020
|
-
navContributions,
|
|
18021
|
-
grossNav,
|
|
18022
|
-
settledAccountingNav: settlement.settledAccountingNav,
|
|
18023
|
-
current,
|
|
18024
|
-
projectionRequiresMaxApyDisabled: true,
|
|
18025
|
-
projected: settlement.projected,
|
|
18026
|
-
performanceFees: settlement.performanceFees
|
|
18027
|
-
};
|
|
18028
|
-
} catch (projectionError) {
|
|
18029
|
-
warnings.push(
|
|
18030
|
-
`could not calculate the uncapped projection: ${message(
|
|
18031
|
-
projectionError
|
|
18032
|
-
)}`
|
|
18033
|
-
);
|
|
18034
|
-
}
|
|
17939
|
+
const requiresLossesEnabled = blocker.includes("LossesDisabled");
|
|
17940
|
+
const requiresMaxApyDisabled = blocker.includes("MaxApyExceeded");
|
|
17941
|
+
if (requiresLossesEnabled || requiresMaxApyDisabled) {
|
|
17942
|
+
const projection = simulateConsensusOracleSettlement({
|
|
17943
|
+
...args,
|
|
17944
|
+
vault: {
|
|
17945
|
+
...args.vault,
|
|
17946
|
+
lossesEnabled: requiresLossesEnabled ? true : args.vault.lossesEnabled,
|
|
17947
|
+
config: {
|
|
17948
|
+
...args.vault.config,
|
|
17949
|
+
apy: {
|
|
17950
|
+
...apyConfig,
|
|
17951
|
+
maxApyBps: requiresMaxApyDisabled ? 0 : apyConfig.maxApyBps
|
|
17952
|
+
}
|
|
17953
|
+
}
|
|
17954
|
+
}
|
|
17955
|
+
});
|
|
17956
|
+
return {
|
|
17957
|
+
...projection,
|
|
17958
|
+
canSettle: false,
|
|
17959
|
+
blockers: [...blockers, ...projection.blockers],
|
|
17960
|
+
projectionRequiresLossesEnabled: projection.projected ? requiresLossesEnabled || projection.projectionRequiresLossesEnabled : void 0,
|
|
17961
|
+
projectionRequiresMaxApyDisabled: projection.projected ? requiresMaxApyDisabled || projection.projectionRequiresMaxApyDisabled : void 0
|
|
17962
|
+
};
|
|
18035
17963
|
}
|
|
18036
17964
|
return {
|
|
18037
17965
|
nowTs: args.nowTs,
|
|
@@ -18832,6 +18760,11 @@ function formatSettlementSimulation(simulation) {
|
|
|
18832
18760
|
);
|
|
18833
18761
|
}
|
|
18834
18762
|
if (simulation.projected) {
|
|
18763
|
+
if (simulation.projectionRequiresLossesEnabled) {
|
|
18764
|
+
lines.push(
|
|
18765
|
+
" hypothetical projection with losses enabled (losses_enabled=true):"
|
|
18766
|
+
);
|
|
18767
|
+
}
|
|
18835
18768
|
if (simulation.projectionRequiresMaxApyDisabled) {
|
|
18836
18769
|
lines.push(" projection with max APY disabled (max_apy_bps=0):");
|
|
18837
18770
|
}
|
|
@@ -18977,7 +18910,6 @@ async function buildHoldingUpdate(yieldTracker, entry, inputs) {
|
|
|
18977
18910
|
}
|
|
18978
18911
|
usd = accountingUnitPriceToUsd(price, inputs.baseUsd, inputs.assetDecimals);
|
|
18979
18912
|
}
|
|
18980
|
-
const walletAmount = inputs.walletBalances[mintKey] ?? 0n;
|
|
18981
18913
|
const lpAmount = inputs.lpByMint.get(mintKey) ?? 0n;
|
|
18982
18914
|
const { trackedValueAmount, principalAmount, yieldAmount } = await resolveTrackedAmounts(
|
|
18983
18915
|
yieldTracker,
|
|
@@ -18990,12 +18922,11 @@ async function buildHoldingUpdate(yieldTracker, entry, inputs) {
|
|
|
18990
18922
|
decimals: holding.decimals,
|
|
18991
18923
|
usdPrice: usd,
|
|
18992
18924
|
price,
|
|
18993
|
-
walletAmount,
|
|
18994
18925
|
lpAmount,
|
|
18995
18926
|
yieldAmount,
|
|
18996
18927
|
trackedPrincipalAmount: principalAmount,
|
|
18997
18928
|
trackedValueAmount,
|
|
18998
|
-
externalAmount:
|
|
18929
|
+
externalAmount: lpAmount + trackedValueAmount
|
|
18999
18930
|
};
|
|
19000
18931
|
}
|
|
19001
18932
|
async function resolveTrackedAmounts(yieldTracker, cfg, decimals) {
|
|
@@ -19091,7 +19022,6 @@ async function refreshLiveOraclePrices({
|
|
|
19091
19022
|
var import_common48 = __toESM(require_dist());
|
|
19092
19023
|
async function gatherPricingInputs(deps, target, vaultState, reportableHoldings, log = () => {
|
|
19093
19024
|
}) {
|
|
19094
|
-
const manager = (0, import_common48.fromWeb3Pk)(vaultState.roles.manager);
|
|
19095
19025
|
const consensusMints = reportableHoldings.filter(
|
|
19096
19026
|
({ holding }) => variantName2(holding.priceOracleType).toLowerCase() === CONSENSUS_ORACLE_VARIANT
|
|
19097
19027
|
).map(({ holding }) => (0, import_common48.fromWeb3Pk)(holding.mint));
|
|
@@ -19112,11 +19042,9 @@ async function gatherPricingInputs(deps, target, vaultState, reportableHoldings,
|
|
|
19112
19042
|
`no USD price for base asset ${baseMint} (cannot denominate prices)`
|
|
19113
19043
|
);
|
|
19114
19044
|
}
|
|
19115
|
-
const walletBalances = await deps.balanceSource.fetchBalances(manager);
|
|
19116
19045
|
const lpByMint = await fetchExternalPositions(
|
|
19117
19046
|
deps,
|
|
19118
19047
|
target,
|
|
19119
|
-
manager,
|
|
19120
19048
|
vaultState,
|
|
19121
19049
|
log
|
|
19122
19050
|
);
|
|
@@ -19124,12 +19052,11 @@ async function gatherPricingInputs(deps, target, vaultState, reportableHoldings,
|
|
|
19124
19052
|
assetDecimals: vaultState.config.assetDecimals,
|
|
19125
19053
|
baseUsd,
|
|
19126
19054
|
usdPrices,
|
|
19127
|
-
walletBalances,
|
|
19128
19055
|
lpByMint,
|
|
19129
19056
|
configByMint: indexConfigByMint(target.holdings)
|
|
19130
19057
|
};
|
|
19131
19058
|
}
|
|
19132
|
-
async function fetchExternalPositions(deps, target,
|
|
19059
|
+
async function fetchExternalPositions(deps, target, vaultState, log = () => {
|
|
19133
19060
|
}) {
|
|
19134
19061
|
if (!deps.externalPositions) return /* @__PURE__ */ new Map();
|
|
19135
19062
|
const configRefs = (target.holdings ?? []).flatMap(
|
|
@@ -19150,7 +19077,6 @@ async function fetchExternalPositions(deps, target, manager, vaultState, log = (
|
|
|
19150
19077
|
async () => sumPositionsByMint(
|
|
19151
19078
|
await provider.positionsFor({
|
|
19152
19079
|
vault: target.vault,
|
|
19153
|
-
manager,
|
|
19154
19080
|
refs: mergedRefs
|
|
19155
19081
|
})
|
|
19156
19082
|
),
|
|
@@ -19302,7 +19228,7 @@ async function settleVault2({
|
|
|
19302
19228
|
log(`vault ${vault}: submitting ${updates.length} consensus asset update(s)`);
|
|
19303
19229
|
for (const update of updates) {
|
|
19304
19230
|
log(
|
|
19305
|
-
` holding #${update.holdingIndex} ${update.mint}: price=${update.price} external_amount=${update.externalAmount} [
|
|
19231
|
+
` holding #${update.holdingIndex} ${update.mint}: price=${update.price} external_amount=${update.externalAmount} [lp=${update.lpAmount} tracked=${update.trackedValueAmount} principal=${update.trackedPrincipalAmount} yield=${update.yieldAmount}]`
|
|
19306
19232
|
);
|
|
19307
19233
|
}
|
|
19308
19234
|
await logProspectiveApy({
|
|
@@ -19313,6 +19239,24 @@ async function settleVault2({
|
|
|
19313
19239
|
nowSecs,
|
|
19314
19240
|
log
|
|
19315
19241
|
});
|
|
19242
|
+
try {
|
|
19243
|
+
const simulation = await simulateDryRunSettlement({
|
|
19244
|
+
client,
|
|
19245
|
+
signer,
|
|
19246
|
+
vault,
|
|
19247
|
+
vaultState,
|
|
19248
|
+
updates,
|
|
19249
|
+
nowSecs
|
|
19250
|
+
});
|
|
19251
|
+
log(
|
|
19252
|
+
`vault ${vault}: expected settlement using this report and current consensus`
|
|
19253
|
+
);
|
|
19254
|
+
for (const line of formatSettlementSimulation(simulation)) log(line);
|
|
19255
|
+
} catch (error) {
|
|
19256
|
+
log(
|
|
19257
|
+
`vault ${vault}: expected share prices unavailable (${error instanceof Error ? error.message : String(error)})`
|
|
19258
|
+
);
|
|
19259
|
+
}
|
|
19316
19260
|
await assertNoUnconfirmedYieldPayments(yieldTracker, target);
|
|
19317
19261
|
const updateSignature = await oracle.updateAssetConsensusPrice(
|
|
19318
19262
|
signer,
|
|
@@ -19471,34 +19415,6 @@ var LivePriceSource = class {
|
|
|
19471
19415
|
}
|
|
19472
19416
|
};
|
|
19473
19417
|
|
|
19474
|
-
// src/services/consensusOracle/sources/jupiterBalanceSource.ts
|
|
19475
|
-
var import_jupiter2 = __toESM(require_dist3());
|
|
19476
|
-
var JupiterBalanceSource = class {
|
|
19477
|
-
constructor(connection, opts = {}) {
|
|
19478
|
-
this.connection = connection;
|
|
19479
|
-
this.rpcOnly = opts.rpcOnly ?? false;
|
|
19480
|
-
this.log = opts.log ?? (() => {
|
|
19481
|
-
});
|
|
19482
|
-
this.apiOptions = { baseUrl: opts.baseUrl, fetchFn: opts.fetchFn };
|
|
19483
|
-
}
|
|
19484
|
-
async fetchBalances(owner) {
|
|
19485
|
-
if (!this.rpcOnly) {
|
|
19486
|
-
try {
|
|
19487
|
-
const fromJup = await (0, import_jupiter2.fetchJupiterWalletBalances)(
|
|
19488
|
-
owner,
|
|
19489
|
-
this.apiOptions
|
|
19490
|
-
);
|
|
19491
|
-
if (Object.keys(fromJup).length > 0) return fromJup;
|
|
19492
|
-
} catch (err) {
|
|
19493
|
-
this.log(
|
|
19494
|
-
`Jupiter balances failed for ${owner}, falling back to RPC: ${err instanceof Error ? err.message : String(err)}`
|
|
19495
|
-
);
|
|
19496
|
-
}
|
|
19497
|
-
}
|
|
19498
|
-
return (0, import_jupiter2.fetchWalletBalancesFromRpc)(this.connection, owner);
|
|
19499
|
-
}
|
|
19500
|
-
};
|
|
19501
|
-
|
|
19502
19418
|
// src/services/consensusOracle/positions/externalPositions.ts
|
|
19503
19419
|
var ExternalPositionRegistry = class {
|
|
19504
19420
|
constructor(providers = [], log = () => {
|
|
@@ -19836,10 +19752,6 @@ function createLiveConsensusOracleDeps(connection, opts = {}) {
|
|
|
19836
19752
|
});
|
|
19837
19753
|
const deps = {
|
|
19838
19754
|
priceSource: new LivePriceSource(),
|
|
19839
|
-
balanceSource: new JupiterBalanceSource(connection, {
|
|
19840
|
-
rpcOnly: opts.rpcOnly ?? false,
|
|
19841
|
-
log
|
|
19842
|
-
}),
|
|
19843
19755
|
yieldTracker: {
|
|
19844
19756
|
async getAccountNamesForVault(vault) {
|
|
19845
19757
|
const accounts2 = await getAccounts();
|
|
@@ -20079,7 +19991,6 @@ async function runLiveConsensusOracle(env, oracleSigner, opts = {}) {
|
|
|
20079
19991
|
client,
|
|
20080
19992
|
createLiveConsensusOracleDeps(client.provider.connection, {
|
|
20081
19993
|
log: opts.log,
|
|
20082
|
-
rpcOnly: opts.rpcOnly,
|
|
20083
19994
|
includeExternalPositions: opts.includeExternalPositions
|
|
20084
19995
|
})
|
|
20085
19996
|
);
|
|
@@ -20172,7 +20083,11 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20172
20083
|
const minAmountUi = opts.minAmountUi ?? DEFAULT_MIN_AMOUNT_UI;
|
|
20173
20084
|
const targetLocalBps = opts.targetLocalBps ?? DEFAULT_TARGET_LOCAL_BPS;
|
|
20174
20085
|
const rebalanceBandBps = opts.rebalanceBandBps ?? DEFAULT_REBALANCE_BAND_BPS;
|
|
20175
|
-
if (dryRun)
|
|
20086
|
+
if (dryRun) {
|
|
20087
|
+
log(
|
|
20088
|
+
this.client.skipSimulation ? "DRY RUN \u2014 rebalances will be built; simulations skipped; nothing sent" : "DRY RUN \u2014 rebalances will be simulated, not sent"
|
|
20089
|
+
);
|
|
20090
|
+
}
|
|
20176
20091
|
log(`Minimum rebalance: ${minAmountUi} token(s) (~$${minAmountUi})`);
|
|
20177
20092
|
log(`Target local share: ${targetLocalBps / 100}% of each holding`);
|
|
20178
20093
|
log(
|
|
@@ -20286,7 +20201,10 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20286
20201
|
continue;
|
|
20287
20202
|
}
|
|
20288
20203
|
log(
|
|
20289
|
-
`Vault ${vault} slot ${slot.index}: ${dryRun ? "simulating " : ""}${plan.direction} of ${formatUi(
|
|
20204
|
+
`Vault ${vault} slot ${slot.index}: ${dryRun ? this.client.skipSimulation ? "building " : "simulating " : ""}${plan.direction} of ${formatUi(
|
|
20205
|
+
plan.amount,
|
|
20206
|
+
decimals
|
|
20207
|
+
)} ${mintAddress} (local ${formatUi(localAmount, decimals)} \u2192 target ${formatUi(
|
|
20290
20208
|
plan.targetLocal,
|
|
20291
20209
|
decimals
|
|
20292
20210
|
)})`
|
|
@@ -20379,6 +20297,12 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20379
20297
|
...cpiRefs.lookupTables?.length ? { lookupTables: cpiRefs.lookupTables } : {}
|
|
20380
20298
|
};
|
|
20381
20299
|
if (dryRun) {
|
|
20300
|
+
if (this.client.skipSimulation) {
|
|
20301
|
+
log(
|
|
20302
|
+
`Vault ${vault} slot ${slot.index}: built; simulation skipped; no transaction sent`
|
|
20303
|
+
);
|
|
20304
|
+
return {};
|
|
20305
|
+
}
|
|
20382
20306
|
const sim = await this.client.simulateTransaction(hwManager, plan);
|
|
20383
20307
|
for (const line of sim.logs ?? []) {
|
|
20384
20308
|
log(` | ${line}`);
|
|
@@ -20400,7 +20324,7 @@ var import_kit16 = require("@solana/kit");
|
|
|
20400
20324
|
var import_spl_token20 = require("@solana/spl-token");
|
|
20401
20325
|
var import_web330 = require("@solana/web3.js");
|
|
20402
20326
|
var import_common54 = __toESM(require_dist());
|
|
20403
|
-
var
|
|
20327
|
+
var import_jupiter2 = __toESM(require_dist3());
|
|
20404
20328
|
var IDLE_RESERVE_FLOOR_BPS = 400;
|
|
20405
20329
|
var IDLE_RESERVE_TARGET_BPS = 500;
|
|
20406
20330
|
var DEFAULT_SLIPPAGE_BPS = 30;
|
|
@@ -20492,7 +20416,7 @@ var IdleLiquidityService = class {
|
|
|
20492
20416
|
log(`Vault ${vault}: ${reason} \u2014 skipping`);
|
|
20493
20417
|
return { ...base, status: "insufficient-pst", reason };
|
|
20494
20418
|
}
|
|
20495
|
-
const jupiter = new
|
|
20419
|
+
const jupiter = new import_jupiter2.JupiterSwapClient(
|
|
20496
20420
|
(0, import_kit16.createSolanaRpc)(this.client.provider.connection.rpcEndpoint)
|
|
20497
20421
|
);
|
|
20498
20422
|
let quote;
|
|
@@ -20755,26 +20679,30 @@ var IdleLiquidityService = class {
|
|
|
20755
20679
|
}).compileToV0Message(lookupTableAccounts);
|
|
20756
20680
|
const transaction = new import_web330.VersionedTransaction(message2);
|
|
20757
20681
|
transaction.sign([hwManager]);
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20682
|
+
if (!this.client.skipSimulation) {
|
|
20683
|
+
const simulation = await connection.simulateTransaction(transaction, {
|
|
20684
|
+
sigVerify: true,
|
|
20685
|
+
commitment: "confirmed"
|
|
20686
|
+
});
|
|
20687
|
+
if (simulation.value.err) {
|
|
20688
|
+
for (const line of simulation.value.logs ?? []) log(` | ${line}`);
|
|
20689
|
+
throw new Error(
|
|
20690
|
+
`simulation failed: ${JSON.stringify(simulation.value.err)}`
|
|
20691
|
+
);
|
|
20692
|
+
}
|
|
20693
|
+
log(
|
|
20694
|
+
`Vault ${vault}: simulation OK (${simulation.value.unitsConsumed ?? "?"} CU)`
|
|
20766
20695
|
);
|
|
20696
|
+
} else {
|
|
20697
|
+
log(`Vault ${vault}: simulation skipped`);
|
|
20767
20698
|
}
|
|
20768
|
-
log(
|
|
20769
|
-
`Vault ${vault}: simulation OK (${simulation.value.unitsConsumed ?? "?"} CU)`
|
|
20770
|
-
);
|
|
20771
20699
|
if (dryRun) {
|
|
20772
20700
|
log(`Vault ${vault}: dry run \u2014 transaction NOT submitted`);
|
|
20773
20701
|
return {};
|
|
20774
20702
|
}
|
|
20775
20703
|
const signature = await connection.sendRawTransaction(
|
|
20776
20704
|
transaction.serialize(),
|
|
20777
|
-
{ skipPreflight:
|
|
20705
|
+
{ skipPreflight: this.client.skipSimulation, maxRetries: 5 }
|
|
20778
20706
|
);
|
|
20779
20707
|
const confirmation = await connection.confirmTransaction(
|
|
20780
20708
|
{ signature, blockhash, lastValidBlockHeight },
|
|
@@ -20998,7 +20926,7 @@ var TimelockSettlementService = class {
|
|
|
20998
20926
|
}
|
|
20999
20927
|
try {
|
|
21000
20928
|
log(
|
|
21001
|
-
`Vault ${vault}: ${dryRun ? "simulating" : "settling"} expired ${action.kind}`
|
|
20929
|
+
`Vault ${vault}: ${dryRun ? this.client.skipSimulation ? "building" : "simulating" : "settling"} expired ${action.kind}`
|
|
21002
20930
|
);
|
|
21003
20931
|
const signature = await action.execute();
|
|
21004
20932
|
summary.settled += 1;
|
|
@@ -21010,7 +20938,7 @@ var TimelockSettlementService = class {
|
|
|
21010
20938
|
dryRun
|
|
21011
20939
|
});
|
|
21012
20940
|
log(
|
|
21013
|
-
`Vault ${vault}: ${action.kind} ${dryRun ? "simulation passed" : `settled: ${signature}`}`
|
|
20941
|
+
`Vault ${vault}: ${action.kind} ${dryRun ? this.client.skipSimulation ? "built; simulation skipped; no transaction sent" : "simulation passed" : `settled: ${signature}`}`
|
|
21014
20942
|
);
|
|
21015
20943
|
} catch (error) {
|
|
21016
20944
|
summary.failed += 1;
|
|
@@ -21024,6 +20952,7 @@ var TimelockSettlementService = class {
|
|
|
21024
20952
|
}
|
|
21025
20953
|
async execute(fulfiller, plan, dryRun, log) {
|
|
21026
20954
|
if (!dryRun) return this.client.sendTransaction(fulfiller, plan);
|
|
20955
|
+
if (this.client.skipSimulation) return void 0;
|
|
21027
20956
|
const simulation = await this.client.simulateTransaction(fulfiller, plan);
|
|
21028
20957
|
for (const line of simulation.logs ?? []) log(` | ${line}`);
|
|
21029
20958
|
if (simulation.err) {
|
|
@@ -21087,7 +21016,6 @@ var import_common56 = __toESM(require_dist());
|
|
|
21087
21016
|
IDLE_RESERVE_TARGET_BPS,
|
|
21088
21017
|
IdleLiquidityService,
|
|
21089
21018
|
InitializeVaultRolesBuilder,
|
|
21090
|
-
JupiterBalanceSource,
|
|
21091
21019
|
JupiterPriceSource,
|
|
21092
21020
|
JupiterSwapBuilder,
|
|
21093
21021
|
KaminoPositionProvider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perena/vault-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42",
|
|
4
4
|
"description": "Vault program helpers for Bankineco integrations.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"init-vault-atas": "tsx scripts/initVaultAtas.ts",
|
|
43
43
|
"inspect": "tsx scripts/inspect.ts",
|
|
44
44
|
"vault-data": "tsx scripts/fetchVaultData.ts",
|
|
45
|
+
"preview-oracle-update": "tsx scripts/previewOracleUpdate.ts",
|
|
45
46
|
"simulate-withdraw": "tsx scripts/simulate-withdraw.ts",
|
|
46
47
|
"simulate-message": "tsx scripts/simulate-message.ts",
|
|
47
48
|
"run-external-liquidity-service": "tsx scripts/runExternalLiquidityService.ts",
|