@pyron-finance/pyron-client 2.0.1 → 2.2.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.js CHANGED
@@ -1,15 +1,15 @@
1
- import { __export } from "./chunk-Cl8Af3a2.js";
2
- import { BUNDLE_TX_SIZE, DEFAULT_CLUSTER, DEFAULT_COMMITMENT, DEFAULT_CONFIRM_OPTS, DEFAULT_ORACLE_MAX_AGE, DEFAULT_SEND_OPTS, DISABLED_FLAG, DUMMY_USDC_MINT, FLASHLOAN_ENABLED_FLAG, GROUP_PK, HOURS_PER_YEAR, JUPITER_V6_PROGRAM, LENDR_PROGRAM, LST_MINT, LUT_PROGRAM_AUTHORITY_INDEX, MAX_ACCOUNT_KEYS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PRIORITY_TX_SIZE, PROGRAM_ID, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, SINGLE_POOL_PROGRAM_ID, SKIP_SIMULATION, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_EXTENDED_METADATA, WSOL_MINT, addTransactionMetadata, aprToApy, bigNumberToWrappedI80F48, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, composeRemainingAccounts, decodeInstruction, decompileV0Transaction, fetchBanksExtendedMetadata, getAccountKeys, getComputeBudgetUnits, getTxSize, isV0Tx, legacyTxToV0Tx, microLamportsToUi, nativeToUi, setTimeoutPromise, shortenAddress, sleep, splitInstructionsToFitTransactions, toBigNumber, uiToMicroLamports, uiToNative, updateV0Tx, wrappedI80F48toBigNumber } from "./common-CpLJbZfZ.js";
1
+ import { __esm, __export, __toCommonJS } from "./chunk-BaU5PcSi.js";
2
+ import { BUNDLE_TX_SIZE, DEFAULT_CLUSTER, DEFAULT_COMMITMENT, DEFAULT_CONFIRM_OPTS, DEFAULT_ORACLE_MAX_AGE, DEFAULT_SEND_OPTS, DISABLED_FLAG, DUMMY_USDC_MINT, FLASHLOAN_ENABLED_FLAG, GROUP_PK, HOURS_PER_YEAR, JUPITER_V6_PROGRAM, LENDR_PROGRAM, LST_MINT, LUT_PROGRAM_AUTHORITY_INDEX, MAX_ACCOUNT_KEYS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PRIORITY_TX_SIZE, PROGRAM_ID, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, SINGLE_POOL_PROGRAM_ID, SKIP_SIMULATION, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_EXTENDED_METADATA, WSOL_MINT, addTransactionMetadata, aprToApy, bigNumberToWrappedI80F48, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, composeRemainingAccounts, decodeInstruction, decompileV0Transaction, fetchBanksExtendedMetadata, getAccountKeys, getComputeBudgetUnits, getTxSize, init_constants, isV0Tx, legacyTxToV0Tx, microLamportsToUi, nativeToUi, setTimeoutPromise, shortenAddress, sleep, splitInstructionsToFitTransactions, toBigNumber, uiToMicroLamports, uiToNative, updateV0Tx, wrappedI80F48toBigNumber } from "./common-BDgJX75H.js";
3
3
  import * as anchor from "@coral-xyz/anchor";
4
4
  import { AnchorProvider, BorshAccountsCoder, BorshCoder, BorshInstructionCoder, LangErrorMessage, Program, translateAddress } from "@coral-xyz/anchor";
5
- import { MintLayout, NATIVE_MINT, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, createApproveInstruction, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createSyncNativeInstruction, createTransferInstruction, getAssociatedTokenAddressSync } from "@solana/spl-token";
5
+ import { MintLayout, NATIVE_MINT, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, createApproveInstruction, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createSyncNativeInstruction, getAssociatedTokenAddressSync } from "@solana/spl-token";
6
6
  import { ComputeBudgetProgram, Connection, Keypair, LAMPORTS_PER_SOL, PublicKey, STAKE_CONFIG_ID as STAKE_CONFIG_ID$1, SYSVAR_CLOCK_PUBKEY, SYSVAR_RENT_PUBKEY, SolanaJSONRPCError, StakeAuthorizationLayout, StakeProgram, SystemProgram, Transaction, TransactionInstruction, TransactionMessage, VersionedTransaction } from "@solana/web3.js";
7
7
  import BigNumber from "bignumber.js";
8
- import BN$1, { BN } from "bn.js";
9
8
  import bs58 from "bs58";
10
9
  import { createStorage, prefixStorage } from "unstorage";
11
10
  import * as z$1 from "zod/v4-mini";
12
11
  import { z } from "zod/v4-mini";
12
+ import BN$1, { BN } from "bn.js";
13
13
  import { findMetadataPda, mplTokenMetadata, safeFetchAllMetadata } from "@metaplex-foundation/mpl-token-metadata";
14
14
  import { publicKey } from "@metaplex-foundation/umi";
15
15
  import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
