@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/{bank-metadata-C06TNYXi.d.cts → bank-metadata-DXKlJh78.d.cts} +185 -1
- package/dist/{bank-metadata-C06TNYXi.d.ts → bank-metadata-DXKlJh78.d.ts} +185 -1
- package/dist/common/index.cjs +1 -0
- package/dist/common/index.d.cts +2 -2
- package/dist/common/index.d.ts +2 -2
- package/dist/common/index.js +1 -0
- package/dist/index.cjs +618 -260
- package/dist/index.d.cts +93 -6
- package/dist/index.d.ts +93 -6
- package/dist/index.js +482 -126
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -88,7 +88,7 @@ var init_misc = __esm({
|
|
|
88
88
|
|
|
89
89
|
// src/constants/programs.ts
|
|
90
90
|
import { PublicKey as PublicKey4 } from "@solana/web3.js";
|
|
91
|
-
var 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;
|
|
91
|
+
var 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;
|
|
92
92
|
var init_programs = __esm({
|
|
93
93
|
"src/constants/programs.ts"() {
|
|
94
94
|
"use strict";
|
|
@@ -103,6 +103,7 @@ var init_programs = __esm({
|
|
|
103
103
|
SYSVAR_CLOCK_ID = new PublicKey4("SysvarC1ock11111111111111111111111111111111");
|
|
104
104
|
SYSVAR_STAKE_HISTORY_ID = new PublicKey4("SysvarStakeHistory1111111111111111111111111");
|
|
105
105
|
STAKE_CONFIG_ID = new PublicKey4("StakeConfig11111111111111111111111111111111");
|
|
106
|
+
FOGO_STAKE_POOL_PROGRAM_ID = new PublicKey4("SP1s4uFeTAX9jsXXmwyDs1gxYYf7cdDZ8qHUHVxE1yr");
|
|
106
107
|
}
|
|
107
108
|
});
|
|
108
109
|
|
|
@@ -164,7 +165,7 @@ __export(single_spl_pool_exports, {
|
|
|
164
165
|
import { TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID3 } from "@solana/spl-token";
|
|
165
166
|
import {
|
|
166
167
|
LAMPORTS_PER_SOL as LAMPORTS_PER_SOL2,
|
|
167
|
-
PublicKey as
|
|
168
|
+
PublicKey as PublicKey11,
|
|
168
169
|
STAKE_CONFIG_ID as STAKE_CONFIG_ID2,
|
|
169
170
|
StakeProgram,
|
|
170
171
|
SYSVAR_CLOCK_PUBKEY,
|
|
@@ -373,7 +374,7 @@ var init_single_spl_pool = __esm({
|
|
|
373
374
|
};
|
|
374
375
|
};
|
|
375
376
|
findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
|
|
376
|
-
const [pda] =
|
|
377
|
+
const [pda] = PublicKey11.findProgramAddressSync([Buffer.from(prefix), baseAddress.toBuffer()], programId);
|
|
377
378
|
return pda;
|
|
378
379
|
};
|
|
379
380
|
findPoolMintAddressByVoteAccount = (voteAccountAddress) => findPda(findPoolAddress(voteAccountAddress), "mint");
|
|
@@ -385,7 +386,7 @@ var init_single_spl_pool = __esm({
|
|
|
385
386
|
findPoolMplAuthorityAddress = (poolAddress) => findPda(poolAddress, "mpl_authority");
|
|
386
387
|
findPoolOnRampAddress = (poolAddress) => findPda(poolAddress, "onramp");
|
|
387
388
|
findMplMetadataAddress = async (poolMintAddress) => {
|
|
388
|
-
const [pda] =
|
|
389
|
+
const [pda] = PublicKey11.findProgramAddressSync(
|
|
389
390
|
[Buffer.from("metadata"), MPL_METADATA_PROGRAM_ID.toBuffer(), poolMintAddress.toBuffer()],
|
|
390
391
|
MPL_METADATA_PROGRAM_ID
|
|
391
392
|
);
|
|
@@ -456,7 +457,7 @@ import {
|
|
|
456
457
|
Connection,
|
|
457
458
|
Keypair as Keypair4,
|
|
458
459
|
LAMPORTS_PER_SOL as LAMPORTS_PER_SOL6,
|
|
459
|
-
PublicKey as
|
|
460
|
+
PublicKey as PublicKey29,
|
|
460
461
|
Transaction as Transaction3,
|
|
461
462
|
TransactionMessage as TransactionMessage6,
|
|
462
463
|
VersionedTransaction as VersionedTransaction6
|
|
@@ -1270,12 +1271,12 @@ init_constants();
|
|
|
1270
1271
|
import { LangErrorMessage } from "@coral-xyz/anchor";
|
|
1271
1272
|
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
|
1272
1273
|
|
|
1273
|
-
// src/idl/lendr_0.1.
|
|
1274
|
-
var
|
|
1275
|
-
address: "
|
|
1274
|
+
// src/idl/lendr_0.1.7.json
|
|
1275
|
+
var lendr_0_1_7_default = {
|
|
1276
|
+
address: "",
|
|
1276
1277
|
metadata: {
|
|
1277
1278
|
name: "lendr",
|
|
1278
|
-
version: "0.1.
|
|
1279
|
+
version: "0.1.7",
|
|
1279
1280
|
spec: "0.1.0",
|
|
1280
1281
|
description: "Borrow Lending Prime Broker"
|
|
1281
1282
|
},
|
|
@@ -4134,6 +4135,208 @@ var lendr_0_1_6_default = {
|
|
|
4134
4135
|
}
|
|
4135
4136
|
]
|
|
4136
4137
|
},
|
|
4138
|
+
{
|
|
4139
|
+
name: "lending_pool_add_bank_permissionless_fogo_stake_pool",
|
|
4140
|
+
docs: [
|
|
4141
|
+
"Permissionlessly add a bank for Fogo Stake Pool LST tokens.",
|
|
4142
|
+
"Similar to lending_pool_add_bank_permissionless but for fogo-stake-pool program LSTs."
|
|
4143
|
+
],
|
|
4144
|
+
discriminator: [70, 105, 223, 175, 19, 138, 253, 208],
|
|
4145
|
+
accounts: [
|
|
4146
|
+
{
|
|
4147
|
+
name: "lendr_group",
|
|
4148
|
+
writable: true,
|
|
4149
|
+
relations: ["staked_settings"]
|
|
4150
|
+
},
|
|
4151
|
+
{
|
|
4152
|
+
name: "staked_settings"
|
|
4153
|
+
},
|
|
4154
|
+
{
|
|
4155
|
+
name: "fee_payer",
|
|
4156
|
+
writable: true,
|
|
4157
|
+
signer: true
|
|
4158
|
+
},
|
|
4159
|
+
{
|
|
4160
|
+
name: "fee_state",
|
|
4161
|
+
pda: {
|
|
4162
|
+
seeds: [
|
|
4163
|
+
{
|
|
4164
|
+
kind: "const",
|
|
4165
|
+
value: [102, 101, 101, 115, 116, 97, 116, 101]
|
|
4166
|
+
}
|
|
4167
|
+
]
|
|
4168
|
+
}
|
|
4169
|
+
},
|
|
4170
|
+
{
|
|
4171
|
+
name: "global_fee_wallet",
|
|
4172
|
+
writable: true,
|
|
4173
|
+
relations: ["fee_state"]
|
|
4174
|
+
},
|
|
4175
|
+
{
|
|
4176
|
+
name: "bank_mint",
|
|
4177
|
+
docs: [
|
|
4178
|
+
"Mint of the Fogo Stake Pool LST",
|
|
4179
|
+
"NOTE: Unlike single-pool, this mint is NOT a PDA. Validation happens by",
|
|
4180
|
+
"checking that stake_pool.pool_mint == bank_mint.key()"
|
|
4181
|
+
]
|
|
4182
|
+
},
|
|
4183
|
+
{
|
|
4184
|
+
name: "stake_pool",
|
|
4185
|
+
docs: [
|
|
4186
|
+
"1. Owner must be FOGO_STAKE_POOL_ID",
|
|
4187
|
+
"2. Deserialized state.pool_mint must match bank_mint",
|
|
4188
|
+
"3. Account type must be StakePool (value 1, not 0=Uninitialized or 2=ValidatorList)"
|
|
4189
|
+
]
|
|
4190
|
+
},
|
|
4191
|
+
{
|
|
4192
|
+
name: "bank",
|
|
4193
|
+
writable: true,
|
|
4194
|
+
pda: {
|
|
4195
|
+
seeds: [
|
|
4196
|
+
{
|
|
4197
|
+
kind: "account",
|
|
4198
|
+
path: "lendr_group"
|
|
4199
|
+
},
|
|
4200
|
+
{
|
|
4201
|
+
kind: "account",
|
|
4202
|
+
path: "bank_mint"
|
|
4203
|
+
},
|
|
4204
|
+
{
|
|
4205
|
+
kind: "arg",
|
|
4206
|
+
path: "bank_seed"
|
|
4207
|
+
}
|
|
4208
|
+
]
|
|
4209
|
+
}
|
|
4210
|
+
},
|
|
4211
|
+
{
|
|
4212
|
+
name: "liquidity_vault_authority",
|
|
4213
|
+
pda: {
|
|
4214
|
+
seeds: [
|
|
4215
|
+
{
|
|
4216
|
+
kind: "const",
|
|
4217
|
+
value: [
|
|
4218
|
+
108,
|
|
4219
|
+
105,
|
|
4220
|
+
113,
|
|
4221
|
+
117,
|
|
4222
|
+
105,
|
|
4223
|
+
100,
|
|
4224
|
+
105,
|
|
4225
|
+
116,
|
|
4226
|
+
121,
|
|
4227
|
+
95,
|
|
4228
|
+
118,
|
|
4229
|
+
97,
|
|
4230
|
+
117,
|
|
4231
|
+
108,
|
|
4232
|
+
116,
|
|
4233
|
+
95,
|
|
4234
|
+
97,
|
|
4235
|
+
117,
|
|
4236
|
+
116,
|
|
4237
|
+
104
|
|
4238
|
+
]
|
|
4239
|
+
},
|
|
4240
|
+
{
|
|
4241
|
+
kind: "account",
|
|
4242
|
+
path: "bank"
|
|
4243
|
+
}
|
|
4244
|
+
]
|
|
4245
|
+
}
|
|
4246
|
+
},
|
|
4247
|
+
{
|
|
4248
|
+
name: "liquidity_vault",
|
|
4249
|
+
writable: true,
|
|
4250
|
+
pda: {
|
|
4251
|
+
seeds: [
|
|
4252
|
+
{
|
|
4253
|
+
kind: "const",
|
|
4254
|
+
value: [108, 105, 113, 117, 105, 100, 105, 116, 121, 95, 118, 97, 117, 108, 116]
|
|
4255
|
+
},
|
|
4256
|
+
{
|
|
4257
|
+
kind: "account",
|
|
4258
|
+
path: "bank"
|
|
4259
|
+
}
|
|
4260
|
+
]
|
|
4261
|
+
}
|
|
4262
|
+
},
|
|
4263
|
+
{
|
|
4264
|
+
name: "insurance_vault_authority",
|
|
4265
|
+
pda: {
|
|
4266
|
+
seeds: [
|
|
4267
|
+
{
|
|
4268
|
+
kind: "const",
|
|
4269
|
+
value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116, 95, 97, 117, 116, 104]
|
|
4270
|
+
},
|
|
4271
|
+
{
|
|
4272
|
+
kind: "account",
|
|
4273
|
+
path: "bank"
|
|
4274
|
+
}
|
|
4275
|
+
]
|
|
4276
|
+
}
|
|
4277
|
+
},
|
|
4278
|
+
{
|
|
4279
|
+
name: "insurance_vault",
|
|
4280
|
+
writable: true,
|
|
4281
|
+
pda: {
|
|
4282
|
+
seeds: [
|
|
4283
|
+
{
|
|
4284
|
+
kind: "const",
|
|
4285
|
+
value: [105, 110, 115, 117, 114, 97, 110, 99, 101, 95, 118, 97, 117, 108, 116]
|
|
4286
|
+
},
|
|
4287
|
+
{
|
|
4288
|
+
kind: "account",
|
|
4289
|
+
path: "bank"
|
|
4290
|
+
}
|
|
4291
|
+
]
|
|
4292
|
+
}
|
|
4293
|
+
},
|
|
4294
|
+
{
|
|
4295
|
+
name: "fee_vault_authority",
|
|
4296
|
+
pda: {
|
|
4297
|
+
seeds: [
|
|
4298
|
+
{
|
|
4299
|
+
kind: "const",
|
|
4300
|
+
value: [102, 101, 101, 95, 118, 97, 117, 108, 116, 95, 97, 117, 116, 104]
|
|
4301
|
+
},
|
|
4302
|
+
{
|
|
4303
|
+
kind: "account",
|
|
4304
|
+
path: "bank"
|
|
4305
|
+
}
|
|
4306
|
+
]
|
|
4307
|
+
}
|
|
4308
|
+
},
|
|
4309
|
+
{
|
|
4310
|
+
name: "fee_vault",
|
|
4311
|
+
writable: true,
|
|
4312
|
+
pda: {
|
|
4313
|
+
seeds: [
|
|
4314
|
+
{
|
|
4315
|
+
kind: "const",
|
|
4316
|
+
value: [102, 101, 101, 95, 118, 97, 117, 108, 116]
|
|
4317
|
+
},
|
|
4318
|
+
{
|
|
4319
|
+
kind: "account",
|
|
4320
|
+
path: "bank"
|
|
4321
|
+
}
|
|
4322
|
+
]
|
|
4323
|
+
}
|
|
4324
|
+
},
|
|
4325
|
+
{
|
|
4326
|
+
name: "token_program"
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
name: "system_program",
|
|
4330
|
+
address: "11111111111111111111111111111111"
|
|
4331
|
+
}
|
|
4332
|
+
],
|
|
4333
|
+
args: [
|
|
4334
|
+
{
|
|
4335
|
+
name: "bank_seed",
|
|
4336
|
+
type: "u64"
|
|
4337
|
+
}
|
|
4338
|
+
]
|
|
4339
|
+
},
|
|
4137
4340
|
{
|
|
4138
4341
|
name: "lending_pool_add_bank_with_seed",
|
|
4139
4342
|
docs: [
|
|
@@ -10400,6 +10603,9 @@ var lendr_0_1_6_default = {
|
|
|
10400
10603
|
},
|
|
10401
10604
|
{
|
|
10402
10605
|
name: "Fixed"
|
|
10606
|
+
},
|
|
10607
|
+
{
|
|
10608
|
+
name: "FogoStakePoolWithPythPush"
|
|
10403
10609
|
}
|
|
10404
10610
|
]
|
|
10405
10611
|
}
|
|
@@ -10795,7 +11001,7 @@ var lendr_0_1_6_default = {
|
|
|
10795
11001
|
};
|
|
10796
11002
|
|
|
10797
11003
|
// src/idl/index.ts
|
|
10798
|
-
var LENDR_IDL =
|
|
11004
|
+
var LENDR_IDL = lendr_0_1_7_default;
|
|
10799
11005
|
|
|
10800
11006
|
// src/errors.ts
|
|
10801
11007
|
var ProcessTransactionErrorType = /* @__PURE__ */ ((ProcessTransactionErrorType2) => {
|
|
@@ -11155,6 +11361,23 @@ async function makePoolAddPermissionlessStakedBankIx(ldProgram, accounts, remain
|
|
|
11155
11361
|
tokenProgram
|
|
11156
11362
|
}).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
|
|
11157
11363
|
}
|
|
11364
|
+
async function makePoolAddPermissionlessFogoStakePoolBankIx(ldProgram, accounts, remainingAccounts, args) {
|
|
11365
|
+
const {
|
|
11366
|
+
stakedSettings,
|
|
11367
|
+
feePayer,
|
|
11368
|
+
bankMint,
|
|
11369
|
+
stakePool,
|
|
11370
|
+
tokenProgram = TOKEN_PROGRAM_ID2,
|
|
11371
|
+
...optionalAccounts
|
|
11372
|
+
} = accounts;
|
|
11373
|
+
return ldProgram.methods.lendingPoolAddBankPermissionlessFogoStakePool(args.seed ?? new BN2(0)).accounts({
|
|
11374
|
+
stakedSettings,
|
|
11375
|
+
feePayer,
|
|
11376
|
+
bankMint,
|
|
11377
|
+
stakePool,
|
|
11378
|
+
tokenProgram
|
|
11379
|
+
}).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
|
|
11380
|
+
}
|
|
11158
11381
|
async function makePoolAddBankIx(ldProgram, accounts, args) {
|
|
11159
11382
|
const { lendrGroup, feePayer, bankMint, bank, tokenProgram, ...optionalAccounts } = accounts;
|
|
11160
11383
|
return ldProgram.methods.lendingPoolAddBank({
|
|
@@ -11211,6 +11434,7 @@ var instructions = {
|
|
|
11211
11434
|
makeGroupInitIx,
|
|
11212
11435
|
makeCloseAccountIx,
|
|
11213
11436
|
makePoolAddPermissionlessStakedBankIx,
|
|
11437
|
+
makePoolAddPermissionlessFogoStakePoolBankIx,
|
|
11214
11438
|
makeLendingPoolConfigureBankOracleIx,
|
|
11215
11439
|
makePulseHealthIx,
|
|
11216
11440
|
makeLendingAccountSettleEmissionsIx,
|
|
@@ -11227,7 +11451,7 @@ import {
|
|
|
11227
11451
|
NATIVE_MINT as NATIVE_MINT2,
|
|
11228
11452
|
TOKEN_2022_PROGRAM_ID
|
|
11229
11453
|
} from "@solana/spl-token";
|
|
11230
|
-
import { ComputeBudgetProgram as ComputeBudgetProgram5, PublicKey as
|
|
11454
|
+
import { ComputeBudgetProgram as ComputeBudgetProgram5, PublicKey as PublicKey27 } from "@solana/web3.js";
|
|
11231
11455
|
import BigNumber14 from "bignumber.js";
|
|
11232
11456
|
import BN13 from "bn.js";
|
|
11233
11457
|
|
|
@@ -11235,7 +11459,7 @@ import BN13 from "bn.js";
|
|
|
11235
11459
|
import {
|
|
11236
11460
|
ComputeBudgetProgram as ComputeBudgetProgram4,
|
|
11237
11461
|
Keypair as Keypair2,
|
|
11238
|
-
PublicKey as
|
|
11462
|
+
PublicKey as PublicKey22,
|
|
11239
11463
|
SystemProgram as SystemProgram3,
|
|
11240
11464
|
TransactionMessage as TransactionMessage4,
|
|
11241
11465
|
VersionedTransaction as VersionedTransaction4
|
|
@@ -11294,7 +11518,7 @@ var HealthCache = class _HealthCache {
|
|
|
11294
11518
|
// src/services/bank/bank.service.ts
|
|
11295
11519
|
init_constants();
|
|
11296
11520
|
import { Program as Program2 } from "@coral-xyz/anchor";
|
|
11297
|
-
import { PublicKey as
|
|
11521
|
+
import { PublicKey as PublicKey18 } from "@solana/web3.js";
|
|
11298
11522
|
|
|
11299
11523
|
// src/utils.ts
|
|
11300
11524
|
import {
|
|
@@ -11307,7 +11531,7 @@ import {
|
|
|
11307
11531
|
import {
|
|
11308
11532
|
ComputeBudgetProgram as ComputeBudgetProgram2,
|
|
11309
11533
|
LAMPORTS_PER_SOL as LAMPORTS_PER_SOL3,
|
|
11310
|
-
PublicKey as
|
|
11534
|
+
PublicKey as PublicKey13,
|
|
11311
11535
|
SystemProgram as SystemProgram2,
|
|
11312
11536
|
TransactionMessage as TransactionMessage2,
|
|
11313
11537
|
VersionedTransaction as VersionedTransaction2
|
|
@@ -11327,17 +11551,18 @@ var OperationalState = /* @__PURE__ */ ((OperationalState2) => {
|
|
|
11327
11551
|
OperationalState2["KilledByBankruptcy"] = "KilledByBankruptcy";
|
|
11328
11552
|
return OperationalState2;
|
|
11329
11553
|
})(OperationalState || {});
|
|
11330
|
-
var OracleSetup = /* @__PURE__ */ ((
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11554
|
+
var OracleSetup = /* @__PURE__ */ ((OracleSetup3) => {
|
|
11555
|
+
OracleSetup3["None"] = "None";
|
|
11556
|
+
OracleSetup3["PythLegacy"] = "PythLegacy";
|
|
11557
|
+
OracleSetup3["SwitchboardV2"] = "SwitchboardV2";
|
|
11558
|
+
OracleSetup3["PythPushOracle"] = "PythPushOracle";
|
|
11559
|
+
OracleSetup3["SwitchboardPull"] = "SwitchboardPull";
|
|
11560
|
+
OracleSetup3["StakedWithPythPush"] = "StakedWithPythPush";
|
|
11561
|
+
OracleSetup3["KaminoPythPush"] = "KaminoPythPush";
|
|
11562
|
+
OracleSetup3["KaminoSwitchboardPull"] = "KaminoSwitchboardPull";
|
|
11563
|
+
OracleSetup3["Fixed"] = "Fixed";
|
|
11564
|
+
OracleSetup3["FogoStakePoolWithPythPush"] = "FogoStakePoolWithPythPush";
|
|
11565
|
+
return OracleSetup3;
|
|
11341
11566
|
})(OracleSetup || {});
|
|
11342
11567
|
var AssetTag = /* @__PURE__ */ ((AssetTag2) => {
|
|
11343
11568
|
AssetTag2[AssetTag2["DEFAULT"] = 0] = "DEFAULT";
|
|
@@ -11768,6 +11993,8 @@ function parseOracleSetup(oracleSetupRaw) {
|
|
|
11768
11993
|
return "KaminoSwitchboardPull" /* KaminoSwitchboardPull */;
|
|
11769
11994
|
case "fixed":
|
|
11770
11995
|
return "Fixed" /* Fixed */;
|
|
11996
|
+
case "fogostakepoolwithpythpush":
|
|
11997
|
+
return "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */;
|
|
11771
11998
|
default:
|
|
11772
11999
|
return "None" /* None */;
|
|
11773
12000
|
}
|
|
@@ -11821,10 +12048,13 @@ __export(vendor_exports, {
|
|
|
11821
12048
|
AggregatorAccountData: () => AggregatorAccountData,
|
|
11822
12049
|
CorpAction: () => CorpAction,
|
|
11823
12050
|
MAX_SLOT_DIFFERENCE: () => MAX_SLOT_DIFFERENCE,
|
|
12051
|
+
MAX_STAKE_POOL_SIZE: () => MAX_STAKE_POOL_SIZE,
|
|
12052
|
+
MIN_STAKE_POOL_SIZE: () => MIN_STAKE_POOL_SIZE,
|
|
11824
12053
|
PriceStatus: () => PriceStatus,
|
|
11825
12054
|
PriceType: () => PriceType,
|
|
11826
12055
|
SWITCHBOARD_ONDEMANDE_PRICE_PRECISION: () => SWITCHBOARD_ONDEMANDE_PRICE_PRECISION,
|
|
11827
12056
|
SinglePoolInstruction: () => SinglePoolInstruction,
|
|
12057
|
+
calculateFogoExchangeRate: () => calculateFogoExchangeRate,
|
|
11828
12058
|
createAccountIx: () => createAccountIx,
|
|
11829
12059
|
createPoolOnrampIx: () => createPoolOnrampIx,
|
|
11830
12060
|
decodeSwitchboardPullFeedData: () => decodeSwitchboardPullFeedData,
|
|
@@ -11841,14 +12071,69 @@ __export(vendor_exports, {
|
|
|
11841
12071
|
getSwitchboardProgram: () => getSwitchboardProgram,
|
|
11842
12072
|
initializeStakedPoolIxs: () => initializeStakedPoolIxs,
|
|
11843
12073
|
initializeStakedPoolTx: () => initializeStakedPoolTx,
|
|
12074
|
+
parseFogoStakePool: () => parseFogoStakePool,
|
|
11844
12075
|
parsePriceData: () => parsePriceData,
|
|
11845
12076
|
parsePriceInfo: () => parsePriceInfo2,
|
|
11846
12077
|
replenishPoolIx: () => replenishPoolIx,
|
|
11847
|
-
switchboardAccountCoder: () => switchboardAccountCoder
|
|
12078
|
+
switchboardAccountCoder: () => switchboardAccountCoder,
|
|
12079
|
+
validateFogoStakePool: () => validateFogoStakePool
|
|
11848
12080
|
});
|
|
11849
12081
|
|
|
11850
|
-
// src/vendor/
|
|
12082
|
+
// src/vendor/fogo_stake_pool/index.ts
|
|
11851
12083
|
import { PublicKey as PublicKey8 } from "@solana/web3.js";
|
|
12084
|
+
var ACCOUNT_TYPE_OFFSET = 0;
|
|
12085
|
+
var TOTAL_LAMPORTS_OFFSET = 258;
|
|
12086
|
+
var POOL_TOKEN_SUPPLY_OFFSET = 266;
|
|
12087
|
+
var LAST_UPDATE_EPOCH_OFFSET = 274;
|
|
12088
|
+
var POOL_MINT_OFFSET = 194;
|
|
12089
|
+
var STAKE_POOL_ACCOUNT_TYPE = 1;
|
|
12090
|
+
var MIN_STAKE_POOL_SIZE = 539;
|
|
12091
|
+
var MAX_STAKE_POOL_SIZE = 700;
|
|
12092
|
+
function parseFogoStakePool(data) {
|
|
12093
|
+
if (data.length < MIN_STAKE_POOL_SIZE) {
|
|
12094
|
+
throw new Error(`Fogo StakePool account too small: ${data.length} < ${MIN_STAKE_POOL_SIZE}`);
|
|
12095
|
+
}
|
|
12096
|
+
if (data.length > MAX_STAKE_POOL_SIZE) {
|
|
12097
|
+
throw new Error(`Fogo StakePool account too large: ${data.length} > ${MAX_STAKE_POOL_SIZE}`);
|
|
12098
|
+
}
|
|
12099
|
+
const accountType = data.readUInt8(ACCOUNT_TYPE_OFFSET);
|
|
12100
|
+
if (accountType !== STAKE_POOL_ACCOUNT_TYPE) {
|
|
12101
|
+
throw new Error(`Invalid Fogo StakePool account type: ${accountType}, expected ${STAKE_POOL_ACCOUNT_TYPE}`);
|
|
12102
|
+
}
|
|
12103
|
+
const poolMint = new PublicKey8(data.subarray(POOL_MINT_OFFSET, POOL_MINT_OFFSET + 32));
|
|
12104
|
+
const totalLamports = data.readBigUInt64LE(TOTAL_LAMPORTS_OFFSET);
|
|
12105
|
+
const poolTokenSupply = data.readBigUInt64LE(POOL_TOKEN_SUPPLY_OFFSET);
|
|
12106
|
+
const lastUpdateEpoch = data.readBigUInt64LE(LAST_UPDATE_EPOCH_OFFSET);
|
|
12107
|
+
return {
|
|
12108
|
+
accountType,
|
|
12109
|
+
poolMint,
|
|
12110
|
+
totalLamports,
|
|
12111
|
+
poolTokenSupply,
|
|
12112
|
+
lastUpdateEpoch
|
|
12113
|
+
};
|
|
12114
|
+
}
|
|
12115
|
+
function calculateFogoExchangeRate(stakePool) {
|
|
12116
|
+
if (stakePool.poolTokenSupply === 0n) {
|
|
12117
|
+
return 1;
|
|
12118
|
+
}
|
|
12119
|
+
return Number(stakePool.totalLamports) / Number(stakePool.poolTokenSupply);
|
|
12120
|
+
}
|
|
12121
|
+
function validateFogoStakePool(stakePool) {
|
|
12122
|
+
if (stakePool.poolTokenSupply === 0n || stakePool.totalLamports === 0n) {
|
|
12123
|
+
return false;
|
|
12124
|
+
}
|
|
12125
|
+
if (stakePool.totalLamports < stakePool.poolTokenSupply) {
|
|
12126
|
+
return false;
|
|
12127
|
+
}
|
|
12128
|
+
const rateScaled = stakePool.totalLamports * 1000000n / stakePool.poolTokenSupply;
|
|
12129
|
+
if (rateScaled > 3000000n) {
|
|
12130
|
+
return false;
|
|
12131
|
+
}
|
|
12132
|
+
return true;
|
|
12133
|
+
}
|
|
12134
|
+
|
|
12135
|
+
// src/vendor/pyth_legacy/index.ts
|
|
12136
|
+
import { PublicKey as PublicKey9 } from "@solana/web3.js";
|
|
11852
12137
|
|
|
11853
12138
|
// src/vendor/pyth_legacy/readBig.ts
|
|
11854
12139
|
var ERR_BUFFER_OUT_OF_BOUNDS = () => new Error("Attempt to access memory outside buffer bounds");
|
|
@@ -11887,7 +12172,7 @@ function readBigUInt64LE(buffer, offset = 0) {
|
|
|
11887
12172
|
// src/vendor/pyth_legacy/index.ts
|
|
11888
12173
|
var MAX_SLOT_DIFFERENCE = 25;
|
|
11889
12174
|
var empty32Buffer = Buffer.alloc(32);
|
|
11890
|
-
var PKorNull = (data) => data.equals(empty32Buffer) ? null : new
|
|
12175
|
+
var PKorNull = (data) => data.equals(empty32Buffer) ? null : new PublicKey9(data);
|
|
11891
12176
|
var PriceStatus = /* @__PURE__ */ ((PriceStatus2) => {
|
|
11892
12177
|
PriceStatus2[PriceStatus2["Unknown"] = 0] = "Unknown";
|
|
11893
12178
|
PriceStatus2[PriceStatus2["Trading"] = 1] = "Trading";
|
|
@@ -11950,7 +12235,7 @@ var parsePriceData = (data, currentSlot) => {
|
|
|
11950
12235
|
const drv2 = data.readInt8(105);
|
|
11951
12236
|
const drv3 = data.readInt16LE(106);
|
|
11952
12237
|
const drv4 = data.readInt32LE(108);
|
|
11953
|
-
const productAccountKey = new
|
|
12238
|
+
const productAccountKey = new PublicKey9(data.slice(112, 144));
|
|
11954
12239
|
const nextPriceAccountKey = PKorNull(data.slice(144, 176));
|
|
11955
12240
|
const previousSlot = readBigUInt64LE(data, 176);
|
|
11956
12241
|
const previousPriceComponent = readBigInt64LE(data, 184);
|
|
@@ -11974,7 +12259,7 @@ var parsePriceData = (data, currentSlot) => {
|
|
|
11974
12259
|
const priceComponents = [];
|
|
11975
12260
|
let offset = 240;
|
|
11976
12261
|
while (priceComponents.length < numComponentPrices) {
|
|
11977
|
-
const publisher = new
|
|
12262
|
+
const publisher = new PublicKey9(data.slice(offset, offset + 32));
|
|
11978
12263
|
offset += 32;
|
|
11979
12264
|
const componentAggregate = parsePriceInfo(data.slice(offset, offset + 32), exponent);
|
|
11980
12265
|
offset += 32;
|
|
@@ -12053,24 +12338,24 @@ var parsePriceInfo2 = (data) => {
|
|
|
12053
12338
|
};
|
|
12054
12339
|
|
|
12055
12340
|
// src/vendor/rpc-get-stake/index.ts
|
|
12056
|
-
import { PublicKey as
|
|
12341
|
+
import { PublicKey as PublicKey10 } from "@solana/web3.js";
|
|
12057
12342
|
var getStakeAccount = (data) => {
|
|
12058
12343
|
let offset = 0;
|
|
12059
12344
|
const discriminant = data.readBigUInt64LE(offset);
|
|
12060
12345
|
offset += 4;
|
|
12061
12346
|
const rentExemptReserve = data.readBigUInt64LE(offset);
|
|
12062
12347
|
offset += 8;
|
|
12063
|
-
const staker = new
|
|
12348
|
+
const staker = new PublicKey10(data.subarray(offset, offset + 32));
|
|
12064
12349
|
offset += 32;
|
|
12065
|
-
const withdrawer = new
|
|
12350
|
+
const withdrawer = new PublicKey10(data.subarray(offset, offset + 32));
|
|
12066
12351
|
offset += 32;
|
|
12067
12352
|
const unixTimestamp = data.readBigUInt64LE(offset);
|
|
12068
12353
|
offset += 8;
|
|
12069
12354
|
const epoch = data.readBigUInt64LE(offset);
|
|
12070
12355
|
offset += 8;
|
|
12071
|
-
const custodian = new
|
|
12356
|
+
const custodian = new PublicKey10(data.subarray(offset, offset + 32));
|
|
12072
12357
|
offset += 32;
|
|
12073
|
-
const voterPubkey = new
|
|
12358
|
+
const voterPubkey = new PublicKey10(data.subarray(offset, offset + 32));
|
|
12074
12359
|
offset += 32;
|
|
12075
12360
|
const stake = data.readBigUInt64LE(offset);
|
|
12076
12361
|
offset += 8;
|
|
@@ -12205,7 +12490,7 @@ function layout(property) {
|
|
|
12205
12490
|
|
|
12206
12491
|
// src/vendor/switchboard_legacy/aggregatorRound.ts
|
|
12207
12492
|
import * as borsh4 from "@coral-xyz/borsh";
|
|
12208
|
-
import { PublicKey as
|
|
12493
|
+
import { PublicKey as PublicKey12 } from "@solana/web3.js";
|
|
12209
12494
|
import BN6 from "bn.js";
|
|
12210
12495
|
|
|
12211
12496
|
// src/vendor/switchboard_legacy/switchboardDecimal.ts
|
|
@@ -12466,7 +12751,7 @@ var AggregatorRound = class _AggregatorRound {
|
|
|
12466
12751
|
stdDeviation: SwitchboardDecimal.fromJSON(obj.stdDeviation),
|
|
12467
12752
|
minResponse: SwitchboardDecimal.fromJSON(obj.minResponse),
|
|
12468
12753
|
maxResponse: SwitchboardDecimal.fromJSON(obj.maxResponse),
|
|
12469
|
-
oraclePubkeysData: obj.oraclePubkeysData.map((item) => new
|
|
12754
|
+
oraclePubkeysData: obj.oraclePubkeysData.map((item) => new PublicKey12(item)),
|
|
12470
12755
|
mediansData: obj.mediansData.map(
|
|
12471
12756
|
(item) => SwitchboardDecimal.fromJSON(item)
|
|
12472
12757
|
),
|
|
@@ -16580,7 +16865,7 @@ function getBankVaultAuthoritySeeds(type) {
|
|
|
16580
16865
|
}
|
|
16581
16866
|
}
|
|
16582
16867
|
function getBankVaultAuthority(bankVaultType, bankPk, programId) {
|
|
16583
|
-
return
|
|
16868
|
+
return PublicKey13.findProgramAddressSync([getBankVaultAuthoritySeeds(bankVaultType), bankPk.toBuffer()], programId);
|
|
16584
16869
|
}
|
|
16585
16870
|
function makeWrapSolIxs(walletAddress, amount) {
|
|
16586
16871
|
const address = getAssociatedTokenAddressSync(NATIVE_MINT, walletAddress, true);
|
|
@@ -16637,7 +16922,7 @@ async function buildFeedIdMap(bankConfigs, connection) {
|
|
|
16637
16922
|
const feedIdMap = /* @__PURE__ */ new Map();
|
|
16638
16923
|
const feedIdsWithAddresses = bankConfigs.filter((bankConfig) => {
|
|
16639
16924
|
const oracleSetup = parseOracleSetup(bankConfig.oracleSetup);
|
|
16640
|
-
return oracleSetup === "PythPushOracle" /* PythPushOracle */ || oracleSetup === "KaminoPythPush" /* KaminoPythPush */;
|
|
16925
|
+
return oracleSetup === "PythPushOracle" /* PythPushOracle */ || oracleSetup === "KaminoPythPush" /* KaminoPythPush */ || oracleSetup === "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */;
|
|
16641
16926
|
}).map((bankConfig) => {
|
|
16642
16927
|
const oracleKey = bankConfig.oracleKeys[0];
|
|
16643
16928
|
const feedId = oracleKey.toBuffer();
|
|
@@ -16696,6 +16981,16 @@ async function buildFeedIdMap(bankConfigs, connection) {
|
|
|
16696
16981
|
}
|
|
16697
16982
|
return feedIdMap;
|
|
16698
16983
|
}
|
|
16984
|
+
function getFogoStakePoolAddress(bankConfig) {
|
|
16985
|
+
if (bankConfig.oracleSetup !== "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */) {
|
|
16986
|
+
return null;
|
|
16987
|
+
}
|
|
16988
|
+
const stakePoolAddress = bankConfig.oracleKeys[1];
|
|
16989
|
+
if (!stakePoolAddress || stakePoolAddress.equals(PublicKey13.default)) {
|
|
16990
|
+
return null;
|
|
16991
|
+
}
|
|
16992
|
+
return stakePoolAddress;
|
|
16993
|
+
}
|
|
16699
16994
|
function findOracleKey(bankConfig, feedIdMap) {
|
|
16700
16995
|
try {
|
|
16701
16996
|
const oracleSetup = bankConfig.oracleSetup;
|
|
@@ -16722,7 +17017,7 @@ var PYTH_SPONSORED_SHARD_ID = 0;
|
|
|
16722
17017
|
var LENDR_SPONSORED_SHARD_ID = 3301;
|
|
16723
17018
|
function findPythPushOracleAddress(feedId, programId, shardId) {
|
|
16724
17019
|
const shardBytes = u16ToArrayBufferLE(shardId);
|
|
16725
|
-
return
|
|
17020
|
+
return PublicKey13.findProgramAddressSync([shardBytes, feedId], programId)[0];
|
|
16726
17021
|
}
|
|
16727
17022
|
function u16ToArrayBufferLE(value) {
|
|
16728
17023
|
const buffer = new ArrayBuffer(2);
|
|
@@ -19251,10 +19546,10 @@ var PYTH_SOLANA_RECEIVER_PROGRAM_IDL = {
|
|
|
19251
19546
|
};
|
|
19252
19547
|
|
|
19253
19548
|
// src/vendor/pyth_crank/pyth.consts.ts
|
|
19254
|
-
import { PublicKey as
|
|
19255
|
-
var DEFAULT_RECEIVER_PROGRAM_ID = new
|
|
19256
|
-
var DEFAULT_WORMHOLE_PROGRAM_ID = new
|
|
19257
|
-
var DEFAULT_PUSH_ORACLE_PROGRAM_ID = new
|
|
19549
|
+
import { PublicKey as PublicKey14 } from "@solana/web3.js";
|
|
19550
|
+
var DEFAULT_RECEIVER_PROGRAM_ID = new PublicKey14("rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ");
|
|
19551
|
+
var DEFAULT_WORMHOLE_PROGRAM_ID = new PublicKey14("HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ");
|
|
19552
|
+
var DEFAULT_PUSH_ORACLE_PROGRAM_ID = new PublicKey14("pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT");
|
|
19258
19553
|
var ACCUMULATOR_MAGIC = "504e4155";
|
|
19259
19554
|
var MAJOR_VERSION = 1;
|
|
19260
19555
|
var MINOR_VERSION = 0;
|
|
@@ -19269,7 +19564,7 @@ var VAA_SPLIT_INDEX = 721;
|
|
|
19269
19564
|
var VAA_START = 46;
|
|
19270
19565
|
|
|
19271
19566
|
// src/vendor/pyth_crank/pyth.utils.ts
|
|
19272
|
-
import { Keypair, PublicKey as
|
|
19567
|
+
import { Keypair, PublicKey as PublicKey15 } from "@solana/web3.js";
|
|
19273
19568
|
import BN7 from "bn.js";
|
|
19274
19569
|
function getGuardianSetIndex(vaa) {
|
|
19275
19570
|
return vaa.readUInt32BE(1);
|
|
@@ -19392,7 +19687,7 @@ async function buildEncodedVaaCreateInstruction(wormhole, vaa, encodedVaaKeypair
|
|
|
19392
19687
|
var getGuardianSetPda = (guardianSetIndex, wormholeProgramId) => {
|
|
19393
19688
|
const guardianSetIndexBuf = Buffer.alloc(4);
|
|
19394
19689
|
guardianSetIndexBuf.writeUInt32BE(guardianSetIndex, 0);
|
|
19395
|
-
return
|
|
19690
|
+
return PublicKey15.findProgramAddressSync([Buffer.from("GuardianSet"), guardianSetIndexBuf], wormholeProgramId)[0];
|
|
19396
19691
|
};
|
|
19397
19692
|
function parsePriceFeedMessage(message) {
|
|
19398
19693
|
let cursor = 0;
|
|
@@ -19471,6 +19766,7 @@ function isOracleSetupSupported(oracleSetup) {
|
|
|
19471
19766
|
case "KaminoPythPush" /* KaminoPythPush */:
|
|
19472
19767
|
case "KaminoSwitchboardPull" /* KaminoSwitchboardPull */:
|
|
19473
19768
|
case "Fixed" /* Fixed */:
|
|
19769
|
+
case "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */:
|
|
19474
19770
|
return true;
|
|
19475
19771
|
default:
|
|
19476
19772
|
return false;
|
|
@@ -19538,7 +19834,8 @@ function parseOraclePriceData(oracleSetup, rawData, fixedPrice, logger = new Noo
|
|
|
19538
19834
|
}
|
|
19539
19835
|
case "PythPushOracle" /* PythPushOracle */:
|
|
19540
19836
|
case "StakedWithPythPush" /* StakedWithPythPush */:
|
|
19541
|
-
case "KaminoPythPush" /* KaminoPythPush */:
|
|
19837
|
+
case "KaminoPythPush" /* KaminoPythPush */:
|
|
19838
|
+
case "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */: {
|
|
19542
19839
|
const bytesWithoutDiscriminator = rawData.slice(8);
|
|
19543
19840
|
const data = parsePriceInfo2(bytesWithoutDiscriminator);
|
|
19544
19841
|
const exponent = new BigNumber5(10 ** data.priceMessage.exponent);
|
|
@@ -19692,7 +19989,7 @@ function dtoToOraclePrice(dto) {
|
|
|
19692
19989
|
}
|
|
19693
19990
|
|
|
19694
19991
|
// src/services/price/utils/fetch.utils.ts
|
|
19695
|
-
import { PublicKey as
|
|
19992
|
+
import { PublicKey as PublicKey16 } from "@solana/web3.js";
|
|
19696
19993
|
import BigNumber7 from "bignumber.js";
|
|
19697
19994
|
var categorizePythBanks = (banks) => {
|
|
19698
19995
|
const pythLegacyBanks = banks.filter(
|
|
@@ -19726,7 +20023,7 @@ var fetchPythDataViaAPI = async (pythPushBanks, voteAccMintTuples) => {
|
|
|
19726
20023
|
const stakedCollatDataJson = await stakedCollatDataResponse.json();
|
|
19727
20024
|
const pythFeedMap = /* @__PURE__ */ new Map();
|
|
19728
20025
|
Object.entries(pythFeedMapJson).forEach(([feedId, { feedId: feedIdStr, shardId }]) => {
|
|
19729
|
-
pythFeedMap.set(feedId, { feedId: new
|
|
20026
|
+
pythFeedMap.set(feedId, { feedId: new PublicKey16(feedIdStr), shardId });
|
|
19730
20027
|
});
|
|
19731
20028
|
return { pythFeedMap, priceCoeffByBank: stakedCollatDataJson };
|
|
19732
20029
|
};
|
|
@@ -20201,7 +20498,7 @@ function computeRemainingCapacity(bank) {
|
|
|
20201
20498
|
}
|
|
20202
20499
|
|
|
20203
20500
|
// src/services/bank/utils/fetch.utils.ts
|
|
20204
|
-
import { PublicKey as
|
|
20501
|
+
import { PublicKey as PublicKey17 } from "@solana/web3.js";
|
|
20205
20502
|
var fetchMultipleBanks = async (program, opts) => {
|
|
20206
20503
|
let bankDatas = [];
|
|
20207
20504
|
if (opts?.bankAddresses && opts.bankAddresses.length > 0) {
|
|
@@ -20209,7 +20506,7 @@ var fetchMultipleBanks = async (program, opts) => {
|
|
|
20209
20506
|
const data = await program.account.bank.fetchMultiple(addresses);
|
|
20210
20507
|
data.forEach((d, idx) => {
|
|
20211
20508
|
if (d) {
|
|
20212
|
-
bankDatas.push({ address: new
|
|
20509
|
+
bankDatas.push({ address: new PublicKey17(addresses[idx]), data: d });
|
|
20213
20510
|
} else {
|
|
20214
20511
|
console.error(`Bank ${addresses[idx]} not found`);
|
|
20215
20512
|
}
|
|
@@ -20316,6 +20613,8 @@ function serializeOracleSetupToIndex(oracleSetup) {
|
|
|
20316
20613
|
return 7;
|
|
20317
20614
|
case "Fixed" /* Fixed */:
|
|
20318
20615
|
return 8;
|
|
20616
|
+
case "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */:
|
|
20617
|
+
return 9;
|
|
20319
20618
|
default:
|
|
20320
20619
|
return 0;
|
|
20321
20620
|
}
|
|
@@ -20340,6 +20639,8 @@ function serializeOracleSetup(oracleSetup) {
|
|
|
20340
20639
|
return { kaminoSwitchboardPull: {} };
|
|
20341
20640
|
case "Fixed" /* Fixed */:
|
|
20342
20641
|
return { fixed: {} };
|
|
20642
|
+
case "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */:
|
|
20643
|
+
return { fogoStakePoolWithPythPush: {} };
|
|
20343
20644
|
default:
|
|
20344
20645
|
throw new Error(`Invalid oracle setup "${oracleSetup}"`);
|
|
20345
20646
|
}
|
|
@@ -20614,23 +20915,23 @@ function getPriceFeedAccountForProgram(shardId, priceFeedId, pushOracleProgramId
|
|
|
20614
20915
|
}
|
|
20615
20916
|
const shardBuffer = Buffer.alloc(2);
|
|
20616
20917
|
shardBuffer.writeUint16LE(shardId, 0);
|
|
20617
|
-
return
|
|
20918
|
+
return PublicKey18.findProgramAddressSync(
|
|
20618
20919
|
[shardBuffer, feedIdBuffer],
|
|
20619
20920
|
pushOracleProgramId ?? DEFAULT_PUSH_ORACLE_PROGRAM_ID
|
|
20620
20921
|
)[0];
|
|
20621
20922
|
}
|
|
20622
20923
|
var getTreasuryPda = (treasuryId, receiverProgramId) => {
|
|
20623
|
-
return
|
|
20924
|
+
return PublicKey18.findProgramAddressSync([Buffer.from("treasury"), Buffer.from([treasuryId])], receiverProgramId)[0];
|
|
20624
20925
|
};
|
|
20625
20926
|
var getConfigPda = (receiverProgramId) => {
|
|
20626
|
-
return
|
|
20927
|
+
return PublicKey18.findProgramAddressSync([Buffer.from("config")], receiverProgramId)[0];
|
|
20627
20928
|
};
|
|
20628
20929
|
async function crankPythOracleIx(oracles, provider) {
|
|
20629
20930
|
const feedIdsByShardId = {};
|
|
20630
20931
|
const wormholeProgram = new Program2(PYTH_WORMHOLE_IDL, provider);
|
|
20631
20932
|
const pushOracleProgram = new Program2(PYTH_PUSH_ORACLE_IDL, provider);
|
|
20632
20933
|
const receiverProgram = new Program2(PYTH_SOLANA_RECEIVER_PROGRAM_IDL, provider);
|
|
20633
|
-
const addressLookupTableAccount = new
|
|
20934
|
+
const addressLookupTableAccount = new PublicKey18("5DNCErWQFBdvCxWQXaC1mrEFsvL3ftrzZ2gVZWNybaSX");
|
|
20634
20935
|
const lookupTableAccount = (await provider.connection.getAddressLookupTable(addressLookupTableAccount)).value;
|
|
20635
20936
|
const buildURL = (endpoint) => {
|
|
20636
20937
|
return new URL(`./v2/${endpoint}`, `https://hermes.pyth.network/`);
|
|
@@ -21371,7 +21672,7 @@ async function sendTransactionAsBundleRpc({
|
|
|
21371
21672
|
// src/services/transaction/helpers/tx-formatting.ts
|
|
21372
21673
|
import {
|
|
21373
21674
|
ComputeBudgetProgram as ComputeBudgetProgram3,
|
|
21374
|
-
PublicKey as
|
|
21675
|
+
PublicKey as PublicKey19,
|
|
21375
21676
|
TransactionMessage as TransactionMessage3,
|
|
21376
21677
|
VersionedTransaction as VersionedTransaction3
|
|
21377
21678
|
} from "@solana/web3.js";
|
|
@@ -21382,7 +21683,7 @@ function isFlashloan(tx) {
|
|
|
21382
21683
|
if (isV0Tx(tx)) {
|
|
21383
21684
|
const addressLookupTableAccounts = tx.addressLookupTables ?? [];
|
|
21384
21685
|
const message = decompileV0Transaction(tx, addressLookupTableAccounts);
|
|
21385
|
-
const idl = { ...LENDR_IDL, address: new
|
|
21686
|
+
const idl = { ...LENDR_IDL, address: new PublicKey19(0) };
|
|
21386
21687
|
const decoded = message.instructions.map((ix) => decodeInstruction(idl, ix.data));
|
|
21387
21688
|
return decoded.some((ix) => ix?.name.toLowerCase().includes("flashloan"));
|
|
21388
21689
|
}
|
|
@@ -21517,7 +21818,7 @@ function addTransactionTxTags(transactions) {
|
|
|
21517
21818
|
}
|
|
21518
21819
|
|
|
21519
21820
|
// src/services/account/utils/compute.utils.ts
|
|
21520
|
-
import { PublicKey as
|
|
21821
|
+
import { PublicKey as PublicKey20 } from "@solana/web3.js";
|
|
21521
21822
|
import BigNumber9 from "bignumber.js";
|
|
21522
21823
|
init_single_spl_pool();
|
|
21523
21824
|
function computeFreeCollateral(lendrAccount, opts) {
|
|
@@ -21742,7 +22043,10 @@ function computeHealthAccountMetas(banksToInclude, bankMetadataMap, enableSortin
|
|
|
21742
22043
|
const accounts = wrapperFn(
|
|
21743
22044
|
banksToInclude.map((bank) => {
|
|
21744
22045
|
const keys = [bank.address, bank.config.oracleKeys[0]];
|
|
21745
|
-
|
|
22046
|
+
const fogoStakePool = getFogoStakePoolAddress(bank.config);
|
|
22047
|
+
if (fogoStakePool) {
|
|
22048
|
+
keys.push(fogoStakePool);
|
|
22049
|
+
} else if (bank.config.assetTag === 2 && bank.config.oracleSetup === "StakedWithPythPush" /* StakedWithPythPush */) {
|
|
21746
22050
|
if (!bankMetadataMap && !bankExtendedMetadata) {
|
|
21747
22051
|
throw Error(`No bank metadata for ${bank.address.toBase58()} provided`);
|
|
21748
22052
|
}
|
|
@@ -21751,7 +22055,7 @@ function computeHealthAccountMetas(banksToInclude, bankMetadataMap, enableSortin
|
|
|
21751
22055
|
if (!validatorVoteAccount) {
|
|
21752
22056
|
throw Error(`no validatorVoteAccount on Bank metadata: ${bank.address.toBase58()}`);
|
|
21753
22057
|
}
|
|
21754
|
-
const pool = findPoolAddress(new
|
|
22058
|
+
const pool = findPoolAddress(new PublicKey20(validatorVoteAccount));
|
|
21755
22059
|
const solPool = findPoolStakeAddress(pool);
|
|
21756
22060
|
const lstMint = findPoolMintAddress(pool);
|
|
21757
22061
|
keys.push(lstMint, solPool);
|
|
@@ -21764,7 +22068,7 @@ function computeHealthAccountMetas(banksToInclude, bankMetadataMap, enableSortin
|
|
|
21764
22068
|
|
|
21765
22069
|
// src/services/account/utils/deserialize.utils.ts
|
|
21766
22070
|
import { BorshCoder as BorshCoder3 } from "@coral-xyz/anchor";
|
|
21767
|
-
import { PublicKey as
|
|
22071
|
+
import { PublicKey as PublicKey21 } from "@solana/web3.js";
|
|
21768
22072
|
import BigNumber11 from "bignumber.js";
|
|
21769
22073
|
import BN9 from "bn.js";
|
|
21770
22074
|
|
|
@@ -21936,19 +22240,19 @@ function getHealthCacheStatusDescription(flags) {
|
|
|
21936
22240
|
}
|
|
21937
22241
|
function dtoToLendrAccount(lendrAccountDto) {
|
|
21938
22242
|
return {
|
|
21939
|
-
address: new
|
|
21940
|
-
group: new
|
|
21941
|
-
authority: new
|
|
22243
|
+
address: new PublicKey21(lendrAccountDto.address),
|
|
22244
|
+
group: new PublicKey21(lendrAccountDto.group),
|
|
22245
|
+
authority: new PublicKey21(lendrAccountDto.authority),
|
|
21942
22246
|
balances: lendrAccountDto.balances.map(dtoToBalance),
|
|
21943
22247
|
accountFlags: lendrAccountDto.accountFlags,
|
|
21944
|
-
emissionsDestinationAccount: new
|
|
22248
|
+
emissionsDestinationAccount: new PublicKey21(lendrAccountDto.emissionsDestinationAccount),
|
|
21945
22249
|
healthCache: dtoToHealthCache(lendrAccountDto.healthCache)
|
|
21946
22250
|
};
|
|
21947
22251
|
}
|
|
21948
22252
|
function dtoToBalance(balanceDto) {
|
|
21949
22253
|
return {
|
|
21950
22254
|
active: balanceDto.active,
|
|
21951
|
-
bankPk: new
|
|
22255
|
+
bankPk: new PublicKey21(balanceDto.bankPk),
|
|
21952
22256
|
assetShares: new BigNumber11(balanceDto.assetShares),
|
|
21953
22257
|
liabilityShares: new BigNumber11(balanceDto.liabilityShares),
|
|
21954
22258
|
emissionsOutstanding: new BigNumber11(balanceDto.emissionsOutstanding),
|
|
@@ -22288,7 +22592,7 @@ async function simulateAccountHealthCache(props) {
|
|
|
22288
22592
|
const computeIx = ComputeBudgetProgram4.setComputeUnitLimit({ units: 14e5 });
|
|
22289
22593
|
const blockhash = (await program.provider.connection.getLatestBlockhash("confirmed")).blockhash;
|
|
22290
22594
|
const fundAccountIx = SystemProgram3.transfer({
|
|
22291
|
-
fromPubkey: new
|
|
22595
|
+
fromPubkey: new PublicKey22("DD3AeAssFvjqTvRTrRAtpfjkBF8FpVKnFuwnMLN9haXD"),
|
|
22292
22596
|
// lendr SOL VAULT
|
|
22293
22597
|
toPubkey: program.provider.publicKey,
|
|
22294
22598
|
lamports: 1e8
|
|
@@ -22412,7 +22716,7 @@ async function createLendrAccountTx(props) {
|
|
|
22412
22716
|
const dummyWrappedI80F48 = bigNumberToWrappedI80F48(new BigNumber12(0));
|
|
22413
22717
|
const dummyBalances = Array(15).fill({
|
|
22414
22718
|
active: false,
|
|
22415
|
-
bankPk: new
|
|
22719
|
+
bankPk: new PublicKey22("11111111111111111111111111111111"),
|
|
22416
22720
|
assetShares: dummyWrappedI80F48,
|
|
22417
22721
|
liabilityShares: dummyWrappedI80F48,
|
|
22418
22722
|
emissionsOutstanding: dummyWrappedI80F48,
|
|
@@ -22442,7 +22746,7 @@ async function createLendrAccountTx(props) {
|
|
|
22442
22746
|
internalLiqErr: 0,
|
|
22443
22747
|
lndrErr: 0
|
|
22444
22748
|
},
|
|
22445
|
-
emissionsDestinationAccount: new
|
|
22749
|
+
emissionsDestinationAccount: new PublicKey22("11111111111111111111111111111111"),
|
|
22446
22750
|
accountFlags: new BN11([0, 0, 0])
|
|
22447
22751
|
};
|
|
22448
22752
|
const account = LendrAccount.fromAccountParsed(lendrAccountKeypair.publicKey, rawAccount);
|
|
@@ -22479,7 +22783,7 @@ function getActiveStaleBanks(balances, banks, additionalBanks, oraclePrices, max
|
|
|
22479
22783
|
seenSwbOracles.add(key);
|
|
22480
22784
|
staleSwbOracles.push({ oracleKey: bank.oracleKey });
|
|
22481
22785
|
}
|
|
22482
|
-
} else if (bank.config.oracleSetup === "PythPushOracle" /* PythPushOracle */ || bank.config.oracleSetup === "StakedWithPythPush" /* StakedWithPythPush */ || bank.config.oracleSetup === "KaminoPythPush" /* KaminoPythPush */) {
|
|
22786
|
+
} else if (bank.config.oracleSetup === "PythPushOracle" /* PythPushOracle */ || bank.config.oracleSetup === "StakedWithPythPush" /* StakedWithPythPush */ || bank.config.oracleSetup === "KaminoPythPush" /* KaminoPythPush */ || bank.config.oracleSetup === "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */) {
|
|
22483
22787
|
const oraclePrice = oraclePrices.get(bank.address.toBase58());
|
|
22484
22788
|
const shardId = oraclePrice?.pythShardId ?? 0;
|
|
22485
22789
|
const feedId = bank.config.oracleKeys[0];
|
|
@@ -22498,7 +22802,7 @@ function getActiveStaleBanks(balances, banks, additionalBanks, oraclePrices, max
|
|
|
22498
22802
|
// src/services/group/group.service.ts
|
|
22499
22803
|
init_constants();
|
|
22500
22804
|
import { TOKEN_PROGRAM_ID as TOKEN_PROGRAM_ID4 } from "@solana/spl-token";
|
|
22501
|
-
import { PublicKey as
|
|
22805
|
+
import { PublicKey as PublicKey23, StakeProgram as StakeProgram2, SYSVAR_RENT_PUBKEY as SYSVAR_RENT_PUBKEY2, SystemProgram as SystemProgram4, TransactionInstruction as TransactionInstruction2 } from "@solana/web3.js";
|
|
22502
22806
|
import BN12 from "bn.js";
|
|
22503
22807
|
init_single_spl_pool();
|
|
22504
22808
|
async function makePoolConfigureBankIx2(program, bank, args) {
|
|
@@ -22515,7 +22819,7 @@ async function makePoolConfigureBankIx2(program, bank, args) {
|
|
|
22515
22819
|
};
|
|
22516
22820
|
}
|
|
22517
22821
|
async function makeAddPermissionlessStakedBankIx(program, group, voteAccountAddress, feePayer, pythOracle) {
|
|
22518
|
-
const [settingsKey] =
|
|
22822
|
+
const [settingsKey] = PublicKey23.findProgramAddressSync(
|
|
22519
22823
|
[Buffer.from("staked_settings", "utf-8"), group.toBuffer()],
|
|
22520
22824
|
program.programId
|
|
22521
22825
|
);
|
|
@@ -22588,11 +22892,11 @@ async function makePoolAddBankIx2(program, group, bank, feePayer, bankMint, bank
|
|
|
22588
22892
|
}
|
|
22589
22893
|
|
|
22590
22894
|
// src/services/group/utils/deserialize.utils.ts
|
|
22591
|
-
import { PublicKey as
|
|
22895
|
+
import { PublicKey as PublicKey24 } from "@solana/web3.js";
|
|
22592
22896
|
function dtoToGroup(groupDto) {
|
|
22593
22897
|
return {
|
|
22594
|
-
admin: new
|
|
22595
|
-
address: new
|
|
22898
|
+
admin: new PublicKey24(groupDto.admin),
|
|
22899
|
+
address: new PublicKey24(groupDto.address)
|
|
22596
22900
|
};
|
|
22597
22901
|
}
|
|
22598
22902
|
|
|
@@ -22605,19 +22909,19 @@ function groupToDto(group) {
|
|
|
22605
22909
|
}
|
|
22606
22910
|
|
|
22607
22911
|
// src/services/native-stake/utils/deserialize.utils.ts
|
|
22608
|
-
import { PublicKey as
|
|
22912
|
+
import { PublicKey as PublicKey25 } from "@solana/web3.js";
|
|
22609
22913
|
function dtoToValidatorStakeGroup(validatorStakeGroupDto) {
|
|
22610
22914
|
return {
|
|
22611
|
-
validator: new
|
|
22612
|
-
poolKey: new
|
|
22613
|
-
poolMintKey: new
|
|
22915
|
+
validator: new PublicKey25(validatorStakeGroupDto.validator),
|
|
22916
|
+
poolKey: new PublicKey25(validatorStakeGroupDto.poolKey),
|
|
22917
|
+
poolMintKey: new PublicKey25(validatorStakeGroupDto.poolMintKey),
|
|
22614
22918
|
totalStake: validatorStakeGroupDto.totalStake,
|
|
22615
22919
|
selectedAccount: {
|
|
22616
|
-
pubkey: new
|
|
22920
|
+
pubkey: new PublicKey25(validatorStakeGroupDto.selectedAccount.pubkey),
|
|
22617
22921
|
amount: validatorStakeGroupDto.selectedAccount.amount
|
|
22618
22922
|
},
|
|
22619
22923
|
accounts: validatorStakeGroupDto.accounts.map((account) => ({
|
|
22620
|
-
pubkey: new
|
|
22924
|
+
pubkey: new PublicKey25(account.pubkey),
|
|
22621
22925
|
amount: account.amount
|
|
22622
22926
|
}))
|
|
22623
22927
|
};
|
|
@@ -22626,7 +22930,7 @@ function dtoToValidatorStakeGroup(validatorStakeGroupDto) {
|
|
|
22626
22930
|
// src/services/native-stake/utils/fetch.utils.ts
|
|
22627
22931
|
init_constants();
|
|
22628
22932
|
init_single_spl_pool();
|
|
22629
|
-
import { LAMPORTS_PER_SOL as LAMPORTS_PER_SOL4, PublicKey as
|
|
22933
|
+
import { LAMPORTS_PER_SOL as LAMPORTS_PER_SOL4, PublicKey as PublicKey26, StakeProgram as StakeProgram3 } from "@solana/web3.js";
|
|
22630
22934
|
var fetchNativeStakeAccounts = async (connection, publicKey3, opts = {
|
|
22631
22935
|
filterInactive: true
|
|
22632
22936
|
}) => {
|
|
@@ -22662,7 +22966,7 @@ var fetchNativeStakeAccounts = async (connection, publicKey3, opts = {
|
|
|
22662
22966
|
);
|
|
22663
22967
|
return Promise.all(
|
|
22664
22968
|
Array.from(validatorMap.entries()).map(async ([validatorAddress, accounts2]) => {
|
|
22665
|
-
const poolKey = findPoolAddress(new
|
|
22969
|
+
const poolKey = findPoolAddress(new PublicKey26(validatorAddress));
|
|
22666
22970
|
const poolMintKey = findPoolMintAddress(poolKey);
|
|
22667
22971
|
const totalStake = accounts2.reduce((acc, curr) => acc + curr.amount, 0);
|
|
22668
22972
|
const largestAccount = accounts2.reduce((acc, curr) => acc.amount > curr.amount ? acc : curr);
|
|
@@ -22671,7 +22975,7 @@ var fetchNativeStakeAccounts = async (connection, publicKey3, opts = {
|
|
|
22671
22975
|
sortedAccounts.unshift(sortedAccounts.splice(sortedAccounts.indexOf(largestAccount), 1)[0]);
|
|
22672
22976
|
}
|
|
22673
22977
|
return {
|
|
22674
|
-
validator: new
|
|
22978
|
+
validator: new PublicKey26(validatorAddress),
|
|
22675
22979
|
poolKey,
|
|
22676
22980
|
poolMintKey,
|
|
22677
22981
|
accounts: sortedAccounts,
|
|
@@ -22727,17 +23031,17 @@ var fetchStakeAccount = (data) => {
|
|
|
22727
23031
|
offset += 4;
|
|
22728
23032
|
const rentExemptReserve = data.readBigUInt64LE(offset);
|
|
22729
23033
|
offset += 8;
|
|
22730
|
-
const staker = new
|
|
23034
|
+
const staker = new PublicKey26(data.subarray(offset, offset + 32));
|
|
22731
23035
|
offset += 32;
|
|
22732
|
-
const withdrawer = new
|
|
23036
|
+
const withdrawer = new PublicKey26(data.subarray(offset, offset + 32));
|
|
22733
23037
|
offset += 32;
|
|
22734
23038
|
const unixTimestamp = data.readBigUInt64LE(offset);
|
|
22735
23039
|
offset += 8;
|
|
22736
23040
|
const epoch = data.readBigUInt64LE(offset);
|
|
22737
23041
|
offset += 8;
|
|
22738
|
-
const custodian = new
|
|
23042
|
+
const custodian = new PublicKey26(data.subarray(offset, offset + 32));
|
|
22739
23043
|
offset += 32;
|
|
22740
|
-
const voterPubkey = new
|
|
23044
|
+
const voterPubkey = new PublicKey26(data.subarray(offset, offset + 32));
|
|
22741
23045
|
offset += 32;
|
|
22742
23046
|
const stake = data.readBigUInt64LE(offset);
|
|
22743
23047
|
offset += 8;
|
|
@@ -23684,12 +23988,9 @@ var LendrAccount = class _LendrAccount {
|
|
|
23684
23988
|
if (bank.mint.equals(NATIVE_MINT2)) {
|
|
23685
23989
|
const wSolBalanceUi = opts.wSolBalanceUi ?? 0;
|
|
23686
23990
|
const wrapAmount = new BigNumber14(amount).minus(wSolBalanceUi);
|
|
23687
|
-
const wrapIxs = makeSessionWrapSolIxs(
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
wrapAmount,
|
|
23691
|
-
{ existingBalance: wSolBalanceUi }
|
|
23692
|
-
);
|
|
23991
|
+
const wrapIxs = makeSessionWrapSolIxs(session.walletPublicKey, session.sessionPublicKey, wrapAmount, {
|
|
23992
|
+
existingBalance: wSolBalanceUi
|
|
23993
|
+
});
|
|
23693
23994
|
depositIxs.push(...wrapIxs);
|
|
23694
23995
|
}
|
|
23695
23996
|
depositIxs.push(depositIx);
|
|
@@ -23716,7 +24017,7 @@ var LendrAccount = class _LendrAccount {
|
|
|
23716
24017
|
const wrapAndUnwrapSol = opts.wrapAndUnwrapSol ?? true;
|
|
23717
24018
|
const wSolBalanceUi = opts.wSolBalanceUi ?? 0;
|
|
23718
24019
|
const repayIxs = [];
|
|
23719
|
-
if (repayAll && !bank.emissionsMint.equals(
|
|
24020
|
+
if (repayAll && !bank.emissionsMint.equals(PublicKey27.default)) {
|
|
23720
24021
|
repayIxs.push(...(await this.makeWithdrawEmissionsIx(program, banks, mintDatas, bankAddress)).instructions);
|
|
23721
24022
|
}
|
|
23722
24023
|
const userAta = getAssociatedTokenAddressSync2(bank.mint, this.authority, true, mintData.tokenProgram);
|
|
@@ -23804,15 +24105,10 @@ var LendrAccount = class _LendrAccount {
|
|
|
23804
24105
|
if (bank.mint.equals(NATIVE_MINT2)) {
|
|
23805
24106
|
const wSolBalanceUi = opts.wSolBalanceUi ?? 0;
|
|
23806
24107
|
const neededAmount = new BigNumber14(amount).minus(wSolBalanceUi);
|
|
23807
|
-
const wrapIxs = makeSessionWrapSolIxs(
|
|
23808
|
-
|
|
23809
|
-
|
|
23810
|
-
|
|
23811
|
-
{
|
|
23812
|
-
existingBalance: wSolBalanceUi,
|
|
23813
|
-
wrapAmountUi: opts.wrapAmountUi
|
|
23814
|
-
}
|
|
23815
|
-
);
|
|
24108
|
+
const wrapIxs = makeSessionWrapSolIxs(session.walletPublicKey, session.sessionPublicKey, neededAmount, {
|
|
24109
|
+
existingBalance: wSolBalanceUi,
|
|
24110
|
+
wrapAmountUi: opts.wrapAmountUi
|
|
24111
|
+
});
|
|
23816
24112
|
repayIxs.push(...wrapIxs);
|
|
23817
24113
|
}
|
|
23818
24114
|
repayIxs.push(repayIx);
|
|
@@ -23832,7 +24128,7 @@ var LendrAccount = class _LendrAccount {
|
|
|
23832
24128
|
const wrapAndUnwrapSol = withdrawOpts.wrapAndUnwrapSol ?? true;
|
|
23833
24129
|
const createAtas = withdrawOpts.createAtas ?? true;
|
|
23834
24130
|
const withdrawIxs = [];
|
|
23835
|
-
if (withdrawAll && !bank.emissionsMint.equals(
|
|
24131
|
+
if (withdrawAll && !bank.emissionsMint.equals(PublicKey27.default) && mintData.emissionTokenProgram) {
|
|
23836
24132
|
withdrawIxs.push(...(await this.makeWithdrawEmissionsIx(program, bankMap, mintDatas, bankAddress)).instructions);
|
|
23837
24133
|
}
|
|
23838
24134
|
const userAta = getAssociatedTokenAddressSync2(bank.mint, this.authority, true, mintData.tokenProgram);
|
|
@@ -23865,7 +24161,7 @@ var LendrAccount = class _LendrAccount {
|
|
|
23865
24161
|
throw Error(`No validator vote account for staked bank ${bankAddress.toBase58()}`);
|
|
23866
24162
|
}
|
|
23867
24163
|
const { findPoolAddress: findPoolAddress2, findPoolStakeAddress: findPoolStakeAddress2, findPoolMintAddress: findPoolMintAddress2 } = (init_single_spl_pool(), __toCommonJS(single_spl_pool_exports));
|
|
23868
|
-
const pool = findPoolAddress2(new
|
|
24164
|
+
const pool = findPoolAddress2(new PublicKey27(bankMetadata.validatorVoteAccount));
|
|
23869
24165
|
const solPool = findPoolStakeAddress2(pool);
|
|
23870
24166
|
const lstMint = findPoolMintAddress2(pool);
|
|
23871
24167
|
remainingAccounts.push(lstMint, solPool);
|
|
@@ -24220,7 +24516,7 @@ var LendrAccount = class _LendrAccount {
|
|
|
24220
24516
|
if (!decoded) continue;
|
|
24221
24517
|
const ixArgs = decoded.data;
|
|
24222
24518
|
if (decoded.name === "lendingAccountBorrow" || decoded.name === "lendingAccountDeposit") {
|
|
24223
|
-
const targetBank = new
|
|
24519
|
+
const targetBank = new PublicKey27(ix.keys[3].pubkey);
|
|
24224
24520
|
const targetBalance = projectedBalances.find((b) => b.bankPk.equals(targetBank));
|
|
24225
24521
|
if (!targetBalance) {
|
|
24226
24522
|
const firstInactiveBalanceIndex = projectedBalances.findIndex((b) => !b.active);
|
|
@@ -24233,7 +24529,7 @@ var LendrAccount = class _LendrAccount {
|
|
|
24233
24529
|
continue;
|
|
24234
24530
|
}
|
|
24235
24531
|
if (decoded.name === "lendingAccountRepay" || decoded.name === "lendingAccountWithdraw") {
|
|
24236
|
-
const targetBank = new
|
|
24532
|
+
const targetBank = new PublicKey27(ix.keys[3].pubkey);
|
|
24237
24533
|
const targetBalance = projectedBalances.find((b) => b.bankPk.equals(targetBank));
|
|
24238
24534
|
if (!targetBalance) {
|
|
24239
24535
|
throw Error(
|
|
@@ -24242,7 +24538,7 @@ var LendrAccount = class _LendrAccount {
|
|
|
24242
24538
|
}
|
|
24243
24539
|
if (ixArgs.repayAll || ixArgs.withdrawAll) {
|
|
24244
24540
|
targetBalance.active = false;
|
|
24245
|
-
targetBalance.bankPk =
|
|
24541
|
+
targetBalance.bankPk = PublicKey27.default;
|
|
24246
24542
|
}
|
|
24247
24543
|
}
|
|
24248
24544
|
}
|
|
@@ -24303,7 +24599,7 @@ import {
|
|
|
24303
24599
|
ComputeBudgetProgram as ComputeBudgetProgram6,
|
|
24304
24600
|
Keypair as Keypair3,
|
|
24305
24601
|
LAMPORTS_PER_SOL as LAMPORTS_PER_SOL5,
|
|
24306
|
-
PublicKey as
|
|
24602
|
+
PublicKey as PublicKey28,
|
|
24307
24603
|
StakeAuthorizationLayout,
|
|
24308
24604
|
StakeProgram as StakeProgram4,
|
|
24309
24605
|
SystemProgram as SystemProgram5,
|
|
@@ -24464,7 +24760,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
|
|
|
24464
24760
|
computeEmodeImpacts(emodePairs) {
|
|
24465
24761
|
return this._lendrAccount.computeEmodeImpacts(
|
|
24466
24762
|
emodePairs,
|
|
24467
|
-
Array.from(this.client.banks.keys()).map((b) => new
|
|
24763
|
+
Array.from(this.client.banks.keys()).map((b) => new PublicKey28(b))
|
|
24468
24764
|
);
|
|
24469
24765
|
}
|
|
24470
24766
|
computeMaxBorrowForBank(bankAddress, opts) {
|
|
@@ -24537,7 +24833,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
|
|
|
24537
24833
|
const mintData = this.client.mintDatas.get(bankAddress.toBase58());
|
|
24538
24834
|
if (!bank || !mintData) throw Error(`Token data for ${bankAddress.toBase58()} not found`);
|
|
24539
24835
|
return getAssociatedTokenAddressSync3(
|
|
24540
|
-
new
|
|
24836
|
+
new PublicKey28(bank.tokenAddress),
|
|
24541
24837
|
this.authority,
|
|
24542
24838
|
true,
|
|
24543
24839
|
mintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : void 0
|
|
@@ -24556,7 +24852,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
|
|
|
24556
24852
|
this.authority,
|
|
24557
24853
|
userAtas[i],
|
|
24558
24854
|
this.authority,
|
|
24559
|
-
new
|
|
24855
|
+
new PublicKey28(bank.tokenAddress),
|
|
24560
24856
|
mintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID2) ? TOKEN_2022_PROGRAM_ID2 : void 0
|
|
24561
24857
|
)
|
|
24562
24858
|
);
|
|
@@ -25490,7 +25786,7 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
|
|
|
25490
25786
|
if (!bankMetadata || !bankMetadata.validatorVoteAccount) {
|
|
25491
25787
|
throw new Error("Validator vote account not found");
|
|
25492
25788
|
}
|
|
25493
|
-
const pool = findPoolAddress(new
|
|
25789
|
+
const pool = findPoolAddress(new PublicKey28(bankMetadata.validatorVoteAccount));
|
|
25494
25790
|
const lstMint = findPoolMintAddress(pool);
|
|
25495
25791
|
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
25496
25792
|
const lstAta = getAssociatedTokenAddressSync3(lstMint, this.authority);
|
|
@@ -26364,6 +26660,10 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
|
|
|
26364
26660
|
{ pubkey: balBank.address, isSigner: false, isWritable: false },
|
|
26365
26661
|
{ pubkey: balBank.config.oracleKeys[0], isSigner: false, isWritable: false }
|
|
26366
26662
|
);
|
|
26663
|
+
const fogoStakePool = getFogoStakePoolAddress(balBank.config);
|
|
26664
|
+
if (fogoStakePool) {
|
|
26665
|
+
remainingAccounts.push({ pubkey: fogoStakePool, isSigner: false, isWritable: false });
|
|
26666
|
+
}
|
|
26367
26667
|
}
|
|
26368
26668
|
const ix = await instructions_default.makeHandleBankruptcyIx(
|
|
26369
26669
|
this._program,
|
|
@@ -26475,7 +26775,7 @@ function makeBundleTipIx(feePayer, bundleTip = 1e5) {
|
|
|
26475
26775
|
const randomTipAccount = tipAccounts[Math.floor(Math.random() * tipAccounts.length)];
|
|
26476
26776
|
return SystemProgram5.transfer({
|
|
26477
26777
|
fromPubkey: feePayer,
|
|
26478
|
-
toPubkey: new
|
|
26778
|
+
toPubkey: new PublicKey28(randomTipAccount),
|
|
26479
26779
|
lamports: bundleTip
|
|
26480
26780
|
// 100_000 lamports = 0.0001 SOL
|
|
26481
26781
|
});
|
|
@@ -26760,7 +27060,7 @@ var LendrClient = class _LendrClient {
|
|
|
26760
27060
|
const bankConfigs = [];
|
|
26761
27061
|
for (const bank of banksRawData) {
|
|
26762
27062
|
mintKeys.push(bank.data.mint);
|
|
26763
|
-
if (!bank.data.emissionsMint.equals(
|
|
27063
|
+
if (!bank.data.emissionsMint.equals(PublicKey29.default)) {
|
|
26764
27064
|
emissionMintKeys.push(bank.data.emissionsMint);
|
|
26765
27065
|
}
|
|
26766
27066
|
bankConfigs.push(bank.data.config);
|
|
@@ -26770,7 +27070,7 @@ var LendrClient = class _LendrClient {
|
|
|
26770
27070
|
const bankConfig = BankConfig.fromAccountParsed(bank.data.config);
|
|
26771
27071
|
const oracleSetup = bankConfig.oracleSetup;
|
|
26772
27072
|
let oracleKey;
|
|
26773
|
-
if (oracleSetup === "PythPushOracle" /* PythPushOracle */ || oracleSetup === "KaminoPythPush" /* KaminoPythPush */) {
|
|
27073
|
+
if (oracleSetup === "PythPushOracle" /* PythPushOracle */ || oracleSetup === "KaminoPythPush" /* KaminoPythPush */ || oracleSetup === "FogoStakePoolWithPythPush" /* FogoStakePoolWithPythPush */) {
|
|
26774
27074
|
const rawKey = bankConfig.oracleKeys[0];
|
|
26775
27075
|
const feedId = rawKey.toBuffer().toString("hex");
|
|
26776
27076
|
const feedInfo = feedIdMap.get(feedId);
|
|
@@ -26794,10 +27094,10 @@ var LendrClient = class _LendrClient {
|
|
|
26794
27094
|
}
|
|
26795
27095
|
oracleKeys.push(oracleKey);
|
|
26796
27096
|
}
|
|
26797
|
-
const uniqueOracleKeys = Array.from(new Set(oracleKeys.map((k) => k.toBase58()))).map((k) => new
|
|
26798
|
-
const uniqueMintKeys = Array.from(new Set(mintKeys.map((k) => k.toBase58()))).map((k) => new
|
|
27097
|
+
const uniqueOracleKeys = Array.from(new Set(oracleKeys.map((k) => k.toBase58()))).map((k) => new PublicKey29(k));
|
|
27098
|
+
const uniqueMintKeys = Array.from(new Set(mintKeys.map((k) => k.toBase58()))).map((k) => new PublicKey29(k));
|
|
26799
27099
|
const uniqueEmissionMintKeys = Array.from(new Set(emissionMintKeys.map((k) => k.toBase58()))).map(
|
|
26800
|
-
(k) => new
|
|
27100
|
+
(k) => new PublicKey29(k)
|
|
26801
27101
|
);
|
|
26802
27102
|
const allAccountInfos = await chunkedGetRawMultipleAccountInfoOrderedWithNulls(program.provider.connection, [
|
|
26803
27103
|
groupAddress.toBase58(),
|
|
@@ -26858,6 +27158,8 @@ var LendrClient = class _LendrClient {
|
|
|
26858
27158
|
const stakedCollatMap = {};
|
|
26859
27159
|
const solPools = [];
|
|
26860
27160
|
const mints = [];
|
|
27161
|
+
const fogoStakePoolMap = {};
|
|
27162
|
+
const fogoStakePools = [];
|
|
26861
27163
|
banksRawData.forEach(({ address, data }, index) => {
|
|
26862
27164
|
const bankAddressStr = address.toBase58();
|
|
26863
27165
|
const metadata = banksExtendedMetadata.get(data.mint.toBase58());
|
|
@@ -26879,7 +27181,7 @@ var LendrClient = class _LendrClient {
|
|
|
26879
27181
|
const bank = Bank.fromAccountParsed(address, data, feedIdMap, metadata, mintDataRaw.owner);
|
|
26880
27182
|
banks.set(bankAddressStr, bank);
|
|
26881
27183
|
let emissionTokenProgram = null;
|
|
26882
|
-
if (!data.emissionsMint.equals(
|
|
27184
|
+
if (!data.emissionsMint.equals(PublicKey29.default)) {
|
|
26883
27185
|
const emissionMintDataRawIndex = emissionMintKeys.findIndex((pk) => pk.equals(data.emissionsMint));
|
|
26884
27186
|
const emissionMintAccountInfo = emissionMintDataRawIndex >= 0 ? emissionMintAccountInfos[emissionMintDataRawIndex] : null;
|
|
26885
27187
|
emissionTokenProgram = emissionMintAccountInfo ? emissionMintAccountInfo.owner : null;
|
|
@@ -26892,23 +27194,31 @@ var LendrClient = class _LendrClient {
|
|
|
26892
27194
|
});
|
|
26893
27195
|
priceInfos.set(bankAddressStr, parseOraclePriceData(oracleSetup, priceDataRaw.data, bank.config.fixedPrice, logger));
|
|
26894
27196
|
if (oracleSetup === "StakedWithPythPush" /* StakedWithPythPush */ && metadata?.validatorVoteAccount) {
|
|
26895
|
-
const [poolAddress] =
|
|
26896
|
-
[Buffer.from("pool"), new
|
|
27197
|
+
const [poolAddress] = PublicKey29.findProgramAddressSync(
|
|
27198
|
+
[Buffer.from("pool"), new PublicKey29(metadata.validatorVoteAccount).toBuffer()],
|
|
26897
27199
|
SINGLE_POOL_PROGRAM_ID
|
|
26898
27200
|
);
|
|
26899
|
-
const [stakePoolAddress] =
|
|
27201
|
+
const [stakePoolAddress] = PublicKey29.findProgramAddressSync(
|
|
26900
27202
|
[Buffer.from("stake"), poolAddress.toBuffer()],
|
|
26901
27203
|
SINGLE_POOL_PROGRAM_ID
|
|
26902
27204
|
);
|
|
26903
27205
|
stakedCollatMap[address.toBase58()] = {
|
|
26904
27206
|
bankAddress: address,
|
|
26905
|
-
mint: new
|
|
27207
|
+
mint: new PublicKey29(metadata.mint),
|
|
26906
27208
|
stakePoolAddress,
|
|
26907
27209
|
poolAddress
|
|
26908
27210
|
};
|
|
26909
27211
|
solPools.push(stakePoolAddress.toBase58());
|
|
26910
27212
|
mints.push(metadata.mint);
|
|
26911
27213
|
}
|
|
27214
|
+
const fogoStakePool = getFogoStakePoolAddress(bank.config);
|
|
27215
|
+
if (fogoStakePool) {
|
|
27216
|
+
fogoStakePoolMap[address.toBase58()] = {
|
|
27217
|
+
bankAddress: address,
|
|
27218
|
+
stakePoolAddress: fogoStakePool
|
|
27219
|
+
};
|
|
27220
|
+
fogoStakePools.push(fogoStakePool.toBase58());
|
|
27221
|
+
}
|
|
26912
27222
|
});
|
|
26913
27223
|
const dataAis = await chunkedGetRawMultipleAccountInfoOrdered(program.provider.connection, [...mints, ...solPools]);
|
|
26914
27224
|
const stakePoolsAis = dataAis.slice(mints.length).map((ai) => getStakeAccount(ai.data));
|
|
@@ -26941,6 +27251,50 @@ var LendrClient = class _LendrClient {
|
|
|
26941
27251
|
priceInfos.set(bankAddress.toBase58(), oraclePrice);
|
|
26942
27252
|
}
|
|
26943
27253
|
}
|
|
27254
|
+
if (fogoStakePools.length > 0) {
|
|
27255
|
+
const fogoStakePoolAis = await chunkedGetRawMultipleAccountInfoOrdered(
|
|
27256
|
+
program.provider.connection,
|
|
27257
|
+
fogoStakePools
|
|
27258
|
+
);
|
|
27259
|
+
const fogoStakePoolRecord = {};
|
|
27260
|
+
for (let i = 0; i < fogoStakePools.length; i++) {
|
|
27261
|
+
const accountInfo = fogoStakePoolAis[i];
|
|
27262
|
+
if (accountInfo) {
|
|
27263
|
+
try {
|
|
27264
|
+
fogoStakePoolRecord[fogoStakePools[i]] = parseFogoStakePool(accountInfo.data);
|
|
27265
|
+
} catch (e) {
|
|
27266
|
+
logger.warn({ stakePool: fogoStakePools[i], error: e }, "Failed to parse Fogo stake pool");
|
|
27267
|
+
}
|
|
27268
|
+
}
|
|
27269
|
+
}
|
|
27270
|
+
for (const index in fogoStakePoolMap) {
|
|
27271
|
+
const { bankAddress, stakePoolAddress } = fogoStakePoolMap[index];
|
|
27272
|
+
const stakePool = fogoStakePoolRecord[stakePoolAddress.toBase58()];
|
|
27273
|
+
if (!stakePool) {
|
|
27274
|
+
logger.warn({ bankAddress: bankAddress.toBase58() }, "Fogo stake pool data not found");
|
|
27275
|
+
continue;
|
|
27276
|
+
}
|
|
27277
|
+
const oracle = priceInfos.get(bankAddress.toBase58());
|
|
27278
|
+
if (oracle) {
|
|
27279
|
+
const exchangeRate = calculateFogoExchangeRate(stakePool);
|
|
27280
|
+
const adjustFogoPrice = (price) => {
|
|
27281
|
+
return price.times(exchangeRate);
|
|
27282
|
+
};
|
|
27283
|
+
const adjustFogoPriceComponent = (priceComponent) => ({
|
|
27284
|
+
price: adjustFogoPrice(priceComponent.price),
|
|
27285
|
+
confidence: priceComponent.confidence.times(exchangeRate),
|
|
27286
|
+
lowestPrice: adjustFogoPrice(priceComponent.lowestPrice),
|
|
27287
|
+
highestPrice: adjustFogoPrice(priceComponent.highestPrice)
|
|
27288
|
+
});
|
|
27289
|
+
const oraclePrice = {
|
|
27290
|
+
timestamp: oracle.timestamp,
|
|
27291
|
+
priceRealtime: adjustFogoPriceComponent(oracle.priceRealtime),
|
|
27292
|
+
priceWeighted: adjustFogoPriceComponent(oracle.priceWeighted)
|
|
27293
|
+
};
|
|
27294
|
+
priceInfos.set(bankAddress.toBase58(), oraclePrice);
|
|
27295
|
+
}
|
|
27296
|
+
}
|
|
27297
|
+
}
|
|
26944
27298
|
logger.debug(
|
|
26945
27299
|
{
|
|
26946
27300
|
banksSize: banks.size,
|
|
@@ -27213,7 +27567,7 @@ var LendrClient = class _LendrClient {
|
|
|
27213
27567
|
const txResult = await session.sendTransaction(instructions2, { variation: "LendrAccountInitialize" });
|
|
27214
27568
|
this.logger.debug({ txResult }, "Created Lendr account (using session)");
|
|
27215
27569
|
const thirdPartyIdValue = thirdPartyId ?? 0;
|
|
27216
|
-
const [accountPublicKey] =
|
|
27570
|
+
const [accountPublicKey] = PublicKey29.findProgramAddressSync(
|
|
27217
27571
|
[
|
|
27218
27572
|
Buffer.from("lendr_account"),
|
|
27219
27573
|
this.groupAddress.toBuffer(),
|
|
@@ -27608,6 +27962,7 @@ export {
|
|
|
27608
27962
|
EmodeSettings,
|
|
27609
27963
|
EmodeTag,
|
|
27610
27964
|
FLASHLOAN_ENABLED_FLAG,
|
|
27965
|
+
FOGO_STAKE_POOL_PROGRAM_ID,
|
|
27611
27966
|
FogoMetadataFetcher,
|
|
27612
27967
|
GROUP_PK,
|
|
27613
27968
|
HOURS_PER_YEAR,
|
|
@@ -27744,6 +28099,7 @@ export {
|
|
|
27744
28099
|
getBankVaultSeeds,
|
|
27745
28100
|
getConfig,
|
|
27746
28101
|
getConfigPda,
|
|
28102
|
+
getFogoStakePoolAddress,
|
|
27747
28103
|
getHealthCacheStatusDescription,
|
|
27748
28104
|
getLiabilityQuantity,
|
|
27749
28105
|
getLiabilityShares,
|