@pyron-finance/pyron-client 2.8.2 → 2.9.0

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.cjs CHANGED
@@ -98,7 +98,7 @@ var init_misc = __esm({
98
98
  });
99
99
 
100
100
  // src/constants/programs.ts
101
- var import_web34, LUT_PROGRAM_AUTHORITY_INDEX, JUPITER_V6_PROGRAM, LENDR_PROGRAM, SINGLE_POOL_PROGRAM_ID, STAKE_PROGRAM_ID, MPL_METADATA_PROGRAM_ID, SYSTEM_PROGRAM_ID, SYSVAR_RENT_ID, SYSVAR_CLOCK_ID, SYSVAR_STAKE_HISTORY_ID, STAKE_CONFIG_ID;
101
+ var import_web34, LUT_PROGRAM_AUTHORITY_INDEX, JUPITER_V6_PROGRAM, LENDR_PROGRAM, SINGLE_POOL_PROGRAM_ID, STAKE_PROGRAM_ID, MPL_METADATA_PROGRAM_ID, SYSTEM_PROGRAM_ID, SYSVAR_RENT_ID, SYSVAR_CLOCK_ID, SYSVAR_STAKE_HISTORY_ID, STAKE_CONFIG_ID, FOGO_STAKE_POOL_PROGRAM_ID;
102
102
  var init_programs = __esm({
103
103
  "src/constants/programs.ts"() {
104
104
  "use strict";
@@ -114,6 +114,7 @@ var init_programs = __esm({
114
114
  SYSVAR_CLOCK_ID = new import_web34.PublicKey("SysvarC1ock11111111111111111111111111111111");
115
115
  SYSVAR_STAKE_HISTORY_ID = new import_web34.PublicKey("SysvarStakeHistory1111111111111111111111111");
116
116
  STAKE_CONFIG_ID = new import_web34.PublicKey("StakeConfig11111111111111111111111111111111");
117
+ FOGO_STAKE_POOL_PROGRAM_ID = new import_web34.PublicKey("SP1s4uFeTAX9jsXXmwyDs1gxYYf7cdDZ8qHUHVxE1yr");
117
118
  }
118
119
  });
119
120
 
@@ -174,7 +175,7 @@ __export(single_spl_pool_exports, {
174
175
  });
175
176
  async function initializeStakedPoolTx(connection, payer, voteAccountAddress) {
176
177
  const instructions2 = await initializeStakedPoolIxs(connection, payer, voteAccountAddress);
177
- const tx = new import_web311.Transaction().add(...instructions2);
178
+ const tx = new import_web312.Transaction().add(...instructions2);
178
179
  return tx;
179
180
  }
180
181
  async function initializeStakedPoolIxs(connection, payer, voteAccountAddress) {
@@ -190,27 +191,27 @@ async function initializeStakedPoolIxs(connection, payer, voteAccountAddress) {
190
191
  ]);
191
192
  const minimumDelegation = minimumDelegationObj.value;
192
193
  const instructions2 = [];
193
- instructions2.push(import_web311.SystemProgram.transfer({ fromPubkey: payer, toPubkey: poolAddress, lamports: poolRent }));
194
+ instructions2.push(import_web312.SystemProgram.transfer({ fromPubkey: payer, toPubkey: poolAddress, lamports: poolRent }));
194
195
  instructions2.push(
195
- import_web311.SystemProgram.transfer({
196
+ import_web312.SystemProgram.transfer({
196
197
  fromPubkey: payer,
197
198
  toPubkey: stakeAddress,
198
- lamports: stakeRent + minimumDelegation + import_web311.LAMPORTS_PER_SOL * 1
199
+ lamports: stakeRent + minimumDelegation + import_web312.LAMPORTS_PER_SOL * 1
199
200
  })
200
201
  );
201
- instructions2.push(import_web311.SystemProgram.transfer({ fromPubkey: payer, toPubkey: onRampAddress, lamports: stakeRent }));
202
- instructions2.push(import_web311.SystemProgram.transfer({ fromPubkey: payer, toPubkey: mintAddress, lamports: mintRent }));
202
+ instructions2.push(import_web312.SystemProgram.transfer({ fromPubkey: payer, toPubkey: onRampAddress, lamports: stakeRent }));
203
+ instructions2.push(import_web312.SystemProgram.transfer({ fromPubkey: payer, toPubkey: mintAddress, lamports: mintRent }));
203
204
  instructions2.push(SinglePoolInstruction.initializePool(voteAccountAddress));
204
205
  instructions2.push(SinglePoolInstruction.initializeOnRamp(poolAddress));
205
206
  instructions2.push(await SinglePoolInstruction.createTokenMetadata(poolAddress, payer));
206
207
  return instructions2;
207
208
  }
208
- var import_spl_token3, import_web311, import_bn4, SinglePoolInstruction, createTransactionInstruction, findPda, findPoolMintAddressByVoteAccount, findPoolAddress, findPoolMintAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findMplMetadataAddress, SINGLE_POOL_ACCOUNT_SIZE, STAKE_ACCOUNT_SIZE, MINT_SIZE, createAccountIx, createPoolOnrampIx, replenishPoolIx;
209
+ var import_spl_token3, import_web312, import_bn4, SinglePoolInstruction, createTransactionInstruction, findPda, findPoolMintAddressByVoteAccount, findPoolAddress, findPoolMintAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findMplMetadataAddress, SINGLE_POOL_ACCOUNT_SIZE, STAKE_ACCOUNT_SIZE, MINT_SIZE, createAccountIx, createPoolOnrampIx, replenishPoolIx;
209
210
  var init_single_spl_pool = __esm({
210
211
  "src/vendor/single-spl-pool/index.ts"() {
211
212
  "use strict";
212
213
  import_spl_token3 = require("@solana/spl-token");
213
- import_web311 = require("@solana/web3.js");
214
+ import_web312 = require("@solana/web3.js");
214
215
  import_bn4 = require("bn.js");
215
216
  init_constants();
216
217
  SinglePoolInstruction = {
@@ -232,7 +233,7 @@ var init_single_spl_pool = __esm({
232
233
  { pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
233
234
  { pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
234
235
  { pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
235
- { pubkey: import_web311.STAKE_CONFIG_ID, isSigner: false, isWritable: false },
236
+ { pubkey: import_web312.STAKE_CONFIG_ID, isSigner: false, isWritable: false },
236
237
  { pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
237
238
  { pubkey: import_spl_token3.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
238
239
  { pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
@@ -374,7 +375,7 @@ var init_single_spl_pool = __esm({
374
375
  };
375
376
  };
376
377
  findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
377
- const [pda] = import_web311.PublicKey.findProgramAddressSync([Buffer.from(prefix), baseAddress.toBuffer()], programId);
378
+ const [pda] = import_web312.PublicKey.findProgramAddressSync([Buffer.from(prefix), baseAddress.toBuffer()], programId);
378
379
  return pda;
379
380
  };
380
381
  findPoolMintAddressByVoteAccount = (voteAccountAddress) => findPda(findPoolAddress(voteAccountAddress), "mint");
@@ -386,7 +387,7 @@ var init_single_spl_pool = __esm({
386
387
  findPoolMplAuthorityAddress = (poolAddress) => findPda(poolAddress, "mpl_authority");
387
388
  findPoolOnRampAddress = (poolAddress) => findPda(poolAddress, "onramp");
388
389
  findMplMetadataAddress = async (poolMintAddress) => {
389
- const [pda] = import_web311.PublicKey.findProgramAddressSync(
390
+ const [pda] = import_web312.PublicKey.findProgramAddressSync(
390
391
  [Buffer.from("metadata"), MPL_METADATA_PROGRAM_ID.toBuffer(), poolMintAddress.toBuffer()],
391
392
  MPL_METADATA_PROGRAM_ID
392
393
  );
@@ -417,12 +418,12 @@ var init_single_spl_pool = __esm({
417
418
  { pubkey: poolAccount, isSigner: false, isWritable: false },
418
419
  { pubkey: onRampAccount, isSigner: false, isWritable: true },
419
420
  { pubkey: poolStakeAuthority, isSigner: false, isWritable: false },
420
- { pubkey: import_web311.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
421
- { pubkey: import_web311.SystemProgram.programId, isSigner: false, isWritable: false },
422
- { pubkey: import_web311.StakeProgram.programId, isSigner: false, isWritable: false }
421
+ { pubkey: import_web312.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
422
+ { pubkey: import_web312.SystemProgram.programId, isSigner: false, isWritable: false },
423
+ { pubkey: import_web312.StakeProgram.programId, isSigner: false, isWritable: false }
423
424
  ];
424
425
  const data = Buffer.from(Uint8Array.of(6));
425
- return new import_web311.TransactionInstruction({
426
+ return new import_web312.TransactionInstruction({
426
427
  keys,
427
428
  programId: SINGLE_POOL_PROGRAM_ID,
428
429
  data
@@ -439,10 +440,10 @@ var init_single_spl_pool = __esm({
439
440
  { pubkey: stakePool, isSigner: false, isWritable: true },
440
441
  { pubkey: onRampPool, isSigner: false, isWritable: true },
441
442
  { pubkey: authority, isSigner: false, isWritable: false },
442
- { pubkey: import_web311.SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },
443
+ { pubkey: import_web312.SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },
443
444
  { pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
444
- { pubkey: import_web311.STAKE_CONFIG_ID, isSigner: false, isWritable: false },
445
- { pubkey: import_web311.StakeProgram.programId, isSigner: false, isWritable: false }
445
+ { pubkey: import_web312.STAKE_CONFIG_ID, isSigner: false, isWritable: false },
446
+ { pubkey: import_web312.StakeProgram.programId, isSigner: false, isWritable: false }
446
447
  ];
447
448
  const data = Buffer.from(Uint8Array.of(1));
448
449
  return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, keys, data);
@@ -480,6 +481,7 @@ __export(index_exports, {
480
481
  EmodeSettings: () => EmodeSettings,
481
482
  EmodeTag: () => EmodeTag,
482
483
  FLASHLOAN_ENABLED_FLAG: () => FLASHLOAN_ENABLED_FLAG,
484
+ FOGO_STAKE_POOL_PROGRAM_ID: () => FOGO_STAKE_POOL_PROGRAM_ID,
483
485
  FogoMetadataFetcher: () => FogoMetadataFetcher,
484
486
  GROUP_PK: () => GROUP_PK,
485
487
  HOURS_PER_YEAR: () => HOURS_PER_YEAR,
@@ -616,6 +618,7 @@ __export(index_exports, {
616
618
  getBankVaultSeeds: () => getBankVaultSeeds,
617
619
  getConfig: () => getConfig,
618
620
  getConfigPda: () => getConfigPda,
621
+ getFogoStakePoolAddress: () => getFogoStakePoolAddress,
619
622
  getHealthCacheStatusDescription: () => getHealthCacheStatusDescription,
620
623
  getLiabilityQuantity: () => getLiabilityQuantity,
621
624
  getLiabilityShares: () => getLiabilityShares,
@@ -682,7 +685,7 @@ module.exports = __toCommonJS(index_exports);
682
685
  // src/clients/client.ts
683
686
  var import_anchor10 = require("@coral-xyz/anchor");
684
687
  var import_spl_token8 = require("@solana/spl-token");
685
- var import_web331 = require("@solana/web3.js");
688
+ var import_web332 = require("@solana/web3.js");
686
689
  var import_bignumber16 = __toESM(require("bignumber.js"), 1);
687
690
  var import_bs582 = __toESM(require("bs58"), 1);
688
691
  var import_unstorage2 = require("unstorage");
@@ -1481,12 +1484,12 @@ var import_anchor2 = require("@coral-xyz/anchor");
1481
1484
  var import_spl_token = require("@solana/spl-token");
1482
1485
  init_constants();
1483
1486
 
1484
- // src/idl/lendr_0.1.6.json
1485
- var lendr_0_1_6_default = {
1486
- address: "F2FCeMczUSvVFnMes8KFumrvwhq1p8czScsQzAWnm7GF",
1487
+ // src/idl/lendr_0.1.7.json
1488
+ var lendr_0_1_7_default = {
1489
+ address: "",
1487
1490
  metadata: {
1488
1491
  name: "lendr",
1489
- version: "0.1.6",
1492
+ version: "0.1.7",
1490
1493
  spec: "0.1.0",
1491
1494
  description: "Borrow Lending Prime Broker"
1492
1495
  },
@@ -4345,6 +4348,208 @@ var lendr_0_1_6_default = {
4345
4348
  }
4346
4349
  ]
4347
4350
  },
4351
+ {
4352
+ name: "lending_pool_add_bank_permissionless_fogo_stake_pool",
4353
+ docs: [
4354
+ "Permissionlessly add a bank for Fogo Stake Pool LST tokens.",
4355
+ "Similar to lending_pool_add_bank_permissionless but for fogo-stake-pool program LSTs."
4356
+ ],
4357
+ discriminator: [70, 105, 223, 175, 19, 138, 253, 208],
4358
+ accounts: [
4359
+ {
4360
+ name: "lendr_group",
4361
+ writable: true,
4362
+ relations: ["staked_settings"]
4363
+ },
4364
+ {
4365
+ name: "staked_settings"
4366
+ },
4367
+ {
4368
+ name: "fee_payer",
4369
+ writable: true,
4370
+ signer: true
4371
+ },
4372
+ {
4373
+ name: "fee_state",
4374
+ pda: {
4375
+ seeds: [
4376
+ {
4377
+ kind: "const",
4378
+ value: [102, 101, 101, 115, 116, 97, 116, 101]
4379
+ }
4380
+ ]
4381
+ }
4382
+ },
4383
+ {
4384
+ name: "global_fee_wallet",
4385
+ writable: true,
4386
+ relations: ["fee_state"]
4387
+ },
4388
+ {
4389
+ name: "bank_mint",
4390
+ docs: [
4391
+ "Mint of the Fogo Stake Pool LST",
4392
+ "NOTE: Unlike single-pool, this mint is NOT a PDA. Validation happens by",
4393
+ "checking that stake_pool.pool_mint == bank_mint.key()"
4394
+ ]
4395
+ },
4396
+ {
4397
+ name: "stake_pool",
4398
+ docs: [
4399
+ "1. Owner must be FOGO_STAKE_POOL_ID",
4400
+ "2. Deserialized state.pool_mint must match bank_mint",
4401
+ "3. Account type must be StakePool (value 1, not 0=Uninitialized or 2=ValidatorList)"
4402
+ ]
4403
+ },
4404
+ {
4405
+ name: "bank",
4406
+ writable: true,
4407
+ pda: {
4408
+ seeds: [
4409
+ {
4410
+ kind: "account",
4411
+ path: "lendr_group"
4412
+ },
4413
+ {
4414
+ kind: "account",
4415
+ path: "bank_mint"
4416
+ },
4417
+ {
4418
+ kind: "arg",
4419
+ path: "bank_seed"
4420
+ }
4421
+ ]
4422
+ }
4423
+ },
4424
+ {
4425
+ name: "liquidity_vault_authority",
4426
+ pda: {
4427
+ seeds: [
4428
+ {
4429
+ kind: "const",
4430
+ value: [
4431
+ 108,
4432
+ 105,
4433
+ 113,
4434
+ 117,
4435
+ 105,
4436
+ 100,
4437
+ 105,
4438
+ 116,
4439
+ 121,
4440
+ 95,
4441
+ 118,
4442
+ 97,
4443
+ 117,
4444
+ 108,
4445
+ 116,
4446
+ 95,
4447
+ 97,
4448
+ 117,
4449
+ 116,
4450
+ 104
4451
+ ]
4452
+ },
4453
+ {
4454
+ kind: "account",
4455
+ path: "bank"
4456
+ }
4457
+ ]
4458
+ }
4459
+ },
4460
+ {
4461
+ name: "liquidity_vault",
4462
+ writable: true,
4463
+ pda: {
4464
+ seeds: [
4465
+ {
4466
+ kind: "const",
4467
+ value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116]
4468
+ },
4469
+ {
4470
+ kind: "account",
4471
+ path: "bank"
4472
+ }
4473
+ ]
4474
+ }
4475
+ },
4476
+ {
4477
+ name: "insurance_vault_authority",
4478
+ pda: {
4479
+ seeds: [
4480
+ {
4481
+ kind: "const",
4482
+ value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116, 95, 97, 117, 116, 104]
4483
+ },
4484
+ {
4485
+ kind: "account",
4486
+ path: "bank"
4487
+ }
4488
+ ]
4489
+ }
4490
+ },
4491
+ {
4492
+ name: "insurance_vault",
4493
+ writable: true,
4494
+ pda: {
4495
+ seeds: [
4496
+ {
4497
+ kind: "const",
4498
+ value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116]
4499
+ },
4500
+ {
4501
+ kind: "account",
4502
+ path: "bank"
4503
+ }
4504
+ ]
4505
+ }
4506
+ },
4507
+ {
4508
+ name: "fee_vault_authority",
4509
+ pda: {
4510
+ seeds: [
4511
+ {
4512
+ kind: "const",
4513
+ value: [102, 101, 101, 95, 118, 97, 117, 108, 116, 95, 97, 117, 116, 104]
4514
+ },
4515
+ {
4516
+ kind: "account",
4517
+ path: "bank"
4518
+ }
4519
+ ]
4520
+ }
4521
+ },
4522
+ {
4523
+ name: "fee_vault",
4524
+ writable: true,
4525
+ pda: {
4526
+ seeds: [
4527
+ {
4528
+ kind: "const",
4529
+ value: [102, 101, 101, 95, 118, 97, 117, 108, 116]
4530
+ },
4531
+ {
4532
+ kind: "account",
4533
+ path: "bank"
4534
+ }
4535
+ ]
4536
+ }
4537
+ },
4538
+ {
4539
+ name: "token_program"
4540
+ },
4541
+ {
4542
+ name: "system_program",
4543
+ address: "11111111111111111111111111111111"
4544
+ }
4545
+ ],
4546
+ args: [
4547
+ {
4548
+ name: "bank_seed",
4549
+ type: "u64"
4550
+ }
4551
+ ]
4552
+ },
4348
4553
  {
4349
4554
  name: "lending_pool_add_bank_with_seed",
4350
4555
  docs: [
@@ -10611,6 +10816,9 @@ var lendr_0_1_6_default = {
10611
10816
  },
10612
10817
  {
10613
10818
  name: "Fixed"
10819
+ },
10820
+ {
10821
+ name: "FogoStakePoolWithPythPush"
10614
10822
  }
10615
10823
  ]
10616
10824
  }
@@ -11006,7 +11214,7 @@ var lendr_0_1_6_default = {
11006
11214
  };
11007
11215
 
11008
11216
  // src/idl/index.ts
11009
- var LENDR_IDL = lendr_0_1_6_default;
11217
+ var LENDR_IDL = lendr_0_1_7_default;
11010
11218
 
11011
11219
  // src/errors.ts
11012
11220
  var ProcessTransactionErrorType = /* @__PURE__ */ ((ProcessTransactionErrorType2) => {
@@ -11366,6 +11574,23 @@ async function makePoolAddPermissionlessStakedBankIx(ldProgram, accounts, remain
11366
11574
  tokenProgram
11367
11575
  }).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
11368
11576
  }
11577
+ async function makePoolAddPermissionlessFogoStakePoolBankIx(ldProgram, accounts, remainingAccounts, args) {
11578
+ const {
11579
+ stakedSettings,
11580
+ feePayer,
11581
+ bankMint,
11582
+ stakePool,
11583
+ tokenProgram = import_spl_token2.TOKEN_PROGRAM_ID,
11584
+ ...optionalAccounts
11585
+ } = accounts;
11586
+ return ldProgram.methods.lendingPoolAddBankPermissionlessFogoStakePool(args.seed ?? new import_bn2.default(0)).accounts({
11587
+ stakedSettings,
11588
+ feePayer,
11589
+ bankMint,
11590
+ stakePool,
11591
+ tokenProgram
11592
+ }).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
11593
+ }
11369
11594
  async function makePoolAddBankIx(ldProgram, accounts, args) {
11370
11595
  const { lendrGroup, feePayer, bankMint, bank, tokenProgram, ...optionalAccounts } = accounts;
11371
11596
  return ldProgram.methods.lendingPoolAddBank({
@@ -11422,6 +11647,7 @@ var instructions = {
11422
11647
  makeGroupInitIx,
11423
11648
  makeCloseAccountIx,
11424
11649
  makePoolAddPermissionlessStakedBankIx,
11650
+ makePoolAddPermissionlessFogoStakePoolBankIx,
11425
11651
  makeLendingPoolConfigureBankOracleIx,
11426
11652
  makePulseHealthIx,
11427
11653
  makeLendingAccountSettleEmissionsIx,
@@ -11433,12 +11659,12 @@ var instructions_default = instructions;
11433
11659
  var import_anchor7 = require("@coral-xyz/anchor");
11434
11660
  var import_sessions_sdk = require("@fogo/sessions-sdk");
11435
11661
  var import_spl_token6 = require("@solana/spl-token");
11436
- var import_web329 = require("@solana/web3.js");
11662
+ var import_web330 = require("@solana/web3.js");
11437
11663
  var import_bignumber14 = __toESM(require("bignumber.js"), 1);
11438
11664
  var import_bn13 = __toESM(require("bn.js"), 1);
11439
11665
 
11440
11666
  // src/services/account/account.service.ts
11441
- var import_web324 = require("@solana/web3.js");
11667
+ var import_web325 = require("@solana/web3.js");
11442
11668
  var import_bignumber12 = __toESM(require("bignumber.js"), 1);
11443
11669
  var import_bn11 = __toESM(require("bn.js"), 1);
11444
11670
 
@@ -11492,12 +11718,12 @@ var HealthCache = class _HealthCache {
11492
11718
 
11493
11719
  // src/services/bank/bank.service.ts
11494
11720
  var import_anchor5 = require("@coral-xyz/anchor");
11495
- var import_web318 = require("@solana/web3.js");
11721
+ var import_web319 = require("@solana/web3.js");
11496
11722
  init_constants();
11497
11723
 
11498
11724
  // src/utils.ts
11499
11725
  var import_spl_token4 = require("@solana/spl-token");
11500
- var import_web313 = require("@solana/web3.js");
11726
+ var import_web314 = require("@solana/web3.js");
11501
11727
  init_constants();
11502
11728
 
11503
11729
  // src/services/bank/types/bank.types.ts
@@ -11513,17 +11739,18 @@ var OperationalState = /* @__PURE__ */ ((OperationalState2) => {
11513
11739
  OperationalState2["KilledByBankruptcy"] = "KilledByBankruptcy";
11514
11740
  return OperationalState2;
11515
11741
  })(OperationalState || {});
11516
- var OracleSetup = /* @__PURE__ */ ((OracleSetup2) => {
11517
- OracleSetup2["None"] = "None";
11518
- OracleSetup2["PythLegacy"] = "PythLegacy";
11519
- OracleSetup2["SwitchboardV2"] = "SwitchboardV2";
11520
- OracleSetup2["PythPushOracle"] = "PythPushOracle";
11521
- OracleSetup2["SwitchboardPull"] = "SwitchboardPull";
11522
- OracleSetup2["StakedWithPythPush"] = "StakedWithPythPush";
11523
- OracleSetup2["KaminoPythPush"] = "KaminoPythPush";
11524
- OracleSetup2["KaminoSwitchboardPull"] = "KaminoSwitchboardPull";
11525
- OracleSetup2["Fixed"] = "Fixed";
11526
- return OracleSetup2;
11742
+ var OracleSetup = /* @__PURE__ */ ((OracleSetup3) => {
11743
+ OracleSetup3["None"] = "None";
11744
+ OracleSetup3["PythLegacy"] = "PythLegacy";
11745
+ OracleSetup3["SwitchboardV2"] = "SwitchboardV2";
11746
+ OracleSetup3["PythPushOracle"] = "PythPushOracle";
11747
+ OracleSetup3["SwitchboardPull"] = "SwitchboardPull";
11748
+ OracleSetup3["StakedWithPythPush"] = "StakedWithPythPush";
11749
+ OracleSetup3["KaminoPythPush"] = "KaminoPythPush";
11750
+ OracleSetup3["KaminoSwitchboardPull"] = "KaminoSwitchboardPull";
11751
+ OracleSetup3["Fixed"] = "Fixed";
11752
+ OracleSetup3["FogoStakePoolWithPythPush"] = "FogoStakePoolWithPythPush";
11753
+ return OracleSetup3;
11527
11754
  })(OracleSetup || {});
11528
11755
  var AssetTag = /* @__PURE__ */ ((AssetTag2) => {
11529
11756
  AssetTag2[AssetTag2["DEFAULT"] = 0] = "DEFAULT";
@@ -11954,6 +12181,8 @@ function parseOracleSetup(oracleSetupRaw) {
11954
12181
  return "KaminoSwitchboardPull" /* KaminoSwitchboardPull */;
11955
12182
  case "fixed":
11956
12183
  return "Fixed" /* Fixed */;
12184
+ case "fogostakepoolwithpythpush":
12185
+ return "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */;
11957
12186
  default:
11958
12187
  return "None" /* None */;
11959
12188
  }
@@ -12007,10 +12236,13 @@ __export(vendor_exports, {
12007
12236
  AggregatorAccountData: () => AggregatorAccountData,
12008
12237
  CorpAction: () => CorpAction,
12009
12238
  MAX_SLOT_DIFFERENCE: () => MAX_SLOT_DIFFERENCE,
12239
+ MAX_STAKE_POOL_SIZE: () => MAX_STAKE_POOL_SIZE,
12240
+ MIN_STAKE_POOL_SIZE: () => MIN_STAKE_POOL_SIZE,
12010
12241
  PriceStatus: () => PriceStatus,
12011
12242
  PriceType: () => PriceType,
12012
12243
  SWITCHBOARD_ONDEMANDE_PRICE_PRECISION: () => SWITCHBOARD_ONDEMANDE_PRICE_PRECISION,
12013
12244
  SinglePoolInstruction: () => SinglePoolInstruction,
12245
+ calculateFogoExchangeRate: () => calculateFogoExchangeRate,
12014
12246
  createAccountIx: () => createAccountIx,
12015
12247
  createPoolOnrampIx: () => createPoolOnrampIx,
12016
12248
  decodeSwitchboardPullFeedData: () => decodeSwitchboardPullFeedData,
@@ -12027,14 +12259,69 @@ __export(vendor_exports, {
12027
12259
  getSwitchboardProgram: () => getSwitchboardProgram,
12028
12260
  initializeStakedPoolIxs: () => initializeStakedPoolIxs,
12029
12261
  initializeStakedPoolTx: () => initializeStakedPoolTx,
12262
+ parseFogoStakePool: () => parseFogoStakePool,
12030
12263
  parsePriceData: () => parsePriceData,
12031
12264
  parsePriceInfo: () => parsePriceInfo2,
12032
12265
  replenishPoolIx: () => replenishPoolIx,
12033
- switchboardAccountCoder: () => switchboardAccountCoder
12266
+ switchboardAccountCoder: () => switchboardAccountCoder,
12267
+ validateFogoStakePool: () => validateFogoStakePool
12034
12268
  });
12035
12269
 
12036
- // src/vendor/pyth_legacy/index.ts
12270
+ // src/vendor/fogo_stake_pool/index.ts
12037
12271
  var import_web39 = require("@solana/web3.js");
12272
+ var ACCOUNT_TYPE_OFFSET = 0;
12273
+ var TOTAL_LAMPORTS_OFFSET = 258;
12274
+ var POOL_TOKEN_SUPPLY_OFFSET = 266;
12275
+ var LAST_UPDATE_EPOCH_OFFSET = 274;
12276
+ var POOL_MINT_OFFSET = 194;
12277
+ var STAKE_POOL_ACCOUNT_TYPE = 1;
12278
+ var MIN_STAKE_POOL_SIZE = 539;
12279
+ var MAX_STAKE_POOL_SIZE = 700;
12280
+ function parseFogoStakePool(data) {
12281
+ if (data.length < MIN_STAKE_POOL_SIZE) {
12282
+ throw new Error(`Fogo StakePool account too small: ${data.length} < ${MIN_STAKE_POOL_SIZE}`);
12283
+ }
12284
+ if (data.length > MAX_STAKE_POOL_SIZE) {
12285
+ throw new Error(`Fogo StakePool account too large: ${data.length} > ${MAX_STAKE_POOL_SIZE}`);
12286
+ }
12287
+ const accountType = data.readUInt8(ACCOUNT_TYPE_OFFSET);
12288
+ if (accountType !== STAKE_POOL_ACCOUNT_TYPE) {
12289
+ throw new Error(`Invalid Fogo StakePool account type: ${accountType}, expected ${STAKE_POOL_ACCOUNT_TYPE}`);
12290
+ }
12291
+ const poolMint = new import_web39.PublicKey(data.subarray(POOL_MINT_OFFSET, POOL_MINT_OFFSET + 32));
12292
+ const totalLamports = data.readBigUInt64LE(TOTAL_LAMPORTS_OFFSET);
12293
+ const poolTokenSupply = data.readBigUInt64LE(POOL_TOKEN_SUPPLY_OFFSET);
12294
+ const lastUpdateEpoch = data.readBigUInt64LE(LAST_UPDATE_EPOCH_OFFSET);
12295
+ return {
12296
+ accountType,
12297
+ poolMint,
12298
+ totalLamports,
12299
+ poolTokenSupply,
12300
+ lastUpdateEpoch
12301
+ };
12302
+ }
12303
+ function calculateFogoExchangeRate(stakePool) {
12304
+ if (stakePool.poolTokenSupply === 0n) {
12305
+ return 1;
12306
+ }
12307
+ return Number(stakePool.totalLamports) / Number(stakePool.poolTokenSupply);
12308
+ }
12309
+ function validateFogoStakePool(stakePool) {
12310
+ if (stakePool.poolTokenSupply === 0n || stakePool.totalLamports === 0n) {
12311
+ return false;
12312
+ }
12313
+ if (stakePool.totalLamports < stakePool.poolTokenSupply) {
12314
+ return false;
12315
+ }
12316
+ const rateScaled = stakePool.totalLamports * 1000000n / stakePool.poolTokenSupply;
12317
+ if (rateScaled > 3000000n) {
12318
+ return false;
12319
+ }
12320
+ return true;
12321
+ }
12322
+
12323
+ // src/vendor/pyth_legacy/index.ts
12324
+ var import_web310 = require("@solana/web3.js");
12038
12325
 
12039
12326
  // src/vendor/pyth_legacy/readBig.ts
12040
12327
  var ERR_BUFFER_OUT_OF_BOUNDS = () => new Error("Attempt to access memory outside buffer bounds");
@@ -12073,7 +12360,7 @@ function readBigUInt64LE(buffer, offset = 0) {
12073
12360
  // src/vendor/pyth_legacy/index.ts
12074
12361
  var MAX_SLOT_DIFFERENCE = 25;
12075
12362
  var empty32Buffer = Buffer.alloc(32);
12076
- var PKorNull = (data) => data.equals(empty32Buffer) ? null : new import_web39.PublicKey(data);
12363
+ var PKorNull = (data) => data.equals(empty32Buffer) ? null : new import_web310.PublicKey(data);
12077
12364
  var PriceStatus = /* @__PURE__ */ ((PriceStatus2) => {
12078
12365
  PriceStatus2[PriceStatus2["Unknown"] = 0] = "Unknown";
12079
12366
  PriceStatus2[PriceStatus2["Trading"] = 1] = "Trading";
@@ -12136,7 +12423,7 @@ var parsePriceData = (data, currentSlot) => {
12136
12423
  const drv2 = data.readInt8(105);
12137
12424
  const drv3 = data.readInt16LE(106);
12138
12425
  const drv4 = data.readInt32LE(108);
12139
- const productAccountKey = new import_web39.PublicKey(data.slice(112, 144));
12426
+ const productAccountKey = new import_web310.PublicKey(data.slice(112, 144));
12140
12427
  const nextPriceAccountKey = PKorNull(data.slice(144, 176));
12141
12428
  const previousSlot = readBigUInt64LE(data, 176);
12142
12429
  const previousPriceComponent = readBigInt64LE(data, 184);
@@ -12160,7 +12447,7 @@ var parsePriceData = (data, currentSlot) => {
12160
12447
  const priceComponents = [];
12161
12448
  let offset = 240;
12162
12449
  while (priceComponents.length < numComponentPrices) {
12163
- const publisher = new import_web39.PublicKey(data.slice(offset, offset + 32));
12450
+ const publisher = new import_web310.PublicKey(data.slice(offset, offset + 32));
12164
12451
  offset += 32;
12165
12452
  const componentAggregate = parsePriceInfo(data.slice(offset, offset + 32), exponent);
12166
12453
  offset += 32;
@@ -12239,24 +12526,24 @@ var parsePriceInfo2 = (data) => {
12239
12526
  };
12240
12527
 
12241
12528
  // src/vendor/rpc-get-stake/index.ts
12242
- var import_web310 = require("@solana/web3.js");
12529
+ var import_web311 = require("@solana/web3.js");
12243
12530
  var getStakeAccount = (data) => {
12244
12531
  let offset = 0;
12245
12532
  const discriminant = data.readBigUInt64LE(offset);
12246
12533
  offset += 4;
12247
12534
  const rentExemptReserve = data.readBigUInt64LE(offset);
12248
12535
  offset += 8;
12249
- const staker = new import_web310.PublicKey(data.subarray(offset, offset + 32));
12536
+ const staker = new import_web311.PublicKey(data.subarray(offset, offset + 32));
12250
12537
  offset += 32;
12251
- const withdrawer = new import_web310.PublicKey(data.subarray(offset, offset + 32));
12538
+ const withdrawer = new import_web311.PublicKey(data.subarray(offset, offset + 32));
12252
12539
  offset += 32;
12253
12540
  const unixTimestamp = data.readBigUInt64LE(offset);
12254
12541
  offset += 8;
12255
12542
  const epoch = data.readBigUInt64LE(offset);
12256
12543
  offset += 8;
12257
- const custodian = new import_web310.PublicKey(data.subarray(offset, offset + 32));
12544
+ const custodian = new import_web311.PublicKey(data.subarray(offset, offset + 32));
12258
12545
  offset += 32;
12259
- const voterPubkey = new import_web310.PublicKey(data.subarray(offset, offset + 32));
12546
+ const voterPubkey = new import_web311.PublicKey(data.subarray(offset, offset + 32));
12260
12547
  offset += 32;
12261
12548
  const stake = data.readBigUInt64LE(offset);
12262
12549
  offset += 8;
@@ -12391,7 +12678,7 @@ function layout(property) {
12391
12678
 
12392
12679
  // src/vendor/switchboard_legacy/aggregatorRound.ts
12393
12680
  var borsh4 = __toESM(require("@coral-xyz/borsh"), 1);
12394
- var import_web312 = require("@solana/web3.js");
12681
+ var import_web313 = require("@solana/web3.js");
12395
12682
  var import_bn6 = __toESM(require("bn.js"), 1);
12396
12683
 
12397
12684
  // src/vendor/switchboard_legacy/switchboardDecimal.ts
@@ -12652,7 +12939,7 @@ var AggregatorRound = class _AggregatorRound {
12652
12939
  stdDeviation: SwitchboardDecimal.fromJSON(obj.stdDeviation),
12653
12940
  minResponse: SwitchboardDecimal.fromJSON(obj.minResponse),
12654
12941
  maxResponse: SwitchboardDecimal.fromJSON(obj.maxResponse),
12655
- oraclePubkeysData: obj.oraclePubkeysData.map((item) => new import_web312.PublicKey(item)),
12942
+ oraclePubkeysData: obj.oraclePubkeysData.map((item) => new import_web313.PublicKey(item)),
12656
12943
  mediansData: obj.mediansData.map(
12657
12944
  (item) => SwitchboardDecimal.fromJSON(item)
12658
12945
  ),
@@ -16766,7 +17053,7 @@ function getBankVaultAuthoritySeeds(type) {
16766
17053
  }
16767
17054
  }
16768
17055
  function getBankVaultAuthority(bankVaultType, bankPk, programId) {
16769
- return import_web313.PublicKey.findProgramAddressSync([getBankVaultAuthoritySeeds(bankVaultType), bankPk.toBuffer()], programId);
17056
+ return import_web314.PublicKey.findProgramAddressSync([getBankVaultAuthoritySeeds(bankVaultType), bankPk.toBuffer()], programId);
16770
17057
  }
16771
17058
  function makeWrapSolIxs(walletAddress, amount) {
16772
17059
  const address = (0, import_spl_token4.getAssociatedTokenAddressSync)(import_spl_token4.NATIVE_MINT, walletAddress, true);
@@ -16774,7 +17061,7 @@ function makeWrapSolIxs(walletAddress, amount) {
16774
17061
  if (amount.gt(0)) {
16775
17062
  const nativeAmount = uiToNative(amount, 9).toNumber() + 1e4;
16776
17063
  ixs.push(
16777
- import_web313.SystemProgram.transfer({ fromPubkey: walletAddress, toPubkey: address, lamports: nativeAmount }),
17064
+ import_web314.SystemProgram.transfer({ fromPubkey: walletAddress, toPubkey: address, lamports: nativeAmount }),
16778
17065
  (0, import_spl_token4.createSyncNativeInstruction)(address)
16779
17066
  );
16780
17067
  }
@@ -16785,16 +17072,16 @@ function makeUnwrapSolIx(walletAddress) {
16785
17072
  return (0, import_spl_token4.createCloseAccountInstruction)(address, walletAddress, walletAddress);
16786
17073
  }
16787
17074
  async function makeVersionedTransaction(blockhash, transaction, payer, addressLookupTables) {
16788
- const message = new import_web313.TransactionMessage({
17075
+ const message = new import_web314.TransactionMessage({
16789
17076
  instructions: transaction.instructions,
16790
17077
  payerKey: payer,
16791
17078
  recentBlockhash: blockhash
16792
17079
  });
16793
17080
  const versionedMessage = addressLookupTables ? message.compileToV0Message(addressLookupTables) : message.compileToLegacyMessage();
16794
- return new import_web313.VersionedTransaction(versionedMessage);
17081
+ return new import_web314.VersionedTransaction(versionedMessage);
16795
17082
  }
16796
17083
  function makePriorityFeeMicroIx(priorityFeeMicro) {
16797
- return import_web313.ComputeBudgetProgram.setComputeUnitPrice({
17084
+ return import_web314.ComputeBudgetProgram.setComputeUnitPrice({
16798
17085
  microLamports: Math.floor(priorityFeeMicro ?? 1)
16799
17086
  });
16800
17087
  }
@@ -16805,12 +17092,12 @@ function makePriorityFeeIx(priorityFeeUi, computeUnitsLimit) {
16805
17092
  if (priorityFeeUi) {
16806
17093
  const isAbsurdPriorityFee = priorityFeeUi > 0.1;
16807
17094
  if (!isAbsurdPriorityFee) {
16808
- const priorityFeeMicroLamports = priorityFeeUi * import_web313.LAMPORTS_PER_SOL * 1e6;
17095
+ const priorityFeeMicroLamports = priorityFeeUi * import_web314.LAMPORTS_PER_SOL * 1e6;
16809
17096
  microLamports = Math.round(priorityFeeMicroLamports / limit);
16810
17097
  }
16811
17098
  }
16812
17099
  priorityFeeIx.push(
16813
- import_web313.ComputeBudgetProgram.setComputeUnitPrice({
17100
+ import_web314.ComputeBudgetProgram.setComputeUnitPrice({
16814
17101
  microLamports
16815
17102
  })
16816
17103
  );
@@ -16823,7 +17110,7 @@ async function buildFeedIdMap(bankConfigs, connection) {
16823
17110
  const feedIdMap = /* @__PURE__ */ new Map();
16824
17111
  const feedIdsWithAddresses = bankConfigs.filter((bankConfig) => {
16825
17112
  const oracleSetup = parseOracleSetup(bankConfig.oracleSetup);
16826
- return oracleSetup === "PythPushOracle" /* PythPushOracle */ || oracleSetup === "KaminoPythPush" /* KaminoPythPush */;
17113
+ return oracleSetup === "PythPushOracle" /* PythPushOracle */ || oracleSetup === "KaminoPythPush" /* KaminoPythPush */ || oracleSetup === "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */;
16827
17114
  }).map((bankConfig) => {
16828
17115
  const oracleKey = bankConfig.oracleKeys[0];
16829
17116
  const feedId = oracleKey.toBuffer();
@@ -16882,6 +17169,16 @@ async function buildFeedIdMap(bankConfigs, connection) {
16882
17169
  }
16883
17170
  return feedIdMap;
16884
17171
  }
17172
+ function getFogoStakePoolAddress(bankConfig) {
17173
+ if (bankConfig.oracleSetup !== "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */) {
17174
+ return null;
17175
+ }
17176
+ const stakePoolAddress = bankConfig.oracleKeys[1];
17177
+ if (!stakePoolAddress || stakePoolAddress.equals(import_web314.PublicKey.default)) {
17178
+ return null;
17179
+ }
17180
+ return stakePoolAddress;
17181
+ }
16885
17182
  function findOracleKey(bankConfig, feedIdMap) {
16886
17183
  try {
16887
17184
  const oracleSetup = bankConfig.oracleSetup;
@@ -16908,7 +17205,7 @@ var PYTH_SPONSORED_SHARD_ID = 0;
16908
17205
  var LENDR_SPONSORED_SHARD_ID = 3301;
16909
17206
  function findPythPushOracleAddress(feedId, programId, shardId) {
16910
17207
  const shardBytes = u16ToArrayBufferLE(shardId);
16911
- return import_web313.PublicKey.findProgramAddressSync([shardBytes, feedId], programId)[0];
17208
+ return import_web314.PublicKey.findProgramAddressSync([shardBytes, feedId], programId)[0];
16912
17209
  }
16913
17210
  function u16ToArrayBufferLE(value) {
16914
17211
  const buffer = new ArrayBuffer(2);
@@ -19437,10 +19734,10 @@ var PYTH_SOLANA_RECEIVER_PROGRAM_IDL = {
19437
19734
  };
19438
19735
 
19439
19736
  // src/vendor/pyth_crank/pyth.consts.ts
19440
- var import_web314 = require("@solana/web3.js");
19441
- var DEFAULT_RECEIVER_PROGRAM_ID = new import_web314.PublicKey("rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ");
19442
- var DEFAULT_WORMHOLE_PROGRAM_ID = new import_web314.PublicKey("HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ");
19443
- var DEFAULT_PUSH_ORACLE_PROGRAM_ID = new import_web314.PublicKey("pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT");
19737
+ var import_web315 = require("@solana/web3.js");
19738
+ var DEFAULT_RECEIVER_PROGRAM_ID = new import_web315.PublicKey("rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ");
19739
+ var DEFAULT_WORMHOLE_PROGRAM_ID = new import_web315.PublicKey("HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ");
19740
+ var DEFAULT_PUSH_ORACLE_PROGRAM_ID = new import_web315.PublicKey("pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT");
19444
19741
  var ACCUMULATOR_MAGIC = "504e4155";
19445
19742
  var MAJOR_VERSION = 1;
19446
19743
  var MINOR_VERSION = 0;
@@ -19455,7 +19752,7 @@ var VAA_SPLIT_INDEX = 721;
19455
19752
  var VAA_START = 46;
19456
19753
 
19457
19754
  // src/vendor/pyth_crank/pyth.utils.ts
19458
- var import_web315 = require("@solana/web3.js");
19755
+ var import_web316 = require("@solana/web3.js");
19459
19756
  var import_bn7 = __toESM(require("bn.js"), 1);
19460
19757
  function getGuardianSetIndex(vaa) {
19461
19758
  return vaa.readUInt32BE(1);
@@ -19510,7 +19807,7 @@ async function buildPostEncodedVaaInstructions(wormhole, vaa) {
19510
19807
  };
19511
19808
  }
19512
19809
  async function generateVaaInstructionGroups(wormhole, vaa) {
19513
- const encodedVaaKeypair = new import_web315.Keypair();
19810
+ const encodedVaaKeypair = new import_web316.Keypair();
19514
19811
  const initInstructions = [
19515
19812
  await buildEncodedVaaCreateInstruction(wormhole, vaa, encodedVaaKeypair),
19516
19813
  {
@@ -19578,7 +19875,7 @@ async function buildEncodedVaaCreateInstruction(wormhole, vaa, encodedVaaKeypair
19578
19875
  var getGuardianSetPda = (guardianSetIndex, wormholeProgramId) => {
19579
19876
  const guardianSetIndexBuf = Buffer.alloc(4);
19580
19877
  guardianSetIndexBuf.writeUInt32BE(guardianSetIndex, 0);
19581
- return import_web315.PublicKey.findProgramAddressSync([Buffer.from("GuardianSet"), guardianSetIndexBuf], wormholeProgramId)[0];
19878
+ return import_web316.PublicKey.findProgramAddressSync([Buffer.from("GuardianSet"), guardianSetIndexBuf], wormholeProgramId)[0];
19582
19879
  };
19583
19880
  function parsePriceFeedMessage(message) {
19584
19881
  let cursor = 0;
@@ -19657,6 +19954,7 @@ function isOracleSetupSupported(oracleSetup) {
19657
19954
  case "KaminoPythPush" /* KaminoPythPush */:
19658
19955
  case "KaminoSwitchboardPull" /* KaminoSwitchboardPull */:
19659
19956
  case "Fixed" /* Fixed */:
19957
+ case "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */:
19660
19958
  return true;
19661
19959
  default:
19662
19960
  return false;
@@ -19724,7 +20022,8 @@ function parseOraclePriceData(oracleSetup, rawData, fixedPrice, logger = new Noo
19724
20022
  }
19725
20023
  case "PythPushOracle" /* PythPushOracle */:
19726
20024
  case "StakedWithPythPush" /* StakedWithPythPush */:
19727
- case "KaminoPythPush" /* KaminoPythPush */: {
20025
+ case "KaminoPythPush" /* KaminoPythPush */:
20026
+ case "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */: {
19728
20027
  const bytesWithoutDiscriminator = rawData.slice(8);
19729
20028
  const data = parsePriceInfo2(bytesWithoutDiscriminator);
19730
20029
  const exponent = new import_bignumber5.default(10 ** data.priceMessage.exponent);
@@ -19878,7 +20177,7 @@ function dtoToOraclePrice(dto) {
19878
20177
  }
19879
20178
 
19880
20179
  // src/services/price/utils/fetch.utils.ts
19881
- var import_web316 = require("@solana/web3.js");
20180
+ var import_web317 = require("@solana/web3.js");
19882
20181
  var import_bignumber7 = __toESM(require("bignumber.js"), 1);
19883
20182
  var categorizePythBanks = (banks) => {
19884
20183
  const pythLegacyBanks = banks.filter(
@@ -19912,7 +20211,7 @@ var fetchPythDataViaAPI = async (pythPushBanks, voteAccMintTuples) => {
19912
20211
  const stakedCollatDataJson = await stakedCollatDataResponse.json();
19913
20212
  const pythFeedMap = /* @__PURE__ */ new Map();
19914
20213
  Object.entries(pythFeedMapJson).forEach(([feedId, { feedId: feedIdStr, shardId }]) => {
19915
- pythFeedMap.set(feedId, { feedId: new import_web316.PublicKey(feedIdStr), shardId });
20214
+ pythFeedMap.set(feedId, { feedId: new import_web317.PublicKey(feedIdStr), shardId });
19916
20215
  });
19917
20216
  return { pythFeedMap, priceCoeffByBank: stakedCollatDataJson };
19918
20217
  };
@@ -20387,7 +20686,7 @@ function computeRemainingCapacity(bank) {
20387
20686
  }
20388
20687
 
20389
20688
  // src/services/bank/utils/fetch.utils.ts
20390
- var import_web317 = require("@solana/web3.js");
20689
+ var import_web318 = require("@solana/web3.js");
20391
20690
  var fetchMultipleBanks = async (program, opts) => {
20392
20691
  let bankDatas = [];
20393
20692
  if (opts?.bankAddresses && opts.bankAddresses.length > 0) {
@@ -20395,7 +20694,7 @@ var fetchMultipleBanks = async (program, opts) => {
20395
20694
  const data = await program.account.bank.fetchMultiple(addresses);
20396
20695
  data.forEach((d, idx) => {
20397
20696
  if (d) {
20398
- bankDatas.push({ address: new import_web317.PublicKey(addresses[idx]), data: d });
20697
+ bankDatas.push({ address: new import_web318.PublicKey(addresses[idx]), data: d });
20399
20698
  } else {
20400
20699
  console.error(`Bank ${addresses[idx]} not found`);
20401
20700
  }
@@ -20502,6 +20801,8 @@ function serializeOracleSetupToIndex(oracleSetup) {
20502
20801
  return 7;
20503
20802
  case "Fixed" /* Fixed */:
20504
20803
  return 8;
20804
+ case "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */:
20805
+ return 9;
20505
20806
  default:
20506
20807
  return 0;
20507
20808
  }
@@ -20526,6 +20827,8 @@ function serializeOracleSetup(oracleSetup) {
20526
20827
  return { kaminoSwitchboardPull: {} };
20527
20828
  case "Fixed" /* Fixed */:
20528
20829
  return { fixed: {} };
20830
+ case "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */:
20831
+ return { fogoStakePoolWithPythPush: {} };
20529
20832
  default:
20530
20833
  throw new Error(`Invalid oracle setup "${oracleSetup}"`);
20531
20834
  }
@@ -20800,23 +21103,23 @@ function getPriceFeedAccountForProgram(shardId, priceFeedId, pushOracleProgramId
20800
21103
  }
20801
21104
  const shardBuffer = Buffer.alloc(2);
20802
21105
  shardBuffer.writeUint16LE(shardId, 0);
20803
- return import_web318.PublicKey.findProgramAddressSync(
21106
+ return import_web319.PublicKey.findProgramAddressSync(
20804
21107
  [shardBuffer, feedIdBuffer],
20805
21108
  pushOracleProgramId ?? DEFAULT_PUSH_ORACLE_PROGRAM_ID
20806
21109
  )[0];
20807
21110
  }
20808
21111
  var getTreasuryPda = (treasuryId, receiverProgramId) => {
20809
- return import_web318.PublicKey.findProgramAddressSync([Buffer.from("treasury"), Buffer.from([treasuryId])], receiverProgramId)[0];
21112
+ return import_web319.PublicKey.findProgramAddressSync([Buffer.from("treasury"), Buffer.from([treasuryId])], receiverProgramId)[0];
20810
21113
  };
20811
21114
  var getConfigPda = (receiverProgramId) => {
20812
- return import_web318.PublicKey.findProgramAddressSync([Buffer.from("config")], receiverProgramId)[0];
21115
+ return import_web319.PublicKey.findProgramAddressSync([Buffer.from("config")], receiverProgramId)[0];
20813
21116
  };
20814
21117
  async function crankPythOracleIx(oracles, provider) {
20815
21118
  const feedIdsByShardId = {};
20816
21119
  const wormholeProgram = new import_anchor5.Program(PYTH_WORMHOLE_IDL, provider);
20817
21120
  const pushOracleProgram = new import_anchor5.Program(PYTH_PUSH_ORACLE_IDL, provider);
20818
21121
  const receiverProgram = new import_anchor5.Program(PYTH_SOLANA_RECEIVER_PROGRAM_IDL, provider);
20819
- const addressLookupTableAccount = new import_web318.PublicKey("5DNCErWQFBdvCxWQXaC1mrEFsvL3ftrzZ2gVZWNybaSX");
21122
+ const addressLookupTableAccount = new import_web319.PublicKey("5DNCErWQFBdvCxWQXaC1mrEFsvL3ftrzZ2gVZWNybaSX");
20820
21123
  const lookupTableAccount = (await provider.connection.getAddressLookupTable(addressLookupTableAccount)).value;
20821
21124
  const buildURL = (endpoint) => {
20822
21125
  return new URL(`./v2/${endpoint}`, `https://hermes.pyth.network/`);
@@ -21012,7 +21315,7 @@ async function confirmBundle(_connection, bundleId, _commitment = "confirmed") {
21012
21315
  }
21013
21316
 
21014
21317
  // src/services/transaction/helpers/bundle-simulation.ts
21015
- var import_web319 = require("@solana/web3.js");
21318
+ var import_web320 = require("@solana/web3.js");
21016
21319
  var BundleSimulationError = class _BundleSimulationError extends Error {
21017
21320
  constructor(message, logs, cause) {
21018
21321
  super(message);
@@ -21040,7 +21343,7 @@ async function simulateBundle(rpcEndpoint, transactions, includeAccounts) {
21040
21343
  const result = await executeBundleSimulation(rpcEndpoint, encodedTransactions, config);
21041
21344
  return result;
21042
21345
  } catch (error) {
21043
- if (error instanceof import_web319.SolanaJSONRPCError || error instanceof BundleSimulationError) {
21346
+ if (error instanceof import_web320.SolanaJSONRPCError || error instanceof BundleSimulationError) {
21044
21347
  throw error;
21045
21348
  } else {
21046
21349
  throw new BundleSimulationError("Failed to execute bundle simulation", void 0, error);
@@ -21099,7 +21402,7 @@ async function executeBundleSimulation(rpcEndpoint, encodedTransactions, config)
21099
21402
  }
21100
21403
 
21101
21404
  // src/services/transaction/transaction.service.ts
21102
- var import_web320 = require("@solana/web3.js");
21405
+ var import_web321 = require("@solana/web3.js");
21103
21406
  var import_bs58 = __toESM(require("bs58"), 1);
21104
21407
  init_constants();
21105
21408
  var DEFAULT_PROCESS_TX_OPTS = {
@@ -21167,7 +21470,7 @@ async function processTransactions({
21167
21470
  lastValidBlockHeight = getLatestBlockhashAndContext.value.lastValidBlockHeight;
21168
21471
  } catch (error) {
21169
21472
  console.error("Failed to get latest blockhash and context", error);
21170
- if (error instanceof import_web320.SolanaJSONRPCError) {
21473
+ if (error instanceof import_web321.SolanaJSONRPCError) {
21171
21474
  throw error;
21172
21475
  }
21173
21476
  throw new ProcessTransactionError({
@@ -21320,7 +21623,7 @@ async function processTransactions({
21320
21623
  }
21321
21624
  } catch (error) {
21322
21625
  const failedTxs = transactions.splice(signatures.length);
21323
- if (error instanceof import_web320.SolanaJSONRPCError) {
21626
+ if (error instanceof import_web321.SolanaJSONRPCError) {
21324
21627
  throw error;
21325
21628
  }
21326
21629
  if (error instanceof ProcessTransactionError) {
@@ -21551,7 +21854,7 @@ async function sendTransactionAsBundleRpc({
21551
21854
  }
21552
21855
 
21553
21856
  // src/services/transaction/helpers/tx-formatting.ts
21554
- var import_web321 = require("@solana/web3.js");
21857
+ var import_web322 = require("@solana/web3.js");
21555
21858
  var MAX_TX_SIZE2 = 1232;
21556
21859
  var BUNDLE_TX_SIZE2 = 81;
21557
21860
  var PRIORITY_TX_SIZE2 = 44;
@@ -21559,7 +21862,7 @@ function isFlashloan(tx) {
21559
21862
  if (isV0Tx(tx)) {
21560
21863
  const addressLookupTableAccounts = tx.addressLookupTables ?? [];
21561
21864
  const message = decompileV0Transaction(tx, addressLookupTableAccounts);
21562
- const idl = { ...LENDR_IDL, address: new import_web321.PublicKey(0) };
21865
+ const idl = { ...LENDR_IDL, address: new import_web322.PublicKey(0) };
21563
21866
  const decoded = message.instructions.map((ix) => decodeInstruction(idl, ix.data));
21564
21867
  return decoded.some((ix) => ix?.name.toLowerCase().includes("flashloan"));
21565
21868
  }
@@ -21596,7 +21899,7 @@ function formatTransactions(transactionsArg, broadcastType, blockhash, feeSettin
21596
21899
  updatedFees = uiToMicroLamports(0.1, cu);
21597
21900
  }
21598
21901
  priorityIxs.push(broadcastType === "BUNDLE" ? dummyPriorityFeeIx : makePriorityFeeMicroIx(updatedFees));
21599
- cuLimitIxs.push(cu ? import_web321.ComputeBudgetProgram.setComputeUnitLimit({ units: cu }) : void 0);
21902
+ cuLimitIxs.push(cu ? import_web322.ComputeBudgetProgram.setComputeUnitLimit({ units: cu }) : void 0);
21600
21903
  });
21601
21904
  const { bundleTipIx } = makeTxPriorityIx(
21602
21905
  feePayer,
@@ -21618,12 +21921,12 @@ function formatTransactions(transactionsArg, broadcastType, blockhash, feeSettin
21618
21921
  }
21619
21922
  }
21620
21923
  if (bundleTipIndex === -1 && bundleTipIx) {
21621
- const bundleTipMessage = new import_web321.TransactionMessage({
21924
+ const bundleTipMessage = new import_web322.TransactionMessage({
21622
21925
  instructions: [bundleTipIx],
21623
21926
  payerKey: feePayer,
21624
21927
  recentBlockhash: blockhash
21625
21928
  });
21626
- formattedTransactions.push(new import_web321.VersionedTransaction(bundleTipMessage.compileToV0Message()));
21929
+ formattedTransactions.push(new import_web322.VersionedTransaction(bundleTipMessage.compileToV0Message()));
21627
21930
  }
21628
21931
  for (const [index, transaction] of transactions.entries()) {
21629
21932
  const hasFlashloan = flashloanIndex !== null;
@@ -21672,7 +21975,7 @@ function addTransactionTxTags(transactions) {
21672
21975
  isWritable: false
21673
21976
  });
21674
21977
  solanaTx = addTransactionMetadata(
21675
- new import_web321.VersionedTransaction(message.compileToV0Message(tx.addressLookupTables)),
21978
+ new import_web322.VersionedTransaction(message.compileToV0Message(tx.addressLookupTables)),
21676
21979
  {
21677
21980
  signers: solanaTx.signers,
21678
21981
  addressLookupTables: solanaTx.addressLookupTables,
@@ -21694,7 +21997,7 @@ function addTransactionTxTags(transactions) {
21694
21997
  }
21695
21998
 
21696
21999
  // src/services/account/utils/compute.utils.ts
21697
- var import_web322 = require("@solana/web3.js");
22000
+ var import_web323 = require("@solana/web3.js");
21698
22001
  var import_bignumber9 = __toESM(require("bignumber.js"), 1);
21699
22002
  init_single_spl_pool();
21700
22003
  function computeFreeCollateral(lendrAccount, opts) {
@@ -21919,7 +22222,10 @@ function computeHealthAccountMetas(banksToInclude, bankMetadataMap, enableSortin
21919
22222
  const accounts = wrapperFn(
21920
22223
  banksToInclude.map((bank) => {
21921
22224
  const keys = [bank.address, bank.config.oracleKeys[0]];
21922
- if (bank.config.assetTag === 2) {
22225
+ const fogoStakePool = getFogoStakePoolAddress(bank.config);
22226
+ if (fogoStakePool) {
22227
+ keys.push(fogoStakePool);
22228
+ } else if (bank.config.assetTag === 2 && bank.config.oracleSetup === "StakedWithPythPush" /* StakedWithPythPush */) {
21923
22229
  if (!bankMetadataMap && !bankExtendedMetadata) {
21924
22230
  throw Error(`No bank metadata for ${bank.address.toBase58()} provided`);
21925
22231
  }
@@ -21928,7 +22234,7 @@ function computeHealthAccountMetas(banksToInclude, bankMetadataMap, enableSortin
21928
22234
  if (!validatorVoteAccount) {
21929
22235
  throw Error(`no validatorVoteAccount on Bank metadata: ${bank.address.toBase58()}`);
21930
22236
  }
21931
- const pool = findPoolAddress(new import_web322.PublicKey(validatorVoteAccount));
22237
+ const pool = findPoolAddress(new import_web323.PublicKey(validatorVoteAccount));
21932
22238
  const solPool = findPoolStakeAddress(pool);
21933
22239
  const lstMint = findPoolMintAddress(pool);
21934
22240
  keys.push(lstMint, solPool);
@@ -21941,7 +22247,7 @@ function computeHealthAccountMetas(banksToInclude, bankMetadataMap, enableSortin
21941
22247
 
21942
22248
  // src/services/account/utils/deserialize.utils.ts
21943
22249
  var import_anchor6 = require("@coral-xyz/anchor");
21944
- var import_web323 = require("@solana/web3.js");
22250
+ var import_web324 = require("@solana/web3.js");
21945
22251
  var import_bignumber11 = __toESM(require("bignumber.js"), 1);
21946
22252
  var import_bn9 = __toESM(require("bn.js"), 1);
21947
22253
 
@@ -22113,19 +22419,19 @@ function getHealthCacheStatusDescription(flags) {
22113
22419
  }
22114
22420
  function dtoToLendrAccount(lendrAccountDto) {
22115
22421
  return {
22116
- address: new import_web323.PublicKey(lendrAccountDto.address),
22117
- group: new import_web323.PublicKey(lendrAccountDto.group),
22118
- authority: new import_web323.PublicKey(lendrAccountDto.authority),
22422
+ address: new import_web324.PublicKey(lendrAccountDto.address),
22423
+ group: new import_web324.PublicKey(lendrAccountDto.group),
22424
+ authority: new import_web324.PublicKey(lendrAccountDto.authority),
22119
22425
  balances: lendrAccountDto.balances.map(dtoToBalance),
22120
22426
  accountFlags: lendrAccountDto.accountFlags,
22121
- emissionsDestinationAccount: new import_web323.PublicKey(lendrAccountDto.emissionsDestinationAccount),
22427
+ emissionsDestinationAccount: new import_web324.PublicKey(lendrAccountDto.emissionsDestinationAccount),
22122
22428
  healthCache: dtoToHealthCache(lendrAccountDto.healthCache)
22123
22429
  };
22124
22430
  }
22125
22431
  function dtoToBalance(balanceDto) {
22126
22432
  return {
22127
22433
  active: balanceDto.active,
22128
- bankPk: new import_web323.PublicKey(balanceDto.bankPk),
22434
+ bankPk: new import_web324.PublicKey(balanceDto.bankPk),
22129
22435
  assetShares: new import_bignumber11.default(balanceDto.assetShares),
22130
22436
  liabilityShares: new import_bignumber11.default(balanceDto.liabilityShares),
22131
22437
  emissionsOutstanding: new import_bignumber11.default(balanceDto.emissionsOutstanding),
@@ -22462,10 +22768,10 @@ async function simulateAccountHealthCache(props) {
22462
22768
  const { program, bankMap, oraclePrices, lendrAccountPk, balances, bankMetadataMap } = props;
22463
22769
  const activeBalances = balances.filter((b) => b.active);
22464
22770
  const { staleSwbOracles } = getActiveStaleBanks(activeBalances, bankMap, [], oraclePrices, 30);
22465
- const computeIx = import_web324.ComputeBudgetProgram.setComputeUnitLimit({ units: 14e5 });
22771
+ const computeIx = import_web325.ComputeBudgetProgram.setComputeUnitLimit({ units: 14e5 });
22466
22772
  const blockhash = (await program.provider.connection.getLatestBlockhash("confirmed")).blockhash;
22467
- const fundAccountIx = import_web324.SystemProgram.transfer({
22468
- fromPubkey: new import_web324.PublicKey("DD3AeAssFvjqTvRTrRAtpfjkBF8FpVKnFuwnMLN9haXD"),
22773
+ const fundAccountIx = import_web325.SystemProgram.transfer({
22774
+ fromPubkey: new import_web325.PublicKey("DD3AeAssFvjqTvRTrRAtpfjkBF8FpVKnFuwnMLN9haXD"),
22469
22775
  // lendr SOL VAULT
22470
22776
  toPubkey: program.provider.publicKey,
22471
22777
  lamports: 1e8
@@ -22509,19 +22815,19 @@ async function simulateAccountHealthCache(props) {
22509
22815
  )
22510
22816
  );
22511
22817
  }
22512
- const messageV0 = new import_web324.TransactionMessage({
22818
+ const messageV0 = new import_web325.TransactionMessage({
22513
22819
  payerKey: program.provider.publicKey,
22514
22820
  recentBlockhash: blockhash,
22515
22821
  instructions: [...crankSwbIxs.instructions]
22516
22822
  }).compileToV0Message([...crankSwbIxs.luts]);
22517
- const swbTx = new import_web324.VersionedTransaction(messageV0);
22823
+ const swbTx = new import_web325.VersionedTransaction(messageV0);
22518
22824
  txs.push(swbTx);
22519
- const healthTx = new import_web324.TransactionMessage({
22825
+ const healthTx = new import_web325.TransactionMessage({
22520
22826
  payerKey: program.provider.publicKey,
22521
22827
  recentBlockhash: blockhash,
22522
22828
  instructions: [...healthPulseIxs.instructions]
22523
22829
  }).compileToV0Message([]);
22524
- const healthTxV0 = new import_web324.VersionedTransaction(healthTx);
22830
+ const healthTxV0 = new import_web325.VersionedTransaction(healthTx);
22525
22831
  txs.push(healthTxV0);
22526
22832
  if (txs.length > 5) {
22527
22833
  console.error("Too many transactions", txs.length);
@@ -22585,11 +22891,11 @@ async function createUpdateFeedIx(_props) {
22585
22891
  }
22586
22892
  async function createLendrAccountTx(props) {
22587
22893
  const authority = props.lendrAccount?.authority ?? props.lendrClient.provider.publicKey;
22588
- const lendrAccountKeypair = import_web324.Keypair.generate();
22894
+ const lendrAccountKeypair = import_web325.Keypair.generate();
22589
22895
  const dummyWrappedI80F48 = bigNumberToWrappedI80F48(new import_bignumber12.default(0));
22590
22896
  const dummyBalances = Array(15).fill({
22591
22897
  active: false,
22592
- bankPk: new import_web324.PublicKey("11111111111111111111111111111111"),
22898
+ bankPk: new import_web325.PublicKey("11111111111111111111111111111111"),
22593
22899
  assetShares: dummyWrappedI80F48,
22594
22900
  liabilityShares: dummyWrappedI80F48,
22595
22901
  emissionsOutstanding: dummyWrappedI80F48,
@@ -22619,7 +22925,7 @@ async function createLendrAccountTx(props) {
22619
22925
  internalLiqErr: 0,
22620
22926
  lndrErr: 0
22621
22927
  },
22622
- emissionsDestinationAccount: new import_web324.PublicKey("11111111111111111111111111111111"),
22928
+ emissionsDestinationAccount: new import_web325.PublicKey("11111111111111111111111111111111"),
22623
22929
  accountFlags: new import_bn11.default([0, 0, 0])
22624
22930
  };
22625
22931
  const account = LendrAccount.fromAccountParsed(lendrAccountKeypair.publicKey, rawAccount);
@@ -22656,7 +22962,7 @@ function getActiveStaleBanks(balances, banks, additionalBanks, oraclePrices, max
22656
22962
  seenSwbOracles.add(key);
22657
22963
  staleSwbOracles.push({ oracleKey: bank.oracleKey });
22658
22964
  }
22659
- } else if (bank.config.oracleSetup === "PythPushOracle" /* PythPushOracle */ || bank.config.oracleSetup === "StakedWithPythPush" /* StakedWithPythPush */ || bank.config.oracleSetup === "KaminoPythPush" /* KaminoPythPush */) {
22965
+ } else if (bank.config.oracleSetup === "PythPushOracle" /* PythPushOracle */ || bank.config.oracleSetup === "StakedWithPythPush" /* StakedWithPythPush */ || bank.config.oracleSetup === "KaminoPythPush" /* KaminoPythPush */ || bank.config.oracleSetup === "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */) {
22660
22966
  const oraclePrice = oraclePrices.get(bank.address.toBase58());
22661
22967
  const shardId = oraclePrice?.pythShardId ?? 0;
22662
22968
  const feedId = bank.config.oracleKeys[0];
@@ -22674,7 +22980,7 @@ function getActiveStaleBanks(balances, banks, additionalBanks, oraclePrices, max
22674
22980
 
22675
22981
  // src/services/group/group.service.ts
22676
22982
  var import_spl_token5 = require("@solana/spl-token");
22677
- var import_web325 = require("@solana/web3.js");
22983
+ var import_web326 = require("@solana/web3.js");
22678
22984
  var import_bn12 = __toESM(require("bn.js"), 1);
22679
22985
  init_constants();
22680
22986
  init_single_spl_pool();
@@ -22692,7 +22998,7 @@ async function makePoolConfigureBankIx2(program, bank, args) {
22692
22998
  };
22693
22999
  }
22694
23000
  async function makeAddPermissionlessStakedBankIx(program, group, voteAccountAddress, feePayer, pythOracle) {
22695
- const [settingsKey] = import_web325.PublicKey.findProgramAddressSync(
23001
+ const [settingsKey] = import_web326.PublicKey.findProgramAddressSync(
22696
23002
  [Buffer.from("staked_settings", "utf-8"), group.toBuffer()],
22697
23003
  program.programId
22698
23004
  );
@@ -22704,12 +23010,12 @@ async function makeAddPermissionlessStakedBankIx(program, group, voteAccountAddr
22704
23010
  { pubkey: poolAddress, isSigner: false, isWritable: false },
22705
23011
  { pubkey: onRampAddress, isSigner: false, isWritable: true },
22706
23012
  { pubkey: solPool, isSigner: false, isWritable: false },
22707
- { pubkey: import_web325.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
22708
- { pubkey: import_web325.SystemProgram.programId, isSigner: false, isWritable: false },
22709
- { pubkey: import_web325.StakeProgram.programId, isSigner: false, isWritable: false }
23013
+ { pubkey: import_web326.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
23014
+ { pubkey: import_web326.SystemProgram.programId, isSigner: false, isWritable: false },
23015
+ { pubkey: import_web326.StakeProgram.programId, isSigner: false, isWritable: false }
22710
23016
  ];
22711
23017
  const data = Buffer.from(Uint8Array.of(6));
22712
- const _onrampIx = new import_web325.TransactionInstruction({
23018
+ const _onrampIx = new import_web326.TransactionInstruction({
22713
23019
  keys,
22714
23020
  programId: SINGLE_POOL_PROGRAM_ID,
22715
23021
  data
@@ -22765,11 +23071,11 @@ async function makePoolAddBankIx2(program, group, bank, feePayer, bankMint, bank
22765
23071
  }
22766
23072
 
22767
23073
  // src/services/group/utils/deserialize.utils.ts
22768
- var import_web326 = require("@solana/web3.js");
23074
+ var import_web327 = require("@solana/web3.js");
22769
23075
  function dtoToGroup(groupDto) {
22770
23076
  return {
22771
- admin: new import_web326.PublicKey(groupDto.admin),
22772
- address: new import_web326.PublicKey(groupDto.address)
23077
+ admin: new import_web327.PublicKey(groupDto.admin),
23078
+ address: new import_web327.PublicKey(groupDto.address)
22773
23079
  };
22774
23080
  }
22775
23081
 
@@ -22782,26 +23088,26 @@ function groupToDto(group) {
22782
23088
  }
22783
23089
 
22784
23090
  // src/services/native-stake/utils/deserialize.utils.ts
22785
- var import_web327 = require("@solana/web3.js");
23091
+ var import_web328 = require("@solana/web3.js");
22786
23092
  function dtoToValidatorStakeGroup(validatorStakeGroupDto) {
22787
23093
  return {
22788
- validator: new import_web327.PublicKey(validatorStakeGroupDto.validator),
22789
- poolKey: new import_web327.PublicKey(validatorStakeGroupDto.poolKey),
22790
- poolMintKey: new import_web327.PublicKey(validatorStakeGroupDto.poolMintKey),
23094
+ validator: new import_web328.PublicKey(validatorStakeGroupDto.validator),
23095
+ poolKey: new import_web328.PublicKey(validatorStakeGroupDto.poolKey),
23096
+ poolMintKey: new import_web328.PublicKey(validatorStakeGroupDto.poolMintKey),
22791
23097
  totalStake: validatorStakeGroupDto.totalStake,
22792
23098
  selectedAccount: {
22793
- pubkey: new import_web327.PublicKey(validatorStakeGroupDto.selectedAccount.pubkey),
23099
+ pubkey: new import_web328.PublicKey(validatorStakeGroupDto.selectedAccount.pubkey),
22794
23100
  amount: validatorStakeGroupDto.selectedAccount.amount
22795
23101
  },
22796
23102
  accounts: validatorStakeGroupDto.accounts.map((account) => ({
22797
- pubkey: new import_web327.PublicKey(account.pubkey),
23103
+ pubkey: new import_web328.PublicKey(account.pubkey),
22798
23104
  amount: account.amount
22799
23105
  }))
22800
23106
  };
22801
23107
  }
22802
23108
 
22803
23109
  // src/services/native-stake/utils/fetch.utils.ts
22804
- var import_web328 = require("@solana/web3.js");
23110
+ var import_web329 = require("@solana/web3.js");
22805
23111
  init_constants();
22806
23112
  init_single_spl_pool();
22807
23113
  var fetchNativeStakeAccounts = async (connection, publicKey3, opts = {
@@ -22812,7 +23118,7 @@ var fetchNativeStakeAccounts = async (connection, publicKey3, opts = {
22812
23118
  }
22813
23119
  try {
22814
23120
  const epochInfo = await connection.getEpochInfo();
22815
- const accounts = await connection.getParsedProgramAccounts(import_web328.StakeProgram.programId, {
23121
+ const accounts = await connection.getParsedProgramAccounts(import_web329.StakeProgram.programId, {
22816
23122
  filters: [
22817
23123
  {
22818
23124
  memcmp: {
@@ -22832,14 +23138,14 @@ var fetchNativeStakeAccounts = async (connection, publicKey3, opts = {
22832
23138
  }
22833
23139
  const validatorAddress = stakeInfo.stake.delegation.voter;
22834
23140
  const accountPubkey = acc.pubkey;
22835
- const amount = Number(stakeInfo.stake.delegation.stake) / import_web328.LAMPORTS_PER_SOL;
23141
+ const amount = Number(stakeInfo.stake.delegation.stake) / import_web329.LAMPORTS_PER_SOL;
22836
23142
  const existingAccounts = validatorMap.get(validatorAddress) || [];
22837
23143
  validatorMap.set(validatorAddress, [...existingAccounts, { pubkey: accountPubkey, amount }]);
22838
23144
  })
22839
23145
  );
22840
23146
  return Promise.all(
22841
23147
  Array.from(validatorMap.entries()).map(async ([validatorAddress, accounts2]) => {
22842
- const poolKey = findPoolAddress(new import_web328.PublicKey(validatorAddress));
23148
+ const poolKey = findPoolAddress(new import_web329.PublicKey(validatorAddress));
22843
23149
  const poolMintKey = findPoolMintAddress(poolKey);
22844
23150
  const totalStake = accounts2.reduce((acc, curr) => acc + curr.amount, 0);
22845
23151
  const largestAccount = accounts2.reduce((acc, curr) => acc.amount > curr.amount ? acc : curr);
@@ -22848,7 +23154,7 @@ var fetchNativeStakeAccounts = async (connection, publicKey3, opts = {
22848
23154
  sortedAccounts.unshift(sortedAccounts.splice(sortedAccounts.indexOf(largestAccount), 1)[0]);
22849
23155
  }
22850
23156
  return {
22851
- validator: new import_web328.PublicKey(validatorAddress),
23157
+ validator: new import_web329.PublicKey(validatorAddress),
22852
23158
  poolKey,
22853
23159
  poolMintKey,
22854
23160
  accounts: sortedAccounts,
@@ -22904,17 +23210,17 @@ var fetchStakeAccount = (data) => {
22904
23210
  offset += 4;
22905
23211
  const rentExemptReserve = data.readBigUInt64LE(offset);
22906
23212
  offset += 8;
22907
- const staker = new import_web328.PublicKey(data.subarray(offset, offset + 32));
23213
+ const staker = new import_web329.PublicKey(data.subarray(offset, offset + 32));
22908
23214
  offset += 32;
22909
- const withdrawer = new import_web328.PublicKey(data.subarray(offset, offset + 32));
23215
+ const withdrawer = new import_web329.PublicKey(data.subarray(offset, offset + 32));
22910
23216
  offset += 32;
22911
23217
  const unixTimestamp = data.readBigUInt64LE(offset);
22912
23218
  offset += 8;
22913
23219
  const epoch = data.readBigUInt64LE(offset);
22914
23220
  offset += 8;
22915
- const custodian = new import_web328.PublicKey(data.subarray(offset, offset + 32));
23221
+ const custodian = new import_web329.PublicKey(data.subarray(offset, offset + 32));
22916
23222
  offset += 32;
22917
- const voterPubkey = new import_web328.PublicKey(data.subarray(offset, offset + 32));
23223
+ const voterPubkey = new import_web329.PublicKey(data.subarray(offset, offset + 32));
22918
23224
  offset += 32;
22919
23225
  const stake = data.readBigUInt64LE(offset);
22920
23226
  offset += 8;
@@ -23861,12 +24167,9 @@ var LendrAccount = class _LendrAccount {
23861
24167
  if (bank.mint.equals(import_spl_token6.NATIVE_MINT)) {
23862
24168
  const wSolBalanceUi = opts.wSolBalanceUi ?? 0;
23863
24169
  const wrapAmount = new import_bignumber14.default(amount).minus(wSolBalanceUi);
23864
- const wrapIxs = makeSessionWrapSolIxs(
23865
- session.walletPublicKey,
23866
- session.sessionPublicKey,
23867
- wrapAmount,
23868
- { existingBalance: wSolBalanceUi }
23869
- );
24170
+ const wrapIxs = makeSessionWrapSolIxs(session.walletPublicKey, session.sessionPublicKey, wrapAmount, {
24171
+ existingBalance: wSolBalanceUi
24172
+ });
23870
24173
  depositIxs.push(...wrapIxs);
23871
24174
  }
23872
24175
  depositIxs.push(depositIx);
@@ -23893,7 +24196,7 @@ var LendrAccount = class _LendrAccount {
23893
24196
  const wrapAndUnwrapSol = opts.wrapAndUnwrapSol ?? true;
23894
24197
  const wSolBalanceUi = opts.wSolBalanceUi ?? 0;
23895
24198
  const repayIxs = [];
23896
- if (repayAll && !bank.emissionsMint.equals(import_web329.PublicKey.default)) {
24199
+ if (repayAll && !bank.emissionsMint.equals(import_web330.PublicKey.default)) {
23897
24200
  repayIxs.push(...(await this.makeWithdrawEmissionsIx(program, banks, mintDatas, bankAddress)).instructions);
23898
24201
  }
23899
24202
  const userAta = (0, import_spl_token6.getAssociatedTokenAddressSync)(bank.mint, this.authority, true, mintData.tokenProgram);
@@ -23981,15 +24284,10 @@ var LendrAccount = class _LendrAccount {
23981
24284
  if (bank.mint.equals(import_spl_token6.NATIVE_MINT)) {
23982
24285
  const wSolBalanceUi = opts.wSolBalanceUi ?? 0;
23983
24286
  const neededAmount = new import_bignumber14.default(amount).minus(wSolBalanceUi);
23984
- const wrapIxs = makeSessionWrapSolIxs(
23985
- session.walletPublicKey,
23986
- session.sessionPublicKey,
23987
- neededAmount,
23988
- {
23989
- existingBalance: wSolBalanceUi,
23990
- wrapAmountUi: opts.wrapAmountUi
23991
- }
23992
- );
24287
+ const wrapIxs = makeSessionWrapSolIxs(session.walletPublicKey, session.sessionPublicKey, neededAmount, {
24288
+ existingBalance: wSolBalanceUi,
24289
+ wrapAmountUi: opts.wrapAmountUi
24290
+ });
23993
24291
  repayIxs.push(...wrapIxs);
23994
24292
  }
23995
24293
  repayIxs.push(repayIx);
@@ -24009,7 +24307,7 @@ var LendrAccount = class _LendrAccount {
24009
24307
  const wrapAndUnwrapSol = withdrawOpts.wrapAndUnwrapSol ?? true;
24010
24308
  const createAtas = withdrawOpts.createAtas ?? true;
24011
24309
  const withdrawIxs = [];
24012
- if (withdrawAll && !bank.emissionsMint.equals(import_web329.PublicKey.default) && mintData.emissionTokenProgram) {
24310
+ if (withdrawAll && !bank.emissionsMint.equals(import_web330.PublicKey.default) && mintData.emissionTokenProgram) {
24013
24311
  withdrawIxs.push(...(await this.makeWithdrawEmissionsIx(program, bankMap, mintDatas, bankAddress)).instructions);
24014
24312
  }
24015
24313
  const userAta = (0, import_spl_token6.getAssociatedTokenAddressSync)(bank.mint, this.authority, true, mintData.tokenProgram);
@@ -24042,7 +24340,7 @@ var LendrAccount = class _LendrAccount {
24042
24340
  throw Error(`No validator vote account for staked bank ${bankAddress.toBase58()}`);
24043
24341
  }
24044
24342
  const { findPoolAddress: findPoolAddress2, findPoolStakeAddress: findPoolStakeAddress2, findPoolMintAddress: findPoolMintAddress2 } = (init_single_spl_pool(), __toCommonJS(single_spl_pool_exports));
24045
- const pool = findPoolAddress2(new import_web329.PublicKey(bankMetadata.validatorVoteAccount));
24343
+ const pool = findPoolAddress2(new import_web330.PublicKey(bankMetadata.validatorVoteAccount));
24046
24344
  const solPool = findPoolStakeAddress2(pool);
24047
24345
  const lstMint = findPoolMintAddress2(pool);
24048
24346
  remainingAccounts.push(lstMint, solPool);
@@ -24279,7 +24577,7 @@ var LendrAccount = class _LendrAccount {
24279
24577
  remainingAccounts.push(liabilityBank.config.oracleKeys[0]);
24280
24578
  const accountMetas = computeHealthAccountMetas(healthAccounts, bankMetadataMap);
24281
24579
  remainingAccounts.push(...accountMetas);
24282
- ixs.push(import_web329.ComputeBudgetProgram.setComputeUnitLimit({ units: 14e5 }));
24580
+ ixs.push(import_web330.ComputeBudgetProgram.setComputeUnitLimit({ units: 14e5 }));
24283
24581
  const liquidateIx = await instructions_default.makeLendingAccountLiquidateIx(
24284
24582
  program,
24285
24583
  {
@@ -24397,7 +24695,7 @@ var LendrAccount = class _LendrAccount {
24397
24695
  if (!decoded) continue;
24398
24696
  const ixArgs = decoded.data;
24399
24697
  if (decoded.name === "lendingAccountBorrow" || decoded.name === "lendingAccountDeposit") {
24400
- const targetBank = new import_web329.PublicKey(ix.keys[3].pubkey);
24698
+ const targetBank = new import_web330.PublicKey(ix.keys[3].pubkey);
24401
24699
  const targetBalance = projectedBalances.find((b) => b.bankPk.equals(targetBank));
24402
24700
  if (!targetBalance) {
24403
24701
  const firstInactiveBalanceIndex = projectedBalances.findIndex((b) => !b.active);
@@ -24410,7 +24708,7 @@ var LendrAccount = class _LendrAccount {
24410
24708
  continue;
24411
24709
  }
24412
24710
  if (decoded.name === "lendingAccountRepay" || decoded.name === "lendingAccountWithdraw") {
24413
- const targetBank = new import_web329.PublicKey(ix.keys[3].pubkey);
24711
+ const targetBank = new import_web330.PublicKey(ix.keys[3].pubkey);
24414
24712
  const targetBalance = projectedBalances.find((b) => b.bankPk.equals(targetBank));
24415
24713
  if (!targetBalance) {
24416
24714
  throw Error(
@@ -24419,7 +24717,7 @@ var LendrAccount = class _LendrAccount {
24419
24717
  }
24420
24718
  if (ixArgs.repayAll || ixArgs.withdrawAll) {
24421
24719
  targetBalance.active = false;
24422
- targetBalance.bankPk = import_web329.PublicKey.default;
24720
+ targetBalance.bankPk = import_web330.PublicKey.default;
24423
24721
  }
24424
24722
  }
24425
24723
  }
@@ -24468,7 +24766,7 @@ function isWeightedPrice(reqType) {
24468
24766
  // src/models/account/wrapper.ts
24469
24767
  var import_anchor8 = require("@coral-xyz/anchor");
24470
24768
  var import_spl_token7 = require("@solana/spl-token");
24471
- var import_web330 = require("@solana/web3.js");
24769
+ var import_web331 = require("@solana/web3.js");
24472
24770
  var import_bignumber15 = __toESM(require("bignumber.js"), 1);
24473
24771
  init_constants();
24474
24772
  var LendrAccountWrapper = class _LendrAccountWrapper {
@@ -24622,7 +24920,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24622
24920
  computeEmodeImpacts(emodePairs) {
24623
24921
  return this._lendrAccount.computeEmodeImpacts(
24624
24922
  emodePairs,
24625
- Array.from(this.client.banks.keys()).map((b) => new import_web330.PublicKey(b))
24923
+ Array.from(this.client.banks.keys()).map((b) => new import_web331.PublicKey(b))
24626
24924
  );
24627
24925
  }
24628
24926
  computeMaxBorrowForBank(bankAddress, opts) {
@@ -24677,7 +24975,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24677
24975
  const cuRequestIxs = [];
24678
24976
  const activeBalances = this.balances.filter((b) => b.active);
24679
24977
  if (activeBalances.length >= 4) {
24680
- cuRequestIxs.push(import_web330.ComputeBudgetProgram.setComputeUnitLimit({ units: 1e6 }));
24978
+ cuRequestIxs.push(import_web331.ComputeBudgetProgram.setComputeUnitLimit({ units: 1e6 }));
24681
24979
  }
24682
24980
  return cuRequestIxs;
24683
24981
  }
@@ -24695,7 +24993,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24695
24993
  const mintData = this.client.mintDatas.get(bankAddress.toBase58());
24696
24994
  if (!bank || !mintData) throw Error(`Token data for ${bankAddress.toBase58()} not found`);
24697
24995
  return (0, import_spl_token7.getAssociatedTokenAddressSync)(
24698
- new import_web330.PublicKey(bank.tokenAddress),
24996
+ new import_web331.PublicKey(bank.tokenAddress),
24699
24997
  this.authority,
24700
24998
  true,
24701
24999
  mintData.tokenProgram.equals(import_spl_token7.TOKEN_2022_PROGRAM_ID) ? import_spl_token7.TOKEN_2022_PROGRAM_ID : void 0
@@ -24714,7 +25012,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24714
25012
  this.authority,
24715
25013
  userAtas[i],
24716
25014
  this.authority,
24717
- new import_web330.PublicKey(bank.tokenAddress),
25015
+ new import_web331.PublicKey(bank.tokenAddress),
24718
25016
  mintData.tokenProgram.equals(import_spl_token7.TOKEN_2022_PROGRAM_ID) ? import_spl_token7.TOKEN_2022_PROGRAM_ID : void 0
24719
25017
  )
24720
25018
  );
@@ -24764,8 +25062,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24764
25062
  if (updateFeedIxs.length > 0) {
24765
25063
  feedCrankTxs.push(
24766
25064
  addTransactionMetadata(
24767
- new import_web330.VersionedTransaction(
24768
- new import_web330.TransactionMessage({
25065
+ new import_web331.VersionedTransaction(
25066
+ new import_web331.TransactionMessage({
24769
25067
  instructions: [...updateFeedIxs],
24770
25068
  payerKey: this.authority,
24771
25069
  recentBlockhash: blockhash
@@ -24780,8 +25078,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24780
25078
  }
24781
25079
  const lookupTables = await getClientAddressLookupTableAccounts(this.client);
24782
25080
  const withdrawTx = addTransactionMetadata(
24783
- new import_web330.VersionedTransaction(
24784
- new import_web330.TransactionMessage({
25081
+ new import_web331.VersionedTransaction(
25082
+ new import_web331.TransactionMessage({
24785
25083
  instructions: [...cuRequestIxs, ...withdrawIxs.instructions],
24786
25084
  payerKey: this.authority,
24787
25085
  recentBlockhash: blockhash
@@ -24795,7 +25093,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24795
25093
  );
24796
25094
  const destinationAccount = await _LendrAccountWrapper.fetch(destinationAccountPk, this.client);
24797
25095
  const depositIx = await destinationAccount.makeDepositIx(amount, bankAddress);
24798
- const tx = new import_web330.Transaction().add(...depositIx.instructions);
25096
+ const tx = new import_web331.Transaction().add(...depositIx.instructions);
24799
25097
  const depositTx = addTransactionMetadata(tx, {
24800
25098
  signers: depositIx.keys,
24801
25099
  addressLookupTables: lookupTables,
@@ -24874,7 +25172,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24874
25172
  }) {
24875
25173
  const blockhash = blockhashArg ?? (await this._program.provider.connection.getLatestBlockhash("confirmed")).blockhash;
24876
25174
  const setupIxs = await this.makeSetupIx([borrowBankAddress, depositBankAddress]);
24877
- const cuRequestIxs = this.makeComputeBudgetIx().length > 0 ? this.makeComputeBudgetIx() : [import_web330.ComputeBudgetProgram.setComputeUnitLimit({ units: 1e6 })];
25175
+ const cuRequestIxs = this.makeComputeBudgetIx().length > 0 ? this.makeComputeBudgetIx() : [import_web331.ComputeBudgetProgram.setComputeUnitLimit({ units: 1e6 })];
24878
25176
  const [priorityFeeIx] = makePriorityFeeIx(1e-5);
24879
25177
  const withdrawIxs = await this.makeWithdrawIx(withdrawAmount, depositBankAddress, withdrawAll, {
24880
25178
  createAtas: false,
@@ -24892,25 +25190,25 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24892
25190
  let flashloanTx;
24893
25191
  let txOverflown = false;
24894
25192
  if (setupIxs.length > 0) {
24895
- const message = new import_web330.TransactionMessage({
25193
+ const message = new import_web331.TransactionMessage({
24896
25194
  payerKey: this.client.wallet.publicKey,
24897
25195
  recentBlockhash: blockhash,
24898
25196
  instructions: setupIxs
24899
25197
  }).compileToLegacyMessage();
24900
25198
  additionalTxs.push(
24901
- addTransactionMetadata(new import_web330.VersionedTransaction(message), {
25199
+ addTransactionMetadata(new import_web331.VersionedTransaction(message), {
24902
25200
  type: "CREATE_ATA" /* CREATE_ATA */
24903
25201
  })
24904
25202
  );
24905
25203
  }
24906
25204
  if (updateFeedIxs.length > 0) {
24907
- const message = new import_web330.TransactionMessage({
25205
+ const message = new import_web331.TransactionMessage({
24908
25206
  payerKey: this.client.wallet.publicKey,
24909
25207
  recentBlockhash: blockhash,
24910
25208
  instructions: updateFeedIxs
24911
25209
  }).compileToV0Message(feedLuts);
24912
25210
  additionalTxs.push(
24913
- addTransactionMetadata(new import_web330.VersionedTransaction(message), {
25211
+ addTransactionMetadata(new import_web331.VersionedTransaction(message), {
24914
25212
  addressLookupTables: feedLuts,
24915
25213
  type: "CRANK" /* CRANK */
24916
25214
  })
@@ -24997,7 +25295,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
24997
25295
  if (!borrowBank) throw Error("Borrow bank not found");
24998
25296
  const blockhash = blockhashArg ?? (await this._program.provider.connection.getLatestBlockhash("confirmed")).blockhash;
24999
25297
  const setupIxs = await this.makeSetupIx(setupBankAddresses ?? [borrowBankAddress, depositBankAddress]);
25000
- const cuRequestIxs = this.makeComputeBudgetIx().length > 0 ? this.makeComputeBudgetIx() : [import_web330.ComputeBudgetProgram.setComputeUnitLimit({ units: 5e5 })];
25298
+ const cuRequestIxs = this.makeComputeBudgetIx().length > 0 ? this.makeComputeBudgetIx() : [import_web331.ComputeBudgetProgram.setComputeUnitLimit({ units: 5e5 })];
25001
25299
  const [priorityFeeIx] = makePriorityFeeIx(1e-5);
25002
25300
  const borrowIxs = await this.makeBorrowIx(borrowAmount, borrowBankAddress, {
25003
25301
  createAtas: false,
@@ -25020,25 +25318,25 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25020
25318
  setupIxs.push(...makeWrapSolIxs(this.authority, new import_bignumber15.default(inputDepositAmount)));
25021
25319
  }
25022
25320
  if (setupIxs.length > 0) {
25023
- const message = new import_web330.TransactionMessage({
25321
+ const message = new import_web331.TransactionMessage({
25024
25322
  payerKey: this.client.wallet.publicKey,
25025
25323
  recentBlockhash: blockhash,
25026
25324
  instructions: setupIxs
25027
25325
  }).compileToLegacyMessage();
25028
25326
  additionalTxs.push(
25029
- addTransactionMetadata(new import_web330.VersionedTransaction(message), {
25327
+ addTransactionMetadata(new import_web331.VersionedTransaction(message), {
25030
25328
  type: "CREATE_ATA" /* CREATE_ATA */
25031
25329
  })
25032
25330
  );
25033
25331
  }
25034
25332
  if (updateFeedIxs.length > 0) {
25035
- const message = new import_web330.TransactionMessage({
25333
+ const message = new import_web331.TransactionMessage({
25036
25334
  payerKey: this.client.wallet.publicKey,
25037
25335
  recentBlockhash: blockhash,
25038
25336
  instructions: updateFeedIxs
25039
25337
  }).compileToV0Message(feedLuts);
25040
25338
  additionalTxs.push(
25041
- addTransactionMetadata(new import_web330.VersionedTransaction(message), {
25339
+ addTransactionMetadata(new import_web331.VersionedTransaction(message), {
25042
25340
  addressLookupTables: feedLuts,
25043
25341
  type: "CRANK" /* CRANK */
25044
25342
  })
@@ -25115,7 +25413,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25115
25413
  */
25116
25414
  async makeCloseAccountTx() {
25117
25415
  const ix = await this.makeCloseAccountIx();
25118
- const tx = new import_web330.Transaction().add(...ix.instructions);
25416
+ const tx = new import_web331.Transaction().add(...ix.instructions);
25119
25417
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25120
25418
  return addTransactionMetadata(tx, {
25121
25419
  signers: ix.keys,
@@ -25180,12 +25478,12 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25180
25478
  ]);
25181
25479
  const stakeAccParsed = stakeAccInfoParsed?.value?.data;
25182
25480
  const [rentExemptReserve, minimumDelegation] = await Promise.all([
25183
- this._program.provider.connection.getMinimumBalanceForRentExemption(import_web330.StakeProgram.space),
25481
+ this._program.provider.connection.getMinimumBalanceForRentExemption(import_web331.StakeProgram.space),
25184
25482
  this._program.provider.connection.getStakeMinimumDelegation().then((res) => {
25185
- return Math.max(res.value, import_web330.LAMPORTS_PER_SOL);
25483
+ return Math.max(res.value, import_web331.LAMPORTS_PER_SOL);
25186
25484
  })
25187
25485
  ]);
25188
- const amountLamports = Math.round(Number(amount) * import_web330.LAMPORTS_PER_SOL);
25486
+ const amountLamports = Math.round(Number(amount) * import_web331.LAMPORTS_PER_SOL);
25189
25487
  const stakeAccLamports = Number(stakeAccParsed.parsed.info.stake?.delegation?.stake ?? 0);
25190
25488
  const isFullStake = amountLamports >= stakeAccLamports;
25191
25489
  const poolStakeAccLamports = (await this._program.provider.connection.getAccountInfo(poolStakeAddress))?.lamports ?? 0;
@@ -25206,11 +25504,11 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25206
25504
  }
25207
25505
  let targetStakePubkey;
25208
25506
  if (!isFullStake) {
25209
- const splitStakeAccount = import_web330.Keypair.generate();
25507
+ const splitStakeAccount = import_web331.Keypair.generate();
25210
25508
  signers.push(splitStakeAccount);
25211
25509
  targetStakePubkey = splitStakeAccount.publicKey;
25212
25510
  instructions2.push(
25213
- ...import_web330.StakeProgram.split(
25511
+ ...import_web331.StakeProgram.split(
25214
25512
  {
25215
25513
  stakePubkey: stakeAccountPk,
25216
25514
  authorizedPubkey: this.authority,
@@ -25224,17 +25522,17 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25224
25522
  targetStakePubkey = stakeAccountPk;
25225
25523
  }
25226
25524
  const [authorizeStakerIx, authorizeWithdrawIx] = await Promise.all([
25227
- import_web330.StakeProgram.authorize({
25525
+ import_web331.StakeProgram.authorize({
25228
25526
  stakePubkey: targetStakePubkey,
25229
25527
  authorizedPubkey: this.authority,
25230
25528
  newAuthorizedPubkey: auth,
25231
- stakeAuthorizationType: import_web330.StakeAuthorizationLayout.Staker
25529
+ stakeAuthorizationType: import_web331.StakeAuthorizationLayout.Staker
25232
25530
  }).instructions,
25233
- import_web330.StakeProgram.authorize({
25531
+ import_web331.StakeProgram.authorize({
25234
25532
  stakePubkey: targetStakePubkey,
25235
25533
  authorizedPubkey: this.authority,
25236
25534
  newAuthorizedPubkey: auth,
25237
- stakeAuthorizationType: import_web330.StakeAuthorizationLayout.Withdrawer
25535
+ stakeAuthorizationType: import_web331.StakeAuthorizationLayout.Withdrawer
25238
25536
  }).instructions
25239
25537
  ]);
25240
25538
  [authorizeStakerIx[0], authorizeWithdrawIx[0]].forEach((ix) => {
@@ -25247,7 +25545,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25247
25545
  const depositStakeIx = await SinglePoolInstruction.depositStake(pool, targetStakePubkey, lstAta, this.authority);
25248
25546
  const lendrDepositIxs = await this.makeDepositIx(newPoolTokens / 1e9, bankAddress, depositOpts);
25249
25547
  instructions2.push(depositStakeIx, ...lendrDepositIxs.instructions);
25250
- const transaction = new import_web330.Transaction().add(...instructions2);
25548
+ const transaction = new import_web331.Transaction().add(...instructions2);
25251
25549
  return addTransactionMetadata(transaction, {
25252
25550
  type: "DEPOSIT_STAKE" /* DEPOSIT_STAKE */,
25253
25551
  signers: [...signers, ...lendrDepositIxs.keys],
@@ -25255,7 +25553,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25255
25553
  });
25256
25554
  }
25257
25555
  async makeMergeStakeAccountsTx(stakeAccountSrc, stakeAccountDest) {
25258
- const mergeInstruction = import_web330.StakeProgram.merge({
25556
+ const mergeInstruction = import_web331.StakeProgram.merge({
25259
25557
  stakePubkey: stakeAccountDest,
25260
25558
  // Public key of the destination stake account
25261
25559
  sourceStakePubKey: stakeAccountSrc,
@@ -25263,7 +25561,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25263
25561
  authorizedPubkey: this.authority
25264
25562
  // Public key of the stake authority
25265
25563
  });
25266
- const transaction = new import_web330.Transaction().add(mergeInstruction);
25564
+ const transaction = new import_web331.Transaction().add(mergeInstruction);
25267
25565
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25268
25566
  return addTransactionMetadata(transaction, {
25269
25567
  type: "MERGE_STAKE_ACCOUNTS" /* MERGE_STAKE_ACCOUNTS */,
@@ -25332,7 +25630,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25332
25630
  */
25333
25631
  async makeDepositTx(amount, bankAddress, depositOpts = {}) {
25334
25632
  const ixs = await this.makeDepositIx(amount, bankAddress, depositOpts);
25335
- const tx = new import_web330.Transaction().add(...ixs.instructions);
25633
+ const tx = new import_web331.Transaction().add(...ixs.instructions);
25336
25634
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25337
25635
  const solanaTx = addTransactionMetadata(tx, {
25338
25636
  type: "DEPOSIT" /* DEPOSIT */,
@@ -25343,7 +25641,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25343
25641
  }
25344
25642
  async makeDepositWithSessionTx(amount, bankAddress, session, depositOpts = {}) {
25345
25643
  const ixs = await this.makeDepositWithSessionIx(amount, bankAddress, session, depositOpts);
25346
- const tx = new import_web330.Transaction().add(...ixs.instructions);
25644
+ const tx = new import_web331.Transaction().add(...ixs.instructions);
25347
25645
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25348
25646
  const solanaTx = addTransactionMetadata(tx, {
25349
25647
  type: "DEPOSIT" /* DEPOSIT */,
@@ -25364,7 +25662,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25364
25662
  async simulateBorrowLendTransaction(txs, banksToInspect, healthSimOptions) {
25365
25663
  const additionalTxs = [];
25366
25664
  if (healthSimOptions?.enabled) {
25367
- const computeIx = import_web330.ComputeBudgetProgram.setComputeUnitLimit({
25665
+ const computeIx = import_web331.ComputeBudgetProgram.setComputeUnitLimit({
25368
25666
  units: 14e5
25369
25667
  });
25370
25668
  const updateFeedIx = await this.makeUpdateFeedIx(healthSimOptions.mandatoryBanks);
@@ -25373,8 +25671,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25373
25671
  healthSimOptions.excludedBanks
25374
25672
  );
25375
25673
  const blockhash = (await this.client.provider.connection.getLatestBlockhash("confirmed")).blockhash;
25376
- const tx = new import_web330.VersionedTransaction(
25377
- new import_web330.TransactionMessage({
25674
+ const tx = new import_web331.VersionedTransaction(
25675
+ new import_web331.TransactionMessage({
25378
25676
  instructions: [computeIx, ...updateFeedIx.instructions, ...healthPulseIx.instructions],
25379
25677
  payerKey: this.client.provider.publicKey,
25380
25678
  recentBlockhash: blockhash
@@ -25545,7 +25843,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25545
25843
  */
25546
25844
  async makeRepayTx(amount, bankAddress, repayAll = false, repayOpts = {}) {
25547
25845
  const ixs = await this.makeRepayIx(amount, bankAddress, repayAll, repayOpts);
25548
- const tx = new import_web330.Transaction().add(...ixs.instructions);
25846
+ const tx = new import_web331.Transaction().add(...ixs.instructions);
25549
25847
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25550
25848
  const solanaTx = addTransactionMetadata(tx, {
25551
25849
  type: "REPAY" /* REPAY */,
@@ -25565,7 +25863,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25565
25863
  */
25566
25864
  async makeRepayWithSessionTx(amount, bankAddress, session, repayAll = false, repayOpts = {}) {
25567
25865
  const ixs = await this.makeRepayWithSessionIx(amount, bankAddress, session, repayAll, repayOpts);
25568
- const tx = new import_web330.Transaction().add(...ixs.instructions);
25866
+ const tx = new import_web331.Transaction().add(...ixs.instructions);
25569
25867
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25570
25868
  const solanaTx = addTransactionMetadata(tx, {
25571
25869
  type: "REPAY" /* REPAY */,
@@ -25648,7 +25946,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25648
25946
  if (!bankMetadata || !bankMetadata.validatorVoteAccount) {
25649
25947
  throw new Error("Validator vote account not found");
25650
25948
  }
25651
- const pool = findPoolAddress(new import_web330.PublicKey(bankMetadata.validatorVoteAccount));
25949
+ const pool = findPoolAddress(new import_web331.PublicKey(bankMetadata.validatorVoteAccount));
25652
25950
  const lstMint = findPoolMintAddress(pool);
25653
25951
  const mintAuthority = findPoolMintAuthorityAddress(pool);
25654
25952
  const lstAta = (0, import_spl_token7.getAssociatedTokenAddressSync)(lstMint, this.authority);
@@ -25658,8 +25956,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25658
25956
  createAtas: true,
25659
25957
  wrapAndUnwrapSol: true
25660
25958
  });
25661
- const stakeAccount = import_web330.Keypair.generate();
25662
- const createStakeAccountIx = import_web330.SystemProgram.createAccount({
25959
+ const stakeAccount = import_web331.Keypair.generate();
25960
+ const createStakeAccountIx = import_web331.SystemProgram.createAccount({
25663
25961
  fromPubkey: this.authority,
25664
25962
  newAccountPubkey: stakeAccount.publicKey,
25665
25963
  lamports: rentExemption,
@@ -25685,22 +25983,22 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25685
25983
  const {
25686
25984
  value: { blockhash }
25687
25985
  } = await this._program.provider.connection.getLatestBlockhashAndContext("confirmed");
25688
- const withdrawMessage = new import_web330.TransactionMessage({
25986
+ const withdrawMessage = new import_web331.TransactionMessage({
25689
25987
  payerKey: this.client.wallet.publicKey,
25690
25988
  recentBlockhash: blockhash,
25691
25989
  instructions: [...withdrawIxs.instructions]
25692
25990
  }).compileToV0Message(this.client.addressLookupTables);
25693
- const withdrawTxn = addTransactionMetadata(new import_web330.VersionedTransaction(withdrawMessage), {
25991
+ const withdrawTxn = addTransactionMetadata(new import_web331.VersionedTransaction(withdrawMessage), {
25694
25992
  signers: withdrawIxs.keys,
25695
25993
  addressLookupTables: this.client.addressLookupTables,
25696
25994
  type: "WITHDRAW" /* WITHDRAW */
25697
25995
  });
25698
- const stakeMessage = new import_web330.TransactionMessage({
25996
+ const stakeMessage = new import_web331.TransactionMessage({
25699
25997
  payerKey: this.client.wallet.publicKey,
25700
25998
  recentBlockhash: blockhash,
25701
25999
  instructions: [createStakeAccountIx, approveAccountAuthorityIx, withdrawStakeIx]
25702
26000
  }).compileToV0Message(this.client.addressLookupTables);
25703
- const stakeTxn = addTransactionMetadata(new import_web330.VersionedTransaction(stakeMessage), {
26001
+ const stakeTxn = addTransactionMetadata(new import_web331.VersionedTransaction(stakeMessage), {
25704
26002
  signers: [stakeAccount],
25705
26003
  addressLookupTables: this.client.addressLookupTables,
25706
26004
  type: "WITHDRAW_STAKE" /* WITHDRAW_STAKE */
@@ -25746,7 +26044,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25746
26044
  const cuRequestIxs = this.makeComputeBudgetIx();
25747
26045
  const withdrawIxs = withdrawIxsWrapped.flatMap((ix) => ix.instructions);
25748
26046
  const filteredSigners = withdrawIxsWrapped.flatMap((ix) => ix.keys).filter((key, index, self) => index === self.findIndex((k) => k.publicKey.equals(key.publicKey)));
25749
- const tx = new import_web330.Transaction().add(...cuRequestIxs, ...withdrawIxs);
26047
+ const tx = new import_web331.Transaction().add(...cuRequestIxs, ...withdrawIxs);
25750
26048
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25751
26049
  const solanaTx = addTransactionMetadata(tx, {
25752
26050
  signers: filteredSigners,
@@ -25831,8 +26129,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25831
26129
  if (updateFeedIxs.length > 0) {
25832
26130
  feedCrankTxs.push(
25833
26131
  addTransactionMetadata(
25834
- new import_web330.VersionedTransaction(
25835
- new import_web330.TransactionMessage({
26132
+ new import_web331.VersionedTransaction(
26133
+ new import_web331.TransactionMessage({
25836
26134
  instructions: [...updateFeedIxs],
25837
26135
  payerKey: this.authority,
25838
26136
  recentBlockhash: blockhash
@@ -25847,8 +26145,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25847
26145
  }
25848
26146
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25849
26147
  const withdrawTx = addTransactionMetadata(
25850
- new import_web330.VersionedTransaction(
25851
- new import_web330.TransactionMessage({
26148
+ new import_web331.VersionedTransaction(
26149
+ new import_web331.TransactionMessage({
25852
26150
  instructions: [...cuRequestIxs, ...withdrawIxs.instructions],
25853
26151
  payerKey: this.authority,
25854
26152
  recentBlockhash: blockhash
@@ -25884,8 +26182,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25884
26182
  if (updateFeedIxs.length > 0) {
25885
26183
  feedCrankTxs.push(
25886
26184
  addTransactionMetadata(
25887
- new import_web330.VersionedTransaction(
25888
- new import_web330.TransactionMessage({
26185
+ new import_web331.VersionedTransaction(
26186
+ new import_web331.TransactionMessage({
25889
26187
  instructions: [...updateFeedIxs],
25890
26188
  payerKey: this.authority,
25891
26189
  recentBlockhash: blockhash
@@ -25900,8 +26198,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
25900
26198
  }
25901
26199
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
25902
26200
  const withdrawTx = addTransactionMetadata(
25903
- new import_web330.VersionedTransaction(
25904
- new import_web330.TransactionMessage({
26201
+ new import_web331.VersionedTransaction(
26202
+ new import_web331.TransactionMessage({
25905
26203
  instructions: [...cuRequestIxs, ...withdrawIxs.instructions],
25906
26204
  payerKey: this.authority,
25907
26205
  recentBlockhash: blockhash
@@ -26034,8 +26332,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26034
26332
  if (updateFeedIxs.length > 0) {
26035
26333
  feedCrankTxs.push(
26036
26334
  addTransactionMetadata(
26037
- new import_web330.VersionedTransaction(
26038
- new import_web330.TransactionMessage({
26335
+ new import_web331.VersionedTransaction(
26336
+ new import_web331.TransactionMessage({
26039
26337
  instructions: updateFeedIxs,
26040
26338
  payerKey: this.authority,
26041
26339
  recentBlockhash: blockhash
@@ -26050,8 +26348,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26050
26348
  }
26051
26349
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
26052
26350
  const borrowTx = addTransactionMetadata(
26053
- new import_web330.VersionedTransaction(
26054
- new import_web330.TransactionMessage({
26351
+ new import_web331.VersionedTransaction(
26352
+ new import_web331.TransactionMessage({
26055
26353
  instructions: [...cuRequestIxs, ...borrowIxs.instructions],
26056
26354
  payerKey: this.authority,
26057
26355
  recentBlockhash: blockhash
@@ -26086,8 +26384,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26086
26384
  if (updateFeedIxs.length > 0) {
26087
26385
  feedCrankTxs.push(
26088
26386
  addTransactionMetadata(
26089
- new import_web330.VersionedTransaction(
26090
- new import_web330.TransactionMessage({
26387
+ new import_web331.VersionedTransaction(
26388
+ new import_web331.TransactionMessage({
26091
26389
  instructions: updateFeedIxs,
26092
26390
  payerKey: this.authority,
26093
26391
  recentBlockhash: blockhash
@@ -26102,8 +26400,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26102
26400
  }
26103
26401
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
26104
26402
  const borrowTx = addTransactionMetadata(
26105
- new import_web330.VersionedTransaction(
26106
- new import_web330.TransactionMessage({
26403
+ new import_web331.VersionedTransaction(
26404
+ new import_web331.TransactionMessage({
26107
26405
  instructions: [...cuRequestIxs, ...borrowIxs.instructions],
26108
26406
  payerKey: this.authority,
26109
26407
  recentBlockhash: blockhash
@@ -26156,8 +26454,8 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26156
26454
  );
26157
26455
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
26158
26456
  const emissionsTx = addTransactionMetadata(
26159
- new import_web330.VersionedTransaction(
26160
- new import_web330.TransactionMessage({
26457
+ new import_web331.VersionedTransaction(
26458
+ new import_web331.TransactionMessage({
26161
26459
  instructions: withdrawEmissionsIxs.flatMap((ix) => ix.instructions),
26162
26460
  payerKey: this.authority,
26163
26461
  recentBlockhash: blockhash
@@ -26244,7 +26542,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26244
26542
  assetQuantityUi,
26245
26543
  liabBankAddress
26246
26544
  );
26247
- const tx = new import_web330.Transaction().add(...liquidationIxs.instructions);
26545
+ const tx = new import_web331.Transaction().add(...liquidationIxs.instructions);
26248
26546
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
26249
26547
  const solanaTx = addTransactionMetadata(tx, {
26250
26548
  signers: liquidationIxs.keys,
@@ -26337,12 +26635,12 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26337
26635
  const flashloanIxs = [...beginFlashLoanIx.instructions, ...args.ixs, ...endFlashLoanIx.instructions];
26338
26636
  const totalLookupTables = [...lookupTables ?? [], ...args.addressLookupTableAccounts ?? []];
26339
26637
  const blockhash = args.blockhash ?? (await this._program.provider.connection.getLatestBlockhash("confirmed")).blockhash;
26340
- const message = new import_web330.TransactionMessage({
26638
+ const message = new import_web331.TransactionMessage({
26341
26639
  payerKey: this.client.wallet.publicKey,
26342
26640
  recentBlockhash: blockhash,
26343
26641
  instructions: flashloanIxs
26344
26642
  }).compileToV0Message(totalLookupTables);
26345
- const tx = addTransactionMetadata(new import_web330.VersionedTransaction(message), {
26643
+ const tx = addTransactionMetadata(new import_web331.VersionedTransaction(message), {
26346
26644
  addressLookupTables: totalLookupTables,
26347
26645
  type: "FLASHLOAN" /* FLASHLOAN */
26348
26646
  });
@@ -26359,12 +26657,12 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26359
26657
  const flashloanIxs = [...beginFlashLoanIx.instructions, ...args.ixs, ...endFlashLoanIx.instructions];
26360
26658
  const totalLookupTables = lookupTables || [];
26361
26659
  const blockhash = args.blockhash ?? (await this._program.provider.connection.getLatestBlockhash("confirmed")).blockhash;
26362
- const message = new import_web330.TransactionMessage({
26660
+ const message = new import_web331.TransactionMessage({
26363
26661
  payerKey: session.payer,
26364
26662
  recentBlockhash: blockhash,
26365
26663
  instructions: flashloanIxs
26366
26664
  }).compileToV0Message(totalLookupTables);
26367
- const tx = addTransactionMetadata(new import_web330.VersionedTransaction(message), {
26665
+ const tx = addTransactionMetadata(new import_web331.VersionedTransaction(message), {
26368
26666
  addressLookupTables: totalLookupTables,
26369
26667
  type: "FLASHLOAN" /* FLASHLOAN */
26370
26668
  });
@@ -26382,7 +26680,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26382
26680
  "[lendr:lendr-account:transfer-authority] Transferring account"
26383
26681
  );
26384
26682
  const ixs = await this.makeTransferAccountAuthorityIx(newAccountAuthority);
26385
- const tx = new import_web330.Transaction().add(...ixs.instructions);
26683
+ const tx = new import_web331.Transaction().add(...ixs.instructions);
26386
26684
  const solanaTx = addTransactionMetadata(tx, {
26387
26685
  type: "TRANSFER_AUTH" /* TRANSFER_AUTH */
26388
26686
  });
@@ -26446,7 +26744,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26446
26744
  */
26447
26745
  async simulateDeposit(amount, bankAddress) {
26448
26746
  const ixs = await this.makeDepositIx(amount, bankAddress);
26449
- const tx = new import_web330.Transaction().add(...ixs.instructions);
26747
+ const tx = new import_web331.Transaction().add(...ixs.instructions);
26450
26748
  try {
26451
26749
  return this.simulateBorrowLendTransaction([tx], [bankAddress]);
26452
26750
  } catch (_e) {
@@ -26478,7 +26776,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26478
26776
  */
26479
26777
  async simulateRepay(amount, bankAddress, repayAll = false) {
26480
26778
  const ixs = await this.makeRepayIx(amount, bankAddress, repayAll);
26481
- const tx = new import_web330.Transaction().add(...ixs.instructions);
26779
+ const tx = new import_web331.Transaction().add(...ixs.instructions);
26482
26780
  try {
26483
26781
  return this.simulateBorrowLendTransaction([tx], [bankAddress]);
26484
26782
  } catch (_e) {
@@ -26487,7 +26785,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26487
26785
  }
26488
26786
  async getBankUnclaimedOutstandingEmissions(bank) {
26489
26787
  const settleEmissionsIx = await this._lendrAccount.makeSettleEmissionsIx(this._program, bank);
26490
- const tx = new import_web330.Transaction().add(...settleEmissionsIx.instructions);
26788
+ const tx = new import_web331.Transaction().add(...settleEmissionsIx.instructions);
26491
26789
  const simulation = await this.client.simulateTransactions([tx], [this._lendrAccount.address]);
26492
26790
  const rawBuffer = simulation[0];
26493
26791
  if (!rawBuffer) {
@@ -26522,6 +26820,10 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26522
26820
  { pubkey: balBank.address, isSigner: false, isWritable: false },
26523
26821
  { pubkey: balBank.config.oracleKeys[0], isSigner: false, isWritable: false }
26524
26822
  );
26823
+ const fogoStakePool = getFogoStakePoolAddress(balBank.config);
26824
+ if (fogoStakePool) {
26825
+ remainingAccounts.push({ pubkey: fogoStakePool, isSigner: false, isWritable: false });
26826
+ }
26525
26827
  }
26526
26828
  const ix = await instructions_default.makeHandleBankruptcyIx(
26527
26829
  this._program,
@@ -26561,7 +26863,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
26561
26863
  "[lendr:lendr-account:handle-bankruptcy] Handling bankruptcy for lendr account"
26562
26864
  );
26563
26865
  const bankruptcyIxs = await this.makeHandleBankruptcyIx(bankAddress);
26564
- const tx = new import_web330.Transaction().add(...bankruptcyIxs.instructions);
26866
+ const tx = new import_web331.Transaction().add(...bankruptcyIxs.instructions);
26565
26867
  const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
26566
26868
  const solanaTx = addTransactionMetadata(tx, {
26567
26869
  addressLookupTables: clientLookupTables,
@@ -26594,7 +26896,7 @@ function makeTxPriorityIx(feePayer, feeUi = 0, broadcastType = "BUNDLE", compute
26594
26896
  let bundleTipIx;
26595
26897
  let priorityFeeIx = makePriorityFeeIx()[0];
26596
26898
  if (broadcastType === "BUNDLE") {
26597
- bundleTipIx = makeBundleTipIx(feePayer, Math.trunc(feeUi * import_web330.LAMPORTS_PER_SOL));
26899
+ bundleTipIx = makeBundleTipIx(feePayer, Math.trunc(feeUi * import_web331.LAMPORTS_PER_SOL));
26598
26900
  } else {
26599
26901
  priorityFeeIx = makePriorityFeeIx(feeUi, computeUnitsLimit)[0];
26600
26902
  }
@@ -26631,9 +26933,9 @@ function makeBundleTipIx(feePayer, bundleTip = 1e5) {
26631
26933
  "3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT"
26632
26934
  ];
26633
26935
  const randomTipAccount = tipAccounts[Math.floor(Math.random() * tipAccounts.length)];
26634
- return import_web330.SystemProgram.transfer({
26936
+ return import_web331.SystemProgram.transfer({
26635
26937
  fromPubkey: feePayer,
26636
- toPubkey: new import_web330.PublicKey(randomTipAccount),
26938
+ toPubkey: new import_web331.PublicKey(randomTipAccount),
26637
26939
  lamports: bundleTip
26638
26940
  // 100_000 lamports = 0.0001 SOL
26639
26941
  });
@@ -26918,7 +27220,7 @@ var LendrClient = class _LendrClient {
26918
27220
  const bankConfigs = [];
26919
27221
  for (const bank of banksRawData) {
26920
27222
  mintKeys.push(bank.data.mint);
26921
- if (!bank.data.emissionsMint.equals(import_web331.PublicKey.default)) {
27223
+ if (!bank.data.emissionsMint.equals(import_web332.PublicKey.default)) {
26922
27224
  emissionMintKeys.push(bank.data.emissionsMint);
26923
27225
  }
26924
27226
  bankConfigs.push(bank.data.config);
@@ -26928,7 +27230,7 @@ var LendrClient = class _LendrClient {
26928
27230
  const bankConfig = BankConfig.fromAccountParsed(bank.data.config);
26929
27231
  const oracleSetup = bankConfig.oracleSetup;
26930
27232
  let oracleKey;
26931
- if (oracleSetup === "PythPushOracle" /* PythPushOracle */ || oracleSetup === "KaminoPythPush" /* KaminoPythPush */) {
27233
+ if (oracleSetup === "PythPushOracle" /* PythPushOracle */ || oracleSetup === "KaminoPythPush" /* KaminoPythPush */ || oracleSetup === "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */) {
26932
27234
  const rawKey = bankConfig.oracleKeys[0];
26933
27235
  const feedId = rawKey.toBuffer().toString("hex");
26934
27236
  const feedInfo = feedIdMap.get(feedId);
@@ -26952,10 +27254,10 @@ var LendrClient = class _LendrClient {
26952
27254
  }
26953
27255
  oracleKeys.push(oracleKey);
26954
27256
  }
26955
- const uniqueOracleKeys = Array.from(new Set(oracleKeys.map((k) => k.toBase58()))).map((k) => new import_web331.PublicKey(k));
26956
- const uniqueMintKeys = Array.from(new Set(mintKeys.map((k) => k.toBase58()))).map((k) => new import_web331.PublicKey(k));
27257
+ const uniqueOracleKeys = Array.from(new Set(oracleKeys.map((k) => k.toBase58()))).map((k) => new import_web332.PublicKey(k));
27258
+ const uniqueMintKeys = Array.from(new Set(mintKeys.map((k) => k.toBase58()))).map((k) => new import_web332.PublicKey(k));
26957
27259
  const uniqueEmissionMintKeys = Array.from(new Set(emissionMintKeys.map((k) => k.toBase58()))).map(
26958
- (k) => new import_web331.PublicKey(k)
27260
+ (k) => new import_web332.PublicKey(k)
26959
27261
  );
26960
27262
  const allAccountInfos = await chunkedGetRawMultipleAccountInfoOrderedWithNulls(program.provider.connection, [
26961
27263
  groupAddress.toBase58(),
@@ -27016,6 +27318,8 @@ var LendrClient = class _LendrClient {
27016
27318
  const stakedCollatMap = {};
27017
27319
  const solPools = [];
27018
27320
  const mints = [];
27321
+ const fogoStakePoolMap = {};
27322
+ const fogoStakePools = [];
27019
27323
  banksRawData.forEach(({ address, data }, index) => {
27020
27324
  const bankAddressStr = address.toBase58();
27021
27325
  const metadata = banksExtendedMetadata.get(data.mint.toBase58());
@@ -27037,7 +27341,7 @@ var LendrClient = class _LendrClient {
27037
27341
  const bank = Bank.fromAccountParsed(address, data, feedIdMap, metadata, mintDataRaw.owner);
27038
27342
  banks.set(bankAddressStr, bank);
27039
27343
  let emissionTokenProgram = null;
27040
- if (!data.emissionsMint.equals(import_web331.PublicKey.default)) {
27344
+ if (!data.emissionsMint.equals(import_web332.PublicKey.default)) {
27041
27345
  const emissionMintDataRawIndex = emissionMintKeys.findIndex((pk) => pk.equals(data.emissionsMint));
27042
27346
  const emissionMintAccountInfo = emissionMintDataRawIndex >= 0 ? emissionMintAccountInfos[emissionMintDataRawIndex] : null;
27043
27347
  emissionTokenProgram = emissionMintAccountInfo ? emissionMintAccountInfo.owner : null;
@@ -27050,23 +27354,31 @@ var LendrClient = class _LendrClient {
27050
27354
  });
27051
27355
  priceInfos.set(bankAddressStr, parseOraclePriceData(oracleSetup, priceDataRaw.data, bank.config.fixedPrice, logger));
27052
27356
  if (oracleSetup === "StakedWithPythPush" /* StakedWithPythPush */ && metadata?.validatorVoteAccount) {
27053
- const [poolAddress] = import_web331.PublicKey.findProgramAddressSync(
27054
- [Buffer.from("pool"), new import_web331.PublicKey(metadata.validatorVoteAccount).toBuffer()],
27357
+ const [poolAddress] = import_web332.PublicKey.findProgramAddressSync(
27358
+ [Buffer.from("pool"), new import_web332.PublicKey(metadata.validatorVoteAccount).toBuffer()],
27055
27359
  SINGLE_POOL_PROGRAM_ID
27056
27360
  );
27057
- const [stakePoolAddress] = import_web331.PublicKey.findProgramAddressSync(
27361
+ const [stakePoolAddress] = import_web332.PublicKey.findProgramAddressSync(
27058
27362
  [Buffer.from("stake"), poolAddress.toBuffer()],
27059
27363
  SINGLE_POOL_PROGRAM_ID
27060
27364
  );
27061
27365
  stakedCollatMap[address.toBase58()] = {
27062
27366
  bankAddress: address,
27063
- mint: new import_web331.PublicKey(metadata.mint),
27367
+ mint: new import_web332.PublicKey(metadata.mint),
27064
27368
  stakePoolAddress,
27065
27369
  poolAddress
27066
27370
  };
27067
27371
  solPools.push(stakePoolAddress.toBase58());
27068
27372
  mints.push(metadata.mint);
27069
27373
  }
27374
+ const fogoStakePool = getFogoStakePoolAddress(bank.config);
27375
+ if (fogoStakePool) {
27376
+ fogoStakePoolMap[address.toBase58()] = {
27377
+ bankAddress: address,
27378
+ stakePoolAddress: fogoStakePool
27379
+ };
27380
+ fogoStakePools.push(fogoStakePool.toBase58());
27381
+ }
27070
27382
  });
27071
27383
  const dataAis = await chunkedGetRawMultipleAccountInfoOrdered(program.provider.connection, [...mints, ...solPools]);
27072
27384
  const stakePoolsAis = dataAis.slice(mints.length).map((ai) => getStakeAccount(ai.data));
@@ -27083,7 +27395,7 @@ var LendrClient = class _LendrClient {
27083
27395
  const oracle = priceInfos.get(bankAddress.toBase58());
27084
27396
  if (oracle) {
27085
27397
  const adjustPrice = (price, stakeActual2, tokenSupply2) => {
27086
- return Number(tokenSupply2) === 0 ? price : new import_bignumber16.default(price.toNumber() * (stakeActual2 - import_web331.LAMPORTS_PER_SOL) / Number(tokenSupply2));
27398
+ return Number(tokenSupply2) === 0 ? price : new import_bignumber16.default(price.toNumber() * (stakeActual2 - import_web332.LAMPORTS_PER_SOL) / Number(tokenSupply2));
27087
27399
  };
27088
27400
  const adjustPriceComponent2 = (priceComponent, stakeActual2, tokenSupply2) => ({
27089
27401
  price: adjustPrice(priceComponent.price, stakeActual2, tokenSupply2),
@@ -27099,6 +27411,50 @@ var LendrClient = class _LendrClient {
27099
27411
  priceInfos.set(bankAddress.toBase58(), oraclePrice);
27100
27412
  }
27101
27413
  }
27414
+ if (fogoStakePools.length > 0) {
27415
+ const fogoStakePoolAis = await chunkedGetRawMultipleAccountInfoOrdered(
27416
+ program.provider.connection,
27417
+ fogoStakePools
27418
+ );
27419
+ const fogoStakePoolRecord = {};
27420
+ for (let i = 0; i < fogoStakePools.length; i++) {
27421
+ const accountInfo = fogoStakePoolAis[i];
27422
+ if (accountInfo) {
27423
+ try {
27424
+ fogoStakePoolRecord[fogoStakePools[i]] = parseFogoStakePool(accountInfo.data);
27425
+ } catch (e) {
27426
+ logger.warn({ stakePool: fogoStakePools[i], error: e }, "Failed to parse Fogo stake pool");
27427
+ }
27428
+ }
27429
+ }
27430
+ for (const index in fogoStakePoolMap) {
27431
+ const { bankAddress, stakePoolAddress } = fogoStakePoolMap[index];
27432
+ const stakePool = fogoStakePoolRecord[stakePoolAddress.toBase58()];
27433
+ if (!stakePool) {
27434
+ logger.warn({ bankAddress: bankAddress.toBase58() }, "Fogo stake pool data not found");
27435
+ continue;
27436
+ }
27437
+ const oracle = priceInfos.get(bankAddress.toBase58());
27438
+ if (oracle) {
27439
+ const exchangeRate = calculateFogoExchangeRate(stakePool);
27440
+ const adjustFogoPrice = (price) => {
27441
+ return price.times(exchangeRate);
27442
+ };
27443
+ const adjustFogoPriceComponent = (priceComponent) => ({
27444
+ price: adjustFogoPrice(priceComponent.price),
27445
+ confidence: priceComponent.confidence.times(exchangeRate),
27446
+ lowestPrice: adjustFogoPrice(priceComponent.lowestPrice),
27447
+ highestPrice: adjustFogoPrice(priceComponent.highestPrice)
27448
+ });
27449
+ const oraclePrice = {
27450
+ timestamp: oracle.timestamp,
27451
+ priceRealtime: adjustFogoPriceComponent(oracle.priceRealtime),
27452
+ priceWeighted: adjustFogoPriceComponent(oracle.priceWeighted)
27453
+ };
27454
+ priceInfos.set(bankAddress.toBase58(), oraclePrice);
27455
+ }
27456
+ }
27457
+ }
27102
27458
  logger.debug(
27103
27459
  {
27104
27460
  banksSize: banks.size,
@@ -27350,7 +27706,7 @@ var LendrClient = class _LendrClient {
27350
27706
  * @returns Object containing the transaction signature and the created LendrAccount instance
27351
27707
  */
27352
27708
  async createLendrAccount(createOpts, processOpts, txOpts) {
27353
- const accountKeypair = import_web331.Keypair.generate();
27709
+ const accountKeypair = import_web332.Keypair.generate();
27354
27710
  const newAccountKey = createOpts?.newAccountKey ?? accountKeypair.publicKey;
27355
27711
  const solanaTx = await this.createLendrAccountTx({ accountKeypair });
27356
27712
  const sig = await this.processTransaction(solanaTx, processOpts, txOpts);
@@ -27371,7 +27727,7 @@ var LendrClient = class _LendrClient {
27371
27727
  const txResult = await session.sendTransaction(instructions2, { variation: "LendrAccountInitialize" });
27372
27728
  this.logger.debug({ txResult }, "Created Lendr account (using session)");
27373
27729
  const thirdPartyIdValue = thirdPartyId ?? 0;
27374
- const [accountPublicKey] = import_web331.PublicKey.findProgramAddressSync(
27730
+ const [accountPublicKey] = import_web332.PublicKey.findProgramAddressSync(
27375
27731
  [
27376
27732
  Buffer.from("lendr_account"),
27377
27733
  this.groupAddress.toBuffer(),
@@ -27404,11 +27760,11 @@ var LendrClient = class _LendrClient {
27404
27760
  * @returns Transaction that can be used to create a new lendr account
27405
27761
  */
27406
27762
  async createLendrAccountTx(createOpts) {
27407
- const accountKeypair = createOpts?.accountKeypair ?? import_web331.Keypair.generate();
27763
+ const accountKeypair = createOpts?.accountKeypair ?? import_web332.Keypair.generate();
27408
27764
  const ixs = await this.makeCreateLendrAccountIx(accountKeypair.publicKey);
27409
27765
  const signers = [...ixs.keys];
27410
27766
  signers.push(accountKeypair);
27411
- const tx = new import_web331.Transaction().add(...ixs.instructions);
27767
+ const tx = new import_web332.Transaction().add(...ixs.instructions);
27412
27768
  const solanaTx = addTransactionMetadata(tx, {
27413
27769
  signers,
27414
27770
  addressLookupTables: this.addressLookupTables,
@@ -27420,18 +27776,18 @@ var LendrClient = class _LendrClient {
27420
27776
  try {
27421
27777
  return (await this.provider.connection.getLatestBlockhashAndContext("confirmed")).value.blockhash;
27422
27778
  } catch (_ex) {
27423
- const connection = new import_web331.Connection(this.provider.connection.rpcEndpoint, this.provider.opts);
27779
+ const connection = new import_web332.Connection(this.provider.connection.rpcEndpoint, this.provider.opts);
27424
27780
  return (await connection.getLatestBlockhashAndContext("confirmed")).value.blockhash;
27425
27781
  }
27426
27782
  }
27427
27783
  async createVersionTransaction(instructions2, payerKey, signers, extraMetaData) {
27428
27784
  const blockhash = await this.getLatestBlockHashForSure();
27429
- const versionedMessage = new import_web331.TransactionMessage({
27785
+ const versionedMessage = new import_web332.TransactionMessage({
27430
27786
  instructions: instructions2,
27431
27787
  payerKey,
27432
27788
  recentBlockhash: blockhash
27433
27789
  });
27434
- const tx = new import_web331.VersionedTransaction(
27790
+ const tx = new import_web332.VersionedTransaction(
27435
27791
  this.addressLookupTables ? versionedMessage.compileToV0Message(this.addressLookupTables) : versionedMessage.compileToLegacyMessage()
27436
27792
  );
27437
27793
  if (signers?.length) {
@@ -27487,10 +27843,10 @@ var LendrClient = class _LendrClient {
27487
27843
  txOpts,
27488
27844
  processOpts
27489
27845
  }) {
27490
- const keypair = seed ?? import_web331.Keypair.generate();
27846
+ const keypair = seed ?? import_web332.Keypair.generate();
27491
27847
  const bankIxs = await this.group.makePoolAddBankIx(this.program, keypair.publicKey, mint, bankConfig, admin);
27492
27848
  const signers = [...bankIxs.keys, keypair];
27493
- const tx = new import_web331.Transaction().add(...bankIxs.instructions);
27849
+ const tx = new import_web332.Transaction().add(...bankIxs.instructions);
27494
27850
  const solanaTx = addTransactionMetadata(tx, {
27495
27851
  signers,
27496
27852
  addressLookupTables: this.addressLookupTables,
@@ -27510,10 +27866,10 @@ var LendrClient = class _LendrClient {
27510
27866
  * @returns The public key of the newly created lendr group.
27511
27867
  */
27512
27868
  async createLendrGroup(seed, additionalIxs, processOpts, txOpts) {
27513
- const accountKeypair = seed ?? import_web331.Keypair.generate();
27869
+ const accountKeypair = seed ?? import_web332.Keypair.generate();
27514
27870
  const ixs = await this.makeCreateLendrGroupIx(accountKeypair.publicKey);
27515
27871
  const signers = [...ixs.keys, accountKeypair];
27516
- const tx = new import_web331.Transaction().add(...ixs.instructions, ...additionalIxs ?? []);
27872
+ const tx = new import_web332.Transaction().add(...ixs.instructions, ...additionalIxs ?? []);
27517
27873
  const solanaTx = addTransactionMetadata(tx, {
27518
27874
  signers,
27519
27875
  addressLookupTables: this.addressLookupTables,
@@ -27534,10 +27890,10 @@ var LendrClient = class _LendrClient {
27534
27890
  * @returns The bank's public key and the transaction signature
27535
27891
  */
27536
27892
  async createLendingPool(bankMint, bankConfig, seed, processOpts, txOpts) {
27537
- const bankKeypair = seed ?? import_web331.Keypair.generate();
27893
+ const bankKeypair = seed ?? import_web332.Keypair.generate();
27538
27894
  const ixs = await this.group.makePoolAddBankIx(this.program, bankKeypair.publicKey, bankMint, bankConfig);
27539
27895
  const signers = [...ixs.keys, bankKeypair];
27540
- const tx = new import_web331.Transaction().add(...ixs.instructions);
27896
+ const tx = new import_web332.Transaction().add(...ixs.instructions);
27541
27897
  const solanaTx = addTransactionMetadata(tx, {
27542
27898
  signers,
27543
27899
  addressLookupTables: this.addressLookupTables,
@@ -27613,7 +27969,7 @@ var LendrClient = class _LendrClient {
27613
27969
  }
27614
27970
  async simulateTransactions(transactions, accountsToInspect) {
27615
27971
  const versionedTransactions = [];
27616
- const connection = new import_web331.Connection(this.provider.connection.rpcEndpoint, this.provider.opts);
27972
+ const connection = new import_web332.Connection(this.provider.connection.rpcEndpoint, this.provider.opts);
27617
27973
  let blockhash;
27618
27974
  try {
27619
27975
  const getLatestBlockhashAndContext = await connection.getLatestBlockhashAndContext("confirmed");
@@ -27622,13 +27978,13 @@ var LendrClient = class _LendrClient {
27622
27978
  if (isV0Tx(transaction)) {
27623
27979
  versionedTransactions.push(transaction);
27624
27980
  } else {
27625
- const versionedMessage = new import_web331.TransactionMessage({
27981
+ const versionedMessage = new import_web332.TransactionMessage({
27626
27982
  instructions: transaction.instructions,
27627
27983
  payerKey: this.provider.publicKey,
27628
27984
  recentBlockhash: blockhash
27629
27985
  });
27630
27986
  versionedTransactions.push(
27631
- new import_web331.VersionedTransaction(versionedMessage.compileToV0Message(this.addressLookupTables))
27987
+ new import_web332.VersionedTransaction(versionedMessage.compileToV0Message(this.addressLookupTables))
27632
27988
  );
27633
27989
  }
27634
27990
  }
@@ -27767,6 +28123,7 @@ var EmodeSettings = class _EmodeSettings {
27767
28123
  EmodeSettings,
27768
28124
  EmodeTag,
27769
28125
  FLASHLOAN_ENABLED_FLAG,
28126
+ FOGO_STAKE_POOL_PROGRAM_ID,
27770
28127
  FogoMetadataFetcher,
27771
28128
  GROUP_PK,
27772
28129
  HOURS_PER_YEAR,
@@ -27903,6 +28260,7 @@ var EmodeSettings = class _EmodeSettings {
27903
28260
  getBankVaultSeeds,
27904
28261
  getConfig,
27905
28262
  getConfigPda,
28263
+ getFogoStakePoolAddress,
27906
28264
  getHealthCacheStatusDescription,
27907
28265
  getLiabilityQuantity,
27908
28266
  getLiabilityShares,