@@ -232,6 +232,7 @@ var FogoMetadataFetcher = class {
232
232
 
233
233
  //#endregion
234
234
  //#region src/config.ts
235
+ init_constants();
235
236
  function getConfig({ environment = "production", overrides } = {}) {
236
237
  return {
237
238
  environment,
@@ -9883,6 +9884,7 @@ const LENDR_IDL = lendr_0_1_6_default;
9883
9884
 
9884
9885
  //#endregion
9885
9886
  //#region src/errors.ts
9887
+ init_constants();
9886
9888
  let ProcessTransactionErrorType = /* @__PURE__ */ function(ProcessTransactionErrorType$1) {
9887
9889
  ProcessTransactionErrorType$1[ProcessTransactionErrorType$1["TransactionBuildingError"] = 0] = "TransactionBuildingError";
9888
9890
  ProcessTransactionErrorType$1[ProcessTransactionErrorType$1["TransactionSendingError"] = 1] = "TransactionSendingError";
@@ -10106,8 +10108,17 @@ async function makeInitLendrAccountIx(ldProgram, accounts$2) {
10106
10108
  return ldProgram.methods.lendrAccountInitialize().accounts(accounts$2).instruction();
10107
10109
  }
10108
10110
  async function makeInitLendrAccountWithSessionIx(ldProgram, { lendrGroup, session, feePayer }, accountIndex, thirdPartyId) {
10111
+ const thirdPartyIdValue = thirdPartyId ?? 0;
10112
+ const [lendrAccount] = PublicKey.findProgramAddressSync([
10113
+ Buffer.from("lendr_account"),
10114
+ lendrGroup.toBuffer(),
10115
+ session.walletPublicKey.toBuffer(),
10116
+ Buffer.from(new Uint16Array([accountIndex]).buffer),
10117
+ Buffer.from(new Uint16Array([thirdPartyIdValue]).buffer)
10118
+ ], ldProgram.programId);
10109
10119
  return ldProgram.methods.lendrAccountInitializeWithSession(session.walletPublicKey, accountIndex, thirdPartyId ?? null).accounts({
10110
10120
  lendrGroup,
10121
+ lendrAccount,
10111
10122
  sessionKey: session.sessionPublicKey,
10112
10123
  feePayer
10113
10124
  }).instruction();
@@ -10479,6 +10490,7 @@ let AccountType = /* @__PURE__ */ function(AccountType$2) {
10479
10490
 
10480
10491
  //#endregion
10481
10492
  //#region src/services/bank/utils/deserialize.utils.ts
10493
+ init_constants();
10482
10494
  function decodeBankRaw(encoded, idl) {
10483
10495
  const coder = new BorshCoder(idl);
10484
10496
  return coder.accounts.decode(AccountType.Bank, encoded);
@@ -11144,554 +11156,576 @@ const getStakeAccount = (data) => {
11144
11156
 
11145
11157
  //#endregion
11146
11158
  //#region src/vendor/single-spl-pool/index.ts
11147
- var SinglePoolInstructionType = /* @__PURE__ */ function(SinglePoolInstructionType$1) {
11148
- SinglePoolInstructionType$1[SinglePoolInstructionType$1["InitializePool"] = 0] = "InitializePool";
11149
- SinglePoolInstructionType$1[SinglePoolInstructionType$1["ReplenishPool"] = 1] = "ReplenishPool";
11150
- SinglePoolInstructionType$1[SinglePoolInstructionType$1["DepositStake"] = 2] = "DepositStake";
11151
- SinglePoolInstructionType$1[SinglePoolInstructionType$1["WithdrawStake"] = 3] = "WithdrawStake";
11152
- SinglePoolInstructionType$1[SinglePoolInstructionType$1["CreateTokenMetadata"] = 4] = "CreateTokenMetadata";
11153
- SinglePoolInstructionType$1[SinglePoolInstructionType$1["UpdateTokenMetadata"] = 5] = "UpdateTokenMetadata";
11154
- SinglePoolInstructionType$1[SinglePoolInstructionType$1["InitializeOnRamp"] = 6] = "InitializeOnRamp";
11155
- return SinglePoolInstructionType$1;
11156
- }(SinglePoolInstructionType || {});
11157
- const SinglePoolInstruction = {
11158
- initializePool: (voteAccount) => {
11159
- const pool = findPoolAddress(voteAccount);
11160
- const stake = findPoolStakeAddress(pool);
11161
- const mint = findPoolMintAddress(pool);
11162
- const stakeAuthority = findPoolStakeAuthorityAddress(pool);
11163
- const mintAuthority = findPoolMintAuthorityAddress(pool);
11164
- return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11165
- {
11166
- pubkey: voteAccount,
11167
- isSigner: false,
11168
- isWritable: false
11169
- },
11170
- {
11171
- pubkey: pool,
11172
- isSigner: false,
11173
- isWritable: true
11174
- },
11175
- {
11176
- pubkey: stake,
11177
- isSigner: false,
11178
- isWritable: true
11179
- },
11180
- {
11181
- pubkey: mint,
11182
- isSigner: false,
11183
- isWritable: true
11184
- },
11185
- {
11186
- pubkey: stakeAuthority,
11187
- isSigner: false,
11188
- isWritable: false
11189
- },
11190
- {
11191
- pubkey: mintAuthority,
11192
- isSigner: false,
11193
- isWritable: false
11194
- },
11195
- {
11196
- pubkey: SYSVAR_RENT_ID,
11197
- isSigner: false,
11198
- isWritable: false
11199
- },
11200
- {
11201
- pubkey: SYSVAR_CLOCK_ID,
11202
- isSigner: false,
11203
- isWritable: false
11204
- },
11205
- {
11206
- pubkey: SYSVAR_STAKE_HISTORY_ID,
11207
- isSigner: false,
11208
- isWritable: false
11209
- },
11210
- {
11211
- pubkey: STAKE_CONFIG_ID$1,
11212
- isSigner: false,
11213
- isWritable: false
11214
- },
11215
- {
11216
- pubkey: SYSTEM_PROGRAM_ID,
11217
- isSigner: false,
11218
- isWritable: false
11219
- },
11220
- {
11221
- pubkey: TOKEN_PROGRAM_ID,
11222
- isSigner: false,
11223
- isWritable: false
11224
- },
11225
- {
11226
- pubkey: STAKE_PROGRAM_ID,
11227
- isSigner: false,
11228
- isWritable: false
11229
- }
11230
- ], Buffer.from([SinglePoolInstructionType.InitializePool]));
11231
- },
11232
- initializeOnRamp: (pool) => {
11233
- const onRamp = findPoolOnRampAddress(pool);
11234
- const stakeAuthority = findPoolStakeAuthorityAddress(pool);
11235
- return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11236
- {
11237
- pubkey: pool,
11238
- isSigner: false,
11239
- isWritable: false
11240
- },
11241
- {
11242
- pubkey: onRamp,
11243
- isSigner: false,
11244
- isWritable: true
11245
- },
11246
- {
11247
- pubkey: stakeAuthority,
11248
- isSigner: false,
11249
- isWritable: false
11250
- },
11251
- {
11252
- pubkey: SYSVAR_RENT_ID,
11253
- isSigner: false,
11254
- isWritable: false
11255
- },
11256
- {
11257
- pubkey: SYSTEM_PROGRAM_ID,
11258
- isSigner: false,
11259
- isWritable: false
11260
- },
11261
- {
11262
- pubkey: STAKE_PROGRAM_ID,
11263
- isSigner: false,
11264
- isWritable: false
11265
- }
11266
- ], Buffer.from([SinglePoolInstructionType.InitializeOnRamp]));
11267
- },
11268
- depositStake: async (pool, userStakeAccount, userTokenAccount, userLamportAccount) => {
11269
- const stake = findPoolStakeAddress(pool);
11270
- const mint = findPoolMintAddress(pool);
11271
- const stakeAuthority = findPoolStakeAuthorityAddress(pool);
11272
- const mintAuthority = findPoolMintAuthorityAddress(pool);
11273
- return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11274
- {
11275
- pubkey: pool,
11276
- isSigner: false,
11277
- isWritable: false
11278
- },
11279
- {
11280
- pubkey: stake,
11281
- isSigner: false,
11282
- isWritable: true
11283
- },
11284
- {
11285
- pubkey: mint,
11286
- isSigner: false,
11287
- isWritable: true
11288
- },
11289
- {
11290
- pubkey: stakeAuthority,
11291
- isSigner: false,
11292
- isWritable: false
11293
- },
11294
- {
11295
- pubkey: mintAuthority,
11296
- isSigner: false,
11297
- isWritable: false
11298
- },
11299
- {
11300
- pubkey: userStakeAccount,
11301
- isSigner: false,
11302
- isWritable: true
11303
- },
11304
- {
11305
- pubkey: userTokenAccount,
11306
- isSigner: false,
11307
- isWritable: true
11308
- },
11309
- {
11310
- pubkey: userLamportAccount,
11311
- isSigner: false,
11312
- isWritable: true
11313
- },
11314
- {
11315
- pubkey: SYSVAR_CLOCK_ID,
11316
- isSigner: false,
11317
- isWritable: false
11318
- },
11319
- {
11320
- pubkey: SYSVAR_STAKE_HISTORY_ID,
11321
- isSigner: false,
11322
- isWritable: false
11323
- },
11324
- {
11325
- pubkey: TOKEN_PROGRAM_ID,
11326
- isSigner: false,
11327
- isWritable: false
11328
- },
11329
- {
11330
- pubkey: STAKE_PROGRAM_ID,
11331
- isSigner: false,
11332
- isWritable: false
11159
+ var single_spl_pool_exports = {};
11160
+ __export(single_spl_pool_exports, {
11161
+ SinglePoolInstruction: () => SinglePoolInstruction,
11162
+ createAccountIx: () => createAccountIx,
11163
+ createPoolOnrampIx: () => createPoolOnrampIx,
11164
+ findMplMetadataAddress: () => findMplMetadataAddress,
11165
+ findPoolAddress: () => findPoolAddress,
11166
+ findPoolMintAddress: () => findPoolMintAddress,
11167
+ findPoolMintAddressByVoteAccount: () => findPoolMintAddressByVoteAccount,
11168
+ findPoolMintAuthorityAddress: () => findPoolMintAuthorityAddress,
11169
+ findPoolMplAuthorityAddress: () => findPoolMplAuthorityAddress,
11170
+ findPoolOnRampAddress: () => findPoolOnRampAddress,
11171
+ findPoolStakeAddress: () => findPoolStakeAddress,
11172
+ findPoolStakeAuthorityAddress: () => findPoolStakeAuthorityAddress,
11173
+ initializeStakedPoolIxs: () => initializeStakedPoolIxs,
11174
+ initializeStakedPoolTx: () => initializeStakedPoolTx,
11175
+ replenishPoolIx: () => replenishPoolIx
11176
+ });
11177
+ async function initializeStakedPoolTx(connection, payer, voteAccountAddress) {
11178
+ const instructions$3 = await initializeStakedPoolIxs(connection, payer, voteAccountAddress);
11179
+ const tx = new Transaction().add(...instructions$3);
11180
+ return tx;
11181
+ }
11182
+ async function initializeStakedPoolIxs(connection, payer, voteAccountAddress) {
11183
+ const poolAddress = findPoolAddress(voteAccountAddress);
11184
+ const stakeAddress = findPoolStakeAddress(poolAddress);
11185
+ const mintAddress = findPoolMintAddress(poolAddress);
11186
+ const onRampAddress = findPoolOnRampAddress(poolAddress);
11187
+ const [poolRent, stakeRent, mintRent, minimumDelegationObj] = await Promise.all([
11188
+ connection.getMinimumBalanceForRentExemption(Number(SINGLE_POOL_ACCOUNT_SIZE), "confirmed"),
11189
+ connection.getMinimumBalanceForRentExemption(Number(STAKE_ACCOUNT_SIZE), "confirmed"),
11190
+ connection.getMinimumBalanceForRentExemption(Number(MINT_SIZE), "confirmed"),
11191
+ connection.getStakeMinimumDelegation()
11192
+ ]);
11193
+ const minimumDelegation = minimumDelegationObj.value;
11194
+ const instructions$3 = [];
11195
+ instructions$3.push(SystemProgram.transfer({
11196
+ fromPubkey: payer,
11197
+ toPubkey: poolAddress,
11198
+ lamports: poolRent
11199
+ }));
11200
+ instructions$3.push(SystemProgram.transfer({
11201
+ fromPubkey: payer,
11202
+ toPubkey: stakeAddress,
11203
+ lamports: stakeRent + minimumDelegation + LAMPORTS_PER_SOL * 1
11204
+ }));
11205
+ instructions$3.push(SystemProgram.transfer({
11206
+ fromPubkey: payer,
11207
+ toPubkey: onRampAddress,
11208
+ lamports: stakeRent
11209
+ }));
11210
+ instructions$3.push(SystemProgram.transfer({
11211
+ fromPubkey: payer,
11212
+ toPubkey: mintAddress,
11213
+ lamports: mintRent
11214
+ }));
11215
+ instructions$3.push(SinglePoolInstruction.initializePool(voteAccountAddress));
11216
+ instructions$3.push(SinglePoolInstruction.initializeOnRamp(poolAddress));
11217
+ instructions$3.push(await SinglePoolInstruction.createTokenMetadata(poolAddress, payer));
11218
+ return instructions$3;
11219
+ }
11220
+ var SinglePoolInstructionType, SinglePoolInstruction, createTransactionInstruction, findPda, findPoolMintAddressByVoteAccount, findPoolAddress, findPoolMintAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findMplMetadataAddress, SINGLE_POOL_ACCOUNT_SIZE, STAKE_ACCOUNT_SIZE, MINT_SIZE, createAccountIx, createPoolOnrampIx, replenishPoolIx;
11221
+ var init_single_spl_pool = __esm({ "src/vendor/single-spl-pool/index.ts"() {
11222
+ init_constants();
11223
+ SinglePoolInstructionType = /* @__PURE__ */ function(SinglePoolInstructionType$1) {
11224
+ SinglePoolInstructionType$1[SinglePoolInstructionType$1["InitializePool"] = 0] = "InitializePool";
11225
+ SinglePoolInstructionType$1[SinglePoolInstructionType$1["ReplenishPool"] = 1] = "ReplenishPool";
11226
+ SinglePoolInstructionType$1[SinglePoolInstructionType$1["DepositStake"] = 2] = "DepositStake";
11227
+ SinglePoolInstructionType$1[SinglePoolInstructionType$1["WithdrawStake"] = 3] = "WithdrawStake";
11228
+ SinglePoolInstructionType$1[SinglePoolInstructionType$1["CreateTokenMetadata"] = 4] = "CreateTokenMetadata";
11229
+ SinglePoolInstructionType$1[SinglePoolInstructionType$1["UpdateTokenMetadata"] = 5] = "UpdateTokenMetadata";
11230
+ SinglePoolInstructionType$1[SinglePoolInstructionType$1["InitializeOnRamp"] = 6] = "InitializeOnRamp";
11231
+ return SinglePoolInstructionType$1;
11232
+ }(SinglePoolInstructionType || {});
11233
+ SinglePoolInstruction = {
11234
+ initializePool: (voteAccount) => {
11235
+ const pool = findPoolAddress(voteAccount);
11236
+ const stake = findPoolStakeAddress(pool);
11237
+ const mint = findPoolMintAddress(pool);
11238
+ const stakeAuthority = findPoolStakeAuthorityAddress(pool);
11239
+ const mintAuthority = findPoolMintAuthorityAddress(pool);
11240
+ return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11241
+ {
11242
+ pubkey: voteAccount,
11243
+ isSigner: false,
11244
+ isWritable: false
11245
+ },
11246
+ {
11247
+ pubkey: pool,
11248
+ isSigner: false,
11249
+ isWritable: true
11250
+ },
11251
+ {
11252
+ pubkey: stake,
11253
+ isSigner: false,
11254
+ isWritable: true
11255
+ },
11256
+ {
11257
+ pubkey: mint,
11258
+ isSigner: false,
11259
+ isWritable: true
11260
+ },
11261
+ {
11262
+ pubkey: stakeAuthority,
11263
+ isSigner: false,
11264
+ isWritable: false
11265
+ },
11266
+ {
11267
+ pubkey: mintAuthority,
11268
+ isSigner: false,
11269
+ isWritable: false
11270
+ },
11271
+ {
11272
+ pubkey: SYSVAR_RENT_ID,
11273
+ isSigner: false,
11274
+ isWritable: false
11275
+ },
11276
+ {
11277
+ pubkey: SYSVAR_CLOCK_ID,
11278
+ isSigner: false,
11279
+ isWritable: false
11280
+ },
11281
+ {
11282
+ pubkey: SYSVAR_STAKE_HISTORY_ID,
11283
+ isSigner: false,
11284
+ isWritable: false
11285
+ },
11286
+ {
11287
+ pubkey: STAKE_CONFIG_ID$1,
11288
+ isSigner: false,
11289
+ isWritable: false
11290
+ },
11291
+ {
11292
+ pubkey: SYSTEM_PROGRAM_ID,
11293
+ isSigner: false,
11294
+ isWritable: false
11295
+ },
11296
+ {
11297
+ pubkey: TOKEN_PROGRAM_ID,
11298
+ isSigner: false,
11299
+ isWritable: false
11300
+ },
11301
+ {
11302
+ pubkey: STAKE_PROGRAM_ID,
11303
+ isSigner: false,
11304
+ isWritable: false
11305
+ }
11306
+ ], Buffer.from([SinglePoolInstructionType.InitializePool]));
11307
+ },
11308
+ initializeOnRamp: (pool) => {
11309
+ const onRamp = findPoolOnRampAddress(pool);
11310
+ const stakeAuthority = findPoolStakeAuthorityAddress(pool);
11311
+ return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11312
+ {
11313
+ pubkey: pool,
11314
+ isSigner: false,
11315
+ isWritable: false
11316
+ },
11317
+ {
11318
+ pubkey: onRamp,
11319
+ isSigner: false,
11320
+ isWritable: true
11321
+ },
11322
+ {
11323
+ pubkey: stakeAuthority,
11324
+ isSigner: false,
11325
+ isWritable: false
11326
+ },
11327
+ {
11328
+ pubkey: SYSVAR_RENT_ID,
11329
+ isSigner: false,
11330
+ isWritable: false
11331
+ },
11332
+ {
11333
+ pubkey: SYSTEM_PROGRAM_ID,
11334
+ isSigner: false,
11335
+ isWritable: false
11336
+ },
11337
+ {
11338
+ pubkey: STAKE_PROGRAM_ID,
11339
+ isSigner: false,
11340
+ isWritable: false
11341
+ }
11342
+ ], Buffer.from([SinglePoolInstructionType.InitializeOnRamp]));
11343
+ },
11344
+ depositStake: async (pool, userStakeAccount, userTokenAccount, userLamportAccount) => {
11345
+ const stake = findPoolStakeAddress(pool);
11346
+ const mint = findPoolMintAddress(pool);
11347
+ const stakeAuthority = findPoolStakeAuthorityAddress(pool);
11348
+ const mintAuthority = findPoolMintAuthorityAddress(pool);
11349
+ return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11350
+ {
11351
+ pubkey: pool,
11352
+ isSigner: false,
11353
+ isWritable: false
11354
+ },
11355
+ {
11356
+ pubkey: stake,
11357
+ isSigner: false,
11358
+ isWritable: true
11359
+ },
11360
+ {
11361
+ pubkey: mint,
11362
+ isSigner: false,
11363
+ isWritable: true
11364
+ },
11365
+ {
11366
+ pubkey: stakeAuthority,
11367
+ isSigner: false,
11368
+ isWritable: false
11369
+ },
11370
+ {
11371
+ pubkey: mintAuthority,
11372
+ isSigner: false,
11373
+ isWritable: false
11374
+ },
11375
+ {
11376
+ pubkey: userStakeAccount,
11377
+ isSigner: false,
11378
+ isWritable: true
11379
+ },
11380
+ {
11381
+ pubkey: userTokenAccount,
11382
+ isSigner: false,
11383
+ isWritable: true
11384
+ },
11385
+ {
11386
+ pubkey: userLamportAccount,
11387
+ isSigner: false,
11388
+ isWritable: true
11389
+ },
11390
+ {
11391
+ pubkey: SYSVAR_CLOCK_ID,
11392
+ isSigner: false,
11393
+ isWritable: false
11394
+ },
11395
+ {
11396
+ pubkey: SYSVAR_STAKE_HISTORY_ID,
11397
+ isSigner: false,
11398
+ isWritable: false
11399
+ },
11400
+ {
11401
+ pubkey: TOKEN_PROGRAM_ID,
11402
+ isSigner: false,
11403
+ isWritable: false
11404
+ },
11405
+ {
11406
+ pubkey: STAKE_PROGRAM_ID,
11407
+ isSigner: false,
11408
+ isWritable: false
11409
+ }
11410
+ ], Buffer.from([SinglePoolInstructionType.DepositStake]));
11411
+ },
11412
+ withdrawStake: async (pool, userStakeAccount, userStakeAuthority, userTokenAccount, tokenAmount) => {
11413
+ const stake = findPoolStakeAddress(pool);
11414
+ const mint = findPoolMintAddress(pool);
11415
+ const stakeAuthority = findPoolStakeAuthorityAddress(pool);
11416
+ const mintAuthority = findPoolMintAuthorityAddress(pool);
11417
+ const rawAmount = BigInt(tokenAmount.multipliedBy(1e9).toString());
11418
+ const data = Buffer.concat([
11419
+ Buffer.from([SinglePoolInstructionType.WithdrawStake]),
11420
+ userStakeAuthority.toBuffer(),
11421
+ Buffer.from(new BN(rawAmount.toString()).toArray("le", 8))
11422
+ ]);
11423
+ return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11424
+ {
11425
+ pubkey: pool,
11426
+ isSigner: false,
11427
+ isWritable: false
11428
+ },
11429
+ {
11430
+ pubkey: stake,
11431
+ isSigner: false,
11432
+ isWritable: true
11433
+ },
11434
+ {
11435
+ pubkey: mint,
11436
+ isSigner: false,
11437
+ isWritable: true
11438
+ },
11439
+ {
11440
+ pubkey: stakeAuthority,
11441
+ isSigner: false,
11442
+ isWritable: false
11443
+ },
11444
+ {
11445
+ pubkey: mintAuthority,
11446
+ isSigner: false,
11447
+ isWritable: false
11448
+ },
11449
+ {
11450
+ pubkey: userStakeAccount,
11451
+ isSigner: false,
11452
+ isWritable: true
11453
+ },
11454
+ {
11455
+ pubkey: userTokenAccount,
11456
+ isSigner: false,
11457
+ isWritable: true
11458
+ },
11459
+ {
11460
+ pubkey: SYSVAR_CLOCK_ID,
11461
+ isSigner: false,
11462
+ isWritable: false
11463
+ },
11464
+ {
11465
+ pubkey: TOKEN_PROGRAM_ID,
11466
+ isSigner: false,
11467
+ isWritable: false
11468
+ },
11469
+ {
11470
+ pubkey: STAKE_PROGRAM_ID,
11471
+ isSigner: false,
11472
+ isWritable: false
11473
+ }
11474
+ ], data);
11475
+ },
11476
+ createTokenMetadata: async (pool, payer) => {
11477
+ const mint = findPoolMintAddress(pool);
11478
+ const [mintAuthority, mplAuthority, mplMetadata] = await Promise.all([
11479
+ findPoolMintAuthorityAddress(pool),
11480
+ findPoolMplAuthorityAddress(pool),
11481
+ findMplMetadataAddress(mint)
11482
+ ]);
11483
+ return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11484
+ {
11485
+ pubkey: pool,
11486
+ isSigner: false,
11487
+ isWritable: false
11488
+ },
11489
+ {
11490
+ pubkey: mint,
11491
+ isSigner: false,
11492
+ isWritable: false
11493
+ },
11494
+ {
11495
+ pubkey: mintAuthority,
11496
+ isSigner: false,
11497
+ isWritable: false
11498
+ },
11499
+ {
11500
+ pubkey: mplAuthority,
11501
+ isSigner: false,
11502
+ isWritable: false
11503
+ },
11504
+ {
11505
+ pubkey: payer,
11506
+ isSigner: true,
11507
+ isWritable: true
11508
+ },
11509
+ {
11510
+ pubkey: mplMetadata,
11511
+ isSigner: false,
11512
+ isWritable: true
11513
+ },
11514
+ {
11515
+ pubkey: MPL_METADATA_PROGRAM_ID,
11516
+ isSigner: false,
11517
+ isWritable: false
11518
+ },
11519
+ {
11520
+ pubkey: SYSTEM_PROGRAM_ID,
11521
+ isSigner: false,
11522
+ isWritable: false
11523
+ }
11524
+ ], Buffer.from([SinglePoolInstructionType.CreateTokenMetadata]));
11525
+ },
11526
+ updateTokenMetadata: async (voteAccount, authorizedWithdrawer, tokenName, tokenSymbol, tokenUri = "") => {
11527
+ if (tokenName.length > 32) {
11528
+ throw new Error("maximum token name length is 32 characters");
11333
11529
  }
11334
- ], Buffer.from([SinglePoolInstructionType.DepositStake]));
11335
- },
11336
- withdrawStake: async (pool, userStakeAccount, userStakeAuthority, userTokenAccount, tokenAmount) => {
11337
- const stake = findPoolStakeAddress(pool);
11338
- const mint = findPoolMintAddress(pool);
11339
- const stakeAuthority = findPoolStakeAuthorityAddress(pool);
11340
- const mintAuthority = findPoolMintAuthorityAddress(pool);
11341
- const rawAmount = BigInt(tokenAmount.multipliedBy(1e9).toString());
11530
+ if (tokenSymbol.length > 10) {
11531
+ throw new Error("maximum token symbol length is 10 characters");
11532
+ }
11533
+ if (tokenUri.length > 200) {
11534
+ throw new Error("maximum token uri length is 200 characters");
11535
+ }
11536
+ const pool = findPoolAddress(voteAccount);
11537
+ const [mint, mplAuthority] = await Promise.all([findPoolMintAddress(pool), findPoolMplAuthorityAddress(pool)]);
11538
+ const mplMetadata = await findMplMetadataAddress(mint);
11539
+ const data = Buffer.concat([
11540
+ Buffer.from([SinglePoolInstructionType.UpdateTokenMetadata]),
11541
+ Buffer.from(new Uint32Array([tokenName.length]).buffer),
11542
+ Buffer.from(tokenName),
11543
+ Buffer.from(new Uint32Array([tokenSymbol.length]).buffer),
11544
+ Buffer.from(tokenSymbol),
11545
+ Buffer.from(new Uint32Array([tokenUri.length]).buffer),
11546
+ Buffer.from(tokenUri)
11547
+ ]);
11548
+ return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11549
+ {
11550
+ pubkey: voteAccount,
11551
+ isSigner: false,
11552
+ isWritable: false
11553
+ },
11554
+ {
11555
+ pubkey: pool,
11556
+ isSigner: false,
11557
+ isWritable: false
11558
+ },
11559
+ {
11560
+ pubkey: mplAuthority,
11561
+ isSigner: false,
11562
+ isWritable: false
11563
+ },
11564
+ {
11565
+ pubkey: authorizedWithdrawer,
11566
+ isSigner: true,
11567
+ isWritable: false
11568
+ },
11569
+ {
11570
+ pubkey: mplMetadata,
11571
+ isSigner: false,
11572
+ isWritable: true
11573
+ },
11574
+ {
11575
+ pubkey: MPL_METADATA_PROGRAM_ID,
11576
+ isSigner: false,
11577
+ isWritable: false
11578
+ }
11579
+ ], data);
11580
+ }
11581
+ };
11582
+ createTransactionInstruction = (programId, keys, data) => {
11583
+ return {
11584
+ programId,
11585
+ keys,
11586
+ data
11587
+ };
11588
+ };
11589
+ findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
11590
+ const [pda] = PublicKey.findProgramAddressSync([Buffer.from(prefix), baseAddress.toBuffer()], programId);
11591
+ return pda;
11592
+ };
11593
+ findPoolMintAddressByVoteAccount = (voteAccountAddress) => findPda(findPoolAddress(voteAccountAddress), "mint");
11594
+ findPoolAddress = (voteAccountAddress) => findPda(voteAccountAddress, "pool");
11595
+ findPoolMintAddress = (poolAddress) => findPda(poolAddress, "mint");
11596
+ findPoolStakeAddress = (poolAddress) => findPda(poolAddress, "stake");
11597
+ findPoolStakeAuthorityAddress = (poolAddress) => findPda(poolAddress, "stake_authority");
11598
+ findPoolMintAuthorityAddress = (poolAddress) => findPda(poolAddress, "mint_authority");
11599
+ findPoolMplAuthorityAddress = (poolAddress) => findPda(poolAddress, "mpl_authority");
11600
+ findPoolOnRampAddress = (poolAddress) => findPda(poolAddress, "onramp");
11601
+ findMplMetadataAddress = async (poolMintAddress) => {
11602
+ const [pda] = PublicKey.findProgramAddressSync([
11603
+ Buffer.from("metadata"),
11604
+ MPL_METADATA_PROGRAM_ID.toBuffer(),
11605
+ poolMintAddress.toBuffer()
11606
+ ], MPL_METADATA_PROGRAM_ID);
11607
+ return pda;
11608
+ };
11609
+ SINGLE_POOL_ACCOUNT_SIZE = BigInt(33);
11610
+ STAKE_ACCOUNT_SIZE = BigInt(200);
11611
+ MINT_SIZE = BigInt(82);
11612
+ createAccountIx = (from, newAccount, lamports, space, programAddress) => {
11342
11613
  const data = Buffer.concat([
11343
- Buffer.from([SinglePoolInstructionType.WithdrawStake]),
11344
- userStakeAuthority.toBuffer(),
11345
- Buffer.from(new BN(rawAmount.toString()).toArray("le", 8))
11614
+ Buffer.from([0]),
11615
+ Buffer.from(new BN(lamports).toArray("le", 8)),
11616
+ Buffer.from(new BN(space).toArray("le", 8)),
11617
+ programAddress.toBuffer()
11346
11618
  ]);
11347
- return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11619
+ const accounts$2 = [{
11620
+ pubkey: from,
11621
+ isSigner: true,
11622
+ isWritable: true
11623
+ }, {
11624
+ pubkey: newAccount,
11625
+ isSigner: true,
11626
+ isWritable: true
11627
+ }];
11628
+ return createTransactionInstruction(SYSTEM_PROGRAM_ID, accounts$2, data);
11629
+ };
11630
+ createPoolOnrampIx = (voteAccount) => {
11631
+ const poolAccount = findPoolAddress(voteAccount);
11632
+ const onRampAccount = findPoolOnRampAddress(poolAccount);
11633
+ const poolStakeAuthority = findPoolStakeAuthorityAddress(poolAccount);
11634
+ const keys = [
11348
11635
  {
11349
- pubkey: pool,
11636
+ pubkey: poolAccount,
11350
11637
  isSigner: false,
11351
11638
  isWritable: false
11352
11639
  },
11353
11640
  {
11354
- pubkey: stake,
11641
+ pubkey: onRampAccount,
11355
11642
  isSigner: false,
11356
11643
  isWritable: true
11357
11644
  },
11358
11645
  {
11359
- pubkey: mint,
11360
- isSigner: false,
11361
- isWritable: true
11362
- },
11363
- {
11364
- pubkey: stakeAuthority,
11365
- isSigner: false,
11366
- isWritable: false
11367
- },
11368
- {
11369
- pubkey: mintAuthority,
11646
+ pubkey: poolStakeAuthority,
11370
11647
  isSigner: false,
11371
11648
  isWritable: false
11372
11649
  },
11373
11650
  {
11374
- pubkey: userStakeAccount,
11375
- isSigner: false,
11376
- isWritable: true
11377
- },
11378
- {
11379
- pubkey: userTokenAccount,
11380
- isSigner: false,
11381
- isWritable: true
11382
- },
11383
- {
11384
- pubkey: SYSVAR_CLOCK_ID,
11651
+ pubkey: SYSVAR_RENT_PUBKEY,
11385
11652
  isSigner: false,
11386
11653
  isWritable: false
11387
11654
  },
11388
11655
  {
11389
- pubkey: TOKEN_PROGRAM_ID,
11656
+ pubkey: SystemProgram.programId,
11390
11657
  isSigner: false,
11391
11658
  isWritable: false
11392
11659
  },
11393
11660
  {
11394
- pubkey: STAKE_PROGRAM_ID,
11661
+ pubkey: StakeProgram.programId,
11395
11662
  isSigner: false,
11396
11663
  isWritable: false
11397
11664
  }
11398
- ], data);
11399
- },
11400
- createTokenMetadata: async (pool, payer) => {
11401
- const mint = findPoolMintAddress(pool);
11402
- const [mintAuthority, mplAuthority, mplMetadata] = await Promise.all([
11403
- findPoolMintAuthorityAddress(pool),
11404
- findPoolMplAuthorityAddress(pool),
11405
- findMplMetadataAddress(mint)
11406
- ]);
11407
- return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11408
- {
11409
- pubkey: pool,
11410
- isSigner: false,
11411
- isWritable: false
11412
- },
11665
+ ];
11666
+ const data = Buffer.from(Uint8Array.of(6));
11667
+ return new TransactionInstruction({
11668
+ keys,
11669
+ programId: SINGLE_POOL_PROGRAM_ID,
11670
+ data
11671
+ });
11672
+ };
11673
+ replenishPoolIx = (voteAccount) => {
11674
+ const poolAccount = findPoolAddress(voteAccount);
11675
+ const stakePool = findPoolStakeAddress(poolAccount);
11676
+ const onRampPool = findPoolOnRampAddress(poolAccount);
11677
+ const authority = findPoolStakeAuthorityAddress(poolAccount);
11678
+ const keys = [
11413
11679
  {
11414
- pubkey: mint,
11680
+ pubkey: voteAccount,
11415
11681
  isSigner: false,
11416
11682
  isWritable: false
11417
11683
  },
11418
11684
  {
11419
- pubkey: mintAuthority,
11685
+ pubkey: poolAccount,
11420
11686
  isSigner: false,
11421
11687
  isWritable: false
11422
11688
  },
11423
11689
  {
11424
- pubkey: mplAuthority,
11690
+ pubkey: stakePool,
11425
11691
  isSigner: false,
11426
- isWritable: false
11427
- },
11428
- {
11429
- pubkey: payer,
11430
- isSigner: true,
11431
11692
  isWritable: true
11432
11693
  },
11433
11694
  {
11434
- pubkey: mplMetadata,
11695
+ pubkey: onRampPool,
11435
11696
  isSigner: false,
11436
11697
  isWritable: true
11437
11698
  },
11438
11699
  {
11439
- pubkey: MPL_METADATA_PROGRAM_ID,
11700
+ pubkey: authority,
11440
11701
  isSigner: false,
11441
11702
  isWritable: false
11442
11703
  },
11443
11704
  {
11444
- pubkey: SYSTEM_PROGRAM_ID,
11445
- isSigner: false,
11446
- isWritable: false
11447
- }
11448
- ], Buffer.from([SinglePoolInstructionType.CreateTokenMetadata]));
11449
- },
11450
- updateTokenMetadata: async (voteAccount, authorizedWithdrawer, tokenName, tokenSymbol, tokenUri = "") => {
11451
- if (tokenName.length > 32) {
11452
- throw new Error("maximum token name length is 32 characters");
11453
- }
11454
- if (tokenSymbol.length > 10) {
11455
- throw new Error("maximum token symbol length is 10 characters");
11456
- }
11457
- if (tokenUri.length > 200) {
11458
- throw new Error("maximum token uri length is 200 characters");
11459
- }
11460
- const pool = findPoolAddress(voteAccount);
11461
- const [mint, mplAuthority] = await Promise.all([findPoolMintAddress(pool), findPoolMplAuthorityAddress(pool)]);
11462
- const mplMetadata = await findMplMetadataAddress(mint);
11463
- const data = Buffer.concat([
11464
- Buffer.from([SinglePoolInstructionType.UpdateTokenMetadata]),
11465
- Buffer.from(new Uint32Array([tokenName.length]).buffer),
11466
- Buffer.from(tokenName),
11467
- Buffer.from(new Uint32Array([tokenSymbol.length]).buffer),
11468
- Buffer.from(tokenSymbol),
11469
- Buffer.from(new Uint32Array([tokenUri.length]).buffer),
11470
- Buffer.from(tokenUri)
11471
- ]);
11472
- return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, [
11473
- {
11474
- pubkey: voteAccount,
11705
+ pubkey: SYSVAR_CLOCK_PUBKEY,
11475
11706
  isSigner: false,
11476
11707
  isWritable: false
11477
11708
  },
11478
11709
  {
11479
- pubkey: pool,
11710
+ pubkey: SYSVAR_STAKE_HISTORY_ID,
11480
11711
  isSigner: false,
11481
11712
  isWritable: false
11482
11713
  },
11483
11714
  {
11484
- pubkey: mplAuthority,
11715
+ pubkey: STAKE_CONFIG_ID$1,
11485
11716
  isSigner: false,
11486
11717
  isWritable: false
11487
11718
  },
11488
11719
  {
11489
- pubkey: authorizedWithdrawer,
11490
- isSigner: true,
11491
- isWritable: false
11492
- },
11493
- {
11494
- pubkey: mplMetadata,
11495
- isSigner: false,
11496
- isWritable: true
11497
- },
11498
- {
11499
- pubkey: MPL_METADATA_PROGRAM_ID,
11720
+ pubkey: StakeProgram.programId,
11500
11721
  isSigner: false,
11501
11722
  isWritable: false
11502
11723
  }
11503
- ], data);
11504
- }
11505
- };
11506
- const createTransactionInstruction = (programId, keys, data) => {
11507
- return {
11508
- programId,
11509
- keys,
11510
- data
11724
+ ];
11725
+ const data = Buffer.from(Uint8Array.of(1));
11726
+ return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, keys, data);
11511
11727
  };
