@perena/vault-sdk 1.0.38 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -0
- package/dist/index.d.ts +819 -49
- package/dist/index.js +1963 -860
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -149,12 +149,12 @@ var require_compat = __commonJS({
|
|
|
149
149
|
exports2.fromWeb3PublicKey = fromWeb3PublicKey;
|
|
150
150
|
exports2.toWeb3PublicKey = toWeb3PublicKey;
|
|
151
151
|
exports2.asWeb3PublicKey = asWeb3PublicKey2;
|
|
152
|
-
exports2.toKitInstruction =
|
|
152
|
+
exports2.toKitInstruction = toKitInstruction32;
|
|
153
153
|
exports2.fromKitInstruction = fromKitInstruction3;
|
|
154
154
|
var kit_1 = require("@solana/kit");
|
|
155
155
|
var web3_js_1 = require("@solana/web3.js");
|
|
156
|
-
function fromWeb3PublicKey(
|
|
157
|
-
return (0, kit_1.address)(
|
|
156
|
+
function fromWeb3PublicKey(pubkey2) {
|
|
157
|
+
return (0, kit_1.address)(pubkey2.toBase58());
|
|
158
158
|
}
|
|
159
159
|
function toWeb3PublicKey(addr) {
|
|
160
160
|
return new web3_js_1.PublicKey(addr);
|
|
@@ -165,7 +165,7 @@ var require_compat = __commonJS({
|
|
|
165
165
|
exports2.toAddress = fromWeb3PublicKey;
|
|
166
166
|
exports2.fromWeb3Pk = fromWeb3PublicKey;
|
|
167
167
|
exports2.toWeb3Pk = toWeb3PublicKey;
|
|
168
|
-
function
|
|
168
|
+
function toKitInstruction32(ix) {
|
|
169
169
|
return {
|
|
170
170
|
programAddress: ix.programId.toBase58(),
|
|
171
171
|
data: new Uint8Array(ix.data),
|
|
@@ -194,10 +194,10 @@ var require_ata = __commonJS({
|
|
|
194
194
|
"../common/dist/utils/accounts/ata.js"(exports2) {
|
|
195
195
|
"use strict";
|
|
196
196
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
197
|
-
exports2.getAtaAddress =
|
|
197
|
+
exports2.getAtaAddress = getAtaAddress18;
|
|
198
198
|
var spl_token_1 = require("@solana/spl-token");
|
|
199
199
|
var compat_1 = require_compat();
|
|
200
|
-
function
|
|
200
|
+
function getAtaAddress18(mint, owner, tokenProgram, allowOwnerOffCurve = true) {
|
|
201
201
|
const ata = (0, spl_token_1.getAssociatedTokenAddressSync)((0, compat_1.toWeb3PublicKey)(mint), (0, compat_1.toWeb3PublicKey)(owner), allowOwnerOffCurve, (0, compat_1.toWeb3PublicKey)(tokenProgram), spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
202
202
|
return ata.toBase58();
|
|
203
203
|
}
|
|
@@ -253,9 +253,9 @@ var require_meta = __commonJS({
|
|
|
253
253
|
exports2.toCustomAccountMeta = toCustomAccountMeta;
|
|
254
254
|
exports2.toCustomAccountMetaFromWeb3AccountMeta = toCustomAccountMetaFromWeb3AccountMeta;
|
|
255
255
|
var roles_1 = require_roles();
|
|
256
|
-
function toCustomAccountMeta(
|
|
256
|
+
function toCustomAccountMeta(address13, isWritable, requiredAtaDetails, isSigner) {
|
|
257
257
|
const role = (0, roles_1.getAccountRole)(isWritable ?? false, isSigner ?? false);
|
|
258
|
-
return { address:
|
|
258
|
+
return { address: address13, role, isRequiredAta: requiredAtaDetails };
|
|
259
259
|
}
|
|
260
260
|
function toCustomAccountMetaFromWeb3AccountMeta(web3AccountMeta) {
|
|
261
261
|
return toCustomAccountMeta(web3AccountMeta.pubkey.toBase58(), web3AccountMeta.isWritable, void 0, web3AccountMeta.isSigner);
|
|
@@ -1233,8 +1233,8 @@ var require_cpiClient = __commonJS({
|
|
|
1233
1233
|
var kit_1 = require("@solana/kit");
|
|
1234
1234
|
var common_1 = require_dist();
|
|
1235
1235
|
var constants_1 = require_constants3();
|
|
1236
|
-
function account(
|
|
1237
|
-
return { address:
|
|
1236
|
+
function account(address13, role) {
|
|
1237
|
+
return { address: address13, role };
|
|
1238
1238
|
}
|
|
1239
1239
|
function requiredAddress(value, label) {
|
|
1240
1240
|
if (!value) {
|
|
@@ -1323,7 +1323,7 @@ var require_cpiClient = __commonJS({
|
|
|
1323
1323
|
});
|
|
1324
1324
|
const bankAndOracleRemainingAccounts = [
|
|
1325
1325
|
account(this.accounts.bank, kit_1.AccountRole.READONLY),
|
|
1326
|
-
...this.accounts.oracleAccounts.map((
|
|
1326
|
+
...this.accounts.oracleAccounts.map((address13) => account(address13, kit_1.AccountRole.READONLY))
|
|
1327
1327
|
];
|
|
1328
1328
|
return {
|
|
1329
1329
|
cpiType: params.cpiType ?? common_1.CpiTypes.MARGINFI_WITHDRAW,
|
|
@@ -2899,12 +2899,12 @@ var require_routePreInstructions = __commonJS({
|
|
|
2899
2899
|
if (existingAta.value) {
|
|
2900
2900
|
continue;
|
|
2901
2901
|
}
|
|
2902
|
-
instructions2.push(
|
|
2902
|
+
instructions2.push(toKitInstruction32((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(new web3_js_1.PublicKey(payer), new web3_js_1.PublicKey(ata), new web3_js_1.PublicKey(user), new web3_js_1.PublicKey(mint), new web3_js_1.PublicKey(tokenProgram), spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID)));
|
|
2903
2903
|
postSuccessCacheInvalidations.push({ address: ata });
|
|
2904
2904
|
}
|
|
2905
2905
|
return { instructions: instructions2, postSuccessCacheInvalidations };
|
|
2906
2906
|
}
|
|
2907
|
-
function
|
|
2907
|
+
function toKitInstruction32(ix) {
|
|
2908
2908
|
return {
|
|
2909
2909
|
programAddress: ix.programId.toBase58(),
|
|
2910
2910
|
accounts: ix.keys.map((account) => ({
|
|
@@ -3251,13 +3251,16 @@ __export(index_exports, {
|
|
|
3251
3251
|
ASSET_REBALANCE_COOLDOWN_SECS: () => ASSET_REBALANCE_COOLDOWN_SECS,
|
|
3252
3252
|
AccountClient: () => AccountClient,
|
|
3253
3253
|
ActivateCircuitBreakerBuilder: () => ActivateCircuitBreakerBuilder,
|
|
3254
|
+
AddIncentiveRecipientBuilder: () => AddIncentiveRecipientBuilder,
|
|
3254
3255
|
BALANCE_CHANGE_BASELINE_MAX_AGE_SECS: () => BALANCE_CHANGE_BASELINE_MAX_AGE_SECS,
|
|
3255
3256
|
CONSENSUS_ORACLE_VARIANT: () => CONSENSUS_ORACLE_VARIANT,
|
|
3257
|
+
CancelIncentiveProposalBuilder: () => CancelIncentiveProposalBuilder,
|
|
3256
3258
|
CancelJuniorTrancheWithdrawBuilder: () => CancelJuniorTrancheWithdrawBuilder,
|
|
3257
3259
|
ConsensusOracleService: () => ConsensusOracleService,
|
|
3258
3260
|
CrankNavBuilder: () => CrankNavBuilder,
|
|
3259
3261
|
CrankPerformanceFeesBuilder: () => CrankPerformanceFeesBuilder,
|
|
3260
3262
|
CreateAssetHoldingBuilder: () => CreateAssetHoldingBuilder,
|
|
3263
|
+
CreateIncentiveBuilder: () => CreateIncentiveBuilder,
|
|
3261
3264
|
CreateTrancheStateBuilder: () => CreateTrancheStateBuilder,
|
|
3262
3265
|
CreateVaultBuilder: () => CreateVaultBuilder,
|
|
3263
3266
|
DEFAULT_CU_PRICE_MICRO_LAMPORTS: () => DEFAULT_CU_PRICE_MICRO_LAMPORTS,
|
|
@@ -3266,7 +3269,7 @@ __export(index_exports, {
|
|
|
3266
3269
|
DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS: () => DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS,
|
|
3267
3270
|
DEFAULT_MAX_ACCEPTABLE_APY_BPS: () => DEFAULT_MAX_ACCEPTABLE_APY_BPS,
|
|
3268
3271
|
DEFAULT_MAX_ACCOUNTS: () => DEFAULT_MAX_ACCOUNTS,
|
|
3269
|
-
DEFAULT_MINTS: () =>
|
|
3272
|
+
DEFAULT_MINTS: () => import_common56.DEFAULT_MINTS,
|
|
3270
3273
|
DEFAULT_MIN_AMOUNT_UI: () => DEFAULT_MIN_AMOUNT_UI,
|
|
3271
3274
|
DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS: () => DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS,
|
|
3272
3275
|
DEFAULT_PRICE_ORACLE_ACCOUNT: () => DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
@@ -3277,6 +3280,7 @@ __export(index_exports, {
|
|
|
3277
3280
|
DEFAULT_TARGET_LOCAL_BPS: () => DEFAULT_TARGET_LOCAL_BPS,
|
|
3278
3281
|
DEFAULT_VAULT_ID: () => DEFAULT_VAULT_ID,
|
|
3279
3282
|
DisableCircuitBreakerBuilder: () => DisableCircuitBreakerBuilder,
|
|
3283
|
+
DistributeIncentiveBuilder: () => DistributeIncentiveBuilder,
|
|
3280
3284
|
EXTERNAL_POSITION_SAMPLES: () => EXTERNAL_POSITION_SAMPLES,
|
|
3281
3285
|
ExecuteDepositBuilder: () => ExecuteDepositBuilder,
|
|
3282
3286
|
ExecuteShareSwapBuilder: () => ExecuteShareSwapBuilder,
|
|
@@ -3303,13 +3307,14 @@ __export(index_exports, {
|
|
|
3303
3307
|
LivePriceSource: () => LivePriceSource,
|
|
3304
3308
|
MAX_BALANCE_CHANGE_BPS: () => MAX_BALANCE_CHANGE_BPS,
|
|
3305
3309
|
MAX_CONSENSUS_SIGNERS: () => MAX_CONSENSUS_SIGNERS,
|
|
3310
|
+
MAX_INCENTIVE_RECIPIENTS: () => MAX_INCENTIVE_RECIPIENTS,
|
|
3306
3311
|
MAX_MANAGER_WITHDRAW_DESTINATIONS: () => MAX_MANAGER_WITHDRAW_DESTINATIONS,
|
|
3307
3312
|
MAX_PRICE_STALENESS_THRESHOLD_SECS: () => MAX_PRICE_STALENESS_THRESHOLD_SECS,
|
|
3308
3313
|
MIN_EXTERNAL_POSITION_SAMPLES: () => MIN_EXTERNAL_POSITION_SAMPLES,
|
|
3309
3314
|
ManagerRedepositAssetBuilder: () => ManagerRedepositAssetBuilder,
|
|
3310
3315
|
ManagerWithdrawAssetBuilder: () => ManagerWithdrawAssetBuilder,
|
|
3311
3316
|
MarginfiPositionProvider: () => MarginfiPositionProvider,
|
|
3312
|
-
MintRegistry: () =>
|
|
3317
|
+
MintRegistry: () => import_common56.MintRegistry,
|
|
3313
3318
|
MockYieldTracker: () => MockYieldTracker,
|
|
3314
3319
|
NEST_API_BASE_URL: () => import_nest2.NEST_API_BASE_URL,
|
|
3315
3320
|
NEST_RWA_SHARE_MINT: () => NEST_RWA_SHARE_MINT,
|
|
@@ -3332,13 +3337,16 @@ __export(index_exports, {
|
|
|
3332
3337
|
SYSTEM_PROGRAM: () => SYSTEM_PROGRAM2,
|
|
3333
3338
|
SetAssetPriceOracleBuilder: () => SetAssetPriceOracleBuilder,
|
|
3334
3339
|
SetExternalLiquidityBuilder: () => SetExternalLiquidityBuilder,
|
|
3340
|
+
SetIncentiveLimitsBuilder: () => SetIncentiveLimitsBuilder,
|
|
3335
3341
|
SetManagerWithdrawDestinationBuilder: () => SetManagerWithdrawDestinationBuilder,
|
|
3336
3342
|
SetProtocolFeeBuilder: () => SetProtocolFeeBuilder,
|
|
3337
3343
|
SetVaultConfigBuilder: () => SetVaultConfigBuilder,
|
|
3338
3344
|
SquadsProposalExecutionSimulationError: () => SquadsProposalExecutionSimulationError,
|
|
3339
3345
|
StaticPositionProvider: () => StaticPositionProvider,
|
|
3346
|
+
SubmitIncentiveBuilder: () => SubmitIncentiveBuilder,
|
|
3340
3347
|
TOKEN_PROGRAM: () => TOKEN_PROGRAM,
|
|
3341
3348
|
TOKEN_PROGRAM_ID: () => TOKEN_PROGRAM_ID,
|
|
3349
|
+
TimelockSettlementService: () => TimelockSettlementService,
|
|
3342
3350
|
TransactionClient: () => TransactionClient,
|
|
3343
3351
|
USDC_MINT: () => USDC_MINT,
|
|
3344
3352
|
USD_STAR_JUNIOR_MINT: () => USD_STAR_JUNIOR_MINT,
|
|
@@ -3383,6 +3391,7 @@ __export(index_exports, {
|
|
|
3383
3391
|
createVaultClient: () => createVaultClient,
|
|
3384
3392
|
createYieldPayment: () => createYieldPayment,
|
|
3385
3393
|
dateToStr: () => dateToStr,
|
|
3394
|
+
decodePendingConsensusSigners: () => decodePendingConsensusSigners,
|
|
3386
3395
|
defaultKeypairPath: () => defaultKeypairPath,
|
|
3387
3396
|
deleteAccount: () => deleteAccount,
|
|
3388
3397
|
discoverVaultsForSigner: () => discoverVaultsForSigner,
|
|
@@ -3400,6 +3409,9 @@ __export(index_exports, {
|
|
|
3400
3409
|
getAprYield: () => getAprYield,
|
|
3401
3410
|
getBalance: () => getBalance,
|
|
3402
3411
|
getCashflows: () => getCashflows,
|
|
3412
|
+
getIncentiveRecipientShareAtas: () => getIncentiveRecipientShareAtas,
|
|
3413
|
+
getIncentiveRecipients: () => getIncentiveRecipients,
|
|
3414
|
+
getIncentiveTotals: () => getIncentiveTotals,
|
|
3403
3415
|
getNavValue: () => getNavValue,
|
|
3404
3416
|
getRpcUrl: () => getRpcUrl,
|
|
3405
3417
|
getTotalOutstandingYield: () => getTotalOutstandingYield,
|
|
@@ -3419,7 +3431,7 @@ __export(index_exports, {
|
|
|
3419
3431
|
logProspectiveApy: () => logProspectiveApy,
|
|
3420
3432
|
makeProvider: () => makeProvider,
|
|
3421
3433
|
mintTokensTo: () => mintTokensTo,
|
|
3422
|
-
mints: () =>
|
|
3434
|
+
mints: () => import_common56.mints,
|
|
3423
3435
|
mostFrequent: () => mostFrequent,
|
|
3424
3436
|
parseExternalLiquidityRefs: () => parseExternalLiquidityRefs,
|
|
3425
3437
|
planRebalance: () => planRebalance,
|
|
@@ -3518,16 +3530,16 @@ var USD_STAR_PRINCIPAL_MINT = (0, import_kit.address)(
|
|
|
3518
3530
|
var import_fs = __toESM(require("fs"));
|
|
3519
3531
|
var import_os = __toESM(require("os"));
|
|
3520
3532
|
var import_path = __toESM(require("path"));
|
|
3521
|
-
var
|
|
3522
|
-
var
|
|
3533
|
+
var import_core19 = require("@anchor-lang/core");
|
|
3534
|
+
var import_web321 = require("@solana/web3.js");
|
|
3523
3535
|
var import_kit10 = require("@solana/kit");
|
|
3524
|
-
var
|
|
3536
|
+
var import_common40 = __toESM(require_dist());
|
|
3525
3537
|
|
|
3526
3538
|
// src/client/client.ts
|
|
3527
|
-
var
|
|
3539
|
+
var import_core18 = require("@anchor-lang/core");
|
|
3528
3540
|
var import_kit9 = require("@solana/kit");
|
|
3529
|
-
var
|
|
3530
|
-
var
|
|
3541
|
+
var import_web320 = require("@solana/web3.js");
|
|
3542
|
+
var import_common39 = __toESM(require_dist());
|
|
3531
3543
|
|
|
3532
3544
|
// src/idl/vault.ts
|
|
3533
3545
|
var IDL = {
|
|
@@ -3563,6 +3575,71 @@ var IDL = {
|
|
|
3563
3575
|
],
|
|
3564
3576
|
"args": []
|
|
3565
3577
|
},
|
|
3578
|
+
{
|
|
3579
|
+
"name": "add_incentive_recipient",
|
|
3580
|
+
"discriminator": [
|
|
3581
|
+
123,
|
|
3582
|
+
176,
|
|
3583
|
+
195,
|
|
3584
|
+
92,
|
|
3585
|
+
173,
|
|
3586
|
+
15,
|
|
3587
|
+
58,
|
|
3588
|
+
43
|
|
3589
|
+
],
|
|
3590
|
+
"accounts": [
|
|
3591
|
+
{
|
|
3592
|
+
"name": "curator",
|
|
3593
|
+
"signer": true
|
|
3594
|
+
},
|
|
3595
|
+
{
|
|
3596
|
+
"name": "vault",
|
|
3597
|
+
"writable": true
|
|
3598
|
+
},
|
|
3599
|
+
{
|
|
3600
|
+
"name": "incentive",
|
|
3601
|
+
"writable": true
|
|
3602
|
+
}
|
|
3603
|
+
],
|
|
3604
|
+
"args": [
|
|
3605
|
+
{
|
|
3606
|
+
"name": "wallet",
|
|
3607
|
+
"type": "pubkey"
|
|
3608
|
+
}
|
|
3609
|
+
]
|
|
3610
|
+
},
|
|
3611
|
+
{
|
|
3612
|
+
"name": "cancel_incentive_proposal",
|
|
3613
|
+
"discriminator": [
|
|
3614
|
+
130,
|
|
3615
|
+
245,
|
|
3616
|
+
210,
|
|
3617
|
+
51,
|
|
3618
|
+
150,
|
|
3619
|
+
220,
|
|
3620
|
+
58,
|
|
3621
|
+
96
|
|
3622
|
+
],
|
|
3623
|
+
"accounts": [
|
|
3624
|
+
{
|
|
3625
|
+
"name": "authority",
|
|
3626
|
+
"signer": true
|
|
3627
|
+
},
|
|
3628
|
+
{
|
|
3629
|
+
"name": "vault"
|
|
3630
|
+
},
|
|
3631
|
+
{
|
|
3632
|
+
"name": "incentive",
|
|
3633
|
+
"writable": true
|
|
3634
|
+
}
|
|
3635
|
+
],
|
|
3636
|
+
"args": [
|
|
3637
|
+
{
|
|
3638
|
+
"name": "round_id",
|
|
3639
|
+
"type": "u64"
|
|
3640
|
+
}
|
|
3641
|
+
]
|
|
3642
|
+
},
|
|
3566
3643
|
{
|
|
3567
3644
|
"name": "cancel_junior_tranche_withdraw",
|
|
3568
3645
|
"discriminator": [
|
|
@@ -4068,6 +4145,73 @@ var IDL = {
|
|
|
4068
4145
|
}
|
|
4069
4146
|
]
|
|
4070
4147
|
},
|
|
4148
|
+
{
|
|
4149
|
+
"name": "create_incentive",
|
|
4150
|
+
"discriminator": [
|
|
4151
|
+
201,
|
|
4152
|
+
74,
|
|
4153
|
+
205,
|
|
4154
|
+
206,
|
|
4155
|
+
209,
|
|
4156
|
+
21,
|
|
4157
|
+
152,
|
|
4158
|
+
179
|
|
4159
|
+
],
|
|
4160
|
+
"accounts": [
|
|
4161
|
+
{
|
|
4162
|
+
"name": "curator",
|
|
4163
|
+
"writable": true,
|
|
4164
|
+
"signer": true
|
|
4165
|
+
},
|
|
4166
|
+
{
|
|
4167
|
+
"name": "vault"
|
|
4168
|
+
},
|
|
4169
|
+
{
|
|
4170
|
+
"name": "incentive",
|
|
4171
|
+
"writable": true,
|
|
4172
|
+
"pda": {
|
|
4173
|
+
"seeds": [
|
|
4174
|
+
{
|
|
4175
|
+
"kind": "const",
|
|
4176
|
+
"value": [
|
|
4177
|
+
105,
|
|
4178
|
+
110,
|
|
4179
|
+
99,
|
|
4180
|
+
101,
|
|
4181
|
+
110,
|
|
4182
|
+
116,
|
|
4183
|
+
105,
|
|
4184
|
+
118,
|
|
4185
|
+
101
|
|
4186
|
+
]
|
|
4187
|
+
},
|
|
4188
|
+
{
|
|
4189
|
+
"kind": "account",
|
|
4190
|
+
"path": "vault"
|
|
4191
|
+
},
|
|
4192
|
+
{
|
|
4193
|
+
"kind": "arg",
|
|
4194
|
+
"path": "args.id"
|
|
4195
|
+
}
|
|
4196
|
+
]
|
|
4197
|
+
}
|
|
4198
|
+
},
|
|
4199
|
+
{
|
|
4200
|
+
"name": "system_program",
|
|
4201
|
+
"address": "11111111111111111111111111111111"
|
|
4202
|
+
}
|
|
4203
|
+
],
|
|
4204
|
+
"args": [
|
|
4205
|
+
{
|
|
4206
|
+
"name": "args",
|
|
4207
|
+
"type": {
|
|
4208
|
+
"defined": {
|
|
4209
|
+
"name": "CreateIncentiveArgs"
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4212
|
+
}
|
|
4213
|
+
]
|
|
4214
|
+
},
|
|
4071
4215
|
{
|
|
4072
4216
|
"name": "create_vault",
|
|
4073
4217
|
"discriminator": [
|
|
@@ -4239,6 +4383,41 @@ var IDL = {
|
|
|
4239
4383
|
],
|
|
4240
4384
|
"args": []
|
|
4241
4385
|
},
|
|
4386
|
+
{
|
|
4387
|
+
"name": "distribute_incentive",
|
|
4388
|
+
"discriminator": [
|
|
4389
|
+
172,
|
|
4390
|
+
211,
|
|
4391
|
+
121,
|
|
4392
|
+
130,
|
|
4393
|
+
226,
|
|
4394
|
+
29,
|
|
4395
|
+
17,
|
|
4396
|
+
199
|
|
4397
|
+
],
|
|
4398
|
+
"accounts": [
|
|
4399
|
+
{
|
|
4400
|
+
"name": "cranker",
|
|
4401
|
+
"signer": true
|
|
4402
|
+
},
|
|
4403
|
+
{
|
|
4404
|
+
"name": "vault",
|
|
4405
|
+
"writable": true
|
|
4406
|
+
},
|
|
4407
|
+
{
|
|
4408
|
+
"name": "incentive",
|
|
4409
|
+
"writable": true
|
|
4410
|
+
},
|
|
4411
|
+
{
|
|
4412
|
+
"name": "share_mint",
|
|
4413
|
+
"writable": true
|
|
4414
|
+
},
|
|
4415
|
+
{
|
|
4416
|
+
"name": "share_token_program"
|
|
4417
|
+
}
|
|
4418
|
+
],
|
|
4419
|
+
"args": []
|
|
4420
|
+
},
|
|
4242
4421
|
{
|
|
4243
4422
|
"name": "execute_deposit",
|
|
4244
4423
|
"discriminator": [
|
|
@@ -9265,6 +9444,43 @@ var IDL = {
|
|
|
9265
9444
|
}
|
|
9266
9445
|
]
|
|
9267
9446
|
},
|
|
9447
|
+
{
|
|
9448
|
+
"name": "set_incentive_limits",
|
|
9449
|
+
"discriminator": [
|
|
9450
|
+
22,
|
|
9451
|
+
243,
|
|
9452
|
+
182,
|
|
9453
|
+
1,
|
|
9454
|
+
240,
|
|
9455
|
+
9,
|
|
9456
|
+
174,
|
|
9457
|
+
175
|
|
9458
|
+
],
|
|
9459
|
+
"accounts": [
|
|
9460
|
+
{
|
|
9461
|
+
"name": "curator",
|
|
9462
|
+
"signer": true
|
|
9463
|
+
},
|
|
9464
|
+
{
|
|
9465
|
+
"name": "vault",
|
|
9466
|
+
"writable": true
|
|
9467
|
+
},
|
|
9468
|
+
{
|
|
9469
|
+
"name": "incentive",
|
|
9470
|
+
"writable": true
|
|
9471
|
+
}
|
|
9472
|
+
],
|
|
9473
|
+
"args": [
|
|
9474
|
+
{
|
|
9475
|
+
"name": "max_total_shares",
|
|
9476
|
+
"type": "u64"
|
|
9477
|
+
},
|
|
9478
|
+
{
|
|
9479
|
+
"name": "min_surplus_reserve",
|
|
9480
|
+
"type": "u64"
|
|
9481
|
+
}
|
|
9482
|
+
]
|
|
9483
|
+
},
|
|
9268
9484
|
{
|
|
9269
9485
|
"name": "set_manager_withdraw_destination",
|
|
9270
9486
|
"discriminator": [
|
|
@@ -9280,6 +9496,10 @@ var IDL = {
|
|
|
9280
9496
|
"accounts": [
|
|
9281
9497
|
{
|
|
9282
9498
|
"name": "curator",
|
|
9499
|
+
"docs": [
|
|
9500
|
+
"Curator for staging/replacing/clearing a destination, or fulfiller for",
|
|
9501
|
+
"confirming an exact pending destination after its timelock expires."
|
|
9502
|
+
],
|
|
9283
9503
|
"signer": true
|
|
9284
9504
|
},
|
|
9285
9505
|
{
|
|
@@ -9360,6 +9580,10 @@ var IDL = {
|
|
|
9360
9580
|
"accounts": [
|
|
9361
9581
|
{
|
|
9362
9582
|
"name": "curator",
|
|
9583
|
+
"docs": [
|
|
9584
|
+
"Curator for configuration changes, or fulfiller when settling expired",
|
|
9585
|
+
"pending role updates with an otherwise empty config update."
|
|
9586
|
+
],
|
|
9363
9587
|
"signer": true
|
|
9364
9588
|
},
|
|
9365
9589
|
{
|
|
@@ -9382,6 +9606,63 @@ var IDL = {
|
|
|
9382
9606
|
}
|
|
9383
9607
|
]
|
|
9384
9608
|
},
|
|
9609
|
+
{
|
|
9610
|
+
"name": "submit_incentive",
|
|
9611
|
+
"discriminator": [
|
|
9612
|
+
254,
|
|
9613
|
+
156,
|
|
9614
|
+
245,
|
|
9615
|
+
213,
|
|
9616
|
+
133,
|
|
9617
|
+
22,
|
|
9618
|
+
132,
|
|
9619
|
+
222
|
|
9620
|
+
],
|
|
9621
|
+
"accounts": [
|
|
9622
|
+
{
|
|
9623
|
+
"name": "oracle",
|
|
9624
|
+
"signer": true
|
|
9625
|
+
},
|
|
9626
|
+
{
|
|
9627
|
+
"name": "vault",
|
|
9628
|
+
"writable": true
|
|
9629
|
+
},
|
|
9630
|
+
{
|
|
9631
|
+
"name": "incentive",
|
|
9632
|
+
"writable": true
|
|
9633
|
+
},
|
|
9634
|
+
{
|
|
9635
|
+
"name": "vault_oracle",
|
|
9636
|
+
"writable": true
|
|
9637
|
+
},
|
|
9638
|
+
{
|
|
9639
|
+
"name": "share_mint"
|
|
9640
|
+
},
|
|
9641
|
+
{
|
|
9642
|
+
"name": "vault_tranche_state",
|
|
9643
|
+
"writable": true,
|
|
9644
|
+
"optional": true
|
|
9645
|
+
},
|
|
9646
|
+
{
|
|
9647
|
+
"name": "junior_tranche_share_mint",
|
|
9648
|
+
"optional": true
|
|
9649
|
+
},
|
|
9650
|
+
{
|
|
9651
|
+
"name": "senior_tranche_share_mint",
|
|
9652
|
+
"optional": true
|
|
9653
|
+
}
|
|
9654
|
+
],
|
|
9655
|
+
"args": [
|
|
9656
|
+
{
|
|
9657
|
+
"name": "args",
|
|
9658
|
+
"type": {
|
|
9659
|
+
"defined": {
|
|
9660
|
+
"name": "SubmitIncentiveArgs"
|
|
9661
|
+
}
|
|
9662
|
+
}
|
|
9663
|
+
}
|
|
9664
|
+
]
|
|
9665
|
+
},
|
|
9385
9666
|
{
|
|
9386
9667
|
"name": "update_asset_price",
|
|
9387
9668
|
"discriminator": [
|
|
@@ -9499,6 +9780,10 @@ var IDL = {
|
|
|
9499
9780
|
"accounts": [
|
|
9500
9781
|
{
|
|
9501
9782
|
"name": "curator",
|
|
9783
|
+
"docs": [
|
|
9784
|
+
"Curator for staging/replacing a signer set, or fulfiller for confirming",
|
|
9785
|
+
"the exact pending signer set after its timelock expires."
|
|
9786
|
+
],
|
|
9502
9787
|
"signer": true
|
|
9503
9788
|
},
|
|
9504
9789
|
{
|
|
@@ -9864,6 +10149,19 @@ var IDL = {
|
|
|
9864
10149
|
119
|
|
9865
10150
|
]
|
|
9866
10151
|
},
|
|
10152
|
+
{
|
|
10153
|
+
"name": "VaultIncentive",
|
|
10154
|
+
"discriminator": [
|
|
10155
|
+
120,
|
|
10156
|
+
176,
|
|
10157
|
+
124,
|
|
10158
|
+
51,
|
|
10159
|
+
97,
|
|
10160
|
+
144,
|
|
10161
|
+
12,
|
|
10162
|
+
50
|
|
10163
|
+
]
|
|
10164
|
+
},
|
|
9867
10165
|
{
|
|
9868
10166
|
"name": "VaultOracle",
|
|
9869
10167
|
"discriminator": [
|
|
@@ -9904,17 +10202,45 @@ var IDL = {
|
|
|
9904
10202
|
]
|
|
9905
10203
|
}
|
|
9906
10204
|
],
|
|
9907
|
-
"
|
|
10205
|
+
"events": [
|
|
9908
10206
|
{
|
|
9909
|
-
"
|
|
9910
|
-
"
|
|
9911
|
-
|
|
10207
|
+
"name": "IncentiveDistributed",
|
|
10208
|
+
"discriminator": [
|
|
10209
|
+
149,
|
|
10210
|
+
100,
|
|
10211
|
+
29,
|
|
10212
|
+
146,
|
|
10213
|
+
164,
|
|
10214
|
+
197,
|
|
10215
|
+
158,
|
|
10216
|
+
34
|
|
10217
|
+
]
|
|
9912
10218
|
},
|
|
9913
10219
|
{
|
|
9914
|
-
"
|
|
9915
|
-
"
|
|
9916
|
-
|
|
9917
|
-
|
|
10220
|
+
"name": "IncentiveReserved",
|
|
10221
|
+
"discriminator": [
|
|
10222
|
+
168,
|
|
10223
|
+
145,
|
|
10224
|
+
110,
|
|
10225
|
+
44,
|
|
10226
|
+
228,
|
|
10227
|
+
193,
|
|
10228
|
+
56,
|
|
10229
|
+
235
|
|
10230
|
+
]
|
|
10231
|
+
}
|
|
10232
|
+
],
|
|
10233
|
+
"errors": [
|
|
10234
|
+
{
|
|
10235
|
+
"code": 14001,
|
|
10236
|
+
"name": "Unauthorized",
|
|
10237
|
+
"msg": "You are not authorized to perform this action."
|
|
10238
|
+
},
|
|
10239
|
+
{
|
|
10240
|
+
"code": 14002,
|
|
10241
|
+
"name": "InvalidBankMint",
|
|
10242
|
+
"msg": "Invalid mint"
|
|
10243
|
+
},
|
|
9918
10244
|
{
|
|
9919
10245
|
"code": 14003,
|
|
9920
10246
|
"name": "AccountingIssue",
|
|
@@ -10171,8 +10497,8 @@ var IDL = {
|
|
|
10171
10497
|
{
|
|
10172
10498
|
"name": "max_apy_bps",
|
|
10173
10499
|
"docs": [
|
|
10174
|
-
"Maximum annualized APY accepted between oracle NAV updates
|
|
10175
|
-
"points."
|
|
10500
|
+
"Maximum annualized APY accepted between oracle NAV updates that advance",
|
|
10501
|
+
"the vault's regular performance-fee high-water mark, in basis points."
|
|
10176
10502
|
],
|
|
10177
10503
|
"type": "u16"
|
|
10178
10504
|
},
|
|
@@ -10434,6 +10760,31 @@ var IDL = {
|
|
|
10434
10760
|
]
|
|
10435
10761
|
}
|
|
10436
10762
|
},
|
|
10763
|
+
{
|
|
10764
|
+
"name": "CreateIncentiveArgs",
|
|
10765
|
+
"type": {
|
|
10766
|
+
"kind": "struct",
|
|
10767
|
+
"fields": [
|
|
10768
|
+
{
|
|
10769
|
+
"name": "id",
|
|
10770
|
+
"type": "u64"
|
|
10771
|
+
},
|
|
10772
|
+
{
|
|
10773
|
+
"name": "recipients",
|
|
10774
|
+
"type": {
|
|
10775
|
+
"vec": "pubkey"
|
|
10776
|
+
}
|
|
10777
|
+
},
|
|
10778
|
+
{
|
|
10779
|
+
"name": "max_total_shares",
|
|
10780
|
+
"docs": [
|
|
10781
|
+
"Lifetime cap across the campaign, including shares already distributed."
|
|
10782
|
+
],
|
|
10783
|
+
"type": "u64"
|
|
10784
|
+
}
|
|
10785
|
+
]
|
|
10786
|
+
}
|
|
10787
|
+
},
|
|
10437
10788
|
{
|
|
10438
10789
|
"name": "ExternalLiquiditySlot",
|
|
10439
10790
|
"serialization": "bytemuck",
|
|
@@ -10579,6 +10930,94 @@ var IDL = {
|
|
|
10579
10930
|
]
|
|
10580
10931
|
}
|
|
10581
10932
|
},
|
|
10933
|
+
{
|
|
10934
|
+
"name": "IncentiveDistributed",
|
|
10935
|
+
"type": {
|
|
10936
|
+
"kind": "struct",
|
|
10937
|
+
"fields": [
|
|
10938
|
+
{
|
|
10939
|
+
"name": "vault",
|
|
10940
|
+
"type": "pubkey"
|
|
10941
|
+
},
|
|
10942
|
+
{
|
|
10943
|
+
"name": "incentive",
|
|
10944
|
+
"type": "pubkey"
|
|
10945
|
+
},
|
|
10946
|
+
{
|
|
10947
|
+
"name": "shares",
|
|
10948
|
+
"type": "u64"
|
|
10949
|
+
}
|
|
10950
|
+
]
|
|
10951
|
+
}
|
|
10952
|
+
},
|
|
10953
|
+
{
|
|
10954
|
+
"name": "IncentiveRecipient",
|
|
10955
|
+
"serialization": "bytemuck",
|
|
10956
|
+
"repr": {
|
|
10957
|
+
"kind": "c"
|
|
10958
|
+
},
|
|
10959
|
+
"type": {
|
|
10960
|
+
"kind": "struct",
|
|
10961
|
+
"fields": [
|
|
10962
|
+
{
|
|
10963
|
+
"name": "wallet",
|
|
10964
|
+
"type": "pubkey"
|
|
10965
|
+
},
|
|
10966
|
+
{
|
|
10967
|
+
"name": "oracle_totals",
|
|
10968
|
+
"docs": [
|
|
10969
|
+
"Cumulative share amounts proposed by the first two vault oracle slots."
|
|
10970
|
+
],
|
|
10971
|
+
"type": {
|
|
10972
|
+
"array": [
|
|
10973
|
+
"u64",
|
|
10974
|
+
2
|
|
10975
|
+
]
|
|
10976
|
+
}
|
|
10977
|
+
},
|
|
10978
|
+
{
|
|
10979
|
+
"name": "settled_total",
|
|
10980
|
+
"type": "u64"
|
|
10981
|
+
},
|
|
10982
|
+
{
|
|
10983
|
+
"name": "distributed_total",
|
|
10984
|
+
"type": "u64"
|
|
10985
|
+
}
|
|
10986
|
+
]
|
|
10987
|
+
}
|
|
10988
|
+
},
|
|
10989
|
+
{
|
|
10990
|
+
"name": "IncentiveReserved",
|
|
10991
|
+
"type": {
|
|
10992
|
+
"kind": "struct",
|
|
10993
|
+
"fields": [
|
|
10994
|
+
{
|
|
10995
|
+
"name": "vault",
|
|
10996
|
+
"type": "pubkey"
|
|
10997
|
+
},
|
|
10998
|
+
{
|
|
10999
|
+
"name": "incentive",
|
|
11000
|
+
"type": "pubkey"
|
|
11001
|
+
},
|
|
11002
|
+
{
|
|
11003
|
+
"name": "round_id",
|
|
11004
|
+
"type": "u64"
|
|
11005
|
+
},
|
|
11006
|
+
{
|
|
11007
|
+
"name": "additional_shares",
|
|
11008
|
+
"type": "u64"
|
|
11009
|
+
},
|
|
11010
|
+
{
|
|
11011
|
+
"name": "curator_shares",
|
|
11012
|
+
"type": "u64"
|
|
11013
|
+
},
|
|
11014
|
+
{
|
|
11015
|
+
"name": "surplus_value",
|
|
11016
|
+
"type": "u64"
|
|
11017
|
+
}
|
|
11018
|
+
]
|
|
11019
|
+
}
|
|
11020
|
+
},
|
|
10582
11021
|
{
|
|
10583
11022
|
"name": "InitializeVaultRolesArgs",
|
|
10584
11023
|
"type": {
|
|
@@ -11322,6 +11761,35 @@ var IDL = {
|
|
|
11322
11761
|
]
|
|
11323
11762
|
}
|
|
11324
11763
|
},
|
|
11764
|
+
{
|
|
11765
|
+
"name": "SubmitIncentiveArgs",
|
|
11766
|
+
"type": {
|
|
11767
|
+
"kind": "struct",
|
|
11768
|
+
"fields": [
|
|
11769
|
+
{
|
|
11770
|
+
"name": "round_id",
|
|
11771
|
+
"type": "u64"
|
|
11772
|
+
},
|
|
11773
|
+
{
|
|
11774
|
+
"name": "totals",
|
|
11775
|
+
"docs": [
|
|
11776
|
+
"One cumulative share total per active recipient, in registration order."
|
|
11777
|
+
],
|
|
11778
|
+
"type": {
|
|
11779
|
+
"vec": "u64"
|
|
11780
|
+
}
|
|
11781
|
+
},
|
|
11782
|
+
{
|
|
11783
|
+
"name": "expires_at",
|
|
11784
|
+
"type": "i64"
|
|
11785
|
+
},
|
|
11786
|
+
{
|
|
11787
|
+
"name": "max_surplus_value",
|
|
11788
|
+
"type": "u64"
|
|
11789
|
+
}
|
|
11790
|
+
]
|
|
11791
|
+
}
|
|
11792
|
+
},
|
|
11325
11793
|
{
|
|
11326
11794
|
"name": "TimelockState",
|
|
11327
11795
|
"docs": [
|
|
@@ -11751,7 +12219,7 @@ var IDL = {
|
|
|
11751
12219
|
{
|
|
11752
12220
|
"name": "total_mint_supply",
|
|
11753
12221
|
"docs": [
|
|
11754
|
-
"Effective share supply: physical mint supply plus unminted
|
|
12222
|
+
"Effective share supply: physical mint supply plus all unminted claims."
|
|
11755
12223
|
],
|
|
11756
12224
|
"type": "u64"
|
|
11757
12225
|
},
|
|
@@ -11832,12 +12300,19 @@ var IDL = {
|
|
|
11832
12300
|
}
|
|
11833
12301
|
}
|
|
11834
12302
|
},
|
|
12303
|
+
{
|
|
12304
|
+
"name": "pending_incentive_shares",
|
|
12305
|
+
"docs": [
|
|
12306
|
+
"Reserved shares across every incentive PDA. Already in effective supply."
|
|
12307
|
+
],
|
|
12308
|
+
"type": "u64"
|
|
12309
|
+
},
|
|
11835
12310
|
{
|
|
11836
12311
|
"name": "_padding1",
|
|
11837
12312
|
"type": {
|
|
11838
12313
|
"array": [
|
|
11839
12314
|
"u64",
|
|
11840
|
-
|
|
12315
|
+
21
|
|
11841
12316
|
]
|
|
11842
12317
|
}
|
|
11843
12318
|
},
|
|
@@ -11933,12 +12408,19 @@ var IDL = {
|
|
|
11933
12408
|
],
|
|
11934
12409
|
"type": "i64"
|
|
11935
12410
|
},
|
|
12411
|
+
{
|
|
12412
|
+
"name": "incentive_min_surplus_reserve",
|
|
12413
|
+
"docs": [
|
|
12414
|
+
"Minimum surplus retained after any incentive reservation, in accounting units."
|
|
12415
|
+
],
|
|
12416
|
+
"type": "u64"
|
|
12417
|
+
},
|
|
11936
12418
|
{
|
|
11937
12419
|
"name": "_padding3",
|
|
11938
12420
|
"type": {
|
|
11939
12421
|
"array": [
|
|
11940
12422
|
"u64",
|
|
11941
|
-
|
|
12423
|
+
21
|
|
11942
12424
|
]
|
|
11943
12425
|
}
|
|
11944
12426
|
}
|
|
@@ -11957,8 +12439,8 @@ var IDL = {
|
|
|
11957
12439
|
{
|
|
11958
12440
|
"name": "junior_floor_apy_bps",
|
|
11959
12441
|
"docs": [
|
|
11960
|
-
"
|
|
11961
|
-
"
|
|
12442
|
+
"Fixed-return floor for the junior tranche, in basis points. It is funded",
|
|
12443
|
+
"only from positive regular-sleeve gains, never senior. Zero disables it."
|
|
11962
12444
|
],
|
|
11963
12445
|
"type": "u16"
|
|
11964
12446
|
},
|
|
@@ -12291,6 +12773,95 @@ var IDL = {
|
|
|
12291
12773
|
]
|
|
12292
12774
|
}
|
|
12293
12775
|
},
|
|
12776
|
+
{
|
|
12777
|
+
"name": "VaultIncentive",
|
|
12778
|
+
"docs": [
|
|
12779
|
+
"One reusable campaign. Recipients are append-only; claims never change owners."
|
|
12780
|
+
],
|
|
12781
|
+
"serialization": "bytemuck",
|
|
12782
|
+
"repr": {
|
|
12783
|
+
"kind": "c"
|
|
12784
|
+
},
|
|
12785
|
+
"type": {
|
|
12786
|
+
"kind": "struct",
|
|
12787
|
+
"fields": [
|
|
12788
|
+
{
|
|
12789
|
+
"name": "vault",
|
|
12790
|
+
"type": "pubkey"
|
|
12791
|
+
},
|
|
12792
|
+
{
|
|
12793
|
+
"name": "id",
|
|
12794
|
+
"type": "u64"
|
|
12795
|
+
},
|
|
12796
|
+
{
|
|
12797
|
+
"name": "round_id",
|
|
12798
|
+
"docs": [
|
|
12799
|
+
"Incremented after settlement, cancellation, or recipient/limit changes."
|
|
12800
|
+
],
|
|
12801
|
+
"type": "u64"
|
|
12802
|
+
},
|
|
12803
|
+
{
|
|
12804
|
+
"name": "expires_at",
|
|
12805
|
+
"type": "i64"
|
|
12806
|
+
},
|
|
12807
|
+
{
|
|
12808
|
+
"name": "max_surplus_value",
|
|
12809
|
+
"docs": [
|
|
12810
|
+
"Both reporters must approve this maximum accounting-value surplus debit."
|
|
12811
|
+
],
|
|
12812
|
+
"type": "u64"
|
|
12813
|
+
},
|
|
12814
|
+
{
|
|
12815
|
+
"name": "max_total_shares",
|
|
12816
|
+
"docs": [
|
|
12817
|
+
"Curator-authorized lifetime share cap across all recipients."
|
|
12818
|
+
],
|
|
12819
|
+
"type": "u64"
|
|
12820
|
+
},
|
|
12821
|
+
{
|
|
12822
|
+
"name": "recipients",
|
|
12823
|
+
"type": {
|
|
12824
|
+
"array": [
|
|
12825
|
+
{
|
|
12826
|
+
"defined": {
|
|
12827
|
+
"name": "IncentiveRecipient"
|
|
12828
|
+
}
|
|
12829
|
+
},
|
|
12830
|
+
5
|
|
12831
|
+
]
|
|
12832
|
+
}
|
|
12833
|
+
},
|
|
12834
|
+
{
|
|
12835
|
+
"name": "bump",
|
|
12836
|
+
"type": "u8"
|
|
12837
|
+
},
|
|
12838
|
+
{
|
|
12839
|
+
"name": "recipient_count",
|
|
12840
|
+
"type": "u8"
|
|
12841
|
+
},
|
|
12842
|
+
{
|
|
12843
|
+
"name": "submitted",
|
|
12844
|
+
"docs": [
|
|
12845
|
+
"Zero-valued reports still set their corresponding bit."
|
|
12846
|
+
],
|
|
12847
|
+
"type": "u8"
|
|
12848
|
+
},
|
|
12849
|
+
{
|
|
12850
|
+
"name": "version",
|
|
12851
|
+
"type": "u8"
|
|
12852
|
+
},
|
|
12853
|
+
{
|
|
12854
|
+
"name": "_padding",
|
|
12855
|
+
"type": {
|
|
12856
|
+
"array": [
|
|
12857
|
+
"u8",
|
|
12858
|
+
4
|
|
12859
|
+
]
|
|
12860
|
+
}
|
|
12861
|
+
}
|
|
12862
|
+
]
|
|
12863
|
+
}
|
|
12864
|
+
},
|
|
12294
12865
|
{
|
|
12295
12866
|
"name": "VaultOracle",
|
|
12296
12867
|
"serialization": "bytemuck",
|
|
@@ -12596,15 +13167,14 @@ var IDL = {
|
|
|
12596
13167
|
"disables the floor.",
|
|
12597
13168
|
"",
|
|
12598
13169
|
"When junior's realized growth falls short of this floor, the shortfall is",
|
|
12599
|
-
"topped up from the *
|
|
12600
|
-
"senior tranche
|
|
12601
|
-
"untouched by the floor. The top-up is
|
|
12602
|
-
"
|
|
12603
|
-
"
|
|
13170
|
+
"topped up from the *positive gain* of the untranched (regular) sleeve,",
|
|
13171
|
+
"never from regular principal or the senior tranche. Senior's fixed-APY",
|
|
13172
|
+
"entitlement is settled first and is untouched by the floor. The top-up is",
|
|
13173
|
+
"best-effort: any unpaid remainder stays outstanding against the durable",
|
|
13174
|
+
"junior anchor",
|
|
12604
13175
|
"(`VaultTrancheState::junior_apy_anchor_share_price`) so it can be paid on",
|
|
12605
|
-
"a later settlement
|
|
12606
|
-
"
|
|
12607
|
-
"and a fresh prospective floor regime begins only after natural recovery."
|
|
13176
|
+
"a later positive-NAV settlement. Flat and negative NAV settlements pay",
|
|
13177
|
+
"nothing but do not reset or forgive the accrued shortfall."
|
|
12608
13178
|
],
|
|
12609
13179
|
"type": "u16"
|
|
12610
13180
|
},
|
|
@@ -12704,8 +13274,8 @@ var IDL = {
|
|
|
12704
13274
|
"name": "junior_apy_anchor_share_price",
|
|
12705
13275
|
"docs": [
|
|
12706
13276
|
"Junior share price at the start of the current floor-APY regime. The",
|
|
12707
|
-
"anchor stays fixed
|
|
12708
|
-
"
|
|
13277
|
+
"anchor stays fixed through gains and losses so unpaid fixed-return",
|
|
13278
|
+
"shortfalls can carry into later positive-NAV settlements."
|
|
12709
13279
|
],
|
|
12710
13280
|
"type": "u64"
|
|
12711
13281
|
},
|
|
@@ -12719,8 +13289,9 @@ var IDL = {
|
|
|
12719
13289
|
{
|
|
12720
13290
|
"name": "junior_floor_underwater",
|
|
12721
13291
|
"docs": [
|
|
12722
|
-
"
|
|
12723
|
-
"
|
|
13292
|
+
"Legacy floor-suspension flag retained for account-layout compatibility.",
|
|
13293
|
+
"The gain-funded floor no longer uses an underwater state and clears this",
|
|
13294
|
+
"field on settlement."
|
|
12724
13295
|
],
|
|
12725
13296
|
"type": "u64"
|
|
12726
13297
|
},
|
|
@@ -12750,9 +13321,10 @@ var IDL = {
|
|
|
12750
13321
|
{
|
|
12751
13322
|
"name": "junior_floor_apy_bps",
|
|
12752
13323
|
"docs": [
|
|
12753
|
-
"
|
|
12754
|
-
"
|
|
12755
|
-
"the previous value is
|
|
13324
|
+
"Fixed-return floor for the junior tranche, in basis points. It is funded",
|
|
13325
|
+
"only from positive regular-sleeve gains. Zero disables it. Setting this",
|
|
13326
|
+
"starts a fresh regime: any shortfall accrued under the previous value is",
|
|
13327
|
+
"forfeited."
|
|
12756
13328
|
],
|
|
12757
13329
|
"type": {
|
|
12758
13330
|
"option": "u16"
|
|
@@ -12963,6 +13535,7 @@ function createRpcFromConnection(connection) {
|
|
|
12963
13535
|
}
|
|
12964
13536
|
|
|
12965
13537
|
// src/client/account.ts
|
|
13538
|
+
var import_sysvars = require("@solana/sysvars");
|
|
12966
13539
|
var import_common = __toESM(require_dist());
|
|
12967
13540
|
var VAULT_CACHE_CATEGORY = "vault";
|
|
12968
13541
|
var FEE_VAULT_CACHE_CATEGORY = "fee_vault";
|
|
@@ -12983,6 +13556,43 @@ var AccountClient = class extends import_common.BaseAccountClient {
|
|
|
12983
13556
|
this.program = program;
|
|
12984
13557
|
this.pda = pda;
|
|
12985
13558
|
}
|
|
13559
|
+
/** Always fresh: callers use the proposal round and cumulative entitlements. */
|
|
13560
|
+
async fetchIncentive(incentive) {
|
|
13561
|
+
return this.program.account.vaultIncentive.fetch((0, import_common.toWeb3Pk)(incentive));
|
|
13562
|
+
}
|
|
13563
|
+
/** Fresh lookup; returns null for missing or uninitialized accounts. */
|
|
13564
|
+
async fetchIncentiveNullable(incentive) {
|
|
13565
|
+
return this.program.account.vaultIncentive.fetchNullable(
|
|
13566
|
+
(0, import_common.toWeb3Pk)(incentive)
|
|
13567
|
+
);
|
|
13568
|
+
}
|
|
13569
|
+
/** Derive the campaign address from its vault and u64 ID, then fetch fresh. */
|
|
13570
|
+
async fetchIncentiveForVault(vault, id) {
|
|
13571
|
+
const [incentive] = await this.pda.deriveIncentivePda(vault, id);
|
|
13572
|
+
return this.fetchIncentive(incentive);
|
|
13573
|
+
}
|
|
13574
|
+
/** Fresh batch lookup preserving input order, duplicates, and missing entries. */
|
|
13575
|
+
async fetchIncentives(incentives) {
|
|
13576
|
+
if (incentives.length === 0) return [];
|
|
13577
|
+
return this.program.account.vaultIncentive.fetchMultiple(
|
|
13578
|
+
incentives.map(import_common.toWeb3Pk)
|
|
13579
|
+
);
|
|
13580
|
+
}
|
|
13581
|
+
/** Discover all campaigns for one vault. Results are fresh and unordered. */
|
|
13582
|
+
async fetchAllIncentivesForVault(vault) {
|
|
13583
|
+
const accounts2 = await this.program.account.vaultIncentive.all([
|
|
13584
|
+
{ memcmp: { offset: 8, bytes: vault } }
|
|
13585
|
+
]);
|
|
13586
|
+
return accounts2.map(({ publicKey, account }) => ({
|
|
13587
|
+
publicKey: (0, import_common.fromWeb3Pk)(publicKey),
|
|
13588
|
+
account
|
|
13589
|
+
}));
|
|
13590
|
+
}
|
|
13591
|
+
/** Live on-chain Unix seconds for proposal expiry; never cached or based on block history. */
|
|
13592
|
+
async fetchClockUnixTimestamp() {
|
|
13593
|
+
const clock = await (0, import_sysvars.fetchSysvarClock)(this.rpc, { commitment: "processed" });
|
|
13594
|
+
return clock.unixTimestamp;
|
|
13595
|
+
}
|
|
12986
13596
|
async fetchVault(vault, opts) {
|
|
12987
13597
|
if (opts?.fresh) {
|
|
12988
13598
|
this.dataCache.clearCacheEntry(VAULT_CACHE_CATEGORY, vault);
|
|
@@ -13111,6 +13721,17 @@ var PdaClient = class {
|
|
|
13111
13721
|
constructor(programAddress) {
|
|
13112
13722
|
this.programAddress = programAddress;
|
|
13113
13723
|
}
|
|
13724
|
+
/** Seeds: `["incentive", vault, id_u64_le]`. */
|
|
13725
|
+
async deriveIncentivePda(vault, id) {
|
|
13726
|
+
if (id < 0n || id > 0xffffffffffffffffn)
|
|
13727
|
+
throw new RangeError("Incentive ID must fit u64");
|
|
13728
|
+
const bytes = new Uint8Array(8);
|
|
13729
|
+
new DataView(bytes.buffer).setBigUint64(0, id, true);
|
|
13730
|
+
return (0, import_kit3.getProgramDerivedAddress)({
|
|
13731
|
+
programAddress: this.programAddress,
|
|
13732
|
+
seeds: [Buffer.from("incentive"), addressEncoder.encode(vault), bytes]
|
|
13733
|
+
});
|
|
13734
|
+
}
|
|
13114
13735
|
/**
|
|
13115
13736
|
* Vault PDA for a global vault id.
|
|
13116
13737
|
*
|
|
@@ -13430,9 +14051,54 @@ function coerceBool(value) {
|
|
|
13430
14051
|
return Boolean(record2?.value ?? record2?.[0]);
|
|
13431
14052
|
}
|
|
13432
14053
|
|
|
13433
|
-
// src/client/builders/
|
|
14054
|
+
// src/client/builders/incentives.ts
|
|
14055
|
+
var import_core = require("@anchor-lang/core");
|
|
14056
|
+
var import_spl_token3 = require("@solana/spl-token");
|
|
14057
|
+
var import_web34 = require("@solana/web3.js");
|
|
14058
|
+
var import_common5 = __toESM(require_dist());
|
|
14059
|
+
|
|
14060
|
+
// src/utils/incentives.ts
|
|
13434
14061
|
var import_common2 = __toESM(require_dist());
|
|
13435
|
-
var
|
|
14062
|
+
var MAX_INCENTIVE_RECIPIENTS = 5;
|
|
14063
|
+
function getIncentiveRecipients(incentive) {
|
|
14064
|
+
const count = incentive.recipientCount;
|
|
14065
|
+
if (!Number.isInteger(count) || count < 0 || count > MAX_INCENTIVE_RECIPIENTS || count > incentive.recipients.length) {
|
|
14066
|
+
throw new RangeError("Invalid incentive recipient count");
|
|
14067
|
+
}
|
|
14068
|
+
return incentive.recipients.slice(0, count).map((entry) => {
|
|
14069
|
+
const settledTotal = BigInt(entry.settledTotal.toString());
|
|
14070
|
+
const distributedTotal = BigInt(entry.distributedTotal.toString());
|
|
14071
|
+
return {
|
|
14072
|
+
wallet: (0, import_common2.fromWeb3Pk)(entry.wallet),
|
|
14073
|
+
oracleTotals: [
|
|
14074
|
+
BigInt(entry.oracleTotals[0].toString()),
|
|
14075
|
+
BigInt(entry.oracleTotals[1].toString())
|
|
14076
|
+
],
|
|
14077
|
+
settledTotal,
|
|
14078
|
+
distributedTotal,
|
|
14079
|
+
outstandingShares: settledTotal - distributedTotal
|
|
14080
|
+
};
|
|
14081
|
+
});
|
|
14082
|
+
}
|
|
14083
|
+
function getIncentiveTotals(incentive) {
|
|
14084
|
+
return getIncentiveRecipients(incentive).reduce(
|
|
14085
|
+
(totals, recipient) => ({
|
|
14086
|
+
settledShares: totals.settledShares + recipient.settledTotal,
|
|
14087
|
+
distributedShares: totals.distributedShares + recipient.distributedTotal,
|
|
14088
|
+
outstandingShares: totals.outstandingShares + recipient.outstandingShares
|
|
14089
|
+
}),
|
|
14090
|
+
{ settledShares: 0n, distributedShares: 0n, outstandingShares: 0n }
|
|
14091
|
+
);
|
|
14092
|
+
}
|
|
14093
|
+
function getIncentiveRecipientShareAtas(incentive, shareMint, shareTokenProgram) {
|
|
14094
|
+
return getIncentiveRecipients(incentive).map(
|
|
14095
|
+
({ wallet }) => (0, import_common2.getAtaAddress)(shareMint, wallet, shareTokenProgram, true)
|
|
14096
|
+
);
|
|
14097
|
+
}
|
|
14098
|
+
|
|
14099
|
+
// src/client/builders/base.ts
|
|
14100
|
+
var import_common3 = __toESM(require_dist());
|
|
14101
|
+
var VaultBuilderBase = class extends import_common3.SingleInstructionBuilderService {
|
|
13436
14102
|
get program() {
|
|
13437
14103
|
return this.context.program;
|
|
13438
14104
|
}
|
|
@@ -13447,16 +14113,11 @@ var VaultBuilderBase = class extends import_common2.SingleInstructionBuilderServ
|
|
|
13447
14113
|
}
|
|
13448
14114
|
};
|
|
13449
14115
|
|
|
13450
|
-
// src/client/builders/cancelJuniorTrancheWithdraw.ts
|
|
13451
|
-
var import_spl_token3 = require("@solana/spl-token");
|
|
13452
|
-
var import_web34 = require("@solana/web3.js");
|
|
13453
|
-
var import_common4 = __toESM(require_dist());
|
|
13454
|
-
|
|
13455
14116
|
// src/client/builders/trancheState.ts
|
|
13456
14117
|
var import_kit5 = require("@solana/kit");
|
|
13457
14118
|
var import_spl_token2 = require("@solana/spl-token");
|
|
13458
14119
|
var import_web33 = require("@solana/web3.js");
|
|
13459
|
-
var
|
|
14120
|
+
var import_common4 = __toESM(require_dist());
|
|
13460
14121
|
function coerceBool2(value) {
|
|
13461
14122
|
if (typeof value === "boolean") return value;
|
|
13462
14123
|
if (typeof value === "number") return value !== 0;
|
|
@@ -13500,7 +14161,7 @@ async function resolveHoldingTokenProgram(account, connection, vault, mint, prov
|
|
|
13500
14161
|
if (provided !== void 0) return provided;
|
|
13501
14162
|
const vaultData = await account.fetchVault(vault);
|
|
13502
14163
|
const holding = vaultData.holdings.find(
|
|
13503
|
-
(entry) => (0,
|
|
14164
|
+
(entry) => (0, import_common4.fromWeb3Pk)(entry.mint) === mint
|
|
13504
14165
|
);
|
|
13505
14166
|
if (holding) {
|
|
13506
14167
|
return tokenProgramAddressFromIdlEnum(holding.tokenProgram);
|
|
@@ -13533,21 +14194,183 @@ async function resolveVaultTrancheState(account, pda, vault, provided) {
|
|
|
13533
14194
|
return trancheStatePda;
|
|
13534
14195
|
}
|
|
13535
14196
|
|
|
14197
|
+
// src/client/builders/incentives.ts
|
|
14198
|
+
var bn = (value) => new import_core.BN(value.toString());
|
|
14199
|
+
var CreateIncentiveBuilder = class extends VaultBuilderBase {
|
|
14200
|
+
async getIx(args) {
|
|
14201
|
+
return this.program.methods.createIncentive({
|
|
14202
|
+
id: bn(args.id),
|
|
14203
|
+
recipients: args.recipients.map(import_common5.toWeb3Pk),
|
|
14204
|
+
maxTotalShares: bn(args.maxTotalShares)
|
|
14205
|
+
}).accountsPartial({
|
|
14206
|
+
curator: (0, import_common5.toWeb3Pk)(args.curator),
|
|
14207
|
+
vault: (0, import_common5.toWeb3Pk)(args.vault),
|
|
14208
|
+
incentive: (0, import_common5.toWeb3Pk)(args.incentive),
|
|
14209
|
+
systemProgram: import_web34.SystemProgram.programId
|
|
14210
|
+
}).instruction().then(import_common5.toKitInstruction);
|
|
14211
|
+
}
|
|
14212
|
+
async deriveIxArgs(args) {
|
|
14213
|
+
const [incentive] = await this.pda.deriveIncentivePda(args.vault, args.id);
|
|
14214
|
+
return { ...args, incentive };
|
|
14215
|
+
}
|
|
14216
|
+
};
|
|
14217
|
+
var AddIncentiveRecipientBuilder = class extends VaultBuilderBase {
|
|
14218
|
+
async getIx(args) {
|
|
14219
|
+
return this.program.methods.addIncentiveRecipient((0, import_common5.toWeb3Pk)(args.wallet)).accountsPartial({
|
|
14220
|
+
curator: (0, import_common5.toWeb3Pk)(args.curator),
|
|
14221
|
+
vault: (0, import_common5.toWeb3Pk)(args.vault),
|
|
14222
|
+
incentive: (0, import_common5.toWeb3Pk)(args.incentive)
|
|
14223
|
+
}).instruction().then(import_common5.toKitInstruction);
|
|
14224
|
+
}
|
|
14225
|
+
};
|
|
14226
|
+
var SetIncentiveLimitsBuilder = class extends VaultBuilderBase {
|
|
14227
|
+
async getIx(args) {
|
|
14228
|
+
return this.program.methods.setIncentiveLimits(bn(args.maxTotalShares), bn(args.minSurplusReserve)).accountsPartial({
|
|
14229
|
+
curator: (0, import_common5.toWeb3Pk)(args.curator),
|
|
14230
|
+
vault: (0, import_common5.toWeb3Pk)(args.vault),
|
|
14231
|
+
incentive: (0, import_common5.toWeb3Pk)(args.incentive)
|
|
14232
|
+
}).instruction().then(import_common5.toKitInstruction);
|
|
14233
|
+
}
|
|
14234
|
+
async buildPlanExtras(args) {
|
|
14235
|
+
return { postSuccessCacheInvalidations: [{ vaultPda: args.vault }] };
|
|
14236
|
+
}
|
|
14237
|
+
};
|
|
14238
|
+
var SubmitIncentiveBuilder = class extends VaultBuilderBase {
|
|
14239
|
+
async getIx(args) {
|
|
14240
|
+
return this.program.methods.submitIncentive({
|
|
14241
|
+
roundId: bn(args.roundId),
|
|
14242
|
+
totals: args.totals.map(bn),
|
|
14243
|
+
expiresAt: bn(args.expiresAt),
|
|
14244
|
+
maxSurplusValue: bn(args.maxSurplusValue)
|
|
14245
|
+
}).accountsPartial({
|
|
14246
|
+
oracle: (0, import_common5.toWeb3Pk)(args.oracle),
|
|
14247
|
+
vault: (0, import_common5.toWeb3Pk)(args.vault),
|
|
14248
|
+
incentive: (0, import_common5.toWeb3Pk)(args.incentive),
|
|
14249
|
+
vaultOracle: (0, import_common5.toWeb3Pk)(args.vaultOracle),
|
|
14250
|
+
shareMint: (0, import_common5.toWeb3Pk)(args.shareMint),
|
|
14251
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common5.toWeb3Pk)(args.vaultTrancheState) : null,
|
|
14252
|
+
juniorTrancheShareMint: args.juniorTrancheShareMint ? (0, import_common5.toWeb3Pk)(args.juniorTrancheShareMint) : null,
|
|
14253
|
+
seniorTrancheShareMint: args.seniorTrancheShareMint ? (0, import_common5.toWeb3Pk)(args.seniorTrancheShareMint) : null
|
|
14254
|
+
}).instruction().then(import_common5.toKitInstruction);
|
|
14255
|
+
}
|
|
14256
|
+
async deriveIxArgs(args) {
|
|
14257
|
+
const [vaultOracle] = await this.pda.deriveVaultOraclePda(args.vault);
|
|
14258
|
+
const vault = await this.account.fetchVault(args.vault, { fresh: true });
|
|
14259
|
+
const vaultTrancheState = await resolveVaultTrancheState(
|
|
14260
|
+
this.account,
|
|
14261
|
+
this.pda,
|
|
14262
|
+
args.vault,
|
|
14263
|
+
void 0
|
|
14264
|
+
);
|
|
14265
|
+
const tranche = vaultTrancheState ? await this.account.fetchVaultTrancheState(vaultTrancheState, {
|
|
14266
|
+
fresh: true
|
|
14267
|
+
}) : null;
|
|
14268
|
+
return {
|
|
14269
|
+
...args,
|
|
14270
|
+
vaultOracle,
|
|
14271
|
+
shareMint: (0, import_common5.fromWeb3Pk)(vault.mint),
|
|
14272
|
+
vaultTrancheState: vaultTrancheState ?? null,
|
|
14273
|
+
juniorTrancheShareMint: tranche ? (0, import_common5.fromWeb3Pk)(tranche.config.juniorMint) : null,
|
|
14274
|
+
seniorTrancheShareMint: tranche ? (0, import_common5.fromWeb3Pk)(tranche.config.seniorMint) : null
|
|
14275
|
+
};
|
|
14276
|
+
}
|
|
14277
|
+
async buildPlanExtras(args) {
|
|
14278
|
+
return {
|
|
14279
|
+
postSuccessCacheInvalidations: [
|
|
14280
|
+
{
|
|
14281
|
+
vaultPda: args.vault,
|
|
14282
|
+
vaultOraclePda: args.vaultOracle,
|
|
14283
|
+
vaultTrancheStatePda: args.vaultTrancheState ?? void 0
|
|
14284
|
+
}
|
|
14285
|
+
]
|
|
14286
|
+
};
|
|
14287
|
+
}
|
|
14288
|
+
};
|
|
14289
|
+
var CancelIncentiveProposalBuilder = class extends VaultBuilderBase {
|
|
14290
|
+
async getIx(args) {
|
|
14291
|
+
return this.program.methods.cancelIncentiveProposal(bn(args.roundId)).accountsPartial({
|
|
14292
|
+
authority: (0, import_common5.toWeb3Pk)(args.authority),
|
|
14293
|
+
vault: (0, import_common5.toWeb3Pk)(args.vault),
|
|
14294
|
+
incentive: (0, import_common5.toWeb3Pk)(args.incentive)
|
|
14295
|
+
}).instruction().then(import_common5.toKitInstruction);
|
|
14296
|
+
}
|
|
14297
|
+
};
|
|
14298
|
+
var DistributeIncentiveBuilder = class extends VaultBuilderBase {
|
|
14299
|
+
async getIx(args) {
|
|
14300
|
+
return this.program.methods.distributeIncentive().accountsPartial({
|
|
14301
|
+
cranker: (0, import_common5.toWeb3Pk)(args.cranker),
|
|
14302
|
+
vault: (0, import_common5.toWeb3Pk)(args.vault),
|
|
14303
|
+
incentive: (0, import_common5.toWeb3Pk)(args.incentive),
|
|
14304
|
+
shareMint: (0, import_common5.toWeb3Pk)(args.shareMint),
|
|
14305
|
+
shareTokenProgram: (0, import_common5.toWeb3Pk)(args.shareTokenProgram)
|
|
14306
|
+
}).remainingAccounts(
|
|
14307
|
+
args.recipientShareAtas.map((ata) => ({
|
|
14308
|
+
pubkey: (0, import_common5.toWeb3Pk)(ata),
|
|
14309
|
+
isWritable: true,
|
|
14310
|
+
isSigner: false
|
|
14311
|
+
}))
|
|
14312
|
+
).instruction().then(import_common5.toKitInstruction);
|
|
14313
|
+
}
|
|
14314
|
+
async deriveIxArgs(args) {
|
|
14315
|
+
const [vault, incentive] = await Promise.all([
|
|
14316
|
+
this.account.fetchVault(args.vault, { fresh: true }),
|
|
14317
|
+
this.account.fetchIncentive(args.incentive)
|
|
14318
|
+
]);
|
|
14319
|
+
const shareMint = (0, import_common5.fromWeb3Pk)(vault.mint);
|
|
14320
|
+
const shareTokenProgram = tokenProgramAddressFromIdlEnum(
|
|
14321
|
+
vault.mintTokenProgram
|
|
14322
|
+
);
|
|
14323
|
+
const recipients = getIncentiveRecipients(incentive).map(
|
|
14324
|
+
({ wallet }) => wallet
|
|
14325
|
+
);
|
|
14326
|
+
return {
|
|
14327
|
+
...args,
|
|
14328
|
+
shareMint,
|
|
14329
|
+
shareTokenProgram,
|
|
14330
|
+
recipients,
|
|
14331
|
+
recipientShareAtas: getIncentiveRecipientShareAtas(
|
|
14332
|
+
incentive,
|
|
14333
|
+
shareMint,
|
|
14334
|
+
shareTokenProgram
|
|
14335
|
+
)
|
|
14336
|
+
};
|
|
14337
|
+
}
|
|
14338
|
+
async buildPreambleInstructions(args) {
|
|
14339
|
+
return args.recipients.map(
|
|
14340
|
+
(wallet, index) => (0, import_common5.toKitInstruction)(
|
|
14341
|
+
(0, import_spl_token3.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14342
|
+
(0, import_common5.toWeb3Pk)(args.cranker),
|
|
14343
|
+
(0, import_common5.toWeb3Pk)(args.recipientShareAtas[index]),
|
|
14344
|
+
(0, import_common5.toWeb3Pk)(wallet),
|
|
14345
|
+
(0, import_common5.toWeb3Pk)(args.shareMint),
|
|
14346
|
+
(0, import_common5.toWeb3Pk)(args.shareTokenProgram)
|
|
14347
|
+
)
|
|
14348
|
+
)
|
|
14349
|
+
);
|
|
14350
|
+
}
|
|
14351
|
+
async buildPlanExtras(args) {
|
|
14352
|
+
return { postSuccessCacheInvalidations: [{ vaultPda: args.vault }] };
|
|
14353
|
+
}
|
|
14354
|
+
};
|
|
14355
|
+
|
|
13536
14356
|
// src/client/builders/cancelJuniorTrancheWithdraw.ts
|
|
14357
|
+
var import_spl_token4 = require("@solana/spl-token");
|
|
14358
|
+
var import_web35 = require("@solana/web3.js");
|
|
14359
|
+
var import_common6 = __toESM(require_dist());
|
|
13537
14360
|
var CancelJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
13538
14361
|
async getIx(args) {
|
|
13539
14362
|
return this.program.methods.cancelJuniorTrancheWithdraw().accountsPartial({
|
|
13540
|
-
user: (0,
|
|
13541
|
-
payer: (0,
|
|
13542
|
-
vault: (0,
|
|
13543
|
-
withdrawalQueue: (0,
|
|
13544
|
-
inputMint: (0,
|
|
13545
|
-
userInputAta: (0,
|
|
13546
|
-
queueInputAta: (0,
|
|
13547
|
-
shareTokenProgram: (0,
|
|
13548
|
-
associatedTokenProgram:
|
|
13549
|
-
systemProgram:
|
|
13550
|
-
}).instruction().then(
|
|
14363
|
+
user: (0, import_common6.toWeb3Pk)(args.user),
|
|
14364
|
+
payer: (0, import_common6.toWeb3Pk)(args.payer),
|
|
14365
|
+
vault: (0, import_common6.toWeb3Pk)(args.vault),
|
|
14366
|
+
withdrawalQueue: (0, import_common6.toWeb3Pk)(args.withdrawalQueue),
|
|
14367
|
+
inputMint: (0, import_common6.toWeb3Pk)(args.inputMint),
|
|
14368
|
+
userInputAta: (0, import_common6.toWeb3Pk)(args.userInputAta),
|
|
14369
|
+
queueInputAta: (0, import_common6.toWeb3Pk)(args.queueInputAta),
|
|
14370
|
+
shareTokenProgram: (0, import_common6.toWeb3Pk)(args.shareTokenProgram),
|
|
14371
|
+
associatedTokenProgram: import_spl_token4.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
14372
|
+
systemProgram: import_web35.SystemProgram.programId
|
|
14373
|
+
}).instruction().then(import_common6.toKitInstruction);
|
|
13551
14374
|
}
|
|
13552
14375
|
async deriveIxArgs(txArgs) {
|
|
13553
14376
|
const payer = txArgs.payer ?? txArgs.user;
|
|
@@ -13576,8 +14399,8 @@ var CancelJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
13576
14399
|
withdrawalQueue: queuePda,
|
|
13577
14400
|
inputMint: juniorShareMint,
|
|
13578
14401
|
shareTokenProgram,
|
|
13579
|
-
userInputAta: txArgs.userInputAta ?? (0,
|
|
13580
|
-
queueInputAta: (0,
|
|
14402
|
+
userInputAta: txArgs.userInputAta ?? (0, import_common6.getAtaAddress)(juniorShareMint, txArgs.user, shareTokenProgram),
|
|
14403
|
+
queueInputAta: (0, import_common6.getAtaAddress)(
|
|
13581
14404
|
juniorShareMint,
|
|
13582
14405
|
queuePda,
|
|
13583
14406
|
shareTokenProgram,
|
|
@@ -13595,19 +14418,19 @@ var CancelJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
13595
14418
|
};
|
|
13596
14419
|
|
|
13597
14420
|
// src/client/builders/createAssetHolding.ts
|
|
13598
|
-
var
|
|
14421
|
+
var import_common7 = __toESM(require_dist());
|
|
13599
14422
|
var CreateAssetHoldingBuilder = class extends VaultBuilderBase {
|
|
13600
14423
|
async getIx(args) {
|
|
13601
14424
|
return this.program.methods.createAssetHolding({
|
|
13602
14425
|
priceOracleType: args.args.priceOracleType,
|
|
13603
|
-
priceOracleAccount: (0,
|
|
14426
|
+
priceOracleAccount: (0, import_common7.toWeb3Pk)(args.args.priceOracleAccount)
|
|
13604
14427
|
}).accountsPartial({
|
|
13605
|
-
hwManager: (0,
|
|
13606
|
-
vault: (0,
|
|
13607
|
-
vaultOracle: (0,
|
|
13608
|
-
mint: (0,
|
|
13609
|
-
tokenProgram: (0,
|
|
13610
|
-
}).instruction().then(
|
|
14428
|
+
hwManager: (0, import_common7.toWeb3Pk)(args.hwManager),
|
|
14429
|
+
vault: (0, import_common7.toWeb3Pk)(args.vault),
|
|
14430
|
+
vaultOracle: (0, import_common7.toWeb3Pk)(args.vaultOracle),
|
|
14431
|
+
mint: (0, import_common7.toWeb3Pk)(args.mint),
|
|
14432
|
+
tokenProgram: (0, import_common7.toWeb3Pk)(args.tokenProgram)
|
|
14433
|
+
}).instruction().then(import_common7.toKitInstruction);
|
|
13611
14434
|
}
|
|
13612
14435
|
async deriveIxArgs(txArgs) {
|
|
13613
14436
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(txArgs.vault);
|
|
@@ -13633,15 +14456,15 @@ var CreateAssetHoldingBuilder = class extends VaultBuilderBase {
|
|
|
13633
14456
|
};
|
|
13634
14457
|
|
|
13635
14458
|
// src/client/builders/removeAssetHolding.ts
|
|
13636
|
-
var
|
|
14459
|
+
var import_common8 = __toESM(require_dist());
|
|
13637
14460
|
var RemoveAssetHoldingBuilder = class extends VaultBuilderBase {
|
|
13638
14461
|
async getIx(args) {
|
|
13639
14462
|
return this.program.methods.removeAssetHolding().accountsPartial({
|
|
13640
|
-
hwManager: (0,
|
|
13641
|
-
vault: (0,
|
|
13642
|
-
vaultOracle: (0,
|
|
13643
|
-
mint: (0,
|
|
13644
|
-
}).instruction().then(
|
|
14463
|
+
hwManager: (0, import_common8.toWeb3Pk)(args.hwManager),
|
|
14464
|
+
vault: (0, import_common8.toWeb3Pk)(args.vault),
|
|
14465
|
+
vaultOracle: (0, import_common8.toWeb3Pk)(args.vaultOracle),
|
|
14466
|
+
mint: (0, import_common8.toWeb3Pk)(args.mint)
|
|
14467
|
+
}).instruction().then(import_common8.toKitInstruction);
|
|
13645
14468
|
}
|
|
13646
14469
|
async deriveIxArgs(txArgs) {
|
|
13647
14470
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(txArgs.vault);
|
|
@@ -13662,16 +14485,16 @@ var RemoveAssetHoldingBuilder = class extends VaultBuilderBase {
|
|
|
13662
14485
|
};
|
|
13663
14486
|
|
|
13664
14487
|
// src/client/builders/updateConsensusSigners.ts
|
|
13665
|
-
var
|
|
14488
|
+
var import_common9 = __toESM(require_dist());
|
|
13666
14489
|
var UpdateConsensusSignersBuilder = class extends VaultBuilderBase {
|
|
13667
14490
|
async getIx(args) {
|
|
13668
14491
|
return this.program.methods.updateConsensusSigners({
|
|
13669
|
-
signers: args.args.signers.map(
|
|
14492
|
+
signers: args.args.signers.map(import_common9.toWeb3Pk)
|
|
13670
14493
|
}).accountsPartial({
|
|
13671
|
-
curator: (0,
|
|
13672
|
-
vault: (0,
|
|
13673
|
-
vaultOracle: (0,
|
|
13674
|
-
}).instruction().then(
|
|
14494
|
+
curator: (0, import_common9.toWeb3Pk)(args.curator),
|
|
14495
|
+
vault: (0, import_common9.toWeb3Pk)(args.vault),
|
|
14496
|
+
vaultOracle: (0, import_common9.toWeb3Pk)(args.vaultOracle)
|
|
14497
|
+
}).instruction().then(import_common9.toKitInstruction);
|
|
13675
14498
|
}
|
|
13676
14499
|
async deriveIxArgs(txArgs) {
|
|
13677
14500
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(txArgs.vault);
|
|
@@ -13692,9 +14515,9 @@ var UpdateConsensusSignersBuilder = class extends VaultBuilderBase {
|
|
|
13692
14515
|
};
|
|
13693
14516
|
|
|
13694
14517
|
// src/client/builders/createTrancheState.ts
|
|
13695
|
-
var
|
|
13696
|
-
var
|
|
13697
|
-
var
|
|
14518
|
+
var import_core2 = require("@anchor-lang/core");
|
|
14519
|
+
var import_web36 = require("@solana/web3.js");
|
|
14520
|
+
var import_common10 = __toESM(require_dist());
|
|
13698
14521
|
var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
13699
14522
|
async getIx(args) {
|
|
13700
14523
|
return this.program.methods.vaultCreateTrancheState({
|
|
@@ -13706,18 +14529,18 @@ var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
|
13706
14529
|
juniorDepositCap: args.juniorDepositCap,
|
|
13707
14530
|
forMigration: args.forMigration
|
|
13708
14531
|
}).accountsPartial({
|
|
13709
|
-
curator: (0,
|
|
13710
|
-
vault: (0,
|
|
13711
|
-
vaultTrancheState: (0,
|
|
13712
|
-
juniorShareMint: (0,
|
|
13713
|
-
seniorShareMint: (0,
|
|
14532
|
+
curator: (0, import_common10.toWeb3Pk)(args.curator),
|
|
14533
|
+
vault: (0, import_common10.toWeb3Pk)(args.vault),
|
|
14534
|
+
vaultTrancheState: (0, import_common10.toWeb3Pk)(args.vaultTrancheState),
|
|
14535
|
+
juniorShareMint: (0, import_common10.toWeb3Pk)(args.juniorShareMint),
|
|
14536
|
+
seniorShareMint: (0, import_common10.toWeb3Pk)(args.seniorShareMint),
|
|
13714
14537
|
// Optional on-chain: required only on the organic path, where the
|
|
13715
14538
|
// program enforces a fresh NAV before enabling tranching. Left null on
|
|
13716
14539
|
// the migration path so Anchor resolves it to the program ID.
|
|
13717
|
-
vaultOracle: args.vaultOracle ? (0,
|
|
13718
|
-
tokenProgram: (0,
|
|
13719
|
-
systemProgram:
|
|
13720
|
-
}).instruction().then(
|
|
14540
|
+
vaultOracle: args.vaultOracle ? (0, import_common10.toWeb3Pk)(args.vaultOracle) : null,
|
|
14541
|
+
tokenProgram: (0, import_common10.toWeb3Pk)(args.tokenProgram),
|
|
14542
|
+
systemProgram: import_web36.SystemProgram.programId
|
|
14543
|
+
}).instruction().then(import_common10.toKitInstruction);
|
|
13721
14544
|
}
|
|
13722
14545
|
async deriveIxArgs(txArgs) {
|
|
13723
14546
|
const [vaultTrancheState] = await this.pda.deriveVaultTrancheStatePda(
|
|
@@ -13746,10 +14569,10 @@ var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
|
13746
14569
|
juniorFloorApyBps: txArgs.juniorFloorApyBps ?? 0,
|
|
13747
14570
|
earlyUnstakeFeeBps: txArgs.earlyUnstakeFeeBps ?? DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS,
|
|
13748
14571
|
standardUnstakeFeeBps: txArgs.standardUnstakeFeeBps ?? DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS,
|
|
13749
|
-
targetLockupDurationSecs: new
|
|
14572
|
+
targetLockupDurationSecs: new import_core2.BN(
|
|
13750
14573
|
(txArgs.targetLockupDurationSecs ?? DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS).toString()
|
|
13751
14574
|
),
|
|
13752
|
-
juniorDepositCap: new
|
|
14575
|
+
juniorDepositCap: new import_core2.BN((txArgs.juniorDepositCap ?? 0n).toString()),
|
|
13753
14576
|
forMigration,
|
|
13754
14577
|
tokenProgram: txArgs.tokenProgram ?? TOKEN_PROGRAM_ID
|
|
13755
14578
|
};
|
|
@@ -13764,13 +14587,13 @@ var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
|
13764
14587
|
};
|
|
13765
14588
|
|
|
13766
14589
|
// src/client/builders/activateCircuitBreaker.ts
|
|
13767
|
-
var
|
|
14590
|
+
var import_common11 = __toESM(require_dist());
|
|
13768
14591
|
var ActivateCircuitBreakerBuilder = class extends VaultBuilderBase {
|
|
13769
14592
|
async getIx(args) {
|
|
13770
14593
|
return this.program.methods.activateCircuitBreaker().accountsPartial({
|
|
13771
|
-
cbTrigger: (0,
|
|
13772
|
-
vault: (0,
|
|
13773
|
-
}).instruction().then(
|
|
14594
|
+
cbTrigger: (0, import_common11.toWeb3Pk)(args.cbTrigger),
|
|
14595
|
+
vault: (0, import_common11.toWeb3Pk)(args.vault)
|
|
14596
|
+
}).instruction().then(import_common11.toKitInstruction);
|
|
13774
14597
|
}
|
|
13775
14598
|
async deriveIxArgs(txArgs) {
|
|
13776
14599
|
return txArgs;
|
|
@@ -13783,34 +14606,34 @@ var ActivateCircuitBreakerBuilder = class extends VaultBuilderBase {
|
|
|
13783
14606
|
};
|
|
13784
14607
|
|
|
13785
14608
|
// src/client/builders/createVault.ts
|
|
13786
|
-
var
|
|
14609
|
+
var import_core4 = require("@anchor-lang/core");
|
|
13787
14610
|
var import_token = require("@solana-program/token");
|
|
13788
|
-
var
|
|
13789
|
-
var
|
|
13790
|
-
var
|
|
14611
|
+
var import_spl_token5 = require("@solana/spl-token");
|
|
14612
|
+
var import_web37 = require("@solana/web3.js");
|
|
14613
|
+
var import_common13 = __toESM(require_dist());
|
|
13791
14614
|
|
|
13792
14615
|
// src/client/builders/anchorArgs.ts
|
|
13793
|
-
var
|
|
13794
|
-
var
|
|
14616
|
+
var import_core3 = require("@anchor-lang/core");
|
|
14617
|
+
var import_common12 = __toESM(require_dist());
|
|
13795
14618
|
function toAnchorCreateVaultParams(params) {
|
|
13796
14619
|
return {
|
|
13797
14620
|
...params,
|
|
13798
|
-
hwManager: (0,
|
|
13799
|
-
cbTrigger: (0,
|
|
13800
|
-
feeCollector: (0,
|
|
13801
|
-
baseAssetMint: (0,
|
|
13802
|
-
basePriceOracleAccount: (0,
|
|
13803
|
-
consensusSigners: params.consensusSigners.map(
|
|
14621
|
+
hwManager: (0, import_common12.toWeb3Pk)(params.hwManager),
|
|
14622
|
+
cbTrigger: (0, import_common12.toWeb3Pk)(params.cbTrigger),
|
|
14623
|
+
feeCollector: (0, import_common12.toWeb3Pk)(params.feeCollector),
|
|
14624
|
+
baseAssetMint: (0, import_common12.toWeb3Pk)(params.baseAssetMint),
|
|
14625
|
+
basePriceOracleAccount: (0, import_common12.toWeb3Pk)(params.basePriceOracleAccount),
|
|
14626
|
+
consensusSigners: params.consensusSigners.map(import_common12.toWeb3Pk)
|
|
13804
14627
|
};
|
|
13805
14628
|
}
|
|
13806
14629
|
function toAnchorSetVaultConfigArgs(args) {
|
|
13807
14630
|
return {
|
|
13808
|
-
manager: args.manager ? (0,
|
|
13809
|
-
hwManager: args.hwManager ? (0,
|
|
13810
|
-
cbTrigger: args.cbTrigger ? (0,
|
|
13811
|
-
fulfiller: args.fulfiller ? (0,
|
|
13812
|
-
feeCollector: args.feeCollector ? (0,
|
|
13813
|
-
newCurator: args.newCurator ? (0,
|
|
14631
|
+
manager: args.manager ? (0, import_common12.toWeb3Pk)(args.manager) : null,
|
|
14632
|
+
hwManager: args.hwManager ? (0, import_common12.toWeb3Pk)(args.hwManager) : null,
|
|
14633
|
+
cbTrigger: args.cbTrigger ? (0, import_common12.toWeb3Pk)(args.cbTrigger) : null,
|
|
14634
|
+
fulfiller: args.fulfiller ? (0, import_common12.toWeb3Pk)(args.fulfiller) : null,
|
|
14635
|
+
feeCollector: args.feeCollector ? (0, import_common12.toWeb3Pk)(args.feeCollector) : null,
|
|
14636
|
+
newCurator: args.newCurator ? (0, import_common12.toWeb3Pk)(args.newCurator) : null,
|
|
13814
14637
|
mintFeeBps: args.mintFeeBps,
|
|
13815
14638
|
burnFeeBps: args.burnFeeBps,
|
|
13816
14639
|
performanceFeeBps: args.performanceFeeBps,
|
|
@@ -13827,9 +14650,9 @@ function toAnchorSetVaultConfigArgs(args) {
|
|
|
13827
14650
|
function toAnchorConsensusUpdates(updates) {
|
|
13828
14651
|
return updates.map((update) => ({
|
|
13829
14652
|
holdingIndex: update.holdingIndex,
|
|
13830
|
-
mint: update.mint ? (0,
|
|
13831
|
-
price: new
|
|
13832
|
-
externalAmount: new
|
|
14653
|
+
mint: update.mint ? (0, import_common12.toWeb3Pk)(update.mint) : null,
|
|
14654
|
+
price: new import_core3.BN(update.price.toString()),
|
|
14655
|
+
externalAmount: new import_core3.BN(update.externalAmount.toString())
|
|
13833
14656
|
}));
|
|
13834
14657
|
}
|
|
13835
14658
|
|
|
@@ -13837,29 +14660,31 @@ function toAnchorConsensusUpdates(updates) {
|
|
|
13837
14660
|
var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
13838
14661
|
async getIx(args) {
|
|
13839
14662
|
return this.program.methods.createVault(toAnchorCreateVaultParams(args.params)).accountsPartial({
|
|
13840
|
-
curator: (0,
|
|
13841
|
-
vault: (0,
|
|
13842
|
-
vaultOracle: (0,
|
|
13843
|
-
feeVault: (0,
|
|
13844
|
-
shareMint: (0,
|
|
13845
|
-
assetMint: (0,
|
|
13846
|
-
assetTokenProgram: (0,
|
|
13847
|
-
tokenProgram: (0,
|
|
13848
|
-
systemProgram:
|
|
13849
|
-
}).instruction().then(
|
|
14663
|
+
curator: (0, import_common13.toWeb3Pk)(args.curator),
|
|
14664
|
+
vault: (0, import_common13.toWeb3Pk)(args.vault),
|
|
14665
|
+
vaultOracle: (0, import_common13.toWeb3Pk)(args.vaultOracle),
|
|
14666
|
+
feeVault: (0, import_common13.toWeb3Pk)(args.feeVault),
|
|
14667
|
+
shareMint: (0, import_common13.toWeb3Pk)(args.shareMint),
|
|
14668
|
+
assetMint: (0, import_common13.toWeb3Pk)(args.assetMint),
|
|
14669
|
+
assetTokenProgram: (0, import_common13.toWeb3Pk)(args.assetTokenProgram),
|
|
14670
|
+
tokenProgram: (0, import_common13.toWeb3Pk)(args.shareTokenProgram ?? TOKEN_PROGRAM_ID),
|
|
14671
|
+
systemProgram: import_web37.SystemProgram.programId
|
|
14672
|
+
}).instruction().then(import_common13.toKitInstruction);
|
|
13850
14673
|
}
|
|
13851
14674
|
async deriveIxArgs(txArgs) {
|
|
13852
14675
|
const vaultId = txArgs.vaultId ?? DEFAULT_VAULT_ID;
|
|
13853
14676
|
const [vault] = await this.pda.deriveVaultPda(vaultId);
|
|
13854
14677
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(vault);
|
|
13855
14678
|
const [feeVault] = await this.pda.deriveFeeAuthorityPda(vault);
|
|
13856
|
-
const
|
|
14679
|
+
const shareMint = await (0, import_token.fetchMint)(this.rpc, txArgs.shareMint);
|
|
14680
|
+
const accountingDecimals = shareMint.data.decimals;
|
|
13857
14681
|
return {
|
|
13858
14682
|
curator: txArgs.curator,
|
|
13859
14683
|
vault,
|
|
13860
14684
|
vaultOracle,
|
|
13861
14685
|
feeVault,
|
|
13862
14686
|
shareMint: txArgs.shareMint,
|
|
14687
|
+
shareTokenProgram: txArgs.shareTokenProgram ?? shareMint.programAddress,
|
|
13863
14688
|
assetMint: txArgs.strictAssetMint,
|
|
13864
14689
|
assetTokenProgram: txArgs.assetTokenProgram ?? TOKEN_PROGRAM_ID,
|
|
13865
14690
|
params: {
|
|
@@ -13873,11 +14698,11 @@ var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
|
13873
14698
|
performanceFeeBps: txArgs.performanceFeeBps ?? 0,
|
|
13874
14699
|
fixedApyBps: txArgs.fixedApyBps ?? 0,
|
|
13875
14700
|
maxApyBps: txArgs.maxApyBps ?? DEFAULT_MAX_ACCEPTABLE_APY_BPS,
|
|
13876
|
-
tvlLimit: new
|
|
14701
|
+
tvlLimit: new import_core4.BN((txArgs.tvlLimit ?? 0n).toString()),
|
|
13877
14702
|
lossesEnabled: txArgs.lossesEnabled ?? false,
|
|
13878
14703
|
initialMintSharePrice: null,
|
|
13879
14704
|
basePriceOracleType: txArgs.basePriceOracleType ?? 1,
|
|
13880
|
-
basePrice: new
|
|
14705
|
+
basePrice: new import_core4.BN(
|
|
13881
14706
|
(txArgs.basePrice ?? 10n ** BigInt(accountingDecimals)).toString()
|
|
13882
14707
|
),
|
|
13883
14708
|
basePriceOracleAccount: txArgs.basePriceOracleAccount ?? DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
@@ -13889,42 +14714,42 @@ var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
|
13889
14714
|
async getTx(txArgs) {
|
|
13890
14715
|
const args = await this.deriveIxArgs(txArgs);
|
|
13891
14716
|
const createIx = await this.getIx(args);
|
|
13892
|
-
const payer = (0,
|
|
13893
|
-
const assetMint = (0,
|
|
13894
|
-
const assetTokenProgram = (0,
|
|
13895
|
-
const vaultAssetAta = (0,
|
|
14717
|
+
const payer = (0, import_common13.toWeb3Pk)(args.curator);
|
|
14718
|
+
const assetMint = (0, import_common13.toWeb3Pk)(args.assetMint);
|
|
14719
|
+
const assetTokenProgram = (0, import_common13.toWeb3Pk)(args.assetTokenProgram);
|
|
14720
|
+
const vaultAssetAta = (0, import_common13.getAtaAddress)(
|
|
13896
14721
|
args.assetMint,
|
|
13897
14722
|
args.vault,
|
|
13898
14723
|
args.assetTokenProgram,
|
|
13899
14724
|
true
|
|
13900
14725
|
);
|
|
13901
|
-
const feeVaultAta = (0,
|
|
14726
|
+
const feeVaultAta = (0, import_common13.getAtaAddress)(
|
|
13902
14727
|
args.assetMint,
|
|
13903
14728
|
args.feeVault,
|
|
13904
14729
|
args.assetTokenProgram,
|
|
13905
14730
|
true
|
|
13906
14731
|
);
|
|
13907
|
-
const createVaultAssetAta = (0,
|
|
14732
|
+
const createVaultAssetAta = (0, import_spl_token5.createAssociatedTokenAccountIdempotentInstruction)(
|
|
13908
14733
|
payer,
|
|
13909
|
-
(0,
|
|
13910
|
-
(0,
|
|
14734
|
+
(0, import_common13.toWeb3Pk)(vaultAssetAta),
|
|
14735
|
+
(0, import_common13.toWeb3Pk)(args.vault),
|
|
13911
14736
|
assetMint,
|
|
13912
14737
|
assetTokenProgram,
|
|
13913
|
-
|
|
14738
|
+
import_spl_token5.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
13914
14739
|
);
|
|
13915
|
-
const createFeeVaultAta = (0,
|
|
14740
|
+
const createFeeVaultAta = (0, import_spl_token5.createAssociatedTokenAccountIdempotentInstruction)(
|
|
13916
14741
|
payer,
|
|
13917
|
-
(0,
|
|
13918
|
-
(0,
|
|
14742
|
+
(0, import_common13.toWeb3Pk)(feeVaultAta),
|
|
14743
|
+
(0, import_common13.toWeb3Pk)(args.feeVault),
|
|
13919
14744
|
assetMint,
|
|
13920
14745
|
assetTokenProgram,
|
|
13921
|
-
|
|
14746
|
+
import_spl_token5.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
13922
14747
|
);
|
|
13923
14748
|
return {
|
|
13924
14749
|
instructions: [
|
|
13925
14750
|
createIx,
|
|
13926
|
-
(0,
|
|
13927
|
-
(0,
|
|
14751
|
+
(0, import_common13.toKitInstruction)(createVaultAssetAta),
|
|
14752
|
+
(0, import_common13.toKitInstruction)(createFeeVaultAta)
|
|
13928
14753
|
],
|
|
13929
14754
|
postSuccessCacheInvalidations: [
|
|
13930
14755
|
{ vaultPda: args.vault, vaultOraclePda: args.vaultOracle }
|
|
@@ -13934,16 +14759,16 @@ var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
|
13934
14759
|
};
|
|
13935
14760
|
|
|
13936
14761
|
// src/client/builders/initializeVaultRoles.ts
|
|
13937
|
-
var
|
|
14762
|
+
var import_common14 = __toESM(require_dist());
|
|
13938
14763
|
var InitializeVaultRolesBuilder = class extends VaultBuilderBase {
|
|
13939
14764
|
async getIx(args) {
|
|
13940
14765
|
return this.program.methods.initializeVaultRoles({
|
|
13941
|
-
manager: (0,
|
|
13942
|
-
fulfiller: (0,
|
|
14766
|
+
manager: (0, import_common14.toWeb3Pk)(args.args.manager),
|
|
14767
|
+
fulfiller: (0, import_common14.toWeb3Pk)(args.args.fulfiller)
|
|
13943
14768
|
}).accountsPartial({
|
|
13944
|
-
curator: (0,
|
|
13945
|
-
vault: (0,
|
|
13946
|
-
}).instruction().then(
|
|
14769
|
+
curator: (0, import_common14.toWeb3Pk)(args.curator),
|
|
14770
|
+
vault: (0, import_common14.toWeb3Pk)(args.vault)
|
|
14771
|
+
}).instruction().then(import_common14.toKitInstruction);
|
|
13947
14772
|
}
|
|
13948
14773
|
async deriveIxArgs(txArgs) {
|
|
13949
14774
|
return {
|
|
@@ -13963,13 +14788,13 @@ var InitializeVaultRolesBuilder = class extends VaultBuilderBase {
|
|
|
13963
14788
|
};
|
|
13964
14789
|
|
|
13965
14790
|
// src/client/builders/disableCircuitBreaker.ts
|
|
13966
|
-
var
|
|
14791
|
+
var import_common15 = __toESM(require_dist());
|
|
13967
14792
|
var DisableCircuitBreakerBuilder = class extends VaultBuilderBase {
|
|
13968
14793
|
async getIx(args) {
|
|
13969
14794
|
return this.program.methods.disableCircuitBreaker().accountsPartial({
|
|
13970
|
-
curator: (0,
|
|
13971
|
-
vault: (0,
|
|
13972
|
-
}).instruction().then(
|
|
14795
|
+
curator: (0, import_common15.toWeb3Pk)(args.curator),
|
|
14796
|
+
vault: (0, import_common15.toWeb3Pk)(args.vault)
|
|
14797
|
+
}).instruction().then(import_common15.toKitInstruction);
|
|
13973
14798
|
}
|
|
13974
14799
|
async deriveIxArgs(txArgs) {
|
|
13975
14800
|
return txArgs;
|
|
@@ -13982,15 +14807,15 @@ var DisableCircuitBreakerBuilder = class extends VaultBuilderBase {
|
|
|
13982
14807
|
};
|
|
13983
14808
|
|
|
13984
14809
|
// src/client/builders/setVaultConfig.ts
|
|
13985
|
-
var
|
|
13986
|
-
var
|
|
14810
|
+
var import_core5 = require("@anchor-lang/core");
|
|
14811
|
+
var import_common16 = __toESM(require_dist());
|
|
13987
14812
|
var SetVaultConfigBuilder = class extends VaultBuilderBase {
|
|
13988
14813
|
async getIx(args) {
|
|
13989
14814
|
return this.program.methods.setVaultConfig(toAnchorSetVaultConfigArgs(args.args)).accountsPartial({
|
|
13990
|
-
curator: (0,
|
|
13991
|
-
vault: (0,
|
|
13992
|
-
vaultOracle: args.vaultOracle ? (0,
|
|
13993
|
-
}).instruction().then(
|
|
14815
|
+
curator: (0, import_common16.toWeb3Pk)(args.curator),
|
|
14816
|
+
vault: (0, import_common16.toWeb3Pk)(args.vault),
|
|
14817
|
+
vaultOracle: args.vaultOracle ? (0, import_common16.toWeb3Pk)(args.vaultOracle) : null
|
|
14818
|
+
}).instruction().then(import_common16.toKitInstruction);
|
|
13994
14819
|
}
|
|
13995
14820
|
async deriveIxArgs(txArgs) {
|
|
13996
14821
|
const [derivedVaultOracle] = await this.pda.deriveVaultOraclePda(
|
|
@@ -14012,28 +14837,28 @@ var SetVaultConfigBuilder = class extends VaultBuilderBase {
|
|
|
14012
14837
|
performanceFeeBps: txArgs.performanceFeeBps ?? null,
|
|
14013
14838
|
fixedApyBps: txArgs.fixedApyBps ?? null,
|
|
14014
14839
|
maxApyBps: txArgs.maxApyBps ?? null,
|
|
14015
|
-
tvlLimit: txArgs.tvlLimit !== void 0 ? new
|
|
14840
|
+
tvlLimit: txArgs.tvlLimit !== void 0 ? new import_core5.BN(txArgs.tvlLimit.toString()) : null,
|
|
14016
14841
|
lossesEnabled: txArgs.lossesEnabled ?? null,
|
|
14017
|
-
priceStalenessThresholdSecs: txArgs.priceStalenessThresholdSecs !== void 0 ? new
|
|
14842
|
+
priceStalenessThresholdSecs: txArgs.priceStalenessThresholdSecs !== void 0 ? new import_core5.BN(txArgs.priceStalenessThresholdSecs.toString()) : null,
|
|
14018
14843
|
userBurnLimit: txArgs.userBurnLimit !== void 0 ? {
|
|
14019
|
-
windowLimit: new
|
|
14844
|
+
windowLimit: new import_core5.BN(
|
|
14020
14845
|
txArgs.userBurnLimit.windowLimit.toString()
|
|
14021
14846
|
),
|
|
14022
|
-
windowDurationSeconds: new
|
|
14847
|
+
windowDurationSeconds: new import_core5.BN(
|
|
14023
14848
|
txArgs.userBurnLimit.windowDurationSeconds.toString()
|
|
14024
14849
|
)
|
|
14025
14850
|
} : null,
|
|
14026
14851
|
managerPullLimit: txArgs.managerPullLimit !== void 0 ? {
|
|
14027
|
-
windowLimit: new
|
|
14852
|
+
windowLimit: new import_core5.BN(
|
|
14028
14853
|
txArgs.managerPullLimit.windowLimit.toString()
|
|
14029
14854
|
),
|
|
14030
|
-
windowDurationSeconds: new
|
|
14855
|
+
windowDurationSeconds: new import_core5.BN(
|
|
14031
14856
|
txArgs.managerPullLimit.windowDurationSeconds.toString()
|
|
14032
14857
|
)
|
|
14033
14858
|
} : null,
|
|
14034
14859
|
rebalanceLimit: txArgs.rebalanceLimit !== void 0 ? {
|
|
14035
14860
|
windowLimitBps: txArgs.rebalanceLimit.windowLimitBps,
|
|
14036
|
-
windowDurationSeconds: new
|
|
14861
|
+
windowDurationSeconds: new import_core5.BN(
|
|
14037
14862
|
txArgs.rebalanceLimit.windowDurationSeconds.toString()
|
|
14038
14863
|
)
|
|
14039
14864
|
} : null
|
|
@@ -14048,14 +14873,14 @@ var SetVaultConfigBuilder = class extends VaultBuilderBase {
|
|
|
14048
14873
|
};
|
|
14049
14874
|
|
|
14050
14875
|
// src/client/builders/setProtocolFee.ts
|
|
14051
|
-
var
|
|
14876
|
+
var import_common17 = __toESM(require_dist());
|
|
14052
14877
|
var SetProtocolFeeBuilder = class extends VaultBuilderBase {
|
|
14053
14878
|
async getIx(args) {
|
|
14054
14879
|
return this.program.methods.setProtocolFee({ protocolFeeBps: args.args.protocolFeeBps }).accountsPartial({
|
|
14055
|
-
protocolAuthority: (0,
|
|
14056
|
-
vault: (0,
|
|
14057
|
-
vaultOracle: args.vaultOracle ? (0,
|
|
14058
|
-
}).instruction().then(
|
|
14880
|
+
protocolAuthority: (0, import_common17.toWeb3Pk)(args.protocolAuthority),
|
|
14881
|
+
vault: (0, import_common17.toWeb3Pk)(args.vault),
|
|
14882
|
+
vaultOracle: args.vaultOracle ? (0, import_common17.toWeb3Pk)(args.vaultOracle) : null
|
|
14883
|
+
}).instruction().then(import_common17.toKitInstruction);
|
|
14059
14884
|
}
|
|
14060
14885
|
async deriveIxArgs(txArgs) {
|
|
14061
14886
|
const [derivedVaultOracle] = await this.pda.deriveVaultOraclePda(
|
|
@@ -14079,13 +14904,13 @@ var SetProtocolFeeBuilder = class extends VaultBuilderBase {
|
|
|
14079
14904
|
};
|
|
14080
14905
|
|
|
14081
14906
|
// src/client/builders/crankNav.ts
|
|
14082
|
-
var
|
|
14907
|
+
var import_spl_token6 = require("@solana/spl-token");
|
|
14083
14908
|
var import_kit6 = require("@solana/kit");
|
|
14084
|
-
var
|
|
14085
|
-
var
|
|
14909
|
+
var import_web38 = require("@solana/web3.js");
|
|
14910
|
+
var import_common19 = __toESM(require_dist());
|
|
14086
14911
|
|
|
14087
14912
|
// src/client/builders/feeCollector.ts
|
|
14088
|
-
var
|
|
14913
|
+
var import_common18 = __toESM(require_dist());
|
|
14089
14914
|
function resolveProtocolFeeRecipient(override) {
|
|
14090
14915
|
return override ?? PROTOCOL_FEE_RECIPIENT;
|
|
14091
14916
|
}
|
|
@@ -14094,14 +14919,14 @@ async function resolveVaultFeeCollector(account, vault, override) {
|
|
|
14094
14919
|
return override;
|
|
14095
14920
|
}
|
|
14096
14921
|
const vaultState = await account.fetchVault(vault);
|
|
14097
|
-
return (0,
|
|
14922
|
+
return (0, import_common18.fromWeb3Pk)(vaultState.roles.feeCollector);
|
|
14098
14923
|
}
|
|
14099
14924
|
function baseAssetMintFromVault(vaultState) {
|
|
14100
14925
|
const baseHolding = vaultState.holdings.find((holding) => holding.isBase);
|
|
14101
14926
|
if (!baseHolding) {
|
|
14102
14927
|
throw new Error("Vault has no base asset holding");
|
|
14103
14928
|
}
|
|
14104
|
-
return (0,
|
|
14929
|
+
return (0, import_common18.fromWeb3Pk)(baseHolding.mint);
|
|
14105
14930
|
}
|
|
14106
14931
|
async function resolveVaultBaseAssetMint(account, vault, override) {
|
|
14107
14932
|
if (override) {
|
|
@@ -14116,7 +14941,7 @@ async function resolveFeeAssetTokenProgram(account, vault, feeAssetMint, overrid
|
|
|
14116
14941
|
}
|
|
14117
14942
|
const vaultState = await account.fetchVault(vault);
|
|
14118
14943
|
const holding = vaultState.holdings.find(
|
|
14119
|
-
(entry) => (0,
|
|
14944
|
+
(entry) => (0, import_common18.fromWeb3Pk)(entry.mint) === feeAssetMint
|
|
14120
14945
|
);
|
|
14121
14946
|
if (!holding) {
|
|
14122
14947
|
return TOKEN_PROGRAM_ID;
|
|
@@ -14128,21 +14953,21 @@ async function resolveFeeAssetTokenProgram(account, vault, feeAssetMint, overrid
|
|
|
14128
14953
|
var CrankNavBuilder = class extends VaultBuilderBase {
|
|
14129
14954
|
async getIx(args) {
|
|
14130
14955
|
return this.program.methods.crankNav().accountsPartial({
|
|
14131
|
-
cranker: (0,
|
|
14132
|
-
vault: (0,
|
|
14133
|
-
vaultOracle: (0,
|
|
14134
|
-
vaultTrancheState: args.vaultTrancheState ? (0,
|
|
14135
|
-
shareMint: (0,
|
|
14136
|
-
juniorTrancheShareMint: args.juniorTrancheShareMint ? (0,
|
|
14137
|
-
seniorTrancheShareMint: args.seniorTrancheShareMint ? (0,
|
|
14138
|
-
feeAssetMint: (0,
|
|
14139
|
-
vaultFeeAssetAta: (0,
|
|
14140
|
-
feeVault: (0,
|
|
14141
|
-
feeVaultAta: (0,
|
|
14142
|
-
feeAssetTokenProgram: (0,
|
|
14143
|
-
associatedTokenProgram:
|
|
14144
|
-
systemProgram:
|
|
14145
|
-
}).instruction().then(
|
|
14956
|
+
cranker: (0, import_common19.toWeb3Pk)(args.cranker),
|
|
14957
|
+
vault: (0, import_common19.toWeb3Pk)(args.vault),
|
|
14958
|
+
vaultOracle: (0, import_common19.toWeb3Pk)(args.vaultOracle),
|
|
14959
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common19.toWeb3Pk)(args.vaultTrancheState) : null,
|
|
14960
|
+
shareMint: (0, import_common19.toWeb3Pk)(args.shareMint),
|
|
14961
|
+
juniorTrancheShareMint: args.juniorTrancheShareMint ? (0, import_common19.toWeb3Pk)(args.juniorTrancheShareMint) : null,
|
|
14962
|
+
seniorTrancheShareMint: args.seniorTrancheShareMint ? (0, import_common19.toWeb3Pk)(args.seniorTrancheShareMint) : null,
|
|
14963
|
+
feeAssetMint: (0, import_common19.toWeb3Pk)(args.feeAssetMint),
|
|
14964
|
+
vaultFeeAssetAta: (0, import_common19.toWeb3Pk)(args.vaultFeeAssetAta),
|
|
14965
|
+
feeVault: (0, import_common19.toWeb3Pk)(args.feeVault),
|
|
14966
|
+
feeVaultAta: (0, import_common19.toWeb3Pk)(args.feeVaultAta),
|
|
14967
|
+
feeAssetTokenProgram: (0, import_common19.toWeb3Pk)(args.feeAssetTokenProgram),
|
|
14968
|
+
associatedTokenProgram: import_spl_token6.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
14969
|
+
systemProgram: import_web38.SystemProgram.programId
|
|
14970
|
+
}).instruction().then(import_common19.toKitInstruction);
|
|
14146
14971
|
}
|
|
14147
14972
|
async deriveIxArgs(txArgs) {
|
|
14148
14973
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(txArgs.vault);
|
|
@@ -14192,13 +15017,13 @@ var CrankNavBuilder = class extends VaultBuilderBase {
|
|
|
14192
15017
|
seniorTrancheShareMint,
|
|
14193
15018
|
feeAssetMint,
|
|
14194
15019
|
feeVault,
|
|
14195
|
-
vaultFeeAssetAta: (0,
|
|
15020
|
+
vaultFeeAssetAta: (0, import_common19.getAtaAddress)(
|
|
14196
15021
|
feeAssetMint,
|
|
14197
15022
|
txArgs.vault,
|
|
14198
15023
|
feeAssetTokenProgram,
|
|
14199
15024
|
true
|
|
14200
15025
|
),
|
|
14201
|
-
feeVaultAta: (0,
|
|
15026
|
+
feeVaultAta: (0, import_common19.getAtaAddress)(
|
|
14202
15027
|
feeAssetMint,
|
|
14203
15028
|
feeVault,
|
|
14204
15029
|
feeAssetTokenProgram,
|
|
@@ -14208,25 +15033,25 @@ var CrankNavBuilder = class extends VaultBuilderBase {
|
|
|
14208
15033
|
};
|
|
14209
15034
|
}
|
|
14210
15035
|
async buildPreambleInstructions(args) {
|
|
14211
|
-
const payer = (0,
|
|
15036
|
+
const payer = (0, import_common19.toWeb3Pk)(args.cranker);
|
|
14212
15037
|
return [
|
|
14213
|
-
(0,
|
|
15038
|
+
(0, import_spl_token6.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14214
15039
|
payer,
|
|
14215
|
-
(0,
|
|
14216
|
-
(0,
|
|
14217
|
-
(0,
|
|
14218
|
-
(0,
|
|
14219
|
-
|
|
15040
|
+
(0, import_common19.toWeb3Pk)(args.vaultFeeAssetAta),
|
|
15041
|
+
(0, import_common19.toWeb3Pk)(args.vault),
|
|
15042
|
+
(0, import_common19.toWeb3Pk)(args.feeAssetMint),
|
|
15043
|
+
(0, import_common19.toWeb3Pk)(args.feeAssetTokenProgram),
|
|
15044
|
+
import_spl_token6.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14220
15045
|
),
|
|
14221
|
-
(0,
|
|
15046
|
+
(0, import_spl_token6.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14222
15047
|
payer,
|
|
14223
|
-
(0,
|
|
14224
|
-
(0,
|
|
14225
|
-
(0,
|
|
14226
|
-
(0,
|
|
14227
|
-
|
|
15048
|
+
(0, import_common19.toWeb3Pk)(args.feeVaultAta),
|
|
15049
|
+
(0, import_common19.toWeb3Pk)(args.feeVault),
|
|
15050
|
+
(0, import_common19.toWeb3Pk)(args.feeAssetMint),
|
|
15051
|
+
(0, import_common19.toWeb3Pk)(args.feeAssetTokenProgram),
|
|
15052
|
+
import_spl_token6.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14228
15053
|
)
|
|
14229
|
-
].map(
|
|
15054
|
+
].map(import_common19.toKitInstruction);
|
|
14230
15055
|
}
|
|
14231
15056
|
async buildPlanExtras(args) {
|
|
14232
15057
|
return {
|
|
@@ -14252,29 +15077,29 @@ var CrankNavBuilder = class extends VaultBuilderBase {
|
|
|
14252
15077
|
};
|
|
14253
15078
|
|
|
14254
15079
|
// src/client/builders/crankPerformanceFees.ts
|
|
14255
|
-
var
|
|
14256
|
-
var
|
|
14257
|
-
var
|
|
15080
|
+
var import_spl_token7 = require("@solana/spl-token");
|
|
15081
|
+
var import_web39 = require("@solana/web3.js");
|
|
15082
|
+
var import_common20 = __toESM(require_dist());
|
|
14258
15083
|
var CrankPerformanceFeesBuilder = class extends VaultBuilderBase {
|
|
14259
15084
|
async getIx(args) {
|
|
14260
15085
|
return this.program.methods.crankPerformanceFees().accountsPartial({
|
|
14261
|
-
cranker: (0,
|
|
14262
|
-
vault: (0,
|
|
14263
|
-
shareMint: (0,
|
|
14264
|
-
feeCollector: (0,
|
|
14265
|
-
feeCollectorShareAta: (0,
|
|
14266
|
-
protocolFeeCollector: (0,
|
|
14267
|
-
protocolFeeCollectorShareAta: (0,
|
|
15086
|
+
cranker: (0, import_common20.toWeb3Pk)(args.cranker),
|
|
15087
|
+
vault: (0, import_common20.toWeb3Pk)(args.vault),
|
|
15088
|
+
shareMint: (0, import_common20.toWeb3Pk)(args.shareMint),
|
|
15089
|
+
feeCollector: (0, import_common20.toWeb3Pk)(args.feeCollector),
|
|
15090
|
+
feeCollectorShareAta: (0, import_common20.toWeb3Pk)(args.feeCollectorShareAta),
|
|
15091
|
+
protocolFeeCollector: (0, import_common20.toWeb3Pk)(args.protocolFeeCollector),
|
|
15092
|
+
protocolFeeCollectorShareAta: (0, import_common20.toWeb3Pk)(
|
|
14268
15093
|
args.protocolFeeCollectorShareAta
|
|
14269
15094
|
),
|
|
14270
|
-
shareTokenProgram: (0,
|
|
14271
|
-
associatedTokenProgram:
|
|
14272
|
-
systemProgram:
|
|
14273
|
-
}).instruction().then(
|
|
15095
|
+
shareTokenProgram: (0, import_common20.toWeb3Pk)(args.shareTokenProgram),
|
|
15096
|
+
associatedTokenProgram: import_spl_token7.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
15097
|
+
systemProgram: import_web39.SystemProgram.programId
|
|
15098
|
+
}).instruction().then(import_common20.toKitInstruction);
|
|
14274
15099
|
}
|
|
14275
15100
|
async deriveIxArgs(txArgs) {
|
|
14276
15101
|
const vaultState = await this.account.fetchVault(txArgs.vault);
|
|
14277
|
-
const shareMint = (0,
|
|
15102
|
+
const shareMint = (0, import_common20.fromWeb3Pk)(vaultState.mint);
|
|
14278
15103
|
const shareTokenProgram = txArgs.shareTokenProgram ?? tokenProgramAddressFromIdlEnum(vaultState.mintTokenProgram);
|
|
14279
15104
|
const feeCollector = await resolveVaultFeeCollector(
|
|
14280
15105
|
this.account,
|
|
@@ -14291,7 +15116,7 @@ var CrankPerformanceFeesBuilder = class extends VaultBuilderBase {
|
|
|
14291
15116
|
feeCollector,
|
|
14292
15117
|
// The vault fee collector is a role that is routinely a Squads vault
|
|
14293
15118
|
// (off-curve PDA), so allow an off-curve owner here too.
|
|
14294
|
-
feeCollectorShareAta: (0,
|
|
15119
|
+
feeCollectorShareAta: (0, import_common20.getAtaAddress)(
|
|
14295
15120
|
shareMint,
|
|
14296
15121
|
feeCollector,
|
|
14297
15122
|
shareTokenProgram,
|
|
@@ -14301,7 +15126,7 @@ var CrankPerformanceFeesBuilder = class extends VaultBuilderBase {
|
|
|
14301
15126
|
// The protocol fee recipient is a hardcoded protocol-controlled address
|
|
14302
15127
|
// that may be off-curve (e.g. a PDA / multisig vault), so allow an
|
|
14303
15128
|
// off-curve owner when deriving its ATA.
|
|
14304
|
-
protocolFeeCollectorShareAta: (0,
|
|
15129
|
+
protocolFeeCollectorShareAta: (0, import_common20.getAtaAddress)(
|
|
14305
15130
|
shareMint,
|
|
14306
15131
|
protocolFeeCollector,
|
|
14307
15132
|
shareTokenProgram,
|
|
@@ -14327,7 +15152,7 @@ var CrankPerformanceFeesBuilder = class extends VaultBuilderBase {
|
|
|
14327
15152
|
};
|
|
14328
15153
|
|
|
14329
15154
|
// src/client/builders/setExternalLiquidity.ts
|
|
14330
|
-
var
|
|
15155
|
+
var import_common21 = __toESM(require_dist());
|
|
14331
15156
|
function toExternalLiquiditySource(source) {
|
|
14332
15157
|
switch (source) {
|
|
14333
15158
|
case 0:
|
|
@@ -14343,11 +15168,11 @@ var SetExternalLiquidityBuilder = class extends VaultBuilderBase {
|
|
|
14343
15168
|
return this.program.methods.setExternalLiquidity({
|
|
14344
15169
|
index: args.args.index,
|
|
14345
15170
|
source: args.args.source,
|
|
14346
|
-
userAccount: (0,
|
|
15171
|
+
userAccount: (0, import_common21.toWeb3Pk)(args.args.userAccount)
|
|
14347
15172
|
}).accountsPartial({
|
|
14348
|
-
curator: (0,
|
|
14349
|
-
vault: (0,
|
|
14350
|
-
}).instruction().then(
|
|
15173
|
+
curator: (0, import_common21.toWeb3Pk)(args.curator),
|
|
15174
|
+
vault: (0, import_common21.toWeb3Pk)(args.vault)
|
|
15175
|
+
}).instruction().then(import_common21.toKitInstruction);
|
|
14351
15176
|
}
|
|
14352
15177
|
async deriveIxArgs(txArgs) {
|
|
14353
15178
|
return {
|
|
@@ -14368,16 +15193,16 @@ var SetExternalLiquidityBuilder = class extends VaultBuilderBase {
|
|
|
14368
15193
|
};
|
|
14369
15194
|
|
|
14370
15195
|
// src/client/builders/setManagerWithdrawDestination.ts
|
|
14371
|
-
var
|
|
15196
|
+
var import_common22 = __toESM(require_dist());
|
|
14372
15197
|
var SetManagerWithdrawDestinationBuilder = class extends VaultBuilderBase {
|
|
14373
15198
|
async getIx(args) {
|
|
14374
15199
|
return this.program.methods.setManagerWithdrawDestination({
|
|
14375
15200
|
slot: args.args.slot,
|
|
14376
|
-
address: (0,
|
|
15201
|
+
address: (0, import_common22.toWeb3Pk)(args.args.address)
|
|
14377
15202
|
}).accountsPartial({
|
|
14378
|
-
curator: (0,
|
|
14379
|
-
vault: (0,
|
|
14380
|
-
}).instruction().then(
|
|
15203
|
+
curator: (0, import_common22.toWeb3Pk)(args.curator),
|
|
15204
|
+
vault: (0, import_common22.toWeb3Pk)(args.vault)
|
|
15205
|
+
}).instruction().then(import_common22.toKitInstruction);
|
|
14381
15206
|
}
|
|
14382
15207
|
async deriveIxArgs(txArgs) {
|
|
14383
15208
|
return {
|
|
@@ -14397,17 +15222,17 @@ var SetManagerWithdrawDestinationBuilder = class extends VaultBuilderBase {
|
|
|
14397
15222
|
};
|
|
14398
15223
|
|
|
14399
15224
|
// src/client/builders/setAssetPriceOracle.ts
|
|
14400
|
-
var
|
|
15225
|
+
var import_common23 = __toESM(require_dist());
|
|
14401
15226
|
var SetAssetPriceOracleBuilder = class extends VaultBuilderBase {
|
|
14402
15227
|
async getIx(args) {
|
|
14403
15228
|
return this.program.methods.setAssetPriceOracle({
|
|
14404
|
-
mint: (0,
|
|
15229
|
+
mint: (0, import_common23.toWeb3Pk)(args.args.mint),
|
|
14405
15230
|
priceOracleType: args.args.priceOracleType,
|
|
14406
|
-
priceOracleAccount: (0,
|
|
15231
|
+
priceOracleAccount: (0, import_common23.toWeb3Pk)(args.args.priceOracleAccount)
|
|
14407
15232
|
}).accountsPartial({
|
|
14408
|
-
curator: (0,
|
|
14409
|
-
vault: (0,
|
|
14410
|
-
}).instruction().then(
|
|
15233
|
+
curator: (0, import_common23.toWeb3Pk)(args.curator),
|
|
15234
|
+
vault: (0, import_common23.toWeb3Pk)(args.vault)
|
|
15235
|
+
}).instruction().then(import_common23.toKitInstruction);
|
|
14411
15236
|
}
|
|
14412
15237
|
async deriveIxArgs(txArgs) {
|
|
14413
15238
|
return {
|
|
@@ -14428,19 +15253,19 @@ var SetAssetPriceOracleBuilder = class extends VaultBuilderBase {
|
|
|
14428
15253
|
};
|
|
14429
15254
|
|
|
14430
15255
|
// src/client/builders/updateAssetPrice.ts
|
|
14431
|
-
var
|
|
14432
|
-
var
|
|
15256
|
+
var import_core6 = require("@anchor-lang/core");
|
|
15257
|
+
var import_common24 = __toESM(require_dist());
|
|
14433
15258
|
var DEFAULT_PRICE_MAX_AGE_SECS = 90n;
|
|
14434
15259
|
var UpdateAssetPriceBuilder = class extends VaultBuilderBase {
|
|
14435
15260
|
async getIx(args) {
|
|
14436
15261
|
return this.program.methods.updateAssetPrice({
|
|
14437
|
-
mint: (0,
|
|
15262
|
+
mint: (0, import_common24.toWeb3Pk)(args.args.mint),
|
|
14438
15263
|
maxAgeSecs: args.args.maxAgeSecs
|
|
14439
15264
|
}).accountsPartial({
|
|
14440
|
-
updater: (0,
|
|
14441
|
-
vault: (0,
|
|
14442
|
-
oracleAccount: (0,
|
|
14443
|
-
}).instruction().then(
|
|
15265
|
+
updater: (0, import_common24.toWeb3Pk)(args.updater),
|
|
15266
|
+
vault: (0, import_common24.toWeb3Pk)(args.vault),
|
|
15267
|
+
oracleAccount: (0, import_common24.toWeb3Pk)(args.oracleAccount)
|
|
15268
|
+
}).instruction().then(import_common24.toKitInstruction);
|
|
14444
15269
|
}
|
|
14445
15270
|
async deriveIxArgs(txArgs) {
|
|
14446
15271
|
return {
|
|
@@ -14449,7 +15274,7 @@ var UpdateAssetPriceBuilder = class extends VaultBuilderBase {
|
|
|
14449
15274
|
oracleAccount: txArgs.oracleAccount,
|
|
14450
15275
|
args: {
|
|
14451
15276
|
mint: txArgs.mint,
|
|
14452
|
-
maxAgeSecs: new
|
|
15277
|
+
maxAgeSecs: new import_core6.BN(
|
|
14453
15278
|
(txArgs.maxAgeSecs ?? DEFAULT_PRICE_MAX_AGE_SECS).toString()
|
|
14454
15279
|
)
|
|
14455
15280
|
}
|
|
@@ -14472,18 +15297,18 @@ var UpdateAssetPriceBuilder = class extends VaultBuilderBase {
|
|
|
14472
15297
|
};
|
|
14473
15298
|
|
|
14474
15299
|
// src/client/builders/updateConsensusOracle.ts
|
|
14475
|
-
var
|
|
15300
|
+
var import_common25 = __toESM(require_dist());
|
|
14476
15301
|
var UpdateConsensusOracleBuilder = class extends VaultBuilderBase {
|
|
14477
15302
|
async getIx(args) {
|
|
14478
15303
|
return this.program.methods.updateConsensusOracle({
|
|
14479
15304
|
updates: toAnchorConsensusUpdates(args.updates)
|
|
14480
15305
|
}).accountsPartial({
|
|
14481
|
-
signer: (0,
|
|
14482
|
-
vault: (0,
|
|
14483
|
-
vaultOracle: (0,
|
|
14484
|
-
assetMint: args.assetMint ? (0,
|
|
14485
|
-
assetTokenProgram: args.assetTokenProgram ? (0,
|
|
14486
|
-
}).instruction().then(
|
|
15306
|
+
signer: (0, import_common25.toWeb3Pk)(args.signer),
|
|
15307
|
+
vault: (0, import_common25.toWeb3Pk)(args.vault),
|
|
15308
|
+
vaultOracle: (0, import_common25.toWeb3Pk)(args.vaultOracle),
|
|
15309
|
+
assetMint: args.assetMint ? (0, import_common25.toWeb3Pk)(args.assetMint) : null,
|
|
15310
|
+
assetTokenProgram: args.assetTokenProgram ? (0, import_common25.toWeb3Pk)(args.assetTokenProgram) : null
|
|
15311
|
+
}).instruction().then(import_common25.toKitInstruction);
|
|
14487
15312
|
}
|
|
14488
15313
|
async deriveIxArgs(txArgs) {
|
|
14489
15314
|
const [derivedVaultOracle] = await this.pda.deriveVaultOraclePda(
|
|
@@ -14527,25 +15352,25 @@ var UpdateConsensusOracleBuilder = class extends VaultBuilderBase {
|
|
|
14527
15352
|
};
|
|
14528
15353
|
|
|
14529
15354
|
// src/client/builders/executeShareSwap.ts
|
|
14530
|
-
var
|
|
14531
|
-
var
|
|
14532
|
-
var
|
|
14533
|
-
var
|
|
15355
|
+
var import_core7 = require("@anchor-lang/core");
|
|
15356
|
+
var import_spl_token8 = require("@solana/spl-token");
|
|
15357
|
+
var import_web310 = require("@solana/web3.js");
|
|
15358
|
+
var import_common26 = __toESM(require_dist());
|
|
14534
15359
|
var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
14535
15360
|
getIxAccounts(args) {
|
|
14536
15361
|
return {
|
|
14537
|
-
user: (0,
|
|
14538
|
-
vault: (0,
|
|
14539
|
-
vaultOracle: (0,
|
|
14540
|
-
vaultTrancheState: (0,
|
|
14541
|
-
shareMint: (0,
|
|
14542
|
-
trancheShareMint: (0,
|
|
14543
|
-
userShareAta: (0,
|
|
14544
|
-
userTrancheShareAta: (0,
|
|
14545
|
-
shareTokenProgram: (0,
|
|
14546
|
-
trancheShareTokenProgram: (0,
|
|
14547
|
-
associatedTokenProgram:
|
|
14548
|
-
systemProgram:
|
|
15362
|
+
user: (0, import_common26.toWeb3Pk)(args.user),
|
|
15363
|
+
vault: (0, import_common26.toWeb3Pk)(args.vault),
|
|
15364
|
+
vaultOracle: (0, import_common26.toWeb3Pk)(args.vaultOracle),
|
|
15365
|
+
vaultTrancheState: (0, import_common26.toWeb3Pk)(args.vaultTrancheState),
|
|
15366
|
+
shareMint: (0, import_common26.toWeb3Pk)(args.shareMint),
|
|
15367
|
+
trancheShareMint: (0, import_common26.toWeb3Pk)(args.trancheShareMint),
|
|
15368
|
+
userShareAta: (0, import_common26.toWeb3Pk)(args.userShareAta),
|
|
15369
|
+
userTrancheShareAta: (0, import_common26.toWeb3Pk)(args.userTrancheShareAta),
|
|
15370
|
+
shareTokenProgram: (0, import_common26.toWeb3Pk)(args.shareTokenProgram),
|
|
15371
|
+
trancheShareTokenProgram: (0, import_common26.toWeb3Pk)(args.trancheShareTokenProgram),
|
|
15372
|
+
associatedTokenProgram: import_spl_token8.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
15373
|
+
systemProgram: import_web310.SystemProgram.programId
|
|
14549
15374
|
};
|
|
14550
15375
|
}
|
|
14551
15376
|
getIxData(args) {
|
|
@@ -14556,7 +15381,7 @@ var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
|
14556
15381
|
}
|
|
14557
15382
|
async getIx(args) {
|
|
14558
15383
|
const data = this.getIxData(args);
|
|
14559
|
-
return this.program.methods.executeShareSwap(data.kind, data.shareAmount).accountsPartial(this.getIxAccounts(args)).instruction().then(
|
|
15384
|
+
return this.program.methods.executeShareSwap(data.kind, data.shareAmount).accountsPartial(this.getIxAccounts(args)).instruction().then(import_common26.toKitInstruction);
|
|
14560
15385
|
}
|
|
14561
15386
|
async deriveIxArgs(txArgs) {
|
|
14562
15387
|
const [
|
|
@@ -14587,11 +15412,11 @@ var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
|
14587
15412
|
shareMint,
|
|
14588
15413
|
trancheShareMint,
|
|
14589
15414
|
kind: txArgs.kind,
|
|
14590
|
-
shareAmount: new
|
|
15415
|
+
shareAmount: new import_core7.BN(txArgs.shareAmount.toString()),
|
|
14591
15416
|
shareTokenProgram,
|
|
14592
15417
|
trancheShareTokenProgram,
|
|
14593
|
-
userShareAta: (0,
|
|
14594
|
-
userTrancheShareAta: (0,
|
|
15418
|
+
userShareAta: (0, import_common26.getAtaAddress)(shareMint, txArgs.user, shareTokenProgram),
|
|
15419
|
+
userTrancheShareAta: (0, import_common26.getAtaAddress)(
|
|
14595
15420
|
trancheShareMint,
|
|
14596
15421
|
txArgs.user,
|
|
14597
15422
|
trancheShareTokenProgram
|
|
@@ -14599,16 +15424,16 @@ var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
|
14599
15424
|
};
|
|
14600
15425
|
}
|
|
14601
15426
|
async buildPreambleInstructions(args) {
|
|
14602
|
-
const payer = (0,
|
|
14603
|
-
const createUserTrancheShareAta = (0,
|
|
15427
|
+
const payer = (0, import_common26.toWeb3Pk)(args.user);
|
|
15428
|
+
const createUserTrancheShareAta = (0, import_spl_token8.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14604
15429
|
payer,
|
|
14605
|
-
(0,
|
|
15430
|
+
(0, import_common26.toWeb3Pk)(args.userTrancheShareAta),
|
|
14606
15431
|
payer,
|
|
14607
|
-
(0,
|
|
14608
|
-
(0,
|
|
14609
|
-
|
|
15432
|
+
(0, import_common26.toWeb3Pk)(args.trancheShareMint),
|
|
15433
|
+
(0, import_common26.toWeb3Pk)(args.trancheShareTokenProgram),
|
|
15434
|
+
import_spl_token8.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14610
15435
|
);
|
|
14611
|
-
return [createUserTrancheShareAta].map(
|
|
15436
|
+
return [createUserTrancheShareAta].map(import_common26.toKitInstruction);
|
|
14612
15437
|
}
|
|
14613
15438
|
async buildPlanExtras(args) {
|
|
14614
15439
|
return {
|
|
@@ -14630,25 +15455,25 @@ var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
|
14630
15455
|
};
|
|
14631
15456
|
|
|
14632
15457
|
// src/client/builders/executeDeposit.ts
|
|
14633
|
-
var
|
|
14634
|
-
var
|
|
14635
|
-
var
|
|
15458
|
+
var import_core8 = require("@anchor-lang/core");
|
|
15459
|
+
var import_spl_token9 = require("@solana/spl-token");
|
|
15460
|
+
var import_common27 = __toESM(require_dist());
|
|
14636
15461
|
var ExecuteDepositBuilder = class extends VaultBuilderBase {
|
|
14637
15462
|
getIxAccounts(args) {
|
|
14638
15463
|
return {
|
|
14639
|
-
user: (0,
|
|
14640
|
-
vault: (0,
|
|
14641
|
-
vaultOracle: (0,
|
|
14642
|
-
vaultTrancheState: args.vaultTrancheState ? (0,
|
|
14643
|
-
assetMint: (0,
|
|
14644
|
-
shareMint: (0,
|
|
14645
|
-
userAssetAta: (0,
|
|
14646
|
-
vaultAssetAta: (0,
|
|
14647
|
-
feeVault: (0,
|
|
14648
|
-
feeVaultAta: (0,
|
|
14649
|
-
userShareAta: (0,
|
|
14650
|
-
assetTokenProgram: (0,
|
|
14651
|
-
shareTokenProgram: (0,
|
|
15464
|
+
user: (0, import_common27.toWeb3Pk)(args.user),
|
|
15465
|
+
vault: (0, import_common27.toWeb3Pk)(args.vault),
|
|
15466
|
+
vaultOracle: (0, import_common27.toWeb3Pk)(args.vaultOracle),
|
|
15467
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common27.toWeb3Pk)(args.vaultTrancheState) : null,
|
|
15468
|
+
assetMint: (0, import_common27.toWeb3Pk)(args.assetMint),
|
|
15469
|
+
shareMint: (0, import_common27.toWeb3Pk)(args.shareMint),
|
|
15470
|
+
userAssetAta: (0, import_common27.toWeb3Pk)(args.userAssetAta),
|
|
15471
|
+
vaultAssetAta: (0, import_common27.toWeb3Pk)(args.vaultAssetAta),
|
|
15472
|
+
feeVault: (0, import_common27.toWeb3Pk)(args.feeVault),
|
|
15473
|
+
feeVaultAta: (0, import_common27.toWeb3Pk)(args.feeVaultAta),
|
|
15474
|
+
userShareAta: (0, import_common27.toWeb3Pk)(args.userShareAta),
|
|
15475
|
+
assetTokenProgram: (0, import_common27.toWeb3Pk)(args.assetTokenProgram),
|
|
15476
|
+
shareTokenProgram: (0, import_common27.toWeb3Pk)(args.shareTokenProgram)
|
|
14652
15477
|
};
|
|
14653
15478
|
}
|
|
14654
15479
|
getIxData(args) {
|
|
@@ -14665,7 +15490,7 @@ var ExecuteDepositBuilder = class extends VaultBuilderBase {
|
|
|
14665
15490
|
) : this.program.methods.executeDeposit(data.amount);
|
|
14666
15491
|
return methods.accountsPartial(
|
|
14667
15492
|
this.getIxAccounts(args)
|
|
14668
|
-
).instruction().then(
|
|
15493
|
+
).instruction().then(import_common27.toKitInstruction);
|
|
14669
15494
|
}
|
|
14670
15495
|
async deriveIxArgs(txArgs) {
|
|
14671
15496
|
const connection = this.program.provider.connection;
|
|
@@ -14704,61 +15529,61 @@ var ExecuteDepositBuilder = class extends VaultBuilderBase {
|
|
|
14704
15529
|
vaultTrancheState,
|
|
14705
15530
|
assetMint: txArgs.assetMint,
|
|
14706
15531
|
shareMint: txArgs.shareMint,
|
|
14707
|
-
amount: new
|
|
15532
|
+
amount: new import_core8.BN(txArgs.amount.toString()),
|
|
14708
15533
|
addressSeeds: txArgs.addressSeeds,
|
|
14709
15534
|
assetTokenProgram,
|
|
14710
15535
|
shareTokenProgram,
|
|
14711
|
-
userAssetAta: txArgs.userAssetAta ?? (0,
|
|
14712
|
-
vaultAssetAta: (0,
|
|
15536
|
+
userAssetAta: txArgs.userAssetAta ?? (0, import_common27.getAtaAddress)(txArgs.assetMint, txArgs.user, assetTokenProgram),
|
|
15537
|
+
vaultAssetAta: (0, import_common27.getAtaAddress)(
|
|
14713
15538
|
txArgs.assetMint,
|
|
14714
15539
|
txArgs.vault,
|
|
14715
15540
|
assetTokenProgram,
|
|
14716
15541
|
true
|
|
14717
15542
|
),
|
|
14718
15543
|
feeVault,
|
|
14719
|
-
feeVaultAta: (0,
|
|
15544
|
+
feeVaultAta: (0, import_common27.getAtaAddress)(
|
|
14720
15545
|
txArgs.assetMint,
|
|
14721
15546
|
feeVault,
|
|
14722
15547
|
assetTokenProgram,
|
|
14723
15548
|
true
|
|
14724
15549
|
),
|
|
14725
|
-
userShareAta: txArgs.userShareAta ?? (0,
|
|
15550
|
+
userShareAta: txArgs.userShareAta ?? (0, import_common27.getAtaAddress)(txArgs.shareMint, txArgs.user, shareTokenProgram)
|
|
14726
15551
|
};
|
|
14727
15552
|
}
|
|
14728
15553
|
async buildPreambleInstructions(args) {
|
|
14729
|
-
const payer = (0,
|
|
14730
|
-
const createVaultAssetAta = (0,
|
|
15554
|
+
const payer = (0, import_common27.toWeb3Pk)(args.user);
|
|
15555
|
+
const createVaultAssetAta = (0, import_spl_token9.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14731
15556
|
payer,
|
|
14732
|
-
(0,
|
|
14733
|
-
(0,
|
|
14734
|
-
(0,
|
|
14735
|
-
(0,
|
|
14736
|
-
|
|
15557
|
+
(0, import_common27.toWeb3Pk)(args.vaultAssetAta),
|
|
15558
|
+
(0, import_common27.toWeb3Pk)(args.vault),
|
|
15559
|
+
(0, import_common27.toWeb3Pk)(args.assetMint),
|
|
15560
|
+
(0, import_common27.toWeb3Pk)(args.assetTokenProgram),
|
|
15561
|
+
import_spl_token9.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14737
15562
|
);
|
|
14738
|
-
const createFeeVaultAta = (0,
|
|
15563
|
+
const createFeeVaultAta = (0, import_spl_token9.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14739
15564
|
payer,
|
|
14740
|
-
(0,
|
|
14741
|
-
(0,
|
|
14742
|
-
(0,
|
|
14743
|
-
(0,
|
|
14744
|
-
|
|
15565
|
+
(0, import_common27.toWeb3Pk)(args.feeVaultAta),
|
|
15566
|
+
(0, import_common27.toWeb3Pk)(args.feeVault),
|
|
15567
|
+
(0, import_common27.toWeb3Pk)(args.assetMint),
|
|
15568
|
+
(0, import_common27.toWeb3Pk)(args.assetTokenProgram),
|
|
15569
|
+
import_spl_token9.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14745
15570
|
);
|
|
14746
|
-
const defaultUserShareAta = (0,
|
|
15571
|
+
const defaultUserShareAta = (0, import_common27.getAtaAddress)(
|
|
14747
15572
|
args.shareMint,
|
|
14748
15573
|
args.user,
|
|
14749
15574
|
args.shareTokenProgram
|
|
14750
15575
|
);
|
|
14751
|
-
const createUserShareAta = (0,
|
|
14752
|
-
(0,
|
|
14753
|
-
) ? (0,
|
|
15576
|
+
const createUserShareAta = (0, import_common27.toWeb3Pk)(args.userShareAta).equals(
|
|
15577
|
+
(0, import_common27.toWeb3Pk)(defaultUserShareAta)
|
|
15578
|
+
) ? (0, import_spl_token9.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14754
15579
|
payer,
|
|
14755
|
-
(0,
|
|
15580
|
+
(0, import_common27.toWeb3Pk)(args.userShareAta),
|
|
14756
15581
|
payer,
|
|
14757
|
-
(0,
|
|
14758
|
-
(0,
|
|
14759
|
-
|
|
15582
|
+
(0, import_common27.toWeb3Pk)(args.shareMint),
|
|
15583
|
+
(0, import_common27.toWeb3Pk)(args.shareTokenProgram),
|
|
15584
|
+
import_spl_token9.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14760
15585
|
) : null;
|
|
14761
|
-
return [createVaultAssetAta, createFeeVaultAta, createUserShareAta].filter((ix) => ix != null).map(
|
|
15586
|
+
return [createVaultAssetAta, createFeeVaultAta, createUserShareAta].filter((ix) => ix != null).map(import_common27.toKitInstruction);
|
|
14762
15587
|
}
|
|
14763
15588
|
async buildPlanExtras(args) {
|
|
14764
15589
|
return {
|
|
@@ -14778,28 +15603,28 @@ var ExecuteDepositBuilder = class extends VaultBuilderBase {
|
|
|
14778
15603
|
};
|
|
14779
15604
|
|
|
14780
15605
|
// src/client/builders/executeTrancheDeposit.ts
|
|
14781
|
-
var
|
|
14782
|
-
var
|
|
14783
|
-
var
|
|
14784
|
-
var
|
|
15606
|
+
var import_core9 = require("@anchor-lang/core");
|
|
15607
|
+
var import_spl_token10 = require("@solana/spl-token");
|
|
15608
|
+
var import_web311 = require("@solana/web3.js");
|
|
15609
|
+
var import_common28 = __toESM(require_dist());
|
|
14785
15610
|
var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
14786
15611
|
getIxAccounts(args) {
|
|
14787
15612
|
return {
|
|
14788
|
-
user: (0,
|
|
14789
|
-
vault: (0,
|
|
14790
|
-
vaultOracle: (0,
|
|
14791
|
-
vaultTrancheState: (0,
|
|
14792
|
-
assetMint: (0,
|
|
14793
|
-
trancheShareMint: (0,
|
|
14794
|
-
userAssetAta: (0,
|
|
14795
|
-
vaultAssetAta: (0,
|
|
14796
|
-
feeVault: (0,
|
|
14797
|
-
feeVaultAta: (0,
|
|
14798
|
-
userTrancheShareAta: (0,
|
|
14799
|
-
assetTokenProgram: (0,
|
|
14800
|
-
shareTokenProgram: (0,
|
|
14801
|
-
associatedTokenProgram:
|
|
14802
|
-
systemProgram:
|
|
15613
|
+
user: (0, import_common28.toWeb3Pk)(args.user),
|
|
15614
|
+
vault: (0, import_common28.toWeb3Pk)(args.vault),
|
|
15615
|
+
vaultOracle: (0, import_common28.toWeb3Pk)(args.vaultOracle),
|
|
15616
|
+
vaultTrancheState: (0, import_common28.toWeb3Pk)(args.vaultTrancheState),
|
|
15617
|
+
assetMint: (0, import_common28.toWeb3Pk)(args.assetMint),
|
|
15618
|
+
trancheShareMint: (0, import_common28.toWeb3Pk)(args.trancheShareMint),
|
|
15619
|
+
userAssetAta: (0, import_common28.toWeb3Pk)(args.userAssetAta),
|
|
15620
|
+
vaultAssetAta: (0, import_common28.toWeb3Pk)(args.vaultAssetAta),
|
|
15621
|
+
feeVault: (0, import_common28.toWeb3Pk)(args.feeVault),
|
|
15622
|
+
feeVaultAta: (0, import_common28.toWeb3Pk)(args.feeVaultAta),
|
|
15623
|
+
userTrancheShareAta: (0, import_common28.toWeb3Pk)(args.userTrancheShareAta),
|
|
15624
|
+
assetTokenProgram: (0, import_common28.toWeb3Pk)(args.assetTokenProgram),
|
|
15625
|
+
shareTokenProgram: (0, import_common28.toWeb3Pk)(args.shareTokenProgram),
|
|
15626
|
+
associatedTokenProgram: import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
15627
|
+
systemProgram: import_web311.SystemProgram.programId
|
|
14803
15628
|
};
|
|
14804
15629
|
}
|
|
14805
15630
|
getIxData(args) {
|
|
@@ -14818,7 +15643,7 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
14818
15643
|
) : this.program.methods.executeTrancheDeposit(data.kind, data.amount);
|
|
14819
15644
|
return methods.accountsPartial(
|
|
14820
15645
|
this.getIxAccounts(args)
|
|
14821
|
-
).instruction().then(
|
|
15646
|
+
).instruction().then(import_common28.toKitInstruction);
|
|
14822
15647
|
}
|
|
14823
15648
|
async deriveIxArgs(txArgs) {
|
|
14824
15649
|
const connection = this.program.provider.connection;
|
|
@@ -14847,29 +15672,29 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
14847
15672
|
assetMint: txArgs.assetMint,
|
|
14848
15673
|
trancheShareMint,
|
|
14849
15674
|
kind: txArgs.kind,
|
|
14850
|
-
amount: new
|
|
15675
|
+
amount: new import_core9.BN(txArgs.amount.toString()),
|
|
14851
15676
|
addressSeeds: txArgs.addressSeeds,
|
|
14852
15677
|
assetTokenProgram,
|
|
14853
15678
|
shareTokenProgram,
|
|
14854
|
-
userAssetAta: (0,
|
|
15679
|
+
userAssetAta: (0, import_common28.getAtaAddress)(
|
|
14855
15680
|
txArgs.assetMint,
|
|
14856
15681
|
txArgs.user,
|
|
14857
15682
|
assetTokenProgram
|
|
14858
15683
|
),
|
|
14859
|
-
vaultAssetAta: (0,
|
|
15684
|
+
vaultAssetAta: (0, import_common28.getAtaAddress)(
|
|
14860
15685
|
txArgs.assetMint,
|
|
14861
15686
|
txArgs.vault,
|
|
14862
15687
|
assetTokenProgram,
|
|
14863
15688
|
true
|
|
14864
15689
|
),
|
|
14865
15690
|
feeVault,
|
|
14866
|
-
feeVaultAta: (0,
|
|
15691
|
+
feeVaultAta: (0, import_common28.getAtaAddress)(
|
|
14867
15692
|
txArgs.assetMint,
|
|
14868
15693
|
feeVault,
|
|
14869
15694
|
assetTokenProgram,
|
|
14870
15695
|
true
|
|
14871
15696
|
),
|
|
14872
|
-
userTrancheShareAta: (0,
|
|
15697
|
+
userTrancheShareAta: (0, import_common28.getAtaAddress)(
|
|
14873
15698
|
trancheShareMint,
|
|
14874
15699
|
txArgs.user,
|
|
14875
15700
|
shareTokenProgram
|
|
@@ -14877,33 +15702,33 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
14877
15702
|
};
|
|
14878
15703
|
}
|
|
14879
15704
|
async buildPreambleInstructions(args) {
|
|
14880
|
-
const payer = (0,
|
|
14881
|
-
const createVaultAssetAta = (0,
|
|
15705
|
+
const payer = (0, import_common28.toWeb3Pk)(args.user);
|
|
15706
|
+
const createVaultAssetAta = (0, import_spl_token10.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14882
15707
|
payer,
|
|
14883
|
-
(0,
|
|
14884
|
-
(0,
|
|
14885
|
-
(0,
|
|
14886
|
-
(0,
|
|
14887
|
-
|
|
15708
|
+
(0, import_common28.toWeb3Pk)(args.vaultAssetAta),
|
|
15709
|
+
(0, import_common28.toWeb3Pk)(args.vault),
|
|
15710
|
+
(0, import_common28.toWeb3Pk)(args.assetMint),
|
|
15711
|
+
(0, import_common28.toWeb3Pk)(args.assetTokenProgram),
|
|
15712
|
+
import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14888
15713
|
);
|
|
14889
|
-
const createUserShareAta = (0,
|
|
15714
|
+
const createUserShareAta = (0, import_spl_token10.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14890
15715
|
payer,
|
|
14891
|
-
(0,
|
|
15716
|
+
(0, import_common28.toWeb3Pk)(args.userTrancheShareAta),
|
|
14892
15717
|
payer,
|
|
14893
|
-
(0,
|
|
14894
|
-
(0,
|
|
14895
|
-
|
|
15718
|
+
(0, import_common28.toWeb3Pk)(args.trancheShareMint),
|
|
15719
|
+
(0, import_common28.toWeb3Pk)(args.shareTokenProgram),
|
|
15720
|
+
import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14896
15721
|
);
|
|
14897
|
-
const createFeeVaultAta = (0,
|
|
15722
|
+
const createFeeVaultAta = (0, import_spl_token10.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14898
15723
|
payer,
|
|
14899
|
-
(0,
|
|
14900
|
-
(0,
|
|
14901
|
-
(0,
|
|
14902
|
-
(0,
|
|
14903
|
-
|
|
15724
|
+
(0, import_common28.toWeb3Pk)(args.feeVaultAta),
|
|
15725
|
+
(0, import_common28.toWeb3Pk)(args.feeVault),
|
|
15726
|
+
(0, import_common28.toWeb3Pk)(args.assetMint),
|
|
15727
|
+
(0, import_common28.toWeb3Pk)(args.assetTokenProgram),
|
|
15728
|
+
import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14904
15729
|
);
|
|
14905
15730
|
return [createVaultAssetAta, createFeeVaultAta, createUserShareAta].map(
|
|
14906
|
-
|
|
15731
|
+
import_common28.toKitInstruction
|
|
14907
15732
|
);
|
|
14908
15733
|
}
|
|
14909
15734
|
async buildPlanExtras(args) {
|
|
@@ -14926,27 +15751,27 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
14926
15751
|
};
|
|
14927
15752
|
|
|
14928
15753
|
// src/client/builders/executeTrancheWithdraw.ts
|
|
14929
|
-
var
|
|
14930
|
-
var
|
|
14931
|
-
var
|
|
14932
|
-
var
|
|
15754
|
+
var import_core10 = require("@anchor-lang/core");
|
|
15755
|
+
var import_spl_token11 = require("@solana/spl-token");
|
|
15756
|
+
var import_web313 = require("@solana/web3.js");
|
|
15757
|
+
var import_common30 = __toESM(require_dist());
|
|
14933
15758
|
|
|
14934
15759
|
// src/client/builders/externalLiquidity.ts
|
|
14935
15760
|
var import_kit7 = require("@solana/kit");
|
|
14936
|
-
var
|
|
14937
|
-
var
|
|
15761
|
+
var import_web312 = require("@solana/web3.js");
|
|
15762
|
+
var import_common29 = __toESM(require_dist());
|
|
14938
15763
|
var import_marginfi = __toESM(require_dist2());
|
|
14939
15764
|
function parseMarginfiSlot(slot) {
|
|
14940
15765
|
const data = slot?.data;
|
|
14941
15766
|
if (!data || data.length < 40) return null;
|
|
14942
15767
|
if (data[0] !== 1) return null;
|
|
14943
15768
|
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
14944
|
-
const userAccount = new
|
|
15769
|
+
const userAccount = new import_web312.PublicKey(pubkeyBytes).toBase58();
|
|
14945
15770
|
return { userAccount };
|
|
14946
15771
|
}
|
|
14947
15772
|
function toWeb3AccountMeta(account) {
|
|
14948
15773
|
return {
|
|
14949
|
-
pubkey: new
|
|
15774
|
+
pubkey: new import_web312.PublicKey(account.address),
|
|
14950
15775
|
isWritable: account.role === import_kit7.AccountRole.WRITABLE || account.role === import_kit7.AccountRole.WRITABLE_SIGNER,
|
|
14951
15776
|
isSigner: account.role === import_kit7.AccountRole.READONLY_SIGNER || account.role === import_kit7.AccountRole.WRITABLE_SIGNER
|
|
14952
15777
|
};
|
|
@@ -14985,7 +15810,7 @@ function resolveExternalWithdraw({
|
|
|
14985
15810
|
};
|
|
14986
15811
|
}
|
|
14987
15812
|
const marginfiClient = new import_marginfi.CpiClient({ accounts: marginfiAccounts });
|
|
14988
|
-
const withdrawRefs = (0,
|
|
15813
|
+
const withdrawRefs = (0, import_common29.createCpiRefs)([
|
|
14989
15814
|
marginfiClient.withdraw_cpi({
|
|
14990
15815
|
marginfiAccount: slot0.userAccount,
|
|
14991
15816
|
authority: vault,
|
|
@@ -15005,14 +15830,14 @@ function buildMarginfiWithdrawInteraction(args) {
|
|
|
15005
15830
|
`No Marginfi market is configured for asset mint ${args.assetMint}`
|
|
15006
15831
|
);
|
|
15007
15832
|
}
|
|
15008
|
-
const vaultAssetAta = (0,
|
|
15833
|
+
const vaultAssetAta = (0, import_common29.getAtaAddress)(
|
|
15009
15834
|
args.assetMint,
|
|
15010
15835
|
args.vault,
|
|
15011
15836
|
marginfiAccounts.tokenProgram,
|
|
15012
15837
|
true
|
|
15013
15838
|
);
|
|
15014
15839
|
const marginfiClient = new import_marginfi.CpiClient({ accounts: marginfiAccounts });
|
|
15015
|
-
const withdraw = (0,
|
|
15840
|
+
const withdraw = (0, import_common29.createCpiRefs)([
|
|
15016
15841
|
marginfiClient.withdraw_cpi({
|
|
15017
15842
|
marginfiAccount: args.marginfiAccount,
|
|
15018
15843
|
authority: args.vault,
|
|
@@ -15036,19 +15861,19 @@ function buildMarginfiWithdrawInteraction(args) {
|
|
|
15036
15861
|
var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
15037
15862
|
getIxAccounts(args) {
|
|
15038
15863
|
return {
|
|
15039
|
-
user: (0,
|
|
15040
|
-
vault: (0,
|
|
15041
|
-
vaultOracle: (0,
|
|
15042
|
-
vaultTrancheState: (0,
|
|
15043
|
-
assetMint: (0,
|
|
15044
|
-
trancheShareMint: (0,
|
|
15045
|
-
userAssetAta: (0,
|
|
15046
|
-
vaultAssetAta: (0,
|
|
15047
|
-
userTrancheShareAta: (0,
|
|
15048
|
-
assetTokenProgram: (0,
|
|
15049
|
-
shareTokenProgram: (0,
|
|
15050
|
-
associatedTokenProgram:
|
|
15051
|
-
systemProgram:
|
|
15864
|
+
user: (0, import_common30.toWeb3Pk)(args.user),
|
|
15865
|
+
vault: (0, import_common30.toWeb3Pk)(args.vault),
|
|
15866
|
+
vaultOracle: (0, import_common30.toWeb3Pk)(args.vaultOracle),
|
|
15867
|
+
vaultTrancheState: (0, import_common30.toWeb3Pk)(args.vaultTrancheState),
|
|
15868
|
+
assetMint: (0, import_common30.toWeb3Pk)(args.assetMint),
|
|
15869
|
+
trancheShareMint: (0, import_common30.toWeb3Pk)(args.trancheShareMint),
|
|
15870
|
+
userAssetAta: (0, import_common30.toWeb3Pk)(args.userAssetAta),
|
|
15871
|
+
vaultAssetAta: (0, import_common30.toWeb3Pk)(args.vaultAssetAta),
|
|
15872
|
+
userTrancheShareAta: (0, import_common30.toWeb3Pk)(args.userTrancheShareAta),
|
|
15873
|
+
assetTokenProgram: (0, import_common30.toWeb3Pk)(args.assetTokenProgram),
|
|
15874
|
+
shareTokenProgram: (0, import_common30.toWeb3Pk)(args.shareTokenProgram),
|
|
15875
|
+
associatedTokenProgram: import_spl_token11.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
15876
|
+
systemProgram: import_web313.SystemProgram.programId
|
|
15052
15877
|
};
|
|
15053
15878
|
}
|
|
15054
15879
|
getIxData(args) {
|
|
@@ -15085,7 +15910,7 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15085
15910
|
);
|
|
15086
15911
|
return methods.accountsPartial(
|
|
15087
15912
|
this.getIxAccounts(args)
|
|
15088
|
-
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(
|
|
15913
|
+
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(import_common30.toKitInstruction);
|
|
15089
15914
|
}
|
|
15090
15915
|
async deriveIxArgs(txArgs) {
|
|
15091
15916
|
const connection = this.program.provider.connection;
|
|
@@ -15106,7 +15931,7 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15106
15931
|
txArgs.assetTokenProgram
|
|
15107
15932
|
);
|
|
15108
15933
|
const { mint: trancheShareMint, tokenProgram: shareTokenProgram } = trancheShare;
|
|
15109
|
-
const vaultAssetAta = (0,
|
|
15934
|
+
const vaultAssetAta = (0, import_common30.getAtaAddress)(
|
|
15110
15935
|
txArgs.assetMint,
|
|
15111
15936
|
txArgs.vault,
|
|
15112
15937
|
assetTokenProgram,
|
|
@@ -15131,17 +15956,17 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15131
15956
|
assetMint: txArgs.assetMint,
|
|
15132
15957
|
trancheShareMint,
|
|
15133
15958
|
kind: txArgs.kind,
|
|
15134
|
-
shareAmount: new
|
|
15959
|
+
shareAmount: new import_core10.BN(txArgs.shareAmount.toString()),
|
|
15135
15960
|
addressSeeds: txArgs.addressSeeds,
|
|
15136
15961
|
assetTokenProgram,
|
|
15137
15962
|
shareTokenProgram,
|
|
15138
|
-
userAssetAta: (0,
|
|
15963
|
+
userAssetAta: (0, import_common30.getAtaAddress)(
|
|
15139
15964
|
txArgs.assetMint,
|
|
15140
15965
|
txArgs.user,
|
|
15141
15966
|
assetTokenProgram
|
|
15142
15967
|
),
|
|
15143
15968
|
vaultAssetAta,
|
|
15144
|
-
userTrancheShareAta: (0,
|
|
15969
|
+
userTrancheShareAta: (0, import_common30.getAtaAddress)(
|
|
15145
15970
|
trancheShareMint,
|
|
15146
15971
|
txArgs.user,
|
|
15147
15972
|
shareTokenProgram
|
|
@@ -15155,16 +15980,16 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15155
15980
|
return txArgs.lookupTables;
|
|
15156
15981
|
}
|
|
15157
15982
|
async buildPreambleInstructions(args) {
|
|
15158
|
-
const payer = (0,
|
|
15159
|
-
const createUserAssetAta = (0,
|
|
15983
|
+
const payer = (0, import_common30.toWeb3Pk)(args.user);
|
|
15984
|
+
const createUserAssetAta = (0, import_spl_token11.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15160
15985
|
payer,
|
|
15161
|
-
(0,
|
|
15986
|
+
(0, import_common30.toWeb3Pk)(args.userAssetAta),
|
|
15162
15987
|
payer,
|
|
15163
|
-
(0,
|
|
15164
|
-
(0,
|
|
15165
|
-
|
|
15988
|
+
(0, import_common30.toWeb3Pk)(args.assetMint),
|
|
15989
|
+
(0, import_common30.toWeb3Pk)(args.assetTokenProgram),
|
|
15990
|
+
import_spl_token11.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15166
15991
|
);
|
|
15167
|
-
return [createUserAssetAta].map(
|
|
15992
|
+
return [createUserAssetAta].map(import_common30.toKitInstruction);
|
|
15168
15993
|
}
|
|
15169
15994
|
async buildPlanExtras(args) {
|
|
15170
15995
|
return {
|
|
@@ -15176,25 +16001,25 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15176
16001
|
};
|
|
15177
16002
|
|
|
15178
16003
|
// src/client/builders/executeWithdraw.ts
|
|
15179
|
-
var
|
|
15180
|
-
var
|
|
15181
|
-
var
|
|
16004
|
+
var import_core11 = require("@anchor-lang/core");
|
|
16005
|
+
var import_spl_token12 = require("@solana/spl-token");
|
|
16006
|
+
var import_common31 = __toESM(require_dist());
|
|
15182
16007
|
var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
15183
16008
|
getIxAccounts(args) {
|
|
15184
16009
|
return {
|
|
15185
|
-
user: (0,
|
|
15186
|
-
vault: (0,
|
|
15187
|
-
vaultOracle: (0,
|
|
15188
|
-
vaultTrancheState: args.vaultTrancheState ? (0,
|
|
15189
|
-
assetMint: (0,
|
|
15190
|
-
shareMint: (0,
|
|
15191
|
-
userAssetAta: (0,
|
|
15192
|
-
vaultAssetAta: (0,
|
|
15193
|
-
feeVault: (0,
|
|
15194
|
-
feeVaultAta: (0,
|
|
15195
|
-
userShareAta: (0,
|
|
15196
|
-
assetTokenProgram: (0,
|
|
15197
|
-
shareTokenProgram: (0,
|
|
16010
|
+
user: (0, import_common31.toWeb3Pk)(args.user),
|
|
16011
|
+
vault: (0, import_common31.toWeb3Pk)(args.vault),
|
|
16012
|
+
vaultOracle: (0, import_common31.toWeb3Pk)(args.vaultOracle),
|
|
16013
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common31.toWeb3Pk)(args.vaultTrancheState) : null,
|
|
16014
|
+
assetMint: (0, import_common31.toWeb3Pk)(args.assetMint),
|
|
16015
|
+
shareMint: (0, import_common31.toWeb3Pk)(args.shareMint),
|
|
16016
|
+
userAssetAta: (0, import_common31.toWeb3Pk)(args.userAssetAta),
|
|
16017
|
+
vaultAssetAta: (0, import_common31.toWeb3Pk)(args.vaultAssetAta),
|
|
16018
|
+
feeVault: (0, import_common31.toWeb3Pk)(args.feeVault),
|
|
16019
|
+
feeVaultAta: (0, import_common31.toWeb3Pk)(args.feeVaultAta),
|
|
16020
|
+
userShareAta: (0, import_common31.toWeb3Pk)(args.userShareAta),
|
|
16021
|
+
assetTokenProgram: (0, import_common31.toWeb3Pk)(args.assetTokenProgram),
|
|
16022
|
+
shareTokenProgram: (0, import_common31.toWeb3Pk)(args.shareTokenProgram)
|
|
15198
16023
|
};
|
|
15199
16024
|
}
|
|
15200
16025
|
getIxData(args) {
|
|
@@ -15224,7 +16049,7 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15224
16049
|
) : this.program.methods.executeWithdraw(data.shareAmount);
|
|
15225
16050
|
return methods.accountsPartial(
|
|
15226
16051
|
this.getIxAccounts(args)
|
|
15227
|
-
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(
|
|
16052
|
+
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(import_common31.toKitInstruction);
|
|
15228
16053
|
}
|
|
15229
16054
|
async deriveIxArgs(txArgs) {
|
|
15230
16055
|
const connection = this.program.provider.connection;
|
|
@@ -15258,7 +16083,7 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15258
16083
|
),
|
|
15259
16084
|
this.account.fetchVault(txArgs.vault)
|
|
15260
16085
|
]);
|
|
15261
|
-
const vaultAssetAta = (0,
|
|
16086
|
+
const vaultAssetAta = (0, import_common31.getAtaAddress)(
|
|
15262
16087
|
txArgs.assetMint,
|
|
15263
16088
|
txArgs.vault,
|
|
15264
16089
|
assetTokenProgram,
|
|
@@ -15282,19 +16107,19 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15282
16107
|
vaultTrancheState: vaultTrancheState ?? null,
|
|
15283
16108
|
assetMint: txArgs.assetMint,
|
|
15284
16109
|
shareMint: txArgs.shareMint,
|
|
15285
|
-
shareAmount: new
|
|
16110
|
+
shareAmount: new import_core11.BN(txArgs.shareAmount.toString()),
|
|
15286
16111
|
assetTokenProgram,
|
|
15287
16112
|
shareTokenProgram,
|
|
15288
|
-
userAssetAta: txArgs.userAssetAta ?? (0,
|
|
16113
|
+
userAssetAta: txArgs.userAssetAta ?? (0, import_common31.getAtaAddress)(txArgs.assetMint, txArgs.user, assetTokenProgram),
|
|
15289
16114
|
vaultAssetAta,
|
|
15290
16115
|
feeVault,
|
|
15291
|
-
feeVaultAta: (0,
|
|
16116
|
+
feeVaultAta: (0, import_common31.getAtaAddress)(
|
|
15292
16117
|
txArgs.assetMint,
|
|
15293
16118
|
feeVault,
|
|
15294
16119
|
assetTokenProgram,
|
|
15295
16120
|
true
|
|
15296
16121
|
),
|
|
15297
|
-
userShareAta: txArgs.userShareAta ?? (0,
|
|
16122
|
+
userShareAta: txArgs.userShareAta ?? (0, import_common31.getAtaAddress)(txArgs.shareMint, txArgs.user, shareTokenProgram),
|
|
15298
16123
|
externalWithdrawIxRefs,
|
|
15299
16124
|
externalLiquiditySource,
|
|
15300
16125
|
externalWithdrawAccounts,
|
|
@@ -15305,31 +16130,31 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15305
16130
|
return txArgs.lookupTables;
|
|
15306
16131
|
}
|
|
15307
16132
|
async buildPreambleInstructions(args) {
|
|
15308
|
-
const defaultUserAssetAta = (0,
|
|
16133
|
+
const defaultUserAssetAta = (0, import_common31.getAtaAddress)(
|
|
15309
16134
|
args.assetMint,
|
|
15310
16135
|
args.user,
|
|
15311
16136
|
args.assetTokenProgram
|
|
15312
16137
|
);
|
|
15313
|
-
const payer = (0,
|
|
15314
|
-
const createUserAssetAta = (0,
|
|
15315
|
-
(0,
|
|
15316
|
-
) ? (0,
|
|
16138
|
+
const payer = (0, import_common31.toWeb3Pk)(args.user);
|
|
16139
|
+
const createUserAssetAta = (0, import_common31.toWeb3Pk)(args.userAssetAta).equals(
|
|
16140
|
+
(0, import_common31.toWeb3Pk)(defaultUserAssetAta)
|
|
16141
|
+
) ? (0, import_spl_token12.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15317
16142
|
payer,
|
|
15318
|
-
(0,
|
|
16143
|
+
(0, import_common31.toWeb3Pk)(args.userAssetAta),
|
|
15319
16144
|
payer,
|
|
15320
|
-
(0,
|
|
15321
|
-
(0,
|
|
15322
|
-
|
|
16145
|
+
(0, import_common31.toWeb3Pk)(args.assetMint),
|
|
16146
|
+
(0, import_common31.toWeb3Pk)(args.assetTokenProgram),
|
|
16147
|
+
import_spl_token12.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15323
16148
|
) : null;
|
|
15324
|
-
const createFeeVaultAta = (0,
|
|
16149
|
+
const createFeeVaultAta = (0, import_spl_token12.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15325
16150
|
payer,
|
|
15326
|
-
(0,
|
|
15327
|
-
(0,
|
|
15328
|
-
(0,
|
|
15329
|
-
(0,
|
|
15330
|
-
|
|
16151
|
+
(0, import_common31.toWeb3Pk)(args.feeVaultAta),
|
|
16152
|
+
(0, import_common31.toWeb3Pk)(args.feeVault),
|
|
16153
|
+
(0, import_common31.toWeb3Pk)(args.assetMint),
|
|
16154
|
+
(0, import_common31.toWeb3Pk)(args.assetTokenProgram),
|
|
16155
|
+
import_spl_token12.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15331
16156
|
);
|
|
15332
|
-
return [createUserAssetAta, createFeeVaultAta].filter((ix) => ix != null).map(
|
|
16157
|
+
return [createUserAssetAta, createFeeVaultAta].filter((ix) => ix != null).map(import_common31.toKitInstruction);
|
|
15333
16158
|
}
|
|
15334
16159
|
async buildPlanExtras(args) {
|
|
15335
16160
|
return {
|
|
@@ -15339,9 +16164,9 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15339
16164
|
};
|
|
15340
16165
|
|
|
15341
16166
|
// src/client/builders/fulfillJuniorTrancheWithdraw.ts
|
|
15342
|
-
var
|
|
15343
|
-
var
|
|
15344
|
-
var
|
|
16167
|
+
var import_spl_token13 = require("@solana/spl-token");
|
|
16168
|
+
var import_web314 = require("@solana/web3.js");
|
|
16169
|
+
var import_common32 = __toESM(require_dist());
|
|
15345
16170
|
var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
15346
16171
|
async getIx(args) {
|
|
15347
16172
|
const externalWithdrawIxRefs = args.externalWithdrawIxRefs ?? null;
|
|
@@ -15355,24 +16180,24 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15355
16180
|
externalLiquiditySource
|
|
15356
16181
|
);
|
|
15357
16182
|
return methods.accountsPartial({
|
|
15358
|
-
signer: (0,
|
|
15359
|
-
owner: (0,
|
|
15360
|
-
queuePayer: (0,
|
|
15361
|
-
vault: (0,
|
|
15362
|
-
vaultOracle: (0,
|
|
15363
|
-
vaultTrancheState: (0,
|
|
15364
|
-
withdrawalQueue: (0,
|
|
15365
|
-
outputMint: (0,
|
|
15366
|
-
inputMint: (0,
|
|
15367
|
-
ownerInputAta: (0,
|
|
15368
|
-
ownerOutputAta: (0,
|
|
15369
|
-
vaultOutputAta: (0,
|
|
15370
|
-
queueInputAta: (0,
|
|
15371
|
-
assetTokenProgram: (0,
|
|
15372
|
-
shareTokenProgram: (0,
|
|
15373
|
-
associatedTokenProgram:
|
|
15374
|
-
systemProgram:
|
|
15375
|
-
}).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(
|
|
16183
|
+
signer: (0, import_common32.toWeb3Pk)(args.signer),
|
|
16184
|
+
owner: (0, import_common32.toWeb3Pk)(args.owner),
|
|
16185
|
+
queuePayer: (0, import_common32.toWeb3Pk)(args.queuePayer),
|
|
16186
|
+
vault: (0, import_common32.toWeb3Pk)(args.vault),
|
|
16187
|
+
vaultOracle: (0, import_common32.toWeb3Pk)(args.vaultOracle),
|
|
16188
|
+
vaultTrancheState: (0, import_common32.toWeb3Pk)(args.vaultTrancheState),
|
|
16189
|
+
withdrawalQueue: (0, import_common32.toWeb3Pk)(args.withdrawalQueue),
|
|
16190
|
+
outputMint: (0, import_common32.toWeb3Pk)(args.outputMint),
|
|
16191
|
+
inputMint: (0, import_common32.toWeb3Pk)(args.inputMint),
|
|
16192
|
+
ownerInputAta: (0, import_common32.toWeb3Pk)(args.ownerInputAta),
|
|
16193
|
+
ownerOutputAta: (0, import_common32.toWeb3Pk)(args.ownerOutputAta),
|
|
16194
|
+
vaultOutputAta: (0, import_common32.toWeb3Pk)(args.vaultOutputAta),
|
|
16195
|
+
queueInputAta: (0, import_common32.toWeb3Pk)(args.queueInputAta),
|
|
16196
|
+
assetTokenProgram: (0, import_common32.toWeb3Pk)(args.assetTokenProgram),
|
|
16197
|
+
shareTokenProgram: (0, import_common32.toWeb3Pk)(args.shareTokenProgram),
|
|
16198
|
+
associatedTokenProgram: import_spl_token13.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16199
|
+
systemProgram: import_web314.SystemProgram.programId
|
|
16200
|
+
}).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(import_common32.toKitInstruction);
|
|
15376
16201
|
}
|
|
15377
16202
|
async deriveIxArgs(txArgs) {
|
|
15378
16203
|
const connection = this.program.provider.connection;
|
|
@@ -15413,7 +16238,7 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15413
16238
|
]);
|
|
15414
16239
|
const { mint: juniorShareMint, tokenProgram: shareTokenProgram } = juniorShare;
|
|
15415
16240
|
const queuePda = txArgs.withdrawalQueue ?? withdrawalQueue;
|
|
15416
|
-
const vaultOutputAta = (0,
|
|
16241
|
+
const vaultOutputAta = (0, import_common32.getAtaAddress)(
|
|
15417
16242
|
txArgs.assetMint,
|
|
15418
16243
|
txArgs.vault,
|
|
15419
16244
|
assetTokenProgram,
|
|
@@ -15442,14 +16267,14 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15442
16267
|
inputMint: juniorShareMint,
|
|
15443
16268
|
assetTokenProgram,
|
|
15444
16269
|
shareTokenProgram,
|
|
15445
|
-
ownerInputAta: txArgs.ownerInputAta ?? (0,
|
|
15446
|
-
ownerOutputAta: (0,
|
|
16270
|
+
ownerInputAta: txArgs.ownerInputAta ?? (0, import_common32.getAtaAddress)(juniorShareMint, txArgs.owner, shareTokenProgram),
|
|
16271
|
+
ownerOutputAta: (0, import_common32.getAtaAddress)(
|
|
15447
16272
|
txArgs.assetMint,
|
|
15448
16273
|
txArgs.owner,
|
|
15449
16274
|
assetTokenProgram
|
|
15450
16275
|
),
|
|
15451
16276
|
vaultOutputAta,
|
|
15452
|
-
queueInputAta: (0,
|
|
16277
|
+
queueInputAta: (0, import_common32.getAtaAddress)(
|
|
15453
16278
|
juniorShareMint,
|
|
15454
16279
|
queuePda,
|
|
15455
16280
|
shareTokenProgram,
|
|
@@ -15465,23 +16290,23 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15465
16290
|
return txArgs.lookupTables;
|
|
15466
16291
|
}
|
|
15467
16292
|
async buildPreambleInstructions(args) {
|
|
15468
|
-
const defaultOwnerInputAta = (0,
|
|
16293
|
+
const defaultOwnerInputAta = (0, import_common32.getAtaAddress)(
|
|
15469
16294
|
args.inputMint,
|
|
15470
16295
|
args.owner,
|
|
15471
16296
|
args.shareTokenProgram
|
|
15472
16297
|
);
|
|
15473
|
-
if (!(0,
|
|
16298
|
+
if (!(0, import_common32.toWeb3Pk)(args.ownerInputAta).equals((0, import_common32.toWeb3Pk)(defaultOwnerInputAta))) {
|
|
15474
16299
|
return [];
|
|
15475
16300
|
}
|
|
15476
16301
|
return [
|
|
15477
|
-
(0,
|
|
15478
|
-
(0,
|
|
15479
|
-
(0,
|
|
15480
|
-
(0,
|
|
15481
|
-
(0,
|
|
15482
|
-
(0,
|
|
15483
|
-
(0,
|
|
15484
|
-
|
|
16302
|
+
(0, import_common32.toKitInstruction)(
|
|
16303
|
+
(0, import_spl_token13.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16304
|
+
(0, import_common32.toWeb3Pk)(args.signer),
|
|
16305
|
+
(0, import_common32.toWeb3Pk)(args.ownerInputAta),
|
|
16306
|
+
(0, import_common32.toWeb3Pk)(args.owner),
|
|
16307
|
+
(0, import_common32.toWeb3Pk)(args.inputMint),
|
|
16308
|
+
(0, import_common32.toWeb3Pk)(args.shareTokenProgram),
|
|
16309
|
+
import_spl_token13.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15485
16310
|
)
|
|
15486
16311
|
)
|
|
15487
16312
|
];
|
|
@@ -15500,8 +16325,8 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15500
16325
|
};
|
|
15501
16326
|
|
|
15502
16327
|
// src/client/builders/updateTrancheConfig.ts
|
|
15503
|
-
var
|
|
15504
|
-
var
|
|
16328
|
+
var import_core12 = require("@anchor-lang/core");
|
|
16329
|
+
var import_common33 = __toESM(require_dist());
|
|
15505
16330
|
var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
15506
16331
|
async getIx(args) {
|
|
15507
16332
|
return this.program.methods.vaultUpdateTrancheConfig({
|
|
@@ -15512,11 +16337,11 @@ var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
|
15512
16337
|
targetLockupDurationSecs: args.targetLockupDurationSecs,
|
|
15513
16338
|
juniorDepositCap: args.juniorDepositCap
|
|
15514
16339
|
}).accountsPartial({
|
|
15515
|
-
curator: (0,
|
|
15516
|
-
vault: (0,
|
|
15517
|
-
vaultTrancheState: (0,
|
|
15518
|
-
vaultOracle: (0,
|
|
15519
|
-
}).instruction().then(
|
|
16340
|
+
curator: (0, import_common33.toWeb3Pk)(args.curator),
|
|
16341
|
+
vault: (0, import_common33.toWeb3Pk)(args.vault),
|
|
16342
|
+
vaultTrancheState: (0, import_common33.toWeb3Pk)(args.vaultTrancheState),
|
|
16343
|
+
vaultOracle: (0, import_common33.toWeb3Pk)(args.vaultOracle)
|
|
16344
|
+
}).instruction().then(import_common33.toKitInstruction);
|
|
15520
16345
|
}
|
|
15521
16346
|
async deriveIxArgs(txArgs) {
|
|
15522
16347
|
const [vaultTrancheState] = await this.pda.deriveVaultTrancheStatePda(
|
|
@@ -15532,8 +16357,8 @@ var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
|
15532
16357
|
juniorFloorApyBps: txArgs.juniorFloorApyBps ?? null,
|
|
15533
16358
|
earlyUnstakeFeeBps: txArgs.earlyUnstakeFeeBps ?? null,
|
|
15534
16359
|
standardUnstakeFeeBps: txArgs.standardUnstakeFeeBps ?? null,
|
|
15535
|
-
targetLockupDurationSecs: txArgs.targetLockupDurationSecs === void 0 ? null : new
|
|
15536
|
-
juniorDepositCap: txArgs.juniorDepositCap === void 0 ? null : new
|
|
16360
|
+
targetLockupDurationSecs: txArgs.targetLockupDurationSecs === void 0 ? null : new import_core12.BN(txArgs.targetLockupDurationSecs.toString()),
|
|
16361
|
+
juniorDepositCap: txArgs.juniorDepositCap === void 0 ? null : new import_core12.BN(txArgs.juniorDepositCap.toString())
|
|
15537
16362
|
};
|
|
15538
16363
|
}
|
|
15539
16364
|
async buildPlanExtras(args) {
|
|
@@ -15546,25 +16371,25 @@ var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
|
15546
16371
|
};
|
|
15547
16372
|
|
|
15548
16373
|
// src/client/builders/managerRedepositAsset.ts
|
|
15549
|
-
var
|
|
15550
|
-
var
|
|
15551
|
-
var
|
|
15552
|
-
var
|
|
16374
|
+
var import_core13 = require("@anchor-lang/core");
|
|
16375
|
+
var import_spl_token14 = require("@solana/spl-token");
|
|
16376
|
+
var import_web315 = require("@solana/web3.js");
|
|
16377
|
+
var import_common34 = __toESM(require_dist());
|
|
15553
16378
|
var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
15554
16379
|
async getIx(args) {
|
|
15555
16380
|
return this.program.methods.managerRedepositAsset({
|
|
15556
16381
|
depositAmount: args.depositAmount,
|
|
15557
16382
|
externalAmount: args.externalAmount
|
|
15558
16383
|
}).accountsPartial({
|
|
15559
|
-
manager: (0,
|
|
15560
|
-
vault: (0,
|
|
15561
|
-
assetMint: (0,
|
|
15562
|
-
vaultAssetAta: (0,
|
|
15563
|
-
managerAssetAta: (0,
|
|
15564
|
-
assetTokenProgram: (0,
|
|
15565
|
-
associatedTokenProgram:
|
|
15566
|
-
systemProgram:
|
|
15567
|
-
}).instruction().then(
|
|
16384
|
+
manager: (0, import_common34.toWeb3Pk)(args.manager),
|
|
16385
|
+
vault: (0, import_common34.toWeb3Pk)(args.vault),
|
|
16386
|
+
assetMint: (0, import_common34.toWeb3Pk)(args.assetMint),
|
|
16387
|
+
vaultAssetAta: (0, import_common34.toWeb3Pk)(args.vaultAssetAta),
|
|
16388
|
+
managerAssetAta: (0, import_common34.toWeb3Pk)(args.managerAssetAta),
|
|
16389
|
+
assetTokenProgram: (0, import_common34.toWeb3Pk)(args.assetTokenProgram),
|
|
16390
|
+
associatedTokenProgram: import_spl_token14.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16391
|
+
systemProgram: import_web315.SystemProgram.programId
|
|
16392
|
+
}).instruction().then(import_common34.toKitInstruction);
|
|
15568
16393
|
}
|
|
15569
16394
|
async deriveIxArgs(txArgs) {
|
|
15570
16395
|
const connection = this.program.provider.connection;
|
|
@@ -15578,10 +16403,10 @@ var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
|
15578
16403
|
manager: txArgs.manager,
|
|
15579
16404
|
vault: txArgs.vault,
|
|
15580
16405
|
assetMint: txArgs.assetMint,
|
|
15581
|
-
depositAmount: new
|
|
15582
|
-
externalAmount: new
|
|
16406
|
+
depositAmount: new import_core13.BN(txArgs.depositAmount.toString()),
|
|
16407
|
+
externalAmount: new import_core13.BN(externalAmount.toString()),
|
|
15583
16408
|
assetTokenProgram,
|
|
15584
|
-
vaultAssetAta: (0,
|
|
16409
|
+
vaultAssetAta: (0, import_common34.getAtaAddress)(
|
|
15585
16410
|
txArgs.assetMint,
|
|
15586
16411
|
txArgs.vault,
|
|
15587
16412
|
assetTokenProgram,
|
|
@@ -15589,7 +16414,7 @@ var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
|
15589
16414
|
),
|
|
15590
16415
|
// The manager may be a PDA (e.g. a Squads vault), so allow off-curve
|
|
15591
16416
|
// owners when deriving its ATA.
|
|
15592
|
-
managerAssetAta: (0,
|
|
16417
|
+
managerAssetAta: (0, import_common34.getAtaAddress)(
|
|
15593
16418
|
txArgs.assetMint,
|
|
15594
16419
|
txArgs.manager,
|
|
15595
16420
|
assetTokenProgram,
|
|
@@ -15605,23 +16430,23 @@ var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
|
15605
16430
|
};
|
|
15606
16431
|
|
|
15607
16432
|
// src/client/builders/managerWithdrawAsset.ts
|
|
15608
|
-
var
|
|
15609
|
-
var
|
|
15610
|
-
var
|
|
15611
|
-
var
|
|
16433
|
+
var import_core14 = require("@anchor-lang/core");
|
|
16434
|
+
var import_spl_token15 = require("@solana/spl-token");
|
|
16435
|
+
var import_web316 = require("@solana/web3.js");
|
|
16436
|
+
var import_common35 = __toESM(require_dist());
|
|
15612
16437
|
var ManagerWithdrawAssetBuilder = class extends VaultBuilderBase {
|
|
15613
16438
|
async getIx(args) {
|
|
15614
16439
|
return this.program.methods.managerWithdrawAsset(args.amount).accountsPartial({
|
|
15615
|
-
manager: (0,
|
|
15616
|
-
vault: (0,
|
|
15617
|
-
assetMint: (0,
|
|
15618
|
-
vaultAssetAta: (0,
|
|
15619
|
-
destination: (0,
|
|
15620
|
-
destinationAssetAta: (0,
|
|
15621
|
-
assetTokenProgram: (0,
|
|
15622
|
-
associatedTokenProgram:
|
|
15623
|
-
systemProgram:
|
|
15624
|
-
}).instruction().then(
|
|
16440
|
+
manager: (0, import_common35.toWeb3Pk)(args.manager),
|
|
16441
|
+
vault: (0, import_common35.toWeb3Pk)(args.vault),
|
|
16442
|
+
assetMint: (0, import_common35.toWeb3Pk)(args.assetMint),
|
|
16443
|
+
vaultAssetAta: (0, import_common35.toWeb3Pk)(args.vaultAssetAta),
|
|
16444
|
+
destination: (0, import_common35.toWeb3Pk)(args.destination),
|
|
16445
|
+
destinationAssetAta: (0, import_common35.toWeb3Pk)(args.destinationAssetAta),
|
|
16446
|
+
assetTokenProgram: (0, import_common35.toWeb3Pk)(args.assetTokenProgram),
|
|
16447
|
+
associatedTokenProgram: import_spl_token15.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16448
|
+
systemProgram: import_web316.SystemProgram.programId
|
|
16449
|
+
}).instruction().then(import_common35.toKitInstruction);
|
|
15625
16450
|
}
|
|
15626
16451
|
async deriveIxArgs(txArgs) {
|
|
15627
16452
|
const connection = this.program.provider.connection;
|
|
@@ -15636,18 +16461,20 @@ var ManagerWithdrawAssetBuilder = class extends VaultBuilderBase {
|
|
|
15636
16461
|
vault: txArgs.vault,
|
|
15637
16462
|
assetMint: txArgs.assetMint,
|
|
15638
16463
|
destination,
|
|
15639
|
-
amount: new
|
|
16464
|
+
amount: new import_core14.BN(txArgs.amount.toString()),
|
|
15640
16465
|
assetTokenProgram,
|
|
15641
|
-
vaultAssetAta: (0,
|
|
16466
|
+
vaultAssetAta: (0, import_common35.getAtaAddress)(
|
|
15642
16467
|
txArgs.assetMint,
|
|
15643
16468
|
txArgs.vault,
|
|
15644
16469
|
assetTokenProgram,
|
|
15645
16470
|
true
|
|
15646
16471
|
),
|
|
15647
|
-
destinationAssetAta: (0,
|
|
16472
|
+
destinationAssetAta: (0, import_common35.getAtaAddress)(
|
|
15648
16473
|
txArgs.assetMint,
|
|
15649
16474
|
destination,
|
|
15650
|
-
assetTokenProgram
|
|
16475
|
+
assetTokenProgram,
|
|
16476
|
+
// Whitelisted destinations may be PDAs, including Squads vaults.
|
|
16477
|
+
true
|
|
15651
16478
|
)
|
|
15652
16479
|
};
|
|
15653
16480
|
}
|
|
@@ -15659,18 +16486,18 @@ var ManagerWithdrawAssetBuilder = class extends VaultBuilderBase {
|
|
|
15659
16486
|
};
|
|
15660
16487
|
|
|
15661
16488
|
// src/client/builders/protocolInteraction.ts
|
|
15662
|
-
var
|
|
16489
|
+
var import_core15 = require("@anchor-lang/core");
|
|
15663
16490
|
var import_kit8 = require("@solana/kit");
|
|
15664
|
-
var
|
|
15665
|
-
var
|
|
15666
|
-
var
|
|
16491
|
+
var import_spl_token16 = require("@solana/spl-token");
|
|
16492
|
+
var import_web317 = require("@solana/web3.js");
|
|
16493
|
+
var import_common36 = __toESM(require_dist());
|
|
15667
16494
|
var DEFAULT_PYTH_PRICE_MAX_AGE_SECS = 90n;
|
|
15668
16495
|
function toAssetPriceOracleConfig(args) {
|
|
15669
16496
|
return {
|
|
15670
16497
|
priceOracleType: args?.priceOracleType ?? { none: {} },
|
|
15671
|
-
initialPrice: new
|
|
16498
|
+
initialPrice: new import_core15.BN((args?.initialPrice ?? 0n).toString()),
|
|
15672
16499
|
priceOracleAccount: args?.priceOracleAccount ?? DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
15673
|
-
pythMaxAgeSecs: new
|
|
16500
|
+
pythMaxAgeSecs: new import_core15.BN(
|
|
15674
16501
|
(args?.pythMaxAgeSecs ?? DEFAULT_PYTH_PRICE_MAX_AGE_SECS).toString()
|
|
15675
16502
|
)
|
|
15676
16503
|
};
|
|
@@ -15678,12 +16505,12 @@ function toAssetPriceOracleConfig(args) {
|
|
|
15678
16505
|
function toAnchorAssetPriceOracleConfig(config) {
|
|
15679
16506
|
return {
|
|
15680
16507
|
...config,
|
|
15681
|
-
priceOracleAccount: (0,
|
|
16508
|
+
priceOracleAccount: (0, import_common36.toWeb3Pk)(config.priceOracleAccount)
|
|
15682
16509
|
};
|
|
15683
16510
|
}
|
|
15684
16511
|
function toWeb3AccountMeta2(account) {
|
|
15685
16512
|
return {
|
|
15686
|
-
pubkey: new
|
|
16513
|
+
pubkey: new import_web317.PublicKey(account.address),
|
|
15687
16514
|
isWritable: account.role === import_kit8.AccountRole.WRITABLE || account.role === import_kit8.AccountRole.WRITABLE_SIGNER,
|
|
15688
16515
|
isSigner: account.role === import_kit8.AccountRole.READONLY_SIGNER || account.role === import_kit8.AccountRole.WRITABLE_SIGNER
|
|
15689
16516
|
};
|
|
@@ -15692,14 +16519,14 @@ var ProtocolInteractionBuilder = class extends VaultBuilderBase {
|
|
|
15692
16519
|
async getIx(args) {
|
|
15693
16520
|
return this.program.methods.protocolInteraction(args.refs, {
|
|
15694
16521
|
externalLiquidityIndex: args.externalLiquidityIndex,
|
|
15695
|
-
affectedAssetMint: args.affectedAssetMint ? (0,
|
|
16522
|
+
affectedAssetMint: args.affectedAssetMint ? (0, import_common36.toWeb3Pk)(args.affectedAssetMint) : null
|
|
15696
16523
|
}).accountsPartial({
|
|
15697
|
-
hwManager: (0,
|
|
15698
|
-
vault: (0,
|
|
15699
|
-
affectedAssetMint: args.affectedAssetMint ? (0,
|
|
15700
|
-
affectedVaultAta: args.affectedVaultAta ? (0,
|
|
15701
|
-
affectedTokenProgram: args.affectedTokenProgram ? (0,
|
|
15702
|
-
}).remainingAccounts(args.accounts.map(toWeb3AccountMeta2)).instruction().then(
|
|
16524
|
+
hwManager: (0, import_common36.toWeb3Pk)(args.hwManager),
|
|
16525
|
+
vault: (0, import_common36.toWeb3Pk)(args.vault),
|
|
16526
|
+
affectedAssetMint: args.affectedAssetMint ? (0, import_common36.toWeb3Pk)(args.affectedAssetMint) : null,
|
|
16527
|
+
affectedVaultAta: args.affectedVaultAta ? (0, import_common36.toWeb3Pk)(args.affectedVaultAta) : null,
|
|
16528
|
+
affectedTokenProgram: args.affectedTokenProgram ? (0, import_common36.toWeb3Pk)(args.affectedTokenProgram) : null
|
|
16529
|
+
}).remainingAccounts(args.accounts.map(toWeb3AccountMeta2)).instruction().then(import_common36.toKitInstruction);
|
|
15703
16530
|
}
|
|
15704
16531
|
async deriveIxArgs(txArgs) {
|
|
15705
16532
|
const affectedTokenProgram = txArgs.affectedAssetMint ? txArgs.affectedTokenProgram ?? TOKEN_PROGRAM_ID : null;
|
|
@@ -15711,7 +16538,7 @@ var ProtocolInteractionBuilder = class extends VaultBuilderBase {
|
|
|
15711
16538
|
accounts: txArgs.accounts,
|
|
15712
16539
|
affectedAssetMint: txArgs.affectedAssetMint ?? null,
|
|
15713
16540
|
affectedTokenProgram,
|
|
15714
|
-
affectedVaultAta: txArgs.affectedAssetMint && affectedTokenProgram ? (0,
|
|
16541
|
+
affectedVaultAta: txArgs.affectedAssetMint && affectedTokenProgram ? (0, import_common36.getAtaAddress)(
|
|
15715
16542
|
txArgs.affectedAssetMint,
|
|
15716
16543
|
txArgs.vault,
|
|
15717
16544
|
affectedTokenProgram,
|
|
@@ -15730,18 +16557,18 @@ var JupiterSwapBuilder = class extends VaultBuilderBase {
|
|
|
15730
16557
|
args.destinationPriceOracle
|
|
15731
16558
|
)
|
|
15732
16559
|
}).accountsPartial({
|
|
15733
|
-
hwManager: (0,
|
|
15734
|
-
vault: (0,
|
|
15735
|
-
sourceMint: (0,
|
|
15736
|
-
destinationMint: (0,
|
|
15737
|
-
vaultSourceAta: (0,
|
|
15738
|
-
vaultDestinationAta: (0,
|
|
15739
|
-
sourceTokenProgram: (0,
|
|
15740
|
-
destinationTokenProgram: (0,
|
|
15741
|
-
destinationOracleAccount: args.destinationOracleAccount ? (0,
|
|
15742
|
-
vaultOracle: (0,
|
|
15743
|
-
vaultTrancheState: args.vaultTrancheState ? (0,
|
|
15744
|
-
}).remainingAccounts(args.accounts.map(toWeb3AccountMeta2)).instruction().then(
|
|
16560
|
+
hwManager: (0, import_common36.toWeb3Pk)(args.hwManager),
|
|
16561
|
+
vault: (0, import_common36.toWeb3Pk)(args.vault),
|
|
16562
|
+
sourceMint: (0, import_common36.toWeb3Pk)(args.sourceMint),
|
|
16563
|
+
destinationMint: (0, import_common36.toWeb3Pk)(args.destinationMint),
|
|
16564
|
+
vaultSourceAta: (0, import_common36.toWeb3Pk)(args.vaultSourceAta),
|
|
16565
|
+
vaultDestinationAta: (0, import_common36.toWeb3Pk)(args.vaultDestinationAta),
|
|
16566
|
+
sourceTokenProgram: (0, import_common36.toWeb3Pk)(args.sourceTokenProgram),
|
|
16567
|
+
destinationTokenProgram: (0, import_common36.toWeb3Pk)(args.destinationTokenProgram),
|
|
16568
|
+
destinationOracleAccount: args.destinationOracleAccount ? (0, import_common36.toWeb3Pk)(args.destinationOracleAccount) : null,
|
|
16569
|
+
vaultOracle: (0, import_common36.toWeb3Pk)(args.vaultOracle),
|
|
16570
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common36.toWeb3Pk)(args.vaultTrancheState) : null
|
|
16571
|
+
}).remainingAccounts(args.accounts.map(toWeb3AccountMeta2)).instruction().then(import_common36.toKitInstruction);
|
|
15745
16572
|
}
|
|
15746
16573
|
async deriveIxArgs(txArgs) {
|
|
15747
16574
|
const sourceTokenProgram = txArgs.sourceTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
@@ -15762,13 +16589,13 @@ var JupiterSwapBuilder = class extends VaultBuilderBase {
|
|
|
15762
16589
|
accounts: txArgs.accounts,
|
|
15763
16590
|
sourceTokenProgram,
|
|
15764
16591
|
destinationTokenProgram,
|
|
15765
|
-
vaultSourceAta: (0,
|
|
16592
|
+
vaultSourceAta: (0, import_common36.getAtaAddress)(
|
|
15766
16593
|
txArgs.sourceMint,
|
|
15767
16594
|
txArgs.vault,
|
|
15768
16595
|
sourceTokenProgram,
|
|
15769
16596
|
true
|
|
15770
16597
|
),
|
|
15771
|
-
vaultDestinationAta: (0,
|
|
16598
|
+
vaultDestinationAta: (0, import_common36.getAtaAddress)(
|
|
15772
16599
|
txArgs.destinationMint,
|
|
15773
16600
|
txArgs.vault,
|
|
15774
16601
|
destinationTokenProgram,
|
|
@@ -15777,24 +16604,24 @@ var JupiterSwapBuilder = class extends VaultBuilderBase {
|
|
|
15777
16604
|
};
|
|
15778
16605
|
}
|
|
15779
16606
|
async buildPreambleInstructions(args) {
|
|
15780
|
-
const payer = (0,
|
|
15781
|
-
const createSourceAta = (0,
|
|
16607
|
+
const payer = (0, import_common36.toWeb3Pk)(args.hwManager);
|
|
16608
|
+
const createSourceAta = (0, import_spl_token16.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15782
16609
|
payer,
|
|
15783
|
-
(0,
|
|
15784
|
-
(0,
|
|
15785
|
-
(0,
|
|
15786
|
-
(0,
|
|
15787
|
-
|
|
16610
|
+
(0, import_common36.toWeb3Pk)(args.vaultSourceAta),
|
|
16611
|
+
(0, import_common36.toWeb3Pk)(args.vault),
|
|
16612
|
+
(0, import_common36.toWeb3Pk)(args.sourceMint),
|
|
16613
|
+
(0, import_common36.toWeb3Pk)(args.sourceTokenProgram),
|
|
16614
|
+
import_spl_token16.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15788
16615
|
);
|
|
15789
|
-
const createDestinationAta = (0,
|
|
16616
|
+
const createDestinationAta = (0, import_spl_token16.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15790
16617
|
payer,
|
|
15791
|
-
(0,
|
|
15792
|
-
(0,
|
|
15793
|
-
(0,
|
|
15794
|
-
(0,
|
|
15795
|
-
|
|
16618
|
+
(0, import_common36.toWeb3Pk)(args.vaultDestinationAta),
|
|
16619
|
+
(0, import_common36.toWeb3Pk)(args.vault),
|
|
16620
|
+
(0, import_common36.toWeb3Pk)(args.destinationMint),
|
|
16621
|
+
(0, import_common36.toWeb3Pk)(args.destinationTokenProgram),
|
|
16622
|
+
import_spl_token16.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15796
16623
|
);
|
|
15797
|
-
return [createSourceAta, createDestinationAta].map(
|
|
16624
|
+
return [createSourceAta, createDestinationAta].map(import_common36.toKitInstruction);
|
|
15798
16625
|
}
|
|
15799
16626
|
async buildLookupTables(_args, txArgs) {
|
|
15800
16627
|
return txArgs.lookupTables;
|
|
@@ -15827,27 +16654,27 @@ var JupiterSwapBuilder = class extends VaultBuilderBase {
|
|
|
15827
16654
|
};
|
|
15828
16655
|
|
|
15829
16656
|
// src/client/builders/requestJuniorTrancheWithdraw.ts
|
|
15830
|
-
var
|
|
15831
|
-
var
|
|
15832
|
-
var
|
|
15833
|
-
var
|
|
16657
|
+
var import_core16 = require("@anchor-lang/core");
|
|
16658
|
+
var import_spl_token17 = require("@solana/spl-token");
|
|
16659
|
+
var import_web318 = require("@solana/web3.js");
|
|
16660
|
+
var import_common37 = __toESM(require_dist());
|
|
15834
16661
|
var RequestJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
15835
16662
|
async getIx(args) {
|
|
15836
16663
|
return this.program.methods.requestJuniorTrancheWithdraw(args.queueId, args.shareAmount).accountsPartial({
|
|
15837
|
-
user: (0,
|
|
15838
|
-
payer: (0,
|
|
15839
|
-
vault: (0,
|
|
15840
|
-
vaultOracle: (0,
|
|
15841
|
-
vaultTrancheState: (0,
|
|
15842
|
-
withdrawalQueue: (0,
|
|
15843
|
-
outputMint: (0,
|
|
15844
|
-
inputMint: (0,
|
|
15845
|
-
userInputAta: (0,
|
|
15846
|
-
queueInputAta: (0,
|
|
15847
|
-
shareTokenProgram: (0,
|
|
15848
|
-
associatedTokenProgram:
|
|
15849
|
-
systemProgram:
|
|
15850
|
-
}).instruction().then(
|
|
16664
|
+
user: (0, import_common37.toWeb3Pk)(args.user),
|
|
16665
|
+
payer: (0, import_common37.toWeb3Pk)(args.payer),
|
|
16666
|
+
vault: (0, import_common37.toWeb3Pk)(args.vault),
|
|
16667
|
+
vaultOracle: (0, import_common37.toWeb3Pk)(args.vaultOracle),
|
|
16668
|
+
vaultTrancheState: (0, import_common37.toWeb3Pk)(args.vaultTrancheState),
|
|
16669
|
+
withdrawalQueue: (0, import_common37.toWeb3Pk)(args.withdrawalQueue),
|
|
16670
|
+
outputMint: (0, import_common37.toWeb3Pk)(args.outputMint),
|
|
16671
|
+
inputMint: (0, import_common37.toWeb3Pk)(args.inputMint),
|
|
16672
|
+
userInputAta: (0, import_common37.toWeb3Pk)(args.userInputAta),
|
|
16673
|
+
queueInputAta: (0, import_common37.toWeb3Pk)(args.queueInputAta),
|
|
16674
|
+
shareTokenProgram: (0, import_common37.toWeb3Pk)(args.shareTokenProgram),
|
|
16675
|
+
associatedTokenProgram: import_spl_token17.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16676
|
+
systemProgram: import_web318.SystemProgram.programId
|
|
16677
|
+
}).instruction().then(import_common37.toKitInstruction);
|
|
15851
16678
|
}
|
|
15852
16679
|
async deriveIxArgs(txArgs) {
|
|
15853
16680
|
const payer = txArgs.payer ?? txArgs.user;
|
|
@@ -15881,10 +16708,10 @@ var RequestJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15881
16708
|
outputMint: txArgs.assetMint,
|
|
15882
16709
|
inputMint: juniorShareMint,
|
|
15883
16710
|
queueId: txArgs.queueId,
|
|
15884
|
-
shareAmount: new
|
|
16711
|
+
shareAmount: new import_core16.BN(txArgs.shareAmount.toString()),
|
|
15885
16712
|
shareTokenProgram,
|
|
15886
|
-
userInputAta: txArgs.userInputAta ?? (0,
|
|
15887
|
-
queueInputAta: (0,
|
|
16713
|
+
userInputAta: txArgs.userInputAta ?? (0, import_common37.getAtaAddress)(juniorShareMint, txArgs.user, shareTokenProgram),
|
|
16714
|
+
queueInputAta: (0, import_common37.getAtaAddress)(
|
|
15888
16715
|
juniorShareMint,
|
|
15889
16716
|
queuePda,
|
|
15890
16717
|
shareTokenProgram,
|
|
@@ -15906,17 +16733,17 @@ var RequestJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
15906
16733
|
};
|
|
15907
16734
|
|
|
15908
16735
|
// src/client/builders/vaultReallocation.ts
|
|
15909
|
-
var
|
|
15910
|
-
var
|
|
15911
|
-
var
|
|
15912
|
-
var
|
|
16736
|
+
var import_core17 = require("@anchor-lang/core");
|
|
16737
|
+
var import_spl_token18 = require("@solana/spl-token");
|
|
16738
|
+
var import_web319 = require("@solana/web3.js");
|
|
16739
|
+
var import_common38 = __toESM(require_dist());
|
|
15913
16740
|
var DEFAULT_PYTH_PRICE_MAX_AGE_SECS2 = 90n;
|
|
15914
16741
|
function toAssetPriceOracleConfig2(args) {
|
|
15915
16742
|
return {
|
|
15916
16743
|
priceOracleType: args?.priceOracleType ?? { none: {} },
|
|
15917
|
-
initialPrice: new
|
|
16744
|
+
initialPrice: new import_core17.BN((args?.initialPrice ?? 0n).toString()),
|
|
15918
16745
|
priceOracleAccount: args?.priceOracleAccount ?? DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
15919
|
-
pythMaxAgeSecs: new
|
|
16746
|
+
pythMaxAgeSecs: new import_core17.BN(
|
|
15920
16747
|
(args?.pythMaxAgeSecs ?? DEFAULT_PYTH_PRICE_MAX_AGE_SECS2).toString()
|
|
15921
16748
|
)
|
|
15922
16749
|
};
|
|
@@ -15924,7 +16751,7 @@ function toAssetPriceOracleConfig2(args) {
|
|
|
15924
16751
|
function toAnchorAssetPriceOracleConfig2(config) {
|
|
15925
16752
|
return {
|
|
15926
16753
|
...config,
|
|
15927
|
-
priceOracleAccount: (0,
|
|
16754
|
+
priceOracleAccount: (0, import_common38.toWeb3Pk)(config.priceOracleAccount)
|
|
15928
16755
|
};
|
|
15929
16756
|
}
|
|
15930
16757
|
var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
@@ -15933,35 +16760,35 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
15933
16760
|
amount: args.amount,
|
|
15934
16761
|
assetPriceOracle: toAnchorAssetPriceOracleConfig2(args.assetPriceOracle)
|
|
15935
16762
|
}).accountsPartial({
|
|
15936
|
-
manager: (0,
|
|
15937
|
-
allocationVault: (0,
|
|
15938
|
-
sourceVault: args.sourceVault ? (0,
|
|
15939
|
-
sourceVaultOracle: args.sourceVaultOracle ? (0,
|
|
15940
|
-
destinationVault: (0,
|
|
15941
|
-
destinationVaultOracle: (0,
|
|
15942
|
-
mint: (0,
|
|
15943
|
-
sourceShareMint: args.sourceShareMint ? (0,
|
|
15944
|
-
destinationShareMint: (0,
|
|
15945
|
-
allocationMintAta: (0,
|
|
15946
|
-
sourceVaultMintAta: args.sourceVaultMintAta ? (0,
|
|
15947
|
-
destinationVaultMintAta: (0,
|
|
15948
|
-
destinationFeeVault: (0,
|
|
15949
|
-
destinationFeeVaultMintAta: (0,
|
|
15950
|
-
allocationSourceShareAta: args.allocationSourceShareAta ? (0,
|
|
15951
|
-
allocationDestinationShareAta: (0,
|
|
16763
|
+
manager: (0, import_common38.toWeb3Pk)(args.manager),
|
|
16764
|
+
allocationVault: (0, import_common38.toWeb3Pk)(args.allocationVault),
|
|
16765
|
+
sourceVault: args.sourceVault ? (0, import_common38.toWeb3Pk)(args.sourceVault) : null,
|
|
16766
|
+
sourceVaultOracle: args.sourceVaultOracle ? (0, import_common38.toWeb3Pk)(args.sourceVaultOracle) : null,
|
|
16767
|
+
destinationVault: (0, import_common38.toWeb3Pk)(args.destinationVault),
|
|
16768
|
+
destinationVaultOracle: (0, import_common38.toWeb3Pk)(args.destinationVaultOracle),
|
|
16769
|
+
mint: (0, import_common38.toWeb3Pk)(args.mint),
|
|
16770
|
+
sourceShareMint: args.sourceShareMint ? (0, import_common38.toWeb3Pk)(args.sourceShareMint) : null,
|
|
16771
|
+
destinationShareMint: (0, import_common38.toWeb3Pk)(args.destinationShareMint),
|
|
16772
|
+
allocationMintAta: (0, import_common38.toWeb3Pk)(args.allocationMintAta),
|
|
16773
|
+
sourceVaultMintAta: args.sourceVaultMintAta ? (0, import_common38.toWeb3Pk)(args.sourceVaultMintAta) : null,
|
|
16774
|
+
destinationVaultMintAta: (0, import_common38.toWeb3Pk)(args.destinationVaultMintAta),
|
|
16775
|
+
destinationFeeVault: (0, import_common38.toWeb3Pk)(args.destinationFeeVault),
|
|
16776
|
+
destinationFeeVaultMintAta: (0, import_common38.toWeb3Pk)(args.destinationFeeVaultMintAta),
|
|
16777
|
+
allocationSourceShareAta: args.allocationSourceShareAta ? (0, import_common38.toWeb3Pk)(args.allocationSourceShareAta) : null,
|
|
16778
|
+
allocationDestinationShareAta: (0, import_common38.toWeb3Pk)(
|
|
15952
16779
|
args.allocationDestinationShareAta
|
|
15953
16780
|
),
|
|
15954
|
-
sourceVaultTrancheState: args.sourceVaultTrancheState ? (0,
|
|
15955
|
-
destinationVaultTrancheState: args.destinationVaultTrancheState ? (0,
|
|
15956
|
-
assetOracleAccount: args.assetOracleAccount ? (0,
|
|
15957
|
-
assetTokenProgram: (0,
|
|
15958
|
-
sourceShareTokenProgram: (0,
|
|
15959
|
-
destinationShareTokenProgram: (0,
|
|
16781
|
+
sourceVaultTrancheState: args.sourceVaultTrancheState ? (0, import_common38.toWeb3Pk)(args.sourceVaultTrancheState) : null,
|
|
16782
|
+
destinationVaultTrancheState: args.destinationVaultTrancheState ? (0, import_common38.toWeb3Pk)(args.destinationVaultTrancheState) : null,
|
|
16783
|
+
assetOracleAccount: args.assetOracleAccount ? (0, import_common38.toWeb3Pk)(args.assetOracleAccount) : null,
|
|
16784
|
+
assetTokenProgram: (0, import_common38.toWeb3Pk)(args.assetTokenProgram),
|
|
16785
|
+
sourceShareTokenProgram: (0, import_common38.toWeb3Pk)(args.sourceShareTokenProgram),
|
|
16786
|
+
destinationShareTokenProgram: (0, import_common38.toWeb3Pk)(
|
|
15960
16787
|
args.destinationShareTokenProgram
|
|
15961
16788
|
),
|
|
15962
|
-
associatedTokenProgram:
|
|
15963
|
-
systemProgram:
|
|
15964
|
-
}).instruction().then(
|
|
16789
|
+
associatedTokenProgram: import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16790
|
+
systemProgram: import_web319.SystemProgram.programId
|
|
16791
|
+
}).instruction().then(import_common38.toKitInstruction);
|
|
15965
16792
|
}
|
|
15966
16793
|
async deriveIxArgs(txArgs) {
|
|
15967
16794
|
const assetTokenProgram = txArgs.assetTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
@@ -15986,7 +16813,7 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
15986
16813
|
mint: txArgs.mint,
|
|
15987
16814
|
sourceShareMint,
|
|
15988
16815
|
destinationShareMint: txArgs.destinationShareMint,
|
|
15989
|
-
amount: new
|
|
16816
|
+
amount: new import_core17.BN(txArgs.amount.toString()),
|
|
15990
16817
|
assetPriceOracle: toAssetPriceOracleConfig2(txArgs.assetPriceOracle),
|
|
15991
16818
|
sourceVaultTrancheState: txArgs.sourceVaultTrancheState ?? null,
|
|
15992
16819
|
destinationVaultTrancheState: txArgs.destinationVaultTrancheState ?? null,
|
|
@@ -15994,33 +16821,33 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
15994
16821
|
assetTokenProgram,
|
|
15995
16822
|
sourceShareTokenProgram,
|
|
15996
16823
|
destinationShareTokenProgram,
|
|
15997
|
-
allocationMintAta: (0,
|
|
16824
|
+
allocationMintAta: (0, import_common38.getAtaAddress)(
|
|
15998
16825
|
txArgs.mint,
|
|
15999
16826
|
txArgs.allocationVault,
|
|
16000
16827
|
assetTokenProgram,
|
|
16001
16828
|
true
|
|
16002
16829
|
),
|
|
16003
|
-
sourceVaultMintAta: sourceVault ? (0,
|
|
16004
|
-
destinationVaultMintAta: (0,
|
|
16830
|
+
sourceVaultMintAta: sourceVault ? (0, import_common38.getAtaAddress)(txArgs.mint, sourceVault, assetTokenProgram, true) : null,
|
|
16831
|
+
destinationVaultMintAta: (0, import_common38.getAtaAddress)(
|
|
16005
16832
|
txArgs.mint,
|
|
16006
16833
|
txArgs.destinationVault,
|
|
16007
16834
|
assetTokenProgram,
|
|
16008
16835
|
true
|
|
16009
16836
|
),
|
|
16010
16837
|
destinationFeeVault,
|
|
16011
|
-
destinationFeeVaultMintAta: (0,
|
|
16838
|
+
destinationFeeVaultMintAta: (0, import_common38.getAtaAddress)(
|
|
16012
16839
|
txArgs.mint,
|
|
16013
16840
|
destinationFeeVault,
|
|
16014
16841
|
assetTokenProgram,
|
|
16015
16842
|
true
|
|
16016
16843
|
),
|
|
16017
|
-
allocationSourceShareAta: sourceShareMint && sourceVault ? (0,
|
|
16844
|
+
allocationSourceShareAta: sourceShareMint && sourceVault ? (0, import_common38.getAtaAddress)(
|
|
16018
16845
|
sourceShareMint,
|
|
16019
16846
|
txArgs.allocationVault,
|
|
16020
16847
|
sourceShareTokenProgram,
|
|
16021
16848
|
true
|
|
16022
16849
|
) : null,
|
|
16023
|
-
allocationDestinationShareAta: (0,
|
|
16850
|
+
allocationDestinationShareAta: (0, import_common38.getAtaAddress)(
|
|
16024
16851
|
txArgs.destinationShareMint,
|
|
16025
16852
|
txArgs.allocationVault,
|
|
16026
16853
|
destinationShareTokenProgram,
|
|
@@ -16029,62 +16856,62 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
16029
16856
|
};
|
|
16030
16857
|
}
|
|
16031
16858
|
async buildPreambleInstructions(args) {
|
|
16032
|
-
const payer = (0,
|
|
16859
|
+
const payer = (0, import_common38.toWeb3Pk)(args.manager);
|
|
16033
16860
|
const instructions2 = [
|
|
16034
|
-
(0,
|
|
16861
|
+
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16035
16862
|
payer,
|
|
16036
|
-
(0,
|
|
16037
|
-
(0,
|
|
16038
|
-
(0,
|
|
16039
|
-
(0,
|
|
16040
|
-
|
|
16863
|
+
(0, import_common38.toWeb3Pk)(args.allocationMintAta),
|
|
16864
|
+
(0, import_common38.toWeb3Pk)(args.allocationVault),
|
|
16865
|
+
(0, import_common38.toWeb3Pk)(args.mint),
|
|
16866
|
+
(0, import_common38.toWeb3Pk)(args.assetTokenProgram),
|
|
16867
|
+
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16041
16868
|
),
|
|
16042
|
-
(0,
|
|
16869
|
+
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16043
16870
|
payer,
|
|
16044
|
-
(0,
|
|
16045
|
-
(0,
|
|
16046
|
-
(0,
|
|
16047
|
-
(0,
|
|
16048
|
-
|
|
16871
|
+
(0, import_common38.toWeb3Pk)(args.destinationVaultMintAta),
|
|
16872
|
+
(0, import_common38.toWeb3Pk)(args.destinationVault),
|
|
16873
|
+
(0, import_common38.toWeb3Pk)(args.mint),
|
|
16874
|
+
(0, import_common38.toWeb3Pk)(args.assetTokenProgram),
|
|
16875
|
+
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16049
16876
|
),
|
|
16050
|
-
(0,
|
|
16877
|
+
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16051
16878
|
payer,
|
|
16052
|
-
(0,
|
|
16053
|
-
(0,
|
|
16054
|
-
(0,
|
|
16055
|
-
(0,
|
|
16056
|
-
|
|
16879
|
+
(0, import_common38.toWeb3Pk)(args.destinationFeeVaultMintAta),
|
|
16880
|
+
(0, import_common38.toWeb3Pk)(args.destinationFeeVault),
|
|
16881
|
+
(0, import_common38.toWeb3Pk)(args.mint),
|
|
16882
|
+
(0, import_common38.toWeb3Pk)(args.assetTokenProgram),
|
|
16883
|
+
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16057
16884
|
),
|
|
16058
|
-
(0,
|
|
16885
|
+
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16059
16886
|
payer,
|
|
16060
|
-
(0,
|
|
16061
|
-
(0,
|
|
16062
|
-
(0,
|
|
16063
|
-
(0,
|
|
16064
|
-
|
|
16887
|
+
(0, import_common38.toWeb3Pk)(args.allocationDestinationShareAta),
|
|
16888
|
+
(0, import_common38.toWeb3Pk)(args.allocationVault),
|
|
16889
|
+
(0, import_common38.toWeb3Pk)(args.destinationShareMint),
|
|
16890
|
+
(0, import_common38.toWeb3Pk)(args.destinationShareTokenProgram),
|
|
16891
|
+
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16065
16892
|
)
|
|
16066
16893
|
];
|
|
16067
16894
|
if (args.sourceVault && args.sourceShareMint && args.sourceVaultMintAta && args.allocationSourceShareAta) {
|
|
16068
16895
|
instructions2.push(
|
|
16069
|
-
(0,
|
|
16896
|
+
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16070
16897
|
payer,
|
|
16071
|
-
(0,
|
|
16072
|
-
(0,
|
|
16073
|
-
(0,
|
|
16074
|
-
(0,
|
|
16075
|
-
|
|
16898
|
+
(0, import_common38.toWeb3Pk)(args.sourceVaultMintAta),
|
|
16899
|
+
(0, import_common38.toWeb3Pk)(args.sourceVault),
|
|
16900
|
+
(0, import_common38.toWeb3Pk)(args.mint),
|
|
16901
|
+
(0, import_common38.toWeb3Pk)(args.assetTokenProgram),
|
|
16902
|
+
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16076
16903
|
),
|
|
16077
|
-
(0,
|
|
16904
|
+
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16078
16905
|
payer,
|
|
16079
|
-
(0,
|
|
16080
|
-
(0,
|
|
16081
|
-
(0,
|
|
16082
|
-
(0,
|
|
16083
|
-
|
|
16906
|
+
(0, import_common38.toWeb3Pk)(args.allocationSourceShareAta),
|
|
16907
|
+
(0, import_common38.toWeb3Pk)(args.allocationVault),
|
|
16908
|
+
(0, import_common38.toWeb3Pk)(args.sourceShareMint),
|
|
16909
|
+
(0, import_common38.toWeb3Pk)(args.sourceShareTokenProgram),
|
|
16910
|
+
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16084
16911
|
)
|
|
16085
16912
|
);
|
|
16086
16913
|
}
|
|
16087
|
-
return instructions2.map(
|
|
16914
|
+
return instructions2.map(import_common38.toKitInstruction);
|
|
16088
16915
|
}
|
|
16089
16916
|
async buildPlanExtras(args) {
|
|
16090
16917
|
return {
|
|
@@ -16122,6 +16949,12 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
16122
16949
|
// src/client/transaction.ts
|
|
16123
16950
|
var TransactionClient = class {
|
|
16124
16951
|
constructor(context) {
|
|
16952
|
+
this.createIncentive = new CreateIncentiveBuilder(context);
|
|
16953
|
+
this.addIncentiveRecipient = new AddIncentiveRecipientBuilder(context);
|
|
16954
|
+
this.setIncentiveLimits = new SetIncentiveLimitsBuilder(context);
|
|
16955
|
+
this.submitIncentive = new SubmitIncentiveBuilder(context);
|
|
16956
|
+
this.cancelIncentiveProposal = new CancelIncentiveProposalBuilder(context);
|
|
16957
|
+
this.distributeIncentive = new DistributeIncentiveBuilder(context);
|
|
16125
16958
|
this.createVault = new CreateVaultBuilder(context);
|
|
16126
16959
|
this.initializeVaultRoles = new InitializeVaultRolesBuilder(context);
|
|
16127
16960
|
this.createAssetHolding = new CreateAssetHoldingBuilder(context);
|
|
@@ -16167,7 +17000,7 @@ var VaultClient = class {
|
|
|
16167
17000
|
constructor(provider, programId = VAULT_PROGRAM_ID) {
|
|
16168
17001
|
this.provider = provider;
|
|
16169
17002
|
const idl = { ...IDL, address: programId };
|
|
16170
|
-
this.program = new
|
|
17003
|
+
this.program = new import_core18.Program(idl, provider);
|
|
16171
17004
|
this.pda = new PdaClient((0, import_kit9.address)(this.program.programId.toBase58()));
|
|
16172
17005
|
const rpc = createRpcFromConnection(provider.connection);
|
|
16173
17006
|
this.account = new AccountClient(this.program, this.pda, rpc);
|
|
@@ -16189,8 +17022,8 @@ var VaultClient = class {
|
|
|
16189
17022
|
*/
|
|
16190
17023
|
async sendTransaction(payer, plan, extraSigners = []) {
|
|
16191
17024
|
const { blockhash, lastValidBlockHeight } = await this.provider.connection.getLatestBlockhash("confirmed");
|
|
16192
|
-
const tx = new
|
|
16193
|
-
...plan.instructions.map(
|
|
17025
|
+
const tx = new import_web320.Transaction().add(
|
|
17026
|
+
...plan.instructions.map(import_common39.fromKitInstruction)
|
|
16194
17027
|
);
|
|
16195
17028
|
tx.feePayer = payer.publicKey;
|
|
16196
17029
|
tx.recentBlockhash = blockhash;
|
|
@@ -16217,13 +17050,13 @@ var VaultClient = class {
|
|
|
16217
17050
|
const { blockhash } = await this.provider.connection.getLatestBlockhash(
|
|
16218
17051
|
"confirmed"
|
|
16219
17052
|
);
|
|
16220
|
-
const lookupTableAccounts = plan.lookupTables?.length ? await (0,
|
|
16221
|
-
const message2 = new
|
|
17053
|
+
const lookupTableAccounts = plan.lookupTables?.length ? await (0, import_common39.fetchLookupTables)(this.provider.connection, plan.lookupTables) : [];
|
|
17054
|
+
const message2 = new import_web320.TransactionMessage({
|
|
16222
17055
|
payerKey: payer.publicKey,
|
|
16223
17056
|
recentBlockhash: blockhash,
|
|
16224
|
-
instructions: plan.instructions.map(
|
|
17057
|
+
instructions: plan.instructions.map(import_common39.fromKitInstruction)
|
|
16225
17058
|
}).compileToV0Message(lookupTableAccounts);
|
|
16226
|
-
const tx = new
|
|
17059
|
+
const tx = new import_web320.VersionedTransaction(message2);
|
|
16227
17060
|
const result = await this.provider.connection.simulateTransaction(tx, {
|
|
16228
17061
|
sigVerify: false,
|
|
16229
17062
|
commitment: "processed"
|
|
@@ -16297,7 +17130,7 @@ function resolveKeypairPath(keypairPath) {
|
|
|
16297
17130
|
}
|
|
16298
17131
|
function loadKeypair(keypairPath) {
|
|
16299
17132
|
const raw = import_fs.default.readFileSync(resolveKeypairPath(keypairPath), "utf-8");
|
|
16300
|
-
return
|
|
17133
|
+
return import_web321.Keypair.fromSecretKey(new Uint8Array(JSON.parse(raw)));
|
|
16301
17134
|
}
|
|
16302
17135
|
var ENV_AGNOSTIC_ROLES = /* @__PURE__ */ new Set(["fulfiller", "rebalancer"]);
|
|
16303
17136
|
function defaultKeypairPath(env, role = "vault") {
|
|
@@ -16308,8 +17141,8 @@ function defaultKeypairPath(env, role = "vault") {
|
|
|
16308
17141
|
}
|
|
16309
17142
|
function createVaultClient(env, opts = {}) {
|
|
16310
17143
|
const payer = opts.keypair ?? loadKeypair(opts.keypairPath ?? defaultKeypairPath(env, opts.role));
|
|
16311
|
-
const connection = new
|
|
16312
|
-
const provider = new
|
|
17144
|
+
const connection = new import_web321.Connection(opts.rpcUrl ?? getRpcUrl(env), "confirmed");
|
|
17145
|
+
const provider = new import_core19.AnchorProvider(connection, new import_core19.Wallet(payer), {
|
|
16313
17146
|
commitment: "confirmed"
|
|
16314
17147
|
});
|
|
16315
17148
|
const client = new VaultClient(
|
|
@@ -16321,11 +17154,11 @@ function createVaultClient(env, opts = {}) {
|
|
|
16321
17154
|
client,
|
|
16322
17155
|
provider,
|
|
16323
17156
|
payer,
|
|
16324
|
-
signer: (0,
|
|
17157
|
+
signer: (0, import_common40.fromWeb3Pk)(payer.publicKey)
|
|
16325
17158
|
};
|
|
16326
17159
|
}
|
|
16327
17160
|
function keypairAddress(keypairPath) {
|
|
16328
|
-
return (0,
|
|
17161
|
+
return (0, import_common40.fromWeb3Pk)(loadKeypair(keypairPath).publicKey);
|
|
16329
17162
|
}
|
|
16330
17163
|
|
|
16331
17164
|
// src/utils/math.ts
|
|
@@ -16339,16 +17172,16 @@ function fromUiAmount(amount, decimals) {
|
|
|
16339
17172
|
}
|
|
16340
17173
|
|
|
16341
17174
|
// src/utils/provider.ts
|
|
16342
|
-
var
|
|
17175
|
+
var import_core20 = require("@anchor-lang/core");
|
|
16343
17176
|
function makeProvider(connection, payer) {
|
|
16344
|
-
return new
|
|
17177
|
+
return new import_core20.AnchorProvider(connection, new import_core20.Wallet(payer), {
|
|
16345
17178
|
commitment: "confirmed"
|
|
16346
17179
|
});
|
|
16347
17180
|
}
|
|
16348
17181
|
|
|
16349
17182
|
// src/utils/squads.ts
|
|
16350
17183
|
var squads = __toESM(require("@sqds/multisig"));
|
|
16351
|
-
var
|
|
17184
|
+
var import_web322 = require("@solana/web3.js");
|
|
16352
17185
|
var SQUADS_SIMULATION_COMMITMENT = "processed";
|
|
16353
17186
|
var SquadsProposalExecutionSimulationError = class extends Error {
|
|
16354
17187
|
constructor(transactionError, logs, unitsConsumed) {
|
|
@@ -16372,8 +17205,8 @@ function validateVaultIndex(vaultIndex) {
|
|
|
16372
17205
|
}
|
|
16373
17206
|
function resolveSquadsWalletRoute(route) {
|
|
16374
17207
|
validateVaultIndex(route.vaultIndex);
|
|
16375
|
-
const wallet = new
|
|
16376
|
-
const multisigPda = new
|
|
17208
|
+
const wallet = new import_web322.PublicKey(route.wallet);
|
|
17209
|
+
const multisigPda = new import_web322.PublicKey(route.multisigPda);
|
|
16377
17210
|
const [vaultPda] = squads.getVaultPda({
|
|
16378
17211
|
multisigPda,
|
|
16379
17212
|
index: route.vaultIndex
|
|
@@ -16381,7 +17214,7 @@ function resolveSquadsWalletRoute(route) {
|
|
|
16381
17214
|
return { ...route, wallet, multisigPda, vaultPda };
|
|
16382
17215
|
}
|
|
16383
17216
|
function findSquadsWalletRoute(wallet, routes) {
|
|
16384
|
-
const walletKey = typeof wallet === "string" ? new
|
|
17217
|
+
const walletKey = typeof wallet === "string" ? new import_web322.PublicKey(wallet) : wallet;
|
|
16385
17218
|
const route = routes.find(
|
|
16386
17219
|
(candidate) => candidate.wallet === walletKey.toBase58()
|
|
16387
17220
|
);
|
|
@@ -16399,18 +17232,18 @@ function validateSquadsWalletRoutes(routes) {
|
|
|
16399
17232
|
}
|
|
16400
17233
|
}
|
|
16401
17234
|
function vaultAuthorityForWallet(wallet, routes) {
|
|
16402
|
-
const walletKey = typeof wallet === "string" ? new
|
|
17235
|
+
const walletKey = typeof wallet === "string" ? new import_web322.PublicKey(wallet) : wallet;
|
|
16403
17236
|
return findSquadsWalletRoute(walletKey, routes)?.vaultPda ?? walletKey;
|
|
16404
17237
|
}
|
|
16405
17238
|
async function simulateSquadsProposalExecution(args) {
|
|
16406
17239
|
const { connection, feePayer, instructions: instructions2 } = args;
|
|
16407
17240
|
const recentBlockhash = args.recentBlockhash ?? (await connection.getLatestBlockhash(SQUADS_SIMULATION_COMMITMENT)).blockhash;
|
|
16408
|
-
const message2 = new
|
|
17241
|
+
const message2 = new import_web322.TransactionMessage({
|
|
16409
17242
|
payerKey: feePayer,
|
|
16410
17243
|
recentBlockhash,
|
|
16411
17244
|
instructions: [...instructions2]
|
|
16412
17245
|
}).compileToV0Message();
|
|
16413
|
-
const transaction = new
|
|
17246
|
+
const transaction = new import_web322.VersionedTransaction(message2);
|
|
16414
17247
|
const { value } = await connection.simulateTransaction(transaction, {
|
|
16415
17248
|
sigVerify: false,
|
|
16416
17249
|
commitment: SQUADS_SIMULATION_COMMITMENT,
|
|
@@ -16431,7 +17264,7 @@ async function prepareVaultTransaction(args) {
|
|
|
16431
17264
|
if (!route) {
|
|
16432
17265
|
return {
|
|
16433
17266
|
kind: "direct",
|
|
16434
|
-
transaction: new
|
|
17267
|
+
transaction: new import_web322.Transaction().add(...instructions2),
|
|
16435
17268
|
authority: proposer
|
|
16436
17269
|
};
|
|
16437
17270
|
}
|
|
@@ -16457,13 +17290,15 @@ async function prepareVaultTransaction(args) {
|
|
|
16457
17290
|
}
|
|
16458
17291
|
const transactionIndex = BigInt(multisig.transactionIndex.toString()) + 1n;
|
|
16459
17292
|
const { blockhash } = await connection.getLatestBlockhash("confirmed");
|
|
16460
|
-
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
|
|
17293
|
+
if (!args.skipSimulation) {
|
|
17294
|
+
await simulateSquadsProposalExecution({
|
|
17295
|
+
connection,
|
|
17296
|
+
feePayer: proposer,
|
|
17297
|
+
instructions: instructions2,
|
|
17298
|
+
recentBlockhash: blockhash
|
|
17299
|
+
});
|
|
17300
|
+
}
|
|
17301
|
+
const transactionMessage = new import_web322.TransactionMessage({
|
|
16467
17302
|
payerKey: route.vaultPda,
|
|
16468
17303
|
recentBlockhash: blockhash,
|
|
16469
17304
|
instructions: [...instructions2]
|
|
@@ -16492,7 +17327,7 @@ async function prepareVaultTransaction(args) {
|
|
|
16492
17327
|
});
|
|
16493
17328
|
return {
|
|
16494
17329
|
kind: "squads",
|
|
16495
|
-
transaction: new
|
|
17330
|
+
transaction: new import_web322.Transaction().add(
|
|
16496
17331
|
createVaultTransactionIx,
|
|
16497
17332
|
createProposalIx
|
|
16498
17333
|
),
|
|
@@ -16506,21 +17341,21 @@ async function prepareVaultTransaction(args) {
|
|
|
16506
17341
|
}
|
|
16507
17342
|
|
|
16508
17343
|
// src/utils/token.ts
|
|
16509
|
-
var
|
|
16510
|
-
var
|
|
16511
|
-
var
|
|
16512
|
-
async function createTokenMintIxs(connection, payer, authority, decimals, tokenProgram =
|
|
16513
|
-
const mint =
|
|
16514
|
-
const lamports = await (0,
|
|
17344
|
+
var import_spl_token19 = require("@solana/spl-token");
|
|
17345
|
+
var import_web323 = require("@solana/web3.js");
|
|
17346
|
+
var import_common41 = __toESM(require_dist());
|
|
17347
|
+
async function createTokenMintIxs(connection, payer, authority, decimals, tokenProgram = import_spl_token19.TOKEN_2022_PROGRAM_ID) {
|
|
17348
|
+
const mint = import_web323.Keypair.generate();
|
|
17349
|
+
const lamports = await (0, import_spl_token19.getMinimumBalanceForRentExemptMint)(connection);
|
|
16515
17350
|
const ixs = [
|
|
16516
|
-
|
|
17351
|
+
import_web323.SystemProgram.createAccount({
|
|
16517
17352
|
fromPubkey: payer,
|
|
16518
17353
|
newAccountPubkey: mint.publicKey,
|
|
16519
|
-
space:
|
|
17354
|
+
space: import_spl_token19.MINT_SIZE,
|
|
16520
17355
|
lamports,
|
|
16521
17356
|
programId: tokenProgram
|
|
16522
17357
|
}),
|
|
16523
|
-
(0,
|
|
17358
|
+
(0, import_spl_token19.createInitializeMint2Instruction)(
|
|
16524
17359
|
mint.publicKey,
|
|
16525
17360
|
decimals,
|
|
16526
17361
|
authority,
|
|
@@ -16530,7 +17365,7 @@ async function createTokenMintIxs(connection, payer, authority, decimals, tokenP
|
|
|
16530
17365
|
];
|
|
16531
17366
|
return { mint, ixs };
|
|
16532
17367
|
}
|
|
16533
|
-
async function createTokenMint(connection, payer, decimals, tokenProgram =
|
|
17368
|
+
async function createTokenMint(connection, payer, decimals, tokenProgram = import_spl_token19.TOKEN_2022_PROGRAM_ID) {
|
|
16534
17369
|
const { mint, ixs } = await createTokenMintIxs(
|
|
16535
17370
|
connection,
|
|
16536
17371
|
payer.publicKey,
|
|
@@ -16539,7 +17374,7 @@ async function createTokenMint(connection, payer, decimals, tokenProgram = impor
|
|
|
16539
17374
|
tokenProgram
|
|
16540
17375
|
);
|
|
16541
17376
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
16542
|
-
const tx = new
|
|
17377
|
+
const tx = new import_web323.Transaction().add(...ixs);
|
|
16543
17378
|
tx.feePayer = payer.publicKey;
|
|
16544
17379
|
tx.recentBlockhash = blockhash;
|
|
16545
17380
|
tx.sign(payer, mint);
|
|
@@ -16552,24 +17387,24 @@ async function createTokenMint(connection, payer, decimals, tokenProgram = impor
|
|
|
16552
17387
|
);
|
|
16553
17388
|
return mint.publicKey;
|
|
16554
17389
|
}
|
|
16555
|
-
async function mintTokensTo(connection, payer, mint, destination, amount, tokenProgram =
|
|
16556
|
-
const tokenProgramPk = (0,
|
|
16557
|
-
const ata = (0,
|
|
17390
|
+
async function mintTokensTo(connection, payer, mint, destination, amount, tokenProgram = import_spl_token19.TOKEN_2022_PROGRAM_ID, allowOwnerOffCurve = true) {
|
|
17391
|
+
const tokenProgramPk = (0, import_common41.asWeb3PublicKey)(tokenProgram);
|
|
17392
|
+
const ata = (0, import_spl_token19.getAssociatedTokenAddressSync)(
|
|
16558
17393
|
mint,
|
|
16559
17394
|
destination,
|
|
16560
17395
|
allowOwnerOffCurve,
|
|
16561
17396
|
tokenProgramPk
|
|
16562
17397
|
);
|
|
16563
17398
|
const ixs = [
|
|
16564
|
-
(0,
|
|
17399
|
+
(0, import_spl_token19.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16565
17400
|
payer.publicKey,
|
|
16566
17401
|
ata,
|
|
16567
17402
|
destination,
|
|
16568
17403
|
mint,
|
|
16569
17404
|
tokenProgramPk,
|
|
16570
|
-
|
|
17405
|
+
import_spl_token19.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16571
17406
|
),
|
|
16572
|
-
(0,
|
|
17407
|
+
(0, import_spl_token19.createMintToInstruction)(
|
|
16573
17408
|
mint,
|
|
16574
17409
|
ata,
|
|
16575
17410
|
payer.publicKey,
|
|
@@ -16578,12 +17413,12 @@ async function mintTokensTo(connection, payer, mint, destination, amount, tokenP
|
|
|
16578
17413
|
tokenProgramPk
|
|
16579
17414
|
)
|
|
16580
17415
|
];
|
|
16581
|
-
const tx = new
|
|
17416
|
+
const tx = new import_web323.Transaction().add(...ixs);
|
|
16582
17417
|
await connection.sendTransaction(tx, [payer]);
|
|
16583
17418
|
}
|
|
16584
17419
|
|
|
16585
17420
|
// src/utils/yieldApi.ts
|
|
16586
|
-
var
|
|
17421
|
+
var import_core21 = require("@anchor-lang/core");
|
|
16587
17422
|
var YIELD_API_BASE = process.env.YIELD_API_BASE ?? "https://yield-tracker.perena.org";
|
|
16588
17423
|
async function yieldApiReq(endpoint, reqType, bodyData, options) {
|
|
16589
17424
|
const headers = {
|
|
@@ -16909,7 +17744,7 @@ async function getTrackedValue(accountName) {
|
|
|
16909
17744
|
return trackedValueFromResponse(await getYield(accountName));
|
|
16910
17745
|
}
|
|
16911
17746
|
async function getTotalYield(accountNames, start, end) {
|
|
16912
|
-
let totalYield = new
|
|
17747
|
+
let totalYield = new import_core21.BN(0);
|
|
16913
17748
|
for (const accountName of accountNames) {
|
|
16914
17749
|
const res = await getYield(accountName, start, end);
|
|
16915
17750
|
if (isNavAccountValue(res)) {
|
|
@@ -16918,7 +17753,7 @@ async function getTotalYield(accountNames, start, end) {
|
|
|
16918
17753
|
);
|
|
16919
17754
|
}
|
|
16920
17755
|
console.log(res);
|
|
16921
|
-
totalYield = totalYield.add(new
|
|
17756
|
+
totalYield = totalYield.add(new import_core21.BN(res.total_yield));
|
|
16922
17757
|
}
|
|
16923
17758
|
return totalYield;
|
|
16924
17759
|
}
|
|
@@ -16950,7 +17785,7 @@ async function getTotalTrackedValue(accountNames, start, end) {
|
|
|
16950
17785
|
}
|
|
16951
17786
|
|
|
16952
17787
|
// src/services/withdrawalQueueService.ts
|
|
16953
|
-
var
|
|
17788
|
+
var import_common42 = __toESM(require_dist());
|
|
16954
17789
|
function bnToBigInt(value) {
|
|
16955
17790
|
return BigInt(value.toString());
|
|
16956
17791
|
}
|
|
@@ -16971,7 +17806,7 @@ var WithdrawalQueueService = class {
|
|
|
16971
17806
|
const program = this.client.program.account;
|
|
16972
17807
|
const accounts2 = await program.vaultWithdrawalQueue.all();
|
|
16973
17808
|
return accounts2.map(
|
|
16974
|
-
(entry) => this.toSnapshot((0,
|
|
17809
|
+
(entry) => this.toSnapshot((0, import_common42.fromWeb3Pk)(entry.publicKey), entry.account)
|
|
16975
17810
|
);
|
|
16976
17811
|
}
|
|
16977
17812
|
/** Withdrawal queues for a single vault. */
|
|
@@ -17012,7 +17847,7 @@ var WithdrawalQueueService = class {
|
|
|
17012
17847
|
async fulfill(signer, queue) {
|
|
17013
17848
|
const plan = await this.client.tx.fulfillJuniorTrancheWithdraw.getTx({
|
|
17014
17849
|
owner: queue.owner,
|
|
17015
|
-
signer: (0,
|
|
17850
|
+
signer: (0, import_common42.fromWeb3Pk)(signer.publicKey),
|
|
17016
17851
|
queuePayer: queue.payer,
|
|
17017
17852
|
vault: queue.vault,
|
|
17018
17853
|
withdrawalQueue: queue.pda,
|
|
@@ -17066,12 +17901,12 @@ var WithdrawalQueueService = class {
|
|
|
17066
17901
|
const a = account;
|
|
17067
17902
|
return {
|
|
17068
17903
|
pda,
|
|
17069
|
-
vault: (0,
|
|
17070
|
-
owner: (0,
|
|
17071
|
-
payer: (0,
|
|
17904
|
+
vault: (0, import_common42.fromWeb3Pk)(a.parties.vault),
|
|
17905
|
+
owner: (0, import_common42.fromWeb3Pk)(a.parties.owner),
|
|
17906
|
+
payer: (0, import_common42.fromWeb3Pk)(a.parties.payer),
|
|
17072
17907
|
queueId: a.header.queueId,
|
|
17073
|
-
inputMint: (0,
|
|
17074
|
-
outputMint: (0,
|
|
17908
|
+
inputMint: (0, import_common42.fromWeb3Pk)(a.mints.inputMint),
|
|
17909
|
+
outputMint: (0, import_common42.fromWeb3Pk)(a.mints.outputMint),
|
|
17075
17910
|
inputAmount: bnToBigInt(a.request.inputAmount),
|
|
17076
17911
|
requestTs: bnToNumber(a.request.requestTs),
|
|
17077
17912
|
expiryTs: bnToNumber(a.request.expiryTs)
|
|
@@ -17081,7 +17916,7 @@ var WithdrawalQueueService = class {
|
|
|
17081
17916
|
|
|
17082
17917
|
// src/services/oracleService.ts
|
|
17083
17918
|
var import_kit11 = require("@solana/kit");
|
|
17084
|
-
var
|
|
17919
|
+
var import_common43 = __toESM(require_dist());
|
|
17085
17920
|
var SYSTEM_PROGRAM = "11111111111111111111111111111111";
|
|
17086
17921
|
var DEFAULT_PRICE_STALENESS_THRESHOLD_SECS2 = 86400n;
|
|
17087
17922
|
var PRICE_ORACLE_TYPES_BY_INDEX = [
|
|
@@ -17145,7 +17980,7 @@ var OracleService = class {
|
|
|
17145
17980
|
*/
|
|
17146
17981
|
async updateAssetConsensusPrice(signer, args, log) {
|
|
17147
17982
|
const plan = await this.client.tx.updateConsensusOracle.getTx({
|
|
17148
|
-
signer: (0,
|
|
17983
|
+
signer: (0, import_common43.fromWeb3Pk)(signer.publicKey),
|
|
17149
17984
|
vault: args.vault,
|
|
17150
17985
|
updates: args.updates,
|
|
17151
17986
|
assetMint: args.assetMint,
|
|
@@ -17161,7 +17996,7 @@ var OracleService = class {
|
|
|
17161
17996
|
/** Settle the vault NAV from its current holdings (permissionless). */
|
|
17162
17997
|
async crankNav(cranker, args, log) {
|
|
17163
17998
|
const plan = await this.client.tx.crankNav.getTx({
|
|
17164
|
-
cranker: (0,
|
|
17999
|
+
cranker: (0, import_common43.fromWeb3Pk)(cranker.publicKey),
|
|
17165
18000
|
vault: args.vault,
|
|
17166
18001
|
vaultTrancheState: args.vaultTrancheState
|
|
17167
18002
|
});
|
|
@@ -17234,7 +18069,7 @@ var OracleService = class {
|
|
|
17234
18069
|
/** Re-price one live-oracle holding from its bound Pyth/nested-vault account. */
|
|
17235
18070
|
async refreshAssetPrice(updater, args, log) {
|
|
17236
18071
|
const plan = await this.client.tx.updateAssetPrice.getTx({
|
|
17237
|
-
updater: (0,
|
|
18072
|
+
updater: (0, import_common43.fromWeb3Pk)(updater.publicKey),
|
|
17238
18073
|
vault: args.vault,
|
|
17239
18074
|
mint: args.mint,
|
|
17240
18075
|
oracleAccount: args.oracleAccount,
|
|
@@ -17316,13 +18151,13 @@ function readSplMintSupply(data) {
|
|
|
17316
18151
|
return supply;
|
|
17317
18152
|
}
|
|
17318
18153
|
function signerInOracleData(data, signerBytes) {
|
|
17319
|
-
const
|
|
18154
|
+
const ZERO_PUBKEY2 = new Uint8Array(32);
|
|
17320
18155
|
for (let i = 0; i < MAX_CONSENSUS_SIGNERS; i++) {
|
|
17321
18156
|
const off = ORACLE_ENTRIES_OFFSET + i * ORACLE_ENTRY_SIZE;
|
|
17322
18157
|
const slice = data.slice(off, off + 32);
|
|
17323
18158
|
if (slice.length < 32) break;
|
|
17324
18159
|
const bytes = new Uint8Array(slice);
|
|
17325
|
-
if (bytes.every((b) => b === 0) ||
|
|
18160
|
+
if (bytes.every((b) => b === 0) || ZERO_PUBKEY2.every((_, j) => bytes[j] === ZERO_PUBKEY2[j]))
|
|
17326
18161
|
continue;
|
|
17327
18162
|
if (signerBytes.every((b, j) => b === bytes[j])) return true;
|
|
17328
18163
|
}
|
|
@@ -17355,11 +18190,11 @@ function toBigInt2(value) {
|
|
|
17355
18190
|
}
|
|
17356
18191
|
|
|
17357
18192
|
// src/services/consensusOracle/utils/holdings.ts
|
|
17358
|
-
var
|
|
17359
|
-
var
|
|
18193
|
+
var import_web324 = require("@solana/web3.js");
|
|
18194
|
+
var import_common44 = __toESM(require_dist());
|
|
17360
18195
|
function selectReportableHoldings(holdings, excludedMints = /* @__PURE__ */ new Set()) {
|
|
17361
18196
|
return holdings.map((holding, holdingIndex) => ({ holding, holdingIndex })).filter(({ holding }) => {
|
|
17362
|
-
const mint = (0,
|
|
18197
|
+
const mint = (0, import_common44.fromWeb3Pk)(holding.mint);
|
|
17363
18198
|
return mint !== SYSTEM_PROGRAM2 && !excludedMints.has(mint.toString()) && REPORTABLE_ORACLE_VARIANTS.has(
|
|
17364
18199
|
variantName2(holding.priceOracleType).toLowerCase()
|
|
17365
18200
|
);
|
|
@@ -17394,7 +18229,7 @@ function parseExternalLiquidityRefs(vaultState) {
|
|
|
17394
18229
|
if (!data || data.length < 40) continue;
|
|
17395
18230
|
if (data[0] !== 1) continue;
|
|
17396
18231
|
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
17397
|
-
const userAccount = new
|
|
18232
|
+
const userAccount = new import_web324.PublicKey(pubkeyBytes).toBase58();
|
|
17398
18233
|
refs.push({
|
|
17399
18234
|
kind: "marginfi",
|
|
17400
18235
|
mint: "",
|
|
@@ -17624,12 +18459,12 @@ function formatBpsAsPercent(bps) {
|
|
|
17624
18459
|
}
|
|
17625
18460
|
|
|
17626
18461
|
// src/services/consensusOracle/pipeline/dryRunSettlement.ts
|
|
17627
|
-
var
|
|
17628
|
-
var
|
|
18462
|
+
var import_web326 = require("@solana/web3.js");
|
|
18463
|
+
var import_common45 = __toESM(require_dist());
|
|
17629
18464
|
|
|
17630
18465
|
// src/services/consensusOracle/settlement/settlementSimulator.ts
|
|
17631
18466
|
var import_kit12 = require("@solana/kit");
|
|
17632
|
-
var
|
|
18467
|
+
var import_web325 = require("@solana/web3.js");
|
|
17633
18468
|
var DEFAULT_SHARE_PRICE = 1000000n;
|
|
17634
18469
|
var BPS_DENOMINATOR3 = 10000n;
|
|
17635
18470
|
var NAV_LOSS_TOLERANCE_BPS = 25n;
|
|
@@ -17659,7 +18494,8 @@ function simulateConsensusOracleSettlement(args) {
|
|
|
17659
18494
|
vaultAccounting.pendingProtocolFeeShares
|
|
17660
18495
|
);
|
|
17661
18496
|
const cachedSupply = bigint(vaultAccounting.totalMintSupply);
|
|
17662
|
-
const
|
|
18497
|
+
const pendingIncentiveShares = bigint(vaultAccounting.pendingIncentiveShares);
|
|
18498
|
+
const reconciledSupply = args.physicalShareSupply === void 0 ? cachedSupply : args.physicalShareSupply + pendingCuratorShares + pendingProtocolShares + pendingIncentiveShares;
|
|
17663
18499
|
if (args.physicalShareSupply === void 0) {
|
|
17664
18500
|
warnings.push(
|
|
17665
18501
|
"regular share-mint supply was unavailable; using cached effective supply"
|
|
@@ -17840,7 +18676,7 @@ function applyConsensus(holdings, entries, nowTs, stalenessThresholdSecs) {
|
|
|
17840
18676
|
continue;
|
|
17841
18677
|
}
|
|
17842
18678
|
const reports = entries.filter(
|
|
17843
|
-
(entry) => entry.signer !==
|
|
18679
|
+
(entry) => entry.signer !== import_web325.PublicKey.default.toBase58() && isFresh(entry.lastUpdateTs, nowTs, stalenessThresholdSecs) && (entry.prices[index] ?? 0n) > 0n
|
|
17844
18680
|
);
|
|
17845
18681
|
const usesConsensusPrice = holding.priceOracleType === "consensusoracle";
|
|
17846
18682
|
const prices = reports.map((entry) => entry.prices[index] ?? 0n);
|
|
@@ -17904,28 +18740,23 @@ function settleVault(args) {
|
|
|
17904
18740
|
}
|
|
17905
18741
|
const priorTs = args.priorSettledNavTs > 0n ? args.priorSettledNavTs : max(args.accountingLastUpdateTs, args.apyAnchorTs);
|
|
17906
18742
|
const nextApyValue = args.tranche ? args.grossNav : sharePriceForValue(args.grossNav, args.totalSupply);
|
|
17907
|
-
if (nextApyValue !== void 0) {
|
|
17908
|
-
validateRealizedApy(
|
|
17909
|
-
args.tranche ? physicalNavBefore : args.currentSharePrice,
|
|
17910
|
-
priorTs,
|
|
17911
|
-
nextApyValue,
|
|
17912
|
-
args.nowTs,
|
|
17913
|
-
args.maxApyBps
|
|
17914
|
-
);
|
|
17915
|
-
}
|
|
17916
18743
|
let regularValue;
|
|
17917
18744
|
let regularSharePrice = args.currentSharePrice;
|
|
18745
|
+
let regularHwmSharePrice = args.hwmSharePrice;
|
|
17918
18746
|
let curatorFee = 0n;
|
|
17919
18747
|
let protocolFee = 0n;
|
|
17920
18748
|
let settledAccountingNav;
|
|
17921
18749
|
if (args.tranche) {
|
|
18750
|
+
const trancheValueBefore = args.tranche.junior.value + args.tranche.senior.value;
|
|
17922
18751
|
const regularGrossValue = settleTrancheNav(
|
|
17923
18752
|
args.tranche,
|
|
17924
18753
|
physicalNavBefore,
|
|
17925
18754
|
args.grossNav,
|
|
17926
18755
|
args.nowTs
|
|
17927
18756
|
);
|
|
18757
|
+
const regularGrossValueBefore = physicalNavBefore - trancheValueBefore;
|
|
17928
18758
|
const trancheValueBeforeFees = args.tranche.junior.value + args.tranche.senior.value;
|
|
18759
|
+
const availableRegularGain = regularGrossValue > regularGrossValueBefore ? regularGrossValue - regularGrossValueBefore : 0n;
|
|
17929
18760
|
const juniorFees = settleShareClassPerformanceFee(
|
|
17930
18761
|
args.tranche.junior,
|
|
17931
18762
|
args.performanceFeeBps,
|
|
@@ -17933,7 +18764,7 @@ function settleVault(args) {
|
|
|
17933
18764
|
);
|
|
17934
18765
|
const juniorFloorTopup = applyJuniorFloorTopup(
|
|
17935
18766
|
args.tranche,
|
|
17936
|
-
|
|
18767
|
+
availableRegularGain,
|
|
17937
18768
|
args.nowTs
|
|
17938
18769
|
);
|
|
17939
18770
|
regularValue = settleFixedApyNav({
|
|
@@ -17954,6 +18785,7 @@ function settleVault(args) {
|
|
|
17954
18785
|
args.protocolFeeBps
|
|
17955
18786
|
);
|
|
17956
18787
|
regularValue = regularFees.netValue;
|
|
18788
|
+
regularHwmSharePrice = regularFees.hwmSharePrice;
|
|
17957
18789
|
regularSharePrice = sharePriceForValue(regularValue, args.totalSupply) ?? regularSharePrice;
|
|
17958
18790
|
curatorFee = juniorFees.curator + regularFees.fees.curator;
|
|
17959
18791
|
protocolFee = juniorFees.protocol + regularFees.fees.protocol;
|
|
@@ -17975,10 +18807,20 @@ function settleVault(args) {
|
|
|
17975
18807
|
args.protocolFeeBps
|
|
17976
18808
|
);
|
|
17977
18809
|
regularValue = regularFees.netValue;
|
|
18810
|
+
regularHwmSharePrice = regularFees.hwmSharePrice;
|
|
17978
18811
|
regularSharePrice = sharePriceForValue(regularValue, args.totalSupply) ?? regularSharePrice;
|
|
17979
18812
|
curatorFee = regularFees.fees.curator;
|
|
17980
18813
|
protocolFee = regularFees.fees.protocol;
|
|
17981
18814
|
}
|
|
18815
|
+
if (regularHwmSharePrice > args.hwmSharePrice && nextApyValue !== void 0) {
|
|
18816
|
+
validateRealizedApy(
|
|
18817
|
+
args.tranche ? physicalNavBefore : args.currentSharePrice,
|
|
18818
|
+
priorTs,
|
|
18819
|
+
nextApyValue,
|
|
18820
|
+
args.nowTs,
|
|
18821
|
+
args.maxApyBps
|
|
18822
|
+
);
|
|
18823
|
+
}
|
|
17982
18824
|
const totalFees = curatorFee + protocolFee;
|
|
17983
18825
|
const netRegularBacking = mulDiv2(
|
|
17984
18826
|
args.totalSupply,
|
|
@@ -18066,28 +18908,15 @@ function seniorEntitlement(tranche, nowTs) {
|
|
|
18066
18908
|
);
|
|
18067
18909
|
return targetValue > tranche.senior.value ? targetValue - tranche.senior.value : 0n;
|
|
18068
18910
|
}
|
|
18069
|
-
function applyJuniorFloorTopup(tranche,
|
|
18911
|
+
function applyJuniorFloorTopup(tranche, availableRegularGain, nowTs) {
|
|
18070
18912
|
if (tranche.juniorApyAnchorTs <= 0n) {
|
|
18071
18913
|
tranche.juniorApyAnchorSharePrice = tranche.junior.sharePrice;
|
|
18072
18914
|
tranche.juniorApyAnchorTs = tranche.lastSettledTs > 0n ? tranche.lastSettledTs : nowTs;
|
|
18073
18915
|
}
|
|
18916
|
+
tranche.juniorFloorUnderwater = 0n;
|
|
18074
18917
|
if (tranche.juniorFloorApyBps === 0 || tranche.junior.totalSupply === 0n) {
|
|
18075
18918
|
return 0n;
|
|
18076
18919
|
}
|
|
18077
|
-
if (tranche.junior.sharePrice < tranche.junior.hwmSharePrice) {
|
|
18078
|
-
if (tranche.juniorFloorUnderwater === 0n) {
|
|
18079
|
-
tranche.juniorApyAnchorSharePrice = tranche.junior.sharePrice;
|
|
18080
|
-
tranche.juniorApyAnchorTs = nowTs;
|
|
18081
|
-
tranche.juniorFloorUnderwater = 1n;
|
|
18082
|
-
}
|
|
18083
|
-
return 0n;
|
|
18084
|
-
}
|
|
18085
|
-
if (tranche.juniorFloorUnderwater !== 0n) {
|
|
18086
|
-
tranche.juniorApyAnchorSharePrice = tranche.junior.sharePrice;
|
|
18087
|
-
tranche.juniorApyAnchorTs = nowTs;
|
|
18088
|
-
tranche.juniorFloorUnderwater = 0n;
|
|
18089
|
-
return 0n;
|
|
18090
|
-
}
|
|
18091
18920
|
if (tranche.juniorApyAnchorSharePrice === 0n || tranche.juniorApyAnchorTs <= 0n || nowTs <= tranche.juniorApyAnchorTs) {
|
|
18092
18921
|
return 0n;
|
|
18093
18922
|
}
|
|
@@ -18102,7 +18931,7 @@ function applyJuniorFloorTopup(tranche, availableRegularValue, nowTs) {
|
|
|
18102
18931
|
DEFAULT_SHARE_PRICE
|
|
18103
18932
|
);
|
|
18104
18933
|
const shortfall = targetValue > tranche.junior.value ? targetValue - tranche.junior.value : 0n;
|
|
18105
|
-
const topup = shortfall <
|
|
18934
|
+
const topup = shortfall < availableRegularGain ? shortfall : availableRegularGain;
|
|
18106
18935
|
if (topup === 0n) return 0n;
|
|
18107
18936
|
tranche.junior.value += topup;
|
|
18108
18937
|
refreshShareClass(tranche.junior);
|
|
@@ -18136,10 +18965,30 @@ function settleShareClassPerformanceFee(shareClass, performanceFeeBps, protocolF
|
|
|
18136
18965
|
return fees;
|
|
18137
18966
|
}
|
|
18138
18967
|
function settleRegularPerformanceFee(grossValue, supply, hwmSharePrice, performanceFeeBps, protocolFeeBps) {
|
|
18139
|
-
if (supply === 0n)
|
|
18968
|
+
if (supply === 0n) {
|
|
18969
|
+
return {
|
|
18970
|
+
netValue: grossValue,
|
|
18971
|
+
fees: noFees(),
|
|
18972
|
+
hwmSharePrice
|
|
18973
|
+
};
|
|
18974
|
+
}
|
|
18140
18975
|
const grossPrice = sharePriceForValue(grossValue, supply);
|
|
18141
|
-
if (hwmSharePrice === 0n
|
|
18142
|
-
return {
|
|
18976
|
+
if (hwmSharePrice === 0n) {
|
|
18977
|
+
return {
|
|
18978
|
+
netValue: grossValue,
|
|
18979
|
+
fees: noFees(),
|
|
18980
|
+
hwmSharePrice: grossPrice
|
|
18981
|
+
};
|
|
18982
|
+
}
|
|
18983
|
+
if (grossPrice <= hwmSharePrice) {
|
|
18984
|
+
return { netValue: grossValue, fees: noFees(), hwmSharePrice };
|
|
18985
|
+
}
|
|
18986
|
+
if (performanceFeeBps + protocolFeeBps === 0) {
|
|
18987
|
+
return {
|
|
18988
|
+
netValue: grossValue,
|
|
18989
|
+
fees: noFees(),
|
|
18990
|
+
hwmSharePrice: grossPrice
|
|
18991
|
+
};
|
|
18143
18992
|
}
|
|
18144
18993
|
const gainValue = mulDiv2(
|
|
18145
18994
|
supply,
|
|
@@ -18147,9 +18996,11 @@ function settleRegularPerformanceFee(grossValue, supply, hwmSharePrice, performa
|
|
|
18147
18996
|
DEFAULT_SHARE_PRICE
|
|
18148
18997
|
);
|
|
18149
18998
|
const fees = feeAmounts(gainValue, performanceFeeBps, protocolFeeBps);
|
|
18999
|
+
const netValue = grossValue - fees.curator - fees.protocol;
|
|
18150
19000
|
return {
|
|
18151
|
-
netValue
|
|
18152
|
-
fees
|
|
19001
|
+
netValue,
|
|
19002
|
+
fees,
|
|
19003
|
+
hwmSharePrice: fees.curator + fees.protocol === 0n ? grossPrice : sharePriceForValue(netValue, supply)
|
|
18153
19004
|
};
|
|
18154
19005
|
}
|
|
18155
19006
|
function settleFixedApyNav(args) {
|
|
@@ -18258,7 +19109,7 @@ function decodeOracleData(data, nowTs) {
|
|
|
18258
19109
|
(_, holdingIndex) => readU64(data, offset + EXTERNAL_OFFSET + holdingIndex * 8)
|
|
18259
19110
|
);
|
|
18260
19111
|
entries.push({
|
|
18261
|
-
signer: new
|
|
19112
|
+
signer: new import_web325.PublicKey(signerBytes).toBase58(),
|
|
18262
19113
|
lastUpdateTs: readI64(data, offset + 32),
|
|
18263
19114
|
prices,
|
|
18264
19115
|
externalAmounts
|
|
@@ -18273,7 +19124,7 @@ function decodeOracleData(data, nowTs) {
|
|
|
18273
19124
|
data.slice(pendingOffset + index * 32, pendingOffset + (index + 1) * 32)
|
|
18274
19125
|
);
|
|
18275
19126
|
entries[index] = {
|
|
18276
|
-
signer: index < pendingCount ? new
|
|
19127
|
+
signer: index < pendingCount ? new import_web325.PublicKey(signerBytes).toBase58() : import_web325.PublicKey.default.toBase58(),
|
|
18277
19128
|
lastUpdateTs: 0n,
|
|
18278
19129
|
prices: Array(MAX_HOLDINGS).fill(0n),
|
|
18279
19130
|
externalAmounts: Array(MAX_HOLDINGS).fill(0n)
|
|
@@ -18301,7 +19152,7 @@ function decodeHolding(value) {
|
|
|
18301
19152
|
externalAmount: bigint(holding.externalAmount),
|
|
18302
19153
|
price: bigint(holding.price),
|
|
18303
19154
|
lastUpdateTs: bigint(holding.lastUpdateTs),
|
|
18304
|
-
cleared: mintString ===
|
|
19155
|
+
cleared: mintString === import_web325.PublicKey.default.toBase58()
|
|
18305
19156
|
};
|
|
18306
19157
|
}
|
|
18307
19158
|
function decodeTrancheState(decoded, args, warnings, blockers) {
|
|
@@ -18690,11 +19541,11 @@ async function simulateDryRunSettlement({
|
|
|
18690
19541
|
client.account.fetchVaultOracleForVault(vault, { fresh: true }),
|
|
18691
19542
|
tranchingEnabled ? client.account.fetchVaultTrancheStateForVault(vault, { fresh: true }) : Promise.resolve(void 0)
|
|
18692
19543
|
]);
|
|
18693
|
-
const mintKeys = [new
|
|
19544
|
+
const mintKeys = [new import_web326.PublicKey(vaultState.mint)];
|
|
18694
19545
|
if (trancheState) {
|
|
18695
19546
|
mintKeys.push(
|
|
18696
|
-
new
|
|
18697
|
-
new
|
|
19547
|
+
new import_web326.PublicKey(trancheState.config.juniorMint),
|
|
19548
|
+
new import_web326.PublicKey(trancheState.config.seniorMint)
|
|
18698
19549
|
);
|
|
18699
19550
|
}
|
|
18700
19551
|
const mintAccounts = await client.provider.connection.getMultipleAccountsInfo(
|
|
@@ -18710,7 +19561,7 @@ async function simulateDryRunSettlement({
|
|
|
18710
19561
|
oracleData: oracleState.data,
|
|
18711
19562
|
trancheState,
|
|
18712
19563
|
updates,
|
|
18713
|
-
signer: (0,
|
|
19564
|
+
signer: (0, import_common45.fromWeb3Pk)(signer.publicKey),
|
|
18714
19565
|
nowTs: nowSecs,
|
|
18715
19566
|
physicalShareSupply: supplies[0],
|
|
18716
19567
|
physicalJuniorSupply: tranchingEnabled ? supplies[1] : void 0,
|
|
@@ -18719,7 +19570,7 @@ async function simulateDryRunSettlement({
|
|
|
18719
19570
|
}
|
|
18720
19571
|
|
|
18721
19572
|
// src/services/consensusOracle/pipeline/holdingUpdates.ts
|
|
18722
|
-
var
|
|
19573
|
+
var import_common46 = __toESM(require_dist());
|
|
18723
19574
|
async function buildUpdates(yieldTracker, reportableHoldings, inputs) {
|
|
18724
19575
|
const updates = [];
|
|
18725
19576
|
for (const entry of reportableHoldings) {
|
|
@@ -18729,7 +19580,7 @@ async function buildUpdates(yieldTracker, reportableHoldings, inputs) {
|
|
|
18729
19580
|
}
|
|
18730
19581
|
async function buildHoldingUpdate(yieldTracker, entry, inputs) {
|
|
18731
19582
|
const { holding, holdingIndex } = entry;
|
|
18732
|
-
const mint = (0,
|
|
19583
|
+
const mint = (0, import_common46.fromWeb3Pk)(holding.mint);
|
|
18733
19584
|
const mintKey = mint.toString();
|
|
18734
19585
|
const oracleType = variantName2(holding.priceOracleType).toLowerCase();
|
|
18735
19586
|
let usd;
|
|
@@ -18793,14 +19644,14 @@ async function resolveTrackedAmounts(yieldTracker, cfg, decimals) {
|
|
|
18793
19644
|
);
|
|
18794
19645
|
}
|
|
18795
19646
|
return {
|
|
18796
|
-
trackedValueAmount: tracked.totalValue > 0 ? (0,
|
|
18797
|
-
principalAmount: tracked.principal > 0 ? (0,
|
|
18798
|
-
yieldAmount: tracked.outstandingYield > 0 ? (0,
|
|
19647
|
+
trackedValueAmount: tracked.totalValue > 0 ? (0, import_common46.fromUiAmount)(tracked.totalValue, decimals) : 0n,
|
|
19648
|
+
principalAmount: tracked.principal > 0 ? (0, import_common46.fromUiAmount)(tracked.principal, decimals) : 0n,
|
|
19649
|
+
yieldAmount: tracked.outstandingYield > 0 ? (0, import_common46.fromUiAmount)(tracked.outstandingYield, decimals) : 0n
|
|
18799
19650
|
};
|
|
18800
19651
|
}
|
|
18801
19652
|
|
|
18802
19653
|
// src/services/consensusOracle/pipeline/livePriceRefresh.ts
|
|
18803
|
-
var
|
|
19654
|
+
var import_common47 = __toESM(require_dist());
|
|
18804
19655
|
async function refreshLiveOraclePrices({
|
|
18805
19656
|
oracle,
|
|
18806
19657
|
signer,
|
|
@@ -18819,7 +19670,7 @@ async function refreshLiveOraclePrices({
|
|
|
18819
19670
|
for (const holding of vaultState.holdings) {
|
|
18820
19671
|
const oracleType = variantName2(holding.priceOracleType).toLowerCase();
|
|
18821
19672
|
if (!LIVE_ORACLE_VARIANTS.has(oracleType)) continue;
|
|
18822
|
-
const mint = (0,
|
|
19673
|
+
const mint = (0, import_common47.fromWeb3Pk)(holding.mint);
|
|
18823
19674
|
if (mint.toString() === SYSTEM_PROGRAM2) continue;
|
|
18824
19675
|
const activeAmount = toBigInt2(holding.localAmount) + toBigInt2(holding.externalAmount);
|
|
18825
19676
|
if (activeAmount === 0n) continue;
|
|
@@ -18834,7 +19685,7 @@ async function refreshLiveOraclePrices({
|
|
|
18834
19685
|
);
|
|
18835
19686
|
continue;
|
|
18836
19687
|
}
|
|
18837
|
-
const oracleAccount = (0,
|
|
19688
|
+
const oracleAccount = (0, import_common47.fromWeb3Pk)(holding.priceOracleAccount);
|
|
18838
19689
|
if (oracleAccount.toString() === SYSTEM_PROGRAM2) {
|
|
18839
19690
|
log(
|
|
18840
19691
|
`vault ${vault}: cannot refresh ${mint}; ${oracleType} holding has no oracle account`
|
|
@@ -18858,15 +19709,15 @@ async function refreshLiveOraclePrices({
|
|
|
18858
19709
|
}
|
|
18859
19710
|
|
|
18860
19711
|
// src/services/consensusOracle/pipeline/pricingInputs.ts
|
|
18861
|
-
var
|
|
19712
|
+
var import_common48 = __toESM(require_dist());
|
|
18862
19713
|
async function gatherPricingInputs(deps, target, vaultState, reportableHoldings, log = () => {
|
|
18863
19714
|
}) {
|
|
18864
|
-
const manager = (0,
|
|
19715
|
+
const manager = (0, import_common48.fromWeb3Pk)(vaultState.roles.manager);
|
|
18865
19716
|
const consensusMints = reportableHoldings.filter(
|
|
18866
19717
|
({ holding }) => variantName2(holding.priceOracleType).toLowerCase() === CONSENSUS_ORACLE_VARIANT
|
|
18867
|
-
).map(({ holding }) => (0,
|
|
19718
|
+
).map(({ holding }) => (0, import_common48.fromWeb3Pk)(holding.mint));
|
|
18868
19719
|
const baseHolding = vaultState.holdings.find((h) => coerceBool3(h.isBase));
|
|
18869
|
-
const baseMint = baseHolding ? (0,
|
|
19720
|
+
const baseMint = baseHolding ? (0, import_common48.fromWeb3Pk)(baseHolding.mint) : consensusMints[0];
|
|
18870
19721
|
if (!baseMint) {
|
|
18871
19722
|
throw new Error(`vault has no holdings \u2014 cannot determine base asset`);
|
|
18872
19723
|
}
|
|
@@ -18959,11 +19810,11 @@ function reconcilePositionSnapshots(snapshots, vault, log) {
|
|
|
18959
19810
|
}
|
|
18960
19811
|
|
|
18961
19812
|
// src/services/consensusOracle/pipeline/receiptMints.ts
|
|
18962
|
-
var
|
|
19813
|
+
var import_common49 = __toESM(require_dist());
|
|
18963
19814
|
async function fetchReceiptMints(client, vault, vaultState) {
|
|
18964
19815
|
const receiptMints = /* @__PURE__ */ new Set();
|
|
18965
19816
|
if (vaultState.mint) {
|
|
18966
|
-
receiptMints.add((0,
|
|
19817
|
+
receiptMints.add((0, import_common49.fromWeb3Pk)(vaultState.mint).toString());
|
|
18967
19818
|
}
|
|
18968
19819
|
if (!coerceBool3(vaultState.tranchingEnabled)) return receiptMints;
|
|
18969
19820
|
const trancheState = await client.account.fetchVaultTrancheStateForVault(
|
|
@@ -18971,19 +19822,19 @@ async function fetchReceiptMints(client, vault, vaultState) {
|
|
|
18971
19822
|
{ fresh: true }
|
|
18972
19823
|
);
|
|
18973
19824
|
receiptMints.add(
|
|
18974
|
-
(0,
|
|
19825
|
+
(0, import_common49.fromWeb3Pk)(trancheState.config.juniorMint).toString()
|
|
18975
19826
|
);
|
|
18976
19827
|
receiptMints.add(
|
|
18977
|
-
(0,
|
|
19828
|
+
(0, import_common49.fromWeb3Pk)(trancheState.config.seniorMint).toString()
|
|
18978
19829
|
);
|
|
18979
19830
|
return receiptMints;
|
|
18980
19831
|
}
|
|
18981
19832
|
|
|
18982
19833
|
// src/services/consensusOracle/pipeline/settlement.ts
|
|
18983
|
-
var
|
|
19834
|
+
var import_common51 = __toESM(require_dist());
|
|
18984
19835
|
|
|
18985
19836
|
// src/services/consensusOracle/pipeline/yieldAccounts.ts
|
|
18986
|
-
var
|
|
19837
|
+
var import_common50 = __toESM(require_dist());
|
|
18987
19838
|
async function assertNoUnconfirmedYieldPayments(yieldTracker, target) {
|
|
18988
19839
|
const accountNames = [
|
|
18989
19840
|
...new Set(
|
|
@@ -19025,7 +19876,7 @@ async function withDiscoveredYieldAccounts(yieldTracker, target, vaultState, exc
|
|
|
19025
19876
|
);
|
|
19026
19877
|
if (namesToAttach.length === 0) return target;
|
|
19027
19878
|
const baseHolding = vaultState.holdings.find((holding) => {
|
|
19028
|
-
const mint = (0,
|
|
19879
|
+
const mint = (0, import_common50.fromWeb3Pk)(holding.mint).toString();
|
|
19029
19880
|
return coerceBool3(holding.isBase) && !excludedMints.has(mint);
|
|
19030
19881
|
});
|
|
19031
19882
|
if (!baseHolding) {
|
|
@@ -19033,7 +19884,7 @@ async function withDiscoveredYieldAccounts(yieldTracker, target, vaultState, exc
|
|
|
19033
19884
|
`vault ${target.vault}: tagged yield accounts found but no base holding is available`
|
|
19034
19885
|
);
|
|
19035
19886
|
}
|
|
19036
|
-
const baseMint = (0,
|
|
19887
|
+
const baseMint = (0, import_common50.fromWeb3Pk)(baseHolding.mint);
|
|
19037
19888
|
const holdings = [...target.holdings ?? []];
|
|
19038
19889
|
const existingIndex = holdings.findIndex(
|
|
19039
19890
|
(holding) => holding.mint.toString() === baseMint.toString()
|
|
@@ -19124,7 +19975,7 @@ async function logProspectiveApy({
|
|
|
19124
19975
|
);
|
|
19125
19976
|
const prospectiveNav = vaultState.holdings.reduce(
|
|
19126
19977
|
(sum, holding, holdingIndex) => {
|
|
19127
|
-
const mint = (0,
|
|
19978
|
+
const mint = (0, import_common51.fromWeb3Pk)(holding.mint).toString();
|
|
19128
19979
|
if (mint === SYSTEM_PROGRAM2) return sum;
|
|
19129
19980
|
const update = updatesByIndex.get(holdingIndex);
|
|
19130
19981
|
const localAmount = toBigInt2(holding.localAmount);
|
|
@@ -19305,7 +20156,7 @@ var StaticPositionProvider = class {
|
|
|
19305
20156
|
|
|
19306
20157
|
// src/services/consensusOracle/positions/kaminoPositionProvider.ts
|
|
19307
20158
|
var import_kit14 = require("@solana/kit");
|
|
19308
|
-
var
|
|
20159
|
+
var import_web327 = require("@solana/web3.js");
|
|
19309
20160
|
var import_klend_sdk = require("@kamino-finance/klend-sdk");
|
|
19310
20161
|
async function readKaminoBalance(manager, vault, sharesHolder) {
|
|
19311
20162
|
const userShares = await manager.getUserSharesBalanceSingleVault(
|
|
@@ -19342,7 +20193,7 @@ var KaminoPositionProvider = class {
|
|
|
19342
20193
|
const amount = await readKaminoBalance(
|
|
19343
20194
|
manager,
|
|
19344
20195
|
kVault,
|
|
19345
|
-
new
|
|
20196
|
+
new import_web327.PublicKey(sharesHolder)
|
|
19346
20197
|
);
|
|
19347
20198
|
out.push({ mint: ref.mint, amount });
|
|
19348
20199
|
}
|
|
@@ -19351,7 +20202,7 @@ var KaminoPositionProvider = class {
|
|
|
19351
20202
|
};
|
|
19352
20203
|
|
|
19353
20204
|
// src/services/consensusOracle/positions/marginfiPositionProvider.ts
|
|
19354
|
-
var
|
|
20205
|
+
var import_web328 = require("@solana/web3.js");
|
|
19355
20206
|
var import_marginfi2 = __toESM(require_dist2());
|
|
19356
20207
|
var MarginfiPositionProvider = class {
|
|
19357
20208
|
constructor(connection, log = () => {
|
|
@@ -19362,8 +20213,8 @@ var MarginfiPositionProvider = class {
|
|
|
19362
20213
|
async positionsFor(ctx) {
|
|
19363
20214
|
const refs = ctx.refs.filter((r) => r.kind === "marginfi");
|
|
19364
20215
|
if (refs.length === 0) return [];
|
|
19365
|
-
const explicitBanks = refs.map((r) => r.marginfiBank).filter(Boolean).map((bank) => new
|
|
19366
|
-
const autoAccountPks = refs.filter((r) => !r.marginfiBank).map((r) => r.marginfiAccount).filter(Boolean).map((account) => new
|
|
20216
|
+
const explicitBanks = refs.map((r) => r.marginfiBank).filter(Boolean).map((bank) => new import_web328.PublicKey(bank));
|
|
20217
|
+
const autoAccountPks = refs.filter((r) => !r.marginfiBank).map((r) => r.marginfiAccount).filter(Boolean).map((account) => new import_web328.PublicKey(account));
|
|
19367
20218
|
const autoBanks = [];
|
|
19368
20219
|
for (const accountPk of autoAccountPks) {
|
|
19369
20220
|
try {
|
|
@@ -19392,14 +20243,14 @@ var MarginfiPositionProvider = class {
|
|
|
19392
20243
|
if (bank) {
|
|
19393
20244
|
const amount = await (0, import_marginfi2.readMarginfiBankBalance)(
|
|
19394
20245
|
client,
|
|
19395
|
-
new
|
|
19396
|
-
new
|
|
20246
|
+
new import_web328.PublicKey(account),
|
|
20247
|
+
new import_web328.PublicKey(bank)
|
|
19397
20248
|
);
|
|
19398
20249
|
out.push({ mint: ref.mint, amount });
|
|
19399
20250
|
} else {
|
|
19400
20251
|
const balances = await (0, import_marginfi2.readAllMarginfiBalances)(
|
|
19401
20252
|
client,
|
|
19402
|
-
new
|
|
20253
|
+
new import_web328.PublicKey(account)
|
|
19403
20254
|
);
|
|
19404
20255
|
for (const { mint, amount } of balances) {
|
|
19405
20256
|
out.push({ mint: mint.toBase58(), amount });
|
|
@@ -19643,7 +20494,7 @@ function createLiveConsensusOracleDeps(connection, opts = {}) {
|
|
|
19643
20494
|
}
|
|
19644
20495
|
|
|
19645
20496
|
// src/services/consensusOracle/consensusOracleService.ts
|
|
19646
|
-
var
|
|
20497
|
+
var import_common52 = __toESM(require_dist());
|
|
19647
20498
|
var ConsensusOracleService = class {
|
|
19648
20499
|
constructor(client, deps) {
|
|
19649
20500
|
this.client = client;
|
|
@@ -19679,7 +20530,7 @@ var ConsensusOracleService = class {
|
|
|
19679
20530
|
receiptMints
|
|
19680
20531
|
);
|
|
19681
20532
|
const filteredCount = vaultState.holdings.filter(
|
|
19682
|
-
(holding) => receiptMints.has((0,
|
|
20533
|
+
(holding) => receiptMints.has((0, import_common52.fromWeb3Pk)(holding.mint).toString())
|
|
19683
20534
|
).length;
|
|
19684
20535
|
if (filteredCount > 0) {
|
|
19685
20536
|
log(
|
|
@@ -19861,8 +20712,8 @@ async function runLiveConsensusOracle(env, oracleSigner, opts = {}) {
|
|
|
19861
20712
|
|
|
19862
20713
|
// src/services/externalLiquidityIntegrityService.ts
|
|
19863
20714
|
var import_kit15 = require("@solana/kit");
|
|
19864
|
-
var
|
|
19865
|
-
var
|
|
20715
|
+
var import_web329 = require("@solana/web3.js");
|
|
20716
|
+
var import_common53 = __toESM(require_dist());
|
|
19866
20717
|
var import_marginfi3 = __toESM(require_dist2());
|
|
19867
20718
|
var DEFAULT_MIN_AMOUNT_UI = 1;
|
|
19868
20719
|
var DEFAULT_TARGET_LOCAL_BPS = 50;
|
|
@@ -19884,7 +20735,7 @@ function parseActiveSlots(externalLiquidity) {
|
|
|
19884
20735
|
if (discriminant === 0) continue;
|
|
19885
20736
|
if (discriminant !== 1) continue;
|
|
19886
20737
|
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
19887
|
-
const userAccount = (0,
|
|
20738
|
+
const userAccount = (0, import_common53.toAddress)(new import_web329.PublicKey(pubkeyBytes));
|
|
19888
20739
|
results.push({ index: i, source: "marginfi", userAccount });
|
|
19889
20740
|
}
|
|
19890
20741
|
return results;
|
|
@@ -19996,8 +20847,8 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
19996
20847
|
result.skipped++;
|
|
19997
20848
|
return result;
|
|
19998
20849
|
}
|
|
19999
|
-
const hwManagerAddress = (0,
|
|
20000
|
-
const vaultPk = new
|
|
20850
|
+
const hwManagerAddress = (0, import_common53.fromWeb3Pk)(hwManager.publicKey);
|
|
20851
|
+
const vaultPk = new import_web329.PublicKey(vault.toString());
|
|
20001
20852
|
const registeredHwManager = pubkeyStr(
|
|
20002
20853
|
vaultState.roles.hwManager
|
|
20003
20854
|
);
|
|
@@ -20114,14 +20965,14 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20114
20965
|
const marginfiClient = new import_marginfi3.CpiClient({
|
|
20115
20966
|
accounts: marginfiAccounts
|
|
20116
20967
|
});
|
|
20117
|
-
const { getAtaAddress:
|
|
20118
|
-
const vaultAta =
|
|
20968
|
+
const { getAtaAddress: getAtaAddress18 } = await Promise.resolve().then(() => __toESM(require_dist()));
|
|
20969
|
+
const vaultAta = getAtaAddress18(
|
|
20119
20970
|
mintAddress,
|
|
20120
20971
|
vault,
|
|
20121
20972
|
marginfiAccounts.tokenProgram,
|
|
20122
20973
|
true
|
|
20123
20974
|
);
|
|
20124
|
-
const cpiRefs = (0,
|
|
20975
|
+
const cpiRefs = (0, import_common53.createCpiRefs)([
|
|
20125
20976
|
direction === "deposit" ? marginfiClient.deposit_cpi({
|
|
20126
20977
|
marginfiAccount: slot.userAccount,
|
|
20127
20978
|
authority: vault,
|
|
@@ -20167,9 +21018,9 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20167
21018
|
|
|
20168
21019
|
// src/services/idleLiquidityService.ts
|
|
20169
21020
|
var import_kit16 = require("@solana/kit");
|
|
20170
|
-
var
|
|
20171
|
-
var
|
|
20172
|
-
var
|
|
21021
|
+
var import_spl_token20 = require("@solana/spl-token");
|
|
21022
|
+
var import_web330 = require("@solana/web3.js");
|
|
21023
|
+
var import_common54 = __toESM(require_dist());
|
|
20173
21024
|
var import_jupiter3 = __toESM(require_dist3());
|
|
20174
21025
|
var IDLE_RESERVE_FLOOR_BPS = 400;
|
|
20175
21026
|
var IDLE_RESERVE_TARGET_BPS = 500;
|
|
@@ -20268,8 +21119,8 @@ var IdleLiquidityService = class {
|
|
|
20268
21119
|
let quote;
|
|
20269
21120
|
try {
|
|
20270
21121
|
quote = await jupiter.getQuote({
|
|
20271
|
-
inputMint:
|
|
20272
|
-
outputMint:
|
|
21122
|
+
inputMint: import_common54.PST_MINT,
|
|
21123
|
+
outputMint: import_common54.USDC_MINT,
|
|
20273
21124
|
amount: pstInput,
|
|
20274
21125
|
slippageBps: opts.slippageBps ?? DEFAULT_SLIPPAGE_BPS,
|
|
20275
21126
|
maxAccounts: DEFAULT_MAX_ACCOUNTS
|
|
@@ -20334,8 +21185,8 @@ var IdleLiquidityService = class {
|
|
|
20334
21185
|
log(`Vault ${vault}: ${reason} \u2014 skipping`);
|
|
20335
21186
|
return { result: { ...empty, status: "no-tvl", reason } };
|
|
20336
21187
|
}
|
|
20337
|
-
const usdc = findHolding2(vaultState,
|
|
20338
|
-
const pst = findHolding2(vaultState,
|
|
21188
|
+
const usdc = findHolding2(vaultState, import_common54.USDC_MINT);
|
|
21189
|
+
const pst = findHolding2(vaultState, import_common54.PST_MINT);
|
|
20339
21190
|
if (!usdc || !pst) {
|
|
20340
21191
|
const reason = `vault has no ${usdc ? "PST" : "USDC"} holding`;
|
|
20341
21192
|
log(`Vault ${vault}: ${reason} \u2014 skipping`);
|
|
@@ -20449,16 +21300,16 @@ var IdleLiquidityService = class {
|
|
|
20449
21300
|
*/
|
|
20450
21301
|
async mintTokenProgram(mint) {
|
|
20451
21302
|
const account = await this.client.provider.connection.getAccountInfo(
|
|
20452
|
-
new
|
|
21303
|
+
new import_web330.PublicKey(mint),
|
|
20453
21304
|
"confirmed"
|
|
20454
21305
|
);
|
|
20455
21306
|
if (!account) throw new Error(`Mint account not found: ${mint}`);
|
|
20456
|
-
if (!account.owner.equals(
|
|
21307
|
+
if (!account.owner.equals(import_spl_token20.TOKEN_PROGRAM_ID) && !account.owner.equals(import_spl_token20.TOKEN_2022_PROGRAM_ID)) {
|
|
20457
21308
|
throw new Error(
|
|
20458
21309
|
`Unsupported token program ${account.owner.toBase58()} for mint ${mint}`
|
|
20459
21310
|
);
|
|
20460
21311
|
}
|
|
20461
|
-
return (0,
|
|
21312
|
+
return (0, import_common54.fromWeb3Pk)(account.owner);
|
|
20462
21313
|
}
|
|
20463
21314
|
/**
|
|
20464
21315
|
* Build, simulate, and (unless `dryRun`) submit the `jupiter_swap`.
|
|
@@ -20478,23 +21329,23 @@ var IdleLiquidityService = class {
|
|
|
20478
21329
|
dryRun,
|
|
20479
21330
|
log
|
|
20480
21331
|
} = params;
|
|
20481
|
-
const signer = (0,
|
|
21332
|
+
const signer = (0, import_common54.fromWeb3Pk)(hwManager.publicKey);
|
|
20482
21333
|
const [sourceTokenProgram, destinationTokenProgram] = await Promise.all([
|
|
20483
|
-
this.mintTokenProgram(
|
|
20484
|
-
this.mintTokenProgram(
|
|
21334
|
+
this.mintTokenProgram(import_common54.PST_MINT),
|
|
21335
|
+
this.mintTokenProgram(import_common54.USDC_MINT)
|
|
20485
21336
|
]);
|
|
20486
21337
|
const jupiterCpi = await jupiter.getSwapCpiData(quote, vault, {
|
|
20487
21338
|
payer: signer
|
|
20488
21339
|
});
|
|
20489
|
-
const { accounts: accounts2, refs, lookupTables } = (0,
|
|
21340
|
+
const { accounts: accounts2, refs, lookupTables } = (0, import_common54.createCpiRefs)([jupiterCpi]);
|
|
20490
21341
|
const vaultTrancheState = coerceBool4(
|
|
20491
21342
|
vaultState.tranchingEnabled
|
|
20492
21343
|
) ? (await this.client.pda.deriveVaultTrancheStatePda(vault))[0] : void 0;
|
|
20493
21344
|
const plan = await this.client.tx.jupiterSwap.getTx({
|
|
20494
21345
|
hwManager: signer,
|
|
20495
21346
|
vault,
|
|
20496
|
-
sourceMint:
|
|
20497
|
-
destinationMint:
|
|
21347
|
+
sourceMint: import_common54.PST_MINT,
|
|
21348
|
+
destinationMint: import_common54.USDC_MINT,
|
|
20498
21349
|
refs,
|
|
20499
21350
|
accounts: accounts2,
|
|
20500
21351
|
sourceTokenProgram,
|
|
@@ -20504,26 +21355,26 @@ var IdleLiquidityService = class {
|
|
|
20504
21355
|
});
|
|
20505
21356
|
const connection = this.client.provider.connection;
|
|
20506
21357
|
const instructions2 = [
|
|
20507
|
-
|
|
21358
|
+
import_web330.ComputeBudgetProgram.setComputeUnitLimit({ units: COMPUTE_UNIT_LIMIT }),
|
|
20508
21359
|
...cuPriceMicroLamports > 0 ? [
|
|
20509
|
-
|
|
21360
|
+
import_web330.ComputeBudgetProgram.setComputeUnitPrice({
|
|
20510
21361
|
microLamports: cuPriceMicroLamports
|
|
20511
21362
|
})
|
|
20512
21363
|
] : [],
|
|
20513
|
-
...(jupiterCpi.preInstructions ?? []).map(
|
|
20514
|
-
...plan.instructions.map(
|
|
21364
|
+
...(jupiterCpi.preInstructions ?? []).map(import_common54.fromKitInstruction),
|
|
21365
|
+
...plan.instructions.map(import_common54.fromKitInstruction)
|
|
20515
21366
|
];
|
|
20516
21367
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
20517
|
-
const lookupTableAccounts = await (0,
|
|
21368
|
+
const lookupTableAccounts = await (0, import_common54.fetchLookupTables)(
|
|
20518
21369
|
connection,
|
|
20519
21370
|
plan.lookupTables ?? []
|
|
20520
21371
|
);
|
|
20521
|
-
const message2 = new
|
|
21372
|
+
const message2 = new import_web330.TransactionMessage({
|
|
20522
21373
|
payerKey: hwManager.publicKey,
|
|
20523
21374
|
recentBlockhash: blockhash,
|
|
20524
21375
|
instructions: instructions2
|
|
20525
21376
|
}).compileToV0Message(lookupTableAccounts);
|
|
20526
|
-
const transaction = new
|
|
21377
|
+
const transaction = new import_web330.VersionedTransaction(message2);
|
|
20527
21378
|
transaction.sign([hwManager]);
|
|
20528
21379
|
const simulation = await connection.simulateTransaction(transaction, {
|
|
20529
21380
|
sigVerify: true,
|
|
@@ -20563,21 +21414,264 @@ var IdleLiquidityService = class {
|
|
|
20563
21414
|
}
|
|
20564
21415
|
};
|
|
20565
21416
|
|
|
21417
|
+
// src/services/timelockSettlementService.ts
|
|
21418
|
+
var import_kit17 = require("@solana/kit");
|
|
21419
|
+
var import_web331 = require("@solana/web3.js");
|
|
21420
|
+
var import_common55 = __toESM(require_dist());
|
|
21421
|
+
var ZERO_PUBKEY = import_web331.PublicKey.default.toBase58();
|
|
21422
|
+
var CONSENSUS_SIGNER_CAPACITY = 4;
|
|
21423
|
+
var CONSENSUS_ENTRY_OFFSET = 40;
|
|
21424
|
+
var CONSENSUS_ENTRY_SIZE = 272;
|
|
21425
|
+
var CONSENSUS_PENDING_OFFSET = CONSENSUS_ENTRY_OFFSET + CONSENSUS_SIGNER_CAPACITY * CONSENSUS_ENTRY_SIZE;
|
|
21426
|
+
var CONSENSUS_PENDING_EFFECTIVE_TS_OFFSET = CONSENSUS_PENDING_OFFSET + 128;
|
|
21427
|
+
var CONSENSUS_PENDING_SIGNER_COUNT_OFFSET = CONSENSUS_PENDING_OFFSET + 136;
|
|
21428
|
+
function integer(value) {
|
|
21429
|
+
if (typeof value === "number") return value;
|
|
21430
|
+
if (typeof value === "bigint") return Number(value);
|
|
21431
|
+
if (value && typeof value.toString === "function") {
|
|
21432
|
+
return Number(value.toString());
|
|
21433
|
+
}
|
|
21434
|
+
return 0;
|
|
21435
|
+
}
|
|
21436
|
+
function pubkey(value) {
|
|
21437
|
+
if (typeof value === "string") return value;
|
|
21438
|
+
if (value && typeof value.toBase58 === "function") {
|
|
21439
|
+
return value.toBase58();
|
|
21440
|
+
}
|
|
21441
|
+
return String(value ?? "");
|
|
21442
|
+
}
|
|
21443
|
+
function readI642(bytes, offset) {
|
|
21444
|
+
let unsigned = 0n;
|
|
21445
|
+
for (let i = 0; i < 8; i += 1) {
|
|
21446
|
+
unsigned |= BigInt(bytes[offset + i] ?? 0) << BigInt(i * 8);
|
|
21447
|
+
}
|
|
21448
|
+
const signed = unsigned >= 1n << 63n ? unsigned - (1n << 64n) : unsigned;
|
|
21449
|
+
return Number(signed);
|
|
21450
|
+
}
|
|
21451
|
+
function decodePendingConsensusSigners(data) {
|
|
21452
|
+
const bytes = Uint8Array.from(data);
|
|
21453
|
+
const count = bytes[CONSENSUS_PENDING_SIGNER_COUNT_OFFSET] ?? 0;
|
|
21454
|
+
if (count === 0) return null;
|
|
21455
|
+
if (count > CONSENSUS_SIGNER_CAPACITY) {
|
|
21456
|
+
throw new Error(`invalid pending consensus signer count: ${count}`);
|
|
21457
|
+
}
|
|
21458
|
+
const signers = [];
|
|
21459
|
+
for (let i = 0; i < count; i += 1) {
|
|
21460
|
+
const start = CONSENSUS_PENDING_OFFSET + i * 32;
|
|
21461
|
+
const signer = new import_web331.PublicKey(bytes.slice(start, start + 32)).toBase58();
|
|
21462
|
+
if (signer === ZERO_PUBKEY) {
|
|
21463
|
+
throw new Error(`pending consensus signer ${i} is unset`);
|
|
21464
|
+
}
|
|
21465
|
+
signers.push((0, import_kit17.address)(signer));
|
|
21466
|
+
}
|
|
21467
|
+
return {
|
|
21468
|
+
signers,
|
|
21469
|
+
effectiveTs: readI642(bytes, CONSENSUS_PENDING_EFFECTIVE_TS_OFFSET)
|
|
21470
|
+
};
|
|
21471
|
+
}
|
|
21472
|
+
function pendingRoleSettlement(state, now) {
|
|
21473
|
+
const pending = state.pendingRoleUpdates;
|
|
21474
|
+
const pendingFields = integer(pending.pendingFields);
|
|
21475
|
+
const effectiveTimestamps = pending.updates.filter((update) => {
|
|
21476
|
+
const role = integer(update.role);
|
|
21477
|
+
return role !== 0 && (pendingFields & role) === role;
|
|
21478
|
+
}).map((update) => integer(update.effectiveTs));
|
|
21479
|
+
if (effectiveTimestamps.length === 0) return null;
|
|
21480
|
+
const expiredTimestamps = effectiveTimestamps.filter((ts) => now >= ts);
|
|
21481
|
+
return {
|
|
21482
|
+
effectiveTs: expiredTimestamps.length > 0 ? Math.min(...expiredTimestamps) : Math.min(...effectiveTimestamps),
|
|
21483
|
+
expired: expiredTimestamps.length > 0
|
|
21484
|
+
};
|
|
21485
|
+
}
|
|
21486
|
+
function pendingDestinationSettlement(state, now) {
|
|
21487
|
+
const pending = state.managerWithdrawWhitelist.pendingDestination;
|
|
21488
|
+
const destination = pubkey(pending.address);
|
|
21489
|
+
if (!destination || destination === ZERO_PUBKEY) return null;
|
|
21490
|
+
const effectiveTs = integer(pending.effectiveTs);
|
|
21491
|
+
return {
|
|
21492
|
+
slot: integer(pending.slot),
|
|
21493
|
+
destination: (0, import_kit17.address)(destination),
|
|
21494
|
+
effectiveTs,
|
|
21495
|
+
expired: now >= effectiveTs
|
|
21496
|
+
};
|
|
21497
|
+
}
|
|
21498
|
+
var TimelockSettlementService = class {
|
|
21499
|
+
constructor(client) {
|
|
21500
|
+
this.client = client;
|
|
21501
|
+
}
|
|
21502
|
+
async chainTime() {
|
|
21503
|
+
const connection = this.client.provider.connection;
|
|
21504
|
+
const slot = await connection.getSlot("confirmed");
|
|
21505
|
+
const blockTime = await connection.getBlockTime(slot);
|
|
21506
|
+
if (blockTime === null) {
|
|
21507
|
+
throw new Error(`block time unavailable for slot ${slot}`);
|
|
21508
|
+
}
|
|
21509
|
+
return blockTime;
|
|
21510
|
+
}
|
|
21511
|
+
/** Scan and settle every due configuration timelock the signer can fulfill. */
|
|
21512
|
+
async runAll(fulfiller, opts = {}) {
|
|
21513
|
+
const log = opts.log ?? (() => {
|
|
21514
|
+
});
|
|
21515
|
+
const dryRun = opts.dryRun ?? false;
|
|
21516
|
+
const now = opts.now ?? await this.chainTime();
|
|
21517
|
+
const fulfillerAddress = (0, import_common55.fromWeb3Pk)(fulfiller.publicKey);
|
|
21518
|
+
const allVaults = opts.vault ? [
|
|
21519
|
+
{
|
|
21520
|
+
publicKey: opts.vault,
|
|
21521
|
+
account: await this.client.account.fetchVault(opts.vault, {
|
|
21522
|
+
fresh: true
|
|
21523
|
+
})
|
|
21524
|
+
}
|
|
21525
|
+
] : await this.client.account.fetchAllVaults({ fresh: true });
|
|
21526
|
+
const summary = {
|
|
21527
|
+
vaultsScanned: allVaults.length,
|
|
21528
|
+
scanFailed: 0,
|
|
21529
|
+
pendingFound: 0,
|
|
21530
|
+
skippedNotExpired: 0,
|
|
21531
|
+
skippedAuthorityMismatch: 0,
|
|
21532
|
+
settled: 0,
|
|
21533
|
+
failed: 0,
|
|
21534
|
+
records: []
|
|
21535
|
+
};
|
|
21536
|
+
log(
|
|
21537
|
+
`Scanning ${allVaults.length} vault(s) at chain time ${now} as fulfiller ${fulfillerAddress}`
|
|
21538
|
+
);
|
|
21539
|
+
for (const { publicKey: vault, account: state } of allVaults) {
|
|
21540
|
+
const isFulfiller = pubkey(state.roles.fulfiller) === fulfiller.publicKey.toBase58();
|
|
21541
|
+
const destination = pendingDestinationSettlement(state, now);
|
|
21542
|
+
const roles = pendingRoleSettlement(state, now);
|
|
21543
|
+
let consensus = null;
|
|
21544
|
+
try {
|
|
21545
|
+
const oracle = await this.client.account.fetchVaultOracleForVault(
|
|
21546
|
+
vault,
|
|
21547
|
+
{
|
|
21548
|
+
fresh: true
|
|
21549
|
+
}
|
|
21550
|
+
);
|
|
21551
|
+
consensus = decodePendingConsensusSigners(oracle.data);
|
|
21552
|
+
} catch (error) {
|
|
21553
|
+
summary.scanFailed += 1;
|
|
21554
|
+
log(
|
|
21555
|
+
`Vault ${vault}: unable to inspect consensus timelock: ${error instanceof Error ? error.message : String(error)}`
|
|
21556
|
+
);
|
|
21557
|
+
}
|
|
21558
|
+
const actions = [];
|
|
21559
|
+
if (destination) {
|
|
21560
|
+
actions.push({
|
|
21561
|
+
kind: "manager-withdraw-destination",
|
|
21562
|
+
effectiveTs: destination.effectiveTs,
|
|
21563
|
+
expired: destination.expired,
|
|
21564
|
+
execute: async () => {
|
|
21565
|
+
const plan = await this.client.tx.setManagerWithdrawDestination.getTx({
|
|
21566
|
+
curator: fulfillerAddress,
|
|
21567
|
+
vault,
|
|
21568
|
+
slot: destination.slot,
|
|
21569
|
+
address: destination.destination
|
|
21570
|
+
});
|
|
21571
|
+
return this.execute(fulfiller, plan, dryRun, log);
|
|
21572
|
+
}
|
|
21573
|
+
});
|
|
21574
|
+
}
|
|
21575
|
+
if (consensus) {
|
|
21576
|
+
actions.push({
|
|
21577
|
+
kind: "consensus-signers",
|
|
21578
|
+
effectiveTs: consensus.effectiveTs,
|
|
21579
|
+
expired: now >= consensus.effectiveTs,
|
|
21580
|
+
execute: async () => {
|
|
21581
|
+
const plan = await this.client.tx.updateConsensusSigners.getTx({
|
|
21582
|
+
curator: fulfillerAddress,
|
|
21583
|
+
vault,
|
|
21584
|
+
signers: consensus.signers
|
|
21585
|
+
});
|
|
21586
|
+
return this.execute(fulfiller, plan, dryRun, log);
|
|
21587
|
+
}
|
|
21588
|
+
});
|
|
21589
|
+
}
|
|
21590
|
+
if (roles) {
|
|
21591
|
+
actions.push({
|
|
21592
|
+
kind: "vault-roles",
|
|
21593
|
+
effectiveTs: roles.effectiveTs,
|
|
21594
|
+
expired: roles.expired,
|
|
21595
|
+
execute: async () => {
|
|
21596
|
+
const plan = await this.client.tx.setVaultConfig.getTx({
|
|
21597
|
+
curator: fulfillerAddress,
|
|
21598
|
+
vault
|
|
21599
|
+
});
|
|
21600
|
+
return this.execute(fulfiller, plan, dryRun, log);
|
|
21601
|
+
}
|
|
21602
|
+
});
|
|
21603
|
+
}
|
|
21604
|
+
for (const action of actions) {
|
|
21605
|
+
summary.pendingFound += 1;
|
|
21606
|
+
if (!action.expired) {
|
|
21607
|
+
summary.skippedNotExpired += 1;
|
|
21608
|
+
log(
|
|
21609
|
+
`Vault ${vault}: ${action.kind} due in ${action.effectiveTs - now}s`
|
|
21610
|
+
);
|
|
21611
|
+
continue;
|
|
21612
|
+
}
|
|
21613
|
+
if (!isFulfiller) {
|
|
21614
|
+
summary.skippedAuthorityMismatch += 1;
|
|
21615
|
+
log(
|
|
21616
|
+
`Vault ${vault}: skipping expired ${action.kind}; signer is not its active fulfiller`
|
|
21617
|
+
);
|
|
21618
|
+
continue;
|
|
21619
|
+
}
|
|
21620
|
+
try {
|
|
21621
|
+
log(
|
|
21622
|
+
`Vault ${vault}: ${dryRun ? "simulating" : "settling"} expired ${action.kind}`
|
|
21623
|
+
);
|
|
21624
|
+
const signature = await action.execute();
|
|
21625
|
+
summary.settled += 1;
|
|
21626
|
+
summary.records.push({
|
|
21627
|
+
vault,
|
|
21628
|
+
kind: action.kind,
|
|
21629
|
+
effectiveTs: action.effectiveTs,
|
|
21630
|
+
signature,
|
|
21631
|
+
dryRun
|
|
21632
|
+
});
|
|
21633
|
+
log(
|
|
21634
|
+
`Vault ${vault}: ${action.kind} ${dryRun ? "simulation passed" : `settled: ${signature}`}`
|
|
21635
|
+
);
|
|
21636
|
+
} catch (error) {
|
|
21637
|
+
summary.failed += 1;
|
|
21638
|
+
log(
|
|
21639
|
+
`Vault ${vault}: FAILED ${action.kind}: ${error instanceof Error ? error.message : String(error)}`
|
|
21640
|
+
);
|
|
21641
|
+
}
|
|
21642
|
+
}
|
|
21643
|
+
}
|
|
21644
|
+
return summary;
|
|
21645
|
+
}
|
|
21646
|
+
async execute(fulfiller, plan, dryRun, log) {
|
|
21647
|
+
if (!dryRun) return this.client.sendTransaction(fulfiller, plan);
|
|
21648
|
+
const simulation = await this.client.simulateTransaction(fulfiller, plan);
|
|
21649
|
+
for (const line of simulation.logs ?? []) log(` | ${line}`);
|
|
21650
|
+
if (simulation.err) {
|
|
21651
|
+
throw new Error(`simulation failed: ${JSON.stringify(simulation.err)}`);
|
|
21652
|
+
}
|
|
21653
|
+
return void 0;
|
|
21654
|
+
}
|
|
21655
|
+
};
|
|
21656
|
+
|
|
20566
21657
|
// src/index.ts
|
|
20567
|
-
var
|
|
21658
|
+
var import_common56 = __toESM(require_dist());
|
|
20568
21659
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20569
21660
|
0 && (module.exports = {
|
|
20570
21661
|
ASSET_DECIMALS,
|
|
20571
21662
|
ASSET_REBALANCE_COOLDOWN_SECS,
|
|
20572
21663
|
AccountClient,
|
|
20573
21664
|
ActivateCircuitBreakerBuilder,
|
|
21665
|
+
AddIncentiveRecipientBuilder,
|
|
20574
21666
|
BALANCE_CHANGE_BASELINE_MAX_AGE_SECS,
|
|
20575
21667
|
CONSENSUS_ORACLE_VARIANT,
|
|
21668
|
+
CancelIncentiveProposalBuilder,
|
|
20576
21669
|
CancelJuniorTrancheWithdrawBuilder,
|
|
20577
21670
|
ConsensusOracleService,
|
|
20578
21671
|
CrankNavBuilder,
|
|
20579
21672
|
CrankPerformanceFeesBuilder,
|
|
20580
21673
|
CreateAssetHoldingBuilder,
|
|
21674
|
+
CreateIncentiveBuilder,
|
|
20581
21675
|
CreateTrancheStateBuilder,
|
|
20582
21676
|
CreateVaultBuilder,
|
|
20583
21677
|
DEFAULT_CU_PRICE_MICRO_LAMPORTS,
|
|
@@ -20597,6 +21691,7 @@ var import_common53 = __toESM(require_dist());
|
|
|
20597
21691
|
DEFAULT_TARGET_LOCAL_BPS,
|
|
20598
21692
|
DEFAULT_VAULT_ID,
|
|
20599
21693
|
DisableCircuitBreakerBuilder,
|
|
21694
|
+
DistributeIncentiveBuilder,
|
|
20600
21695
|
EXTERNAL_POSITION_SAMPLES,
|
|
20601
21696
|
ExecuteDepositBuilder,
|
|
20602
21697
|
ExecuteShareSwapBuilder,
|
|
@@ -20623,6 +21718,7 @@ var import_common53 = __toESM(require_dist());
|
|
|
20623
21718
|
LivePriceSource,
|
|
20624
21719
|
MAX_BALANCE_CHANGE_BPS,
|
|
20625
21720
|
MAX_CONSENSUS_SIGNERS,
|
|
21721
|
+
MAX_INCENTIVE_RECIPIENTS,
|
|
20626
21722
|
MAX_MANAGER_WITHDRAW_DESTINATIONS,
|
|
20627
21723
|
MAX_PRICE_STALENESS_THRESHOLD_SECS,
|
|
20628
21724
|
MIN_EXTERNAL_POSITION_SAMPLES,
|
|
@@ -20652,13 +21748,16 @@ var import_common53 = __toESM(require_dist());
|
|
|
20652
21748
|
SYSTEM_PROGRAM,
|
|
20653
21749
|
SetAssetPriceOracleBuilder,
|
|
20654
21750
|
SetExternalLiquidityBuilder,
|
|
21751
|
+
SetIncentiveLimitsBuilder,
|
|
20655
21752
|
SetManagerWithdrawDestinationBuilder,
|
|
20656
21753
|
SetProtocolFeeBuilder,
|
|
20657
21754
|
SetVaultConfigBuilder,
|
|
20658
21755
|
SquadsProposalExecutionSimulationError,
|
|
20659
21756
|
StaticPositionProvider,
|
|
21757
|
+
SubmitIncentiveBuilder,
|
|
20660
21758
|
TOKEN_PROGRAM,
|
|
20661
21759
|
TOKEN_PROGRAM_ID,
|
|
21760
|
+
TimelockSettlementService,
|
|
20662
21761
|
TransactionClient,
|
|
20663
21762
|
USDC_MINT,
|
|
20664
21763
|
USD_STAR_JUNIOR_MINT,
|
|
@@ -20703,6 +21802,7 @@ var import_common53 = __toESM(require_dist());
|
|
|
20703
21802
|
createVaultClient,
|
|
20704
21803
|
createYieldPayment,
|
|
20705
21804
|
dateToStr,
|
|
21805
|
+
decodePendingConsensusSigners,
|
|
20706
21806
|
defaultKeypairPath,
|
|
20707
21807
|
deleteAccount,
|
|
20708
21808
|
discoverVaultsForSigner,
|
|
@@ -20720,6 +21820,9 @@ var import_common53 = __toESM(require_dist());
|
|
|
20720
21820
|
getAprYield,
|
|
20721
21821
|
getBalance,
|
|
20722
21822
|
getCashflows,
|
|
21823
|
+
getIncentiveRecipientShareAtas,
|
|
21824
|
+
getIncentiveRecipients,
|
|
21825
|
+
getIncentiveTotals,
|
|
20723
21826
|
getNavValue,
|
|
20724
21827
|
getRpcUrl,
|
|
20725
21828
|
getTotalOutstandingYield,
|