@perena/vault-sdk 1.0.47 → 1.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +191 -1
- package/dist/index.js +1136 -754
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -149,7 +149,7 @@ 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 = toKitInstruction35;
|
|
153
153
|
exports2.fromKitInstruction = fromKitInstruction3;
|
|
154
154
|
var kit_1 = require("@solana/kit");
|
|
155
155
|
var web3_js_1 = require("@solana/web3.js");
|
|
@@ -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 toKitInstruction35(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 = getAtaAddress20;
|
|
198
198
|
var spl_token_1 = require("@solana/spl-token");
|
|
199
199
|
var compat_1 = require_compat();
|
|
200
|
-
function
|
|
200
|
+
function getAtaAddress20(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
|
}
|
|
@@ -2844,12 +2844,12 @@ var require_routePreInstructions = __commonJS({
|
|
|
2844
2844
|
if (existingAta.value) {
|
|
2845
2845
|
continue;
|
|
2846
2846
|
}
|
|
2847
|
-
instructions2.push(
|
|
2847
|
+
instructions2.push(toKitInstruction35((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)));
|
|
2848
2848
|
postSuccessCacheInvalidations.push({ address: ata });
|
|
2849
2849
|
}
|
|
2850
2850
|
return { instructions: instructions2, postSuccessCacheInvalidations };
|
|
2851
2851
|
}
|
|
2852
|
-
function
|
|
2852
|
+
function toKitInstruction35(ix) {
|
|
2853
2853
|
return {
|
|
2854
2854
|
programAddress: ix.programId.toBase58(),
|
|
2855
2855
|
accounts: ix.keys.map((account) => ({
|
|
@@ -3281,16 +3281,19 @@ __export(index_exports, {
|
|
|
3281
3281
|
AccountClient: () => AccountClient,
|
|
3282
3282
|
ActivateCircuitBreakerBuilder: () => ActivateCircuitBreakerBuilder,
|
|
3283
3283
|
AddIncentiveRecipientBuilder: () => AddIncentiveRecipientBuilder,
|
|
3284
|
+
AddIncentiveRecipientV3Builder: () => AddIncentiveRecipientV3Builder,
|
|
3284
3285
|
BALANCE_CHANGE_BASELINE_MAX_AGE_SECS: () => BALANCE_CHANGE_BASELINE_MAX_AGE_SECS,
|
|
3285
3286
|
CONSENSUS_ORACLE_VARIANT: () => CONSENSUS_ORACLE_VARIANT,
|
|
3286
3287
|
CancelIncentiveProposalBuilder: () => CancelIncentiveProposalBuilder,
|
|
3287
3288
|
CancelJuniorTrancheWithdrawBuilder: () => CancelJuniorTrancheWithdrawBuilder,
|
|
3288
3289
|
ClaimIncentiveBuilder: () => ClaimIncentiveBuilder,
|
|
3290
|
+
ClaimIncentiveV3Builder: () => ClaimIncentiveV3Builder,
|
|
3289
3291
|
ConsensusOracleService: () => ConsensusOracleService,
|
|
3290
3292
|
CrankNavBuilder: () => CrankNavBuilder,
|
|
3291
3293
|
CrankPerformanceFeesBuilder: () => CrankPerformanceFeesBuilder,
|
|
3292
3294
|
CreateAssetHoldingBuilder: () => CreateAssetHoldingBuilder,
|
|
3293
3295
|
CreateIncentiveBuilder: () => CreateIncentiveBuilder,
|
|
3296
|
+
CreateIncentiveV3Builder: () => CreateIncentiveV3Builder,
|
|
3294
3297
|
CreateTrancheStateBuilder: () => CreateTrancheStateBuilder,
|
|
3295
3298
|
CreateVaultBuilder: () => CreateVaultBuilder,
|
|
3296
3299
|
DEFAULT_CU_PRICE_MICRO_LAMPORTS: () => DEFAULT_CU_PRICE_MICRO_LAMPORTS,
|
|
@@ -3299,7 +3302,7 @@ __export(index_exports, {
|
|
|
3299
3302
|
DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS: () => DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS,
|
|
3300
3303
|
DEFAULT_MAX_ACCEPTABLE_APY_BPS: () => DEFAULT_MAX_ACCEPTABLE_APY_BPS,
|
|
3301
3304
|
DEFAULT_MAX_ACCOUNTS: () => DEFAULT_MAX_ACCOUNTS,
|
|
3302
|
-
DEFAULT_MINTS: () =>
|
|
3305
|
+
DEFAULT_MINTS: () => import_common60.DEFAULT_MINTS,
|
|
3303
3306
|
DEFAULT_MIN_AMOUNT_UI: () => DEFAULT_MIN_AMOUNT_UI,
|
|
3304
3307
|
DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS: () => DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS,
|
|
3305
3308
|
DEFAULT_PRICE_ORACLE_ACCOUNT: () => DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
@@ -3311,6 +3314,7 @@ __export(index_exports, {
|
|
|
3311
3314
|
DEFAULT_VAULT_ID: () => DEFAULT_VAULT_ID,
|
|
3312
3315
|
DisableCircuitBreakerBuilder: () => DisableCircuitBreakerBuilder,
|
|
3313
3316
|
DistributeIncentiveBuilder: () => DistributeIncentiveBuilder,
|
|
3317
|
+
DistributeIncentiveV3Builder: () => DistributeIncentiveV3Builder,
|
|
3314
3318
|
EXTERNAL_POSITION_SAMPLES: () => EXTERNAL_POSITION_SAMPLES,
|
|
3315
3319
|
ExecuteDepositBuilder: () => ExecuteDepositBuilder,
|
|
3316
3320
|
ExecuteShareSwapBuilder: () => ExecuteShareSwapBuilder,
|
|
@@ -3338,13 +3342,14 @@ __export(index_exports, {
|
|
|
3338
3342
|
MAX_BALANCE_CHANGE_BPS: () => MAX_BALANCE_CHANGE_BPS,
|
|
3339
3343
|
MAX_CONSENSUS_SIGNERS: () => MAX_CONSENSUS_SIGNERS,
|
|
3340
3344
|
MAX_INCENTIVE_RECIPIENTS: () => MAX_INCENTIVE_RECIPIENTS,
|
|
3345
|
+
MAX_INCENTIVE_REPORT_TTL: () => MAX_INCENTIVE_REPORT_TTL,
|
|
3341
3346
|
MAX_MANAGER_WITHDRAW_DESTINATIONS: () => MAX_MANAGER_WITHDRAW_DESTINATIONS,
|
|
3342
3347
|
MAX_PRICE_STALENESS_THRESHOLD_SECS: () => MAX_PRICE_STALENESS_THRESHOLD_SECS,
|
|
3343
3348
|
MIN_EXTERNAL_POSITION_SAMPLES: () => MIN_EXTERNAL_POSITION_SAMPLES,
|
|
3344
3349
|
ManagerRedepositAssetBuilder: () => ManagerRedepositAssetBuilder,
|
|
3345
3350
|
ManagerWithdrawAssetBuilder: () => ManagerWithdrawAssetBuilder,
|
|
3346
3351
|
MarginfiPositionProvider: () => MarginfiPositionProvider,
|
|
3347
|
-
MintRegistry: () =>
|
|
3352
|
+
MintRegistry: () => import_common60.MintRegistry,
|
|
3348
3353
|
MockYieldTracker: () => MockYieldTracker,
|
|
3349
3354
|
NEST_API_BASE_URL: () => import_nest2.NEST_API_BASE_URL,
|
|
3350
3355
|
NEST_RWA_SHARE_MINT: () => NEST_RWA_SHARE_MINT,
|
|
@@ -3355,7 +3360,7 @@ __export(index_exports, {
|
|
|
3355
3360
|
ORACLE_ENTRY_SIZE: () => ORACLE_ENTRY_SIZE,
|
|
3356
3361
|
ORACLE_SETTLED_NAV_TS_OFFSET: () => ORACLE_SETTLED_NAV_TS_OFFSET,
|
|
3357
3362
|
OracleService: () => OracleService,
|
|
3358
|
-
PRICE_ORACLE_TYPES_BY_INDEX: () =>
|
|
3363
|
+
PRICE_ORACLE_TYPES_BY_INDEX: () => PRICE_ORACLE_TYPES_BY_INDEX,
|
|
3359
3364
|
PROGRAM_FEE_EXEMPT_OWNER_WHITELIST: () => PROGRAM_FEE_EXEMPT_OWNER_WHITELIST,
|
|
3360
3365
|
PROTOCOL_ADMIN: () => PROTOCOL_ADMIN,
|
|
3361
3366
|
PROTOCOL_FEE_RECIPIENT: () => PROTOCOL_FEE_RECIPIENT,
|
|
@@ -3363,15 +3368,18 @@ __export(index_exports, {
|
|
|
3363
3368
|
ProtocolInteractionBuilder: () => ProtocolInteractionBuilder,
|
|
3364
3369
|
REPORTABLE_ORACLE_VARIANTS: () => REPORTABLE_ORACLE_VARIANTS,
|
|
3365
3370
|
RemoveAssetHoldingBuilder: () => RemoveAssetHoldingBuilder,
|
|
3371
|
+
ReportIncentiveV3Builder: () => ReportIncentiveV3Builder,
|
|
3366
3372
|
RequestJuniorTrancheWithdrawBuilder: () => RequestJuniorTrancheWithdrawBuilder,
|
|
3367
3373
|
SHARE_DECIMALS: () => SHARE_DECIMALS,
|
|
3368
|
-
SYSTEM_PROGRAM: () =>
|
|
3374
|
+
SYSTEM_PROGRAM: () => SYSTEM_PROGRAM,
|
|
3369
3375
|
SetAssetPriceOracleBuilder: () => SetAssetPriceOracleBuilder,
|
|
3370
3376
|
SetExternalLiquidityBuilder: () => SetExternalLiquidityBuilder,
|
|
3371
3377
|
SetIncentiveLimitsBuilder: () => SetIncentiveLimitsBuilder,
|
|
3378
|
+
SetIncentiveLimitsV3Builder: () => SetIncentiveLimitsV3Builder,
|
|
3372
3379
|
SetManagerWithdrawDestinationBuilder: () => SetManagerWithdrawDestinationBuilder,
|
|
3373
3380
|
SetProtocolFeeBuilder: () => SetProtocolFeeBuilder,
|
|
3374
3381
|
SetVaultConfigBuilder: () => SetVaultConfigBuilder,
|
|
3382
|
+
SettleIncentiveV3Builder: () => SettleIncentiveV3Builder,
|
|
3375
3383
|
SquadsProposalExecutionSimulationError: () => SquadsProposalExecutionSimulationError,
|
|
3376
3384
|
StaticPositionProvider: () => StaticPositionProvider,
|
|
3377
3385
|
SubmitIncentiveBuilder: () => SubmitIncentiveBuilder,
|
|
@@ -3448,6 +3456,10 @@ __export(index_exports, {
|
|
|
3448
3456
|
getIncentiveRecipients: () => getIncentiveRecipients,
|
|
3449
3457
|
getIncentiveReportRecipients: () => getIncentiveReportRecipients,
|
|
3450
3458
|
getIncentiveTotals: () => getIncentiveTotals,
|
|
3459
|
+
getIncentiveV3OracleState: () => getIncentiveV3OracleState,
|
|
3460
|
+
getIncentiveV3RecipientShareAtas: () => getIncentiveV3RecipientShareAtas,
|
|
3461
|
+
getIncentiveV3Recipients: () => getIncentiveV3Recipients,
|
|
3462
|
+
getIncentiveV3Totals: () => getIncentiveV3Totals,
|
|
3451
3463
|
getNavValue: () => getNavValue,
|
|
3452
3464
|
getRpcUrl: () => getRpcUrl,
|
|
3453
3465
|
getTotalOutstandingYield: () => getTotalOutstandingYield,
|
|
@@ -3467,7 +3479,7 @@ __export(index_exports, {
|
|
|
3467
3479
|
logProspectiveApy: () => logProspectiveApy,
|
|
3468
3480
|
makeProvider: () => makeProvider,
|
|
3469
3481
|
mintTokensTo: () => mintTokensTo,
|
|
3470
|
-
mints: () =>
|
|
3482
|
+
mints: () => import_common60.mints,
|
|
3471
3483
|
mostFrequent: () => mostFrequent,
|
|
3472
3484
|
parseExternalLiquidityRefs: () => parseExternalLiquidityRefs,
|
|
3473
3485
|
planRebalance: () => planRebalance,
|
|
@@ -3567,16 +3579,16 @@ var USD_STAR_PRINCIPAL_MINT = (0, import_kit.address)(
|
|
|
3567
3579
|
var import_fs = __toESM(require("fs"));
|
|
3568
3580
|
var import_os = __toESM(require("os"));
|
|
3569
3581
|
var import_path = __toESM(require("path"));
|
|
3570
|
-
var
|
|
3571
|
-
var
|
|
3582
|
+
var import_core20 = require("@anchor-lang/core");
|
|
3583
|
+
var import_web323 = require("@solana/web3.js");
|
|
3572
3584
|
var import_kit10 = require("@solana/kit");
|
|
3573
|
-
var
|
|
3585
|
+
var import_common43 = __toESM(require_dist());
|
|
3574
3586
|
|
|
3575
3587
|
// src/client/client.ts
|
|
3576
|
-
var
|
|
3588
|
+
var import_core19 = require("@anchor-lang/core");
|
|
3577
3589
|
var import_kit9 = require("@solana/kit");
|
|
3578
|
-
var
|
|
3579
|
-
var
|
|
3590
|
+
var import_web322 = require("@solana/web3.js");
|
|
3591
|
+
var import_common42 = __toESM(require_dist());
|
|
3580
3592
|
|
|
3581
3593
|
// src/idl/vault.ts
|
|
3582
3594
|
var IDL = {
|
|
@@ -13644,6 +13656,36 @@ var AccountClient = class extends import_common.BaseAccountClient {
|
|
|
13644
13656
|
this.program = program;
|
|
13645
13657
|
this.pda = pda;
|
|
13646
13658
|
}
|
|
13659
|
+
/** Always fresh: report sequences, generations, USD and share counters must not be cached. */
|
|
13660
|
+
async fetchIncentiveV3(incentive) {
|
|
13661
|
+
return this.program.account.vaultIncentiveV3.fetch((0, import_common.toWeb3Pk)(incentive));
|
|
13662
|
+
}
|
|
13663
|
+
async fetchIncentiveV3Nullable(incentive) {
|
|
13664
|
+
return this.program.account.vaultIncentiveV3.fetchNullable(
|
|
13665
|
+
(0, import_common.toWeb3Pk)(incentive)
|
|
13666
|
+
);
|
|
13667
|
+
}
|
|
13668
|
+
async fetchIncentiveV3ForVault(vault, id) {
|
|
13669
|
+
const [incentive] = await this.pda.deriveIncentiveV3Pda(vault, id);
|
|
13670
|
+
return this.fetchIncentiveV3(incentive);
|
|
13671
|
+
}
|
|
13672
|
+
/** Fresh batch lookup preserving input order, duplicates, and missing entries. */
|
|
13673
|
+
async fetchIncentivesV3(incentives) {
|
|
13674
|
+
if (incentives.length === 0) return [];
|
|
13675
|
+
return this.program.account.vaultIncentiveV3.fetchMultiple(
|
|
13676
|
+
incentives.map(import_common.toWeb3Pk)
|
|
13677
|
+
);
|
|
13678
|
+
}
|
|
13679
|
+
/** V3 campaigns only; the discriminator excludes legacy share-denominated accounts. */
|
|
13680
|
+
async fetchAllIncentivesV3ForVault(vault) {
|
|
13681
|
+
const accounts2 = await this.program.account.vaultIncentiveV3.all([
|
|
13682
|
+
{ memcmp: { offset: 8, bytes: vault } }
|
|
13683
|
+
]);
|
|
13684
|
+
return accounts2.map(({ publicKey, account }) => ({
|
|
13685
|
+
publicKey: (0, import_common.fromWeb3Pk)(publicKey),
|
|
13686
|
+
account
|
|
13687
|
+
}));
|
|
13688
|
+
}
|
|
13647
13689
|
/** Always fresh: callers use the proposal round and cumulative entitlements. */
|
|
13648
13690
|
async fetchIncentive(incentive) {
|
|
13649
13691
|
return this.program.account.vaultIncentive.fetch((0, import_common.toWeb3Pk)(incentive));
|
|
@@ -13820,6 +13862,17 @@ var PdaClient = class {
|
|
|
13820
13862
|
seeds: [Buffer.from("incentive"), addressEncoder.encode(vault), bytes]
|
|
13821
13863
|
});
|
|
13822
13864
|
}
|
|
13865
|
+
/** Separate V3 namespace: `["incentive_v3", vault, id_u64_le]`. */
|
|
13866
|
+
async deriveIncentiveV3Pda(vault, id) {
|
|
13867
|
+
if (id < 0n || id > 0xffffffffffffffffn)
|
|
13868
|
+
throw new RangeError("Incentive ID must fit u64");
|
|
13869
|
+
const bytes = new Uint8Array(8);
|
|
13870
|
+
new DataView(bytes.buffer).setBigUint64(0, id, true);
|
|
13871
|
+
return (0, import_kit3.getProgramDerivedAddress)({
|
|
13872
|
+
programAddress: this.programAddress,
|
|
13873
|
+
seeds: [Buffer.from("incentive_v3"), addressEncoder.encode(vault), bytes]
|
|
13874
|
+
});
|
|
13875
|
+
}
|
|
13823
13876
|
/**
|
|
13824
13877
|
* Vault PDA for a global vault id.
|
|
13825
13878
|
*
|
|
@@ -14522,25 +14575,360 @@ var ClaimIncentiveBuilder = class extends VaultBuilderBase {
|
|
|
14522
14575
|
}
|
|
14523
14576
|
};
|
|
14524
14577
|
|
|
14525
|
-
// src/client/builders/
|
|
14526
|
-
var
|
|
14578
|
+
// src/client/builders/incentivesV3.ts
|
|
14579
|
+
var import_core2 = require("@anchor-lang/core");
|
|
14527
14580
|
var import_web35 = require("@solana/web3.js");
|
|
14528
14581
|
var import_common6 = __toESM(require_dist());
|
|
14529
|
-
var
|
|
14582
|
+
var u64 = (value) => {
|
|
14583
|
+
if (value < 0n || value > 0xffffffffffffffffn)
|
|
14584
|
+
throw new RangeError("Incentive value must fit u64");
|
|
14585
|
+
return new import_core2.BN(value.toString());
|
|
14586
|
+
};
|
|
14587
|
+
function validateIndices(indices) {
|
|
14588
|
+
if (indices.length === 0 || indices.length > MAX_INCENTIVE_RECIPIENTS || new Set(indices).size !== indices.length || indices.some(
|
|
14589
|
+
(index) => !Number.isInteger(index) || index < 0 || index >= MAX_INCENTIVE_RECIPIENTS
|
|
14590
|
+
))
|
|
14591
|
+
throw new RangeError(
|
|
14592
|
+
"Supply distinct incentive recipient indices from 0 to 4"
|
|
14593
|
+
);
|
|
14594
|
+
}
|
|
14595
|
+
var CreateIncentiveV3Builder = class extends VaultBuilderBase {
|
|
14530
14596
|
async getIx(args) {
|
|
14531
|
-
return this.program.methods.
|
|
14532
|
-
|
|
14533
|
-
|
|
14597
|
+
return this.program.methods.createIncentiveV3({
|
|
14598
|
+
id: u64(args.id),
|
|
14599
|
+
recipients: args.recipients.map(import_common6.toWeb3Pk),
|
|
14600
|
+
maxTotalUsd: u64(args.maxTotalUsd)
|
|
14601
|
+
}).accountsStrict({
|
|
14602
|
+
oracle: (0, import_common6.toWeb3Pk)(args.oracle),
|
|
14534
14603
|
vault: (0, import_common6.toWeb3Pk)(args.vault),
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
userInputAta: (0, import_common6.toWeb3Pk)(args.userInputAta),
|
|
14538
|
-
queueInputAta: (0, import_common6.toWeb3Pk)(args.queueInputAta),
|
|
14539
|
-
shareTokenProgram: (0, import_common6.toWeb3Pk)(args.shareTokenProgram),
|
|
14540
|
-
associatedTokenProgram: import_spl_token4.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
14604
|
+
vaultOracle: (0, import_common6.toWeb3Pk)(args.vaultOracle),
|
|
14605
|
+
incentive: (0, import_common6.toWeb3Pk)(args.incentive),
|
|
14541
14606
|
systemProgram: import_web35.SystemProgram.programId
|
|
14542
14607
|
}).instruction().then(import_common6.toKitInstruction);
|
|
14543
14608
|
}
|
|
14609
|
+
async deriveIxArgs(args) {
|
|
14610
|
+
const [incentive] = await this.pda.deriveIncentiveV3Pda(
|
|
14611
|
+
args.vault,
|
|
14612
|
+
args.id
|
|
14613
|
+
);
|
|
14614
|
+
const [vaultOracle] = await this.pda.deriveVaultOraclePda(args.vault);
|
|
14615
|
+
return { ...args, incentive, vaultOracle };
|
|
14616
|
+
}
|
|
14617
|
+
async buildPlanExtras(args) {
|
|
14618
|
+
return {
|
|
14619
|
+
postSuccessCacheInvalidations: [
|
|
14620
|
+
{ vaultPda: args.vault, vaultOraclePda: args.vaultOracle }
|
|
14621
|
+
]
|
|
14622
|
+
};
|
|
14623
|
+
}
|
|
14624
|
+
};
|
|
14625
|
+
var AddIncentiveRecipientV3Builder = class extends VaultBuilderBase {
|
|
14626
|
+
async getIx(args) {
|
|
14627
|
+
return this.program.methods.addIncentiveRecipientV3((0, import_common6.toWeb3Pk)(args.wallet)).accountsStrict({
|
|
14628
|
+
oracle: (0, import_common6.toWeb3Pk)(args.oracle),
|
|
14629
|
+
vault: (0, import_common6.toWeb3Pk)(args.vault),
|
|
14630
|
+
vaultOracle: (0, import_common6.toWeb3Pk)(args.vaultOracle),
|
|
14631
|
+
incentive: (0, import_common6.toWeb3Pk)(args.incentive)
|
|
14632
|
+
}).instruction().then(import_common6.toKitInstruction);
|
|
14633
|
+
}
|
|
14634
|
+
async deriveIxArgs(args) {
|
|
14635
|
+
const [vaultOracle] = await this.pda.deriveVaultOraclePda(args.vault);
|
|
14636
|
+
return { ...args, vaultOracle };
|
|
14637
|
+
}
|
|
14638
|
+
async buildPlanExtras(args) {
|
|
14639
|
+
return {
|
|
14640
|
+
postSuccessCacheInvalidations: [
|
|
14641
|
+
{ vaultPda: args.vault, vaultOraclePda: args.vaultOracle }
|
|
14642
|
+
]
|
|
14643
|
+
};
|
|
14644
|
+
}
|
|
14645
|
+
};
|
|
14646
|
+
var SetIncentiveLimitsV3Builder = class extends VaultBuilderBase {
|
|
14647
|
+
async getIx(args) {
|
|
14648
|
+
return this.program.methods.setIncentiveLimitsV3({
|
|
14649
|
+
maxTotalUsd: u64(args.maxTotalUsd),
|
|
14650
|
+
maxSurplusValue: u64(args.maxSurplusValue),
|
|
14651
|
+
minSurplusReserve: u64(args.minSurplusReserve)
|
|
14652
|
+
}).accountsStrict({
|
|
14653
|
+
curator: (0, import_common6.toWeb3Pk)(args.curator),
|
|
14654
|
+
vault: (0, import_common6.toWeb3Pk)(args.vault),
|
|
14655
|
+
incentive: (0, import_common6.toWeb3Pk)(args.incentive)
|
|
14656
|
+
}).instruction().then(import_common6.toKitInstruction);
|
|
14657
|
+
}
|
|
14658
|
+
async buildPlanExtras(args) {
|
|
14659
|
+
return { postSuccessCacheInvalidations: [{ vaultPda: args.vault }] };
|
|
14660
|
+
}
|
|
14661
|
+
};
|
|
14662
|
+
var ReportIncentiveV3Builder = class extends VaultBuilderBase {
|
|
14663
|
+
async getIx(args) {
|
|
14664
|
+
validateIndices(args.updates.map((update) => update.recipientIndex));
|
|
14665
|
+
if (args.sequence <= 0n)
|
|
14666
|
+
throw new RangeError("Incentive sequence must be positive");
|
|
14667
|
+
if (args.expiresAt < -0x8000000000000000n || args.expiresAt > 0x7fffffffffffffffn)
|
|
14668
|
+
throw new RangeError("Incentive expiry must fit i64");
|
|
14669
|
+
return this.program.methods.reportIncentiveV3({
|
|
14670
|
+
signerGeneration: u64(args.signerGeneration),
|
|
14671
|
+
configGeneration: u64(args.configGeneration),
|
|
14672
|
+
sequence: u64(args.sequence),
|
|
14673
|
+
expiresAt: new import_core2.BN(args.expiresAt.toString()),
|
|
14674
|
+
updates: args.updates.map((update) => ({
|
|
14675
|
+
recipientIndex: update.recipientIndex,
|
|
14676
|
+
totalUsd: u64(update.totalUsd)
|
|
14677
|
+
}))
|
|
14678
|
+
}).accountsStrict({
|
|
14679
|
+
oracle: (0, import_common6.toWeb3Pk)(args.oracle),
|
|
14680
|
+
vault: (0, import_common6.toWeb3Pk)(args.vault),
|
|
14681
|
+
vaultOracle: (0, import_common6.toWeb3Pk)(args.vaultOracle),
|
|
14682
|
+
incentive: (0, import_common6.toWeb3Pk)(args.incentive)
|
|
14683
|
+
}).instruction().then(import_common6.toKitInstruction);
|
|
14684
|
+
}
|
|
14685
|
+
async deriveIxArgs(args) {
|
|
14686
|
+
const [vaultOracle] = await this.pda.deriveVaultOraclePda(args.vault);
|
|
14687
|
+
return { ...args, vaultOracle };
|
|
14688
|
+
}
|
|
14689
|
+
async buildPlanExtras(args) {
|
|
14690
|
+
return {
|
|
14691
|
+
postSuccessCacheInvalidations: [
|
|
14692
|
+
{ vaultPda: args.vault, vaultOraclePda: args.vaultOracle }
|
|
14693
|
+
]
|
|
14694
|
+
};
|
|
14695
|
+
}
|
|
14696
|
+
};
|
|
14697
|
+
var SettleIncentiveV3Builder = class extends VaultBuilderBase {
|
|
14698
|
+
async getIx(args) {
|
|
14699
|
+
validateIndices(args.recipientIndices);
|
|
14700
|
+
return this.program.methods.settleIncentiveV3(Buffer.from(args.recipientIndices)).accountsStrict({
|
|
14701
|
+
cranker: (0, import_common6.toWeb3Pk)(args.cranker),
|
|
14702
|
+
vault: (0, import_common6.toWeb3Pk)(args.vault),
|
|
14703
|
+
incentive: (0, import_common6.toWeb3Pk)(args.incentive),
|
|
14704
|
+
vaultOracle: (0, import_common6.toWeb3Pk)(args.vaultOracle),
|
|
14705
|
+
shareMint: (0, import_common6.toWeb3Pk)(args.shareMint),
|
|
14706
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common6.toWeb3Pk)(args.vaultTrancheState) : null,
|
|
14707
|
+
juniorTrancheShareMint: args.juniorTrancheShareMint ? (0, import_common6.toWeb3Pk)(args.juniorTrancheShareMint) : null,
|
|
14708
|
+
seniorTrancheShareMint: args.seniorTrancheShareMint ? (0, import_common6.toWeb3Pk)(args.seniorTrancheShareMint) : null
|
|
14709
|
+
}).instruction().then(import_common6.toKitInstruction);
|
|
14710
|
+
}
|
|
14711
|
+
async deriveIxArgs(args) {
|
|
14712
|
+
const [vaultOracle] = await this.pda.deriveVaultOraclePda(args.vault);
|
|
14713
|
+
const vault = await this.account.fetchVault(args.vault, { fresh: true });
|
|
14714
|
+
const vaultTrancheState = await resolveVaultTrancheState(
|
|
14715
|
+
this.account,
|
|
14716
|
+
this.pda,
|
|
14717
|
+
args.vault,
|
|
14718
|
+
void 0
|
|
14719
|
+
);
|
|
14720
|
+
const tranche = vaultTrancheState ? await this.account.fetchVaultTrancheState(vaultTrancheState, {
|
|
14721
|
+
fresh: true
|
|
14722
|
+
}) : null;
|
|
14723
|
+
return {
|
|
14724
|
+
...args,
|
|
14725
|
+
vaultOracle,
|
|
14726
|
+
shareMint: (0, import_common6.fromWeb3Pk)(vault.mint),
|
|
14727
|
+
vaultTrancheState,
|
|
14728
|
+
juniorTrancheShareMint: tranche ? (0, import_common6.fromWeb3Pk)(tranche.config.juniorMint) : null,
|
|
14729
|
+
seniorTrancheShareMint: tranche ? (0, import_common6.fromWeb3Pk)(tranche.config.seniorMint) : null
|
|
14730
|
+
};
|
|
14731
|
+
}
|
|
14732
|
+
async buildPlanExtras(args) {
|
|
14733
|
+
return {
|
|
14734
|
+
postSuccessCacheInvalidations: [
|
|
14735
|
+
{
|
|
14736
|
+
vaultPda: args.vault,
|
|
14737
|
+
vaultOraclePda: args.vaultOracle,
|
|
14738
|
+
vaultTrancheStatePda: args.vaultTrancheState ?? void 0
|
|
14739
|
+
}
|
|
14740
|
+
]
|
|
14741
|
+
};
|
|
14742
|
+
}
|
|
14743
|
+
};
|
|
14744
|
+
|
|
14745
|
+
// src/client/builders/incentivesV3Claims.ts
|
|
14746
|
+
var import_common8 = __toESM(require_dist());
|
|
14747
|
+
|
|
14748
|
+
// src/utils/incentivesV3.ts
|
|
14749
|
+
var import_web36 = require("@solana/web3.js");
|
|
14750
|
+
var import_common7 = __toESM(require_dist());
|
|
14751
|
+
|
|
14752
|
+
// src/services/consensusOracle/constants.ts
|
|
14753
|
+
var SYSTEM_PROGRAM = "11111111111111111111111111111111";
|
|
14754
|
+
var PRICE_ORACLE_TYPES_BY_INDEX = [
|
|
14755
|
+
"none",
|
|
14756
|
+
"consensusOracle",
|
|
14757
|
+
"pyth",
|
|
14758
|
+
"perenaVault"
|
|
14759
|
+
];
|
|
14760
|
+
var CONSENSUS_ORACLE_VARIANT = "consensusoracle";
|
|
14761
|
+
var LIVE_ORACLE_VARIANTS = /* @__PURE__ */ new Set(["pyth", "perenavault"]);
|
|
14762
|
+
var REPORTABLE_ORACLE_VARIANTS = /* @__PURE__ */ new Set([
|
|
14763
|
+
CONSENSUS_ORACLE_VARIANT,
|
|
14764
|
+
...LIVE_ORACLE_VARIANTS
|
|
14765
|
+
]);
|
|
14766
|
+
var LIVE_PRICE_REFRESH_INTERVAL_SECS = 60n * 60n;
|
|
14767
|
+
var DEFAULT_PRICE_STALENESS_SECS = BigInt(
|
|
14768
|
+
DEFAULT_PRICE_STALENESS_THRESHOLD_SECS
|
|
14769
|
+
);
|
|
14770
|
+
var EXTERNAL_POSITION_SAMPLES = 5;
|
|
14771
|
+
var MIN_EXTERNAL_POSITION_SAMPLES = 4;
|
|
14772
|
+
var ORACLE_ENTRY_SIZE = 272;
|
|
14773
|
+
var ORACLE_ENTRIES_OFFSET = 40;
|
|
14774
|
+
var ORACLE_SETTLED_NAV_TS_OFFSET = 8;
|
|
14775
|
+
var MAX_CONSENSUS_SIGNERS = 4;
|
|
14776
|
+
|
|
14777
|
+
// src/utils/incentivesV3.ts
|
|
14778
|
+
var MAX_INCENTIVE_REPORT_TTL = 86400n;
|
|
14779
|
+
function getIncentiveV3OracleState(oracle, now) {
|
|
14780
|
+
const data = Buffer.from(oracle.data);
|
|
14781
|
+
if (!("consensusOracle" in oracle.oracleType) || data.length !== 2048)
|
|
14782
|
+
throw new RangeError(
|
|
14783
|
+
"Expected a consensus oracle with a 2048-byte payload"
|
|
14784
|
+
);
|
|
14785
|
+
const pendingOffset = ORACLE_ENTRIES_OFFSET + MAX_CONSENSUS_SIGNERS * ORACLE_ENTRY_SIZE;
|
|
14786
|
+
const pendingTimestampOffset = pendingOffset + MAX_CONSENSUS_SIGNERS * 32;
|
|
14787
|
+
const pendingCount = data[pendingTimestampOffset + 8];
|
|
14788
|
+
if (pendingCount > MAX_CONSENSUS_SIGNERS)
|
|
14789
|
+
throw new RangeError("Invalid pending oracle signer count");
|
|
14790
|
+
const matured = pendingCount > 0 && data.readBigInt64LE(pendingTimestampOffset) <= now;
|
|
14791
|
+
const signers = [0, 1].map((index) => {
|
|
14792
|
+
if (matured && index >= pendingCount) return (0, import_common7.fromWeb3Pk)(import_web36.PublicKey.default);
|
|
14793
|
+
const offset = matured ? pendingOffset + index * 32 : ORACLE_ENTRIES_OFFSET + index * ORACLE_ENTRY_SIZE;
|
|
14794
|
+
return (0, import_common7.fromWeb3Pk)(new import_web36.PublicKey(data.subarray(offset, offset + 32)));
|
|
14795
|
+
});
|
|
14796
|
+
if (signers.includes((0, import_common7.fromWeb3Pk)(import_web36.PublicKey.default)) || signers[0] === signers[1])
|
|
14797
|
+
throw new RangeError(
|
|
14798
|
+
"Incentives require two distinct nonzero oracle signers"
|
|
14799
|
+
);
|
|
14800
|
+
const signerGeneration = data.readBigUInt64LE(data.length - 8) + (matured ? 1n : 0n);
|
|
14801
|
+
if (signerGeneration > 0xffffffffffffffffn)
|
|
14802
|
+
throw new RangeError("Oracle signer generation overflow");
|
|
14803
|
+
return { signers, signerGeneration };
|
|
14804
|
+
}
|
|
14805
|
+
function getIncentiveV3Recipients(incentive) {
|
|
14806
|
+
const count = incentive.recipientCount;
|
|
14807
|
+
if (incentive.version !== 3)
|
|
14808
|
+
throw new RangeError("Expected a V3 incentive account");
|
|
14809
|
+
if (!Number.isInteger(count) || count < 0 || count > MAX_INCENTIVE_RECIPIENTS || count > incentive.recipients.length)
|
|
14810
|
+
throw new RangeError("Invalid incentive recipient count");
|
|
14811
|
+
return incentive.recipients.slice(0, count).map((entry, recipientIndex) => {
|
|
14812
|
+
const settledShares = BigInt(entry.settledShares.toString());
|
|
14813
|
+
const claimedShares = BigInt(entry.claimedShares.toString());
|
|
14814
|
+
return {
|
|
14815
|
+
recipientIndex,
|
|
14816
|
+
wallet: (0, import_common7.fromWeb3Pk)(entry.wallet),
|
|
14817
|
+
oracleTotalUsd: [
|
|
14818
|
+
BigInt(entry.oracleTotalUsd[0].toString()),
|
|
14819
|
+
BigInt(entry.oracleTotalUsd[1].toString())
|
|
14820
|
+
],
|
|
14821
|
+
expiresAt: [
|
|
14822
|
+
BigInt(entry.expiresAt[0].toString()),
|
|
14823
|
+
BigInt(entry.expiresAt[1].toString())
|
|
14824
|
+
],
|
|
14825
|
+
settledUsd: BigInt(entry.settledUsd.toString()),
|
|
14826
|
+
settledShares,
|
|
14827
|
+
claimedShares,
|
|
14828
|
+
outstandingShares: settledShares - claimedShares
|
|
14829
|
+
};
|
|
14830
|
+
});
|
|
14831
|
+
}
|
|
14832
|
+
function getIncentiveV3Totals(incentive) {
|
|
14833
|
+
return getIncentiveV3Recipients(incentive).reduce(
|
|
14834
|
+
(totals, recipient) => ({
|
|
14835
|
+
settledUsd: totals.settledUsd + recipient.settledUsd,
|
|
14836
|
+
settledShares: totals.settledShares + recipient.settledShares,
|
|
14837
|
+
claimedShares: totals.claimedShares + recipient.claimedShares,
|
|
14838
|
+
outstandingShares: totals.outstandingShares + recipient.outstandingShares
|
|
14839
|
+
}),
|
|
14840
|
+
{
|
|
14841
|
+
settledUsd: 0n,
|
|
14842
|
+
settledShares: 0n,
|
|
14843
|
+
claimedShares: 0n,
|
|
14844
|
+
outstandingShares: 0n
|
|
14845
|
+
}
|
|
14846
|
+
);
|
|
14847
|
+
}
|
|
14848
|
+
function getIncentiveV3RecipientShareAtas(incentive, shareMint, shareTokenProgram) {
|
|
14849
|
+
return getIncentiveV3Recipients(incentive).map(
|
|
14850
|
+
({ wallet }) => (0, import_common7.getAtaAddress)(shareMint, wallet, shareTokenProgram, true)
|
|
14851
|
+
);
|
|
14852
|
+
}
|
|
14853
|
+
|
|
14854
|
+
// src/client/builders/incentivesV3Claims.ts
|
|
14855
|
+
var ClaimIncentiveV3Builder = class extends ClaimIncentiveBuilder {
|
|
14856
|
+
async getIx(args) {
|
|
14857
|
+
return this.program.methods.claimIncentiveV3().accountsStrict({
|
|
14858
|
+
recipient: (0, import_common8.toWeb3Pk)(args.recipient),
|
|
14859
|
+
vault: (0, import_common8.toWeb3Pk)(args.vault),
|
|
14860
|
+
incentive: (0, import_common8.toWeb3Pk)(args.incentive),
|
|
14861
|
+
shareMint: (0, import_common8.toWeb3Pk)(args.shareMint),
|
|
14862
|
+
shareTokenProgram: (0, import_common8.toWeb3Pk)(args.shareTokenProgram),
|
|
14863
|
+
recipientShareAta: (0, import_common8.toWeb3Pk)(args.recipientShareAta)
|
|
14864
|
+
}).instruction().then(import_common8.toKitInstruction);
|
|
14865
|
+
}
|
|
14866
|
+
};
|
|
14867
|
+
var DistributeIncentiveV3Builder = class extends DistributeIncentiveBuilder {
|
|
14868
|
+
async getIx(args) {
|
|
14869
|
+
return this.program.methods.distributeIncentiveV3().accountsStrict({
|
|
14870
|
+
cranker: (0, import_common8.toWeb3Pk)(args.cranker),
|
|
14871
|
+
vault: (0, import_common8.toWeb3Pk)(args.vault),
|
|
14872
|
+
incentive: (0, import_common8.toWeb3Pk)(args.incentive),
|
|
14873
|
+
shareMint: (0, import_common8.toWeb3Pk)(args.shareMint),
|
|
14874
|
+
shareTokenProgram: (0, import_common8.toWeb3Pk)(args.shareTokenProgram)
|
|
14875
|
+
}).remainingAccounts([
|
|
14876
|
+
...args.recipientShareAtas.map((ata) => ({
|
|
14877
|
+
pubkey: (0, import_common8.toWeb3Pk)(ata),
|
|
14878
|
+
isWritable: true,
|
|
14879
|
+
isSigner: false
|
|
14880
|
+
})),
|
|
14881
|
+
...(args.recipientSigners ?? args.recipients).map((wallet) => ({
|
|
14882
|
+
pubkey: (0, import_common8.toWeb3Pk)(wallet),
|
|
14883
|
+
isWritable: false,
|
|
14884
|
+
isSigner: true
|
|
14885
|
+
}))
|
|
14886
|
+
]).instruction().then(import_common8.toKitInstruction);
|
|
14887
|
+
}
|
|
14888
|
+
async deriveIxArgs(args) {
|
|
14889
|
+
const [vault, incentive] = await Promise.all([
|
|
14890
|
+
this.account.fetchVault(args.vault, { fresh: true }),
|
|
14891
|
+
this.account.fetchIncentiveV3(args.incentive)
|
|
14892
|
+
]);
|
|
14893
|
+
const shareMint = (0, import_common8.fromWeb3Pk)(vault.mint);
|
|
14894
|
+
const shareTokenProgram = tokenProgramAddressFromIdlEnum(
|
|
14895
|
+
vault.mintTokenProgram
|
|
14896
|
+
);
|
|
14897
|
+
const recipients = getIncentiveV3Recipients(incentive);
|
|
14898
|
+
return {
|
|
14899
|
+
...args,
|
|
14900
|
+
shareMint,
|
|
14901
|
+
shareTokenProgram,
|
|
14902
|
+
recipients: recipients.map(({ wallet }) => wallet),
|
|
14903
|
+
recipientSigners: recipients.filter((entry) => entry.outstandingShares > 0n).map(({ wallet }) => wallet),
|
|
14904
|
+
recipientShareAtas: getIncentiveV3RecipientShareAtas(
|
|
14905
|
+
incentive,
|
|
14906
|
+
shareMint,
|
|
14907
|
+
shareTokenProgram
|
|
14908
|
+
)
|
|
14909
|
+
};
|
|
14910
|
+
}
|
|
14911
|
+
};
|
|
14912
|
+
|
|
14913
|
+
// src/client/builders/cancelJuniorTrancheWithdraw.ts
|
|
14914
|
+
var import_spl_token4 = require("@solana/spl-token");
|
|
14915
|
+
var import_web37 = require("@solana/web3.js");
|
|
14916
|
+
var import_common9 = __toESM(require_dist());
|
|
14917
|
+
var CancelJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
14918
|
+
async getIx(args) {
|
|
14919
|
+
return this.program.methods.cancelJuniorTrancheWithdraw().accountsPartial({
|
|
14920
|
+
user: (0, import_common9.toWeb3Pk)(args.user),
|
|
14921
|
+
payer: (0, import_common9.toWeb3Pk)(args.payer),
|
|
14922
|
+
vault: (0, import_common9.toWeb3Pk)(args.vault),
|
|
14923
|
+
withdrawalQueue: (0, import_common9.toWeb3Pk)(args.withdrawalQueue),
|
|
14924
|
+
inputMint: (0, import_common9.toWeb3Pk)(args.inputMint),
|
|
14925
|
+
userInputAta: (0, import_common9.toWeb3Pk)(args.userInputAta),
|
|
14926
|
+
queueInputAta: (0, import_common9.toWeb3Pk)(args.queueInputAta),
|
|
14927
|
+
shareTokenProgram: (0, import_common9.toWeb3Pk)(args.shareTokenProgram),
|
|
14928
|
+
associatedTokenProgram: import_spl_token4.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
14929
|
+
systemProgram: import_web37.SystemProgram.programId
|
|
14930
|
+
}).instruction().then(import_common9.toKitInstruction);
|
|
14931
|
+
}
|
|
14544
14932
|
async deriveIxArgs(txArgs) {
|
|
14545
14933
|
const payer = txArgs.payer ?? txArgs.user;
|
|
14546
14934
|
const [[withdrawalQueue], juniorShare] = await Promise.all([
|
|
@@ -14568,8 +14956,8 @@ var CancelJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
14568
14956
|
withdrawalQueue: queuePda,
|
|
14569
14957
|
inputMint: juniorShareMint,
|
|
14570
14958
|
shareTokenProgram,
|
|
14571
|
-
userInputAta: txArgs.userInputAta ?? (0,
|
|
14572
|
-
queueInputAta: (0,
|
|
14959
|
+
userInputAta: txArgs.userInputAta ?? (0, import_common9.getAtaAddress)(juniorShareMint, txArgs.user, shareTokenProgram),
|
|
14960
|
+
queueInputAta: (0, import_common9.getAtaAddress)(
|
|
14573
14961
|
juniorShareMint,
|
|
14574
14962
|
queuePda,
|
|
14575
14963
|
shareTokenProgram,
|
|
@@ -14587,19 +14975,19 @@ var CancelJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
14587
14975
|
};
|
|
14588
14976
|
|
|
14589
14977
|
// src/client/builders/createAssetHolding.ts
|
|
14590
|
-
var
|
|
14978
|
+
var import_common10 = __toESM(require_dist());
|
|
14591
14979
|
var CreateAssetHoldingBuilder = class extends VaultBuilderBase {
|
|
14592
14980
|
async getIx(args) {
|
|
14593
14981
|
return this.program.methods.createAssetHolding({
|
|
14594
14982
|
priceOracleType: args.args.priceOracleType,
|
|
14595
|
-
priceOracleAccount: (0,
|
|
14983
|
+
priceOracleAccount: (0, import_common10.toWeb3Pk)(args.args.priceOracleAccount)
|
|
14596
14984
|
}).accountsPartial({
|
|
14597
|
-
hwManager: (0,
|
|
14598
|
-
vault: (0,
|
|
14599
|
-
vaultOracle: (0,
|
|
14600
|
-
mint: (0,
|
|
14601
|
-
tokenProgram: (0,
|
|
14602
|
-
}).instruction().then(
|
|
14985
|
+
hwManager: (0, import_common10.toWeb3Pk)(args.hwManager),
|
|
14986
|
+
vault: (0, import_common10.toWeb3Pk)(args.vault),
|
|
14987
|
+
vaultOracle: (0, import_common10.toWeb3Pk)(args.vaultOracle),
|
|
14988
|
+
mint: (0, import_common10.toWeb3Pk)(args.mint),
|
|
14989
|
+
tokenProgram: (0, import_common10.toWeb3Pk)(args.tokenProgram)
|
|
14990
|
+
}).instruction().then(import_common10.toKitInstruction);
|
|
14603
14991
|
}
|
|
14604
14992
|
async deriveIxArgs(txArgs) {
|
|
14605
14993
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(txArgs.vault);
|
|
@@ -14625,15 +15013,15 @@ var CreateAssetHoldingBuilder = class extends VaultBuilderBase {
|
|
|
14625
15013
|
};
|
|
14626
15014
|
|
|
14627
15015
|
// src/client/builders/removeAssetHolding.ts
|
|
14628
|
-
var
|
|
15016
|
+
var import_common11 = __toESM(require_dist());
|
|
14629
15017
|
var RemoveAssetHoldingBuilder = class extends VaultBuilderBase {
|
|
14630
15018
|
async getIx(args) {
|
|
14631
15019
|
return this.program.methods.removeAssetHolding().accountsPartial({
|
|
14632
|
-
hwManager: (0,
|
|
14633
|
-
vault: (0,
|
|
14634
|
-
vaultOracle: (0,
|
|
14635
|
-
mint: (0,
|
|
14636
|
-
}).instruction().then(
|
|
15020
|
+
hwManager: (0, import_common11.toWeb3Pk)(args.hwManager),
|
|
15021
|
+
vault: (0, import_common11.toWeb3Pk)(args.vault),
|
|
15022
|
+
vaultOracle: (0, import_common11.toWeb3Pk)(args.vaultOracle),
|
|
15023
|
+
mint: (0, import_common11.toWeb3Pk)(args.mint)
|
|
15024
|
+
}).instruction().then(import_common11.toKitInstruction);
|
|
14637
15025
|
}
|
|
14638
15026
|
async deriveIxArgs(txArgs) {
|
|
14639
15027
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(txArgs.vault);
|
|
@@ -14654,16 +15042,16 @@ var RemoveAssetHoldingBuilder = class extends VaultBuilderBase {
|
|
|
14654
15042
|
};
|
|
14655
15043
|
|
|
14656
15044
|
// src/client/builders/updateConsensusSigners.ts
|
|
14657
|
-
var
|
|
15045
|
+
var import_common12 = __toESM(require_dist());
|
|
14658
15046
|
var UpdateConsensusSignersBuilder = class extends VaultBuilderBase {
|
|
14659
15047
|
async getIx(args) {
|
|
14660
15048
|
return this.program.methods.updateConsensusSigners({
|
|
14661
|
-
signers: args.args.signers.map(
|
|
15049
|
+
signers: args.args.signers.map(import_common12.toWeb3Pk)
|
|
14662
15050
|
}).accountsPartial({
|
|
14663
|
-
curator: (0,
|
|
14664
|
-
vault: (0,
|
|
14665
|
-
vaultOracle: (0,
|
|
14666
|
-
}).instruction().then(
|
|
15051
|
+
curator: (0, import_common12.toWeb3Pk)(args.curator),
|
|
15052
|
+
vault: (0, import_common12.toWeb3Pk)(args.vault),
|
|
15053
|
+
vaultOracle: (0, import_common12.toWeb3Pk)(args.vaultOracle)
|
|
15054
|
+
}).instruction().then(import_common12.toKitInstruction);
|
|
14667
15055
|
}
|
|
14668
15056
|
async deriveIxArgs(txArgs) {
|
|
14669
15057
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(txArgs.vault);
|
|
@@ -14684,9 +15072,9 @@ var UpdateConsensusSignersBuilder = class extends VaultBuilderBase {
|
|
|
14684
15072
|
};
|
|
14685
15073
|
|
|
14686
15074
|
// src/client/builders/createTrancheState.ts
|
|
14687
|
-
var
|
|
14688
|
-
var
|
|
14689
|
-
var
|
|
15075
|
+
var import_core3 = require("@anchor-lang/core");
|
|
15076
|
+
var import_web38 = require("@solana/web3.js");
|
|
15077
|
+
var import_common13 = __toESM(require_dist());
|
|
14690
15078
|
var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
14691
15079
|
async getIx(args) {
|
|
14692
15080
|
return this.program.methods.vaultCreateTrancheState({
|
|
@@ -14698,18 +15086,18 @@ var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
|
14698
15086
|
juniorDepositCap: args.juniorDepositCap,
|
|
14699
15087
|
forMigration: args.forMigration
|
|
14700
15088
|
}).accountsPartial({
|
|
14701
|
-
curator: (0,
|
|
14702
|
-
vault: (0,
|
|
14703
|
-
vaultTrancheState: (0,
|
|
14704
|
-
juniorShareMint: (0,
|
|
14705
|
-
seniorShareMint: (0,
|
|
15089
|
+
curator: (0, import_common13.toWeb3Pk)(args.curator),
|
|
15090
|
+
vault: (0, import_common13.toWeb3Pk)(args.vault),
|
|
15091
|
+
vaultTrancheState: (0, import_common13.toWeb3Pk)(args.vaultTrancheState),
|
|
15092
|
+
juniorShareMint: (0, import_common13.toWeb3Pk)(args.juniorShareMint),
|
|
15093
|
+
seniorShareMint: (0, import_common13.toWeb3Pk)(args.seniorShareMint),
|
|
14706
15094
|
// Optional on-chain: required only on the organic path, where the
|
|
14707
15095
|
// program enforces a fresh NAV before enabling tranching. Left null on
|
|
14708
15096
|
// the migration path so Anchor resolves it to the program ID.
|
|
14709
|
-
vaultOracle: args.vaultOracle ? (0,
|
|
14710
|
-
tokenProgram: (0,
|
|
14711
|
-
systemProgram:
|
|
14712
|
-
}).instruction().then(
|
|
15097
|
+
vaultOracle: args.vaultOracle ? (0, import_common13.toWeb3Pk)(args.vaultOracle) : null,
|
|
15098
|
+
tokenProgram: (0, import_common13.toWeb3Pk)(args.tokenProgram),
|
|
15099
|
+
systemProgram: import_web38.SystemProgram.programId
|
|
15100
|
+
}).instruction().then(import_common13.toKitInstruction);
|
|
14713
15101
|
}
|
|
14714
15102
|
async deriveIxArgs(txArgs) {
|
|
14715
15103
|
const [vaultTrancheState] = await this.pda.deriveVaultTrancheStatePda(
|
|
@@ -14738,10 +15126,10 @@ var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
|
14738
15126
|
juniorFloorApyBps: txArgs.juniorFloorApyBps ?? 0,
|
|
14739
15127
|
earlyUnstakeFeeBps: txArgs.earlyUnstakeFeeBps ?? DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS,
|
|
14740
15128
|
standardUnstakeFeeBps: txArgs.standardUnstakeFeeBps ?? DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS,
|
|
14741
|
-
targetLockupDurationSecs: new
|
|
15129
|
+
targetLockupDurationSecs: new import_core3.BN(
|
|
14742
15130
|
(txArgs.targetLockupDurationSecs ?? DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS).toString()
|
|
14743
15131
|
),
|
|
14744
|
-
juniorDepositCap: new
|
|
15132
|
+
juniorDepositCap: new import_core3.BN((txArgs.juniorDepositCap ?? 0n).toString()),
|
|
14745
15133
|
forMigration,
|
|
14746
15134
|
tokenProgram: txArgs.tokenProgram ?? TOKEN_PROGRAM_ID
|
|
14747
15135
|
};
|
|
@@ -14756,13 +15144,13 @@ var CreateTrancheStateBuilder = class extends VaultBuilderBase {
|
|
|
14756
15144
|
};
|
|
14757
15145
|
|
|
14758
15146
|
// src/client/builders/activateCircuitBreaker.ts
|
|
14759
|
-
var
|
|
15147
|
+
var import_common14 = __toESM(require_dist());
|
|
14760
15148
|
var ActivateCircuitBreakerBuilder = class extends VaultBuilderBase {
|
|
14761
15149
|
async getIx(args) {
|
|
14762
15150
|
return this.program.methods.activateCircuitBreaker().accountsPartial({
|
|
14763
|
-
cbTrigger: (0,
|
|
14764
|
-
vault: (0,
|
|
14765
|
-
}).instruction().then(
|
|
15151
|
+
cbTrigger: (0, import_common14.toWeb3Pk)(args.cbTrigger),
|
|
15152
|
+
vault: (0, import_common14.toWeb3Pk)(args.vault)
|
|
15153
|
+
}).instruction().then(import_common14.toKitInstruction);
|
|
14766
15154
|
}
|
|
14767
15155
|
async deriveIxArgs(txArgs) {
|
|
14768
15156
|
return txArgs;
|
|
@@ -14775,34 +15163,34 @@ var ActivateCircuitBreakerBuilder = class extends VaultBuilderBase {
|
|
|
14775
15163
|
};
|
|
14776
15164
|
|
|
14777
15165
|
// src/client/builders/createVault.ts
|
|
14778
|
-
var
|
|
15166
|
+
var import_core5 = require("@anchor-lang/core");
|
|
14779
15167
|
var import_token = require("@solana-program/token");
|
|
14780
15168
|
var import_spl_token5 = require("@solana/spl-token");
|
|
14781
|
-
var
|
|
14782
|
-
var
|
|
15169
|
+
var import_web39 = require("@solana/web3.js");
|
|
15170
|
+
var import_common16 = __toESM(require_dist());
|
|
14783
15171
|
|
|
14784
15172
|
// src/client/builders/anchorArgs.ts
|
|
14785
|
-
var
|
|
14786
|
-
var
|
|
15173
|
+
var import_core4 = require("@anchor-lang/core");
|
|
15174
|
+
var import_common15 = __toESM(require_dist());
|
|
14787
15175
|
function toAnchorCreateVaultParams(params) {
|
|
14788
15176
|
return {
|
|
14789
15177
|
...params,
|
|
14790
|
-
hwManager: (0,
|
|
14791
|
-
cbTrigger: (0,
|
|
14792
|
-
feeCollector: (0,
|
|
14793
|
-
baseAssetMint: (0,
|
|
14794
|
-
basePriceOracleAccount: (0,
|
|
14795
|
-
consensusSigners: params.consensusSigners.map(
|
|
15178
|
+
hwManager: (0, import_common15.toWeb3Pk)(params.hwManager),
|
|
15179
|
+
cbTrigger: (0, import_common15.toWeb3Pk)(params.cbTrigger),
|
|
15180
|
+
feeCollector: (0, import_common15.toWeb3Pk)(params.feeCollector),
|
|
15181
|
+
baseAssetMint: (0, import_common15.toWeb3Pk)(params.baseAssetMint),
|
|
15182
|
+
basePriceOracleAccount: (0, import_common15.toWeb3Pk)(params.basePriceOracleAccount),
|
|
15183
|
+
consensusSigners: params.consensusSigners.map(import_common15.toWeb3Pk)
|
|
14796
15184
|
};
|
|
14797
15185
|
}
|
|
14798
15186
|
function toAnchorSetVaultConfigArgs(args) {
|
|
14799
15187
|
return {
|
|
14800
|
-
manager: args.manager ? (0,
|
|
14801
|
-
hwManager: args.hwManager ? (0,
|
|
14802
|
-
cbTrigger: args.cbTrigger ? (0,
|
|
14803
|
-
fulfiller: args.fulfiller ? (0,
|
|
14804
|
-
feeCollector: args.feeCollector ? (0,
|
|
14805
|
-
newCurator: args.newCurator ? (0,
|
|
15188
|
+
manager: args.manager ? (0, import_common15.toWeb3Pk)(args.manager) : null,
|
|
15189
|
+
hwManager: args.hwManager ? (0, import_common15.toWeb3Pk)(args.hwManager) : null,
|
|
15190
|
+
cbTrigger: args.cbTrigger ? (0, import_common15.toWeb3Pk)(args.cbTrigger) : null,
|
|
15191
|
+
fulfiller: args.fulfiller ? (0, import_common15.toWeb3Pk)(args.fulfiller) : null,
|
|
15192
|
+
feeCollector: args.feeCollector ? (0, import_common15.toWeb3Pk)(args.feeCollector) : null,
|
|
15193
|
+
newCurator: args.newCurator ? (0, import_common15.toWeb3Pk)(args.newCurator) : null,
|
|
14806
15194
|
mintFeeBps: args.mintFeeBps,
|
|
14807
15195
|
burnFeeBps: args.burnFeeBps,
|
|
14808
15196
|
performanceFeeBps: args.performanceFeeBps,
|
|
@@ -14819,9 +15207,9 @@ function toAnchorSetVaultConfigArgs(args) {
|
|
|
14819
15207
|
function toAnchorConsensusUpdates(updates) {
|
|
14820
15208
|
return updates.map((update) => ({
|
|
14821
15209
|
holdingIndex: update.holdingIndex,
|
|
14822
|
-
mint: update.mint ? (0,
|
|
14823
|
-
price: new
|
|
14824
|
-
externalAmount: new
|
|
15210
|
+
mint: update.mint ? (0, import_common15.toWeb3Pk)(update.mint) : null,
|
|
15211
|
+
price: new import_core4.BN(update.price.toString()),
|
|
15212
|
+
externalAmount: new import_core4.BN(update.externalAmount.toString())
|
|
14825
15213
|
}));
|
|
14826
15214
|
}
|
|
14827
15215
|
|
|
@@ -14829,16 +15217,16 @@ function toAnchorConsensusUpdates(updates) {
|
|
|
14829
15217
|
var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
14830
15218
|
async getIx(args) {
|
|
14831
15219
|
return this.program.methods.createVault(toAnchorCreateVaultParams(args.params)).accountsPartial({
|
|
14832
|
-
curator: (0,
|
|
14833
|
-
vault: (0,
|
|
14834
|
-
vaultOracle: (0,
|
|
14835
|
-
feeVault: (0,
|
|
14836
|
-
shareMint: (0,
|
|
14837
|
-
assetMint: (0,
|
|
14838
|
-
assetTokenProgram: (0,
|
|
14839
|
-
tokenProgram: (0,
|
|
14840
|
-
systemProgram:
|
|
14841
|
-
}).instruction().then(
|
|
15220
|
+
curator: (0, import_common16.toWeb3Pk)(args.curator),
|
|
15221
|
+
vault: (0, import_common16.toWeb3Pk)(args.vault),
|
|
15222
|
+
vaultOracle: (0, import_common16.toWeb3Pk)(args.vaultOracle),
|
|
15223
|
+
feeVault: (0, import_common16.toWeb3Pk)(args.feeVault),
|
|
15224
|
+
shareMint: (0, import_common16.toWeb3Pk)(args.shareMint),
|
|
15225
|
+
assetMint: (0, import_common16.toWeb3Pk)(args.assetMint),
|
|
15226
|
+
assetTokenProgram: (0, import_common16.toWeb3Pk)(args.assetTokenProgram),
|
|
15227
|
+
tokenProgram: (0, import_common16.toWeb3Pk)(args.shareTokenProgram ?? TOKEN_PROGRAM_ID),
|
|
15228
|
+
systemProgram: import_web39.SystemProgram.programId
|
|
15229
|
+
}).instruction().then(import_common16.toKitInstruction);
|
|
14842
15230
|
}
|
|
14843
15231
|
async deriveIxArgs(txArgs) {
|
|
14844
15232
|
const vaultId = txArgs.vaultId ?? DEFAULT_VAULT_ID;
|
|
@@ -14867,11 +15255,11 @@ var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
|
14867
15255
|
performanceFeeBps: txArgs.performanceFeeBps ?? 0,
|
|
14868
15256
|
fixedApyBps: txArgs.fixedApyBps ?? 0,
|
|
14869
15257
|
maxApyBps: txArgs.maxApyBps ?? DEFAULT_MAX_ACCEPTABLE_APY_BPS,
|
|
14870
|
-
tvlLimit: new
|
|
15258
|
+
tvlLimit: new import_core5.BN((txArgs.tvlLimit ?? 0n).toString()),
|
|
14871
15259
|
lossesEnabled: txArgs.lossesEnabled ?? false,
|
|
14872
15260
|
initialMintSharePrice: null,
|
|
14873
15261
|
basePriceOracleType: txArgs.basePriceOracleType ?? 1,
|
|
14874
|
-
basePrice: new
|
|
15262
|
+
basePrice: new import_core5.BN(
|
|
14875
15263
|
(txArgs.basePrice ?? 10n ** BigInt(accountingDecimals)).toString()
|
|
14876
15264
|
),
|
|
14877
15265
|
basePriceOracleAccount: txArgs.basePriceOracleAccount ?? DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
@@ -14883,16 +15271,16 @@ var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
|
14883
15271
|
async getTx(txArgs) {
|
|
14884
15272
|
const args = await this.deriveIxArgs(txArgs);
|
|
14885
15273
|
const createIx = await this.getIx(args);
|
|
14886
|
-
const payer = (0,
|
|
14887
|
-
const assetMint = (0,
|
|
14888
|
-
const assetTokenProgram = (0,
|
|
14889
|
-
const vaultAssetAta = (0,
|
|
15274
|
+
const payer = (0, import_common16.toWeb3Pk)(args.curator);
|
|
15275
|
+
const assetMint = (0, import_common16.toWeb3Pk)(args.assetMint);
|
|
15276
|
+
const assetTokenProgram = (0, import_common16.toWeb3Pk)(args.assetTokenProgram);
|
|
15277
|
+
const vaultAssetAta = (0, import_common16.getAtaAddress)(
|
|
14890
15278
|
args.assetMint,
|
|
14891
15279
|
args.vault,
|
|
14892
15280
|
args.assetTokenProgram,
|
|
14893
15281
|
true
|
|
14894
15282
|
);
|
|
14895
|
-
const feeVaultAta = (0,
|
|
15283
|
+
const feeVaultAta = (0, import_common16.getAtaAddress)(
|
|
14896
15284
|
args.assetMint,
|
|
14897
15285
|
args.feeVault,
|
|
14898
15286
|
args.assetTokenProgram,
|
|
@@ -14900,16 +15288,16 @@ var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
|
14900
15288
|
);
|
|
14901
15289
|
const createVaultAssetAta = (0, import_spl_token5.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14902
15290
|
payer,
|
|
14903
|
-
(0,
|
|
14904
|
-
(0,
|
|
15291
|
+
(0, import_common16.toWeb3Pk)(vaultAssetAta),
|
|
15292
|
+
(0, import_common16.toWeb3Pk)(args.vault),
|
|
14905
15293
|
assetMint,
|
|
14906
15294
|
assetTokenProgram,
|
|
14907
15295
|
import_spl_token5.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
14908
15296
|
);
|
|
14909
15297
|
const createFeeVaultAta = (0, import_spl_token5.createAssociatedTokenAccountIdempotentInstruction)(
|
|
14910
15298
|
payer,
|
|
14911
|
-
(0,
|
|
14912
|
-
(0,
|
|
15299
|
+
(0, import_common16.toWeb3Pk)(feeVaultAta),
|
|
15300
|
+
(0, import_common16.toWeb3Pk)(args.feeVault),
|
|
14913
15301
|
assetMint,
|
|
14914
15302
|
assetTokenProgram,
|
|
14915
15303
|
import_spl_token5.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
@@ -14917,8 +15305,8 @@ var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
|
14917
15305
|
return {
|
|
14918
15306
|
instructions: [
|
|
14919
15307
|
createIx,
|
|
14920
|
-
(0,
|
|
14921
|
-
(0,
|
|
15308
|
+
(0, import_common16.toKitInstruction)(createVaultAssetAta),
|
|
15309
|
+
(0, import_common16.toKitInstruction)(createFeeVaultAta)
|
|
14922
15310
|
],
|
|
14923
15311
|
postSuccessCacheInvalidations: [
|
|
14924
15312
|
{ vaultPda: args.vault, vaultOraclePda: args.vaultOracle }
|
|
@@ -14928,16 +15316,16 @@ var CreateVaultBuilder = class extends VaultBuilderBase {
|
|
|
14928
15316
|
};
|
|
14929
15317
|
|
|
14930
15318
|
// src/client/builders/initializeVaultRoles.ts
|
|
14931
|
-
var
|
|
15319
|
+
var import_common17 = __toESM(require_dist());
|
|
14932
15320
|
var InitializeVaultRolesBuilder = class extends VaultBuilderBase {
|
|
14933
15321
|
async getIx(args) {
|
|
14934
15322
|
return this.program.methods.initializeVaultRoles({
|
|
14935
|
-
manager: (0,
|
|
14936
|
-
fulfiller: (0,
|
|
15323
|
+
manager: (0, import_common17.toWeb3Pk)(args.args.manager),
|
|
15324
|
+
fulfiller: (0, import_common17.toWeb3Pk)(args.args.fulfiller)
|
|
14937
15325
|
}).accountsPartial({
|
|
14938
|
-
curator: (0,
|
|
14939
|
-
vault: (0,
|
|
14940
|
-
}).instruction().then(
|
|
15326
|
+
curator: (0, import_common17.toWeb3Pk)(args.curator),
|
|
15327
|
+
vault: (0, import_common17.toWeb3Pk)(args.vault)
|
|
15328
|
+
}).instruction().then(import_common17.toKitInstruction);
|
|
14941
15329
|
}
|
|
14942
15330
|
async deriveIxArgs(txArgs) {
|
|
14943
15331
|
return {
|
|
@@ -14957,13 +15345,13 @@ var InitializeVaultRolesBuilder = class extends VaultBuilderBase {
|
|
|
14957
15345
|
};
|
|
14958
15346
|
|
|
14959
15347
|
// src/client/builders/disableCircuitBreaker.ts
|
|
14960
|
-
var
|
|
15348
|
+
var import_common18 = __toESM(require_dist());
|
|
14961
15349
|
var DisableCircuitBreakerBuilder = class extends VaultBuilderBase {
|
|
14962
15350
|
async getIx(args) {
|
|
14963
15351
|
return this.program.methods.disableCircuitBreaker().accountsPartial({
|
|
14964
|
-
curator: (0,
|
|
14965
|
-
vault: (0,
|
|
14966
|
-
}).instruction().then(
|
|
15352
|
+
curator: (0, import_common18.toWeb3Pk)(args.curator),
|
|
15353
|
+
vault: (0, import_common18.toWeb3Pk)(args.vault)
|
|
15354
|
+
}).instruction().then(import_common18.toKitInstruction);
|
|
14967
15355
|
}
|
|
14968
15356
|
async deriveIxArgs(txArgs) {
|
|
14969
15357
|
return txArgs;
|
|
@@ -14976,15 +15364,15 @@ var DisableCircuitBreakerBuilder = class extends VaultBuilderBase {
|
|
|
14976
15364
|
};
|
|
14977
15365
|
|
|
14978
15366
|
// src/client/builders/setVaultConfig.ts
|
|
14979
|
-
var
|
|
14980
|
-
var
|
|
15367
|
+
var import_core6 = require("@anchor-lang/core");
|
|
15368
|
+
var import_common19 = __toESM(require_dist());
|
|
14981
15369
|
var SetVaultConfigBuilder = class extends VaultBuilderBase {
|
|
14982
15370
|
async getIx(args) {
|
|
14983
15371
|
return this.program.methods.setVaultConfig(toAnchorSetVaultConfigArgs(args.args)).accountsPartial({
|
|
14984
|
-
curator: (0,
|
|
14985
|
-
vault: (0,
|
|
14986
|
-
vaultOracle: args.vaultOracle ? (0,
|
|
14987
|
-
}).instruction().then(
|
|
15372
|
+
curator: (0, import_common19.toWeb3Pk)(args.curator),
|
|
15373
|
+
vault: (0, import_common19.toWeb3Pk)(args.vault),
|
|
15374
|
+
vaultOracle: args.vaultOracle ? (0, import_common19.toWeb3Pk)(args.vaultOracle) : null
|
|
15375
|
+
}).instruction().then(import_common19.toKitInstruction);
|
|
14988
15376
|
}
|
|
14989
15377
|
async deriveIxArgs(txArgs) {
|
|
14990
15378
|
const [derivedVaultOracle] = await this.pda.deriveVaultOraclePda(
|
|
@@ -15006,28 +15394,28 @@ var SetVaultConfigBuilder = class extends VaultBuilderBase {
|
|
|
15006
15394
|
performanceFeeBps: txArgs.performanceFeeBps ?? null,
|
|
15007
15395
|
fixedApyBps: txArgs.fixedApyBps ?? null,
|
|
15008
15396
|
maxApyBps: txArgs.maxApyBps ?? null,
|
|
15009
|
-
tvlLimit: txArgs.tvlLimit !== void 0 ? new
|
|
15397
|
+
tvlLimit: txArgs.tvlLimit !== void 0 ? new import_core6.BN(txArgs.tvlLimit.toString()) : null,
|
|
15010
15398
|
lossesEnabled: txArgs.lossesEnabled ?? null,
|
|
15011
|
-
priceStalenessThresholdSecs: txArgs.priceStalenessThresholdSecs !== void 0 ? new
|
|
15399
|
+
priceStalenessThresholdSecs: txArgs.priceStalenessThresholdSecs !== void 0 ? new import_core6.BN(txArgs.priceStalenessThresholdSecs.toString()) : null,
|
|
15012
15400
|
userBurnLimit: txArgs.userBurnLimit !== void 0 ? {
|
|
15013
|
-
windowLimit: new
|
|
15401
|
+
windowLimit: new import_core6.BN(
|
|
15014
15402
|
txArgs.userBurnLimit.windowLimit.toString()
|
|
15015
15403
|
),
|
|
15016
|
-
windowDurationSeconds: new
|
|
15404
|
+
windowDurationSeconds: new import_core6.BN(
|
|
15017
15405
|
txArgs.userBurnLimit.windowDurationSeconds.toString()
|
|
15018
15406
|
)
|
|
15019
15407
|
} : null,
|
|
15020
15408
|
managerPullLimit: txArgs.managerPullLimit !== void 0 ? {
|
|
15021
|
-
windowLimit: new
|
|
15409
|
+
windowLimit: new import_core6.BN(
|
|
15022
15410
|
txArgs.managerPullLimit.windowLimit.toString()
|
|
15023
15411
|
),
|
|
15024
|
-
windowDurationSeconds: new
|
|
15412
|
+
windowDurationSeconds: new import_core6.BN(
|
|
15025
15413
|
txArgs.managerPullLimit.windowDurationSeconds.toString()
|
|
15026
15414
|
)
|
|
15027
15415
|
} : null,
|
|
15028
15416
|
rebalanceLimit: txArgs.rebalanceLimit !== void 0 ? {
|
|
15029
15417
|
windowLimitBps: txArgs.rebalanceLimit.windowLimitBps,
|
|
15030
|
-
windowDurationSeconds: new
|
|
15418
|
+
windowDurationSeconds: new import_core6.BN(
|
|
15031
15419
|
txArgs.rebalanceLimit.windowDurationSeconds.toString()
|
|
15032
15420
|
)
|
|
15033
15421
|
} : null
|
|
@@ -15042,14 +15430,14 @@ var SetVaultConfigBuilder = class extends VaultBuilderBase {
|
|
|
15042
15430
|
};
|
|
15043
15431
|
|
|
15044
15432
|
// src/client/builders/setProtocolFee.ts
|
|
15045
|
-
var
|
|
15433
|
+
var import_common20 = __toESM(require_dist());
|
|
15046
15434
|
var SetProtocolFeeBuilder = class extends VaultBuilderBase {
|
|
15047
15435
|
async getIx(args) {
|
|
15048
15436
|
return this.program.methods.setProtocolFee({ protocolFeeBps: args.args.protocolFeeBps }).accountsPartial({
|
|
15049
|
-
protocolAuthority: (0,
|
|
15050
|
-
vault: (0,
|
|
15051
|
-
vaultOracle: args.vaultOracle ? (0,
|
|
15052
|
-
}).instruction().then(
|
|
15437
|
+
protocolAuthority: (0, import_common20.toWeb3Pk)(args.protocolAuthority),
|
|
15438
|
+
vault: (0, import_common20.toWeb3Pk)(args.vault),
|
|
15439
|
+
vaultOracle: args.vaultOracle ? (0, import_common20.toWeb3Pk)(args.vaultOracle) : null
|
|
15440
|
+
}).instruction().then(import_common20.toKitInstruction);
|
|
15053
15441
|
}
|
|
15054
15442
|
async deriveIxArgs(txArgs) {
|
|
15055
15443
|
const [derivedVaultOracle] = await this.pda.deriveVaultOraclePda(
|
|
@@ -15075,11 +15463,11 @@ var SetProtocolFeeBuilder = class extends VaultBuilderBase {
|
|
|
15075
15463
|
// src/client/builders/crankNav.ts
|
|
15076
15464
|
var import_spl_token6 = require("@solana/spl-token");
|
|
15077
15465
|
var import_kit6 = require("@solana/kit");
|
|
15078
|
-
var
|
|
15079
|
-
var
|
|
15466
|
+
var import_web310 = require("@solana/web3.js");
|
|
15467
|
+
var import_common22 = __toESM(require_dist());
|
|
15080
15468
|
|
|
15081
15469
|
// src/client/builders/feeCollector.ts
|
|
15082
|
-
var
|
|
15470
|
+
var import_common21 = __toESM(require_dist());
|
|
15083
15471
|
function resolveProtocolFeeRecipient(override) {
|
|
15084
15472
|
return override ?? PROTOCOL_FEE_RECIPIENT;
|
|
15085
15473
|
}
|
|
@@ -15088,14 +15476,14 @@ async function resolveVaultFeeCollector(account, vault, override) {
|
|
|
15088
15476
|
return override;
|
|
15089
15477
|
}
|
|
15090
15478
|
const vaultState = await account.fetchVault(vault);
|
|
15091
|
-
return (0,
|
|
15479
|
+
return (0, import_common21.fromWeb3Pk)(vaultState.roles.feeCollector);
|
|
15092
15480
|
}
|
|
15093
15481
|
function baseAssetMintFromVault(vaultState) {
|
|
15094
15482
|
const baseHolding = vaultState.holdings.find((holding) => holding.isBase);
|
|
15095
15483
|
if (!baseHolding) {
|
|
15096
15484
|
throw new Error("Vault has no base asset holding");
|
|
15097
15485
|
}
|
|
15098
|
-
return (0,
|
|
15486
|
+
return (0, import_common21.fromWeb3Pk)(baseHolding.mint);
|
|
15099
15487
|
}
|
|
15100
15488
|
async function resolveVaultBaseAssetMint(account, vault, override) {
|
|
15101
15489
|
if (override) {
|
|
@@ -15110,7 +15498,7 @@ async function resolveFeeAssetTokenProgram(account, vault, feeAssetMint, overrid
|
|
|
15110
15498
|
}
|
|
15111
15499
|
const vaultState = await account.fetchVault(vault);
|
|
15112
15500
|
const holding = vaultState.holdings.find(
|
|
15113
|
-
(entry) => (0,
|
|
15501
|
+
(entry) => (0, import_common21.fromWeb3Pk)(entry.mint) === feeAssetMint
|
|
15114
15502
|
);
|
|
15115
15503
|
if (!holding) {
|
|
15116
15504
|
return TOKEN_PROGRAM_ID;
|
|
@@ -15122,21 +15510,21 @@ async function resolveFeeAssetTokenProgram(account, vault, feeAssetMint, overrid
|
|
|
15122
15510
|
var CrankNavBuilder = class extends VaultBuilderBase {
|
|
15123
15511
|
async getIx(args) {
|
|
15124
15512
|
return this.program.methods.crankNav().accountsPartial({
|
|
15125
|
-
cranker: (0,
|
|
15126
|
-
vault: (0,
|
|
15127
|
-
vaultOracle: (0,
|
|
15128
|
-
vaultTrancheState: args.vaultTrancheState ? (0,
|
|
15129
|
-
shareMint: (0,
|
|
15130
|
-
juniorTrancheShareMint: args.juniorTrancheShareMint ? (0,
|
|
15131
|
-
seniorTrancheShareMint: args.seniorTrancheShareMint ? (0,
|
|
15132
|
-
feeAssetMint: (0,
|
|
15133
|
-
vaultFeeAssetAta: (0,
|
|
15134
|
-
feeVault: (0,
|
|
15135
|
-
feeVaultAta: (0,
|
|
15136
|
-
feeAssetTokenProgram: (0,
|
|
15513
|
+
cranker: (0, import_common22.toWeb3Pk)(args.cranker),
|
|
15514
|
+
vault: (0, import_common22.toWeb3Pk)(args.vault),
|
|
15515
|
+
vaultOracle: (0, import_common22.toWeb3Pk)(args.vaultOracle),
|
|
15516
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common22.toWeb3Pk)(args.vaultTrancheState) : null,
|
|
15517
|
+
shareMint: (0, import_common22.toWeb3Pk)(args.shareMint),
|
|
15518
|
+
juniorTrancheShareMint: args.juniorTrancheShareMint ? (0, import_common22.toWeb3Pk)(args.juniorTrancheShareMint) : null,
|
|
15519
|
+
seniorTrancheShareMint: args.seniorTrancheShareMint ? (0, import_common22.toWeb3Pk)(args.seniorTrancheShareMint) : null,
|
|
15520
|
+
feeAssetMint: (0, import_common22.toWeb3Pk)(args.feeAssetMint),
|
|
15521
|
+
vaultFeeAssetAta: (0, import_common22.toWeb3Pk)(args.vaultFeeAssetAta),
|
|
15522
|
+
feeVault: (0, import_common22.toWeb3Pk)(args.feeVault),
|
|
15523
|
+
feeVaultAta: (0, import_common22.toWeb3Pk)(args.feeVaultAta),
|
|
15524
|
+
feeAssetTokenProgram: (0, import_common22.toWeb3Pk)(args.feeAssetTokenProgram),
|
|
15137
15525
|
associatedTokenProgram: import_spl_token6.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
15138
|
-
systemProgram:
|
|
15139
|
-
}).instruction().then(
|
|
15526
|
+
systemProgram: import_web310.SystemProgram.programId
|
|
15527
|
+
}).instruction().then(import_common22.toKitInstruction);
|
|
15140
15528
|
}
|
|
15141
15529
|
async deriveIxArgs(txArgs) {
|
|
15142
15530
|
const [vaultOracle] = await this.pda.deriveVaultOraclePda(txArgs.vault);
|
|
@@ -15186,13 +15574,13 @@ var CrankNavBuilder = class extends VaultBuilderBase {
|
|
|
15186
15574
|
seniorTrancheShareMint,
|
|
15187
15575
|
feeAssetMint,
|
|
15188
15576
|
feeVault,
|
|
15189
|
-
vaultFeeAssetAta: (0,
|
|
15577
|
+
vaultFeeAssetAta: (0, import_common22.getAtaAddress)(
|
|
15190
15578
|
feeAssetMint,
|
|
15191
15579
|
txArgs.vault,
|
|
15192
15580
|
feeAssetTokenProgram,
|
|
15193
15581
|
true
|
|
15194
15582
|
),
|
|
15195
|
-
feeVaultAta: (0,
|
|
15583
|
+
feeVaultAta: (0, import_common22.getAtaAddress)(
|
|
15196
15584
|
feeAssetMint,
|
|
15197
15585
|
feeVault,
|
|
15198
15586
|
feeAssetTokenProgram,
|
|
@@ -15202,25 +15590,25 @@ var CrankNavBuilder = class extends VaultBuilderBase {
|
|
|
15202
15590
|
};
|
|
15203
15591
|
}
|
|
15204
15592
|
async buildPreambleInstructions(args) {
|
|
15205
|
-
const payer = (0,
|
|
15593
|
+
const payer = (0, import_common22.toWeb3Pk)(args.cranker);
|
|
15206
15594
|
return [
|
|
15207
15595
|
(0, import_spl_token6.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15208
15596
|
payer,
|
|
15209
|
-
(0,
|
|
15210
|
-
(0,
|
|
15211
|
-
(0,
|
|
15212
|
-
(0,
|
|
15597
|
+
(0, import_common22.toWeb3Pk)(args.vaultFeeAssetAta),
|
|
15598
|
+
(0, import_common22.toWeb3Pk)(args.vault),
|
|
15599
|
+
(0, import_common22.toWeb3Pk)(args.feeAssetMint),
|
|
15600
|
+
(0, import_common22.toWeb3Pk)(args.feeAssetTokenProgram),
|
|
15213
15601
|
import_spl_token6.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15214
15602
|
),
|
|
15215
15603
|
(0, import_spl_token6.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15216
15604
|
payer,
|
|
15217
|
-
(0,
|
|
15218
|
-
(0,
|
|
15219
|
-
(0,
|
|
15220
|
-
(0,
|
|
15605
|
+
(0, import_common22.toWeb3Pk)(args.feeVaultAta),
|
|
15606
|
+
(0, import_common22.toWeb3Pk)(args.feeVault),
|
|
15607
|
+
(0, import_common22.toWeb3Pk)(args.feeAssetMint),
|
|
15608
|
+
(0, import_common22.toWeb3Pk)(args.feeAssetTokenProgram),
|
|
15221
15609
|
import_spl_token6.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15222
15610
|
)
|
|
15223
|
-
].map(
|
|
15611
|
+
].map(import_common22.toKitInstruction);
|
|
15224
15612
|
}
|
|
15225
15613
|
async buildPlanExtras(args) {
|
|
15226
15614
|
return {
|
|
@@ -15247,28 +15635,28 @@ var CrankNavBuilder = class extends VaultBuilderBase {
|
|
|
15247
15635
|
|
|
15248
15636
|
// src/client/builders/crankPerformanceFees.ts
|
|
15249
15637
|
var import_spl_token7 = require("@solana/spl-token");
|
|
15250
|
-
var
|
|
15251
|
-
var
|
|
15638
|
+
var import_web311 = require("@solana/web3.js");
|
|
15639
|
+
var import_common23 = __toESM(require_dist());
|
|
15252
15640
|
var CrankPerformanceFeesBuilder = class extends VaultBuilderBase {
|
|
15253
15641
|
async getIx(args) {
|
|
15254
15642
|
return this.program.methods.crankPerformanceFees().accountsPartial({
|
|
15255
|
-
cranker: (0,
|
|
15256
|
-
vault: (0,
|
|
15257
|
-
shareMint: (0,
|
|
15258
|
-
feeCollector: (0,
|
|
15259
|
-
feeCollectorShareAta: (0,
|
|
15260
|
-
protocolFeeCollector: (0,
|
|
15261
|
-
protocolFeeCollectorShareAta: (0,
|
|
15643
|
+
cranker: (0, import_common23.toWeb3Pk)(args.cranker),
|
|
15644
|
+
vault: (0, import_common23.toWeb3Pk)(args.vault),
|
|
15645
|
+
shareMint: (0, import_common23.toWeb3Pk)(args.shareMint),
|
|
15646
|
+
feeCollector: (0, import_common23.toWeb3Pk)(args.feeCollector),
|
|
15647
|
+
feeCollectorShareAta: (0, import_common23.toWeb3Pk)(args.feeCollectorShareAta),
|
|
15648
|
+
protocolFeeCollector: (0, import_common23.toWeb3Pk)(args.protocolFeeCollector),
|
|
15649
|
+
protocolFeeCollectorShareAta: (0, import_common23.toWeb3Pk)(
|
|
15262
15650
|
args.protocolFeeCollectorShareAta
|
|
15263
15651
|
),
|
|
15264
|
-
shareTokenProgram: (0,
|
|
15652
|
+
shareTokenProgram: (0, import_common23.toWeb3Pk)(args.shareTokenProgram),
|
|
15265
15653
|
associatedTokenProgram: import_spl_token7.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
15266
|
-
systemProgram:
|
|
15267
|
-
}).instruction().then(
|
|
15654
|
+
systemProgram: import_web311.SystemProgram.programId
|
|
15655
|
+
}).instruction().then(import_common23.toKitInstruction);
|
|
15268
15656
|
}
|
|
15269
15657
|
async deriveIxArgs(txArgs) {
|
|
15270
15658
|
const vaultState = await this.account.fetchVault(txArgs.vault);
|
|
15271
|
-
const shareMint = (0,
|
|
15659
|
+
const shareMint = (0, import_common23.fromWeb3Pk)(vaultState.mint);
|
|
15272
15660
|
const shareTokenProgram = txArgs.shareTokenProgram ?? tokenProgramAddressFromIdlEnum(vaultState.mintTokenProgram);
|
|
15273
15661
|
const feeCollector = await resolveVaultFeeCollector(
|
|
15274
15662
|
this.account,
|
|
@@ -15285,7 +15673,7 @@ var CrankPerformanceFeesBuilder = class extends VaultBuilderBase {
|
|
|
15285
15673
|
feeCollector,
|
|
15286
15674
|
// The vault fee collector is a role that is routinely a Squads vault
|
|
15287
15675
|
// (off-curve PDA), so allow an off-curve owner here too.
|
|
15288
|
-
feeCollectorShareAta: (0,
|
|
15676
|
+
feeCollectorShareAta: (0, import_common23.getAtaAddress)(
|
|
15289
15677
|
shareMint,
|
|
15290
15678
|
feeCollector,
|
|
15291
15679
|
shareTokenProgram,
|
|
@@ -15295,7 +15683,7 @@ var CrankPerformanceFeesBuilder = class extends VaultBuilderBase {
|
|
|
15295
15683
|
// The protocol fee recipient is a hardcoded protocol-controlled address
|
|
15296
15684
|
// that may be off-curve (e.g. a PDA / multisig vault), so allow an
|
|
15297
15685
|
// off-curve owner when deriving its ATA.
|
|
15298
|
-
protocolFeeCollectorShareAta: (0,
|
|
15686
|
+
protocolFeeCollectorShareAta: (0, import_common23.getAtaAddress)(
|
|
15299
15687
|
shareMint,
|
|
15300
15688
|
protocolFeeCollector,
|
|
15301
15689
|
shareTokenProgram,
|
|
@@ -15321,7 +15709,7 @@ var CrankPerformanceFeesBuilder = class extends VaultBuilderBase {
|
|
|
15321
15709
|
};
|
|
15322
15710
|
|
|
15323
15711
|
// src/client/builders/setExternalLiquidity.ts
|
|
15324
|
-
var
|
|
15712
|
+
var import_common24 = __toESM(require_dist());
|
|
15325
15713
|
function toExternalLiquiditySource(source) {
|
|
15326
15714
|
switch (source) {
|
|
15327
15715
|
case 0:
|
|
@@ -15337,11 +15725,11 @@ var SetExternalLiquidityBuilder = class extends VaultBuilderBase {
|
|
|
15337
15725
|
return this.program.methods.setExternalLiquidity({
|
|
15338
15726
|
index: args.args.index,
|
|
15339
15727
|
source: args.args.source,
|
|
15340
|
-
userAccount: (0,
|
|
15728
|
+
userAccount: (0, import_common24.toWeb3Pk)(args.args.userAccount)
|
|
15341
15729
|
}).accountsPartial({
|
|
15342
|
-
curator: (0,
|
|
15343
|
-
vault: (0,
|
|
15344
|
-
}).instruction().then(
|
|
15730
|
+
curator: (0, import_common24.toWeb3Pk)(args.curator),
|
|
15731
|
+
vault: (0, import_common24.toWeb3Pk)(args.vault)
|
|
15732
|
+
}).instruction().then(import_common24.toKitInstruction);
|
|
15345
15733
|
}
|
|
15346
15734
|
async deriveIxArgs(txArgs) {
|
|
15347
15735
|
return {
|
|
@@ -15362,16 +15750,16 @@ var SetExternalLiquidityBuilder = class extends VaultBuilderBase {
|
|
|
15362
15750
|
};
|
|
15363
15751
|
|
|
15364
15752
|
// src/client/builders/setManagerWithdrawDestination.ts
|
|
15365
|
-
var
|
|
15753
|
+
var import_common25 = __toESM(require_dist());
|
|
15366
15754
|
var SetManagerWithdrawDestinationBuilder = class extends VaultBuilderBase {
|
|
15367
15755
|
async getIx(args) {
|
|
15368
15756
|
return this.program.methods.setManagerWithdrawDestination({
|
|
15369
15757
|
slot: args.args.slot,
|
|
15370
|
-
address: (0,
|
|
15758
|
+
address: (0, import_common25.toWeb3Pk)(args.args.address)
|
|
15371
15759
|
}).accountsPartial({
|
|
15372
|
-
curator: (0,
|
|
15373
|
-
vault: (0,
|
|
15374
|
-
}).instruction().then(
|
|
15760
|
+
curator: (0, import_common25.toWeb3Pk)(args.curator),
|
|
15761
|
+
vault: (0, import_common25.toWeb3Pk)(args.vault)
|
|
15762
|
+
}).instruction().then(import_common25.toKitInstruction);
|
|
15375
15763
|
}
|
|
15376
15764
|
async deriveIxArgs(txArgs) {
|
|
15377
15765
|
return {
|
|
@@ -15391,17 +15779,17 @@ var SetManagerWithdrawDestinationBuilder = class extends VaultBuilderBase {
|
|
|
15391
15779
|
};
|
|
15392
15780
|
|
|
15393
15781
|
// src/client/builders/setAssetPriceOracle.ts
|
|
15394
|
-
var
|
|
15782
|
+
var import_common26 = __toESM(require_dist());
|
|
15395
15783
|
var SetAssetPriceOracleBuilder = class extends VaultBuilderBase {
|
|
15396
15784
|
async getIx(args) {
|
|
15397
15785
|
return this.program.methods.setAssetPriceOracle({
|
|
15398
|
-
mint: (0,
|
|
15786
|
+
mint: (0, import_common26.toWeb3Pk)(args.args.mint),
|
|
15399
15787
|
priceOracleType: args.args.priceOracleType,
|
|
15400
|
-
priceOracleAccount: (0,
|
|
15788
|
+
priceOracleAccount: (0, import_common26.toWeb3Pk)(args.args.priceOracleAccount)
|
|
15401
15789
|
}).accountsPartial({
|
|
15402
|
-
curator: (0,
|
|
15403
|
-
vault: (0,
|
|
15404
|
-
}).instruction().then(
|
|
15790
|
+
curator: (0, import_common26.toWeb3Pk)(args.curator),
|
|
15791
|
+
vault: (0, import_common26.toWeb3Pk)(args.vault)
|
|
15792
|
+
}).instruction().then(import_common26.toKitInstruction);
|
|
15405
15793
|
}
|
|
15406
15794
|
async deriveIxArgs(txArgs) {
|
|
15407
15795
|
return {
|
|
@@ -15422,19 +15810,19 @@ var SetAssetPriceOracleBuilder = class extends VaultBuilderBase {
|
|
|
15422
15810
|
};
|
|
15423
15811
|
|
|
15424
15812
|
// src/client/builders/updateAssetPrice.ts
|
|
15425
|
-
var
|
|
15426
|
-
var
|
|
15813
|
+
var import_core7 = require("@anchor-lang/core");
|
|
15814
|
+
var import_common27 = __toESM(require_dist());
|
|
15427
15815
|
var DEFAULT_PRICE_MAX_AGE_SECS = 90n;
|
|
15428
15816
|
var UpdateAssetPriceBuilder = class extends VaultBuilderBase {
|
|
15429
15817
|
async getIx(args) {
|
|
15430
15818
|
return this.program.methods.updateAssetPrice({
|
|
15431
|
-
mint: (0,
|
|
15819
|
+
mint: (0, import_common27.toWeb3Pk)(args.args.mint),
|
|
15432
15820
|
maxAgeSecs: args.args.maxAgeSecs
|
|
15433
15821
|
}).accountsPartial({
|
|
15434
|
-
updater: (0,
|
|
15435
|
-
vault: (0,
|
|
15436
|
-
oracleAccount: (0,
|
|
15437
|
-
}).instruction().then(
|
|
15822
|
+
updater: (0, import_common27.toWeb3Pk)(args.updater),
|
|
15823
|
+
vault: (0, import_common27.toWeb3Pk)(args.vault),
|
|
15824
|
+
oracleAccount: (0, import_common27.toWeb3Pk)(args.oracleAccount)
|
|
15825
|
+
}).instruction().then(import_common27.toKitInstruction);
|
|
15438
15826
|
}
|
|
15439
15827
|
async deriveIxArgs(txArgs) {
|
|
15440
15828
|
return {
|
|
@@ -15443,7 +15831,7 @@ var UpdateAssetPriceBuilder = class extends VaultBuilderBase {
|
|
|
15443
15831
|
oracleAccount: txArgs.oracleAccount,
|
|
15444
15832
|
args: {
|
|
15445
15833
|
mint: txArgs.mint,
|
|
15446
|
-
maxAgeSecs: new
|
|
15834
|
+
maxAgeSecs: new import_core7.BN(
|
|
15447
15835
|
(txArgs.maxAgeSecs ?? DEFAULT_PRICE_MAX_AGE_SECS).toString()
|
|
15448
15836
|
)
|
|
15449
15837
|
}
|
|
@@ -15466,18 +15854,18 @@ var UpdateAssetPriceBuilder = class extends VaultBuilderBase {
|
|
|
15466
15854
|
};
|
|
15467
15855
|
|
|
15468
15856
|
// src/client/builders/updateConsensusOracle.ts
|
|
15469
|
-
var
|
|
15857
|
+
var import_common28 = __toESM(require_dist());
|
|
15470
15858
|
var UpdateConsensusOracleBuilder = class extends VaultBuilderBase {
|
|
15471
15859
|
async getIx(args) {
|
|
15472
15860
|
return this.program.methods.updateConsensusOracle({
|
|
15473
15861
|
updates: toAnchorConsensusUpdates(args.updates)
|
|
15474
15862
|
}).accountsPartial({
|
|
15475
|
-
signer: (0,
|
|
15476
|
-
vault: (0,
|
|
15477
|
-
vaultOracle: (0,
|
|
15478
|
-
assetMint: args.assetMint ? (0,
|
|
15479
|
-
assetTokenProgram: args.assetTokenProgram ? (0,
|
|
15480
|
-
}).instruction().then(
|
|
15863
|
+
signer: (0, import_common28.toWeb3Pk)(args.signer),
|
|
15864
|
+
vault: (0, import_common28.toWeb3Pk)(args.vault),
|
|
15865
|
+
vaultOracle: (0, import_common28.toWeb3Pk)(args.vaultOracle),
|
|
15866
|
+
assetMint: args.assetMint ? (0, import_common28.toWeb3Pk)(args.assetMint) : null,
|
|
15867
|
+
assetTokenProgram: args.assetTokenProgram ? (0, import_common28.toWeb3Pk)(args.assetTokenProgram) : null
|
|
15868
|
+
}).instruction().then(import_common28.toKitInstruction);
|
|
15481
15869
|
}
|
|
15482
15870
|
async deriveIxArgs(txArgs) {
|
|
15483
15871
|
const [derivedVaultOracle] = await this.pda.deriveVaultOraclePda(
|
|
@@ -15521,25 +15909,25 @@ var UpdateConsensusOracleBuilder = class extends VaultBuilderBase {
|
|
|
15521
15909
|
};
|
|
15522
15910
|
|
|
15523
15911
|
// src/client/builders/executeShareSwap.ts
|
|
15524
|
-
var
|
|
15912
|
+
var import_core8 = require("@anchor-lang/core");
|
|
15525
15913
|
var import_spl_token8 = require("@solana/spl-token");
|
|
15526
|
-
var
|
|
15527
|
-
var
|
|
15914
|
+
var import_web312 = require("@solana/web3.js");
|
|
15915
|
+
var import_common29 = __toESM(require_dist());
|
|
15528
15916
|
var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
15529
15917
|
getIxAccounts(args) {
|
|
15530
15918
|
return {
|
|
15531
|
-
user: (0,
|
|
15532
|
-
vault: (0,
|
|
15533
|
-
vaultOracle: (0,
|
|
15534
|
-
vaultTrancheState: (0,
|
|
15535
|
-
shareMint: (0,
|
|
15536
|
-
trancheShareMint: (0,
|
|
15537
|
-
userShareAta: (0,
|
|
15538
|
-
userTrancheShareAta: (0,
|
|
15539
|
-
shareTokenProgram: (0,
|
|
15540
|
-
trancheShareTokenProgram: (0,
|
|
15919
|
+
user: (0, import_common29.toWeb3Pk)(args.user),
|
|
15920
|
+
vault: (0, import_common29.toWeb3Pk)(args.vault),
|
|
15921
|
+
vaultOracle: (0, import_common29.toWeb3Pk)(args.vaultOracle),
|
|
15922
|
+
vaultTrancheState: (0, import_common29.toWeb3Pk)(args.vaultTrancheState),
|
|
15923
|
+
shareMint: (0, import_common29.toWeb3Pk)(args.shareMint),
|
|
15924
|
+
trancheShareMint: (0, import_common29.toWeb3Pk)(args.trancheShareMint),
|
|
15925
|
+
userShareAta: (0, import_common29.toWeb3Pk)(args.userShareAta),
|
|
15926
|
+
userTrancheShareAta: (0, import_common29.toWeb3Pk)(args.userTrancheShareAta),
|
|
15927
|
+
shareTokenProgram: (0, import_common29.toWeb3Pk)(args.shareTokenProgram),
|
|
15928
|
+
trancheShareTokenProgram: (0, import_common29.toWeb3Pk)(args.trancheShareTokenProgram),
|
|
15541
15929
|
associatedTokenProgram: import_spl_token8.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
15542
|
-
systemProgram:
|
|
15930
|
+
systemProgram: import_web312.SystemProgram.programId
|
|
15543
15931
|
};
|
|
15544
15932
|
}
|
|
15545
15933
|
getIxData(args) {
|
|
@@ -15550,7 +15938,7 @@ var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
|
15550
15938
|
}
|
|
15551
15939
|
async getIx(args) {
|
|
15552
15940
|
const data = this.getIxData(args);
|
|
15553
|
-
return this.program.methods.executeShareSwap(data.kind, data.shareAmount).accountsPartial(this.getIxAccounts(args)).instruction().then(
|
|
15941
|
+
return this.program.methods.executeShareSwap(data.kind, data.shareAmount).accountsPartial(this.getIxAccounts(args)).instruction().then(import_common29.toKitInstruction);
|
|
15554
15942
|
}
|
|
15555
15943
|
async deriveIxArgs(txArgs) {
|
|
15556
15944
|
const [
|
|
@@ -15581,11 +15969,11 @@ var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
|
15581
15969
|
shareMint,
|
|
15582
15970
|
trancheShareMint,
|
|
15583
15971
|
kind: txArgs.kind,
|
|
15584
|
-
shareAmount: new
|
|
15972
|
+
shareAmount: new import_core8.BN(txArgs.shareAmount.toString()),
|
|
15585
15973
|
shareTokenProgram,
|
|
15586
15974
|
trancheShareTokenProgram,
|
|
15587
|
-
userShareAta: (0,
|
|
15588
|
-
userTrancheShareAta: (0,
|
|
15975
|
+
userShareAta: (0, import_common29.getAtaAddress)(shareMint, txArgs.user, shareTokenProgram),
|
|
15976
|
+
userTrancheShareAta: (0, import_common29.getAtaAddress)(
|
|
15589
15977
|
trancheShareMint,
|
|
15590
15978
|
txArgs.user,
|
|
15591
15979
|
trancheShareTokenProgram
|
|
@@ -15593,16 +15981,16 @@ var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
|
15593
15981
|
};
|
|
15594
15982
|
}
|
|
15595
15983
|
async buildPreambleInstructions(args) {
|
|
15596
|
-
const payer = (0,
|
|
15984
|
+
const payer = (0, import_common29.toWeb3Pk)(args.user);
|
|
15597
15985
|
const createUserTrancheShareAta = (0, import_spl_token8.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15598
15986
|
payer,
|
|
15599
|
-
(0,
|
|
15987
|
+
(0, import_common29.toWeb3Pk)(args.userTrancheShareAta),
|
|
15600
15988
|
payer,
|
|
15601
|
-
(0,
|
|
15602
|
-
(0,
|
|
15989
|
+
(0, import_common29.toWeb3Pk)(args.trancheShareMint),
|
|
15990
|
+
(0, import_common29.toWeb3Pk)(args.trancheShareTokenProgram),
|
|
15603
15991
|
import_spl_token8.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15604
15992
|
);
|
|
15605
|
-
return [createUserTrancheShareAta].map(
|
|
15993
|
+
return [createUserTrancheShareAta].map(import_common29.toKitInstruction);
|
|
15606
15994
|
}
|
|
15607
15995
|
async buildPlanExtras(args) {
|
|
15608
15996
|
return {
|
|
@@ -15624,25 +16012,25 @@ var ExecuteShareSwapBuilder = class extends VaultBuilderBase {
|
|
|
15624
16012
|
};
|
|
15625
16013
|
|
|
15626
16014
|
// src/client/builders/executeDeposit.ts
|
|
15627
|
-
var
|
|
16015
|
+
var import_core9 = require("@anchor-lang/core");
|
|
15628
16016
|
var import_spl_token9 = require("@solana/spl-token");
|
|
15629
|
-
var
|
|
16017
|
+
var import_common30 = __toESM(require_dist());
|
|
15630
16018
|
var ExecuteDepositBuilder = class extends VaultBuilderBase {
|
|
15631
16019
|
getIxAccounts(args) {
|
|
15632
16020
|
return {
|
|
15633
|
-
user: (0,
|
|
15634
|
-
vault: (0,
|
|
15635
|
-
vaultOracle: (0,
|
|
15636
|
-
vaultTrancheState: args.vaultTrancheState ? (0,
|
|
15637
|
-
assetMint: (0,
|
|
15638
|
-
shareMint: (0,
|
|
15639
|
-
userAssetAta: (0,
|
|
15640
|
-
vaultAssetAta: (0,
|
|
15641
|
-
feeVault: (0,
|
|
15642
|
-
feeVaultAta: (0,
|
|
15643
|
-
userShareAta: (0,
|
|
15644
|
-
assetTokenProgram: (0,
|
|
15645
|
-
shareTokenProgram: (0,
|
|
16021
|
+
user: (0, import_common30.toWeb3Pk)(args.user),
|
|
16022
|
+
vault: (0, import_common30.toWeb3Pk)(args.vault),
|
|
16023
|
+
vaultOracle: (0, import_common30.toWeb3Pk)(args.vaultOracle),
|
|
16024
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common30.toWeb3Pk)(args.vaultTrancheState) : null,
|
|
16025
|
+
assetMint: (0, import_common30.toWeb3Pk)(args.assetMint),
|
|
16026
|
+
shareMint: (0, import_common30.toWeb3Pk)(args.shareMint),
|
|
16027
|
+
userAssetAta: (0, import_common30.toWeb3Pk)(args.userAssetAta),
|
|
16028
|
+
vaultAssetAta: (0, import_common30.toWeb3Pk)(args.vaultAssetAta),
|
|
16029
|
+
feeVault: (0, import_common30.toWeb3Pk)(args.feeVault),
|
|
16030
|
+
feeVaultAta: (0, import_common30.toWeb3Pk)(args.feeVaultAta),
|
|
16031
|
+
userShareAta: (0, import_common30.toWeb3Pk)(args.userShareAta),
|
|
16032
|
+
assetTokenProgram: (0, import_common30.toWeb3Pk)(args.assetTokenProgram),
|
|
16033
|
+
shareTokenProgram: (0, import_common30.toWeb3Pk)(args.shareTokenProgram)
|
|
15646
16034
|
};
|
|
15647
16035
|
}
|
|
15648
16036
|
getIxData(args) {
|
|
@@ -15659,7 +16047,7 @@ var ExecuteDepositBuilder = class extends VaultBuilderBase {
|
|
|
15659
16047
|
) : this.program.methods.executeDeposit(data.amount);
|
|
15660
16048
|
return methods.accountsPartial(
|
|
15661
16049
|
this.getIxAccounts(args)
|
|
15662
|
-
).instruction().then(
|
|
16050
|
+
).instruction().then(import_common30.toKitInstruction);
|
|
15663
16051
|
}
|
|
15664
16052
|
async deriveIxArgs(txArgs) {
|
|
15665
16053
|
const connection = this.program.provider.connection;
|
|
@@ -15698,61 +16086,61 @@ var ExecuteDepositBuilder = class extends VaultBuilderBase {
|
|
|
15698
16086
|
vaultTrancheState,
|
|
15699
16087
|
assetMint: txArgs.assetMint,
|
|
15700
16088
|
shareMint: txArgs.shareMint,
|
|
15701
|
-
amount: new
|
|
16089
|
+
amount: new import_core9.BN(txArgs.amount.toString()),
|
|
15702
16090
|
addressSeeds: txArgs.addressSeeds,
|
|
15703
16091
|
assetTokenProgram,
|
|
15704
16092
|
shareTokenProgram,
|
|
15705
|
-
userAssetAta: txArgs.userAssetAta ?? (0,
|
|
15706
|
-
vaultAssetAta: (0,
|
|
16093
|
+
userAssetAta: txArgs.userAssetAta ?? (0, import_common30.getAtaAddress)(txArgs.assetMint, txArgs.user, assetTokenProgram),
|
|
16094
|
+
vaultAssetAta: (0, import_common30.getAtaAddress)(
|
|
15707
16095
|
txArgs.assetMint,
|
|
15708
16096
|
txArgs.vault,
|
|
15709
16097
|
assetTokenProgram,
|
|
15710
16098
|
true
|
|
15711
16099
|
),
|
|
15712
16100
|
feeVault,
|
|
15713
|
-
feeVaultAta: (0,
|
|
16101
|
+
feeVaultAta: (0, import_common30.getAtaAddress)(
|
|
15714
16102
|
txArgs.assetMint,
|
|
15715
16103
|
feeVault,
|
|
15716
16104
|
assetTokenProgram,
|
|
15717
16105
|
true
|
|
15718
16106
|
),
|
|
15719
|
-
userShareAta: txArgs.userShareAta ?? (0,
|
|
16107
|
+
userShareAta: txArgs.userShareAta ?? (0, import_common30.getAtaAddress)(txArgs.shareMint, txArgs.user, shareTokenProgram)
|
|
15720
16108
|
};
|
|
15721
16109
|
}
|
|
15722
16110
|
async buildPreambleInstructions(args) {
|
|
15723
|
-
const payer = (0,
|
|
16111
|
+
const payer = (0, import_common30.toWeb3Pk)(args.user);
|
|
15724
16112
|
const createVaultAssetAta = (0, import_spl_token9.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15725
16113
|
payer,
|
|
15726
|
-
(0,
|
|
15727
|
-
(0,
|
|
15728
|
-
(0,
|
|
15729
|
-
(0,
|
|
16114
|
+
(0, import_common30.toWeb3Pk)(args.vaultAssetAta),
|
|
16115
|
+
(0, import_common30.toWeb3Pk)(args.vault),
|
|
16116
|
+
(0, import_common30.toWeb3Pk)(args.assetMint),
|
|
16117
|
+
(0, import_common30.toWeb3Pk)(args.assetTokenProgram),
|
|
15730
16118
|
import_spl_token9.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15731
16119
|
);
|
|
15732
16120
|
const createFeeVaultAta = (0, import_spl_token9.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15733
16121
|
payer,
|
|
15734
|
-
(0,
|
|
15735
|
-
(0,
|
|
15736
|
-
(0,
|
|
15737
|
-
(0,
|
|
16122
|
+
(0, import_common30.toWeb3Pk)(args.feeVaultAta),
|
|
16123
|
+
(0, import_common30.toWeb3Pk)(args.feeVault),
|
|
16124
|
+
(0, import_common30.toWeb3Pk)(args.assetMint),
|
|
16125
|
+
(0, import_common30.toWeb3Pk)(args.assetTokenProgram),
|
|
15738
16126
|
import_spl_token9.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15739
16127
|
);
|
|
15740
|
-
const defaultUserShareAta = (0,
|
|
16128
|
+
const defaultUserShareAta = (0, import_common30.getAtaAddress)(
|
|
15741
16129
|
args.shareMint,
|
|
15742
16130
|
args.user,
|
|
15743
16131
|
args.shareTokenProgram
|
|
15744
16132
|
);
|
|
15745
|
-
const createUserShareAta = (0,
|
|
15746
|
-
(0,
|
|
16133
|
+
const createUserShareAta = (0, import_common30.toWeb3Pk)(args.userShareAta).equals(
|
|
16134
|
+
(0, import_common30.toWeb3Pk)(defaultUserShareAta)
|
|
15747
16135
|
) ? (0, import_spl_token9.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15748
16136
|
payer,
|
|
15749
|
-
(0,
|
|
16137
|
+
(0, import_common30.toWeb3Pk)(args.userShareAta),
|
|
15750
16138
|
payer,
|
|
15751
|
-
(0,
|
|
15752
|
-
(0,
|
|
16139
|
+
(0, import_common30.toWeb3Pk)(args.shareMint),
|
|
16140
|
+
(0, import_common30.toWeb3Pk)(args.shareTokenProgram),
|
|
15753
16141
|
import_spl_token9.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15754
16142
|
) : null;
|
|
15755
|
-
return [createVaultAssetAta, createFeeVaultAta, createUserShareAta].filter((ix) => ix != null).map(
|
|
16143
|
+
return [createVaultAssetAta, createFeeVaultAta, createUserShareAta].filter((ix) => ix != null).map(import_common30.toKitInstruction);
|
|
15756
16144
|
}
|
|
15757
16145
|
async buildPlanExtras(args) {
|
|
15758
16146
|
return {
|
|
@@ -15772,28 +16160,28 @@ var ExecuteDepositBuilder = class extends VaultBuilderBase {
|
|
|
15772
16160
|
};
|
|
15773
16161
|
|
|
15774
16162
|
// src/client/builders/executeTrancheDeposit.ts
|
|
15775
|
-
var
|
|
16163
|
+
var import_core10 = require("@anchor-lang/core");
|
|
15776
16164
|
var import_spl_token10 = require("@solana/spl-token");
|
|
15777
|
-
var
|
|
15778
|
-
var
|
|
16165
|
+
var import_web313 = require("@solana/web3.js");
|
|
16166
|
+
var import_common31 = __toESM(require_dist());
|
|
15779
16167
|
var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
15780
16168
|
getIxAccounts(args) {
|
|
15781
16169
|
return {
|
|
15782
|
-
user: (0,
|
|
15783
|
-
vault: (0,
|
|
15784
|
-
vaultOracle: (0,
|
|
15785
|
-
vaultTrancheState: (0,
|
|
15786
|
-
assetMint: (0,
|
|
15787
|
-
trancheShareMint: (0,
|
|
15788
|
-
userAssetAta: (0,
|
|
15789
|
-
vaultAssetAta: (0,
|
|
15790
|
-
feeVault: (0,
|
|
15791
|
-
feeVaultAta: (0,
|
|
15792
|
-
userTrancheShareAta: (0,
|
|
15793
|
-
assetTokenProgram: (0,
|
|
15794
|
-
shareTokenProgram: (0,
|
|
16170
|
+
user: (0, import_common31.toWeb3Pk)(args.user),
|
|
16171
|
+
vault: (0, import_common31.toWeb3Pk)(args.vault),
|
|
16172
|
+
vaultOracle: (0, import_common31.toWeb3Pk)(args.vaultOracle),
|
|
16173
|
+
vaultTrancheState: (0, import_common31.toWeb3Pk)(args.vaultTrancheState),
|
|
16174
|
+
assetMint: (0, import_common31.toWeb3Pk)(args.assetMint),
|
|
16175
|
+
trancheShareMint: (0, import_common31.toWeb3Pk)(args.trancheShareMint),
|
|
16176
|
+
userAssetAta: (0, import_common31.toWeb3Pk)(args.userAssetAta),
|
|
16177
|
+
vaultAssetAta: (0, import_common31.toWeb3Pk)(args.vaultAssetAta),
|
|
16178
|
+
feeVault: (0, import_common31.toWeb3Pk)(args.feeVault),
|
|
16179
|
+
feeVaultAta: (0, import_common31.toWeb3Pk)(args.feeVaultAta),
|
|
16180
|
+
userTrancheShareAta: (0, import_common31.toWeb3Pk)(args.userTrancheShareAta),
|
|
16181
|
+
assetTokenProgram: (0, import_common31.toWeb3Pk)(args.assetTokenProgram),
|
|
16182
|
+
shareTokenProgram: (0, import_common31.toWeb3Pk)(args.shareTokenProgram),
|
|
15795
16183
|
associatedTokenProgram: import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
15796
|
-
systemProgram:
|
|
16184
|
+
systemProgram: import_web313.SystemProgram.programId
|
|
15797
16185
|
};
|
|
15798
16186
|
}
|
|
15799
16187
|
getIxData(args) {
|
|
@@ -15812,7 +16200,7 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
15812
16200
|
) : this.program.methods.executeTrancheDeposit(data.kind, data.amount);
|
|
15813
16201
|
return methods.accountsPartial(
|
|
15814
16202
|
this.getIxAccounts(args)
|
|
15815
|
-
).instruction().then(
|
|
16203
|
+
).instruction().then(import_common31.toKitInstruction);
|
|
15816
16204
|
}
|
|
15817
16205
|
async deriveIxArgs(txArgs) {
|
|
15818
16206
|
const connection = this.program.provider.connection;
|
|
@@ -15841,29 +16229,29 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
15841
16229
|
assetMint: txArgs.assetMint,
|
|
15842
16230
|
trancheShareMint,
|
|
15843
16231
|
kind: txArgs.kind,
|
|
15844
|
-
amount: new
|
|
16232
|
+
amount: new import_core10.BN(txArgs.amount.toString()),
|
|
15845
16233
|
addressSeeds: txArgs.addressSeeds,
|
|
15846
16234
|
assetTokenProgram,
|
|
15847
16235
|
shareTokenProgram,
|
|
15848
|
-
userAssetAta: (0,
|
|
16236
|
+
userAssetAta: (0, import_common31.getAtaAddress)(
|
|
15849
16237
|
txArgs.assetMint,
|
|
15850
16238
|
txArgs.user,
|
|
15851
16239
|
assetTokenProgram
|
|
15852
16240
|
),
|
|
15853
|
-
vaultAssetAta: (0,
|
|
16241
|
+
vaultAssetAta: (0, import_common31.getAtaAddress)(
|
|
15854
16242
|
txArgs.assetMint,
|
|
15855
16243
|
txArgs.vault,
|
|
15856
16244
|
assetTokenProgram,
|
|
15857
16245
|
true
|
|
15858
16246
|
),
|
|
15859
16247
|
feeVault,
|
|
15860
|
-
feeVaultAta: (0,
|
|
16248
|
+
feeVaultAta: (0, import_common31.getAtaAddress)(
|
|
15861
16249
|
txArgs.assetMint,
|
|
15862
16250
|
feeVault,
|
|
15863
16251
|
assetTokenProgram,
|
|
15864
16252
|
true
|
|
15865
16253
|
),
|
|
15866
|
-
userTrancheShareAta: (0,
|
|
16254
|
+
userTrancheShareAta: (0, import_common31.getAtaAddress)(
|
|
15867
16255
|
trancheShareMint,
|
|
15868
16256
|
txArgs.user,
|
|
15869
16257
|
shareTokenProgram
|
|
@@ -15871,33 +16259,33 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
15871
16259
|
};
|
|
15872
16260
|
}
|
|
15873
16261
|
async buildPreambleInstructions(args) {
|
|
15874
|
-
const payer = (0,
|
|
16262
|
+
const payer = (0, import_common31.toWeb3Pk)(args.user);
|
|
15875
16263
|
const createVaultAssetAta = (0, import_spl_token10.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15876
16264
|
payer,
|
|
15877
|
-
(0,
|
|
15878
|
-
(0,
|
|
15879
|
-
(0,
|
|
15880
|
-
(0,
|
|
16265
|
+
(0, import_common31.toWeb3Pk)(args.vaultAssetAta),
|
|
16266
|
+
(0, import_common31.toWeb3Pk)(args.vault),
|
|
16267
|
+
(0, import_common31.toWeb3Pk)(args.assetMint),
|
|
16268
|
+
(0, import_common31.toWeb3Pk)(args.assetTokenProgram),
|
|
15881
16269
|
import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15882
16270
|
);
|
|
15883
16271
|
const createUserShareAta = (0, import_spl_token10.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15884
16272
|
payer,
|
|
15885
|
-
(0,
|
|
16273
|
+
(0, import_common31.toWeb3Pk)(args.userTrancheShareAta),
|
|
15886
16274
|
payer,
|
|
15887
|
-
(0,
|
|
15888
|
-
(0,
|
|
16275
|
+
(0, import_common31.toWeb3Pk)(args.trancheShareMint),
|
|
16276
|
+
(0, import_common31.toWeb3Pk)(args.shareTokenProgram),
|
|
15889
16277
|
import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15890
16278
|
);
|
|
15891
16279
|
const createFeeVaultAta = (0, import_spl_token10.createAssociatedTokenAccountIdempotentInstruction)(
|
|
15892
16280
|
payer,
|
|
15893
|
-
(0,
|
|
15894
|
-
(0,
|
|
15895
|
-
(0,
|
|
15896
|
-
(0,
|
|
16281
|
+
(0, import_common31.toWeb3Pk)(args.feeVaultAta),
|
|
16282
|
+
(0, import_common31.toWeb3Pk)(args.feeVault),
|
|
16283
|
+
(0, import_common31.toWeb3Pk)(args.assetMint),
|
|
16284
|
+
(0, import_common31.toWeb3Pk)(args.assetTokenProgram),
|
|
15897
16285
|
import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
15898
16286
|
);
|
|
15899
16287
|
return [createVaultAssetAta, createFeeVaultAta, createUserShareAta].map(
|
|
15900
|
-
|
|
16288
|
+
import_common31.toKitInstruction
|
|
15901
16289
|
);
|
|
15902
16290
|
}
|
|
15903
16291
|
async buildPlanExtras(args) {
|
|
@@ -15920,27 +16308,27 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
15920
16308
|
};
|
|
15921
16309
|
|
|
15922
16310
|
// src/client/builders/executeTrancheWithdraw.ts
|
|
15923
|
-
var
|
|
16311
|
+
var import_core11 = require("@anchor-lang/core");
|
|
15924
16312
|
var import_spl_token11 = require("@solana/spl-token");
|
|
15925
|
-
var
|
|
15926
|
-
var
|
|
16313
|
+
var import_web315 = require("@solana/web3.js");
|
|
16314
|
+
var import_common33 = __toESM(require_dist());
|
|
15927
16315
|
|
|
15928
16316
|
// src/client/builders/externalLiquidity.ts
|
|
15929
16317
|
var import_kit7 = require("@solana/kit");
|
|
15930
|
-
var
|
|
15931
|
-
var
|
|
16318
|
+
var import_web314 = require("@solana/web3.js");
|
|
16319
|
+
var import_common32 = __toESM(require_dist());
|
|
15932
16320
|
var import_marginfi = __toESM(require_dist2());
|
|
15933
16321
|
function parseMarginfiSlot(slot) {
|
|
15934
16322
|
const data = slot?.data;
|
|
15935
16323
|
if (!data || data.length < 40) return null;
|
|
15936
16324
|
if (data[0] !== 1) return null;
|
|
15937
16325
|
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
15938
|
-
const userAccount = new
|
|
16326
|
+
const userAccount = new import_web314.PublicKey(pubkeyBytes).toBase58();
|
|
15939
16327
|
return { userAccount };
|
|
15940
16328
|
}
|
|
15941
16329
|
function toWeb3AccountMeta(account) {
|
|
15942
16330
|
return {
|
|
15943
|
-
pubkey: new
|
|
16331
|
+
pubkey: new import_web314.PublicKey(account.address),
|
|
15944
16332
|
isWritable: account.role === import_kit7.AccountRole.WRITABLE || account.role === import_kit7.AccountRole.WRITABLE_SIGNER,
|
|
15945
16333
|
isSigner: account.role === import_kit7.AccountRole.READONLY_SIGNER || account.role === import_kit7.AccountRole.WRITABLE_SIGNER
|
|
15946
16334
|
};
|
|
@@ -15979,7 +16367,7 @@ function resolveExternalWithdraw({
|
|
|
15979
16367
|
};
|
|
15980
16368
|
}
|
|
15981
16369
|
const marginfiClient = new import_marginfi.CpiClient({ accounts: marginfiAccounts });
|
|
15982
|
-
const withdrawRefs = (0,
|
|
16370
|
+
const withdrawRefs = (0, import_common32.createCpiRefs)([
|
|
15983
16371
|
marginfiClient.withdraw_cpi({
|
|
15984
16372
|
marginfiAccount: slot0.userAccount,
|
|
15985
16373
|
authority: vault,
|
|
@@ -15999,14 +16387,14 @@ function buildMarginfiWithdrawInteraction(args) {
|
|
|
15999
16387
|
`No Marginfi market is configured for asset mint ${args.assetMint}`
|
|
16000
16388
|
);
|
|
16001
16389
|
}
|
|
16002
|
-
const vaultAssetAta = (0,
|
|
16390
|
+
const vaultAssetAta = (0, import_common32.getAtaAddress)(
|
|
16003
16391
|
args.assetMint,
|
|
16004
16392
|
args.vault,
|
|
16005
16393
|
marginfiAccounts.tokenProgram,
|
|
16006
16394
|
true
|
|
16007
16395
|
);
|
|
16008
16396
|
const marginfiClient = new import_marginfi.CpiClient({ accounts: marginfiAccounts });
|
|
16009
|
-
const withdraw = (0,
|
|
16397
|
+
const withdraw = (0, import_common32.createCpiRefs)([
|
|
16010
16398
|
marginfiClient.withdraw_cpi({
|
|
16011
16399
|
marginfiAccount: args.marginfiAccount,
|
|
16012
16400
|
authority: args.vault,
|
|
@@ -16030,19 +16418,19 @@ function buildMarginfiWithdrawInteraction(args) {
|
|
|
16030
16418
|
var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
16031
16419
|
getIxAccounts(args) {
|
|
16032
16420
|
return {
|
|
16033
|
-
user: (0,
|
|
16034
|
-
vault: (0,
|
|
16035
|
-
vaultOracle: (0,
|
|
16036
|
-
vaultTrancheState: (0,
|
|
16037
|
-
assetMint: (0,
|
|
16038
|
-
trancheShareMint: (0,
|
|
16039
|
-
userAssetAta: (0,
|
|
16040
|
-
vaultAssetAta: (0,
|
|
16041
|
-
userTrancheShareAta: (0,
|
|
16042
|
-
assetTokenProgram: (0,
|
|
16043
|
-
shareTokenProgram: (0,
|
|
16421
|
+
user: (0, import_common33.toWeb3Pk)(args.user),
|
|
16422
|
+
vault: (0, import_common33.toWeb3Pk)(args.vault),
|
|
16423
|
+
vaultOracle: (0, import_common33.toWeb3Pk)(args.vaultOracle),
|
|
16424
|
+
vaultTrancheState: (0, import_common33.toWeb3Pk)(args.vaultTrancheState),
|
|
16425
|
+
assetMint: (0, import_common33.toWeb3Pk)(args.assetMint),
|
|
16426
|
+
trancheShareMint: (0, import_common33.toWeb3Pk)(args.trancheShareMint),
|
|
16427
|
+
userAssetAta: (0, import_common33.toWeb3Pk)(args.userAssetAta),
|
|
16428
|
+
vaultAssetAta: (0, import_common33.toWeb3Pk)(args.vaultAssetAta),
|
|
16429
|
+
userTrancheShareAta: (0, import_common33.toWeb3Pk)(args.userTrancheShareAta),
|
|
16430
|
+
assetTokenProgram: (0, import_common33.toWeb3Pk)(args.assetTokenProgram),
|
|
16431
|
+
shareTokenProgram: (0, import_common33.toWeb3Pk)(args.shareTokenProgram),
|
|
16044
16432
|
associatedTokenProgram: import_spl_token11.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16045
|
-
systemProgram:
|
|
16433
|
+
systemProgram: import_web315.SystemProgram.programId
|
|
16046
16434
|
};
|
|
16047
16435
|
}
|
|
16048
16436
|
getIxData(args) {
|
|
@@ -16079,7 +16467,7 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16079
16467
|
);
|
|
16080
16468
|
return methods.accountsPartial(
|
|
16081
16469
|
this.getIxAccounts(args)
|
|
16082
|
-
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(
|
|
16470
|
+
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(import_common33.toKitInstruction);
|
|
16083
16471
|
}
|
|
16084
16472
|
async deriveIxArgs(txArgs) {
|
|
16085
16473
|
const connection = this.program.provider.connection;
|
|
@@ -16100,7 +16488,7 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16100
16488
|
txArgs.assetTokenProgram
|
|
16101
16489
|
);
|
|
16102
16490
|
const { mint: trancheShareMint, tokenProgram: shareTokenProgram } = trancheShare;
|
|
16103
|
-
const vaultAssetAta = (0,
|
|
16491
|
+
const vaultAssetAta = (0, import_common33.getAtaAddress)(
|
|
16104
16492
|
txArgs.assetMint,
|
|
16105
16493
|
txArgs.vault,
|
|
16106
16494
|
assetTokenProgram,
|
|
@@ -16125,17 +16513,17 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16125
16513
|
assetMint: txArgs.assetMint,
|
|
16126
16514
|
trancheShareMint,
|
|
16127
16515
|
kind: txArgs.kind,
|
|
16128
|
-
shareAmount: new
|
|
16516
|
+
shareAmount: new import_core11.BN(txArgs.shareAmount.toString()),
|
|
16129
16517
|
addressSeeds: txArgs.addressSeeds,
|
|
16130
16518
|
assetTokenProgram,
|
|
16131
16519
|
shareTokenProgram,
|
|
16132
|
-
userAssetAta: (0,
|
|
16520
|
+
userAssetAta: (0, import_common33.getAtaAddress)(
|
|
16133
16521
|
txArgs.assetMint,
|
|
16134
16522
|
txArgs.user,
|
|
16135
16523
|
assetTokenProgram
|
|
16136
16524
|
),
|
|
16137
16525
|
vaultAssetAta,
|
|
16138
|
-
userTrancheShareAta: (0,
|
|
16526
|
+
userTrancheShareAta: (0, import_common33.getAtaAddress)(
|
|
16139
16527
|
trancheShareMint,
|
|
16140
16528
|
txArgs.user,
|
|
16141
16529
|
shareTokenProgram
|
|
@@ -16149,16 +16537,16 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16149
16537
|
return txArgs.lookupTables;
|
|
16150
16538
|
}
|
|
16151
16539
|
async buildPreambleInstructions(args) {
|
|
16152
|
-
const payer = (0,
|
|
16540
|
+
const payer = (0, import_common33.toWeb3Pk)(args.user);
|
|
16153
16541
|
const createUserAssetAta = (0, import_spl_token11.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16154
16542
|
payer,
|
|
16155
|
-
(0,
|
|
16543
|
+
(0, import_common33.toWeb3Pk)(args.userAssetAta),
|
|
16156
16544
|
payer,
|
|
16157
|
-
(0,
|
|
16158
|
-
(0,
|
|
16545
|
+
(0, import_common33.toWeb3Pk)(args.assetMint),
|
|
16546
|
+
(0, import_common33.toWeb3Pk)(args.assetTokenProgram),
|
|
16159
16547
|
import_spl_token11.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16160
16548
|
);
|
|
16161
|
-
return [createUserAssetAta].map(
|
|
16549
|
+
return [createUserAssetAta].map(import_common33.toKitInstruction);
|
|
16162
16550
|
}
|
|
16163
16551
|
async buildPlanExtras(args) {
|
|
16164
16552
|
return {
|
|
@@ -16170,25 +16558,25 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16170
16558
|
};
|
|
16171
16559
|
|
|
16172
16560
|
// src/client/builders/executeWithdraw.ts
|
|
16173
|
-
var
|
|
16561
|
+
var import_core12 = require("@anchor-lang/core");
|
|
16174
16562
|
var import_spl_token12 = require("@solana/spl-token");
|
|
16175
|
-
var
|
|
16563
|
+
var import_common34 = __toESM(require_dist());
|
|
16176
16564
|
var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
16177
16565
|
getIxAccounts(args) {
|
|
16178
16566
|
return {
|
|
16179
|
-
user: (0,
|
|
16180
|
-
vault: (0,
|
|
16181
|
-
vaultOracle: (0,
|
|
16182
|
-
vaultTrancheState: args.vaultTrancheState ? (0,
|
|
16183
|
-
assetMint: (0,
|
|
16184
|
-
shareMint: (0,
|
|
16185
|
-
userAssetAta: (0,
|
|
16186
|
-
vaultAssetAta: (0,
|
|
16187
|
-
feeVault: (0,
|
|
16188
|
-
feeVaultAta: (0,
|
|
16189
|
-
userShareAta: (0,
|
|
16190
|
-
assetTokenProgram: (0,
|
|
16191
|
-
shareTokenProgram: (0,
|
|
16567
|
+
user: (0, import_common34.toWeb3Pk)(args.user),
|
|
16568
|
+
vault: (0, import_common34.toWeb3Pk)(args.vault),
|
|
16569
|
+
vaultOracle: (0, import_common34.toWeb3Pk)(args.vaultOracle),
|
|
16570
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common34.toWeb3Pk)(args.vaultTrancheState) : null,
|
|
16571
|
+
assetMint: (0, import_common34.toWeb3Pk)(args.assetMint),
|
|
16572
|
+
shareMint: (0, import_common34.toWeb3Pk)(args.shareMint),
|
|
16573
|
+
userAssetAta: (0, import_common34.toWeb3Pk)(args.userAssetAta),
|
|
16574
|
+
vaultAssetAta: (0, import_common34.toWeb3Pk)(args.vaultAssetAta),
|
|
16575
|
+
feeVault: (0, import_common34.toWeb3Pk)(args.feeVault),
|
|
16576
|
+
feeVaultAta: (0, import_common34.toWeb3Pk)(args.feeVaultAta),
|
|
16577
|
+
userShareAta: (0, import_common34.toWeb3Pk)(args.userShareAta),
|
|
16578
|
+
assetTokenProgram: (0, import_common34.toWeb3Pk)(args.assetTokenProgram),
|
|
16579
|
+
shareTokenProgram: (0, import_common34.toWeb3Pk)(args.shareTokenProgram)
|
|
16192
16580
|
};
|
|
16193
16581
|
}
|
|
16194
16582
|
getIxData(args) {
|
|
@@ -16218,7 +16606,7 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16218
16606
|
) : this.program.methods.executeWithdraw(data.shareAmount);
|
|
16219
16607
|
return methods.accountsPartial(
|
|
16220
16608
|
this.getIxAccounts(args)
|
|
16221
|
-
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(
|
|
16609
|
+
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(import_common34.toKitInstruction);
|
|
16222
16610
|
}
|
|
16223
16611
|
async deriveIxArgs(txArgs) {
|
|
16224
16612
|
const connection = this.program.provider.connection;
|
|
@@ -16252,7 +16640,7 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16252
16640
|
),
|
|
16253
16641
|
this.account.fetchVault(txArgs.vault)
|
|
16254
16642
|
]);
|
|
16255
|
-
const vaultAssetAta = (0,
|
|
16643
|
+
const vaultAssetAta = (0, import_common34.getAtaAddress)(
|
|
16256
16644
|
txArgs.assetMint,
|
|
16257
16645
|
txArgs.vault,
|
|
16258
16646
|
assetTokenProgram,
|
|
@@ -16276,19 +16664,19 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16276
16664
|
vaultTrancheState: vaultTrancheState ?? null,
|
|
16277
16665
|
assetMint: txArgs.assetMint,
|
|
16278
16666
|
shareMint: txArgs.shareMint,
|
|
16279
|
-
shareAmount: new
|
|
16667
|
+
shareAmount: new import_core12.BN(txArgs.shareAmount.toString()),
|
|
16280
16668
|
assetTokenProgram,
|
|
16281
16669
|
shareTokenProgram,
|
|
16282
|
-
userAssetAta: txArgs.userAssetAta ?? (0,
|
|
16670
|
+
userAssetAta: txArgs.userAssetAta ?? (0, import_common34.getAtaAddress)(txArgs.assetMint, txArgs.user, assetTokenProgram),
|
|
16283
16671
|
vaultAssetAta,
|
|
16284
16672
|
feeVault,
|
|
16285
|
-
feeVaultAta: (0,
|
|
16673
|
+
feeVaultAta: (0, import_common34.getAtaAddress)(
|
|
16286
16674
|
txArgs.assetMint,
|
|
16287
16675
|
feeVault,
|
|
16288
16676
|
assetTokenProgram,
|
|
16289
16677
|
true
|
|
16290
16678
|
),
|
|
16291
|
-
userShareAta: txArgs.userShareAta ?? (0,
|
|
16679
|
+
userShareAta: txArgs.userShareAta ?? (0, import_common34.getAtaAddress)(txArgs.shareMint, txArgs.user, shareTokenProgram),
|
|
16292
16680
|
externalWithdrawIxRefs,
|
|
16293
16681
|
externalLiquiditySource,
|
|
16294
16682
|
externalWithdrawAccounts,
|
|
@@ -16299,31 +16687,31 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16299
16687
|
return txArgs.lookupTables;
|
|
16300
16688
|
}
|
|
16301
16689
|
async buildPreambleInstructions(args) {
|
|
16302
|
-
const defaultUserAssetAta = (0,
|
|
16690
|
+
const defaultUserAssetAta = (0, import_common34.getAtaAddress)(
|
|
16303
16691
|
args.assetMint,
|
|
16304
16692
|
args.user,
|
|
16305
16693
|
args.assetTokenProgram
|
|
16306
16694
|
);
|
|
16307
|
-
const payer = (0,
|
|
16308
|
-
const createUserAssetAta = (0,
|
|
16309
|
-
(0,
|
|
16695
|
+
const payer = (0, import_common34.toWeb3Pk)(args.user);
|
|
16696
|
+
const createUserAssetAta = (0, import_common34.toWeb3Pk)(args.userAssetAta).equals(
|
|
16697
|
+
(0, import_common34.toWeb3Pk)(defaultUserAssetAta)
|
|
16310
16698
|
) ? (0, import_spl_token12.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16311
16699
|
payer,
|
|
16312
|
-
(0,
|
|
16700
|
+
(0, import_common34.toWeb3Pk)(args.userAssetAta),
|
|
16313
16701
|
payer,
|
|
16314
|
-
(0,
|
|
16315
|
-
(0,
|
|
16702
|
+
(0, import_common34.toWeb3Pk)(args.assetMint),
|
|
16703
|
+
(0, import_common34.toWeb3Pk)(args.assetTokenProgram),
|
|
16316
16704
|
import_spl_token12.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16317
16705
|
) : null;
|
|
16318
16706
|
const createFeeVaultAta = (0, import_spl_token12.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16319
16707
|
payer,
|
|
16320
|
-
(0,
|
|
16321
|
-
(0,
|
|
16322
|
-
(0,
|
|
16323
|
-
(0,
|
|
16708
|
+
(0, import_common34.toWeb3Pk)(args.feeVaultAta),
|
|
16709
|
+
(0, import_common34.toWeb3Pk)(args.feeVault),
|
|
16710
|
+
(0, import_common34.toWeb3Pk)(args.assetMint),
|
|
16711
|
+
(0, import_common34.toWeb3Pk)(args.assetTokenProgram),
|
|
16324
16712
|
import_spl_token12.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16325
16713
|
);
|
|
16326
|
-
return [createUserAssetAta, createFeeVaultAta].filter((ix) => ix != null).map(
|
|
16714
|
+
return [createUserAssetAta, createFeeVaultAta].filter((ix) => ix != null).map(import_common34.toKitInstruction);
|
|
16327
16715
|
}
|
|
16328
16716
|
async buildPlanExtras(args) {
|
|
16329
16717
|
return {
|
|
@@ -16334,8 +16722,8 @@ var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16334
16722
|
|
|
16335
16723
|
// src/client/builders/fulfillJuniorTrancheWithdraw.ts
|
|
16336
16724
|
var import_spl_token13 = require("@solana/spl-token");
|
|
16337
|
-
var
|
|
16338
|
-
var
|
|
16725
|
+
var import_web316 = require("@solana/web3.js");
|
|
16726
|
+
var import_common35 = __toESM(require_dist());
|
|
16339
16727
|
var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
16340
16728
|
async getIx(args) {
|
|
16341
16729
|
const externalWithdrawIxRefs = args.externalWithdrawIxRefs ?? null;
|
|
@@ -16349,24 +16737,24 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16349
16737
|
externalLiquiditySource
|
|
16350
16738
|
);
|
|
16351
16739
|
return methods.accountsPartial({
|
|
16352
|
-
signer: (0,
|
|
16353
|
-
owner: (0,
|
|
16354
|
-
queuePayer: (0,
|
|
16355
|
-
vault: (0,
|
|
16356
|
-
vaultOracle: (0,
|
|
16357
|
-
vaultTrancheState: (0,
|
|
16358
|
-
withdrawalQueue: (0,
|
|
16359
|
-
outputMint: (0,
|
|
16360
|
-
inputMint: (0,
|
|
16361
|
-
ownerInputAta: (0,
|
|
16362
|
-
ownerOutputAta: (0,
|
|
16363
|
-
vaultOutputAta: (0,
|
|
16364
|
-
queueInputAta: (0,
|
|
16365
|
-
assetTokenProgram: (0,
|
|
16366
|
-
shareTokenProgram: (0,
|
|
16740
|
+
signer: (0, import_common35.toWeb3Pk)(args.signer),
|
|
16741
|
+
owner: (0, import_common35.toWeb3Pk)(args.owner),
|
|
16742
|
+
queuePayer: (0, import_common35.toWeb3Pk)(args.queuePayer),
|
|
16743
|
+
vault: (0, import_common35.toWeb3Pk)(args.vault),
|
|
16744
|
+
vaultOracle: (0, import_common35.toWeb3Pk)(args.vaultOracle),
|
|
16745
|
+
vaultTrancheState: (0, import_common35.toWeb3Pk)(args.vaultTrancheState),
|
|
16746
|
+
withdrawalQueue: (0, import_common35.toWeb3Pk)(args.withdrawalQueue),
|
|
16747
|
+
outputMint: (0, import_common35.toWeb3Pk)(args.outputMint),
|
|
16748
|
+
inputMint: (0, import_common35.toWeb3Pk)(args.inputMint),
|
|
16749
|
+
ownerInputAta: (0, import_common35.toWeb3Pk)(args.ownerInputAta),
|
|
16750
|
+
ownerOutputAta: (0, import_common35.toWeb3Pk)(args.ownerOutputAta),
|
|
16751
|
+
vaultOutputAta: (0, import_common35.toWeb3Pk)(args.vaultOutputAta),
|
|
16752
|
+
queueInputAta: (0, import_common35.toWeb3Pk)(args.queueInputAta),
|
|
16753
|
+
assetTokenProgram: (0, import_common35.toWeb3Pk)(args.assetTokenProgram),
|
|
16754
|
+
shareTokenProgram: (0, import_common35.toWeb3Pk)(args.shareTokenProgram),
|
|
16367
16755
|
associatedTokenProgram: import_spl_token13.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16368
|
-
systemProgram:
|
|
16369
|
-
}).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(
|
|
16756
|
+
systemProgram: import_web316.SystemProgram.programId
|
|
16757
|
+
}).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(import_common35.toKitInstruction);
|
|
16370
16758
|
}
|
|
16371
16759
|
async deriveIxArgs(txArgs) {
|
|
16372
16760
|
const connection = this.program.provider.connection;
|
|
@@ -16407,7 +16795,7 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16407
16795
|
]);
|
|
16408
16796
|
const { mint: juniorShareMint, tokenProgram: shareTokenProgram } = juniorShare;
|
|
16409
16797
|
const queuePda = txArgs.withdrawalQueue ?? withdrawalQueue;
|
|
16410
|
-
const vaultOutputAta = (0,
|
|
16798
|
+
const vaultOutputAta = (0, import_common35.getAtaAddress)(
|
|
16411
16799
|
txArgs.assetMint,
|
|
16412
16800
|
txArgs.vault,
|
|
16413
16801
|
assetTokenProgram,
|
|
@@ -16436,14 +16824,14 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16436
16824
|
inputMint: juniorShareMint,
|
|
16437
16825
|
assetTokenProgram,
|
|
16438
16826
|
shareTokenProgram,
|
|
16439
|
-
ownerInputAta: txArgs.ownerInputAta ?? (0,
|
|
16440
|
-
ownerOutputAta: (0,
|
|
16827
|
+
ownerInputAta: txArgs.ownerInputAta ?? (0, import_common35.getAtaAddress)(juniorShareMint, txArgs.owner, shareTokenProgram),
|
|
16828
|
+
ownerOutputAta: (0, import_common35.getAtaAddress)(
|
|
16441
16829
|
txArgs.assetMint,
|
|
16442
16830
|
txArgs.owner,
|
|
16443
16831
|
assetTokenProgram
|
|
16444
16832
|
),
|
|
16445
16833
|
vaultOutputAta,
|
|
16446
|
-
queueInputAta: (0,
|
|
16834
|
+
queueInputAta: (0, import_common35.getAtaAddress)(
|
|
16447
16835
|
juniorShareMint,
|
|
16448
16836
|
queuePda,
|
|
16449
16837
|
shareTokenProgram,
|
|
@@ -16459,22 +16847,22 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16459
16847
|
return txArgs.lookupTables;
|
|
16460
16848
|
}
|
|
16461
16849
|
async buildPreambleInstructions(args) {
|
|
16462
|
-
const defaultOwnerInputAta = (0,
|
|
16850
|
+
const defaultOwnerInputAta = (0, import_common35.getAtaAddress)(
|
|
16463
16851
|
args.inputMint,
|
|
16464
16852
|
args.owner,
|
|
16465
16853
|
args.shareTokenProgram
|
|
16466
16854
|
);
|
|
16467
|
-
if (!(0,
|
|
16855
|
+
if (!(0, import_common35.toWeb3Pk)(args.ownerInputAta).equals((0, import_common35.toWeb3Pk)(defaultOwnerInputAta))) {
|
|
16468
16856
|
return [];
|
|
16469
16857
|
}
|
|
16470
16858
|
return [
|
|
16471
|
-
(0,
|
|
16859
|
+
(0, import_common35.toKitInstruction)(
|
|
16472
16860
|
(0, import_spl_token13.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16473
|
-
(0,
|
|
16474
|
-
(0,
|
|
16475
|
-
(0,
|
|
16476
|
-
(0,
|
|
16477
|
-
(0,
|
|
16861
|
+
(0, import_common35.toWeb3Pk)(args.signer),
|
|
16862
|
+
(0, import_common35.toWeb3Pk)(args.ownerInputAta),
|
|
16863
|
+
(0, import_common35.toWeb3Pk)(args.owner),
|
|
16864
|
+
(0, import_common35.toWeb3Pk)(args.inputMint),
|
|
16865
|
+
(0, import_common35.toWeb3Pk)(args.shareTokenProgram),
|
|
16478
16866
|
import_spl_token13.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16479
16867
|
)
|
|
16480
16868
|
)
|
|
@@ -16494,8 +16882,8 @@ var FulfillJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16494
16882
|
};
|
|
16495
16883
|
|
|
16496
16884
|
// src/client/builders/updateTrancheConfig.ts
|
|
16497
|
-
var
|
|
16498
|
-
var
|
|
16885
|
+
var import_core13 = require("@anchor-lang/core");
|
|
16886
|
+
var import_common36 = __toESM(require_dist());
|
|
16499
16887
|
var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
16500
16888
|
async getIx(args) {
|
|
16501
16889
|
return this.program.methods.vaultUpdateTrancheConfig({
|
|
@@ -16506,11 +16894,11 @@ var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
|
16506
16894
|
targetLockupDurationSecs: args.targetLockupDurationSecs,
|
|
16507
16895
|
juniorDepositCap: args.juniorDepositCap
|
|
16508
16896
|
}).accountsPartial({
|
|
16509
|
-
curator: (0,
|
|
16510
|
-
vault: (0,
|
|
16511
|
-
vaultTrancheState: (0,
|
|
16512
|
-
vaultOracle: (0,
|
|
16513
|
-
}).instruction().then(
|
|
16897
|
+
curator: (0, import_common36.toWeb3Pk)(args.curator),
|
|
16898
|
+
vault: (0, import_common36.toWeb3Pk)(args.vault),
|
|
16899
|
+
vaultTrancheState: (0, import_common36.toWeb3Pk)(args.vaultTrancheState),
|
|
16900
|
+
vaultOracle: (0, import_common36.toWeb3Pk)(args.vaultOracle)
|
|
16901
|
+
}).instruction().then(import_common36.toKitInstruction);
|
|
16514
16902
|
}
|
|
16515
16903
|
async deriveIxArgs(txArgs) {
|
|
16516
16904
|
const [vaultTrancheState] = await this.pda.deriveVaultTrancheStatePda(
|
|
@@ -16526,8 +16914,8 @@ var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
|
16526
16914
|
juniorFloorApyBps: txArgs.juniorFloorApyBps ?? null,
|
|
16527
16915
|
earlyUnstakeFeeBps: txArgs.earlyUnstakeFeeBps ?? null,
|
|
16528
16916
|
standardUnstakeFeeBps: txArgs.standardUnstakeFeeBps ?? null,
|
|
16529
|
-
targetLockupDurationSecs: txArgs.targetLockupDurationSecs === void 0 ? null : new
|
|
16530
|
-
juniorDepositCap: txArgs.juniorDepositCap === void 0 ? null : new
|
|
16917
|
+
targetLockupDurationSecs: txArgs.targetLockupDurationSecs === void 0 ? null : new import_core13.BN(txArgs.targetLockupDurationSecs.toString()),
|
|
16918
|
+
juniorDepositCap: txArgs.juniorDepositCap === void 0 ? null : new import_core13.BN(txArgs.juniorDepositCap.toString())
|
|
16531
16919
|
};
|
|
16532
16920
|
}
|
|
16533
16921
|
async buildPlanExtras(args) {
|
|
@@ -16540,25 +16928,25 @@ var UpdateTrancheConfigBuilder = class extends VaultBuilderBase {
|
|
|
16540
16928
|
};
|
|
16541
16929
|
|
|
16542
16930
|
// src/client/builders/managerRedepositAsset.ts
|
|
16543
|
-
var
|
|
16931
|
+
var import_core14 = require("@anchor-lang/core");
|
|
16544
16932
|
var import_spl_token14 = require("@solana/spl-token");
|
|
16545
|
-
var
|
|
16546
|
-
var
|
|
16933
|
+
var import_web317 = require("@solana/web3.js");
|
|
16934
|
+
var import_common37 = __toESM(require_dist());
|
|
16547
16935
|
var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
16548
16936
|
async getIx(args) {
|
|
16549
16937
|
return this.program.methods.managerRedepositAsset({
|
|
16550
16938
|
depositAmount: args.depositAmount,
|
|
16551
16939
|
externalAmount: args.externalAmount
|
|
16552
16940
|
}).accountsPartial({
|
|
16553
|
-
manager: (0,
|
|
16554
|
-
vault: (0,
|
|
16555
|
-
assetMint: (0,
|
|
16556
|
-
vaultAssetAta: (0,
|
|
16557
|
-
managerAssetAta: (0,
|
|
16558
|
-
assetTokenProgram: (0,
|
|
16941
|
+
manager: (0, import_common37.toWeb3Pk)(args.manager),
|
|
16942
|
+
vault: (0, import_common37.toWeb3Pk)(args.vault),
|
|
16943
|
+
assetMint: (0, import_common37.toWeb3Pk)(args.assetMint),
|
|
16944
|
+
vaultAssetAta: (0, import_common37.toWeb3Pk)(args.vaultAssetAta),
|
|
16945
|
+
managerAssetAta: (0, import_common37.toWeb3Pk)(args.managerAssetAta),
|
|
16946
|
+
assetTokenProgram: (0, import_common37.toWeb3Pk)(args.assetTokenProgram),
|
|
16559
16947
|
associatedTokenProgram: import_spl_token14.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16560
|
-
systemProgram:
|
|
16561
|
-
}).instruction().then(
|
|
16948
|
+
systemProgram: import_web317.SystemProgram.programId
|
|
16949
|
+
}).instruction().then(import_common37.toKitInstruction);
|
|
16562
16950
|
}
|
|
16563
16951
|
async deriveIxArgs(txArgs) {
|
|
16564
16952
|
const connection = this.program.provider.connection;
|
|
@@ -16572,10 +16960,10 @@ var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
|
16572
16960
|
manager: txArgs.manager,
|
|
16573
16961
|
vault: txArgs.vault,
|
|
16574
16962
|
assetMint: txArgs.assetMint,
|
|
16575
|
-
depositAmount: new
|
|
16576
|
-
externalAmount: new
|
|
16963
|
+
depositAmount: new import_core14.BN(txArgs.depositAmount.toString()),
|
|
16964
|
+
externalAmount: new import_core14.BN(externalAmount.toString()),
|
|
16577
16965
|
assetTokenProgram,
|
|
16578
|
-
vaultAssetAta: (0,
|
|
16966
|
+
vaultAssetAta: (0, import_common37.getAtaAddress)(
|
|
16579
16967
|
txArgs.assetMint,
|
|
16580
16968
|
txArgs.vault,
|
|
16581
16969
|
assetTokenProgram,
|
|
@@ -16583,7 +16971,7 @@ var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
|
16583
16971
|
),
|
|
16584
16972
|
// The manager may be a PDA (e.g. a Squads vault), so allow off-curve
|
|
16585
16973
|
// owners when deriving its ATA.
|
|
16586
|
-
managerAssetAta: (0,
|
|
16974
|
+
managerAssetAta: (0, import_common37.getAtaAddress)(
|
|
16587
16975
|
txArgs.assetMint,
|
|
16588
16976
|
txArgs.manager,
|
|
16589
16977
|
assetTokenProgram,
|
|
@@ -16599,23 +16987,23 @@ var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
|
16599
16987
|
};
|
|
16600
16988
|
|
|
16601
16989
|
// src/client/builders/managerWithdrawAsset.ts
|
|
16602
|
-
var
|
|
16990
|
+
var import_core15 = require("@anchor-lang/core");
|
|
16603
16991
|
var import_spl_token15 = require("@solana/spl-token");
|
|
16604
|
-
var
|
|
16605
|
-
var
|
|
16992
|
+
var import_web318 = require("@solana/web3.js");
|
|
16993
|
+
var import_common38 = __toESM(require_dist());
|
|
16606
16994
|
var ManagerWithdrawAssetBuilder = class extends VaultBuilderBase {
|
|
16607
16995
|
async getIx(args) {
|
|
16608
16996
|
return this.program.methods.managerWithdrawAsset(args.amount).accountsPartial({
|
|
16609
|
-
manager: (0,
|
|
16610
|
-
vault: (0,
|
|
16611
|
-
assetMint: (0,
|
|
16612
|
-
vaultAssetAta: (0,
|
|
16613
|
-
destination: (0,
|
|
16614
|
-
destinationAssetAta: (0,
|
|
16615
|
-
assetTokenProgram: (0,
|
|
16997
|
+
manager: (0, import_common38.toWeb3Pk)(args.manager),
|
|
16998
|
+
vault: (0, import_common38.toWeb3Pk)(args.vault),
|
|
16999
|
+
assetMint: (0, import_common38.toWeb3Pk)(args.assetMint),
|
|
17000
|
+
vaultAssetAta: (0, import_common38.toWeb3Pk)(args.vaultAssetAta),
|
|
17001
|
+
destination: (0, import_common38.toWeb3Pk)(args.destination),
|
|
17002
|
+
destinationAssetAta: (0, import_common38.toWeb3Pk)(args.destinationAssetAta),
|
|
17003
|
+
assetTokenProgram: (0, import_common38.toWeb3Pk)(args.assetTokenProgram),
|
|
16616
17004
|
associatedTokenProgram: import_spl_token15.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16617
|
-
systemProgram:
|
|
16618
|
-
}).instruction().then(
|
|
17005
|
+
systemProgram: import_web318.SystemProgram.programId
|
|
17006
|
+
}).instruction().then(import_common38.toKitInstruction);
|
|
16619
17007
|
}
|
|
16620
17008
|
async deriveIxArgs(txArgs) {
|
|
16621
17009
|
const connection = this.program.provider.connection;
|
|
@@ -16630,15 +17018,15 @@ var ManagerWithdrawAssetBuilder = class extends VaultBuilderBase {
|
|
|
16630
17018
|
vault: txArgs.vault,
|
|
16631
17019
|
assetMint: txArgs.assetMint,
|
|
16632
17020
|
destination,
|
|
16633
|
-
amount: new
|
|
17021
|
+
amount: new import_core15.BN(txArgs.amount.toString()),
|
|
16634
17022
|
assetTokenProgram,
|
|
16635
|
-
vaultAssetAta: (0,
|
|
17023
|
+
vaultAssetAta: (0, import_common38.getAtaAddress)(
|
|
16636
17024
|
txArgs.assetMint,
|
|
16637
17025
|
txArgs.vault,
|
|
16638
17026
|
assetTokenProgram,
|
|
16639
17027
|
true
|
|
16640
17028
|
),
|
|
16641
|
-
destinationAssetAta: (0,
|
|
17029
|
+
destinationAssetAta: (0, import_common38.getAtaAddress)(
|
|
16642
17030
|
txArgs.assetMint,
|
|
16643
17031
|
destination,
|
|
16644
17032
|
assetTokenProgram,
|
|
@@ -16655,18 +17043,18 @@ var ManagerWithdrawAssetBuilder = class extends VaultBuilderBase {
|
|
|
16655
17043
|
};
|
|
16656
17044
|
|
|
16657
17045
|
// src/client/builders/protocolInteraction.ts
|
|
16658
|
-
var
|
|
17046
|
+
var import_core16 = require("@anchor-lang/core");
|
|
16659
17047
|
var import_kit8 = require("@solana/kit");
|
|
16660
17048
|
var import_spl_token16 = require("@solana/spl-token");
|
|
16661
|
-
var
|
|
16662
|
-
var
|
|
17049
|
+
var import_web319 = require("@solana/web3.js");
|
|
17050
|
+
var import_common39 = __toESM(require_dist());
|
|
16663
17051
|
var DEFAULT_PYTH_PRICE_MAX_AGE_SECS = 90n;
|
|
16664
17052
|
function toAssetPriceOracleConfig(args) {
|
|
16665
17053
|
return {
|
|
16666
17054
|
priceOracleType: args?.priceOracleType ?? { none: {} },
|
|
16667
|
-
initialPrice: new
|
|
17055
|
+
initialPrice: new import_core16.BN((args?.initialPrice ?? 0n).toString()),
|
|
16668
17056
|
priceOracleAccount: args?.priceOracleAccount ?? DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
16669
|
-
pythMaxAgeSecs: new
|
|
17057
|
+
pythMaxAgeSecs: new import_core16.BN(
|
|
16670
17058
|
(args?.pythMaxAgeSecs ?? DEFAULT_PYTH_PRICE_MAX_AGE_SECS).toString()
|
|
16671
17059
|
)
|
|
16672
17060
|
};
|
|
@@ -16674,12 +17062,12 @@ function toAssetPriceOracleConfig(args) {
|
|
|
16674
17062
|
function toAnchorAssetPriceOracleConfig(config) {
|
|
16675
17063
|
return {
|
|
16676
17064
|
...config,
|
|
16677
|
-
priceOracleAccount: (0,
|
|
17065
|
+
priceOracleAccount: (0, import_common39.toWeb3Pk)(config.priceOracleAccount)
|
|
16678
17066
|
};
|
|
16679
17067
|
}
|
|
16680
17068
|
function toWeb3AccountMeta2(account) {
|
|
16681
17069
|
return {
|
|
16682
|
-
pubkey: new
|
|
17070
|
+
pubkey: new import_web319.PublicKey(account.address),
|
|
16683
17071
|
isWritable: account.role === import_kit8.AccountRole.WRITABLE || account.role === import_kit8.AccountRole.WRITABLE_SIGNER,
|
|
16684
17072
|
isSigner: account.role === import_kit8.AccountRole.READONLY_SIGNER || account.role === import_kit8.AccountRole.WRITABLE_SIGNER
|
|
16685
17073
|
};
|
|
@@ -16688,14 +17076,14 @@ var ProtocolInteractionBuilder = class extends VaultBuilderBase {
|
|
|
16688
17076
|
async getIx(args) {
|
|
16689
17077
|
return this.program.methods.protocolInteraction(args.refs, {
|
|
16690
17078
|
externalLiquidityIndex: args.externalLiquidityIndex,
|
|
16691
|
-
affectedAssetMint: args.affectedAssetMint ? (0,
|
|
17079
|
+
affectedAssetMint: args.affectedAssetMint ? (0, import_common39.toWeb3Pk)(args.affectedAssetMint) : null
|
|
16692
17080
|
}).accountsPartial({
|
|
16693
|
-
hwManager: (0,
|
|
16694
|
-
vault: (0,
|
|
16695
|
-
affectedAssetMint: args.affectedAssetMint ? (0,
|
|
16696
|
-
affectedVaultAta: args.affectedVaultAta ? (0,
|
|
16697
|
-
affectedTokenProgram: args.affectedTokenProgram ? (0,
|
|
16698
|
-
}).remainingAccounts(args.accounts.map(toWeb3AccountMeta2)).instruction().then(
|
|
17081
|
+
hwManager: (0, import_common39.toWeb3Pk)(args.hwManager),
|
|
17082
|
+
vault: (0, import_common39.toWeb3Pk)(args.vault),
|
|
17083
|
+
affectedAssetMint: args.affectedAssetMint ? (0, import_common39.toWeb3Pk)(args.affectedAssetMint) : null,
|
|
17084
|
+
affectedVaultAta: args.affectedVaultAta ? (0, import_common39.toWeb3Pk)(args.affectedVaultAta) : null,
|
|
17085
|
+
affectedTokenProgram: args.affectedTokenProgram ? (0, import_common39.toWeb3Pk)(args.affectedTokenProgram) : null
|
|
17086
|
+
}).remainingAccounts(args.accounts.map(toWeb3AccountMeta2)).instruction().then(import_common39.toKitInstruction);
|
|
16699
17087
|
}
|
|
16700
17088
|
async deriveIxArgs(txArgs) {
|
|
16701
17089
|
const affectedTokenProgram = txArgs.affectedAssetMint ? txArgs.affectedTokenProgram ?? TOKEN_PROGRAM_ID : null;
|
|
@@ -16707,7 +17095,7 @@ var ProtocolInteractionBuilder = class extends VaultBuilderBase {
|
|
|
16707
17095
|
accounts: txArgs.accounts,
|
|
16708
17096
|
affectedAssetMint: txArgs.affectedAssetMint ?? null,
|
|
16709
17097
|
affectedTokenProgram,
|
|
16710
|
-
affectedVaultAta: txArgs.affectedAssetMint && affectedTokenProgram ? (0,
|
|
17098
|
+
affectedVaultAta: txArgs.affectedAssetMint && affectedTokenProgram ? (0, import_common39.getAtaAddress)(
|
|
16711
17099
|
txArgs.affectedAssetMint,
|
|
16712
17100
|
txArgs.vault,
|
|
16713
17101
|
affectedTokenProgram,
|
|
@@ -16726,18 +17114,18 @@ var JupiterSwapBuilder = class extends VaultBuilderBase {
|
|
|
16726
17114
|
args.destinationPriceOracle
|
|
16727
17115
|
)
|
|
16728
17116
|
}).accountsPartial({
|
|
16729
|
-
hwManager: (0,
|
|
16730
|
-
vault: (0,
|
|
16731
|
-
sourceMint: (0,
|
|
16732
|
-
destinationMint: (0,
|
|
16733
|
-
vaultSourceAta: (0,
|
|
16734
|
-
vaultDestinationAta: (0,
|
|
16735
|
-
sourceTokenProgram: (0,
|
|
16736
|
-
destinationTokenProgram: (0,
|
|
16737
|
-
destinationOracleAccount: args.destinationOracleAccount ? (0,
|
|
16738
|
-
vaultOracle: (0,
|
|
16739
|
-
vaultTrancheState: args.vaultTrancheState ? (0,
|
|
16740
|
-
}).remainingAccounts(args.accounts.map(toWeb3AccountMeta2)).instruction().then(
|
|
17117
|
+
hwManager: (0, import_common39.toWeb3Pk)(args.hwManager),
|
|
17118
|
+
vault: (0, import_common39.toWeb3Pk)(args.vault),
|
|
17119
|
+
sourceMint: (0, import_common39.toWeb3Pk)(args.sourceMint),
|
|
17120
|
+
destinationMint: (0, import_common39.toWeb3Pk)(args.destinationMint),
|
|
17121
|
+
vaultSourceAta: (0, import_common39.toWeb3Pk)(args.vaultSourceAta),
|
|
17122
|
+
vaultDestinationAta: (0, import_common39.toWeb3Pk)(args.vaultDestinationAta),
|
|
17123
|
+
sourceTokenProgram: (0, import_common39.toWeb3Pk)(args.sourceTokenProgram),
|
|
17124
|
+
destinationTokenProgram: (0, import_common39.toWeb3Pk)(args.destinationTokenProgram),
|
|
17125
|
+
destinationOracleAccount: args.destinationOracleAccount ? (0, import_common39.toWeb3Pk)(args.destinationOracleAccount) : null,
|
|
17126
|
+
vaultOracle: (0, import_common39.toWeb3Pk)(args.vaultOracle),
|
|
17127
|
+
vaultTrancheState: args.vaultTrancheState ? (0, import_common39.toWeb3Pk)(args.vaultTrancheState) : null
|
|
17128
|
+
}).remainingAccounts(args.accounts.map(toWeb3AccountMeta2)).instruction().then(import_common39.toKitInstruction);
|
|
16741
17129
|
}
|
|
16742
17130
|
async deriveIxArgs(txArgs) {
|
|
16743
17131
|
const sourceTokenProgram = txArgs.sourceTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
@@ -16758,13 +17146,13 @@ var JupiterSwapBuilder = class extends VaultBuilderBase {
|
|
|
16758
17146
|
accounts: txArgs.accounts,
|
|
16759
17147
|
sourceTokenProgram,
|
|
16760
17148
|
destinationTokenProgram,
|
|
16761
|
-
vaultSourceAta: (0,
|
|
17149
|
+
vaultSourceAta: (0, import_common39.getAtaAddress)(
|
|
16762
17150
|
txArgs.sourceMint,
|
|
16763
17151
|
txArgs.vault,
|
|
16764
17152
|
sourceTokenProgram,
|
|
16765
17153
|
true
|
|
16766
17154
|
),
|
|
16767
|
-
vaultDestinationAta: (0,
|
|
17155
|
+
vaultDestinationAta: (0, import_common39.getAtaAddress)(
|
|
16768
17156
|
txArgs.destinationMint,
|
|
16769
17157
|
txArgs.vault,
|
|
16770
17158
|
destinationTokenProgram,
|
|
@@ -16773,24 +17161,24 @@ var JupiterSwapBuilder = class extends VaultBuilderBase {
|
|
|
16773
17161
|
};
|
|
16774
17162
|
}
|
|
16775
17163
|
async buildPreambleInstructions(args) {
|
|
16776
|
-
const payer = (0,
|
|
17164
|
+
const payer = (0, import_common39.toWeb3Pk)(args.hwManager);
|
|
16777
17165
|
const createSourceAta = (0, import_spl_token16.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16778
17166
|
payer,
|
|
16779
|
-
(0,
|
|
16780
|
-
(0,
|
|
16781
|
-
(0,
|
|
16782
|
-
(0,
|
|
17167
|
+
(0, import_common39.toWeb3Pk)(args.vaultSourceAta),
|
|
17168
|
+
(0, import_common39.toWeb3Pk)(args.vault),
|
|
17169
|
+
(0, import_common39.toWeb3Pk)(args.sourceMint),
|
|
17170
|
+
(0, import_common39.toWeb3Pk)(args.sourceTokenProgram),
|
|
16783
17171
|
import_spl_token16.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16784
17172
|
);
|
|
16785
17173
|
const createDestinationAta = (0, import_spl_token16.createAssociatedTokenAccountIdempotentInstruction)(
|
|
16786
17174
|
payer,
|
|
16787
|
-
(0,
|
|
16788
|
-
(0,
|
|
16789
|
-
(0,
|
|
16790
|
-
(0,
|
|
17175
|
+
(0, import_common39.toWeb3Pk)(args.vaultDestinationAta),
|
|
17176
|
+
(0, import_common39.toWeb3Pk)(args.vault),
|
|
17177
|
+
(0, import_common39.toWeb3Pk)(args.destinationMint),
|
|
17178
|
+
(0, import_common39.toWeb3Pk)(args.destinationTokenProgram),
|
|
16791
17179
|
import_spl_token16.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
16792
17180
|
);
|
|
16793
|
-
return [createSourceAta, createDestinationAta].map(
|
|
17181
|
+
return [createSourceAta, createDestinationAta].map(import_common39.toKitInstruction);
|
|
16794
17182
|
}
|
|
16795
17183
|
async buildLookupTables(_args, txArgs) {
|
|
16796
17184
|
return txArgs.lookupTables;
|
|
@@ -16823,27 +17211,27 @@ var JupiterSwapBuilder = class extends VaultBuilderBase {
|
|
|
16823
17211
|
};
|
|
16824
17212
|
|
|
16825
17213
|
// src/client/builders/requestJuniorTrancheWithdraw.ts
|
|
16826
|
-
var
|
|
17214
|
+
var import_core17 = require("@anchor-lang/core");
|
|
16827
17215
|
var import_spl_token17 = require("@solana/spl-token");
|
|
16828
|
-
var
|
|
16829
|
-
var
|
|
17216
|
+
var import_web320 = require("@solana/web3.js");
|
|
17217
|
+
var import_common40 = __toESM(require_dist());
|
|
16830
17218
|
var RequestJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
16831
17219
|
async getIx(args) {
|
|
16832
17220
|
return this.program.methods.requestJuniorTrancheWithdraw(args.queueId, args.shareAmount).accountsPartial({
|
|
16833
|
-
user: (0,
|
|
16834
|
-
payer: (0,
|
|
16835
|
-
vault: (0,
|
|
16836
|
-
vaultOracle: (0,
|
|
16837
|
-
vaultTrancheState: (0,
|
|
16838
|
-
withdrawalQueue: (0,
|
|
16839
|
-
outputMint: (0,
|
|
16840
|
-
inputMint: (0,
|
|
16841
|
-
userInputAta: (0,
|
|
16842
|
-
queueInputAta: (0,
|
|
16843
|
-
shareTokenProgram: (0,
|
|
17221
|
+
user: (0, import_common40.toWeb3Pk)(args.user),
|
|
17222
|
+
payer: (0, import_common40.toWeb3Pk)(args.payer),
|
|
17223
|
+
vault: (0, import_common40.toWeb3Pk)(args.vault),
|
|
17224
|
+
vaultOracle: (0, import_common40.toWeb3Pk)(args.vaultOracle),
|
|
17225
|
+
vaultTrancheState: (0, import_common40.toWeb3Pk)(args.vaultTrancheState),
|
|
17226
|
+
withdrawalQueue: (0, import_common40.toWeb3Pk)(args.withdrawalQueue),
|
|
17227
|
+
outputMint: (0, import_common40.toWeb3Pk)(args.outputMint),
|
|
17228
|
+
inputMint: (0, import_common40.toWeb3Pk)(args.inputMint),
|
|
17229
|
+
userInputAta: (0, import_common40.toWeb3Pk)(args.userInputAta),
|
|
17230
|
+
queueInputAta: (0, import_common40.toWeb3Pk)(args.queueInputAta),
|
|
17231
|
+
shareTokenProgram: (0, import_common40.toWeb3Pk)(args.shareTokenProgram),
|
|
16844
17232
|
associatedTokenProgram: import_spl_token17.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16845
|
-
systemProgram:
|
|
16846
|
-
}).instruction().then(
|
|
17233
|
+
systemProgram: import_web320.SystemProgram.programId
|
|
17234
|
+
}).instruction().then(import_common40.toKitInstruction);
|
|
16847
17235
|
}
|
|
16848
17236
|
async deriveIxArgs(txArgs) {
|
|
16849
17237
|
const payer = txArgs.payer ?? txArgs.user;
|
|
@@ -16877,10 +17265,10 @@ var RequestJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16877
17265
|
outputMint: txArgs.assetMint,
|
|
16878
17266
|
inputMint: juniorShareMint,
|
|
16879
17267
|
queueId: txArgs.queueId,
|
|
16880
|
-
shareAmount: new
|
|
17268
|
+
shareAmount: new import_core17.BN(txArgs.shareAmount.toString()),
|
|
16881
17269
|
shareTokenProgram,
|
|
16882
|
-
userInputAta: txArgs.userInputAta ?? (0,
|
|
16883
|
-
queueInputAta: (0,
|
|
17270
|
+
userInputAta: txArgs.userInputAta ?? (0, import_common40.getAtaAddress)(juniorShareMint, txArgs.user, shareTokenProgram),
|
|
17271
|
+
queueInputAta: (0, import_common40.getAtaAddress)(
|
|
16884
17272
|
juniorShareMint,
|
|
16885
17273
|
queuePda,
|
|
16886
17274
|
shareTokenProgram,
|
|
@@ -16902,17 +17290,17 @@ var RequestJuniorTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
16902
17290
|
};
|
|
16903
17291
|
|
|
16904
17292
|
// src/client/builders/vaultReallocation.ts
|
|
16905
|
-
var
|
|
17293
|
+
var import_core18 = require("@anchor-lang/core");
|
|
16906
17294
|
var import_spl_token18 = require("@solana/spl-token");
|
|
16907
|
-
var
|
|
16908
|
-
var
|
|
17295
|
+
var import_web321 = require("@solana/web3.js");
|
|
17296
|
+
var import_common41 = __toESM(require_dist());
|
|
16909
17297
|
var DEFAULT_PYTH_PRICE_MAX_AGE_SECS2 = 90n;
|
|
16910
17298
|
function toAssetPriceOracleConfig2(args) {
|
|
16911
17299
|
return {
|
|
16912
17300
|
priceOracleType: args?.priceOracleType ?? { none: {} },
|
|
16913
|
-
initialPrice: new
|
|
17301
|
+
initialPrice: new import_core18.BN((args?.initialPrice ?? 0n).toString()),
|
|
16914
17302
|
priceOracleAccount: args?.priceOracleAccount ?? DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
16915
|
-
pythMaxAgeSecs: new
|
|
17303
|
+
pythMaxAgeSecs: new import_core18.BN(
|
|
16916
17304
|
(args?.pythMaxAgeSecs ?? DEFAULT_PYTH_PRICE_MAX_AGE_SECS2).toString()
|
|
16917
17305
|
)
|
|
16918
17306
|
};
|
|
@@ -16920,7 +17308,7 @@ function toAssetPriceOracleConfig2(args) {
|
|
|
16920
17308
|
function toAnchorAssetPriceOracleConfig2(config) {
|
|
16921
17309
|
return {
|
|
16922
17310
|
...config,
|
|
16923
|
-
priceOracleAccount: (0,
|
|
17311
|
+
priceOracleAccount: (0, import_common41.toWeb3Pk)(config.priceOracleAccount)
|
|
16924
17312
|
};
|
|
16925
17313
|
}
|
|
16926
17314
|
var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
@@ -16929,35 +17317,35 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
16929
17317
|
amount: args.amount,
|
|
16930
17318
|
assetPriceOracle: toAnchorAssetPriceOracleConfig2(args.assetPriceOracle)
|
|
16931
17319
|
}).accountsPartial({
|
|
16932
|
-
manager: (0,
|
|
16933
|
-
allocationVault: (0,
|
|
16934
|
-
sourceVault: args.sourceVault ? (0,
|
|
16935
|
-
sourceVaultOracle: args.sourceVaultOracle ? (0,
|
|
16936
|
-
destinationVault: (0,
|
|
16937
|
-
destinationVaultOracle: (0,
|
|
16938
|
-
mint: (0,
|
|
16939
|
-
sourceShareMint: args.sourceShareMint ? (0,
|
|
16940
|
-
destinationShareMint: (0,
|
|
16941
|
-
allocationMintAta: (0,
|
|
16942
|
-
sourceVaultMintAta: args.sourceVaultMintAta ? (0,
|
|
16943
|
-
destinationVaultMintAta: (0,
|
|
16944
|
-
destinationFeeVault: (0,
|
|
16945
|
-
destinationFeeVaultMintAta: (0,
|
|
16946
|
-
allocationSourceShareAta: args.allocationSourceShareAta ? (0,
|
|
16947
|
-
allocationDestinationShareAta: (0,
|
|
17320
|
+
manager: (0, import_common41.toWeb3Pk)(args.manager),
|
|
17321
|
+
allocationVault: (0, import_common41.toWeb3Pk)(args.allocationVault),
|
|
17322
|
+
sourceVault: args.sourceVault ? (0, import_common41.toWeb3Pk)(args.sourceVault) : null,
|
|
17323
|
+
sourceVaultOracle: args.sourceVaultOracle ? (0, import_common41.toWeb3Pk)(args.sourceVaultOracle) : null,
|
|
17324
|
+
destinationVault: (0, import_common41.toWeb3Pk)(args.destinationVault),
|
|
17325
|
+
destinationVaultOracle: (0, import_common41.toWeb3Pk)(args.destinationVaultOracle),
|
|
17326
|
+
mint: (0, import_common41.toWeb3Pk)(args.mint),
|
|
17327
|
+
sourceShareMint: args.sourceShareMint ? (0, import_common41.toWeb3Pk)(args.sourceShareMint) : null,
|
|
17328
|
+
destinationShareMint: (0, import_common41.toWeb3Pk)(args.destinationShareMint),
|
|
17329
|
+
allocationMintAta: (0, import_common41.toWeb3Pk)(args.allocationMintAta),
|
|
17330
|
+
sourceVaultMintAta: args.sourceVaultMintAta ? (0, import_common41.toWeb3Pk)(args.sourceVaultMintAta) : null,
|
|
17331
|
+
destinationVaultMintAta: (0, import_common41.toWeb3Pk)(args.destinationVaultMintAta),
|
|
17332
|
+
destinationFeeVault: (0, import_common41.toWeb3Pk)(args.destinationFeeVault),
|
|
17333
|
+
destinationFeeVaultMintAta: (0, import_common41.toWeb3Pk)(args.destinationFeeVaultMintAta),
|
|
17334
|
+
allocationSourceShareAta: args.allocationSourceShareAta ? (0, import_common41.toWeb3Pk)(args.allocationSourceShareAta) : null,
|
|
17335
|
+
allocationDestinationShareAta: (0, import_common41.toWeb3Pk)(
|
|
16948
17336
|
args.allocationDestinationShareAta
|
|
16949
17337
|
),
|
|
16950
|
-
sourceVaultTrancheState: args.sourceVaultTrancheState ? (0,
|
|
16951
|
-
destinationVaultTrancheState: args.destinationVaultTrancheState ? (0,
|
|
16952
|
-
assetOracleAccount: args.assetOracleAccount ? (0,
|
|
16953
|
-
assetTokenProgram: (0,
|
|
16954
|
-
sourceShareTokenProgram: (0,
|
|
16955
|
-
destinationShareTokenProgram: (0,
|
|
17338
|
+
sourceVaultTrancheState: args.sourceVaultTrancheState ? (0, import_common41.toWeb3Pk)(args.sourceVaultTrancheState) : null,
|
|
17339
|
+
destinationVaultTrancheState: args.destinationVaultTrancheState ? (0, import_common41.toWeb3Pk)(args.destinationVaultTrancheState) : null,
|
|
17340
|
+
assetOracleAccount: args.assetOracleAccount ? (0, import_common41.toWeb3Pk)(args.assetOracleAccount) : null,
|
|
17341
|
+
assetTokenProgram: (0, import_common41.toWeb3Pk)(args.assetTokenProgram),
|
|
17342
|
+
sourceShareTokenProgram: (0, import_common41.toWeb3Pk)(args.sourceShareTokenProgram),
|
|
17343
|
+
destinationShareTokenProgram: (0, import_common41.toWeb3Pk)(
|
|
16956
17344
|
args.destinationShareTokenProgram
|
|
16957
17345
|
),
|
|
16958
17346
|
associatedTokenProgram: import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
16959
|
-
systemProgram:
|
|
16960
|
-
}).instruction().then(
|
|
17347
|
+
systemProgram: import_web321.SystemProgram.programId
|
|
17348
|
+
}).instruction().then(import_common41.toKitInstruction);
|
|
16961
17349
|
}
|
|
16962
17350
|
async deriveIxArgs(txArgs) {
|
|
16963
17351
|
const assetTokenProgram = txArgs.assetTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
@@ -16982,7 +17370,7 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
16982
17370
|
mint: txArgs.mint,
|
|
16983
17371
|
sourceShareMint,
|
|
16984
17372
|
destinationShareMint: txArgs.destinationShareMint,
|
|
16985
|
-
amount: new
|
|
17373
|
+
amount: new import_core18.BN(txArgs.amount.toString()),
|
|
16986
17374
|
assetPriceOracle: toAssetPriceOracleConfig2(txArgs.assetPriceOracle),
|
|
16987
17375
|
sourceVaultTrancheState: txArgs.sourceVaultTrancheState ?? null,
|
|
16988
17376
|
destinationVaultTrancheState: txArgs.destinationVaultTrancheState ?? null,
|
|
@@ -16990,33 +17378,33 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
16990
17378
|
assetTokenProgram,
|
|
16991
17379
|
sourceShareTokenProgram,
|
|
16992
17380
|
destinationShareTokenProgram,
|
|
16993
|
-
allocationMintAta: (0,
|
|
17381
|
+
allocationMintAta: (0, import_common41.getAtaAddress)(
|
|
16994
17382
|
txArgs.mint,
|
|
16995
17383
|
txArgs.allocationVault,
|
|
16996
17384
|
assetTokenProgram,
|
|
16997
17385
|
true
|
|
16998
17386
|
),
|
|
16999
|
-
sourceVaultMintAta: sourceVault ? (0,
|
|
17000
|
-
destinationVaultMintAta: (0,
|
|
17387
|
+
sourceVaultMintAta: sourceVault ? (0, import_common41.getAtaAddress)(txArgs.mint, sourceVault, assetTokenProgram, true) : null,
|
|
17388
|
+
destinationVaultMintAta: (0, import_common41.getAtaAddress)(
|
|
17001
17389
|
txArgs.mint,
|
|
17002
17390
|
txArgs.destinationVault,
|
|
17003
17391
|
assetTokenProgram,
|
|
17004
17392
|
true
|
|
17005
17393
|
),
|
|
17006
17394
|
destinationFeeVault,
|
|
17007
|
-
destinationFeeVaultMintAta: (0,
|
|
17395
|
+
destinationFeeVaultMintAta: (0, import_common41.getAtaAddress)(
|
|
17008
17396
|
txArgs.mint,
|
|
17009
17397
|
destinationFeeVault,
|
|
17010
17398
|
assetTokenProgram,
|
|
17011
17399
|
true
|
|
17012
17400
|
),
|
|
17013
|
-
allocationSourceShareAta: sourceShareMint && sourceVault ? (0,
|
|
17401
|
+
allocationSourceShareAta: sourceShareMint && sourceVault ? (0, import_common41.getAtaAddress)(
|
|
17014
17402
|
sourceShareMint,
|
|
17015
17403
|
txArgs.allocationVault,
|
|
17016
17404
|
sourceShareTokenProgram,
|
|
17017
17405
|
true
|
|
17018
17406
|
) : null,
|
|
17019
|
-
allocationDestinationShareAta: (0,
|
|
17407
|
+
allocationDestinationShareAta: (0, import_common41.getAtaAddress)(
|
|
17020
17408
|
txArgs.destinationShareMint,
|
|
17021
17409
|
txArgs.allocationVault,
|
|
17022
17410
|
destinationShareTokenProgram,
|
|
@@ -17025,38 +17413,38 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
17025
17413
|
};
|
|
17026
17414
|
}
|
|
17027
17415
|
async buildPreambleInstructions(args) {
|
|
17028
|
-
const payer = (0,
|
|
17416
|
+
const payer = (0, import_common41.toWeb3Pk)(args.manager);
|
|
17029
17417
|
const instructions2 = [
|
|
17030
17418
|
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
17031
17419
|
payer,
|
|
17032
|
-
(0,
|
|
17033
|
-
(0,
|
|
17034
|
-
(0,
|
|
17035
|
-
(0,
|
|
17420
|
+
(0, import_common41.toWeb3Pk)(args.allocationMintAta),
|
|
17421
|
+
(0, import_common41.toWeb3Pk)(args.allocationVault),
|
|
17422
|
+
(0, import_common41.toWeb3Pk)(args.mint),
|
|
17423
|
+
(0, import_common41.toWeb3Pk)(args.assetTokenProgram),
|
|
17036
17424
|
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
17037
17425
|
),
|
|
17038
17426
|
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
17039
17427
|
payer,
|
|
17040
|
-
(0,
|
|
17041
|
-
(0,
|
|
17042
|
-
(0,
|
|
17043
|
-
(0,
|
|
17428
|
+
(0, import_common41.toWeb3Pk)(args.destinationVaultMintAta),
|
|
17429
|
+
(0, import_common41.toWeb3Pk)(args.destinationVault),
|
|
17430
|
+
(0, import_common41.toWeb3Pk)(args.mint),
|
|
17431
|
+
(0, import_common41.toWeb3Pk)(args.assetTokenProgram),
|
|
17044
17432
|
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
17045
17433
|
),
|
|
17046
17434
|
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
17047
17435
|
payer,
|
|
17048
|
-
(0,
|
|
17049
|
-
(0,
|
|
17050
|
-
(0,
|
|
17051
|
-
(0,
|
|
17436
|
+
(0, import_common41.toWeb3Pk)(args.destinationFeeVaultMintAta),
|
|
17437
|
+
(0, import_common41.toWeb3Pk)(args.destinationFeeVault),
|
|
17438
|
+
(0, import_common41.toWeb3Pk)(args.mint),
|
|
17439
|
+
(0, import_common41.toWeb3Pk)(args.assetTokenProgram),
|
|
17052
17440
|
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
17053
17441
|
),
|
|
17054
17442
|
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
17055
17443
|
payer,
|
|
17056
|
-
(0,
|
|
17057
|
-
(0,
|
|
17058
|
-
(0,
|
|
17059
|
-
(0,
|
|
17444
|
+
(0, import_common41.toWeb3Pk)(args.allocationDestinationShareAta),
|
|
17445
|
+
(0, import_common41.toWeb3Pk)(args.allocationVault),
|
|
17446
|
+
(0, import_common41.toWeb3Pk)(args.destinationShareMint),
|
|
17447
|
+
(0, import_common41.toWeb3Pk)(args.destinationShareTokenProgram),
|
|
17060
17448
|
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
17061
17449
|
)
|
|
17062
17450
|
];
|
|
@@ -17064,23 +17452,23 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
17064
17452
|
instructions2.push(
|
|
17065
17453
|
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
17066
17454
|
payer,
|
|
17067
|
-
(0,
|
|
17068
|
-
(0,
|
|
17069
|
-
(0,
|
|
17070
|
-
(0,
|
|
17455
|
+
(0, import_common41.toWeb3Pk)(args.sourceVaultMintAta),
|
|
17456
|
+
(0, import_common41.toWeb3Pk)(args.sourceVault),
|
|
17457
|
+
(0, import_common41.toWeb3Pk)(args.mint),
|
|
17458
|
+
(0, import_common41.toWeb3Pk)(args.assetTokenProgram),
|
|
17071
17459
|
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
17072
17460
|
),
|
|
17073
17461
|
(0, import_spl_token18.createAssociatedTokenAccountIdempotentInstruction)(
|
|
17074
17462
|
payer,
|
|
17075
|
-
(0,
|
|
17076
|
-
(0,
|
|
17077
|
-
(0,
|
|
17078
|
-
(0,
|
|
17463
|
+
(0, import_common41.toWeb3Pk)(args.allocationSourceShareAta),
|
|
17464
|
+
(0, import_common41.toWeb3Pk)(args.allocationVault),
|
|
17465
|
+
(0, import_common41.toWeb3Pk)(args.sourceShareMint),
|
|
17466
|
+
(0, import_common41.toWeb3Pk)(args.sourceShareTokenProgram),
|
|
17079
17467
|
import_spl_token18.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
17080
17468
|
)
|
|
17081
17469
|
);
|
|
17082
17470
|
}
|
|
17083
|
-
return instructions2.map(
|
|
17471
|
+
return instructions2.map(import_common41.toKitInstruction);
|
|
17084
17472
|
}
|
|
17085
17473
|
async buildPlanExtras(args) {
|
|
17086
17474
|
return {
|
|
@@ -17118,6 +17506,13 @@ var VaultReallocationBuilder = class extends VaultBuilderBase {
|
|
|
17118
17506
|
// src/client/transaction.ts
|
|
17119
17507
|
var TransactionClient = class {
|
|
17120
17508
|
constructor(context) {
|
|
17509
|
+
this.createIncentiveV3 = new CreateIncentiveV3Builder(context);
|
|
17510
|
+
this.addIncentiveRecipientV3 = new AddIncentiveRecipientV3Builder(context);
|
|
17511
|
+
this.setIncentiveLimitsV3 = new SetIncentiveLimitsV3Builder(context);
|
|
17512
|
+
this.reportIncentiveV3 = new ReportIncentiveV3Builder(context);
|
|
17513
|
+
this.settleIncentiveV3 = new SettleIncentiveV3Builder(context);
|
|
17514
|
+
this.claimIncentiveV3 = new ClaimIncentiveV3Builder(context);
|
|
17515
|
+
this.distributeIncentiveV3 = new DistributeIncentiveV3Builder(context);
|
|
17121
17516
|
this.claimIncentive = new ClaimIncentiveBuilder(context);
|
|
17122
17517
|
this.createIncentive = new CreateIncentiveBuilder(context);
|
|
17123
17518
|
this.addIncentiveRecipient = new AddIncentiveRecipientBuilder(context);
|
|
@@ -17171,7 +17566,7 @@ var VaultClient = class {
|
|
|
17171
17566
|
this.provider = provider;
|
|
17172
17567
|
this.skipSimulation = options.skipSimulation ?? false;
|
|
17173
17568
|
const idl = { ...IDL, address: programId };
|
|
17174
|
-
this.program = new
|
|
17569
|
+
this.program = new import_core19.Program(idl, provider);
|
|
17175
17570
|
this.pda = new PdaClient((0, import_kit9.address)(this.program.programId.toBase58()));
|
|
17176
17571
|
const rpc = createRpcFromConnection(provider.connection);
|
|
17177
17572
|
this.account = new AccountClient(this.program, this.pda, rpc);
|
|
@@ -17193,8 +17588,8 @@ var VaultClient = class {
|
|
|
17193
17588
|
*/
|
|
17194
17589
|
async sendTransaction(payer, plan, extraSigners = []) {
|
|
17195
17590
|
const { blockhash, lastValidBlockHeight } = await this.provider.connection.getLatestBlockhash("confirmed");
|
|
17196
|
-
const tx = new
|
|
17197
|
-
...plan.instructions.map(
|
|
17591
|
+
const tx = new import_web322.Transaction().add(
|
|
17592
|
+
...plan.instructions.map(import_common42.fromKitInstruction)
|
|
17198
17593
|
);
|
|
17199
17594
|
tx.feePayer = payer.publicKey;
|
|
17200
17595
|
tx.recentBlockhash = blockhash;
|
|
@@ -17228,13 +17623,13 @@ var VaultClient = class {
|
|
|
17228
17623
|
const { blockhash } = await this.provider.connection.getLatestBlockhash(
|
|
17229
17624
|
"confirmed"
|
|
17230
17625
|
);
|
|
17231
|
-
const lookupTableAccounts = plan.lookupTables?.length ? await (0,
|
|
17232
|
-
const message2 = new
|
|
17626
|
+
const lookupTableAccounts = plan.lookupTables?.length ? await (0, import_common42.fetchLookupTables)(this.provider.connection, plan.lookupTables) : [];
|
|
17627
|
+
const message2 = new import_web322.TransactionMessage({
|
|
17233
17628
|
payerKey: payer.publicKey,
|
|
17234
17629
|
recentBlockhash: blockhash,
|
|
17235
|
-
instructions: plan.instructions.map(
|
|
17630
|
+
instructions: plan.instructions.map(import_common42.fromKitInstruction)
|
|
17236
17631
|
}).compileToV0Message(lookupTableAccounts);
|
|
17237
|
-
const tx = new
|
|
17632
|
+
const tx = new import_web322.VersionedTransaction(message2);
|
|
17238
17633
|
const result = await this.provider.connection.simulateTransaction(tx, {
|
|
17239
17634
|
sigVerify: false,
|
|
17240
17635
|
commitment: "processed"
|
|
@@ -17308,7 +17703,7 @@ function resolveKeypairPath(keypairPath) {
|
|
|
17308
17703
|
}
|
|
17309
17704
|
function loadKeypair(keypairPath) {
|
|
17310
17705
|
const raw = import_fs.default.readFileSync(resolveKeypairPath(keypairPath), "utf-8");
|
|
17311
|
-
return
|
|
17706
|
+
return import_web323.Keypair.fromSecretKey(new Uint8Array(JSON.parse(raw)));
|
|
17312
17707
|
}
|
|
17313
17708
|
var ENV_AGNOSTIC_ROLES = /* @__PURE__ */ new Set(["fulfiller", "rebalancer"]);
|
|
17314
17709
|
function defaultKeypairPath(env, role = "vault") {
|
|
@@ -17319,8 +17714,8 @@ function defaultKeypairPath(env, role = "vault") {
|
|
|
17319
17714
|
}
|
|
17320
17715
|
function createVaultClient(env, opts = {}) {
|
|
17321
17716
|
const payer = opts.keypair ?? loadKeypair(opts.keypairPath ?? defaultKeypairPath(env, opts.role));
|
|
17322
|
-
const connection = new
|
|
17323
|
-
const provider = new
|
|
17717
|
+
const connection = new import_web323.Connection(opts.rpcUrl ?? getRpcUrl(env), "confirmed");
|
|
17718
|
+
const provider = new import_core20.AnchorProvider(connection, new import_core20.Wallet(payer), {
|
|
17324
17719
|
commitment: "confirmed"
|
|
17325
17720
|
});
|
|
17326
17721
|
const client = new VaultClient(
|
|
@@ -17333,11 +17728,11 @@ function createVaultClient(env, opts = {}) {
|
|
|
17333
17728
|
client,
|
|
17334
17729
|
provider,
|
|
17335
17730
|
payer,
|
|
17336
|
-
signer: (0,
|
|
17731
|
+
signer: (0, import_common43.fromWeb3Pk)(payer.publicKey)
|
|
17337
17732
|
};
|
|
17338
17733
|
}
|
|
17339
17734
|
function keypairAddress(keypairPath) {
|
|
17340
|
-
return (0,
|
|
17735
|
+
return (0, import_common43.fromWeb3Pk)(loadKeypair(keypairPath).publicKey);
|
|
17341
17736
|
}
|
|
17342
17737
|
|
|
17343
17738
|
// src/utils/math.ts
|
|
@@ -17351,16 +17746,16 @@ function fromUiAmount(amount, decimals) {
|
|
|
17351
17746
|
}
|
|
17352
17747
|
|
|
17353
17748
|
// src/utils/provider.ts
|
|
17354
|
-
var
|
|
17749
|
+
var import_core21 = require("@anchor-lang/core");
|
|
17355
17750
|
function makeProvider(connection, payer) {
|
|
17356
|
-
return new
|
|
17751
|
+
return new import_core21.AnchorProvider(connection, new import_core21.Wallet(payer), {
|
|
17357
17752
|
commitment: "confirmed"
|
|
17358
17753
|
});
|
|
17359
17754
|
}
|
|
17360
17755
|
|
|
17361
17756
|
// src/utils/squads.ts
|
|
17362
17757
|
var squads = __toESM(require("@sqds/multisig"));
|
|
17363
|
-
var
|
|
17758
|
+
var import_web324 = require("@solana/web3.js");
|
|
17364
17759
|
var SQUADS_SIMULATION_COMMITMENT = "processed";
|
|
17365
17760
|
var SquadsProposalExecutionSimulationError = class extends Error {
|
|
17366
17761
|
constructor(transactionError, logs, unitsConsumed) {
|
|
@@ -17384,8 +17779,8 @@ function validateVaultIndex(vaultIndex) {
|
|
|
17384
17779
|
}
|
|
17385
17780
|
function resolveSquadsWalletRoute(route) {
|
|
17386
17781
|
validateVaultIndex(route.vaultIndex);
|
|
17387
|
-
const wallet = new
|
|
17388
|
-
const multisigPda = new
|
|
17782
|
+
const wallet = new import_web324.PublicKey(route.wallet);
|
|
17783
|
+
const multisigPda = new import_web324.PublicKey(route.multisigPda);
|
|
17389
17784
|
const [vaultPda] = squads.getVaultPda({
|
|
17390
17785
|
multisigPda,
|
|
17391
17786
|
index: route.vaultIndex
|
|
@@ -17393,7 +17788,7 @@ function resolveSquadsWalletRoute(route) {
|
|
|
17393
17788
|
return { ...route, wallet, multisigPda, vaultPda };
|
|
17394
17789
|
}
|
|
17395
17790
|
function findSquadsWalletRoute(wallet, routes) {
|
|
17396
|
-
const walletKey = typeof wallet === "string" ? new
|
|
17791
|
+
const walletKey = typeof wallet === "string" ? new import_web324.PublicKey(wallet) : wallet;
|
|
17397
17792
|
const route = routes.find(
|
|
17398
17793
|
(candidate) => candidate.wallet === walletKey.toBase58()
|
|
17399
17794
|
);
|
|
@@ -17411,18 +17806,18 @@ function validateSquadsWalletRoutes(routes) {
|
|
|
17411
17806
|
}
|
|
17412
17807
|
}
|
|
17413
17808
|
function vaultAuthorityForWallet(wallet, routes) {
|
|
17414
|
-
const walletKey = typeof wallet === "string" ? new
|
|
17809
|
+
const walletKey = typeof wallet === "string" ? new import_web324.PublicKey(wallet) : wallet;
|
|
17415
17810
|
return findSquadsWalletRoute(walletKey, routes)?.vaultPda ?? walletKey;
|
|
17416
17811
|
}
|
|
17417
17812
|
async function simulateSquadsProposalExecution(args) {
|
|
17418
17813
|
const { connection, feePayer, instructions: instructions2 } = args;
|
|
17419
17814
|
const recentBlockhash = args.recentBlockhash ?? (await connection.getLatestBlockhash(SQUADS_SIMULATION_COMMITMENT)).blockhash;
|
|
17420
|
-
const message2 = new
|
|
17815
|
+
const message2 = new import_web324.TransactionMessage({
|
|
17421
17816
|
payerKey: feePayer,
|
|
17422
17817
|
recentBlockhash,
|
|
17423
17818
|
instructions: [...instructions2]
|
|
17424
17819
|
}).compileToV0Message(args.addressLookupTableAccounts);
|
|
17425
|
-
const transaction = new
|
|
17820
|
+
const transaction = new import_web324.VersionedTransaction(message2);
|
|
17426
17821
|
const { value } = await connection.simulateTransaction(transaction, {
|
|
17427
17822
|
sigVerify: false,
|
|
17428
17823
|
commitment: SQUADS_SIMULATION_COMMITMENT,
|
|
@@ -17443,7 +17838,7 @@ async function prepareVaultTransaction(args) {
|
|
|
17443
17838
|
if (!route) {
|
|
17444
17839
|
return {
|
|
17445
17840
|
kind: "direct",
|
|
17446
|
-
transaction: new
|
|
17841
|
+
transaction: new import_web324.Transaction().add(...instructions2),
|
|
17447
17842
|
authority: proposer
|
|
17448
17843
|
};
|
|
17449
17844
|
}
|
|
@@ -17478,7 +17873,7 @@ async function prepareVaultTransaction(args) {
|
|
|
17478
17873
|
addressLookupTableAccounts: args.addressLookupTableAccounts
|
|
17479
17874
|
});
|
|
17480
17875
|
}
|
|
17481
|
-
const transactionMessage = new
|
|
17876
|
+
const transactionMessage = new import_web324.TransactionMessage({
|
|
17482
17877
|
payerKey: route.vaultPda,
|
|
17483
17878
|
recentBlockhash: blockhash,
|
|
17484
17879
|
instructions: [...instructions2]
|
|
@@ -17508,7 +17903,7 @@ async function prepareVaultTransaction(args) {
|
|
|
17508
17903
|
});
|
|
17509
17904
|
return {
|
|
17510
17905
|
kind: "squads",
|
|
17511
|
-
transaction: new
|
|
17906
|
+
transaction: new import_web324.Transaction().add(
|
|
17512
17907
|
createVaultTransactionIx,
|
|
17513
17908
|
createProposalIx
|
|
17514
17909
|
),
|
|
@@ -17523,16 +17918,16 @@ async function prepareVaultTransaction(args) {
|
|
|
17523
17918
|
|
|
17524
17919
|
// src/utils/squadsBuffer.ts
|
|
17525
17920
|
var squads2 = __toESM(require("@sqds/multisig"));
|
|
17526
|
-
var
|
|
17921
|
+
var import_web325 = require("@solana/web3.js");
|
|
17527
17922
|
var PacketSize = 1232;
|
|
17528
17923
|
var BufferChunkSize = 700;
|
|
17529
17924
|
var MaxBufferSize = 4e3;
|
|
17530
17925
|
async function prepareSquadsProposalUpload(args) {
|
|
17531
17926
|
const { connection, proposer, prepared } = args;
|
|
17532
17927
|
const transaction = prepared.transaction;
|
|
17533
|
-
const sizeProbe = new
|
|
17928
|
+
const sizeProbe = new import_web325.Transaction({
|
|
17534
17929
|
feePayer: proposer,
|
|
17535
|
-
recentBlockhash:
|
|
17930
|
+
recentBlockhash: import_web325.PublicKey.default.toBase58()
|
|
17536
17931
|
}).add(...transaction.instructions);
|
|
17537
17932
|
let fits = false;
|
|
17538
17933
|
try {
|
|
@@ -17552,7 +17947,7 @@ async function prepareSquadsProposalUpload(args) {
|
|
|
17552
17947
|
let bufferPda;
|
|
17553
17948
|
let bufferIndex = 0;
|
|
17554
17949
|
for (; bufferIndex <= 255; bufferIndex++) {
|
|
17555
|
-
const [candidate] =
|
|
17950
|
+
const [candidate] = import_web325.PublicKey.findProgramAddressSync(
|
|
17556
17951
|
[
|
|
17557
17952
|
Buffer.from("multisig"),
|
|
17558
17953
|
prepared.multisigPda.toBuffer(),
|
|
@@ -17580,7 +17975,7 @@ async function prepareSquadsProposalUpload(args) {
|
|
|
17580
17975
|
creator: proposer
|
|
17581
17976
|
};
|
|
17582
17977
|
const setupTransactions = [
|
|
17583
|
-
new
|
|
17978
|
+
new import_web325.Transaction().add(
|
|
17584
17979
|
squads2.generated.createTransactionBufferCreateInstruction(
|
|
17585
17980
|
{
|
|
17586
17981
|
...accounts2,
|
|
@@ -17600,7 +17995,7 @@ async function prepareSquadsProposalUpload(args) {
|
|
|
17600
17995
|
];
|
|
17601
17996
|
for (let offset = BufferChunkSize; offset < bytes.length; offset += BufferChunkSize) {
|
|
17602
17997
|
setupTransactions.push(
|
|
17603
|
-
new
|
|
17998
|
+
new import_web325.Transaction().add(
|
|
17604
17999
|
squads2.generated.createTransactionBufferExtendInstruction(accounts2, {
|
|
17605
18000
|
args: { buffer: bytes.slice(offset, offset + BufferChunkSize) }
|
|
17606
18001
|
})
|
|
@@ -17613,7 +18008,7 @@ async function prepareSquadsProposalUpload(args) {
|
|
|
17613
18008
|
vaultTransactionCreateItemTransaction: prepared.vaultTransactionPda,
|
|
17614
18009
|
vaultTransactionCreateItemCreator: proposer,
|
|
17615
18010
|
vaultTransactionCreateItemRentPayer: proposer,
|
|
17616
|
-
vaultTransactionCreateItemSystemProgram:
|
|
18011
|
+
vaultTransactionCreateItemSystemProgram: import_web325.SystemProgram.programId,
|
|
17617
18012
|
transactionBuffer: bufferPda,
|
|
17618
18013
|
creator: proposer
|
|
17619
18014
|
},
|
|
@@ -17625,7 +18020,7 @@ async function prepareSquadsProposalUpload(args) {
|
|
|
17625
18020
|
).isWritable = true;
|
|
17626
18021
|
return {
|
|
17627
18022
|
setupTransactions,
|
|
17628
|
-
proposalTransaction: new
|
|
18023
|
+
proposalTransaction: new import_web325.Transaction().add(
|
|
17629
18024
|
finalize,
|
|
17630
18025
|
...transaction.instructions.slice(1)
|
|
17631
18026
|
),
|
|
@@ -17636,13 +18031,13 @@ async function prepareSquadsProposalUpload(args) {
|
|
|
17636
18031
|
|
|
17637
18032
|
// src/utils/token.ts
|
|
17638
18033
|
var import_spl_token19 = require("@solana/spl-token");
|
|
17639
|
-
var
|
|
17640
|
-
var
|
|
18034
|
+
var import_web326 = require("@solana/web3.js");
|
|
18035
|
+
var import_common44 = __toESM(require_dist());
|
|
17641
18036
|
async function createTokenMintIxs(connection, payer, authority, decimals, tokenProgram = import_spl_token19.TOKEN_2022_PROGRAM_ID) {
|
|
17642
|
-
const mint =
|
|
18037
|
+
const mint = import_web326.Keypair.generate();
|
|
17643
18038
|
const lamports = await (0, import_spl_token19.getMinimumBalanceForRentExemptMint)(connection);
|
|
17644
18039
|
const ixs = [
|
|
17645
|
-
|
|
18040
|
+
import_web326.SystemProgram.createAccount({
|
|
17646
18041
|
fromPubkey: payer,
|
|
17647
18042
|
newAccountPubkey: mint.publicKey,
|
|
17648
18043
|
space: import_spl_token19.MINT_SIZE,
|
|
@@ -17668,7 +18063,7 @@ async function createTokenMint(connection, payer, decimals, tokenProgram = impor
|
|
|
17668
18063
|
tokenProgram
|
|
17669
18064
|
);
|
|
17670
18065
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
17671
|
-
const tx = new
|
|
18066
|
+
const tx = new import_web326.Transaction().add(...ixs);
|
|
17672
18067
|
tx.feePayer = payer.publicKey;
|
|
17673
18068
|
tx.recentBlockhash = blockhash;
|
|
17674
18069
|
tx.sign(payer, mint);
|
|
@@ -17682,7 +18077,7 @@ async function createTokenMint(connection, payer, decimals, tokenProgram = impor
|
|
|
17682
18077
|
return mint.publicKey;
|
|
17683
18078
|
}
|
|
17684
18079
|
async function mintTokensTo(connection, payer, mint, destination, amount, tokenProgram = import_spl_token19.TOKEN_2022_PROGRAM_ID, allowOwnerOffCurve = true) {
|
|
17685
|
-
const tokenProgramPk = (0,
|
|
18080
|
+
const tokenProgramPk = (0, import_common44.asWeb3PublicKey)(tokenProgram);
|
|
17686
18081
|
const ata = (0, import_spl_token19.getAssociatedTokenAddressSync)(
|
|
17687
18082
|
mint,
|
|
17688
18083
|
destination,
|
|
@@ -17707,12 +18102,12 @@ async function mintTokensTo(connection, payer, mint, destination, amount, tokenP
|
|
|
17707
18102
|
tokenProgramPk
|
|
17708
18103
|
)
|
|
17709
18104
|
];
|
|
17710
|
-
const tx = new
|
|
18105
|
+
const tx = new import_web326.Transaction().add(...ixs);
|
|
17711
18106
|
await connection.sendTransaction(tx, [payer]);
|
|
17712
18107
|
}
|
|
17713
18108
|
|
|
17714
18109
|
// src/utils/yieldApi.ts
|
|
17715
|
-
var
|
|
18110
|
+
var import_core22 = require("@anchor-lang/core");
|
|
17716
18111
|
var YIELD_API_BASE = process.env.YIELD_API_BASE ?? "https://yield-tracker.perena.org";
|
|
17717
18112
|
async function yieldApiReq(endpoint, reqType, bodyData, options) {
|
|
17718
18113
|
const headers = {
|
|
@@ -18038,7 +18433,7 @@ async function getTrackedValue(accountName) {
|
|
|
18038
18433
|
return trackedValueFromResponse(await getYield(accountName));
|
|
18039
18434
|
}
|
|
18040
18435
|
async function getTotalYield(accountNames, start, end) {
|
|
18041
|
-
let totalYield = new
|
|
18436
|
+
let totalYield = new import_core22.BN(0);
|
|
18042
18437
|
for (const accountName of accountNames) {
|
|
18043
18438
|
const res = await getYield(accountName, start, end);
|
|
18044
18439
|
if (isNavAccountValue(res)) {
|
|
@@ -18047,7 +18442,7 @@ async function getTotalYield(accountNames, start, end) {
|
|
|
18047
18442
|
);
|
|
18048
18443
|
}
|
|
18049
18444
|
console.log(res);
|
|
18050
|
-
totalYield = totalYield.add(new
|
|
18445
|
+
totalYield = totalYield.add(new import_core22.BN(res.total_yield));
|
|
18051
18446
|
}
|
|
18052
18447
|
return totalYield;
|
|
18053
18448
|
}
|
|
@@ -18079,7 +18474,7 @@ async function getTotalTrackedValue(accountNames, start, end) {
|
|
|
18079
18474
|
}
|
|
18080
18475
|
|
|
18081
18476
|
// src/services/withdrawalQueueService.ts
|
|
18082
|
-
var
|
|
18477
|
+
var import_common45 = __toESM(require_dist());
|
|
18083
18478
|
function bnToBigInt(value) {
|
|
18084
18479
|
return BigInt(value.toString());
|
|
18085
18480
|
}
|
|
@@ -18100,7 +18495,7 @@ var WithdrawalQueueService = class {
|
|
|
18100
18495
|
const program = this.client.program.account;
|
|
18101
18496
|
const accounts2 = await program.vaultWithdrawalQueue.all();
|
|
18102
18497
|
return accounts2.map(
|
|
18103
|
-
(entry) => this.toSnapshot((0,
|
|
18498
|
+
(entry) => this.toSnapshot((0, import_common45.fromWeb3Pk)(entry.publicKey), entry.account)
|
|
18104
18499
|
);
|
|
18105
18500
|
}
|
|
18106
18501
|
/** Withdrawal queues for a single vault. */
|
|
@@ -18141,7 +18536,7 @@ var WithdrawalQueueService = class {
|
|
|
18141
18536
|
async fulfill(signer, queue) {
|
|
18142
18537
|
const plan = await this.client.tx.fulfillJuniorTrancheWithdraw.getTx({
|
|
18143
18538
|
owner: queue.owner,
|
|
18144
|
-
signer: (0,
|
|
18539
|
+
signer: (0, import_common45.fromWeb3Pk)(signer.publicKey),
|
|
18145
18540
|
queuePayer: queue.payer,
|
|
18146
18541
|
vault: queue.vault,
|
|
18147
18542
|
withdrawalQueue: queue.pda,
|
|
@@ -18195,12 +18590,12 @@ var WithdrawalQueueService = class {
|
|
|
18195
18590
|
const a = account;
|
|
18196
18591
|
return {
|
|
18197
18592
|
pda,
|
|
18198
|
-
vault: (0,
|
|
18199
|
-
owner: (0,
|
|
18200
|
-
payer: (0,
|
|
18593
|
+
vault: (0, import_common45.fromWeb3Pk)(a.parties.vault),
|
|
18594
|
+
owner: (0, import_common45.fromWeb3Pk)(a.parties.owner),
|
|
18595
|
+
payer: (0, import_common45.fromWeb3Pk)(a.parties.payer),
|
|
18201
18596
|
queueId: a.header.queueId,
|
|
18202
|
-
inputMint: (0,
|
|
18203
|
-
outputMint: (0,
|
|
18597
|
+
inputMint: (0, import_common45.fromWeb3Pk)(a.mints.inputMint),
|
|
18598
|
+
outputMint: (0, import_common45.fromWeb3Pk)(a.mints.outputMint),
|
|
18204
18599
|
inputAmount: bnToBigInt(a.request.inputAmount),
|
|
18205
18600
|
requestTs: bnToNumber(a.request.requestTs),
|
|
18206
18601
|
expiryTs: bnToNumber(a.request.expiryTs)
|
|
@@ -18210,10 +18605,10 @@ var WithdrawalQueueService = class {
|
|
|
18210
18605
|
|
|
18211
18606
|
// src/services/oracleService.ts
|
|
18212
18607
|
var import_kit11 = require("@solana/kit");
|
|
18213
|
-
var
|
|
18214
|
-
var
|
|
18608
|
+
var import_common46 = __toESM(require_dist());
|
|
18609
|
+
var SYSTEM_PROGRAM2 = "11111111111111111111111111111111";
|
|
18215
18610
|
var DEFAULT_PRICE_STALENESS_THRESHOLD_SECS2 = 86400n;
|
|
18216
|
-
var
|
|
18611
|
+
var PRICE_ORACLE_TYPES_BY_INDEX2 = [
|
|
18217
18612
|
"none",
|
|
18218
18613
|
"consensusOracle",
|
|
18219
18614
|
"pyth",
|
|
@@ -18234,14 +18629,14 @@ function pubkeyString2(value) {
|
|
|
18234
18629
|
return String(value);
|
|
18235
18630
|
}
|
|
18236
18631
|
function isZeroPubkey(value) {
|
|
18237
|
-
return !value || value ===
|
|
18632
|
+
return !value || value === SYSTEM_PROGRAM2 || /^1+$/.test(value);
|
|
18238
18633
|
}
|
|
18239
18634
|
function variantName(value) {
|
|
18240
18635
|
if (typeof value === "number") {
|
|
18241
|
-
return
|
|
18636
|
+
return PRICE_ORACLE_TYPES_BY_INDEX2[value] ?? String(value);
|
|
18242
18637
|
}
|
|
18243
18638
|
if (typeof value === "bigint") {
|
|
18244
|
-
return
|
|
18639
|
+
return PRICE_ORACLE_TYPES_BY_INDEX2[Number(value)] ?? String(value);
|
|
18245
18640
|
}
|
|
18246
18641
|
if (value && typeof value === "object") return Object.keys(value)[0] ?? "";
|
|
18247
18642
|
return String(value ?? "");
|
|
@@ -18274,7 +18669,7 @@ var OracleService = class {
|
|
|
18274
18669
|
*/
|
|
18275
18670
|
async updateAssetConsensusPrice(signer, args, log) {
|
|
18276
18671
|
const plan = await this.client.tx.updateConsensusOracle.getTx({
|
|
18277
|
-
signer: (0,
|
|
18672
|
+
signer: (0, import_common46.fromWeb3Pk)(signer.publicKey),
|
|
18278
18673
|
vault: args.vault,
|
|
18279
18674
|
updates: args.updates,
|
|
18280
18675
|
assetMint: args.assetMint,
|
|
@@ -18290,7 +18685,7 @@ var OracleService = class {
|
|
|
18290
18685
|
/** Settle the vault NAV from its current holdings (permissionless). */
|
|
18291
18686
|
async crankNav(cranker, args, log) {
|
|
18292
18687
|
const plan = await this.client.tx.crankNav.getTx({
|
|
18293
|
-
cranker: (0,
|
|
18688
|
+
cranker: (0, import_common46.fromWeb3Pk)(cranker.publicKey),
|
|
18294
18689
|
vault: args.vault,
|
|
18295
18690
|
vaultTrancheState: args.vaultTrancheState
|
|
18296
18691
|
});
|
|
@@ -18363,7 +18758,7 @@ var OracleService = class {
|
|
|
18363
18758
|
/** Re-price one live-oracle holding from its bound Pyth/nested-vault account. */
|
|
18364
18759
|
async refreshAssetPrice(updater, args, log) {
|
|
18365
18760
|
const plan = await this.client.tx.updateAssetPrice.getTx({
|
|
18366
|
-
updater: (0,
|
|
18761
|
+
updater: (0, import_common46.fromWeb3Pk)(updater.publicKey),
|
|
18367
18762
|
vault: args.vault,
|
|
18368
18763
|
mint: args.mint,
|
|
18369
18764
|
oracleAccount: args.oracleAccount,
|
|
@@ -18400,31 +18795,6 @@ var OracleService = class {
|
|
|
18400
18795
|
// src/services/consensusOracle/types.ts
|
|
18401
18796
|
var systemClock = { now: () => Date.now() };
|
|
18402
18797
|
|
|
18403
|
-
// src/services/consensusOracle/constants.ts
|
|
18404
|
-
var SYSTEM_PROGRAM2 = "11111111111111111111111111111111";
|
|
18405
|
-
var PRICE_ORACLE_TYPES_BY_INDEX2 = [
|
|
18406
|
-
"none",
|
|
18407
|
-
"consensusOracle",
|
|
18408
|
-
"pyth",
|
|
18409
|
-
"perenaVault"
|
|
18410
|
-
];
|
|
18411
|
-
var CONSENSUS_ORACLE_VARIANT = "consensusoracle";
|
|
18412
|
-
var LIVE_ORACLE_VARIANTS = /* @__PURE__ */ new Set(["pyth", "perenavault"]);
|
|
18413
|
-
var REPORTABLE_ORACLE_VARIANTS = /* @__PURE__ */ new Set([
|
|
18414
|
-
CONSENSUS_ORACLE_VARIANT,
|
|
18415
|
-
...LIVE_ORACLE_VARIANTS
|
|
18416
|
-
]);
|
|
18417
|
-
var LIVE_PRICE_REFRESH_INTERVAL_SECS = 60n * 60n;
|
|
18418
|
-
var DEFAULT_PRICE_STALENESS_SECS = BigInt(
|
|
18419
|
-
DEFAULT_PRICE_STALENESS_THRESHOLD_SECS
|
|
18420
|
-
);
|
|
18421
|
-
var EXTERNAL_POSITION_SAMPLES = 5;
|
|
18422
|
-
var MIN_EXTERNAL_POSITION_SAMPLES = 4;
|
|
18423
|
-
var ORACLE_ENTRY_SIZE = 272;
|
|
18424
|
-
var ORACLE_ENTRIES_OFFSET = 40;
|
|
18425
|
-
var ORACLE_SETTLED_NAV_TS_OFFSET = 8;
|
|
18426
|
-
var MAX_CONSENSUS_SIGNERS = 4;
|
|
18427
|
-
|
|
18428
18798
|
// src/services/consensusOracle/utils/accountLayout.ts
|
|
18429
18799
|
function readI64LE(data, offset) {
|
|
18430
18800
|
let value = 0n;
|
|
@@ -18461,10 +18831,10 @@ function signerInOracleData(data, signerBytes) {
|
|
|
18461
18831
|
// src/services/consensusOracle/utils/decode.ts
|
|
18462
18832
|
function variantName2(value) {
|
|
18463
18833
|
if (typeof value === "number") {
|
|
18464
|
-
return
|
|
18834
|
+
return PRICE_ORACLE_TYPES_BY_INDEX[value] ?? String(value);
|
|
18465
18835
|
}
|
|
18466
18836
|
if (typeof value === "bigint") {
|
|
18467
|
-
return
|
|
18837
|
+
return PRICE_ORACLE_TYPES_BY_INDEX[Number(value)] ?? String(value);
|
|
18468
18838
|
}
|
|
18469
18839
|
if (value && typeof value === "object") return Object.keys(value)[0] ?? "";
|
|
18470
18840
|
return String(value ?? "");
|
|
@@ -18484,12 +18854,12 @@ function toBigInt2(value) {
|
|
|
18484
18854
|
}
|
|
18485
18855
|
|
|
18486
18856
|
// src/services/consensusOracle/utils/holdings.ts
|
|
18487
|
-
var
|
|
18488
|
-
var
|
|
18857
|
+
var import_web327 = require("@solana/web3.js");
|
|
18858
|
+
var import_common47 = __toESM(require_dist());
|
|
18489
18859
|
function selectReportableHoldings(holdings, excludedMints = /* @__PURE__ */ new Set()) {
|
|
18490
18860
|
return holdings.map((holding, holdingIndex) => ({ holding, holdingIndex })).filter(({ holding }) => {
|
|
18491
|
-
const mint = (0,
|
|
18492
|
-
return mint !==
|
|
18861
|
+
const mint = (0, import_common47.fromWeb3Pk)(holding.mint);
|
|
18862
|
+
return mint !== SYSTEM_PROGRAM && !excludedMints.has(mint.toString()) && REPORTABLE_ORACLE_VARIANTS.has(
|
|
18493
18863
|
variantName2(holding.priceOracleType).toLowerCase()
|
|
18494
18864
|
);
|
|
18495
18865
|
});
|
|
@@ -18523,7 +18893,7 @@ function parseExternalLiquidityRefs(vaultState) {
|
|
|
18523
18893
|
if (!data || data.length < 40) continue;
|
|
18524
18894
|
if (data[0] !== 1) continue;
|
|
18525
18895
|
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
18526
|
-
const userAccount = new
|
|
18896
|
+
const userAccount = new import_web327.PublicKey(pubkeyBytes).toBase58();
|
|
18527
18897
|
refs.push({
|
|
18528
18898
|
kind: "marginfi",
|
|
18529
18899
|
mint: "",
|
|
@@ -18749,12 +19119,12 @@ function formatBpsAsPercent(bps) {
|
|
|
18749
19119
|
}
|
|
18750
19120
|
|
|
18751
19121
|
// src/services/consensusOracle/pipeline/dryRunSettlement.ts
|
|
18752
|
-
var
|
|
18753
|
-
var
|
|
19122
|
+
var import_web329 = require("@solana/web3.js");
|
|
19123
|
+
var import_common48 = __toESM(require_dist());
|
|
18754
19124
|
|
|
18755
19125
|
// src/services/consensusOracle/settlement/settlementSimulator.ts
|
|
18756
19126
|
var import_kit12 = require("@solana/kit");
|
|
18757
|
-
var
|
|
19127
|
+
var import_web328 = require("@solana/web3.js");
|
|
18758
19128
|
var DEFAULT_SHARE_PRICE = 1000000n;
|
|
18759
19129
|
var BPS_DENOMINATOR3 = 10000n;
|
|
18760
19130
|
var NAV_LOSS_TOLERANCE_BPS = 25n;
|
|
@@ -18957,7 +19327,7 @@ function applyConsensus(holdings, entries, nowTs, stalenessThresholdSecs) {
|
|
|
18957
19327
|
continue;
|
|
18958
19328
|
}
|
|
18959
19329
|
const reports = entries.filter(
|
|
18960
|
-
(entry) => entry.signer !==
|
|
19330
|
+
(entry) => entry.signer !== import_web328.PublicKey.default.toBase58() && isFresh(entry.lastUpdateTs, nowTs, stalenessThresholdSecs) && (entry.prices[index] ?? 0n) > 0n
|
|
18961
19331
|
);
|
|
18962
19332
|
const usesConsensusPrice = holding.priceOracleType === "consensusoracle";
|
|
18963
19333
|
const prices = reports.map((entry) => entry.prices[index] ?? 0n);
|
|
@@ -19455,7 +19825,7 @@ function decodeOracleData(data, nowTs) {
|
|
|
19455
19825
|
(_, holdingIndex) => readU64(data, offset + EXTERNAL_OFFSET + holdingIndex * 8)
|
|
19456
19826
|
);
|
|
19457
19827
|
entries.push({
|
|
19458
|
-
signer: new
|
|
19828
|
+
signer: new import_web328.PublicKey(signerBytes).toBase58(),
|
|
19459
19829
|
lastUpdateTs: readI64(data, offset + 32),
|
|
19460
19830
|
prices,
|
|
19461
19831
|
externalAmounts
|
|
@@ -19470,7 +19840,7 @@ function decodeOracleData(data, nowTs) {
|
|
|
19470
19840
|
data.slice(pendingOffset + index * 32, pendingOffset + (index + 1) * 32)
|
|
19471
19841
|
);
|
|
19472
19842
|
entries[index] = {
|
|
19473
|
-
signer: index < pendingCount ? new
|
|
19843
|
+
signer: index < pendingCount ? new import_web328.PublicKey(signerBytes).toBase58() : import_web328.PublicKey.default.toBase58(),
|
|
19474
19844
|
lastUpdateTs: 0n,
|
|
19475
19845
|
prices: Array(MAX_HOLDINGS).fill(0n),
|
|
19476
19846
|
externalAmounts: Array(MAX_HOLDINGS).fill(0n)
|
|
@@ -19498,7 +19868,7 @@ function decodeHolding(value) {
|
|
|
19498
19868
|
externalAmount: bigint(holding.externalAmount),
|
|
19499
19869
|
price: bigint(holding.price),
|
|
19500
19870
|
lastUpdateTs: bigint(holding.lastUpdateTs),
|
|
19501
|
-
cleared: mintString ===
|
|
19871
|
+
cleared: mintString === import_web328.PublicKey.default.toBase58()
|
|
19502
19872
|
};
|
|
19503
19873
|
}
|
|
19504
19874
|
function decodeTrancheState(decoded, args, warnings, blockers) {
|
|
@@ -19963,11 +20333,11 @@ async function simulateDryRunSettlement({
|
|
|
19963
20333
|
client.account.fetchVaultOracleForVault(vault, { fresh: true }),
|
|
19964
20334
|
tranchingEnabled ? client.account.fetchVaultTrancheStateForVault(vault, { fresh: true }) : Promise.resolve(void 0)
|
|
19965
20335
|
]);
|
|
19966
|
-
const mintKeys = [new
|
|
20336
|
+
const mintKeys = [new import_web329.PublicKey(vaultState.mint)];
|
|
19967
20337
|
if (trancheState) {
|
|
19968
20338
|
mintKeys.push(
|
|
19969
|
-
new
|
|
19970
|
-
new
|
|
20339
|
+
new import_web329.PublicKey(trancheState.config.juniorMint),
|
|
20340
|
+
new import_web329.PublicKey(trancheState.config.seniorMint)
|
|
19971
20341
|
);
|
|
19972
20342
|
}
|
|
19973
20343
|
const mintAccounts = await client.provider.connection.getMultipleAccountsInfo(
|
|
@@ -19983,7 +20353,7 @@ async function simulateDryRunSettlement({
|
|
|
19983
20353
|
oracleData: oracleState.data,
|
|
19984
20354
|
trancheState,
|
|
19985
20355
|
updates,
|
|
19986
|
-
signer: (0,
|
|
20356
|
+
signer: (0, import_common48.fromWeb3Pk)(signer.publicKey),
|
|
19987
20357
|
nowTs: nowSecs,
|
|
19988
20358
|
physicalShareSupply: supplies[0],
|
|
19989
20359
|
physicalJuniorSupply: tranchingEnabled ? supplies[1] : void 0,
|
|
@@ -19992,7 +20362,7 @@ async function simulateDryRunSettlement({
|
|
|
19992
20362
|
}
|
|
19993
20363
|
|
|
19994
20364
|
// src/services/consensusOracle/pipeline/holdingUpdates.ts
|
|
19995
|
-
var
|
|
20365
|
+
var import_common49 = __toESM(require_dist());
|
|
19996
20366
|
async function buildUpdates(yieldTracker, reportableHoldings, inputs) {
|
|
19997
20367
|
const updates = [];
|
|
19998
20368
|
for (const entry of reportableHoldings) {
|
|
@@ -20002,7 +20372,7 @@ async function buildUpdates(yieldTracker, reportableHoldings, inputs) {
|
|
|
20002
20372
|
}
|
|
20003
20373
|
async function buildHoldingUpdate(yieldTracker, entry, inputs) {
|
|
20004
20374
|
const { holding, holdingIndex } = entry;
|
|
20005
|
-
const mint = (0,
|
|
20375
|
+
const mint = (0, import_common49.fromWeb3Pk)(holding.mint);
|
|
20006
20376
|
const mintKey = mint.toString();
|
|
20007
20377
|
const oracleType = variantName2(holding.priceOracleType).toLowerCase();
|
|
20008
20378
|
let usd;
|
|
@@ -20064,14 +20434,14 @@ async function resolveTrackedAmounts(yieldTracker, cfg, decimals) {
|
|
|
20064
20434
|
);
|
|
20065
20435
|
}
|
|
20066
20436
|
return {
|
|
20067
|
-
trackedValueAmount: tracked.totalValue > 0 ? (0,
|
|
20068
|
-
principalAmount: tracked.principal > 0 ? (0,
|
|
20069
|
-
yieldAmount: tracked.outstandingYield > 0 ? (0,
|
|
20437
|
+
trackedValueAmount: tracked.totalValue > 0 ? (0, import_common49.fromUiAmount)(tracked.totalValue, decimals) : 0n,
|
|
20438
|
+
principalAmount: tracked.principal > 0 ? (0, import_common49.fromUiAmount)(tracked.principal, decimals) : 0n,
|
|
20439
|
+
yieldAmount: tracked.outstandingYield > 0 ? (0, import_common49.fromUiAmount)(tracked.outstandingYield, decimals) : 0n
|
|
20070
20440
|
};
|
|
20071
20441
|
}
|
|
20072
20442
|
|
|
20073
20443
|
// src/services/consensusOracle/pipeline/livePriceRefresh.ts
|
|
20074
|
-
var
|
|
20444
|
+
var import_common50 = __toESM(require_dist());
|
|
20075
20445
|
async function refreshLiveOraclePrices({
|
|
20076
20446
|
oracle,
|
|
20077
20447
|
signer,
|
|
@@ -20090,8 +20460,8 @@ async function refreshLiveOraclePrices({
|
|
|
20090
20460
|
for (const holding of vaultState.holdings) {
|
|
20091
20461
|
const oracleType = variantName2(holding.priceOracleType).toLowerCase();
|
|
20092
20462
|
if (!LIVE_ORACLE_VARIANTS.has(oracleType)) continue;
|
|
20093
|
-
const mint = (0,
|
|
20094
|
-
if (mint.toString() ===
|
|
20463
|
+
const mint = (0, import_common50.fromWeb3Pk)(holding.mint);
|
|
20464
|
+
if (mint.toString() === SYSTEM_PROGRAM) continue;
|
|
20095
20465
|
const activeAmount = toBigInt2(holding.localAmount) + toBigInt2(holding.externalAmount);
|
|
20096
20466
|
if (activeAmount === 0n) continue;
|
|
20097
20467
|
const lastUpdateTs = toBigInt2(holding.lastUpdateTs);
|
|
@@ -20105,8 +20475,8 @@ async function refreshLiveOraclePrices({
|
|
|
20105
20475
|
);
|
|
20106
20476
|
continue;
|
|
20107
20477
|
}
|
|
20108
|
-
const oracleAccount = (0,
|
|
20109
|
-
if (oracleAccount.toString() ===
|
|
20478
|
+
const oracleAccount = (0, import_common50.fromWeb3Pk)(holding.priceOracleAccount);
|
|
20479
|
+
if (oracleAccount.toString() === SYSTEM_PROGRAM) {
|
|
20110
20480
|
log(
|
|
20111
20481
|
`vault ${vault}: cannot refresh ${mint}; ${oracleType} holding has no oracle account`
|
|
20112
20482
|
);
|
|
@@ -20129,14 +20499,14 @@ async function refreshLiveOraclePrices({
|
|
|
20129
20499
|
}
|
|
20130
20500
|
|
|
20131
20501
|
// src/services/consensusOracle/pipeline/pricingInputs.ts
|
|
20132
|
-
var
|
|
20502
|
+
var import_common51 = __toESM(require_dist());
|
|
20133
20503
|
async function gatherPricingInputs(deps, target, vaultState, reportableHoldings, log = () => {
|
|
20134
20504
|
}) {
|
|
20135
20505
|
const consensusMints = reportableHoldings.filter(
|
|
20136
20506
|
({ holding }) => variantName2(holding.priceOracleType).toLowerCase() === CONSENSUS_ORACLE_VARIANT
|
|
20137
|
-
).map(({ holding }) => (0,
|
|
20507
|
+
).map(({ holding }) => (0, import_common51.fromWeb3Pk)(holding.mint));
|
|
20138
20508
|
const baseHolding = vaultState.holdings.find((h) => coerceBool3(h.isBase));
|
|
20139
|
-
const baseMint = baseHolding ? (0,
|
|
20509
|
+
const baseMint = baseHolding ? (0, import_common51.fromWeb3Pk)(baseHolding.mint) : consensusMints[0];
|
|
20140
20510
|
if (!baseMint) {
|
|
20141
20511
|
throw new Error(`vault has no holdings \u2014 cannot determine base asset`);
|
|
20142
20512
|
}
|
|
@@ -20220,11 +20590,11 @@ function reconcilePositionSnapshots(snapshots, vault, log) {
|
|
|
20220
20590
|
}
|
|
20221
20591
|
|
|
20222
20592
|
// src/services/consensusOracle/pipeline/receiptMints.ts
|
|
20223
|
-
var
|
|
20593
|
+
var import_common52 = __toESM(require_dist());
|
|
20224
20594
|
async function fetchReceiptMints(client, vault, vaultState) {
|
|
20225
20595
|
const receiptMints = /* @__PURE__ */ new Set();
|
|
20226
20596
|
if (vaultState.mint) {
|
|
20227
|
-
receiptMints.add((0,
|
|
20597
|
+
receiptMints.add((0, import_common52.fromWeb3Pk)(vaultState.mint).toString());
|
|
20228
20598
|
}
|
|
20229
20599
|
if (!coerceBool3(vaultState.tranchingEnabled)) return receiptMints;
|
|
20230
20600
|
const trancheState = await client.account.fetchVaultTrancheStateForVault(
|
|
@@ -20232,19 +20602,19 @@ async function fetchReceiptMints(client, vault, vaultState) {
|
|
|
20232
20602
|
{ fresh: true }
|
|
20233
20603
|
);
|
|
20234
20604
|
receiptMints.add(
|
|
20235
|
-
(0,
|
|
20605
|
+
(0, import_common52.fromWeb3Pk)(trancheState.config.juniorMint).toString()
|
|
20236
20606
|
);
|
|
20237
20607
|
receiptMints.add(
|
|
20238
|
-
(0,
|
|
20608
|
+
(0, import_common52.fromWeb3Pk)(trancheState.config.seniorMint).toString()
|
|
20239
20609
|
);
|
|
20240
20610
|
return receiptMints;
|
|
20241
20611
|
}
|
|
20242
20612
|
|
|
20243
20613
|
// src/services/consensusOracle/pipeline/settlement.ts
|
|
20244
|
-
var
|
|
20614
|
+
var import_common54 = __toESM(require_dist());
|
|
20245
20615
|
|
|
20246
20616
|
// src/services/consensusOracle/pipeline/yieldAccounts.ts
|
|
20247
|
-
var
|
|
20617
|
+
var import_common53 = __toESM(require_dist());
|
|
20248
20618
|
async function assertNoUnconfirmedYieldPayments(yieldTracker, target) {
|
|
20249
20619
|
const accountNames = [
|
|
20250
20620
|
...new Set(
|
|
@@ -20286,7 +20656,7 @@ async function withDiscoveredYieldAccounts(yieldTracker, target, vaultState, exc
|
|
|
20286
20656
|
);
|
|
20287
20657
|
if (namesToAttach.length === 0) return target;
|
|
20288
20658
|
const baseHolding = vaultState.holdings.find((holding) => {
|
|
20289
|
-
const mint = (0,
|
|
20659
|
+
const mint = (0, import_common53.fromWeb3Pk)(holding.mint).toString();
|
|
20290
20660
|
return coerceBool3(holding.isBase) && !excludedMints.has(mint);
|
|
20291
20661
|
});
|
|
20292
20662
|
if (!baseHolding) {
|
|
@@ -20294,7 +20664,7 @@ async function withDiscoveredYieldAccounts(yieldTracker, target, vaultState, exc
|
|
|
20294
20664
|
`vault ${target.vault}: tagged yield accounts found but no base holding is available`
|
|
20295
20665
|
);
|
|
20296
20666
|
}
|
|
20297
|
-
const baseMint = (0,
|
|
20667
|
+
const baseMint = (0, import_common53.fromWeb3Pk)(baseHolding.mint);
|
|
20298
20668
|
const holdings = [...target.holdings ?? []];
|
|
20299
20669
|
const existingIndex = holdings.findIndex(
|
|
20300
20670
|
(holding) => holding.mint.toString() === baseMint.toString()
|
|
@@ -20395,8 +20765,8 @@ async function logProspectiveApy({
|
|
|
20395
20765
|
);
|
|
20396
20766
|
const prospectiveNav = vaultState.holdings.reduce(
|
|
20397
20767
|
(sum, holding, holdingIndex) => {
|
|
20398
|
-
const mint = (0,
|
|
20399
|
-
if (mint ===
|
|
20768
|
+
const mint = (0, import_common54.fromWeb3Pk)(holding.mint).toString();
|
|
20769
|
+
if (mint === SYSTEM_PROGRAM) return sum;
|
|
20400
20770
|
const update = updatesByIndex.get(holdingIndex);
|
|
20401
20771
|
const localAmount = toBigInt2(holding.localAmount);
|
|
20402
20772
|
const externalAmount = update ? update.externalAmount : toBigInt2(holding.externalAmount);
|
|
@@ -20548,7 +20918,7 @@ var StaticPositionProvider = class {
|
|
|
20548
20918
|
|
|
20549
20919
|
// src/services/consensusOracle/positions/kaminoPositionProvider.ts
|
|
20550
20920
|
var import_kit14 = require("@solana/kit");
|
|
20551
|
-
var
|
|
20921
|
+
var import_web330 = require("@solana/web3.js");
|
|
20552
20922
|
var import_klend_sdk = require("@kamino-finance/klend-sdk");
|
|
20553
20923
|
async function readKaminoBalance(manager, vault, sharesHolder) {
|
|
20554
20924
|
const userShares = await manager.getUserSharesBalanceSingleVault(
|
|
@@ -20585,7 +20955,7 @@ var KaminoPositionProvider = class {
|
|
|
20585
20955
|
const amount = await readKaminoBalance(
|
|
20586
20956
|
manager,
|
|
20587
20957
|
kVault,
|
|
20588
|
-
new
|
|
20958
|
+
new import_web330.PublicKey(sharesHolder)
|
|
20589
20959
|
);
|
|
20590
20960
|
out.push({ mint: ref.mint, amount });
|
|
20591
20961
|
}
|
|
@@ -20594,7 +20964,7 @@ var KaminoPositionProvider = class {
|
|
|
20594
20964
|
};
|
|
20595
20965
|
|
|
20596
20966
|
// src/services/consensusOracle/positions/marginfiPositionProvider.ts
|
|
20597
|
-
var
|
|
20967
|
+
var import_web331 = require("@solana/web3.js");
|
|
20598
20968
|
var import_marginfi2 = __toESM(require_dist2());
|
|
20599
20969
|
var MarginfiPositionProvider = class {
|
|
20600
20970
|
constructor(connection, log = () => {
|
|
@@ -20605,8 +20975,8 @@ var MarginfiPositionProvider = class {
|
|
|
20605
20975
|
async positionsFor(ctx) {
|
|
20606
20976
|
const refs = ctx.refs.filter((r) => r.kind === "marginfi");
|
|
20607
20977
|
if (refs.length === 0) return [];
|
|
20608
|
-
const explicitBanks = refs.map((r) => r.marginfiBank).filter(Boolean).map((bank) => new
|
|
20609
|
-
const autoAccountPks = refs.filter((r) => !r.marginfiBank).map((r) => r.marginfiAccount).filter(Boolean).map((account) => new
|
|
20978
|
+
const explicitBanks = refs.map((r) => r.marginfiBank).filter(Boolean).map((bank) => new import_web331.PublicKey(bank));
|
|
20979
|
+
const autoAccountPks = refs.filter((r) => !r.marginfiBank).map((r) => r.marginfiAccount).filter(Boolean).map((account) => new import_web331.PublicKey(account));
|
|
20610
20980
|
const autoBanks = [];
|
|
20611
20981
|
for (const accountPk of autoAccountPks) {
|
|
20612
20982
|
try {
|
|
@@ -20635,14 +21005,14 @@ var MarginfiPositionProvider = class {
|
|
|
20635
21005
|
if (bank) {
|
|
20636
21006
|
const amount = await (0, import_marginfi2.readMarginfiBankBalance)(
|
|
20637
21007
|
client,
|
|
20638
|
-
new
|
|
20639
|
-
new
|
|
21008
|
+
new import_web331.PublicKey(account),
|
|
21009
|
+
new import_web331.PublicKey(bank)
|
|
20640
21010
|
);
|
|
20641
21011
|
out.push({ mint: ref.mint, amount });
|
|
20642
21012
|
} else {
|
|
20643
21013
|
const balances = await (0, import_marginfi2.readAllMarginfiBalances)(
|
|
20644
21014
|
client,
|
|
20645
|
-
new
|
|
21015
|
+
new import_web331.PublicKey(account)
|
|
20646
21016
|
);
|
|
20647
21017
|
for (const { mint, amount } of balances) {
|
|
20648
21018
|
out.push({ mint: mint.toBase58(), amount });
|
|
@@ -20882,7 +21252,7 @@ function createLiveConsensusOracleDeps(connection, opts = {}) {
|
|
|
20882
21252
|
}
|
|
20883
21253
|
|
|
20884
21254
|
// src/services/consensusOracle/consensusOracleService.ts
|
|
20885
|
-
var
|
|
21255
|
+
var import_common55 = __toESM(require_dist());
|
|
20886
21256
|
var ConsensusOracleService = class {
|
|
20887
21257
|
constructor(client, deps) {
|
|
20888
21258
|
this.client = client;
|
|
@@ -20918,7 +21288,7 @@ var ConsensusOracleService = class {
|
|
|
20918
21288
|
receiptMints
|
|
20919
21289
|
);
|
|
20920
21290
|
const filteredCount = vaultState.holdings.filter(
|
|
20921
|
-
(holding) => receiptMints.has((0,
|
|
21291
|
+
(holding) => receiptMints.has((0, import_common55.fromWeb3Pk)(holding.mint).toString())
|
|
20922
21292
|
).length;
|
|
20923
21293
|
if (filteredCount > 0) {
|
|
20924
21294
|
log(
|
|
@@ -21099,8 +21469,8 @@ async function runLiveConsensusOracle(env, oracleSigner, opts = {}) {
|
|
|
21099
21469
|
|
|
21100
21470
|
// src/services/externalLiquidityIntegrityService.ts
|
|
21101
21471
|
var import_kit15 = require("@solana/kit");
|
|
21102
|
-
var
|
|
21103
|
-
var
|
|
21472
|
+
var import_web332 = require("@solana/web3.js");
|
|
21473
|
+
var import_common56 = __toESM(require_dist());
|
|
21104
21474
|
var import_marginfi3 = __toESM(require_dist2());
|
|
21105
21475
|
var DEFAULT_MIN_AMOUNT_UI = 1;
|
|
21106
21476
|
var DEFAULT_TARGET_LOCAL_BPS = 50;
|
|
@@ -21122,7 +21492,7 @@ function parseActiveSlots(externalLiquidity) {
|
|
|
21122
21492
|
if (discriminant === 0) continue;
|
|
21123
21493
|
if (discriminant !== 1) continue;
|
|
21124
21494
|
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
21125
|
-
const userAccount = (0,
|
|
21495
|
+
const userAccount = (0, import_common56.toAddress)(new import_web332.PublicKey(pubkeyBytes));
|
|
21126
21496
|
results.push({ index: i, source: "marginfi", userAccount });
|
|
21127
21497
|
}
|
|
21128
21498
|
return results;
|
|
@@ -21238,8 +21608,8 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
21238
21608
|
result.skipped++;
|
|
21239
21609
|
return result;
|
|
21240
21610
|
}
|
|
21241
|
-
const hwManagerAddress = (0,
|
|
21242
|
-
const vaultPk = new
|
|
21611
|
+
const hwManagerAddress = (0, import_common56.fromWeb3Pk)(hwManager.publicKey);
|
|
21612
|
+
const vaultPk = new import_web332.PublicKey(vault.toString());
|
|
21243
21613
|
const registeredHwManager = pubkeyStr(
|
|
21244
21614
|
vaultState.roles.hwManager
|
|
21245
21615
|
);
|
|
@@ -21359,14 +21729,14 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
21359
21729
|
const marginfiClient = new import_marginfi3.CpiClient({
|
|
21360
21730
|
accounts: marginfiAccounts
|
|
21361
21731
|
});
|
|
21362
|
-
const { getAtaAddress:
|
|
21363
|
-
const vaultAta =
|
|
21732
|
+
const { getAtaAddress: getAtaAddress20 } = await Promise.resolve().then(() => __toESM(require_dist()));
|
|
21733
|
+
const vaultAta = getAtaAddress20(
|
|
21364
21734
|
mintAddress,
|
|
21365
21735
|
vault,
|
|
21366
21736
|
marginfiAccounts.tokenProgram,
|
|
21367
21737
|
true
|
|
21368
21738
|
);
|
|
21369
|
-
const cpiRefs = (0,
|
|
21739
|
+
const cpiRefs = (0, import_common56.createCpiRefs)([
|
|
21370
21740
|
direction === "deposit" ? marginfiClient.deposit_cpi({
|
|
21371
21741
|
marginfiAccount: slot.userAccount,
|
|
21372
21742
|
authority: vault,
|
|
@@ -21420,8 +21790,8 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
21420
21790
|
var import_kit16 = require("@solana/kit");
|
|
21421
21791
|
var import_spl_token20 = require("@solana/spl-token");
|
|
21422
21792
|
var import_marginfi_client_v2 = require("@mrgnlabs/marginfi-client-v2");
|
|
21423
|
-
var
|
|
21424
|
-
var
|
|
21793
|
+
var import_web333 = require("@solana/web3.js");
|
|
21794
|
+
var import_common57 = __toESM(require_dist());
|
|
21425
21795
|
var import_jupiter2 = __toESM(require_dist3());
|
|
21426
21796
|
var import_marginfi4 = __toESM(require_dist2());
|
|
21427
21797
|
var IDLE_RESERVE_FLOOR_BPS = 400;
|
|
@@ -21520,8 +21890,8 @@ var IdleLiquidityService = class {
|
|
|
21520
21890
|
let quote;
|
|
21521
21891
|
try {
|
|
21522
21892
|
quote = await jupiter.getQuote({
|
|
21523
|
-
inputMint:
|
|
21524
|
-
outputMint:
|
|
21893
|
+
inputMint: import_common57.PST_MINT,
|
|
21894
|
+
outputMint: import_common57.USDC_MINT,
|
|
21525
21895
|
amount: pstInput,
|
|
21526
21896
|
slippageBps: opts.slippageBps ?? DEFAULT_SLIPPAGE_BPS,
|
|
21527
21897
|
maxAccounts: DEFAULT_MAX_ACCOUNTS
|
|
@@ -21567,8 +21937,8 @@ var IdleLiquidityService = class {
|
|
|
21567
21937
|
/** Read only the two locations that constitute the idle USDC reserve. */
|
|
21568
21938
|
async fetchIdleUsdc(vault, vaultState) {
|
|
21569
21939
|
const connection = this.client.provider.connection;
|
|
21570
|
-
const vaultPk = new
|
|
21571
|
-
const usdcMint = new
|
|
21940
|
+
const vaultPk = new import_web333.PublicKey(vault);
|
|
21941
|
+
const usdcMint = new import_web333.PublicKey(import_common57.USDC_MINT);
|
|
21572
21942
|
const ata = (0, import_spl_token20.getAssociatedTokenAddressSync)(usdcMint, vaultPk, true);
|
|
21573
21943
|
const tokenInfo = await connection.getAccountInfo(ata, "confirmed");
|
|
21574
21944
|
let localAmount = 0n;
|
|
@@ -21587,12 +21957,12 @@ var IdleLiquidityService = class {
|
|
|
21587
21957
|
if (data[0] !== 1) {
|
|
21588
21958
|
throw new Error("External-liquidity slot 0 is not Marginfi");
|
|
21589
21959
|
}
|
|
21590
|
-
const positionPk = new
|
|
21960
|
+
const positionPk = new import_web333.PublicKey(new Uint8Array(data.slice(8, 40)));
|
|
21591
21961
|
const positionInfo = await connection.getAccountInfo(
|
|
21592
21962
|
positionPk,
|
|
21593
21963
|
"confirmed"
|
|
21594
21964
|
);
|
|
21595
|
-
if (!positionInfo || !positionInfo.owner.equals(new
|
|
21965
|
+
if (!positionInfo || !positionInfo.owner.equals(new import_web333.PublicKey(import_marginfi4.MARGINFI_PROGRAM_ID))) {
|
|
21596
21966
|
throw new Error(
|
|
21597
21967
|
`Invalid Marginfi slot-0 account: ${positionPk.toBase58()}`
|
|
21598
21968
|
);
|
|
@@ -21642,8 +22012,8 @@ var IdleLiquidityService = class {
|
|
|
21642
22012
|
log(`Vault ${vault}: ${reason} \u2014 skipping`);
|
|
21643
22013
|
return { result: { ...empty, status: "no-tvl", reason } };
|
|
21644
22014
|
}
|
|
21645
|
-
const usdc = findHolding2(vaultState,
|
|
21646
|
-
const pst = findHolding2(vaultState,
|
|
22015
|
+
const usdc = findHolding2(vaultState, import_common57.USDC_MINT);
|
|
22016
|
+
const pst = findHolding2(vaultState, import_common57.PST_MINT);
|
|
21647
22017
|
if (!usdc || !pst) {
|
|
21648
22018
|
const reason = `vault has no ${usdc ? "PST" : "USDC"} holding`;
|
|
21649
22019
|
log(`Vault ${vault}: ${reason} \u2014 skipping`);
|
|
@@ -21771,7 +22141,7 @@ var IdleLiquidityService = class {
|
|
|
21771
22141
|
*/
|
|
21772
22142
|
async mintTokenProgram(mint) {
|
|
21773
22143
|
const account = await this.client.provider.connection.getAccountInfo(
|
|
21774
|
-
new
|
|
22144
|
+
new import_web333.PublicKey(mint),
|
|
21775
22145
|
"confirmed"
|
|
21776
22146
|
);
|
|
21777
22147
|
if (!account) throw new Error(`Mint account not found: ${mint}`);
|
|
@@ -21780,7 +22150,7 @@ var IdleLiquidityService = class {
|
|
|
21780
22150
|
`Unsupported token program ${account.owner.toBase58()} for mint ${mint}`
|
|
21781
22151
|
);
|
|
21782
22152
|
}
|
|
21783
|
-
return (0,
|
|
22153
|
+
return (0, import_common57.fromWeb3Pk)(account.owner);
|
|
21784
22154
|
}
|
|
21785
22155
|
/**
|
|
21786
22156
|
* Build, simulate, and (unless `dryRun`) submit the `jupiter_swap`.
|
|
@@ -21800,23 +22170,23 @@ var IdleLiquidityService = class {
|
|
|
21800
22170
|
dryRun,
|
|
21801
22171
|
log
|
|
21802
22172
|
} = params;
|
|
21803
|
-
const signer = (0,
|
|
22173
|
+
const signer = (0, import_common57.fromWeb3Pk)(hwManager.publicKey);
|
|
21804
22174
|
const [sourceTokenProgram, destinationTokenProgram] = await Promise.all([
|
|
21805
|
-
this.mintTokenProgram(
|
|
21806
|
-
this.mintTokenProgram(
|
|
22175
|
+
this.mintTokenProgram(import_common57.PST_MINT),
|
|
22176
|
+
this.mintTokenProgram(import_common57.USDC_MINT)
|
|
21807
22177
|
]);
|
|
21808
22178
|
const jupiterCpi = await jupiter.getSwapCpiData(quote, vault, {
|
|
21809
22179
|
payer: signer
|
|
21810
22180
|
});
|
|
21811
|
-
const { accounts: accounts2, refs, lookupTables } = (0,
|
|
22181
|
+
const { accounts: accounts2, refs, lookupTables } = (0, import_common57.createCpiRefs)([jupiterCpi]);
|
|
21812
22182
|
const vaultTrancheState = coerceBool4(
|
|
21813
22183
|
vaultState.tranchingEnabled
|
|
21814
22184
|
) ? (await this.client.pda.deriveVaultTrancheStatePda(vault))[0] : void 0;
|
|
21815
22185
|
const plan = await this.client.tx.jupiterSwap.getTx({
|
|
21816
22186
|
hwManager: signer,
|
|
21817
22187
|
vault,
|
|
21818
|
-
sourceMint:
|
|
21819
|
-
destinationMint:
|
|
22188
|
+
sourceMint: import_common57.PST_MINT,
|
|
22189
|
+
destinationMint: import_common57.USDC_MINT,
|
|
21820
22190
|
refs,
|
|
21821
22191
|
accounts: accounts2,
|
|
21822
22192
|
sourceTokenProgram,
|
|
@@ -21826,26 +22196,26 @@ var IdleLiquidityService = class {
|
|
|
21826
22196
|
});
|
|
21827
22197
|
const connection = this.client.provider.connection;
|
|
21828
22198
|
const instructions2 = [
|
|
21829
|
-
|
|
22199
|
+
import_web333.ComputeBudgetProgram.setComputeUnitLimit({ units: COMPUTE_UNIT_LIMIT }),
|
|
21830
22200
|
...cuPriceMicroLamports > 0 ? [
|
|
21831
|
-
|
|
22201
|
+
import_web333.ComputeBudgetProgram.setComputeUnitPrice({
|
|
21832
22202
|
microLamports: cuPriceMicroLamports
|
|
21833
22203
|
})
|
|
21834
22204
|
] : [],
|
|
21835
|
-
...(jupiterCpi.preInstructions ?? []).map(
|
|
21836
|
-
...plan.instructions.map(
|
|
22205
|
+
...(jupiterCpi.preInstructions ?? []).map(import_common57.fromKitInstruction),
|
|
22206
|
+
...plan.instructions.map(import_common57.fromKitInstruction)
|
|
21837
22207
|
];
|
|
21838
22208
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
21839
|
-
const lookupTableAccounts = await (0,
|
|
22209
|
+
const lookupTableAccounts = await (0, import_common57.fetchLookupTables)(
|
|
21840
22210
|
connection,
|
|
21841
22211
|
plan.lookupTables ?? []
|
|
21842
22212
|
);
|
|
21843
|
-
const message2 = new
|
|
22213
|
+
const message2 = new import_web333.TransactionMessage({
|
|
21844
22214
|
payerKey: hwManager.publicKey,
|
|
21845
22215
|
recentBlockhash: blockhash,
|
|
21846
22216
|
instructions: instructions2
|
|
21847
22217
|
}).compileToV0Message(lookupTableAccounts);
|
|
21848
|
-
const transaction = new
|
|
22218
|
+
const transaction = new import_web333.VersionedTransaction(message2);
|
|
21849
22219
|
transaction.sign([hwManager]);
|
|
21850
22220
|
if (!this.client.skipSimulation) {
|
|
21851
22221
|
const simulation = await connection.simulateTransaction(transaction, {
|
|
@@ -21891,9 +22261,9 @@ var IdleLiquidityService = class {
|
|
|
21891
22261
|
|
|
21892
22262
|
// src/services/timelockSettlementService.ts
|
|
21893
22263
|
var import_kit17 = require("@solana/kit");
|
|
21894
|
-
var
|
|
21895
|
-
var
|
|
21896
|
-
var ZERO_PUBKEY =
|
|
22264
|
+
var import_web334 = require("@solana/web3.js");
|
|
22265
|
+
var import_common58 = __toESM(require_dist());
|
|
22266
|
+
var ZERO_PUBKEY = import_web334.PublicKey.default.toBase58();
|
|
21897
22267
|
var CONSENSUS_SIGNER_CAPACITY = 4;
|
|
21898
22268
|
var CONSENSUS_ENTRY_OFFSET = 40;
|
|
21899
22269
|
var CONSENSUS_ENTRY_SIZE = 272;
|
|
@@ -21933,7 +22303,7 @@ function decodePendingConsensusSigners(data) {
|
|
|
21933
22303
|
const signers = [];
|
|
21934
22304
|
for (let i = 0; i < count; i += 1) {
|
|
21935
22305
|
const start = CONSENSUS_PENDING_OFFSET + i * 32;
|
|
21936
|
-
const signer = new
|
|
22306
|
+
const signer = new import_web334.PublicKey(bytes.slice(start, start + 32)).toBase58();
|
|
21937
22307
|
if (signer === ZERO_PUBKEY) {
|
|
21938
22308
|
throw new Error(`pending consensus signer ${i} is unset`);
|
|
21939
22309
|
}
|
|
@@ -21989,7 +22359,7 @@ var TimelockSettlementService = class {
|
|
|
21989
22359
|
});
|
|
21990
22360
|
const dryRun = opts.dryRun ?? false;
|
|
21991
22361
|
const now = opts.now ?? await this.chainTime();
|
|
21992
|
-
const fulfillerAddress = (0,
|
|
22362
|
+
const fulfillerAddress = (0, import_common58.fromWeb3Pk)(fulfiller.publicKey);
|
|
21993
22363
|
const allVaults = opts.vault ? [
|
|
21994
22364
|
{
|
|
21995
22365
|
publicKey: opts.vault,
|
|
@@ -22133,17 +22503,17 @@ var TimelockSettlementService = class {
|
|
|
22133
22503
|
// src/services/nestWithdrawalService.ts
|
|
22134
22504
|
var import_kit18 = require("@solana/kit");
|
|
22135
22505
|
var import_spl_token21 = require("@solana/spl-token");
|
|
22136
|
-
var
|
|
22137
|
-
var
|
|
22506
|
+
var import_web335 = require("@solana/web3.js");
|
|
22507
|
+
var import_common59 = __toESM(require_dist());
|
|
22138
22508
|
var import_nest3 = __toESM(require_dist4());
|
|
22139
22509
|
var import_nest4 = __toESM(require_dist4());
|
|
22140
|
-
var NestOftProgram = new
|
|
22510
|
+
var NestOftProgram = new import_web335.PublicKey(
|
|
22141
22511
|
"ChEfPd3RzLeYiRwp1K9evimmaFSd6DV1S4Mv5q5Aj1th"
|
|
22142
22512
|
);
|
|
22143
|
-
var NestOftStore = new
|
|
22513
|
+
var NestOftStore = new import_web335.PublicKey(
|
|
22144
22514
|
"k8mJj8Gyw2gFAqut21AFVUUZhxb4RVDMnb4PrSYiDhV"
|
|
22145
22515
|
);
|
|
22146
|
-
var UsdcMint = new
|
|
22516
|
+
var UsdcMint = new import_web335.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
22147
22517
|
var NestPerenaComposer = Buffer.from(
|
|
22148
22518
|
"000000000000000000000000908dcb5531691c2124c54e30bb645cf11647090d",
|
|
22149
22519
|
"hex"
|
|
@@ -22160,7 +22530,7 @@ async function buildNestWithdrawalRequest(args) {
|
|
|
22160
22530
|
return decodeNestWithdrawalRequest({ ...args, txBase64 });
|
|
22161
22531
|
}
|
|
22162
22532
|
async function decodeNestWithdrawalRequest(args) {
|
|
22163
|
-
const transaction =
|
|
22533
|
+
const transaction = import_web335.VersionedTransaction.deserialize(
|
|
22164
22534
|
Buffer.from(args.txBase64, "base64")
|
|
22165
22535
|
);
|
|
22166
22536
|
const message2 = transaction.message;
|
|
@@ -22181,14 +22551,14 @@ async function decodeNestWithdrawalRequest(args) {
|
|
|
22181
22551
|
return value;
|
|
22182
22552
|
})
|
|
22183
22553
|
);
|
|
22184
|
-
const decoded =
|
|
22554
|
+
const decoded = import_web335.TransactionMessage.decompile(message2, {
|
|
22185
22555
|
addressLookupTableAccounts: tables
|
|
22186
22556
|
});
|
|
22187
|
-
const nestMint = new
|
|
22557
|
+
const nestMint = new import_web335.PublicKey(NEST_RWA_SHARE_MINT);
|
|
22188
22558
|
const sourceAta = (0, import_spl_token21.getAssociatedTokenAddressSync)(nestMint, args.owner, true);
|
|
22189
22559
|
const usdcAta = (0, import_spl_token21.getAssociatedTokenAddressSync)(UsdcMint, args.owner, true);
|
|
22190
22560
|
const instructions2 = decoded.instructions.filter(
|
|
22191
|
-
(ix) => !ix.programId.equals(
|
|
22561
|
+
(ix) => !ix.programId.equals(import_web335.ComputeBudgetProgram.programId)
|
|
22192
22562
|
);
|
|
22193
22563
|
let sends = 0;
|
|
22194
22564
|
for (const ix of instructions2) {
|
|
@@ -22210,13 +22580,13 @@ async function decodeNestWithdrawalRequest(args) {
|
|
|
22210
22580
|
if (sends !== 1)
|
|
22211
22581
|
throw new Error("Nest withdrawal must contain exactly one OFT send");
|
|
22212
22582
|
return {
|
|
22213
|
-
instructions: instructions2.map(
|
|
22583
|
+
instructions: instructions2.map(import_common59.toKitInstruction),
|
|
22214
22584
|
lookupTables: tables.map((table) => (0, import_kit18.address)(table.key.toBase58()))
|
|
22215
22585
|
};
|
|
22216
22586
|
}
|
|
22217
22587
|
|
|
22218
22588
|
// src/index.ts
|
|
22219
|
-
var
|
|
22589
|
+
var import_common60 = __toESM(require_dist());
|
|
22220
22590
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22221
22591
|
0 && (module.exports = {
|
|
22222
22592
|
ASSET_DECIMALS,
|
|
@@ -22224,16 +22594,19 @@ var import_common57 = __toESM(require_dist());
|
|
|
22224
22594
|
AccountClient,
|
|
22225
22595
|
ActivateCircuitBreakerBuilder,
|
|
22226
22596
|
AddIncentiveRecipientBuilder,
|
|
22597
|
+
AddIncentiveRecipientV3Builder,
|
|
22227
22598
|
BALANCE_CHANGE_BASELINE_MAX_AGE_SECS,
|
|
22228
22599
|
CONSENSUS_ORACLE_VARIANT,
|
|
22229
22600
|
CancelIncentiveProposalBuilder,
|
|
22230
22601
|
CancelJuniorTrancheWithdrawBuilder,
|
|
22231
22602
|
ClaimIncentiveBuilder,
|
|
22603
|
+
ClaimIncentiveV3Builder,
|
|
22232
22604
|
ConsensusOracleService,
|
|
22233
22605
|
CrankNavBuilder,
|
|
22234
22606
|
CrankPerformanceFeesBuilder,
|
|
22235
22607
|
CreateAssetHoldingBuilder,
|
|
22236
22608
|
CreateIncentiveBuilder,
|
|
22609
|
+
CreateIncentiveV3Builder,
|
|
22237
22610
|
CreateTrancheStateBuilder,
|
|
22238
22611
|
CreateVaultBuilder,
|
|
22239
22612
|
DEFAULT_CU_PRICE_MICRO_LAMPORTS,
|
|
@@ -22254,6 +22627,7 @@ var import_common57 = __toESM(require_dist());
|
|
|
22254
22627
|
DEFAULT_VAULT_ID,
|
|
22255
22628
|
DisableCircuitBreakerBuilder,
|
|
22256
22629
|
DistributeIncentiveBuilder,
|
|
22630
|
+
DistributeIncentiveV3Builder,
|
|
22257
22631
|
EXTERNAL_POSITION_SAMPLES,
|
|
22258
22632
|
ExecuteDepositBuilder,
|
|
22259
22633
|
ExecuteShareSwapBuilder,
|
|
@@ -22281,6 +22655,7 @@ var import_common57 = __toESM(require_dist());
|
|
|
22281
22655
|
MAX_BALANCE_CHANGE_BPS,
|
|
22282
22656
|
MAX_CONSENSUS_SIGNERS,
|
|
22283
22657
|
MAX_INCENTIVE_RECIPIENTS,
|
|
22658
|
+
MAX_INCENTIVE_REPORT_TTL,
|
|
22284
22659
|
MAX_MANAGER_WITHDRAW_DESTINATIONS,
|
|
22285
22660
|
MAX_PRICE_STALENESS_THRESHOLD_SECS,
|
|
22286
22661
|
MIN_EXTERNAL_POSITION_SAMPLES,
|
|
@@ -22306,15 +22681,18 @@ var import_common57 = __toESM(require_dist());
|
|
|
22306
22681
|
ProtocolInteractionBuilder,
|
|
22307
22682
|
REPORTABLE_ORACLE_VARIANTS,
|
|
22308
22683
|
RemoveAssetHoldingBuilder,
|
|
22684
|
+
ReportIncentiveV3Builder,
|
|
22309
22685
|
RequestJuniorTrancheWithdrawBuilder,
|
|
22310
22686
|
SHARE_DECIMALS,
|
|
22311
22687
|
SYSTEM_PROGRAM,
|
|
22312
22688
|
SetAssetPriceOracleBuilder,
|
|
22313
22689
|
SetExternalLiquidityBuilder,
|
|
22314
22690
|
SetIncentiveLimitsBuilder,
|
|
22691
|
+
SetIncentiveLimitsV3Builder,
|
|
22315
22692
|
SetManagerWithdrawDestinationBuilder,
|
|
22316
22693
|
SetProtocolFeeBuilder,
|
|
22317
22694
|
SetVaultConfigBuilder,
|
|
22695
|
+
SettleIncentiveV3Builder,
|
|
22318
22696
|
SquadsProposalExecutionSimulationError,
|
|
22319
22697
|
StaticPositionProvider,
|
|
22320
22698
|
SubmitIncentiveBuilder,
|
|
@@ -22391,6 +22769,10 @@ var import_common57 = __toESM(require_dist());
|
|
|
22391
22769
|
getIncentiveRecipients,
|
|
22392
22770
|
getIncentiveReportRecipients,
|
|
22393
22771
|
getIncentiveTotals,
|
|
22772
|
+
getIncentiveV3OracleState,
|
|
22773
|
+
getIncentiveV3RecipientShareAtas,
|
|
22774
|
+
getIncentiveV3Recipients,
|
|
22775
|
+
getIncentiveV3Totals,
|
|
22394
22776
|
getNavValue,
|
|
22395
22777
|
getRpcUrl,
|
|
22396
22778
|
getTotalOutstandingYield,
|