@perena/vault-sdk 1.0.41 → 1.0.43
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 +99 -71
- package/dist/index.js +321 -208
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -6508,8 +6508,9 @@ type Bankineco = {
|
|
|
6508
6508
|
{
|
|
6509
6509
|
name: "maxApyBps";
|
|
6510
6510
|
docs: [
|
|
6511
|
-
"Maximum annualized
|
|
6512
|
-
"
|
|
6511
|
+
"Maximum linear annualized growth of the settled regular share price",
|
|
6512
|
+
"against `max_apy_anchor`, for settlements advancing its performance-fee",
|
|
6513
|
+
"high-water mark. Basis points; zero disables enforcement, not observation."
|
|
6513
6514
|
];
|
|
6514
6515
|
type: "u16";
|
|
6515
6516
|
},
|
|
@@ -6556,10 +6557,23 @@ type Bankineco = {
|
|
|
6556
6557
|
];
|
|
6557
6558
|
type: "i64";
|
|
6558
6559
|
},
|
|
6560
|
+
{
|
|
6561
|
+
name: "maxApyAnchor";
|
|
6562
|
+
docs: [
|
|
6563
|
+
"Independent of the durable fixed-APY accrual anchor above. Carved from",
|
|
6564
|
+
"reserved bytes without changing APYConfig or Vault size/field offsets.",
|
|
6565
|
+
"Existing zero-filled accounts initialize lazily from a known price/time."
|
|
6566
|
+
];
|
|
6567
|
+
type: {
|
|
6568
|
+
defined: {
|
|
6569
|
+
name: "maxApyAnchor";
|
|
6570
|
+
};
|
|
6571
|
+
};
|
|
6572
|
+
},
|
|
6559
6573
|
{
|
|
6560
6574
|
name: "padding1";
|
|
6561
6575
|
type: {
|
|
6562
|
-
array: ["u64",
|
|
6576
|
+
array: ["u64", 28];
|
|
6563
6577
|
};
|
|
6564
6578
|
}
|
|
6565
6579
|
];
|
|
@@ -7146,6 +7160,41 @@ type Bankineco = {
|
|
|
7146
7160
|
];
|
|
7147
7161
|
};
|
|
7148
7162
|
},
|
|
7163
|
+
{
|
|
7164
|
+
name: "maxApyAnchor";
|
|
7165
|
+
docs: [
|
|
7166
|
+
"Weekly observations of the settled regular share price. Keep the previous",
|
|
7167
|
+
"observation while the newest is younger than seven days, so rollover never",
|
|
7168
|
+
"reduces a mature comparison window to a few seconds. With regular settlement",
|
|
7169
|
+
"the effective lookback is seven to fourteen days; sparse settlement can make",
|
|
7170
|
+
"it longer. A new cohort uses its actual age until seven days of history exist."
|
|
7171
|
+
];
|
|
7172
|
+
serialization: "bytemuck";
|
|
7173
|
+
repr: {
|
|
7174
|
+
kind: "c";
|
|
7175
|
+
};
|
|
7176
|
+
type: {
|
|
7177
|
+
kind: "struct";
|
|
7178
|
+
fields: [
|
|
7179
|
+
{
|
|
7180
|
+
name: "sharePrice";
|
|
7181
|
+
type: "u64";
|
|
7182
|
+
},
|
|
7183
|
+
{
|
|
7184
|
+
name: "timestamp";
|
|
7185
|
+
type: "i64";
|
|
7186
|
+
},
|
|
7187
|
+
{
|
|
7188
|
+
name: "previousSharePrice";
|
|
7189
|
+
type: "u64";
|
|
7190
|
+
},
|
|
7191
|
+
{
|
|
7192
|
+
name: "previousTimestamp";
|
|
7193
|
+
type: "i64";
|
|
7194
|
+
}
|
|
7195
|
+
];
|
|
7196
|
+
};
|
|
7197
|
+
},
|
|
7149
7198
|
{
|
|
7150
7199
|
name: "pendingManagerWithdrawDestination";
|
|
7151
7200
|
docs: [
|
|
@@ -11345,7 +11394,10 @@ declare class VaultClient {
|
|
|
11345
11394
|
readonly account: AccountClient;
|
|
11346
11395
|
readonly tx: TransactionClient;
|
|
11347
11396
|
readonly quote: VaultQuoteClient;
|
|
11348
|
-
|
|
11397
|
+
readonly skipSimulation: boolean;
|
|
11398
|
+
constructor(provider: AnchorProvider, programId?: Address, options?: {
|
|
11399
|
+
skipSimulation?: boolean;
|
|
11400
|
+
});
|
|
11349
11401
|
/**
|
|
11350
11402
|
* Sign, send, and confirm a transaction plan built from {@link TransactionClient}.
|
|
11351
11403
|
* Pass `extraSigners` for accounts created in the same tx (e.g. a new share mint).
|
|
@@ -11401,6 +11453,8 @@ declare function loadKeypair(keypairPath: string): Keypair;
|
|
|
11401
11453
|
*/
|
|
11402
11454
|
declare function defaultKeypairPath(env: VaultEnv, role?: string): string;
|
|
11403
11455
|
interface CreateVaultClientOptions {
|
|
11456
|
+
/** Skip optional transaction simulations and RPC send preflight. */
|
|
11457
|
+
skipSimulation?: boolean;
|
|
11404
11458
|
/** Explicit RPC endpoint; otherwise resolved from env vars. */
|
|
11405
11459
|
rpcUrl?: string;
|
|
11406
11460
|
/** Keypair file path; defaults to {@link defaultKeypairPath}. Ignored if `keypair` is set. */
|
|
@@ -11982,7 +12036,7 @@ declare class OracleService {
|
|
|
11982
12036
|
* The orchestrator ({@link ConsensusOracleService}) depends only on these
|
|
11983
12037
|
* interfaces, so it carries no network/RPC/protocol dependencies of its own and
|
|
11984
12038
|
* can be unit-tested with in-memory fakes. Concrete implementations
|
|
11985
|
-
* (
|
|
12039
|
+
* (price feeds, the mock yield tracker, live-LP providers) are
|
|
11986
12040
|
* injected by the caller.
|
|
11987
12041
|
*/
|
|
11988
12042
|
|
|
@@ -11994,10 +12048,6 @@ interface PriceSource {
|
|
|
11994
12048
|
*/
|
|
11995
12049
|
fetchUsdPrices(mints: Address[]): Promise<Record<string, number>>;
|
|
11996
12050
|
}
|
|
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
12051
|
/** A balance deployed outside vault-owned token accounts, in the mint's base units. */
|
|
12002
12052
|
interface ExternalPosition {
|
|
12003
12053
|
mint: Address;
|
|
@@ -12015,8 +12065,6 @@ interface ExternalPositionRef {
|
|
|
12015
12065
|
}
|
|
12016
12066
|
interface ExternalPositionContext {
|
|
12017
12067
|
vault: Address;
|
|
12018
|
-
/** The vault's manager wallet (positions are usually held against it). */
|
|
12019
|
-
manager: Address;
|
|
12020
12068
|
/** Position descriptors gathered from the target config for this vault. */
|
|
12021
12069
|
refs: ExternalPositionRef[];
|
|
12022
12070
|
}
|
|
@@ -12099,7 +12147,6 @@ interface ConsensusOracleTarget {
|
|
|
12099
12147
|
/** Injected collaborators for {@link ConsensusOracleService}. */
|
|
12100
12148
|
interface ConsensusOracleDeps {
|
|
12101
12149
|
priceSource: PriceSource;
|
|
12102
|
-
balanceSource: WalletBalanceSource;
|
|
12103
12150
|
/** Optional; omitted ⇒ no live-LP balances are folded in. */
|
|
12104
12151
|
externalPositions?: ExternalPositionProvider;
|
|
12105
12152
|
/** Optional; omitted ⇒ no yield accrual is folded in. */
|
|
@@ -12123,8 +12170,6 @@ interface HoldingUpdatePreview {
|
|
|
12123
12170
|
usdPrice: number;
|
|
12124
12171
|
/** Price in the vault's accounting unit, fixed-point (scaled by assetDecimals). */
|
|
12125
12172
|
price: bigint;
|
|
12126
|
-
/** Manager-wallet balance of this mint (base units). */
|
|
12127
|
-
walletAmount: bigint;
|
|
12128
12173
|
/** Summed live-LP positions for this mint (base units). */
|
|
12129
12174
|
lpAmount: bigint;
|
|
12130
12175
|
/** Accrued yield attributed to this holding (base units). */
|
|
@@ -12133,7 +12178,7 @@ interface HoldingUpdatePreview {
|
|
|
12133
12178
|
trackedPrincipalAmount: bigint;
|
|
12134
12179
|
/** Complete tracked value, including NAV accounts (base units). */
|
|
12135
12180
|
trackedValueAmount: bigint;
|
|
12136
|
-
/** Total external balance pushed =
|
|
12181
|
+
/** Total external balance pushed = LP + complete tracked value. */
|
|
12137
12182
|
externalAmount: bigint;
|
|
12138
12183
|
}
|
|
12139
12184
|
interface VaultOracleResult {
|
|
@@ -12256,6 +12301,31 @@ interface SettlementSimulationSnapshot {
|
|
|
12256
12301
|
junior?: SimulatedShareClass;
|
|
12257
12302
|
senior?: SimulatedShareClass;
|
|
12258
12303
|
}
|
|
12304
|
+
interface MaxApyAnchorSnapshot {
|
|
12305
|
+
sharePrice: bigint;
|
|
12306
|
+
timestamp: bigint;
|
|
12307
|
+
previousSharePrice: bigint;
|
|
12308
|
+
previousTimestamp: bigint;
|
|
12309
|
+
}
|
|
12310
|
+
/** Inputs to the program's linear annualized max-APY comparison. */
|
|
12311
|
+
interface RealizedApySimulation {
|
|
12312
|
+
basis: "regular-share-price";
|
|
12313
|
+
priorValue: bigint;
|
|
12314
|
+
nextValue?: bigint;
|
|
12315
|
+
priorTs: bigint;
|
|
12316
|
+
timestampSource: "apy.max_apy_anchor.timestamp" | "apy.max_apy_anchor.previous_timestamp" | "legacy fixed-APY anchor (initialization)" | "current share-price observation (initialization)";
|
|
12317
|
+
checkpointTs: bigint;
|
|
12318
|
+
nowTs: bigint;
|
|
12319
|
+
elapsedSecs: bigint;
|
|
12320
|
+
/** Signed annualized growth, in millionths of a basis point, truncated. */
|
|
12321
|
+
impliedApyMicroBps?: bigint;
|
|
12322
|
+
/** Ceiling of the positive implied rate; zero for flat/negative growth. */
|
|
12323
|
+
minimumCapBps?: bigint;
|
|
12324
|
+
maxApyBps: number;
|
|
12325
|
+
fixedApyBps: number;
|
|
12326
|
+
hwmBefore: bigint;
|
|
12327
|
+
hwmAfter: bigint;
|
|
12328
|
+
}
|
|
12259
12329
|
/**
|
|
12260
12330
|
* Result of replaying the relevant on-chain consensus and NAV-settlement math.
|
|
12261
12331
|
* All numbers remain in raw on-chain fixed-point/base units.
|
|
@@ -12275,6 +12345,10 @@ interface SettlementSimulation {
|
|
|
12275
12345
|
/** Per-holding attribution of the gross-NAV change consensus would cause. */
|
|
12276
12346
|
navContributions: HoldingNavContribution[];
|
|
12277
12347
|
grossNav?: bigint;
|
|
12348
|
+
/** Also retained when max APY blocks the otherwise-projected settlement. */
|
|
12349
|
+
realizedApy?: RealizedApySimulation;
|
|
12350
|
+
/** Weekly observations after the projected settlement succeeds. */
|
|
12351
|
+
projectedMaxApyAnchor?: MaxApyAnchorSnapshot;
|
|
12278
12352
|
settledAccountingNav?: bigint;
|
|
12279
12353
|
current: SettlementSimulationSnapshot;
|
|
12280
12354
|
/**
|
|
@@ -12283,6 +12357,8 @@ interface SettlementSimulation {
|
|
|
12283
12357
|
* until the vault config is updated.
|
|
12284
12358
|
*/
|
|
12285
12359
|
projectionRequiresMaxApyDisabled?: boolean;
|
|
12360
|
+
/** Hypothetical projection with losses enabled; the real crank remains blocked. */
|
|
12361
|
+
projectionRequiresLossesEnabled?: boolean;
|
|
12286
12362
|
projected?: SettlementSimulationSnapshot;
|
|
12287
12363
|
performanceFees?: {
|
|
12288
12364
|
curator: bigint;
|
|
@@ -12301,7 +12377,6 @@ interface VaultPricingInputs {
|
|
|
12301
12377
|
assetDecimals: number;
|
|
12302
12378
|
baseUsd: number;
|
|
12303
12379
|
usdPrices: Record<string, number>;
|
|
12304
|
-
walletBalances: Record<string, bigint>;
|
|
12305
12380
|
lpByMint: Map<string, bigint>;
|
|
12306
12381
|
configByMint: Map<string, ConsensusOracleHoldingConfig>;
|
|
12307
12382
|
}
|
|
@@ -12425,7 +12500,6 @@ interface LargeBalanceChangeViolation {
|
|
|
12425
12500
|
valueChange: bigint;
|
|
12426
12501
|
tvl: bigint;
|
|
12427
12502
|
thresholdBps: bigint;
|
|
12428
|
-
walletAmount: bigint;
|
|
12429
12503
|
lpAmount: bigint;
|
|
12430
12504
|
trackedPrincipalAmount: bigint;
|
|
12431
12505
|
trackedValueAmount: bigint;
|
|
@@ -12489,11 +12563,6 @@ interface RefreshLiveOraclePricesParams {
|
|
|
12489
12563
|
/** Returns true when at least one price was actually refreshed on-chain. */
|
|
12490
12564
|
declare function refreshLiveOraclePrices({ oracle, signer, vault, vaultState, nowSecs, log, dryRun, }: RefreshLiveOraclePricesParams): Promise<boolean>;
|
|
12491
12565
|
|
|
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
12566
|
declare function gatherPricingInputs(deps: ConsensusOracleDeps, target: ConsensusOracleTarget, vaultState: DecodedVault, reportableHoldings: ConsensusHoldingEntry[], log?: (msg: string) => void): Promise<VaultPricingInputs>;
|
|
12498
12567
|
/**
|
|
12499
12568
|
* Live-LP balances for the target, summed by mint (empty if no provider).
|
|
@@ -12503,7 +12572,7 @@ declare function gatherPricingInputs(deps: ConsensusOracleDeps, target: Consensu
|
|
|
12503
12572
|
* or hit a lagging RPC node, and this value is reported on-chain as
|
|
12504
12573
|
* `external_amount`.
|
|
12505
12574
|
*/
|
|
12506
|
-
declare function fetchExternalPositions(deps: ConsensusOracleDeps, target: ConsensusOracleTarget,
|
|
12575
|
+
declare function fetchExternalPositions(deps: ConsensusOracleDeps, target: ConsensusOracleTarget, vaultState: DecodedVault, log?: (msg: string) => void): Promise<Map<string, bigint>>;
|
|
12507
12576
|
|
|
12508
12577
|
/**
|
|
12509
12578
|
* Receipt mints issued by a vault are liabilities/shares, not underlying assets
|
|
@@ -12544,8 +12613,9 @@ interface LogProspectiveApyParams {
|
|
|
12544
12613
|
log: (msg: string) => void;
|
|
12545
12614
|
}
|
|
12546
12615
|
/**
|
|
12547
|
-
*
|
|
12548
|
-
*
|
|
12616
|
+
* @deprecated Raw candidate NAV estimate, retained for SDK compatibility.
|
|
12617
|
+
* Use simulateDryRunSettlement + formatSettlementSimulation for the program's
|
|
12618
|
+
* consensus-aware max-APY diagnostic, including regular-share and HWM rules.
|
|
12549
12619
|
*
|
|
12550
12620
|
* NAV is expressed in the vault's accounting unit (scaled by assetDecimals).
|
|
12551
12621
|
* Mirrors `gross_nav_from_holdings`: consensus updates overlay their target
|
|
@@ -12570,8 +12640,8 @@ declare function discoverVaultsForSigner(client: VaultClient, signer: Keypair, o
|
|
|
12570
12640
|
|
|
12571
12641
|
/**
|
|
12572
12642
|
* Fail closed while any configured yield account has an unsettled payment.
|
|
12573
|
-
*
|
|
12574
|
-
* balance
|
|
12643
|
+
* Confirmed payments reduce tracked value; the oracle does not add the payout's
|
|
12644
|
+
* destination balance to the reported external amount.
|
|
12575
12645
|
*/
|
|
12576
12646
|
declare function assertNoUnconfirmedYieldPayments(yieldTracker: YieldTracker | undefined, target: ConsensusOracleTarget): Promise<void>;
|
|
12577
12647
|
/**
|
|
@@ -12581,24 +12651,6 @@ declare function assertNoUnconfirmedYieldPayments(yieldTracker: YieldTracker | u
|
|
|
12581
12651
|
*/
|
|
12582
12652
|
declare function withDiscoveredYieldAccounts(yieldTracker: YieldTracker | undefined, target: ConsensusOracleTarget, vaultState: DecodedVault, excludedMints: ReadonlySet<string>, log: (msg: string) => void): Promise<ConsensusOracleTarget>;
|
|
12583
12653
|
|
|
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
12654
|
/**
|
|
12603
12655
|
* Jupiter price API (`GET /price/v3`).
|
|
12604
12656
|
*
|
|
@@ -12682,28 +12734,6 @@ declare class LivePriceSource implements PriceSource {
|
|
|
12682
12734
|
fetchUsdPrices(mints: Address[]): Promise<Record<string, number>>;
|
|
12683
12735
|
}
|
|
12684
12736
|
|
|
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
12737
|
/**
|
|
12708
12738
|
* Aggregation of {@link ExternalPositionProvider}s plus a trivial static
|
|
12709
12739
|
* provider. Concrete live-LP providers (Kamino, Marginfi) wrap protocol SDKs,
|
|
@@ -12834,6 +12864,7 @@ declare class MockYieldTracker implements YieldTracker {
|
|
|
12834
12864
|
* file owns deterministic program-math parity and is straightforward to test.
|
|
12835
12865
|
*/
|
|
12836
12866
|
|
|
12867
|
+
declare const MAX_APY_ANCHOR_WINDOW_SECS = 604800n;
|
|
12837
12868
|
interface SimulateSettlementArgs {
|
|
12838
12869
|
vault: DecodedVault;
|
|
12839
12870
|
oracleData: readonly number[];
|
|
@@ -12855,7 +12886,6 @@ declare function formatSettlementSimulation(simulation: SettlementSimulation): s
|
|
|
12855
12886
|
|
|
12856
12887
|
interface LiveConsensusOracleDepsOptions {
|
|
12857
12888
|
log?: (msg: string) => void;
|
|
12858
|
-
rpcOnly?: boolean;
|
|
12859
12889
|
includeExternalPositions?: boolean;
|
|
12860
12890
|
}
|
|
12861
12891
|
declare function createLiveConsensusOracleDeps(connection: Connection, opts?: LiveConsensusOracleDepsOptions): ConsensusOracleDeps;
|
|
@@ -12865,8 +12895,6 @@ interface RunLiveConsensusOracleOptions extends RunOptions {
|
|
|
12865
12895
|
rpcUrl?: string;
|
|
12866
12896
|
/** Override the vault program id. Defaults to the environment's configured program. */
|
|
12867
12897
|
programId?: Address;
|
|
12868
|
-
/** Skip Jupiter balances and use RPC token-account balances only. */
|
|
12869
|
-
rpcOnly?: boolean;
|
|
12870
12898
|
/** Include live Kamino/Marginfi positions in external amount updates. Defaults to true. */
|
|
12871
12899
|
includeExternalPositions?: boolean;
|
|
12872
12900
|
}
|
|
@@ -13201,4 +13229,4 @@ declare class TimelockSettlementService {
|
|
|
13201
13229
|
private execute;
|
|
13202
13230
|
}
|
|
13203
13231
|
|
|
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 };
|
|
13232
|
+
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_APY_ANCHOR_WINDOW_SECS, 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 MaxApyAnchorSnapshot, 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 RealizedApySimulation, 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,
|
|
@@ -3306,6 +3249,7 @@ __export(index_exports, {
|
|
|
3306
3249
|
LOCAL_PROTOCOL_ADMIN: () => LOCAL_PROTOCOL_ADMIN,
|
|
3307
3250
|
LargeBalanceChangeError: () => LargeBalanceChangeError,
|
|
3308
3251
|
LivePriceSource: () => LivePriceSource,
|
|
3252
|
+
MAX_APY_ANCHOR_WINDOW_SECS: () => MAX_APY_ANCHOR_WINDOW_SECS,
|
|
3309
3253
|
MAX_BALANCE_CHANGE_BPS: () => MAX_BALANCE_CHANGE_BPS,
|
|
3310
3254
|
MAX_CONSENSUS_SIGNERS: () => MAX_CONSENSUS_SIGNERS,
|
|
3311
3255
|
MAX_INCENTIVE_RECIPIENTS: () => MAX_INCENTIVE_RECIPIENTS,
|
|
@@ -9973,8 +9917,9 @@ var IDL = {
|
|
|
9973
9917
|
{
|
|
9974
9918
|
name: "max_apy_bps",
|
|
9975
9919
|
docs: [
|
|
9976
|
-
"Maximum annualized
|
|
9977
|
-
"
|
|
9920
|
+
"Maximum linear annualized growth of the settled regular share price",
|
|
9921
|
+
"against `max_apy_anchor`, for settlements advancing its performance-fee",
|
|
9922
|
+
"high-water mark. Basis points; zero disables enforcement, not observation."
|
|
9978
9923
|
],
|
|
9979
9924
|
type: "u16"
|
|
9980
9925
|
},
|
|
@@ -10021,10 +9966,23 @@ var IDL = {
|
|
|
10021
9966
|
],
|
|
10022
9967
|
type: "i64"
|
|
10023
9968
|
},
|
|
9969
|
+
{
|
|
9970
|
+
name: "max_apy_anchor",
|
|
9971
|
+
docs: [
|
|
9972
|
+
"Independent of the durable fixed-APY accrual anchor above. Carved from",
|
|
9973
|
+
"reserved bytes without changing APYConfig or Vault size/field offsets.",
|
|
9974
|
+
"Existing zero-filled accounts initialize lazily from a known price/time."
|
|
9975
|
+
],
|
|
9976
|
+
type: {
|
|
9977
|
+
defined: {
|
|
9978
|
+
name: "MaxApyAnchor"
|
|
9979
|
+
}
|
|
9980
|
+
}
|
|
9981
|
+
},
|
|
10024
9982
|
{
|
|
10025
9983
|
name: "_padding1",
|
|
10026
9984
|
type: {
|
|
10027
|
-
array: ["u64",
|
|
9985
|
+
array: ["u64", 28]
|
|
10028
9986
|
}
|
|
10029
9987
|
}
|
|
10030
9988
|
]
|
|
@@ -10611,6 +10569,41 @@ var IDL = {
|
|
|
10611
10569
|
]
|
|
10612
10570
|
}
|
|
10613
10571
|
},
|
|
10572
|
+
{
|
|
10573
|
+
name: "MaxApyAnchor",
|
|
10574
|
+
docs: [
|
|
10575
|
+
"Weekly observations of the settled regular share price. Keep the previous",
|
|
10576
|
+
"observation while the newest is younger than seven days, so rollover never",
|
|
10577
|
+
"reduces a mature comparison window to a few seconds. With regular settlement",
|
|
10578
|
+
"the effective lookback is seven to fourteen days; sparse settlement can make",
|
|
10579
|
+
"it longer. A new cohort uses its actual age until seven days of history exist."
|
|
10580
|
+
],
|
|
10581
|
+
serialization: "bytemuck",
|
|
10582
|
+
repr: {
|
|
10583
|
+
kind: "c"
|
|
10584
|
+
},
|
|
10585
|
+
type: {
|
|
10586
|
+
kind: "struct",
|
|
10587
|
+
fields: [
|
|
10588
|
+
{
|
|
10589
|
+
name: "share_price",
|
|
10590
|
+
type: "u64"
|
|
10591
|
+
},
|
|
10592
|
+
{
|
|
10593
|
+
name: "timestamp",
|
|
10594
|
+
type: "i64"
|
|
10595
|
+
},
|
|
10596
|
+
{
|
|
10597
|
+
name: "previous_share_price",
|
|
10598
|
+
type: "u64"
|
|
10599
|
+
},
|
|
10600
|
+
{
|
|
10601
|
+
name: "previous_timestamp",
|
|
10602
|
+
type: "i64"
|
|
10603
|
+
}
|
|
10604
|
+
]
|
|
10605
|
+
}
|
|
10606
|
+
},
|
|
10614
10607
|
{
|
|
10615
10608
|
name: "PendingManagerWithdrawDestination",
|
|
10616
10609
|
docs: [
|
|
@@ -16376,8 +16369,9 @@ var TransactionClient = class {
|
|
|
16376
16369
|
|
|
16377
16370
|
// src/client/client.ts
|
|
16378
16371
|
var VaultClient = class {
|
|
16379
|
-
constructor(provider, programId = VAULT_PROGRAM_ID) {
|
|
16372
|
+
constructor(provider, programId = VAULT_PROGRAM_ID, options = {}) {
|
|
16380
16373
|
this.provider = provider;
|
|
16374
|
+
this.skipSimulation = options.skipSimulation ?? false;
|
|
16381
16375
|
const idl = { ...IDL, address: programId };
|
|
16382
16376
|
this.program = new import_core18.Program(idl, provider);
|
|
16383
16377
|
this.pda = new PdaClient((0, import_kit9.address)(this.program.programId.toBase58()));
|
|
@@ -16410,13 +16404,20 @@ var VaultClient = class {
|
|
|
16410
16404
|
const signature = await this.provider.connection.sendRawTransaction(
|
|
16411
16405
|
tx.serialize(),
|
|
16412
16406
|
{
|
|
16413
|
-
skipPreflight:
|
|
16407
|
+
skipPreflight: this.skipSimulation
|
|
16414
16408
|
}
|
|
16415
16409
|
);
|
|
16416
|
-
await this.provider.connection.confirmTransaction(
|
|
16410
|
+
const confirmation = await this.provider.connection.confirmTransaction(
|
|
16417
16411
|
{ signature, blockhash, lastValidBlockHeight },
|
|
16418
16412
|
"confirmed"
|
|
16419
16413
|
);
|
|
16414
|
+
if (confirmation.value.err) {
|
|
16415
|
+
throw new Error(
|
|
16416
|
+
`Transaction ${signature} failed: ${JSON.stringify(
|
|
16417
|
+
confirmation.value.err
|
|
16418
|
+
)}`
|
|
16419
|
+
);
|
|
16420
|
+
}
|
|
16420
16421
|
this.applyCacheInvalidations(plan);
|
|
16421
16422
|
return signature;
|
|
16422
16423
|
}
|
|
@@ -16526,7 +16527,8 @@ function createVaultClient(env, opts = {}) {
|
|
|
16526
16527
|
});
|
|
16527
16528
|
const client = new VaultClient(
|
|
16528
16529
|
provider,
|
|
16529
|
-
opts.programId ?? getVaultProgramId(env)
|
|
16530
|
+
opts.programId ?? getVaultProgramId(env),
|
|
16531
|
+
{ skipSimulation: opts.skipSimulation }
|
|
16530
16532
|
);
|
|
16531
16533
|
return {
|
|
16532
16534
|
env,
|
|
@@ -17720,7 +17722,6 @@ function evaluateBalanceChanges(vaultState, updates, thresholdBps, nowSecs) {
|
|
|
17720
17722
|
valueChange: valueNumerator / amountScale,
|
|
17721
17723
|
tvl,
|
|
17722
17724
|
thresholdBps,
|
|
17723
|
-
walletAmount: update.walletAmount,
|
|
17724
17725
|
lpAmount: update.lpAmount,
|
|
17725
17726
|
trackedPrincipalAmount: update.trackedPrincipalAmount,
|
|
17726
17727
|
trackedValueAmount: update.trackedValueAmount,
|
|
@@ -17782,10 +17783,7 @@ function assertNoLargeBalanceChanges(vault, vaultState, updates, nowSecs, log =
|
|
|
17782
17783
|
violation.decimals
|
|
17783
17784
|
)}, value_change=${violation.valueChange} accounting_base_units (${percentOfTvl} of TVL ${violation.tvl} accounting_base_units; threshold=${formatBpsAsPercent(
|
|
17784
17785
|
violation.thresholdBps
|
|
17785
|
-
)}), sources=[
|
|
17786
|
-
violation.walletAmount,
|
|
17787
|
-
violation.decimals
|
|
17788
|
-
)} lp=${formatTokenAmount(
|
|
17786
|
+
)}), sources=[lp=${formatTokenAmount(
|
|
17789
17787
|
violation.lpAmount,
|
|
17790
17788
|
violation.decimals
|
|
17791
17789
|
)} tracked=${formatTokenAmount(
|
|
@@ -17848,6 +17846,7 @@ var DEFAULT_SHARE_PRICE = 1000000n;
|
|
|
17848
17846
|
var BPS_DENOMINATOR3 = 10000n;
|
|
17849
17847
|
var NAV_LOSS_TOLERANCE_BPS = 25n;
|
|
17850
17848
|
var SECONDS_PER_YEAR = 31536000n;
|
|
17849
|
+
var MAX_APY_ANCHOR_WINDOW_SECS = 604800n;
|
|
17851
17850
|
var DEFAULT_STALENESS_SECS = 86400n;
|
|
17852
17851
|
var CONSENSUS_MAX_DIFF_BPS = 8n;
|
|
17853
17852
|
var MIN_CONSENSUS_SIGNERS = 2;
|
|
@@ -17950,6 +17949,7 @@ function simulateConsensusOracleSettlement(args) {
|
|
|
17950
17949
|
current
|
|
17951
17950
|
};
|
|
17952
17951
|
}
|
|
17952
|
+
let realizedApy;
|
|
17953
17953
|
try {
|
|
17954
17954
|
const settlement = settleVault({
|
|
17955
17955
|
grossNav,
|
|
@@ -17968,7 +17968,11 @@ function simulateConsensusOracleSettlement(args) {
|
|
|
17968
17968
|
accruedApyBalance: bigint(apyConfig.accruedApyBalance),
|
|
17969
17969
|
apyAnchorSharePrice: bigint(apyConfig.anchorSharePrice),
|
|
17970
17970
|
apyAnchorTs: bigint(apyConfig.anchorTs),
|
|
17971
|
-
|
|
17971
|
+
maxApyAnchor: decodeMaxApyAnchor(apyConfig.maxApyAnchor),
|
|
17972
|
+
tranche: currentTranche,
|
|
17973
|
+
onRealizedApy: (diagnostic) => {
|
|
17974
|
+
realizedApy = diagnostic;
|
|
17975
|
+
}
|
|
17972
17976
|
});
|
|
17973
17977
|
return {
|
|
17974
17978
|
nowTs: args.nowTs,
|
|
@@ -17980,6 +17984,8 @@ function simulateConsensusOracleSettlement(args) {
|
|
|
17980
17984
|
consensus,
|
|
17981
17985
|
navContributions,
|
|
17982
17986
|
grossNav,
|
|
17987
|
+
realizedApy,
|
|
17988
|
+
projectedMaxApyAnchor: settlement.maxApyAnchor,
|
|
17983
17989
|
settledAccountingNav: settlement.settledAccountingNav,
|
|
17984
17990
|
current,
|
|
17985
17991
|
projected: settlement.projected,
|
|
@@ -17988,50 +17994,32 @@ function simulateConsensusOracleSettlement(args) {
|
|
|
17988
17994
|
} catch (error) {
|
|
17989
17995
|
const blocker = message(error);
|
|
17990
17996
|
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
|
-
|
|
18016
|
-
|
|
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
|
-
}
|
|
17997
|
+
const requiresLossesEnabled = blocker.includes("LossesDisabled");
|
|
17998
|
+
const requiresMaxApyDisabled = blocker.includes("MaxApyExceeded");
|
|
17999
|
+
if (requiresLossesEnabled || requiresMaxApyDisabled) {
|
|
18000
|
+
const projection = simulateConsensusOracleSettlement({
|
|
18001
|
+
...args,
|
|
18002
|
+
vault: {
|
|
18003
|
+
...args.vault,
|
|
18004
|
+
lossesEnabled: requiresLossesEnabled ? true : args.vault.lossesEnabled,
|
|
18005
|
+
config: {
|
|
18006
|
+
...args.vault.config,
|
|
18007
|
+
apy: {
|
|
18008
|
+
...apyConfig,
|
|
18009
|
+
maxApyBps: requiresMaxApyDisabled ? 0 : apyConfig.maxApyBps
|
|
18010
|
+
}
|
|
18011
|
+
}
|
|
18012
|
+
}
|
|
18013
|
+
});
|
|
18014
|
+
return {
|
|
18015
|
+
...projection,
|
|
18016
|
+
// Retain the real configured cap when the projection retries uncapped.
|
|
18017
|
+
realizedApy: realizedApy ?? projection.realizedApy,
|
|
18018
|
+
canSettle: false,
|
|
18019
|
+
blockers: [...blockers, ...projection.blockers],
|
|
18020
|
+
projectionRequiresLossesEnabled: projection.projected ? requiresLossesEnabled || projection.projectionRequiresLossesEnabled : void 0,
|
|
18021
|
+
projectionRequiresMaxApyDisabled: projection.projected ? requiresMaxApyDisabled || projection.projectionRequiresMaxApyDisabled : void 0
|
|
18022
|
+
};
|
|
18035
18023
|
}
|
|
18036
18024
|
return {
|
|
18037
18025
|
nowTs: args.nowTs,
|
|
@@ -18043,6 +18031,7 @@ function simulateConsensusOracleSettlement(args) {
|
|
|
18043
18031
|
consensus,
|
|
18044
18032
|
navContributions,
|
|
18045
18033
|
grossNav,
|
|
18034
|
+
realizedApy,
|
|
18046
18035
|
current
|
|
18047
18036
|
};
|
|
18048
18037
|
}
|
|
@@ -18117,8 +18106,23 @@ function settleVault(args) {
|
|
|
18117
18106
|
`crank would fail LossesDisabled: gross NAV ${args.grossNav} is more than ${NAV_LOSS_TOLERANCE_BPS}bps below physical NAV ${physicalNavBefore}`
|
|
18118
18107
|
);
|
|
18119
18108
|
}
|
|
18120
|
-
const
|
|
18121
|
-
|
|
18109
|
+
const priorSettledTs = args.priorSettledNavTs > 0n ? args.priorSettledNavTs : max(args.accountingLastUpdateTs, args.apyAnchorTs);
|
|
18110
|
+
let maxApyAnchor = { ...args.maxApyAnchor };
|
|
18111
|
+
let timestampSource = "apy.max_apy_anchor.timestamp";
|
|
18112
|
+
if (maxApyAnchor.sharePrice <= 0n || maxApyAnchor.timestamp <= 0n) {
|
|
18113
|
+
const hasFixedAnchor = args.apyAnchorSharePrice > 0n && args.apyAnchorTs > 0n;
|
|
18114
|
+
maxApyAnchor = {
|
|
18115
|
+
sharePrice: hasFixedAnchor ? args.apyAnchorSharePrice : args.currentSharePrice,
|
|
18116
|
+
timestamp: hasFixedAnchor ? args.apyAnchorTs : max(priorSettledTs, args.accountingLastUpdateTs),
|
|
18117
|
+
previousSharePrice: 0n,
|
|
18118
|
+
previousTimestamp: 0n
|
|
18119
|
+
};
|
|
18120
|
+
timestampSource = hasFixedAnchor ? "legacy fixed-APY anchor (initialization)" : "current share-price observation (initialization)";
|
|
18121
|
+
}
|
|
18122
|
+
const usePrevious = args.nowTs - maxApyAnchor.timestamp < MAX_APY_ANCHOR_WINDOW_SECS && maxApyAnchor.previousSharePrice > 0n && maxApyAnchor.previousTimestamp > 0n;
|
|
18123
|
+
const priorApyValue = usePrevious ? maxApyAnchor.previousSharePrice : maxApyAnchor.sharePrice;
|
|
18124
|
+
const priorTs = usePrevious ? maxApyAnchor.previousTimestamp : maxApyAnchor.timestamp;
|
|
18125
|
+
if (usePrevious) timestampSource = "apy.max_apy_anchor.previous_timestamp";
|
|
18122
18126
|
let regularValue;
|
|
18123
18127
|
let regularSharePrice = args.currentSharePrice;
|
|
18124
18128
|
let regularHwmSharePrice = args.hwmSharePrice;
|
|
@@ -18191,15 +18195,55 @@ function settleVault(args) {
|
|
|
18191
18195
|
curatorFee = regularFees.fees.curator;
|
|
18192
18196
|
protocolFee = regularFees.fees.protocol;
|
|
18193
18197
|
}
|
|
18198
|
+
const nextApyValue = args.totalSupply > 0n ? regularSharePrice : void 0;
|
|
18199
|
+
const elapsedSecs = args.nowTs - priorTs;
|
|
18200
|
+
const numerator = nextApyValue === void 0 ? void 0 : (nextApyValue - priorApyValue) * BPS_DENOMINATOR3 * SECONDS_PER_YEAR;
|
|
18201
|
+
const denominator = priorApyValue * elapsedSecs;
|
|
18202
|
+
const rateAvailable = numerator !== void 0 && priorApyValue > 0n && priorTs > 0n && elapsedSecs > 0n;
|
|
18203
|
+
args.onRealizedApy({
|
|
18204
|
+
basis: "regular-share-price",
|
|
18205
|
+
priorValue: priorApyValue,
|
|
18206
|
+
nextValue: nextApyValue,
|
|
18207
|
+
priorTs,
|
|
18208
|
+
timestampSource,
|
|
18209
|
+
checkpointTs: maxApyAnchor.timestamp,
|
|
18210
|
+
nowTs: args.nowTs,
|
|
18211
|
+
elapsedSecs,
|
|
18212
|
+
impliedApyMicroBps: rateAvailable ? numerator * 1000000n / denominator : void 0,
|
|
18213
|
+
minimumCapBps: rateAvailable ? numerator > 0n ? (numerator + denominator - 1n) / denominator : 0n : void 0,
|
|
18214
|
+
maxApyBps: args.maxApyBps,
|
|
18215
|
+
fixedApyBps: args.fixedApyBps,
|
|
18216
|
+
hwmBefore: args.hwmSharePrice,
|
|
18217
|
+
hwmAfter: regularHwmSharePrice
|
|
18218
|
+
});
|
|
18194
18219
|
if (regularHwmSharePrice > args.hwmSharePrice && nextApyValue !== void 0) {
|
|
18195
18220
|
validateRealizedApy(
|
|
18196
|
-
|
|
18221
|
+
priorApyValue,
|
|
18197
18222
|
priorTs,
|
|
18198
18223
|
nextApyValue,
|
|
18199
18224
|
args.nowTs,
|
|
18200
18225
|
args.maxApyBps
|
|
18201
18226
|
);
|
|
18202
18227
|
}
|
|
18228
|
+
if (args.totalSupply > 0n) {
|
|
18229
|
+
if (maxApyAnchor.sharePrice <= 0n || maxApyAnchor.timestamp <= 0n) {
|
|
18230
|
+
maxApyAnchor = {
|
|
18231
|
+
sharePrice: regularSharePrice,
|
|
18232
|
+
timestamp: args.nowTs,
|
|
18233
|
+
previousSharePrice: 0n,
|
|
18234
|
+
previousTimestamp: 0n
|
|
18235
|
+
};
|
|
18236
|
+
} else if (args.nowTs - maxApyAnchor.timestamp >= MAX_APY_ANCHOR_WINDOW_SECS) {
|
|
18237
|
+
maxApyAnchor = {
|
|
18238
|
+
sharePrice: regularSharePrice,
|
|
18239
|
+
timestamp: args.nowTs,
|
|
18240
|
+
previousSharePrice: maxApyAnchor.sharePrice,
|
|
18241
|
+
previousTimestamp: maxApyAnchor.timestamp
|
|
18242
|
+
};
|
|
18243
|
+
}
|
|
18244
|
+
} else {
|
|
18245
|
+
maxApyAnchor = args.maxApyAnchor;
|
|
18246
|
+
}
|
|
18203
18247
|
const totalFees = curatorFee + protocolFee;
|
|
18204
18248
|
const netRegularBacking = mulDiv2(
|
|
18205
18249
|
args.totalSupply,
|
|
@@ -18226,6 +18270,7 @@ function settleVault(args) {
|
|
|
18226
18270
|
return {
|
|
18227
18271
|
settledAccountingNav,
|
|
18228
18272
|
projected,
|
|
18273
|
+
maxApyAnchor,
|
|
18229
18274
|
performanceFees: {
|
|
18230
18275
|
curator: curatorFee,
|
|
18231
18276
|
protocol: protocolFee,
|
|
@@ -18234,6 +18279,15 @@ function settleVault(args) {
|
|
|
18234
18279
|
}
|
|
18235
18280
|
};
|
|
18236
18281
|
}
|
|
18282
|
+
function decodeMaxApyAnchor(value) {
|
|
18283
|
+
const decoded = record(value);
|
|
18284
|
+
return {
|
|
18285
|
+
sharePrice: bigint(decoded.sharePrice),
|
|
18286
|
+
timestamp: bigint(decoded.timestamp),
|
|
18287
|
+
previousSharePrice: bigint(decoded.previousSharePrice),
|
|
18288
|
+
previousTimestamp: bigint(decoded.previousTimestamp)
|
|
18289
|
+
};
|
|
18290
|
+
}
|
|
18237
18291
|
function settleTrancheNav(tranche, currentTvl, nextTvl, nowTs) {
|
|
18238
18292
|
const before = tranche.junior.value + tranche.senior.value;
|
|
18239
18293
|
if (before === 0n) {
|
|
@@ -18415,7 +18469,7 @@ function validateRealizedApy(priorValue, priorTs, nextValue, nextTs, maxApyBps)
|
|
|
18415
18469
|
const lhs = (nextValue - priorValue) * BPS_DENOMINATOR3 * SECONDS_PER_YEAR;
|
|
18416
18470
|
const rhs = BigInt(maxApyBps) * priorValue * elapsed;
|
|
18417
18471
|
if (lhs > rhs) {
|
|
18418
|
-
const implied = lhs / (priorValue * elapsed);
|
|
18472
|
+
const implied = formatUnits(lhs * 1000000n / (priorValue * elapsed), 6);
|
|
18419
18473
|
throw new Error(
|
|
18420
18474
|
`crank would fail MaxApyExceeded: implied ${implied}bps > ${maxApyBps}bps`
|
|
18421
18475
|
);
|
|
@@ -18772,6 +18826,13 @@ function formatSettlementSimulation(simulation) {
|
|
|
18772
18826
|
lines.push(
|
|
18773
18827
|
` crank simulation: ${simulation.canSettle ? "WOULD SETTLE" : "BLOCKED"}`
|
|
18774
18828
|
);
|
|
18829
|
+
if (simulation.realizedApy) {
|
|
18830
|
+
lines.push(...formatRealizedApy(simulation.realizedApy));
|
|
18831
|
+
} else {
|
|
18832
|
+
lines.push(
|
|
18833
|
+
" max-APY diagnostic unavailable: settlement did not reach the APY check"
|
|
18834
|
+
);
|
|
18835
|
+
}
|
|
18775
18836
|
for (const holding of simulation.consensus) {
|
|
18776
18837
|
const detail = holding.settledPrice ? `price=${holding.settledPrice} external=${holding.settledExternalAmount}` : holding.reason ?? "no aggregate";
|
|
18777
18838
|
lines.push(
|
|
@@ -18832,6 +18893,11 @@ function formatSettlementSimulation(simulation) {
|
|
|
18832
18893
|
);
|
|
18833
18894
|
}
|
|
18834
18895
|
if (simulation.projected) {
|
|
18896
|
+
if (simulation.projectionRequiresLossesEnabled) {
|
|
18897
|
+
lines.push(
|
|
18898
|
+
" hypothetical projection with losses enabled (losses_enabled=true):"
|
|
18899
|
+
);
|
|
18900
|
+
}
|
|
18835
18901
|
if (simulation.projectionRequiresMaxApyDisabled) {
|
|
18836
18902
|
lines.push(" projection with max APY disabled (max_apy_bps=0):");
|
|
18837
18903
|
}
|
|
@@ -18888,6 +18954,70 @@ function formatSettlementSimulation(simulation) {
|
|
|
18888
18954
|
lines.push(` warning: ${warning}`);
|
|
18889
18955
|
return lines;
|
|
18890
18956
|
}
|
|
18957
|
+
function formatRealizedApy(apy) {
|
|
18958
|
+
const lines = [
|
|
18959
|
+
` max-APY share-price anchor -> settled regular share price (after tranche allocation, fixed APY, and fees): ${formatUnits(
|
|
18960
|
+
apy.priorValue,
|
|
18961
|
+
6
|
|
18962
|
+
)} [${apy.priorValue}] -> ${apy.nextValue === void 0 ? "unavailable (zero supply)" : `${formatUnits(apy.nextValue, 6)} [${apy.nextValue}]`}`,
|
|
18963
|
+
` weekly checkpoints: every 604800s (7 days); previous checkpoint retained through rollover; latest=${apy.checkpointTs}`,
|
|
18964
|
+
` observation window: ${formatUnits(
|
|
18965
|
+
apy.elapsedSecs * 1000000n / 86400n,
|
|
18966
|
+
6
|
|
18967
|
+
)} days${apy.elapsedSecs < MAX_APY_ANCHOR_WINDOW_SECS ? " (initial history is shorter than 7 days)" : ""}`,
|
|
18968
|
+
` timestamp: ${apy.priorTs} from ${apy.timestampSource}; settlement time estimate=${apy.nowTs}; elapsed=${apy.elapsedSecs}s`,
|
|
18969
|
+
` configured max: ${apy.maxApyBps}bps (${formatUnits(
|
|
18970
|
+
BigInt(apy.maxApyBps),
|
|
18971
|
+
2
|
|
18972
|
+
)}%); regular HWM: ${apy.hwmBefore} -> ${apy.hwmAfter}`
|
|
18973
|
+
];
|
|
18974
|
+
if (apy.impliedApyMicroBps !== void 0) {
|
|
18975
|
+
lines.push(
|
|
18976
|
+
` implied APY (linear annualization): ${formatUnits(
|
|
18977
|
+
apy.impliedApyMicroBps,
|
|
18978
|
+
6
|
|
18979
|
+
)}bps (${formatUnits(apy.impliedApyMicroBps, 8)}%)`
|
|
18980
|
+
);
|
|
18981
|
+
lines.push(
|
|
18982
|
+
" formula: (new - anchor) * 10,000 * 31,536,000 / (anchor * elapsed_seconds)"
|
|
18983
|
+
);
|
|
18984
|
+
} else {
|
|
18985
|
+
lines.push(
|
|
18986
|
+
" implied APY: unavailable (missing baseline/supply or non-positive elapsed time)"
|
|
18987
|
+
);
|
|
18988
|
+
}
|
|
18989
|
+
const hwmAdvances = apy.hwmAfter > apy.hwmBefore;
|
|
18990
|
+
const positiveGrowth = apy.nextValue !== void 0 && apy.nextValue > apy.priorValue;
|
|
18991
|
+
const comparisonApplies = hwmAdvances && positiveGrowth && apy.priorValue > 0n && apy.priorTs > 0n;
|
|
18992
|
+
const status = apy.maxApyBps === 0 ? "DISABLED (0 means uncapped)" : !hwmAdvances ? "BYPASSED (regular HWM does not advance)" : apy.nextValue === void 0 ? "BYPASSED (zero regular supply)" : apy.priorValue === 0n || apy.priorTs <= 0n ? "BYPASSED (no valid prior anchor)" : !positiveGrowth ? "BYPASSED (no positive growth)" : apy.elapsedSecs <= 0n ? "BLOCKED (positive growth with no elapsed time; no nonzero cap passes)" : apy.minimumCapBps > BigInt(apy.maxApyBps) ? "BLOCKED (MaxApyExceeded)" : "PASS";
|
|
18993
|
+
lines.push(` max-APY guard: ${status}`);
|
|
18994
|
+
if (comparisonApplies && apy.elapsedSecs > 0n && apy.minimumCapBps !== void 0) {
|
|
18995
|
+
const minimum = max(1n, max(apy.minimumCapBps, BigInt(apy.fixedApyBps)));
|
|
18996
|
+
lines.push(
|
|
18997
|
+
` minimum nonzero --max-apy-bps for this snapshot: ${minimum} (${formatUnits(
|
|
18998
|
+
minimum,
|
|
18999
|
+
2
|
|
19000
|
+
)}%; rounded UP, includes fixed-APY config floor)`
|
|
19001
|
+
);
|
|
19002
|
+
if (minimum > BPS_DENOMINATOR3) {
|
|
19003
|
+
lines.push(
|
|
19004
|
+
" exceeds the configurable maximum of 10000bps (100%); no supported nonzero cap passes this snapshot"
|
|
19005
|
+
);
|
|
19006
|
+
}
|
|
19007
|
+
} else if (comparisonApplies && apy.elapsedSecs <= 0n) {
|
|
19008
|
+
lines.push(
|
|
19009
|
+
" no nonzero cap passes positive growth until settlement time advances beyond the anchor"
|
|
19010
|
+
);
|
|
19011
|
+
} else if (!comparisonApplies) {
|
|
19012
|
+
lines.push(
|
|
19013
|
+
" this settlement does not require a higher cap; the HWM/baseline/growth gate bypasses the comparison"
|
|
19014
|
+
);
|
|
19015
|
+
}
|
|
19016
|
+
lines.push(
|
|
19017
|
+
" estimate uses current consensus and sampled time; later reports or settlement time can change it"
|
|
19018
|
+
);
|
|
19019
|
+
return lines;
|
|
19020
|
+
}
|
|
18891
19021
|
function formatTransition(before, after, decimals) {
|
|
18892
19022
|
return `${formatUnits(before, decimals)} [${before}] -> ${formatUnits(
|
|
18893
19023
|
after,
|
|
@@ -18977,7 +19107,6 @@ async function buildHoldingUpdate(yieldTracker, entry, inputs) {
|
|
|
18977
19107
|
}
|
|
18978
19108
|
usd = accountingUnitPriceToUsd(price, inputs.baseUsd, inputs.assetDecimals);
|
|
18979
19109
|
}
|
|
18980
|
-
const walletAmount = inputs.walletBalances[mintKey] ?? 0n;
|
|
18981
19110
|
const lpAmount = inputs.lpByMint.get(mintKey) ?? 0n;
|
|
18982
19111
|
const { trackedValueAmount, principalAmount, yieldAmount } = await resolveTrackedAmounts(
|
|
18983
19112
|
yieldTracker,
|
|
@@ -18990,12 +19119,11 @@ async function buildHoldingUpdate(yieldTracker, entry, inputs) {
|
|
|
18990
19119
|
decimals: holding.decimals,
|
|
18991
19120
|
usdPrice: usd,
|
|
18992
19121
|
price,
|
|
18993
|
-
walletAmount,
|
|
18994
19122
|
lpAmount,
|
|
18995
19123
|
yieldAmount,
|
|
18996
19124
|
trackedPrincipalAmount: principalAmount,
|
|
18997
19125
|
trackedValueAmount,
|
|
18998
|
-
externalAmount:
|
|
19126
|
+
externalAmount: lpAmount + trackedValueAmount
|
|
18999
19127
|
};
|
|
19000
19128
|
}
|
|
19001
19129
|
async function resolveTrackedAmounts(yieldTracker, cfg, decimals) {
|
|
@@ -19091,7 +19219,6 @@ async function refreshLiveOraclePrices({
|
|
|
19091
19219
|
var import_common48 = __toESM(require_dist());
|
|
19092
19220
|
async function gatherPricingInputs(deps, target, vaultState, reportableHoldings, log = () => {
|
|
19093
19221
|
}) {
|
|
19094
|
-
const manager = (0, import_common48.fromWeb3Pk)(vaultState.roles.manager);
|
|
19095
19222
|
const consensusMints = reportableHoldings.filter(
|
|
19096
19223
|
({ holding }) => variantName2(holding.priceOracleType).toLowerCase() === CONSENSUS_ORACLE_VARIANT
|
|
19097
19224
|
).map(({ holding }) => (0, import_common48.fromWeb3Pk)(holding.mint));
|
|
@@ -19112,24 +19239,16 @@ async function gatherPricingInputs(deps, target, vaultState, reportableHoldings,
|
|
|
19112
19239
|
`no USD price for base asset ${baseMint} (cannot denominate prices)`
|
|
19113
19240
|
);
|
|
19114
19241
|
}
|
|
19115
|
-
const
|
|
19116
|
-
const lpByMint = await fetchExternalPositions(
|
|
19117
|
-
deps,
|
|
19118
|
-
target,
|
|
19119
|
-
manager,
|
|
19120
|
-
vaultState,
|
|
19121
|
-
log
|
|
19122
|
-
);
|
|
19242
|
+
const lpByMint = await fetchExternalPositions(deps, target, vaultState, log);
|
|
19123
19243
|
return {
|
|
19124
19244
|
assetDecimals: vaultState.config.assetDecimals,
|
|
19125
19245
|
baseUsd,
|
|
19126
19246
|
usdPrices,
|
|
19127
|
-
walletBalances,
|
|
19128
19247
|
lpByMint,
|
|
19129
19248
|
configByMint: indexConfigByMint(target.holdings)
|
|
19130
19249
|
};
|
|
19131
19250
|
}
|
|
19132
|
-
async function fetchExternalPositions(deps, target,
|
|
19251
|
+
async function fetchExternalPositions(deps, target, vaultState, log = () => {
|
|
19133
19252
|
}) {
|
|
19134
19253
|
if (!deps.externalPositions) return /* @__PURE__ */ new Map();
|
|
19135
19254
|
const configRefs = (target.holdings ?? []).flatMap(
|
|
@@ -19150,7 +19269,6 @@ async function fetchExternalPositions(deps, target, manager, vaultState, log = (
|
|
|
19150
19269
|
async () => sumPositionsByMint(
|
|
19151
19270
|
await provider.positionsFor({
|
|
19152
19271
|
vault: target.vault,
|
|
19153
|
-
manager,
|
|
19154
19272
|
refs: mergedRefs
|
|
19155
19273
|
})
|
|
19156
19274
|
),
|
|
@@ -19302,17 +19420,27 @@ async function settleVault2({
|
|
|
19302
19420
|
log(`vault ${vault}: submitting ${updates.length} consensus asset update(s)`);
|
|
19303
19421
|
for (const update of updates) {
|
|
19304
19422
|
log(
|
|
19305
|
-
` holding #${update.holdingIndex} ${update.mint}: price=${update.price} external_amount=${update.externalAmount} [
|
|
19423
|
+
` holding #${update.holdingIndex} ${update.mint}: price=${update.price} external_amount=${update.externalAmount} [lp=${update.lpAmount} tracked=${update.trackedValueAmount} principal=${update.trackedPrincipalAmount} yield=${update.yieldAmount}]`
|
|
19424
|
+
);
|
|
19425
|
+
}
|
|
19426
|
+
try {
|
|
19427
|
+
const simulation = await simulateDryRunSettlement({
|
|
19428
|
+
client,
|
|
19429
|
+
signer,
|
|
19430
|
+
vault,
|
|
19431
|
+
vaultState,
|
|
19432
|
+
updates,
|
|
19433
|
+
nowSecs
|
|
19434
|
+
});
|
|
19435
|
+
log(
|
|
19436
|
+
`vault ${vault}: expected settlement using this report and current consensus`
|
|
19437
|
+
);
|
|
19438
|
+
for (const line of formatSettlementSimulation(simulation)) log(line);
|
|
19439
|
+
} catch (error) {
|
|
19440
|
+
log(
|
|
19441
|
+
`vault ${vault}: expected share prices unavailable (${error instanceof Error ? error.message : String(error)})`
|
|
19306
19442
|
);
|
|
19307
19443
|
}
|
|
19308
|
-
await logProspectiveApy({
|
|
19309
|
-
client,
|
|
19310
|
-
vault,
|
|
19311
|
-
updates,
|
|
19312
|
-
vaultState,
|
|
19313
|
-
nowSecs,
|
|
19314
|
-
log
|
|
19315
|
-
});
|
|
19316
19444
|
await assertNoUnconfirmedYieldPayments(yieldTracker, target);
|
|
19317
19445
|
const updateSignature = await oracle.updateAssetConsensusPrice(
|
|
19318
19446
|
signer,
|
|
@@ -19377,7 +19505,7 @@ async function logProspectiveApy({
|
|
|
19377
19505
|
if (elapsedSecs <= 0n) return;
|
|
19378
19506
|
const apyBps = (prospectiveNav - physicalNavBefore) * SECONDS_PER_YEAR2 * 10000n / (physicalNavBefore * elapsedSecs);
|
|
19379
19507
|
log(
|
|
19380
|
-
`vault ${vault}:
|
|
19508
|
+
`vault ${vault}: raw candidate estimate (before consensus, not the max-APY check): NAV ${prospectiveNav} vs physical baseline ${physicalNavBefore} (elapsed ${elapsedSecs}s) \u2192 implied APY ${apyBps}bps`
|
|
19381
19509
|
);
|
|
19382
19510
|
} catch {
|
|
19383
19511
|
}
|
|
@@ -19471,34 +19599,6 @@ var LivePriceSource = class {
|
|
|
19471
19599
|
}
|
|
19472
19600
|
};
|
|
19473
19601
|
|
|
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
19602
|
// src/services/consensusOracle/positions/externalPositions.ts
|
|
19503
19603
|
var ExternalPositionRegistry = class {
|
|
19504
19604
|
constructor(providers = [], log = () => {
|
|
@@ -19836,10 +19936,6 @@ function createLiveConsensusOracleDeps(connection, opts = {}) {
|
|
|
19836
19936
|
});
|
|
19837
19937
|
const deps = {
|
|
19838
19938
|
priceSource: new LivePriceSource(),
|
|
19839
|
-
balanceSource: new JupiterBalanceSource(connection, {
|
|
19840
|
-
rpcOnly: opts.rpcOnly ?? false,
|
|
19841
|
-
log
|
|
19842
|
-
}),
|
|
19843
19939
|
yieldTracker: {
|
|
19844
19940
|
async getAccountNamesForVault(vault) {
|
|
19845
19941
|
const accounts2 = await getAccounts();
|
|
@@ -20079,7 +20175,6 @@ async function runLiveConsensusOracle(env, oracleSigner, opts = {}) {
|
|
|
20079
20175
|
client,
|
|
20080
20176
|
createLiveConsensusOracleDeps(client.provider.connection, {
|
|
20081
20177
|
log: opts.log,
|
|
20082
|
-
rpcOnly: opts.rpcOnly,
|
|
20083
20178
|
includeExternalPositions: opts.includeExternalPositions
|
|
20084
20179
|
})
|
|
20085
20180
|
);
|
|
@@ -20172,7 +20267,11 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20172
20267
|
const minAmountUi = opts.minAmountUi ?? DEFAULT_MIN_AMOUNT_UI;
|
|
20173
20268
|
const targetLocalBps = opts.targetLocalBps ?? DEFAULT_TARGET_LOCAL_BPS;
|
|
20174
20269
|
const rebalanceBandBps = opts.rebalanceBandBps ?? DEFAULT_REBALANCE_BAND_BPS;
|
|
20175
|
-
if (dryRun)
|
|
20270
|
+
if (dryRun) {
|
|
20271
|
+
log(
|
|
20272
|
+
this.client.skipSimulation ? "DRY RUN \u2014 rebalances will be built; simulations skipped; nothing sent" : "DRY RUN \u2014 rebalances will be simulated, not sent"
|
|
20273
|
+
);
|
|
20274
|
+
}
|
|
20176
20275
|
log(`Minimum rebalance: ${minAmountUi} token(s) (~$${minAmountUi})`);
|
|
20177
20276
|
log(`Target local share: ${targetLocalBps / 100}% of each holding`);
|
|
20178
20277
|
log(
|
|
@@ -20286,7 +20385,10 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20286
20385
|
continue;
|
|
20287
20386
|
}
|
|
20288
20387
|
log(
|
|
20289
|
-
`Vault ${vault} slot ${slot.index}: ${dryRun ? "simulating " : ""}${plan.direction} of ${formatUi(
|
|
20388
|
+
`Vault ${vault} slot ${slot.index}: ${dryRun ? this.client.skipSimulation ? "building " : "simulating " : ""}${plan.direction} of ${formatUi(
|
|
20389
|
+
plan.amount,
|
|
20390
|
+
decimals
|
|
20391
|
+
)} ${mintAddress} (local ${formatUi(localAmount, decimals)} \u2192 target ${formatUi(
|
|
20290
20392
|
plan.targetLocal,
|
|
20291
20393
|
decimals
|
|
20292
20394
|
)})`
|
|
@@ -20379,6 +20481,12 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20379
20481
|
...cpiRefs.lookupTables?.length ? { lookupTables: cpiRefs.lookupTables } : {}
|
|
20380
20482
|
};
|
|
20381
20483
|
if (dryRun) {
|
|
20484
|
+
if (this.client.skipSimulation) {
|
|
20485
|
+
log(
|
|
20486
|
+
`Vault ${vault} slot ${slot.index}: built; simulation skipped; no transaction sent`
|
|
20487
|
+
);
|
|
20488
|
+
return {};
|
|
20489
|
+
}
|
|
20382
20490
|
const sim = await this.client.simulateTransaction(hwManager, plan);
|
|
20383
20491
|
for (const line of sim.logs ?? []) {
|
|
20384
20492
|
log(` | ${line}`);
|
|
@@ -20400,7 +20508,7 @@ var import_kit16 = require("@solana/kit");
|
|
|
20400
20508
|
var import_spl_token20 = require("@solana/spl-token");
|
|
20401
20509
|
var import_web330 = require("@solana/web3.js");
|
|
20402
20510
|
var import_common54 = __toESM(require_dist());
|
|
20403
|
-
var
|
|
20511
|
+
var import_jupiter2 = __toESM(require_dist3());
|
|
20404
20512
|
var IDLE_RESERVE_FLOOR_BPS = 400;
|
|
20405
20513
|
var IDLE_RESERVE_TARGET_BPS = 500;
|
|
20406
20514
|
var DEFAULT_SLIPPAGE_BPS = 30;
|
|
@@ -20492,7 +20600,7 @@ var IdleLiquidityService = class {
|
|
|
20492
20600
|
log(`Vault ${vault}: ${reason} \u2014 skipping`);
|
|
20493
20601
|
return { ...base, status: "insufficient-pst", reason };
|
|
20494
20602
|
}
|
|
20495
|
-
const jupiter = new
|
|
20603
|
+
const jupiter = new import_jupiter2.JupiterSwapClient(
|
|
20496
20604
|
(0, import_kit16.createSolanaRpc)(this.client.provider.connection.rpcEndpoint)
|
|
20497
20605
|
);
|
|
20498
20606
|
let quote;
|
|
@@ -20755,26 +20863,30 @@ var IdleLiquidityService = class {
|
|
|
20755
20863
|
}).compileToV0Message(lookupTableAccounts);
|
|
20756
20864
|
const transaction = new import_web330.VersionedTransaction(message2);
|
|
20757
20865
|
transaction.sign([hwManager]);
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20866
|
+
if (!this.client.skipSimulation) {
|
|
20867
|
+
const simulation = await connection.simulateTransaction(transaction, {
|
|
20868
|
+
sigVerify: true,
|
|
20869
|
+
commitment: "confirmed"
|
|
20870
|
+
});
|
|
20871
|
+
if (simulation.value.err) {
|
|
20872
|
+
for (const line of simulation.value.logs ?? []) log(` | ${line}`);
|
|
20873
|
+
throw new Error(
|
|
20874
|
+
`simulation failed: ${JSON.stringify(simulation.value.err)}`
|
|
20875
|
+
);
|
|
20876
|
+
}
|
|
20877
|
+
log(
|
|
20878
|
+
`Vault ${vault}: simulation OK (${simulation.value.unitsConsumed ?? "?"} CU)`
|
|
20766
20879
|
);
|
|
20880
|
+
} else {
|
|
20881
|
+
log(`Vault ${vault}: simulation skipped`);
|
|
20767
20882
|
}
|
|
20768
|
-
log(
|
|
20769
|
-
`Vault ${vault}: simulation OK (${simulation.value.unitsConsumed ?? "?"} CU)`
|
|
20770
|
-
);
|
|
20771
20883
|
if (dryRun) {
|
|
20772
20884
|
log(`Vault ${vault}: dry run \u2014 transaction NOT submitted`);
|
|
20773
20885
|
return {};
|
|
20774
20886
|
}
|
|
20775
20887
|
const signature = await connection.sendRawTransaction(
|
|
20776
20888
|
transaction.serialize(),
|
|
20777
|
-
{ skipPreflight:
|
|
20889
|
+
{ skipPreflight: this.client.skipSimulation, maxRetries: 5 }
|
|
20778
20890
|
);
|
|
20779
20891
|
const confirmation = await connection.confirmTransaction(
|
|
20780
20892
|
{ signature, blockhash, lastValidBlockHeight },
|
|
@@ -20998,7 +21110,7 @@ var TimelockSettlementService = class {
|
|
|
20998
21110
|
}
|
|
20999
21111
|
try {
|
|
21000
21112
|
log(
|
|
21001
|
-
`Vault ${vault}: ${dryRun ? "simulating" : "settling"} expired ${action.kind}`
|
|
21113
|
+
`Vault ${vault}: ${dryRun ? this.client.skipSimulation ? "building" : "simulating" : "settling"} expired ${action.kind}`
|
|
21002
21114
|
);
|
|
21003
21115
|
const signature = await action.execute();
|
|
21004
21116
|
summary.settled += 1;
|
|
@@ -21010,7 +21122,7 @@ var TimelockSettlementService = class {
|
|
|
21010
21122
|
dryRun
|
|
21011
21123
|
});
|
|
21012
21124
|
log(
|
|
21013
|
-
`Vault ${vault}: ${action.kind} ${dryRun ? "simulation passed" : `settled: ${signature}`}`
|
|
21125
|
+
`Vault ${vault}: ${action.kind} ${dryRun ? this.client.skipSimulation ? "built; simulation skipped; no transaction sent" : "simulation passed" : `settled: ${signature}`}`
|
|
21014
21126
|
);
|
|
21015
21127
|
} catch (error) {
|
|
21016
21128
|
summary.failed += 1;
|
|
@@ -21024,6 +21136,7 @@ var TimelockSettlementService = class {
|
|
|
21024
21136
|
}
|
|
21025
21137
|
async execute(fulfiller, plan, dryRun, log) {
|
|
21026
21138
|
if (!dryRun) return this.client.sendTransaction(fulfiller, plan);
|
|
21139
|
+
if (this.client.skipSimulation) return void 0;
|
|
21027
21140
|
const simulation = await this.client.simulateTransaction(fulfiller, plan);
|
|
21028
21141
|
for (const line of simulation.logs ?? []) log(` | ${line}`);
|
|
21029
21142
|
if (simulation.err) {
|
|
@@ -21087,7 +21200,6 @@ var import_common56 = __toESM(require_dist());
|
|
|
21087
21200
|
IDLE_RESERVE_TARGET_BPS,
|
|
21088
21201
|
IdleLiquidityService,
|
|
21089
21202
|
InitializeVaultRolesBuilder,
|
|
21090
|
-
JupiterBalanceSource,
|
|
21091
21203
|
JupiterPriceSource,
|
|
21092
21204
|
JupiterSwapBuilder,
|
|
21093
21205
|
KaminoPositionProvider,
|
|
@@ -21096,6 +21208,7 @@ var import_common56 = __toESM(require_dist());
|
|
|
21096
21208
|
LOCAL_PROTOCOL_ADMIN,
|
|
21097
21209
|
LargeBalanceChangeError,
|
|
21098
21210
|
LivePriceSource,
|
|
21211
|
+
MAX_APY_ANCHOR_WINDOW_SECS,
|
|
21099
21212
|
MAX_BALANCE_CHANGE_BPS,
|
|
21100
21213
|
MAX_CONSENSUS_SIGNERS,
|
|
21101
21214
|
MAX_INCENTIVE_RECIPIENTS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perena/vault-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
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",
|