11512
- };
11513
- const findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
11514
- const [pda] = PublicKey.findProgramAddressSync([Buffer.from(prefix), baseAddress.toBuffer()], programId);
11515
- return pda;
11516
- };
11517
- const findPoolMintAddressByVoteAccount = (voteAccountAddress) => findPda(findPoolAddress(voteAccountAddress), "mint");
11518
- const findPoolAddress = (voteAccountAddress) => findPda(voteAccountAddress, "pool");
11519
- const findPoolMintAddress = (poolAddress) => findPda(poolAddress, "mint");
11520
- const findPoolStakeAddress = (poolAddress) => findPda(poolAddress, "stake");
11521
- const findPoolStakeAuthorityAddress = (poolAddress) => findPda(poolAddress, "stake_authority");
11522
- const findPoolMintAuthorityAddress = (poolAddress) => findPda(poolAddress, "mint_authority");
11523
- const findPoolMplAuthorityAddress = (poolAddress) => findPda(poolAddress, "mpl_authority");
11524
- const findPoolOnRampAddress = (poolAddress) => findPda(poolAddress, "onramp");
11525
- const findMplMetadataAddress = async (poolMintAddress) => {
11526
- const [pda] = PublicKey.findProgramAddressSync([
11527
- Buffer.from("metadata"),
11528
- MPL_METADATA_PROGRAM_ID.toBuffer(),
11529
- poolMintAddress.toBuffer()
11530
- ], MPL_METADATA_PROGRAM_ID);
11531
- return pda;
11532
- };
11533
- const SINGLE_POOL_ACCOUNT_SIZE = BigInt(33);
11534
- const STAKE_ACCOUNT_SIZE = BigInt(200);
11535
- const MINT_SIZE = BigInt(82);
11536
- async function initializeStakedPoolTx(connection, payer, voteAccountAddress) {
11537
- const instructions$3 = await initializeStakedPoolIxs(connection, payer, voteAccountAddress);
11538
- const tx = new Transaction().add(...instructions$3);
11539
- return tx;
11540
- }
11541
- async function initializeStakedPoolIxs(connection, payer, voteAccountAddress) {
11542
- const poolAddress = findPoolAddress(voteAccountAddress);
11543
- const stakeAddress = findPoolStakeAddress(poolAddress);
11544
- const mintAddress = findPoolMintAddress(poolAddress);
11545
- const onRampAddress = findPoolOnRampAddress(poolAddress);
11546
- const [poolRent, stakeRent, mintRent, minimumDelegationObj] = await Promise.all([
11547
- connection.getMinimumBalanceForRentExemption(Number(SINGLE_POOL_ACCOUNT_SIZE), "confirmed"),
11548
- connection.getMinimumBalanceForRentExemption(Number(STAKE_ACCOUNT_SIZE), "confirmed"),
11549
- connection.getMinimumBalanceForRentExemption(Number(MINT_SIZE), "confirmed"),
11550
- connection.getStakeMinimumDelegation()
11551
- ]);
11552
- const minimumDelegation = minimumDelegationObj.value;
11553
- const instructions$3 = [];
11554
- instructions$3.push(SystemProgram.transfer({
11555
- fromPubkey: payer,
11556
- toPubkey: poolAddress,
11557
- lamports: poolRent
11558
- }));
11559
- instructions$3.push(SystemProgram.transfer({
11560
- fromPubkey: payer,
11561
- toPubkey: stakeAddress,
11562
- lamports: stakeRent + minimumDelegation + LAMPORTS_PER_SOL * 1
11563
- }));
11564
- instructions$3.push(SystemProgram.transfer({
11565
- fromPubkey: payer,
11566
- toPubkey: onRampAddress,
11567
- lamports: stakeRent
11568
- }));
11569
- instructions$3.push(SystemProgram.transfer({
11570
- fromPubkey: payer,
11571
- toPubkey: mintAddress,
11572
- lamports: mintRent
11573
- }));
11574
- instructions$3.push(SinglePoolInstruction.initializePool(voteAccountAddress));
11575
- instructions$3.push(SinglePoolInstruction.initializeOnRamp(poolAddress));
11576
- instructions$3.push(await SinglePoolInstruction.createTokenMetadata(poolAddress, payer));
11577
- return instructions$3;
11578
- }
11579
- const createAccountIx = (from, newAccount, lamports, space, programAddress) => {
11580
- const data = Buffer.concat([
11581
- Buffer.from([0]),
11582
- Buffer.from(new BN(lamports).toArray("le", 8)),
11583
- Buffer.from(new BN(space).toArray("le", 8)),
11584
- programAddress.toBuffer()
11585
- ]);
11586
- const accounts$2 = [{
11587
- pubkey: from,
11588
- isSigner: true,
11589
- isWritable: true
11590
- }, {
11591
- pubkey: newAccount,
11592
- isSigner: true,
11593
- isWritable: true
11594
- }];
11595
- return createTransactionInstruction(SYSTEM_PROGRAM_ID, accounts$2, data);
11596
- };
11597
- const createPoolOnrampIx = (voteAccount) => {
11598
- const poolAccount = findPoolAddress(voteAccount);
11599
- const onRampAccount = findPoolOnRampAddress(poolAccount);
11600
- const poolStakeAuthority = findPoolStakeAuthorityAddress(poolAccount);
11601
- const keys = [
11602
- {
11603
- pubkey: poolAccount,
11604
- isSigner: false,
11605
- isWritable: false
11606
- },
11607
- {
11608
- pubkey: onRampAccount,
11609
- isSigner: false,
11610
- isWritable: true
11611
- },
11612
- {
11613
- pubkey: poolStakeAuthority,
11614
- isSigner: false,
11615
- isWritable: false
11616
- },
11617
- {
11618
- pubkey: SYSVAR_RENT_PUBKEY,
11619
- isSigner: false,
11620
- isWritable: false
11621
- },
11622
- {
11623
- pubkey: SystemProgram.programId,
11624
- isSigner: false,
11625
- isWritable: false
11626
- },
11627
- {
11628
- pubkey: StakeProgram.programId,
11629
- isSigner: false,
11630
- isWritable: false
11631
- }
11632
- ];
11633
- const data = Buffer.from(Uint8Array.of(6));
11634
- return new TransactionInstruction({
11635
- keys,
11636
- programId: SINGLE_POOL_PROGRAM_ID,
11637
- data
11638
- });
11639
- };
11640
- const replenishPoolIx = (voteAccount) => {
11641
- const poolAccount = findPoolAddress(voteAccount);
11642
- const stakePool = findPoolStakeAddress(poolAccount);
11643
- const onRampPool = findPoolOnRampAddress(poolAccount);
11644
- const authority = findPoolStakeAuthorityAddress(poolAccount);
11645
- const keys = [
11646
- {
11647
- pubkey: voteAccount,
11648
- isSigner: false,
11649
- isWritable: false
11650
- },
11651
- {
11652
- pubkey: poolAccount,
11653
- isSigner: false,
11654
- isWritable: false
11655
- },
11656
- {
11657
- pubkey: stakePool,
11658
- isSigner: false,
11659
- isWritable: true
11660
- },
11661
- {
11662
- pubkey: onRampPool,
11663
- isSigner: false,
11664
- isWritable: true
11665
- },
11666
- {
11667
- pubkey: authority,
11668
- isSigner: false,
11669
- isWritable: false
11670
- },
11671
- {
11672
- pubkey: SYSVAR_CLOCK_PUBKEY,
11673
- isSigner: false,
11674
- isWritable: false
11675
- },
11676
- {
11677
- pubkey: SYSVAR_STAKE_HISTORY_ID,
11678
- isSigner: false,
11679
- isWritable: false
11680
- },
11681
- {
11682
- pubkey: STAKE_CONFIG_ID$1,
11683
- isSigner: false,
11684
- isWritable: false
11685
- },
11686
- {
11687
- pubkey: StakeProgram.programId,
11688
- isSigner: false,
11689
- isWritable: false
11690
- }
11691
- ];
11692
- const data = Buffer.from(Uint8Array.of(1));
11693
- return createTransactionInstruction(SINGLE_POOL_PROGRAM_ID, keys, data);
11694
- };
11728
+ } });
11695
11729
 
