@perena/vault-sdk 1.0.19 → 1.0.20
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 +103 -3
- package/dist/index.js +162 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9756,6 +9756,11 @@ type Bankineco = {
|
|
|
9756
9756
|
"code": 6042;
|
|
9757
9757
|
"name": "invalidFeeExemption";
|
|
9758
9758
|
"msg": "Invalid fee-exemption PDA signer or seeds";
|
|
9759
|
+
},
|
|
9760
|
+
{
|
|
9761
|
+
"code": 6043;
|
|
9762
|
+
"name": "exceedsJuniorDepositCap";
|
|
9763
|
+
"msg": "Deposit would exceed the junior tranche deposit cap";
|
|
9759
9764
|
}
|
|
9760
9765
|
];
|
|
9761
9766
|
"types": [
|
|
@@ -12140,6 +12145,13 @@ type Bankineco = {
|
|
|
12140
12145
|
"name": "targetLockupDurationSecs";
|
|
12141
12146
|
"type": "i64";
|
|
12142
12147
|
},
|
|
12148
|
+
{
|
|
12149
|
+
"name": "juniorDepositCap";
|
|
12150
|
+
"docs": [
|
|
12151
|
+
"Maximum junior tranche value in accounting units. Zero means uncapped."
|
|
12152
|
+
];
|
|
12153
|
+
"type": "u64";
|
|
12154
|
+
},
|
|
12143
12155
|
{
|
|
12144
12156
|
"name": "forMigration";
|
|
12145
12157
|
"docs": [
|
|
@@ -12937,12 +12949,21 @@ type Bankineco = {
|
|
|
12937
12949
|
"name": "targetLockupDurationSecs";
|
|
12938
12950
|
"type": "i64";
|
|
12939
12951
|
},
|
|
12952
|
+
{
|
|
12953
|
+
"name": "juniorDepositCap";
|
|
12954
|
+
"docs": [
|
|
12955
|
+
"Maximum junior tranche value in vault accounting units. Zero disables",
|
|
12956
|
+
"the cap. Yield may carry the tranche above this value, but further",
|
|
12957
|
+
"junior deposits remain blocked until its value falls below the cap."
|
|
12958
|
+
];
|
|
12959
|
+
"type": "u64";
|
|
12960
|
+
},
|
|
12940
12961
|
{
|
|
12941
12962
|
"name": "padding2";
|
|
12942
12963
|
"type": {
|
|
12943
12964
|
"array": [
|
|
12944
12965
|
"u64",
|
|
12945
|
-
|
|
12966
|
+
13
|
|
12946
12967
|
];
|
|
12947
12968
|
};
|
|
12948
12969
|
}
|
|
@@ -13060,6 +13081,15 @@ type Bankineco = {
|
|
|
13060
13081
|
"type": {
|
|
13061
13082
|
"option": "i64";
|
|
13062
13083
|
};
|
|
13084
|
+
},
|
|
13085
|
+
{
|
|
13086
|
+
"name": "juniorDepositCap";
|
|
13087
|
+
"docs": [
|
|
13088
|
+
"Maximum junior tranche value in accounting units. Zero means uncapped."
|
|
13089
|
+
];
|
|
13090
|
+
"type": {
|
|
13091
|
+
"option": "u64";
|
|
13092
|
+
};
|
|
13063
13093
|
}
|
|
13064
13094
|
];
|
|
13065
13095
|
};
|
|
@@ -14133,6 +14163,7 @@ interface CreateTrancheStateIxArgs {
|
|
|
14133
14163
|
earlyUnstakeFeeBps: number;
|
|
14134
14164
|
standardUnstakeFeeBps: number;
|
|
14135
14165
|
targetLockupDurationSecs: BN;
|
|
14166
|
+
juniorDepositCap: BN;
|
|
14136
14167
|
forMigration: boolean;
|
|
14137
14168
|
tokenProgram: Address;
|
|
14138
14169
|
}
|
|
@@ -14146,6 +14177,8 @@ interface CreateTrancheStateTxArgs {
|
|
|
14146
14177
|
earlyUnstakeFeeBps?: number;
|
|
14147
14178
|
standardUnstakeFeeBps?: number;
|
|
14148
14179
|
targetLockupDurationSecs?: number;
|
|
14180
|
+
/** Maximum junior tranche value in accounting units. Zero means uncapped. */
|
|
14181
|
+
juniorDepositCap?: bigint;
|
|
14149
14182
|
forMigration?: boolean;
|
|
14150
14183
|
tokenProgram?: Address;
|
|
14151
14184
|
}
|
|
@@ -14158,6 +14191,7 @@ interface UpdateTrancheConfigIxArgs {
|
|
|
14158
14191
|
earlyUnstakeFeeBps: number | null;
|
|
14159
14192
|
standardUnstakeFeeBps: number | null;
|
|
14160
14193
|
targetLockupDurationSecs: BN | null;
|
|
14194
|
+
juniorDepositCap: BN | null;
|
|
14161
14195
|
}
|
|
14162
14196
|
interface UpdateTrancheConfigTxArgs {
|
|
14163
14197
|
curator: Address;
|
|
@@ -14168,6 +14202,8 @@ interface UpdateTrancheConfigTxArgs {
|
|
|
14168
14202
|
earlyUnstakeFeeBps?: number;
|
|
14169
14203
|
standardUnstakeFeeBps?: number;
|
|
14170
14204
|
targetLockupDurationSecs?: number;
|
|
14205
|
+
/** Maximum junior tranche value in accounting units. Zero means uncapped. */
|
|
14206
|
+
juniorDepositCap?: bigint;
|
|
14171
14207
|
}
|
|
14172
14208
|
interface InitializeVaultRolesIxArgs {
|
|
14173
14209
|
curator: Address;
|
|
@@ -15466,6 +15502,9 @@ interface AccountYieldResponse {
|
|
|
15466
15502
|
updated_at: Date;
|
|
15467
15503
|
};
|
|
15468
15504
|
total_yield: number;
|
|
15505
|
+
gross_yield: number;
|
|
15506
|
+
paid_yield: number;
|
|
15507
|
+
outstanding_yield: number;
|
|
15469
15508
|
principal_at_end: number;
|
|
15470
15509
|
accrual_start: Date;
|
|
15471
15510
|
accrual_end: Date;
|
|
@@ -15473,8 +15512,36 @@ interface AccountYieldResponse {
|
|
|
15473
15512
|
apr_used: number;
|
|
15474
15513
|
calculation_log: YieldCalculationLog[];
|
|
15475
15514
|
}
|
|
15515
|
+
interface CreateYieldPaymentParams {
|
|
15516
|
+
accountName: string;
|
|
15517
|
+
amount: number;
|
|
15518
|
+
effectiveAt: Date;
|
|
15519
|
+
idempotencyKey: string;
|
|
15520
|
+
password: string;
|
|
15521
|
+
}
|
|
15522
|
+
interface YieldPaymentResponse {
|
|
15523
|
+
id: string;
|
|
15524
|
+
account_name: string;
|
|
15525
|
+
idempotency_key: string;
|
|
15526
|
+
amount: number;
|
|
15527
|
+
effective_at: Date;
|
|
15528
|
+
status: "pending" | "confirmed";
|
|
15529
|
+
transaction_signature?: string;
|
|
15530
|
+
confirmed_at?: Date;
|
|
15531
|
+
created_at: Date;
|
|
15532
|
+
}
|
|
15533
|
+
declare function createYieldPayment(params: CreateYieldPaymentParams): Promise<YieldPaymentResponse>;
|
|
15534
|
+
declare function confirmYieldPayment(params: {
|
|
15535
|
+
accountName: string;
|
|
15536
|
+
paymentId: string;
|
|
15537
|
+
transactionSignature: string;
|
|
15538
|
+
password: string;
|
|
15539
|
+
}): Promise<YieldPaymentResponse>;
|
|
15540
|
+
declare function getYieldPayments(accountName: string): Promise<YieldPaymentResponse[]>;
|
|
15476
15541
|
declare function getYield(accountName: string, start?: Date, end?: Date): Promise<AccountYieldResponse>;
|
|
15477
15542
|
declare function getTotalYield(accountNames: string[], start?: Date, end?: Date): Promise<BN>;
|
|
15543
|
+
/** Sum only confirmed-payment-adjusted yield that remains receivable. */
|
|
15544
|
+
declare function getTotalOutstandingYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
15478
15545
|
|
|
15479
15546
|
/**
|
|
15480
15547
|
* Junior-tranche withdrawal-queue fulfillment.
|
|
@@ -15705,7 +15772,13 @@ interface ExternalPositionProvider {
|
|
|
15705
15772
|
*/
|
|
15706
15773
|
interface YieldAccountSnapshot {
|
|
15707
15774
|
account: string;
|
|
15775
|
+
/** Gross accrued yield before payment settlements. */
|
|
15708
15776
|
totalYield: number;
|
|
15777
|
+
grossYield: number;
|
|
15778
|
+
/** Confirmed payments inside the requested accrual window. */
|
|
15779
|
+
paidYield: number;
|
|
15780
|
+
/** Gross yield less confirmed payments; this is the oracle-safe receivable. */
|
|
15781
|
+
outstandingYield: number;
|
|
15709
15782
|
principalAtEnd: number;
|
|
15710
15783
|
aprUsed: number;
|
|
15711
15784
|
accrualStart: Date;
|
|
@@ -15720,7 +15793,9 @@ interface YieldTracker {
|
|
|
15720
15793
|
getYield(accountName: string, start?: Date, end?: Date): Promise<YieldAccountSnapshot>;
|
|
15721
15794
|
/** Sum of `totalYield` (UI amount) across the named accounts. */
|
|
15722
15795
|
getTotalYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
15723
|
-
/**
|
|
15796
|
+
/** Sum of oracle-safe outstanding yield across the named accounts. */
|
|
15797
|
+
getTotalOutstandingYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
15798
|
+
/** Current balance (principal + outstanding yield), UI amount. */
|
|
15724
15799
|
getBalance(accountName: string, atTime?: Date): Promise<number>;
|
|
15725
15800
|
addCashflow(params: {
|
|
15726
15801
|
accountName: string;
|
|
@@ -15728,6 +15803,19 @@ interface YieldTracker {
|
|
|
15728
15803
|
date?: Date;
|
|
15729
15804
|
cashflowType: "deposit" | "withdraw";
|
|
15730
15805
|
}): Promise<void>;
|
|
15806
|
+
/** Register an expected payment. Pending payments remain outstanding. */
|
|
15807
|
+
createYieldPayment(params: {
|
|
15808
|
+
accountName: string;
|
|
15809
|
+
paymentId: string;
|
|
15810
|
+
amount: number;
|
|
15811
|
+
effectiveAt: Date;
|
|
15812
|
+
}): Promise<void>;
|
|
15813
|
+
/** Confirm only after the payment is observable in the destination wallet. */
|
|
15814
|
+
confirmYieldPayment(params: {
|
|
15815
|
+
accountName: string;
|
|
15816
|
+
paymentId: string;
|
|
15817
|
+
transactionSignature: string;
|
|
15818
|
+
}): Promise<void>;
|
|
15731
15819
|
}
|
|
15732
15820
|
/** Injectable wall clock (ms since epoch). Lets tests pin time deterministically. */
|
|
15733
15821
|
interface Clock {
|
|
@@ -15988,6 +16076,7 @@ declare class MockYieldTracker implements YieldTracker {
|
|
|
15988
16076
|
private require;
|
|
15989
16077
|
getYield(accountName: string, start?: Date, end?: Date): Promise<YieldAccountSnapshot>;
|
|
15990
16078
|
getTotalYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
16079
|
+
getTotalOutstandingYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
15991
16080
|
getBalance(accountName: string, atTime?: Date): Promise<number>;
|
|
15992
16081
|
addCashflow(params: {
|
|
15993
16082
|
accountName: string;
|
|
@@ -15995,6 +16084,17 @@ declare class MockYieldTracker implements YieldTracker {
|
|
|
15995
16084
|
date?: Date;
|
|
15996
16085
|
cashflowType: "deposit" | "withdraw";
|
|
15997
16086
|
}): Promise<void>;
|
|
16087
|
+
createYieldPayment(params: {
|
|
16088
|
+
accountName: string;
|
|
16089
|
+
paymentId: string;
|
|
16090
|
+
amount: number;
|
|
16091
|
+
effectiveAt: Date;
|
|
16092
|
+
}): Promise<void>;
|
|
16093
|
+
confirmYieldPayment(params: {
|
|
16094
|
+
accountName: string;
|
|
16095
|
+
paymentId: string;
|
|
16096
|
+
transactionSignature: string;
|
|
16097
|
+
}): Promise<void>;
|
|
15998
16098
|
}
|
|
15999
16099
|
|
|
16000
16100
|
declare class ConsensusOracleService {
|
|
@@ -16087,4 +16187,4 @@ declare class ExternalLiquidityIntegrityService {
|
|
|
16087
16187
|
private depositIntoMarginfi;
|
|
16088
16188
|
}
|
|
16089
16189
|
|
|
16090
|
-
export { ASSET_DECIMALS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AssetPriceOracleConfigIxArgs, type AssetPriceOracleConfigTxArgs, type AssetPriceRefreshTarget, type AssetRefreshResult, type Bankineco, type BasicAuthCredentials, type Bigintish, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, type Clock, type ConsensusAssetUpdate, type ConsensusHoldingEntry, type ConsensusOracleDeps, type ConsensusOracleHoldingConfig, ConsensusOracleService, type ConsensusOracleTarget, CrankNavBuilder, type CrankNavIxArgs, type CrankNavTxArgs, CrankPerformanceFeesBuilder, type CrankPerformanceFeesIxArgs, type CrankPerformanceFeesTxArgs, type CreateAccountParams, CreateAssetHoldingBuilder, type CreateAssetHoldingIxArgs, type CreateAssetHoldingTxArgs, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS, DEFAULT_PRICE_ORACLE_ACCOUNT, DEFAULT_PRICE_STALENESS_THRESHOLD_SECS, DEFAULT_VAULT_ID, type DecodedHolding, type DecodedVault, type DeleteAccountParams, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, 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 ExternalLiquidityIntegrityResult, ExternalLiquidityIntegrityService, type ExternalLiquidityIntegritySummary, type ExternalLiquiditySlot, type ExternalLiquiditySourceArgs, type ExternalPosition, type ExternalPositionContext, type ExternalPositionProvider, type ExternalPositionRef, ExternalPositionRegistry, FEE_VAULT_CACHE_CATEGORY, type FeeVaultAccountData, FulfillJuniorTrancheWithdrawBuilder, type FulfillJuniorTrancheWithdrawIxArgs, type FulfillJuniorTrancheWithdrawTxArgs, type FulfillSummary, type HoldingUpdatePreview, IDL, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterBalanceSource, type JupiterBalanceSourceOptions, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoPositionProvider, type LiveConsensusOracleDepsOptions, MAX_PRICE_STALENESS_THRESHOLD_SECS, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, type NavCrankBlocker, type NavCrankBlockerReason, type NavCrankReadiness, type NavCrankResult, OracleService, PROGRAM_FEE_EXEMPT_OWNER_WHITELIST, PROTOCOL_ADMIN, PROTOCOL_FEE_RECIPIENT, PdaClient, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type RollingLimitConfig, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, StaticPositionProvider, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, type TrancheKindArgs, type TransactionBuilder, TransactionClient, USDC_MINT, USD_STAR_JUNIOR_MINT, USD_STAR_MINT, USD_STAR_PRINCIPAL_MINT, type UpdateAccountParams, UpdateAssetPriceBuilder, type UpdateAssetPriceIxArgs, type UpdateAssetPriceTxArgs, UpdateConsensusOracleBuilder, type UpdateConsensusOracleIxArgs, type UpdateConsensusOracleTxArgs, UpdateConsensusSignersBuilder, type UpdateConsensusSignersIxArgs, type UpdateConsensusSignersTxArgs, type UpdateDynamicAprParams, UpdateTrancheConfigBuilder, type UpdateTrancheConfigIxArgs, type UpdateTrancheConfigTxArgs, VAULT_CACHE_CATEGORY, VAULT_CREATOR_WHITELIST, VAULT_ENVIRONMENTS, VAULT_ORACLE_CACHE_CATEGORY, VAULT_PROGRAM_ID, VAULT_PROGRAM_IDS, VAULT_PROGRAM_PUBLIC_KEY, VAULT_ROLE_UPDATE_TIMELOCK_SECS, VAULT_TRANCHE_STATE_CACHE_CATEGORY, VAULT_TRANCHE_WITHDRAWAL_QUEUE_CACHE_CATEGORY, type Vault, type VaultAccountData, VaultBuilderBase, type VaultBuilderContext, type VaultCacheInvalidation, VaultClient, type VaultClientBundle, type VaultEnv, type VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, type WalletBalanceSource, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, type WithdrawTrancheFeesIxArgs, type WithdrawTrancheFeesTxArgs, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldTracker, addCashflowUpdate, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, dateToStr, defaultKeypairPath, deleteAccount, fromUiAmount, getAccounts, getBalance, getCashflows, getRpcUrl, getTotalYield, getVaultProgramId, getYield, isVaultEnv, keypairAddress, loadKeypair, makeProvider, mintTokensTo, resolveKeypairPath, roundToNextUtcMidnight, runLiveConsensusOracle, systemClock, toUiAmount, updateAccount, updateDynamicApr };
|
|
16190
|
+
export { ASSET_DECIMALS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AssetPriceOracleConfigIxArgs, type AssetPriceOracleConfigTxArgs, type AssetPriceRefreshTarget, type AssetRefreshResult, type Bankineco, type BasicAuthCredentials, type Bigintish, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, type Clock, type ConsensusAssetUpdate, type ConsensusHoldingEntry, type ConsensusOracleDeps, type ConsensusOracleHoldingConfig, ConsensusOracleService, type ConsensusOracleTarget, CrankNavBuilder, type CrankNavIxArgs, type CrankNavTxArgs, CrankPerformanceFeesBuilder, type CrankPerformanceFeesIxArgs, type CrankPerformanceFeesTxArgs, type CreateAccountParams, CreateAssetHoldingBuilder, type CreateAssetHoldingIxArgs, type CreateAssetHoldingTxArgs, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS, DEFAULT_PRICE_ORACLE_ACCOUNT, DEFAULT_PRICE_STALENESS_THRESHOLD_SECS, DEFAULT_VAULT_ID, type DecodedHolding, type DecodedVault, type DeleteAccountParams, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, 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 ExternalLiquidityIntegrityResult, ExternalLiquidityIntegrityService, type ExternalLiquidityIntegritySummary, type ExternalLiquiditySlot, type ExternalLiquiditySourceArgs, type ExternalPosition, type ExternalPositionContext, type ExternalPositionProvider, type ExternalPositionRef, ExternalPositionRegistry, FEE_VAULT_CACHE_CATEGORY, type FeeVaultAccountData, FulfillJuniorTrancheWithdrawBuilder, type FulfillJuniorTrancheWithdrawIxArgs, type FulfillJuniorTrancheWithdrawTxArgs, type FulfillSummary, type HoldingUpdatePreview, IDL, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterBalanceSource, type JupiterBalanceSourceOptions, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoPositionProvider, type LiveConsensusOracleDepsOptions, MAX_PRICE_STALENESS_THRESHOLD_SECS, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, type NavCrankBlocker, type NavCrankBlockerReason, type NavCrankReadiness, type NavCrankResult, OracleService, PROGRAM_FEE_EXEMPT_OWNER_WHITELIST, PROTOCOL_ADMIN, PROTOCOL_FEE_RECIPIENT, PdaClient, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type RollingLimitConfig, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, StaticPositionProvider, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, type TrancheKindArgs, type TransactionBuilder, TransactionClient, USDC_MINT, USD_STAR_JUNIOR_MINT, USD_STAR_MINT, USD_STAR_PRINCIPAL_MINT, type UpdateAccountParams, UpdateAssetPriceBuilder, type UpdateAssetPriceIxArgs, type UpdateAssetPriceTxArgs, UpdateConsensusOracleBuilder, type UpdateConsensusOracleIxArgs, type UpdateConsensusOracleTxArgs, UpdateConsensusSignersBuilder, type UpdateConsensusSignersIxArgs, type UpdateConsensusSignersTxArgs, type UpdateDynamicAprParams, UpdateTrancheConfigBuilder, type UpdateTrancheConfigIxArgs, type UpdateTrancheConfigTxArgs, VAULT_CACHE_CATEGORY, VAULT_CREATOR_WHITELIST, VAULT_ENVIRONMENTS, VAULT_ORACLE_CACHE_CATEGORY, VAULT_PROGRAM_ID, VAULT_PROGRAM_IDS, VAULT_PROGRAM_PUBLIC_KEY, VAULT_ROLE_UPDATE_TIMELOCK_SECS, VAULT_TRANCHE_STATE_CACHE_CATEGORY, VAULT_TRANCHE_WITHDRAWAL_QUEUE_CACHE_CATEGORY, type Vault, type VaultAccountData, VaultBuilderBase, type VaultBuilderContext, type VaultCacheInvalidation, VaultClient, type VaultClientBundle, type VaultEnv, type VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, type WalletBalanceSource, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, type WithdrawTrancheFeesIxArgs, type WithdrawTrancheFeesTxArgs, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldPaymentResponse, type YieldTracker, addCashflowUpdate, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, defaultKeypairPath, deleteAccount, fromUiAmount, getAccounts, getBalance, getCashflows, getRpcUrl, getTotalOutstandingYield, getTotalYield, getVaultProgramId, getYield, getYieldPayments, isVaultEnv, keypairAddress, loadKeypair, makeProvider, mintTokensTo, resolveKeypairPath, roundToNextUtcMidnight, runLiveConsensusOracle, systemClock, toUiAmount, updateAccount, updateDynamicApr };
|
package/dist/index.js
CHANGED
|
@@ -1461,12 +1461,14 @@ __export(index_exports, {
|
|
|
1461
1461
|
WithdrawalQueueService: () => WithdrawalQueueService,
|
|
1462
1462
|
addCashflowUpdate: () => addCashflowUpdate,
|
|
1463
1463
|
address: () => import_kit10.address,
|
|
1464
|
+
confirmYieldPayment: () => confirmYieldPayment,
|
|
1464
1465
|
createAccount: () => createAccount,
|
|
1465
1466
|
createLiveConsensusOracleDeps: () => createLiveConsensusOracleDeps,
|
|
1466
1467
|
createRpcFromConnection: () => createRpcFromConnection,
|
|
1467
1468
|
createTokenMint: () => createTokenMint,
|
|
1468
1469
|
createTokenMintIxs: () => createTokenMintIxs,
|
|
1469
1470
|
createVaultClient: () => createVaultClient,
|
|
1471
|
+
createYieldPayment: () => createYieldPayment,
|
|
1470
1472
|
dateToStr: () => dateToStr,
|
|
1471
1473
|
defaultKeypairPath: () => defaultKeypairPath,
|
|
1472
1474
|
deleteAccount: () => deleteAccount,
|
|
@@ -1475,9 +1477,11 @@ __export(index_exports, {
|
|
|
1475
1477
|
getBalance: () => getBalance,
|
|
1476
1478
|
getCashflows: () => getCashflows,
|
|
1477
1479
|
getRpcUrl: () => getRpcUrl,
|
|
1480
|
+
getTotalOutstandingYield: () => getTotalOutstandingYield,
|
|
1478
1481
|
getTotalYield: () => getTotalYield,
|
|
1479
1482
|
getVaultProgramId: () => getVaultProgramId,
|
|
1480
1483
|
getYield: () => getYield,
|
|
1484
|
+
getYieldPayments: () => getYieldPayments,
|
|
1481
1485
|
isVaultEnv: () => isVaultEnv,
|
|
1482
1486
|
keypairAddress: () => keypairAddress,
|
|
1483
1487
|
loadKeypair: () => loadKeypair,
|
|
@@ -11238,6 +11242,11 @@ var IDL = {
|
|
|
11238
11242
|
"code": 6042,
|
|
11239
11243
|
"name": "InvalidFeeExemption",
|
|
11240
11244
|
"msg": "Invalid fee-exemption PDA signer or seeds"
|
|
11245
|
+
},
|
|
11246
|
+
{
|
|
11247
|
+
"code": 6043,
|
|
11248
|
+
"name": "ExceedsJuniorDepositCap",
|
|
11249
|
+
"msg": "Deposit would exceed the junior tranche deposit cap"
|
|
11241
11250
|
}
|
|
11242
11251
|
],
|
|
11243
11252
|
"types": [
|
|
@@ -13622,6 +13631,13 @@ var IDL = {
|
|
|
13622
13631
|
"name": "target_lockup_duration_secs",
|
|
13623
13632
|
"type": "i64"
|
|
13624
13633
|
},
|
|
13634
|
+
{
|
|
13635
|
+
"name": "junior_deposit_cap",
|
|
13636
|
+
"docs": [
|
|
13637
|
+
"Maximum junior tranche value in accounting units. Zero means uncapped."
|
|
13638
|
+
],
|
|
13639
|
+
"type": "u64"
|
|
13640
|
+
},
|
|
13625
13641
|
{
|
|
13626
13642
|
"name": "for_migration",
|
|
13627
13643
|
"docs": [
|
|
@@ -14419,12 +14435,21 @@ var IDL = {
|
|
|
14419
14435
|
"name": "target_lockup_duration_secs",
|
|
14420
14436
|
"type": "i64"
|
|
14421
14437
|
},
|
|
14438
|
+
{
|
|
14439
|
+
"name": "junior_deposit_cap",
|
|
14440
|
+
"docs": [
|
|
14441
|
+
"Maximum junior tranche value in vault accounting units. Zero disables",
|
|
14442
|
+
"the cap. Yield may carry the tranche above this value, but further",
|
|
14443
|
+
"junior deposits remain blocked until its value falls below the cap."
|
|
14444
|
+
],
|
|
14445
|
+
"type": "u64"
|
|
14446
|
+
},
|
|
14422
14447
|
{
|
|
14423
14448
|
"name": "_padding2",
|
|
14424
14449
|
"type": {
|
|
14425
14450
|
"array": [
|
|
14426
14451
|
"u64",
|
|
14427
|
-
|
|
14452
|
+
13
|
|
14428
14453
|
]
|
|
14429
14454
|
}
|
|
14430
14455
|
}
|
|
@@ -14542,6 +14567,15 @@ var IDL = {
|
|
|
14542
14567
|
"type": {
|
|
14543
14568
|
"option": "i64"
|
|
14544
14569
|
}
|
|
14570
|
+
},
|
|
14571
|
+
{
|
|
14572
|
+
"name": "junior_deposit_cap",
|
|
14573
|
+
"docs": [
|
|
14574
|
+
"Maximum junior tranche value in accounting units. Zero means uncapped."
|
|
14575
|
+
],
|
|
14576
|
+
"type": {
|
|
14577
|
+
"option": "u64"
|
|
14578
|
+
}
|
|
14545
14579
|
}
|
|
14546
14580
|
]
|
|
14547
14581
|
}
|
|
@@ -15931,6 +15965,7 @@ var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
|
15931
15965
|
earlyUnstakeFeeBps: args.earlyUnstakeFeeBps,
|
|
15932
15966
|
standardUnstakeFeeBps: args.standardUnstakeFeeBps,
|
|
15933
15967
|
targetLockupDurationSecs: args.targetLockupDurationSecs,
|
|
15968
|
+
juniorDepositCap: args.juniorDepositCap,
|
|
15934
15969
|
forMigration: args.forMigration
|
|
15935
15970
|
}).accountsPartial({
|
|
15936
15971
|
curator: (0, import_common8.toWeb3Pk)(args.curator),
|
|
@@ -15975,6 +16010,7 @@ var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
|
15975
16010
|
targetLockupDurationSecs: new import_core.BN(
|
|
15976
16011
|
(txArgs.targetLockupDurationSecs ?? DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS).toString()
|
|
15977
16012
|
),
|
|
16013
|
+
juniorDepositCap: new import_core.BN((txArgs.juniorDepositCap ?? 0n).toString()),
|
|
15978
16014
|
forMigration,
|
|
15979
16015
|
tokenProgram: txArgs.tokenProgram ?? TOKEN_PROGRAM_ID
|
|
15980
16016
|
};
|
|
@@ -17608,7 +17644,8 @@ var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
|
17608
17644
|
seniorFixedApyBps: args.seniorFixedApyBps,
|
|
17609
17645
|
earlyUnstakeFeeBps: args.earlyUnstakeFeeBps,
|
|
17610
17646
|
standardUnstakeFeeBps: args.standardUnstakeFeeBps,
|
|
17611
|
-
targetLockupDurationSecs: args.targetLockupDurationSecs
|
|
17647
|
+
targetLockupDurationSecs: args.targetLockupDurationSecs,
|
|
17648
|
+
juniorDepositCap: args.juniorDepositCap
|
|
17612
17649
|
}).accountsPartial({
|
|
17613
17650
|
curator: (0, import_common29.toWeb3Pk)(args.curator),
|
|
17614
17651
|
vault: (0, import_common29.toWeb3Pk)(args.vault),
|
|
@@ -17629,7 +17666,8 @@ var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
|
17629
17666
|
seniorFixedApyBps: txArgs.seniorFixedApyBps ?? null,
|
|
17630
17667
|
earlyUnstakeFeeBps: txArgs.earlyUnstakeFeeBps ?? null,
|
|
17631
17668
|
standardUnstakeFeeBps: txArgs.standardUnstakeFeeBps ?? null,
|
|
17632
|
-
targetLockupDurationSecs: txArgs.targetLockupDurationSecs === void 0 ? null : new import_core11.BN(txArgs.targetLockupDurationSecs.toString())
|
|
17669
|
+
targetLockupDurationSecs: txArgs.targetLockupDurationSecs === void 0 ? null : new import_core11.BN(txArgs.targetLockupDurationSecs.toString()),
|
|
17670
|
+
juniorDepositCap: txArgs.juniorDepositCap === void 0 ? null : new import_core11.BN(txArgs.juniorDepositCap.toString())
|
|
17633
17671
|
};
|
|
17634
17672
|
}
|
|
17635
17673
|
async buildPlanExtras(args) {
|
|
@@ -18677,6 +18715,40 @@ async function getBalance(accountName, atTime) {
|
|
|
18677
18715
|
"GET"
|
|
18678
18716
|
)).data;
|
|
18679
18717
|
}
|
|
18718
|
+
async function createYieldPayment(params) {
|
|
18719
|
+
return unwrapData(
|
|
18720
|
+
await yieldApiReq(
|
|
18721
|
+
accountEndpoint(params.accountName, "yield-payments"),
|
|
18722
|
+
"POST",
|
|
18723
|
+
{
|
|
18724
|
+
amount: params.amount,
|
|
18725
|
+
effective_at: dateToStr(params.effectiveAt),
|
|
18726
|
+
idempotency_key: params.idempotencyKey,
|
|
18727
|
+
password: params.password
|
|
18728
|
+
}
|
|
18729
|
+
)
|
|
18730
|
+
);
|
|
18731
|
+
}
|
|
18732
|
+
async function confirmYieldPayment(params) {
|
|
18733
|
+
return unwrapData(
|
|
18734
|
+
await yieldApiReq(
|
|
18735
|
+
accountEndpoint(
|
|
18736
|
+
params.accountName,
|
|
18737
|
+
`yield-payments/${encodeURIComponent(params.paymentId)}/confirm`
|
|
18738
|
+
),
|
|
18739
|
+
"POST",
|
|
18740
|
+
{
|
|
18741
|
+
transaction_signature: params.transactionSignature,
|
|
18742
|
+
password: params.password
|
|
18743
|
+
}
|
|
18744
|
+
)
|
|
18745
|
+
);
|
|
18746
|
+
}
|
|
18747
|
+
async function getYieldPayments(accountName) {
|
|
18748
|
+
return unwrapData(
|
|
18749
|
+
await yieldApiReq(accountEndpoint(accountName, "yield-payments"), "GET")
|
|
18750
|
+
);
|
|
18751
|
+
}
|
|
18680
18752
|
async function getYield(accountName, start, end) {
|
|
18681
18753
|
return (await yieldApiReq(
|
|
18682
18754
|
accountEndpoint(accountName, "yield") + (start ? `?start=${dateToStr(start)}` : "") + (start && end ? `&end=${dateToStr(end)}` : end ? `?end=${dateToStr(end)}` : ""),
|
|
@@ -18692,6 +18764,14 @@ async function getTotalYield(accountNames, start, end) {
|
|
|
18692
18764
|
}
|
|
18693
18765
|
return totalYield;
|
|
18694
18766
|
}
|
|
18767
|
+
async function getTotalOutstandingYield(accountNames, start, end) {
|
|
18768
|
+
let total = 0;
|
|
18769
|
+
for (const accountName of accountNames) {
|
|
18770
|
+
const response = await getYield(accountName, start, end);
|
|
18771
|
+
total += response.outstanding_yield;
|
|
18772
|
+
}
|
|
18773
|
+
return total;
|
|
18774
|
+
}
|
|
18695
18775
|
|
|
18696
18776
|
// src/services/withdrawalQueueService.ts
|
|
18697
18777
|
var import_common38 = __toESM(require_dist());
|
|
@@ -19588,7 +19668,7 @@ var ConsensusOracleService = class {
|
|
|
19588
19668
|
/** Accrued yield (base units) attributed to a holding via its configured accounts. */
|
|
19589
19669
|
async resolveYieldAmount(cfg, decimals) {
|
|
19590
19670
|
if (!this.deps.yieldTracker || !cfg?.yieldAccountNames?.length) return 0n;
|
|
19591
|
-
const totalYieldUi = await this.deps.yieldTracker.
|
|
19671
|
+
const totalYieldUi = await this.deps.yieldTracker.getTotalOutstandingYield(
|
|
19592
19672
|
cfg.yieldAccountNames
|
|
19593
19673
|
);
|
|
19594
19674
|
return totalYieldUi > 0 ? (0, import_common41.fromUiAmount)(totalYieldUi, decimals) : 0n;
|
|
@@ -19766,7 +19846,8 @@ var MockYieldTracker = class {
|
|
|
19766
19846
|
aprBps: cfg.aprBps,
|
|
19767
19847
|
initialPrincipal: cfg.principal ?? 0,
|
|
19768
19848
|
startTs: cfg.startTs ?? this.clock.now(),
|
|
19769
|
-
cashflows: []
|
|
19849
|
+
cashflows: [],
|
|
19850
|
+
yieldPayments: []
|
|
19770
19851
|
});
|
|
19771
19852
|
}
|
|
19772
19853
|
}
|
|
@@ -19776,7 +19857,8 @@ var MockYieldTracker = class {
|
|
|
19776
19857
|
aprBps: cfg.aprBps,
|
|
19777
19858
|
initialPrincipal: cfg.principal ?? 0,
|
|
19778
19859
|
startTs: cfg.startTs ?? this.clock.now(),
|
|
19779
|
-
cashflows: []
|
|
19860
|
+
cashflows: [],
|
|
19861
|
+
yieldPayments: []
|
|
19780
19862
|
});
|
|
19781
19863
|
}
|
|
19782
19864
|
require(name) {
|
|
@@ -19809,9 +19891,16 @@ var MockYieldTracker = class {
|
|
|
19809
19891
|
}
|
|
19810
19892
|
const tailSecs = Math.max(0, (windowEndMs - segStart) / 1e3);
|
|
19811
19893
|
totalYield += principal * apr * (tailSecs / SECONDS_PER_YEAR);
|
|
19894
|
+
const paidYield = state.yieldPayments.reduce((sum, payment) => {
|
|
19895
|
+
return payment.status === "confirmed" && payment.effectiveAt > windowStartMs && payment.effectiveAt <= windowEndMs ? sum + payment.amount : sum;
|
|
19896
|
+
}, 0);
|
|
19897
|
+
const outstandingYield = Math.max(0, totalYield - paidYield);
|
|
19812
19898
|
return {
|
|
19813
19899
|
account: accountName,
|
|
19814
19900
|
totalYield,
|
|
19901
|
+
grossYield: totalYield,
|
|
19902
|
+
paidYield,
|
|
19903
|
+
outstandingYield,
|
|
19815
19904
|
principalAtEnd: principal,
|
|
19816
19905
|
aprUsed: apr,
|
|
19817
19906
|
accrualStart: new Date(windowStartMs),
|
|
@@ -19826,9 +19915,17 @@ var MockYieldTracker = class {
|
|
|
19826
19915
|
}
|
|
19827
19916
|
return total;
|
|
19828
19917
|
}
|
|
19918
|
+
async getTotalOutstandingYield(accountNames, start, end) {
|
|
19919
|
+
let total = 0;
|
|
19920
|
+
for (const name of accountNames) {
|
|
19921
|
+
const snapshot = await this.getYield(name, start, end);
|
|
19922
|
+
total += snapshot.outstandingYield;
|
|
19923
|
+
}
|
|
19924
|
+
return total;
|
|
19925
|
+
}
|
|
19829
19926
|
async getBalance(accountName, atTime) {
|
|
19830
19927
|
const snapshot = await this.getYield(accountName, void 0, atTime);
|
|
19831
|
-
return snapshot.principalAtEnd + snapshot.
|
|
19928
|
+
return snapshot.principalAtEnd + snapshot.outstandingYield;
|
|
19832
19929
|
}
|
|
19833
19930
|
async addCashflow(params) {
|
|
19834
19931
|
const state = this.require(params.accountName);
|
|
@@ -19838,6 +19935,60 @@ var MockYieldTracker = class {
|
|
|
19838
19935
|
amount: signed
|
|
19839
19936
|
});
|
|
19840
19937
|
}
|
|
19938
|
+
async createYieldPayment(params) {
|
|
19939
|
+
const state = this.require(params.accountName);
|
|
19940
|
+
if (!(params.amount > 0)) throw new Error("Yield payment must be positive");
|
|
19941
|
+
const existing = state.yieldPayments.find(
|
|
19942
|
+
(payment) => payment.paymentId === params.paymentId
|
|
19943
|
+
);
|
|
19944
|
+
if (existing) {
|
|
19945
|
+
if (existing.amount !== params.amount || existing.effectiveAt !== params.effectiveAt.getTime()) {
|
|
19946
|
+
throw new Error(
|
|
19947
|
+
`Yield payment "${params.paymentId}" already exists with different details`
|
|
19948
|
+
);
|
|
19949
|
+
}
|
|
19950
|
+
return;
|
|
19951
|
+
}
|
|
19952
|
+
state.yieldPayments.push({
|
|
19953
|
+
paymentId: params.paymentId,
|
|
19954
|
+
amount: params.amount,
|
|
19955
|
+
effectiveAt: params.effectiveAt.getTime(),
|
|
19956
|
+
status: "pending"
|
|
19957
|
+
});
|
|
19958
|
+
}
|
|
19959
|
+
async confirmYieldPayment(params) {
|
|
19960
|
+
const state = this.require(params.accountName);
|
|
19961
|
+
const payment = state.yieldPayments.find(
|
|
19962
|
+
(candidate) => candidate.paymentId === params.paymentId
|
|
19963
|
+
);
|
|
19964
|
+
if (!payment)
|
|
19965
|
+
throw new Error(`Unknown yield payment "${params.paymentId}"`);
|
|
19966
|
+
if (payment.status === "confirmed") {
|
|
19967
|
+
if (payment.transactionSignature !== params.transactionSignature) {
|
|
19968
|
+
throw new Error(
|
|
19969
|
+
"Yield payment already confirmed with another signature"
|
|
19970
|
+
);
|
|
19971
|
+
}
|
|
19972
|
+
return;
|
|
19973
|
+
}
|
|
19974
|
+
const chronologicalPayments = state.yieldPayments.filter(
|
|
19975
|
+
(candidate) => candidate.status === "confirmed" || candidate === payment
|
|
19976
|
+
).sort((a, b) => a.effectiveAt - b.effectiveAt);
|
|
19977
|
+
let cumulativePaid = 0;
|
|
19978
|
+
for (const candidate of chronologicalPayments) {
|
|
19979
|
+
cumulativePaid += candidate.amount;
|
|
19980
|
+
const snapshot = await this.getYield(
|
|
19981
|
+
params.accountName,
|
|
19982
|
+
void 0,
|
|
19983
|
+
new Date(candidate.effectiveAt)
|
|
19984
|
+
);
|
|
19985
|
+
if (cumulativePaid > snapshot.totalYield + 1e-9) {
|
|
19986
|
+
throw new Error("Confirmed payment exceeds accrued unpaid yield");
|
|
19987
|
+
}
|
|
19988
|
+
}
|
|
19989
|
+
payment.status = "confirmed";
|
|
19990
|
+
payment.transactionSignature = params.transactionSignature;
|
|
19991
|
+
}
|
|
19841
19992
|
};
|
|
19842
19993
|
|
|
19843
19994
|
// src/services/externalLiquidityIntegrityService.ts
|
|
@@ -20111,12 +20262,14 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20111
20262
|
WithdrawalQueueService,
|
|
20112
20263
|
addCashflowUpdate,
|
|
20113
20264
|
address,
|
|
20265
|
+
confirmYieldPayment,
|
|
20114
20266
|
createAccount,
|
|
20115
20267
|
createLiveConsensusOracleDeps,
|
|
20116
20268
|
createRpcFromConnection,
|
|
20117
20269
|
createTokenMint,
|
|
20118
20270
|
createTokenMintIxs,
|
|
20119
20271
|
createVaultClient,
|
|
20272
|
+
createYieldPayment,
|
|
20120
20273
|
dateToStr,
|
|
20121
20274
|
defaultKeypairPath,
|
|
20122
20275
|
deleteAccount,
|
|
@@ -20125,9 +20278,11 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20125
20278
|
getBalance,
|
|
20126
20279
|
getCashflows,
|
|
20127
20280
|
getRpcUrl,
|
|
20281
|
+
getTotalOutstandingYield,
|
|
20128
20282
|
getTotalYield,
|
|
20129
20283
|
getVaultProgramId,
|
|
20130
20284
|
getYield,
|
|
20285
|
+
getYieldPayments,
|
|
20131
20286
|
isVaultEnv,
|
|
20132
20287
|
keypairAddress,
|
|
20133
20288
|
loadKeypair,
|