11696
11730
  //#endregion
11697
11731
  //#region src/vendor/switchboard_legacy/account.ts
@@ -15989,9 +16023,11 @@ __export(vendor_exports, {
15989
16023
  replenishPoolIx: () => replenishPoolIx,
15990
16024
  switchboardAccountCoder: () => switchboardAccountCoder
15991
16025
  });
16026
+ init_single_spl_pool();
15992
16027
 
15993
16028
  //#endregion
15994
16029
  //#region src/utils.ts
16030
+ init_constants();
15995
16031
  function getBankVaultSeeds(type) {
15996
16032
  switch (type) {
15997
16033
  case BankVaultType.LiquidityVault: return PDA_BANK_LIQUIDITY_VAULT_SEED;
@@ -18723,6 +18759,7 @@ let PriceBias = /* @__PURE__ */ function(PriceBias$1) {
18723
18759
 
18724
18760
  //#endregion
18725
18761
  //#region src/services/price/utils/compute.utils.ts
18762
+ init_constants();
18726
18763
  function getPriceWithConfidence(oraclePrice, weighted) {
18727
18764
  return weighted ? oraclePrice.priceWeighted : oraclePrice.priceRealtime;
18728
18765
  }
@@ -19690,6 +19727,7 @@ function bankConfigRawToDto(bankConfigRaw) {
19690
19727
 
19691
19728
  //#endregion
19692
19729
  //#region src/services/bank/bank.service.ts
19730
+ init_constants();
19693
19731
  async function freezeBankConfigIx(program, bankAddress, bankConfigOpt) {
19694
19732
  if (!bankConfigOpt) {}
19695
19733
  const bankConfigRaw = serializeBankConfigOpt(bankConfigOpt);
@@ -20061,6 +20099,7 @@ async function executeBundleSimulation(rpcEndpoint, encodedTransactions, config)
20061
20099
 
20062
20100
  //#endregion
20063
20101
  //#region src/services/transaction/transaction.service.ts
20102
+ init_constants();
20064
20103
  const DEFAULT_PROCESS_TX_OPTS = {
20065
20104
  broadcastType: "RPC",
20066
20105
  isSequentialTxs: true,
@@ -20657,6 +20696,7 @@ function addTransactionTxTags(transactions) {
20657
20696
 
20658
20697
  //#endregion
20659
20698
  //#region src/services/account/utils/compute.utils.ts
20699
+ init_single_spl_pool();
20660
20700
  /**
20661
20701
  * Lendr Account Computes
20662
20702
  * =========================
@@ -21608,6 +21648,8 @@ function getActiveStaleBanks(balances, banks, additionalBanks, oraclePrices, max
21608
21648
 
21609
21649
  //#endregion
21610
21650
  //#region src/services/group/group.service.ts
21651
+ init_constants();
21652
+ init_single_spl_pool();
21611
21653
  async function makePoolConfigureBankIx(program, bank, args) {
21612
21654
  const ix = await instructions_default.makePoolConfigureBankIx(program, { bank }, { bankConfigOpt: args });
21613
21655
  return {
@@ -21741,6 +21783,8 @@ function dtoToValidatorStakeGroup(validatorStakeGroupDto) {
21741
21783
 
21742
21784
  //#endregion
21743
21785
  //#region src/services/native-stake/utils/fetch.utils.ts
21786
+ init_constants();
21787
+ init_single_spl_pool();
21744
21788
  /**
21745
21789
  * Retrieves all active stake accounts associated with a given public key grouped by validator
21746
21790
  *
@@ -22536,7 +22580,7 @@ var LendrAccount = class LendrAccount {
22536
22580
  group: opts.overrideInferAccounts?.group ?? this.group,
22537
22581
  liquidityVault: opts.overrideInferAccounts?.liquidityVault ?? bank.liquidityVault
22538
22582
  }, ixArguments, remainingAccounts.map((account) => ({
22539
- pubkey: account,
22583
+ pubkey: account.pubkey,
22540
22584
  isSigner: false,
22541
22585
  isWritable: false
22542
22586
  })));
@@ -22548,9 +22592,6 @@ var LendrAccount = class LendrAccount {
22548
22592
  }
22549
22593
  async makeDepositWithSessionIx(program, banks, mintDatas, amount, bankAddress, sessionKey, opts = {}) {
22550
22594
  const { depositIxs, ixArguments, userTokenAtaPk, mintData, remainingAccounts } = await this.prepareDepositIx(banks, mintDatas, amount, bankAddress, opts);
22551
- const PAYMASTER_DESTINATION = new PublicKey("43TSuDshgvKXuQCmDwHXmF4s3hH3nmDNJsvWGhoNnb7v");
22552
- const transferIx = createTransferInstruction(userTokenAtaPk, PAYMASTER_DESTINATION, this.authority, 1e4, [], TOKEN_PROGRAM_ID);
22553
- depositIxs.unshift(transferIx);
22554
22595
  const accounts$2 = {
22555
22596
  sessionKey,
22556
22597
  lendrAccount: this.address,
@@ -22651,7 +22692,7 @@ var LendrAccount = class LendrAccount {
22651
22692
  keys: []
22652
22693
  };
22653
22694
  }
22654
- async prepareWithdrawInstruction(program, bankMap, mintDatas, bankAddress, withdrawAll = false, withdrawOpts = {}) {
22695
+ async prepareWithdrawInstruction(program, bankMap, mintDatas, bankMetadataMap, bankAddress, withdrawAll = false, withdrawOpts = {}) {
22655
22696
  const bank = bankMap.get(bankAddress.toBase58());
22656
22697
  if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
22657
22698
  const mintData = mintDatas.get(bankAddress.toBase58());
@@ -22675,9 +22716,23 @@ var LendrAccount = class LendrAccount {
22675
22716
  if (withdrawOpts.observationBanksOverride) {
22676
22717
  remainingAccounts.push(...withdrawOpts.observationBanksOverride);
22677
22718
  } else {
22678
- const accountMetas = computeHealthAccountMetas(healthAccounts);
22719
+ const accountMetas = computeHealthAccountMetas(healthAccounts, bankMetadataMap);
22679
22720
  remainingAccounts.push(...accountMetas);
22680
22721
  }
22722
+ if (withdrawAll) {
22723
+ remainingAccounts.push(bank.address, bank.config.oracleKeys[0]);
22724
+ if (bank.config.assetTag === 2) {
22725
+ const bankMetadata = bankMetadataMap?.[bankAddress.toBase58()];
22726
+ if (!bankMetadata?.validatorVoteAccount) {
22727
+ throw Error(`No validator vote account for staked bank ${bankAddress.toBase58()}`);
22728
+ }
22729
+ const { findPoolAddress: findPoolAddress$1, findPoolStakeAddress: findPoolStakeAddress$1, findPoolMintAddress: findPoolMintAddress$1 } = (init_single_spl_pool(), __toCommonJS(single_spl_pool_exports));
22730
+ const pool = findPoolAddress$1(new PublicKey(bankMetadata.validatorVoteAccount));
22731
+ const solPool = findPoolStakeAddress$1(pool);
22732
+ const lstMint = findPoolMintAddress$1(pool);
22733
+ remainingAccounts.push(lstMint, solPool);
22734
+ }
22735
+ }
22681
22736
  return {
22682
22737
  withdrawIxs,
22683
22738
  wrapAndUnwrapSol,
@@ -22691,8 +22746,8 @@ var LendrAccount = class LendrAccount {
22691
22746
  }))
22692
22747
  };
22693
22748
  }
22694
- async makeWithdrawIx(program, bankMap, mintDatas, amount, bankAddress, withdrawAll = false, withdrawOpts = {}) {
22695
- const { withdrawIxs, wrapAndUnwrapSol, userAta, mintData, bank, remainingAccounts } = await this.prepareWithdrawInstruction(program, bankMap, mintDatas, bankAddress, withdrawAll, withdrawOpts);
22749
+ async makeWithdrawIx(program, bankMap, mintDatas, bankMetadataMap, amount, bankAddress, withdrawAll = false, withdrawOpts = {}) {
22750
+ const { withdrawIxs, wrapAndUnwrapSol, userAta, mintData, bank, remainingAccounts } = await this.prepareWithdrawInstruction(program, bankMap, mintDatas, bankMetadataMap, bankAddress, withdrawAll, withdrawOpts);
22696
22751
  const [bankLiquidityVaultAuthority] = getBankVaultAuthority(BankVaultType.LiquidityVault, bank.address, program.programId);
22697
22752
  const withdrawIx = await instructions_default.makeWithdrawIx(program, {
22698
22753
  lendrAccount: this.address,
@@ -22716,8 +22771,8 @@ var LendrAccount = class LendrAccount {
22716
22771
  keys: []
22717
22772
  };
22718
22773
  }
22719
- async makeWithdrawWithSessionIx(program, bankMap, mintDatas, amount, bankAddress, session, withdrawAll = false, withdrawOpts = {}) {
22720
- const { withdrawIxs, wrapAndUnwrapSol, userAta, mintData, bank, remainingAccounts } = await this.prepareWithdrawInstruction(program, bankMap, mintDatas, bankAddress, withdrawAll, {
22774
+ async makeWithdrawWithSessionIx(program, bankMap, mintDatas, bankMetadataMap, amount, bankAddress, session, withdrawAll = false, withdrawOpts = {}) {
22775
+ const { withdrawIxs, wrapAndUnwrapSol, userAta, mintData, bank, remainingAccounts } = await this.prepareWithdrawInstruction(program, bankMap, mintDatas, bankMetadataMap, bankAddress, withdrawAll, {
22721
22776
  ...withdrawOpts,
22722
22777
  createAtaPayer: session.payer
22723
22778
  });
@@ -23035,6 +23090,7 @@ function isWeightedPrice(reqType) {
23035
23090
 
23036
23091
  //#endregion
23037
23092
  //#region src/models/account/wrapper.ts
23093
+ init_constants();
23038
23094
  var LendrAccountWrapper = class LendrAccountWrapper {
23039
23095
  address;
23040
23096
  _lendrAccount;
@@ -23049,7 +23105,7 @@ var LendrAccountWrapper = class LendrAccountWrapper {
23049
23105
  static async fetch(lendrAccountPk, client, commitment) {
23050
23106
  const { config, program } = client;
23051
23107
  const _lendrAccountPk = translateAddress(lendrAccountPk);
23052
- const accountData = await LendrAccountWrapper._fetchAccountData(_lendrAccountPk, config, program, commitment);
23108
+ const accountData = await LendrAccountWrapper.fetchAccountData(_lendrAccountPk, config, program, commitment);
23053
23109
  const lendrAccount = LendrAccount.fromAccountParsed(_lendrAccountPk, accountData);
23054
23110
  const lendrAccountProxy = new LendrAccountWrapper(_lendrAccountPk, client, lendrAccount);
23055
23111
  client.logger.debug({ accountPk: _lendrAccountPk }, "[lendr:lendr-account] Loaded lendr account");
@@ -23942,7 +23998,8 @@ var LendrAccountWrapper = class LendrAccountWrapper {
23942
23998
  async makeWithdrawIx(amount, bankAddress, withdrawAll = false, withdrawOpts = {}) {
23943
23999
  const tokenProgramAddress = this.client.mintDatas.get(bankAddress.toBase58())?.tokenProgram;
23944
24000
  if (!tokenProgramAddress) throw Error("Withdraw mint not found");
23945
- return this._lendrAccount.makeWithdrawIx(this._program, this.client.banks, this.client.mintDatas, amount, bankAddress, withdrawAll, withdrawOpts);
24001
+ if (!this.client.bankMetadataMap) throw Error("Bank metadata map not found");
24002
+ return this._lendrAccount.makeWithdrawIx(this._program, this.client.banks, this.client.mintDatas, this.client.bankMetadataMap, amount, bankAddress, withdrawAll, withdrawOpts);
23946
24003
  }
23947
24004
  /**
23948
24005
  * Creates instructions for withdrawing tokens from a lendr bank account.
@@ -23958,7 +24015,8 @@ var LendrAccountWrapper = class LendrAccountWrapper {
23958
24015
  async makeWithdrawWithSessionIx(amount, bankAddress, session, withdrawAll = false, withdrawOpts = {}) {
23959
24016
  const tokenProgramAddress = this.client.mintDatas.get(bankAddress.toBase58())?.tokenProgram;
23960
24017
  if (!tokenProgramAddress) throw Error("Withdraw mint not found");
23961
- return this._lendrAccount.makeWithdrawWithSessionIx(this._program, this.client.banks, this.client.mintDatas, amount, bankAddress, session, withdrawAll, withdrawOpts);
24018
+ if (!this.client.bankMetadataMap) throw Error("Bank metadata map not found");
24019
+ return this._lendrAccount.makeWithdrawWithSessionIx(this._program, this.client.banks, this.client.mintDatas, this.client.bankMetadataMap, amount, bankAddress, session, withdrawAll, withdrawOpts);
23962
24020
  }
23963
24021
  /**
23964
24022
  * Creates a transaction for withdrawing tokens from a lendr bank account and staking them.
@@ -24605,6 +24663,12 @@ var LendrAccountWrapper = class LendrAccountWrapper {
24605
24663
  async makePulseHealthIx(mandatoryBanks = [], excludedBanks = []) {
24606
24664
  return this._lendrAccount.makePulseHealthIx(this._program, this.client.banks, mandatoryBanks, excludedBanks, this.client.bankMetadataMap || {});
24607
24665
  }
24666
+ static async fetchAccountData(accountAddress, config, program, commitment) {
24667
+ const mergedCommitment = commitment ?? program.provider.connection.commitment ?? DEFAULT_COMMITMENT;
24668
+ const data = await program.account.lendrAccount.fetch(accountAddress, mergedCommitment);
24669
+ if (!data.group.equals(config.groupPk)) throw Error(`Lendr account tied to group ${data.group.toBase58()}. Expected: ${config.groupPk.toBase58()}`);
24670
+ return data;
24671
+ }
24608
24672
  static async encode(decoded, idl) {
24609
24673
  const coder = new BorshCoder(idl);
24610
24674
  return await coder.accounts.encode(AccountType.LendrAccount, decoded);
@@ -24778,6 +24842,7 @@ var LendrGroup = class LendrGroup {
24778
24842
 
24779
24843
  //#endregion
24780
24844
  //#region src/clients/client.ts
24845
+ init_constants();
24781
24846
  /**
24782
24847
  * Entrypoint to interact with the lendr contract.
24783
24848
  */
@@ -24909,6 +24974,22 @@ var LendrClient = class LendrClient {
24909
24974
  });
24910
24975
  }
24911
24976
  /**
24977
+ * Fetches address lookup tables from the provided addresses
24978
+ * @param connection The Solana connection
24979
+ * @param addressLookupTableAddresses Optional array of address lookup table addresses to fetch
24980
+ * @param logger Optional logger
24981
+ * @returns Array of address lookup table accounts
24982
+ */
24983
+ static async fetchAddressLookupTables(connection, addressLookupTableAddresses, logger = new NoopLogger()) {
24984
+ if (!addressLookupTableAddresses || addressLookupTableAddresses.length === 0) {
24985
+ logger.debug({}, "[lendr:client] No address lookup table addresses provided");
24986
+ return [];
24987
+ }
24988
+ logger.debug({ for: addressLookupTableAddresses }, "[lendr:client] Fetching address lookup tables");
24989
+ const addressLookupTables = (await Promise.all(addressLookupTableAddresses.map((address$2) => connection.getAddressLookupTable(address$2)))).map((response) => response?.value).filter((table) => table !== null);
24990
+ return addressLookupTables;
24991
+ }
24992
+ /**
24912
24993
  * Fetches all data for a group, including banks and oracle prices
24913
24994
  * NOTE: If bankAddresses not provided, this will make 2 RPC calls
24914
24995
  * @param connection
@@ -25280,21 +25361,12 @@ var LendrClient = class LendrClient {
25280
25361
  }
25281
25362
  async makeCreateLendrAccountWithSessionIx(session, accountIndex, thirdPartyId) {
25282
25363
  this.logger.debug({ for: session.walletPublicKey.toBase58() }, "Generating lendr account init with session ix");
25283
- const PAYMASTER_DESTINATION = new PublicKey("43TSuDshgvKXuQCmDwHXmF4s3hH3nmDNJsvWGhoNnb7v");
25284
- const userTokenAtaPk = getAssociatedTokenAddressSync(NATIVE_MINT, session.walletPublicKey, true);
25285
- const transferIx = createTransferInstruction(userTokenAtaPk, PAYMASTER_DESTINATION, session.walletPublicKey, 1e4, [], TOKEN_PROGRAM_ID);
25286
- this.logger.debug({
25287
- transferFrom: userTokenAtaPk.toBase58(),
25288
- transferTo: PAYMASTER_DESTINATION.toBase58(),
25289
- amount: 1e4,
25290
- programId: TOKEN_PROGRAM_ID.toBase58()
25291
- }, "Adding paymaster transfer instruction to initialize tx");
25292
25364
  const initLendrAccountIx = await instructions_default.makeInitLendrAccountWithSessionIx(this.program, {
25293
25365
  lendrGroup: this.groupAddress,
25294
25366
  session,
25295
25367
  feePayer: session.payer
25296
25368
  }, accountIndex, thirdPartyId);
25297
- const ixs = [transferIx, initLendrAccountIx];
25369
+ const ixs = [initLendrAccountIx];
25298
25370
  this.logger.debug({
25299
25371
  numInstructions: ixs.length,
25300
25372
  instructions: ixs.map((ix, i) => ({
@@ -25339,11 +25411,13 @@ var LendrClient = class LendrClient {
25339
25411
  const tx = await this.createLendrAccountWithSessionTx(session, accountIndex, thirdPartyId);
25340
25412
  const txResult = await session.sendTransaction(tx);
25341
25413
  this.logger.debug({ txResult }, "Created Lendr account (using session)");
25414
+ const thirdPartyIdValue = thirdPartyId ?? 0;
25342
25415
  const [accountPublicKey] = PublicKey.findProgramAddressSync([
25343
- Buffer.from("pyroners"),
25344
- session.walletPublicKey.toBuffer(),
25416
+ Buffer.from("lendr_account"),
25345
25417
  this.groupAddress.toBuffer(),
25346
- new BN$1(accountIndex).toArrayLike(Buffer, "le", 8)
25418
+ session.walletPublicKey.toBuffer(),
25419
+ Buffer.from(new Uint16Array([accountIndex]).buffer),
25420
+ Buffer.from(new Uint16Array([thirdPartyIdValue]).buffer)
25347
25421
  ], this.programId);
25348
25422
  try {
25349
25423
  return {
@@ -25680,6 +25754,10 @@ var EmodeSettings = class EmodeSettings {
25680
25754
  }
25681
25755
  };
25682
25756
 
25757
+ //#endregion
25758
+ //#region src/index.ts
25759
+ init_constants();
25760
+
25683
25761
  //#endregion
25684
25762
  export { AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_CLUSTER, DEFAULT_COMMITMENT, DEFAULT_CONFIRM_OPTS, DEFAULT_ORACLE_MAX_AGE, DEFAULT_PROCESS_TX_OPTS, DEFAULT_PROCESS_TX_STRATEGY, DEFAULT_SEND_OPTS, DISABLED_FLAG, DUMMY_USDC_MINT, DataFetcher, DummyMetadataFetcher, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, FogoMetadataFetcher, GROUP_PK, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, JUPITER_V6_PROGRAM, LENDR_IDL, LENDR_PROGRAM, LENDR_SPONSORED_SHARD_ID, LST_MINT, LUT_PROGRAM_AUTHORITY_INDEX, LendrAccount, LendrAccountWrapper, client_default as LendrClient, LendrGroup, LendrRequirementType, MAX_ACCOUNT_KEYS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MetadataService, MetaplexMetadataFetcher, OperationalState, OracleSetup, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PRIORITY_TX_SIZE, PROGRAM_ID, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, ProcessTransactionError, ProcessTransactionErrorType, RiskTier, SINGLE_POOL_PROGRAM_ID, SKIP_SIMULATION, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, USDC_DECIMALS, USDC_MINT, WSOL_EXTENDED_METADATA, WSOL_MINT, accountFlagToBN, addOracleToBanksIx, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankRawToDto, buildFeedIdMap, computeAccountValue, computeActiveEmodePairs, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeEmodeImpacts, computeFreeCollateral, computeFreeCollateralLegacy, computeHealthAccountMetas, computeHealthCheckAccounts, computeHealthComponents, computeHealthComponentsLegacy, computeHealthComponentsWithoutBiasLegacy, computeInterestRates, computeLiabilityUsdValue, computeLoopingParams, computeMaxLeverage, computeNetApy, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, confirmTransaction, crankPythOracleIx, createLendrAccountTx, createUpdateFeedIx, decodeAccountRaw, decodeBankRaw, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToLendrAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, feedIdToString, fetchLendrAccountAddresses, fetchLendrAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchPythOracleData, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleData, findOracleKey, findPythPushOracleAddress, freezeBankConfigIx, getActiveAccountFlags, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getActiveStaleBanks, getAssetQuantity, getAssetShares, getAssetWeight, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getConfig, getConfigPda, getHealthCacheStatusDescription, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getPrice, getPriceFeedAccountForProgram, getPriceWithConfidence, getTotalAssetQuantity, getTotalLiabilityQuantity, getTreasuryPda, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, instructions_default as instructions, isOracleSetupSupported, isWeightedPrice, lendrAccountToDto, makeAddPermissionlessStakedBankIx, makeBundleTipIx, makePoolAddBankIx, makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx, makeTxPriorityIx, makeUnwrapSolIx, makeVersionedTransaction, makeWrapSolIxs, metadataSchema, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseErrorFromLogs, parseLendrAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseTransactionError, processTransactions, serializeBankConfigOpt, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateTransactions, toBankConfigDto, toBankDto, toEmodeSettingsDto, toInterestRateConfigDto, validatorStakeGroupToDto, vendor_exports as vendor };
25685
25763
  //# sourceMappingURL=index.js.map