@pyron-finance/pyron-client 2.7.2 → 2.8.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-X4_5k9-u.d.cts → bank-metadata-C06TNYXi.d.cts} +1 -0
- package/dist/{bank-metadata-X4_5k9-u.d.ts → bank-metadata-C06TNYXi.d.ts} +1 -0
- package/dist/common/index.cjs +3 -0
- package/dist/common/index.d.cts +2 -2
- package/dist/common/index.d.ts +2 -2
- package/dist/common/index.js +3 -0
- package/dist/index.cjs +96 -4
- package/dist/index.d.cts +80 -4
- package/dist/index.d.ts +80 -4
- package/dist/index.js +95 -4
- package/package.json +1 -1
|
@@ -9274,6 +9274,7 @@ declare enum TransactionType {
|
|
|
9274
9274
|
UNSTAKE_LST = "UNSTAKE_LST",
|
|
9275
9275
|
WITHDRAW_EMISSIONS = "WITHDRAW_EMISSIONS",
|
|
9276
9276
|
LIQUIDATE_ACCOUNT = "LIQUIDATE_ACCOUNT",
|
|
9277
|
+
HANDLE_BANKRUPTCY = "HANDLE_BANKRUPTCY",
|
|
9277
9278
|
CREATE_PERM_BANK = "CREATE_PERM_BANK",
|
|
9278
9279
|
CREATE_GROUP = "CREATE_GROUP",
|
|
9279
9280
|
JUPITER_SWAP = "JUPITER_SWAP"
|
|
@@ -9274,6 +9274,7 @@ declare enum TransactionType {
|
|
|
9274
9274
|
UNSTAKE_LST = "UNSTAKE_LST",
|
|
9275
9275
|
WITHDRAW_EMISSIONS = "WITHDRAW_EMISSIONS",
|
|
9276
9276
|
LIQUIDATE_ACCOUNT = "LIQUIDATE_ACCOUNT",
|
|
9277
|
+
HANDLE_BANKRUPTCY = "HANDLE_BANKRUPTCY",
|
|
9277
9278
|
CREATE_PERM_BANK = "CREATE_PERM_BANK",
|
|
9278
9279
|
CREATE_GROUP = "CREATE_GROUP",
|
|
9279
9280
|
JUPITER_SWAP = "JUPITER_SWAP"
|
package/dist/common/index.cjs
CHANGED
|
@@ -344,6 +344,7 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
|
344
344
|
TransactionType2["UNSTAKE_LST"] = "UNSTAKE_LST";
|
|
345
345
|
TransactionType2["WITHDRAW_EMISSIONS"] = "WITHDRAW_EMISSIONS";
|
|
346
346
|
TransactionType2["LIQUIDATE_ACCOUNT"] = "LIQUIDATE_ACCOUNT";
|
|
347
|
+
TransactionType2["HANDLE_BANKRUPTCY"] = "HANDLE_BANKRUPTCY";
|
|
347
348
|
TransactionType2["CREATE_PERM_BANK"] = "CREATE_PERM_BANK";
|
|
348
349
|
TransactionType2["CREATE_GROUP"] = "CREATE_GROUP";
|
|
349
350
|
TransactionType2["JUPITER_SWAP"] = "JUPITER_SWAP";
|
|
@@ -419,6 +420,8 @@ var TransactionConfigMap = {
|
|
|
419
420
|
["WITHDRAW_EMISSIONS" /* WITHDRAW_EMISSIONS */]: { label: () => "Withdraw emissions" },
|
|
420
421
|
// LIQUIDATE
|
|
421
422
|
["LIQUIDATE_ACCOUNT" /* LIQUIDATE_ACCOUNT */]: { label: () => "Liquidate account" },
|
|
423
|
+
// BANKRUPTCY
|
|
424
|
+
["HANDLE_BANKRUPTCY" /* HANDLE_BANKRUPTCY */]: { label: () => "Handle bad debt settlement" },
|
|
422
425
|
// BANK and GROUPS
|
|
423
426
|
["CREATE_PERM_BANK" /* CREATE_PERM_BANK */]: { label: () => "Create permissionless bank" },
|
|
424
427
|
["CREATE_GROUP" /* CREATE_GROUP */]: { label: () => "Create lendr group" },
|
package/dist/common/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Keypair, Transaction, VersionedTransaction, PublicKey, Connection, AccountInfo, AddressLookupTableAccount, TransactionMessage, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
-
import { j as Wallet, e as ExtendedTransactionProperties, S as SolanaTransaction, W as WrappedI80F48, A as Amount } from '../bank-metadata-
|
|
3
|
-
export { a as BankExtendedMetadata, m as BankExtendedMetadataMap, X as BankExtendedMetadataOverride, h as BankMetadata, b as BankMetadataMap, l as BanksExtendedMetadataOverrideMap, E as ExtendedTransaction, f as ExtendedV0Transaction, I as InstructionsWrapper, D as MaxCapType, G as PriotitizationFeeLevels, P as Program, R as ProgramReadonly, z as TransactionArenaKeyMap, g as TransactionBroadcastType, y as TransactionConfigMap, d as TransactionOptions, C as TransactionPriorityType, F as TransactionSettings, x as TransactionType, U as WalletToken, V as bankExtendedMetadataOverrideSchema, Z as fetchBanksExtendedMetadata, H as getCalculatedPrioritizationFeeByPercentile, K as getMaxPrioritizationFeeByPercentile, N as getMeanPrioritizationFeeByPercentile, O as getMedianPrioritizationFeeByPercentile, J as getMinPrioritizationFeeByPercentile, Q as getRecentPrioritizationFeesByPercentile, Y as parseBanksMetadataOverride } from '../bank-metadata-
|
|
2
|
+
import { j as Wallet, e as ExtendedTransactionProperties, S as SolanaTransaction, W as WrappedI80F48, A as Amount } from '../bank-metadata-C06TNYXi.cjs';
|
|
3
|
+
export { a as BankExtendedMetadata, m as BankExtendedMetadataMap, X as BankExtendedMetadataOverride, h as BankMetadata, b as BankMetadataMap, l as BanksExtendedMetadataOverrideMap, E as ExtendedTransaction, f as ExtendedV0Transaction, I as InstructionsWrapper, D as MaxCapType, G as PriotitizationFeeLevels, P as Program, R as ProgramReadonly, z as TransactionArenaKeyMap, g as TransactionBroadcastType, y as TransactionConfigMap, d as TransactionOptions, C as TransactionPriorityType, F as TransactionSettings, x as TransactionType, U as WalletToken, V as bankExtendedMetadataOverrideSchema, Z as fetchBanksExtendedMetadata, H as getCalculatedPrioritizationFeeByPercentile, K as getMaxPrioritizationFeeByPercentile, N as getMeanPrioritizationFeeByPercentile, O as getMedianPrioritizationFeeByPercentile, J as getMinPrioritizationFeeByPercentile, Q as getRecentPrioritizationFeesByPercentile, Y as parseBanksMetadataOverride } from '../bank-metadata-C06TNYXi.cjs';
|
|
4
4
|
import { Idl, Instruction, Address } from '@coral-xyz/anchor';
|
|
5
5
|
import BigNumber from 'bignumber.js';
|
|
6
6
|
import BN from 'bn.js';
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Keypair, Transaction, VersionedTransaction, PublicKey, Connection, AccountInfo, AddressLookupTableAccount, TransactionMessage, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
-
import { j as Wallet, e as ExtendedTransactionProperties, S as SolanaTransaction, W as WrappedI80F48, A as Amount } from '../bank-metadata-
|
|
3
|
-
export { a as BankExtendedMetadata, m as BankExtendedMetadataMap, X as BankExtendedMetadataOverride, h as BankMetadata, b as BankMetadataMap, l as BanksExtendedMetadataOverrideMap, E as ExtendedTransaction, f as ExtendedV0Transaction, I as InstructionsWrapper, D as MaxCapType, G as PriotitizationFeeLevels, P as Program, R as ProgramReadonly, z as TransactionArenaKeyMap, g as TransactionBroadcastType, y as TransactionConfigMap, d as TransactionOptions, C as TransactionPriorityType, F as TransactionSettings, x as TransactionType, U as WalletToken, V as bankExtendedMetadataOverrideSchema, Z as fetchBanksExtendedMetadata, H as getCalculatedPrioritizationFeeByPercentile, K as getMaxPrioritizationFeeByPercentile, N as getMeanPrioritizationFeeByPercentile, O as getMedianPrioritizationFeeByPercentile, J as getMinPrioritizationFeeByPercentile, Q as getRecentPrioritizationFeesByPercentile, Y as parseBanksMetadataOverride } from '../bank-metadata-
|
|
2
|
+
import { j as Wallet, e as ExtendedTransactionProperties, S as SolanaTransaction, W as WrappedI80F48, A as Amount } from '../bank-metadata-C06TNYXi.js';
|
|
3
|
+
export { a as BankExtendedMetadata, m as BankExtendedMetadataMap, X as BankExtendedMetadataOverride, h as BankMetadata, b as BankMetadataMap, l as BanksExtendedMetadataOverrideMap, E as ExtendedTransaction, f as ExtendedV0Transaction, I as InstructionsWrapper, D as MaxCapType, G as PriotitizationFeeLevels, P as Program, R as ProgramReadonly, z as TransactionArenaKeyMap, g as TransactionBroadcastType, y as TransactionConfigMap, d as TransactionOptions, C as TransactionPriorityType, F as TransactionSettings, x as TransactionType, U as WalletToken, V as bankExtendedMetadataOverrideSchema, Z as fetchBanksExtendedMetadata, H as getCalculatedPrioritizationFeeByPercentile, K as getMaxPrioritizationFeeByPercentile, N as getMeanPrioritizationFeeByPercentile, O as getMedianPrioritizationFeeByPercentile, J as getMinPrioritizationFeeByPercentile, Q as getRecentPrioritizationFeesByPercentile, Y as parseBanksMetadataOverride } from '../bank-metadata-C06TNYXi.js';
|
|
4
4
|
import { Idl, Instruction, Address } from '@coral-xyz/anchor';
|
|
5
5
|
import BigNumber from 'bignumber.js';
|
|
6
6
|
import BN from 'bn.js';
|
package/dist/common/index.js
CHANGED
|
@@ -245,6 +245,7 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
|
245
245
|
TransactionType2["UNSTAKE_LST"] = "UNSTAKE_LST";
|
|
246
246
|
TransactionType2["WITHDRAW_EMISSIONS"] = "WITHDRAW_EMISSIONS";
|
|
247
247
|
TransactionType2["LIQUIDATE_ACCOUNT"] = "LIQUIDATE_ACCOUNT";
|
|
248
|
+
TransactionType2["HANDLE_BANKRUPTCY"] = "HANDLE_BANKRUPTCY";
|
|
248
249
|
TransactionType2["CREATE_PERM_BANK"] = "CREATE_PERM_BANK";
|
|
249
250
|
TransactionType2["CREATE_GROUP"] = "CREATE_GROUP";
|
|
250
251
|
TransactionType2["JUPITER_SWAP"] = "JUPITER_SWAP";
|
|
@@ -320,6 +321,8 @@ var TransactionConfigMap = {
|
|
|
320
321
|
["WITHDRAW_EMISSIONS" /* WITHDRAW_EMISSIONS */]: { label: () => "Withdraw emissions" },
|
|
321
322
|
// LIQUIDATE
|
|
322
323
|
["LIQUIDATE_ACCOUNT" /* LIQUIDATE_ACCOUNT */]: { label: () => "Liquidate account" },
|
|
324
|
+
// BANKRUPTCY
|
|
325
|
+
["HANDLE_BANKRUPTCY" /* HANDLE_BANKRUPTCY */]: { label: () => "Handle bad debt settlement" },
|
|
323
326
|
// BANK and GROUPS
|
|
324
327
|
["CREATE_PERM_BANK" /* CREATE_PERM_BANK */]: { label: () => "Create permissionless bank" },
|
|
325
328
|
["CREATE_GROUP" /* CREATE_GROUP */]: { label: () => "Create lendr group" },
|
package/dist/index.cjs
CHANGED
|
@@ -461,6 +461,7 @@ __export(index_exports, {
|
|
|
461
461
|
Bank: () => Bank,
|
|
462
462
|
BankConfig: () => BankConfig,
|
|
463
463
|
BankConfigFlag: () => BankConfigFlag,
|
|
464
|
+
BankFlags: () => BankFlags,
|
|
464
465
|
BankVaultType: () => BankVaultType,
|
|
465
466
|
DEFAULT_CLUSTER: () => DEFAULT_CLUSTER,
|
|
466
467
|
DEFAULT_COMMITMENT: () => DEFAULT_COMMITMENT,
|
|
@@ -11391,6 +11392,14 @@ async function makePulseHealthIx(ldProgram, accounts, remainingAccounts = []) {
|
|
|
11391
11392
|
lendrAccount: accounts.lendrAccount
|
|
11392
11393
|
}).remainingAccounts(remainingAccounts).instruction();
|
|
11393
11394
|
}
|
|
11395
|
+
async function makeHandleBankruptcyIx(ldProgram, accounts) {
|
|
11396
|
+
const { bank, lendrAccount, tokenProgram, ...optionalAccounts } = accounts;
|
|
11397
|
+
return ldProgram.methods.lendingPoolHandleBankruptcy().accounts({
|
|
11398
|
+
bank,
|
|
11399
|
+
lendrAccount,
|
|
11400
|
+
tokenProgram
|
|
11401
|
+
}).accountsPartial(optionalAccounts).instruction();
|
|
11402
|
+
}
|
|
11394
11403
|
var instructions = {
|
|
11395
11404
|
makeDepositIx,
|
|
11396
11405
|
makeDepositWithSessionIx,
|
|
@@ -11415,7 +11424,8 @@ var instructions = {
|
|
|
11415
11424
|
makePoolAddPermissionlessStakedBankIx,
|
|
11416
11425
|
makeLendingPoolConfigureBankOracleIx,
|
|
11417
11426
|
makePulseHealthIx,
|
|
11418
|
-
makeLendingAccountSettleEmissionsIx
|
|
11427
|
+
makeLendingAccountSettleEmissionsIx,
|
|
11428
|
+
makeHandleBankruptcyIx
|
|
11419
11429
|
};
|
|
11420
11430
|
var instructions_default = instructions;
|
|
11421
11431
|
|
|
@@ -11525,6 +11535,16 @@ var BankConfigFlag = /* @__PURE__ */ ((BankConfigFlag2) => {
|
|
|
11525
11535
|
BankConfigFlag2[BankConfigFlag2["PYTH_MIGRATED"] = 1] = "PYTH_MIGRATED";
|
|
11526
11536
|
return BankConfigFlag2;
|
|
11527
11537
|
})(BankConfigFlag || {});
|
|
11538
|
+
var BankFlags = /* @__PURE__ */ ((BankFlags2) => {
|
|
11539
|
+
BankFlags2[BankFlags2["EMISSIONS_FLAG_BORROW_ACTIVE"] = 1] = "EMISSIONS_FLAG_BORROW_ACTIVE";
|
|
11540
|
+
BankFlags2[BankFlags2["EMISSIONS_FLAG_LENDING_ACTIVE"] = 2] = "EMISSIONS_FLAG_LENDING_ACTIVE";
|
|
11541
|
+
BankFlags2[BankFlags2["PERMISSIONLESS_BAD_DEBT_SETTLEMENT"] = 4] = "PERMISSIONLESS_BAD_DEBT_SETTLEMENT";
|
|
11542
|
+
BankFlags2[BankFlags2["FREEZE_SETTINGS"] = 8] = "FREEZE_SETTINGS";
|
|
11543
|
+
BankFlags2[BankFlags2["CLOSE_ENABLED"] = 16] = "CLOSE_ENABLED";
|
|
11544
|
+
BankFlags2[BankFlags2["TOKENLESS_REPAYMENTS_ALLOWED"] = 32] = "TOKENLESS_REPAYMENTS_ALLOWED";
|
|
11545
|
+
BankFlags2[BankFlags2["TOKENLESS_REPAYMENTS_COMPLETE"] = 64] = "TOKENLESS_REPAYMENTS_COMPLETE";
|
|
11546
|
+
return BankFlags2;
|
|
11547
|
+
})(BankFlags || {});
|
|
11528
11548
|
var EmodeEntryFlags = /* @__PURE__ */ ((EmodeEntryFlags2) => {
|
|
11529
11549
|
EmodeEntryFlags2[EmodeEntryFlags2["APPLIES_TO_ISOLATED"] = 1] = "APPLIES_TO_ISOLATED";
|
|
11530
11550
|
EmodeEntryFlags2[EmodeEntryFlags2["RESERVED_1"] = 2] = "RESERVED_1";
|
|
@@ -11643,6 +11663,7 @@ function parseBankRaw(address, accountParsed, feedIdMap, bankMetadata, mintData)
|
|
|
11643
11663
|
group,
|
|
11644
11664
|
mint,
|
|
11645
11665
|
mintDecimals,
|
|
11666
|
+
flags,
|
|
11646
11667
|
assetShareValue,
|
|
11647
11668
|
liabilityShareValue,
|
|
11648
11669
|
liquidityVault,
|
|
@@ -11682,6 +11703,7 @@ function dtoToBank(bankDto) {
|
|
|
11682
11703
|
group: new import_web38.PublicKey(bankDto.group),
|
|
11683
11704
|
mint: new import_web38.PublicKey(bankDto.mint),
|
|
11684
11705
|
mintDecimals: bankDto.mintDecimals,
|
|
11706
|
+
flags: bankDto.flags,
|
|
11685
11707
|
assetShareValue: new import_bignumber3.default(bankDto.assetShareValue),
|
|
11686
11708
|
liabilityShareValue: new import_bignumber3.default(bankDto.liabilityShareValue),
|
|
11687
11709
|
liquidityVault: new import_web38.PublicKey(bankDto.liquidityVault),
|
|
@@ -16879,7 +16901,6 @@ function findOracleKey(bankConfig, feedIdMap) {
|
|
|
16879
16901
|
return { oracleKey: feedId };
|
|
16880
16902
|
} catch (error) {
|
|
16881
16903
|
console.error("Error finding oracle key", error);
|
|
16882
|
-
console.log("oracleSetup", bankConfig.oracleSetup);
|
|
16883
16904
|
return { oracleKey: bankConfig.oracleKeys[0] };
|
|
16884
16905
|
}
|
|
16885
16906
|
}
|
|
@@ -20532,6 +20553,7 @@ function toBankDto(bank) {
|
|
|
20532
20553
|
config: toBankConfigDto(bank.config),
|
|
20533
20554
|
totalAssetShares: bank.totalAssetShares.toString(),
|
|
20534
20555
|
totalLiabilityShares: bank.totalLiabilityShares.toString(),
|
|
20556
|
+
flags: bank.flags,
|
|
20535
20557
|
emissionsActiveBorrowing: bank.emissionsActiveBorrowing,
|
|
20536
20558
|
emissionsActiveLending: bank.emissionsActiveLending,
|
|
20537
20559
|
emissionsRate: bank.emissionsRate,
|
|
@@ -21896,7 +21918,7 @@ function computeHealthAccountMetas(banksToInclude, bankMetadataMap, enableSortin
|
|
|
21896
21918
|
const wrapperFn = enableSorting ? composeRemainingAccounts : (banksAndOracles) => banksAndOracles.flat();
|
|
21897
21919
|
const accounts = wrapperFn(
|
|
21898
21920
|
banksToInclude.map((bank) => {
|
|
21899
|
-
const keys = [bank.address, bank.
|
|
21921
|
+
const keys = [bank.address, bank.config.oracleKeys[0]];
|
|
21900
21922
|
if (bank.config.assetTag === 2) {
|
|
21901
21923
|
if (!bankMetadataMap && !bankExtendedMetadata) {
|
|
21902
21924
|
throw Error(`No bank metadata for ${bank.address.toBase58()} provided`);
|
|
@@ -22991,7 +23013,7 @@ var import_bignumber13 = __toESM(require("bignumber.js"), 1);
|
|
|
22991
23013
|
var SECONDS_PER_DAY2 = 24 * 60 * 60;
|
|
22992
23014
|
var _SECONDS_PER_YEAR = SECONDS_PER_DAY2 * 365.25;
|
|
22993
23015
|
var Bank = class _Bank {
|
|
22994
|
-
constructor(address, mint, mintDecimals, group, mintRate, mintPrice, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, oracleKey, emode, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, pythShardId, tokenSymbol, extendedMetadata, owner) {
|
|
23016
|
+
constructor(address, mint, mintDecimals, group, mintRate, mintPrice, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, flags, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, oracleKey, emode, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, pythShardId, tokenSymbol, extendedMetadata, owner) {
|
|
22995
23017
|
this.address = address;
|
|
22996
23018
|
this.mint = mint;
|
|
22997
23019
|
this.mintDecimals = mintDecimals;
|
|
@@ -23015,6 +23037,7 @@ var Bank = class _Bank {
|
|
|
23015
23037
|
this.config = config;
|
|
23016
23038
|
this.totalAssetShares = totalAssetShares;
|
|
23017
23039
|
this.totalLiabilityShares = totalLiabilityShares;
|
|
23040
|
+
this.flags = flags;
|
|
23018
23041
|
this.emissionsActiveBorrowing = emissionsActiveBorrowing;
|
|
23019
23042
|
this.emissionsActiveLending = emissionsActiveLending;
|
|
23020
23043
|
this.emissionsRate = emissionsRate;
|
|
@@ -23081,6 +23104,7 @@ var Bank = class _Bank {
|
|
|
23081
23104
|
config,
|
|
23082
23105
|
bankType.totalAssetShares,
|
|
23083
23106
|
bankType.totalLiabilityShares,
|
|
23107
|
+
bankType.flags,
|
|
23084
23108
|
bankType.emissionsActiveBorrowing,
|
|
23085
23109
|
bankType.emissionsActiveLending,
|
|
23086
23110
|
bankType.emissionsRate,
|
|
@@ -23121,6 +23145,7 @@ var Bank = class _Bank {
|
|
|
23121
23145
|
props.config,
|
|
23122
23146
|
props.totalAssetShares,
|
|
23123
23147
|
props.totalLiabilityShares,
|
|
23148
|
+
props.flags,
|
|
23124
23149
|
props.emissionsActiveBorrowing,
|
|
23125
23150
|
props.emissionsActiveLending,
|
|
23126
23151
|
props.emissionsRate,
|
|
@@ -24249,6 +24274,8 @@ var LendrAccount = class _LendrAccount {
|
|
|
24249
24274
|
if (liabilityMintData.tokenProgram.equals(import_spl_token6.TOKEN_2022_PROGRAM_ID)) {
|
|
24250
24275
|
remainingAccounts.push(liabilityMintData.mint);
|
|
24251
24276
|
}
|
|
24277
|
+
remainingAccounts.push(assetBank.config.oracleKeys[0]);
|
|
24278
|
+
remainingAccounts.push(liabilityBank.config.oracleKeys[0]);
|
|
24252
24279
|
const accountMetas = computeHealthAccountMetas(healthAccounts, bankMetadataMap);
|
|
24253
24280
|
remainingAccounts.push(...accountMetas);
|
|
24254
24281
|
ixs.push(import_web329.ComputeBudgetProgram.setComputeUnitLimit({ units: 14e5 }));
|
|
@@ -26469,6 +26496,70 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
|
|
|
26469
26496
|
const outstandingEmissions = simulatedLendrAccount.getBalance(bank).emissionsOutstanding;
|
|
26470
26497
|
return outstandingEmissions;
|
|
26471
26498
|
}
|
|
26499
|
+
/**
|
|
26500
|
+
* Creates an instruction to handle bankruptcy (bad debt settlement) for this account.
|
|
26501
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
26502
|
+
*
|
|
26503
|
+
* @param bankAddress - The bank where the account has bad debt
|
|
26504
|
+
* @returns An InstructionsWrapper containing the handle bankruptcy instruction
|
|
26505
|
+
*
|
|
26506
|
+
* @remarks
|
|
26507
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
26508
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
26509
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for that bank)
|
|
26510
|
+
*/
|
|
26511
|
+
async makeHandleBankruptcyIx(bankAddress) {
|
|
26512
|
+
const bank = this.client.getBankByPk(bankAddress);
|
|
26513
|
+
if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
|
|
26514
|
+
const mintData = this.client.mintDatas.get(bankAddress.toBase58());
|
|
26515
|
+
if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);
|
|
26516
|
+
const ix = await instructions_default.makeHandleBankruptcyIx(this._program, {
|
|
26517
|
+
bank: bankAddress,
|
|
26518
|
+
lendrAccount: this.address,
|
|
26519
|
+
tokenProgram: mintData.tokenProgram,
|
|
26520
|
+
group: this.client.group.address
|
|
26521
|
+
});
|
|
26522
|
+
return {
|
|
26523
|
+
instructions: [ix],
|
|
26524
|
+
keys: []
|
|
26525
|
+
};
|
|
26526
|
+
}
|
|
26527
|
+
/**
|
|
26528
|
+
* Handles bankruptcy (bad debt settlement) for this account at a specific bank.
|
|
26529
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
26530
|
+
*
|
|
26531
|
+
* @param bankAddress - The bank where the account has bad debt
|
|
26532
|
+
* @param processOpts - Optional processing options for the transaction
|
|
26533
|
+
* @param txOpts - Optional transaction options
|
|
26534
|
+
* @returns The transaction signature of the handle bankruptcy transaction
|
|
26535
|
+
*
|
|
26536
|
+
* @remarks
|
|
26537
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
26538
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
26539
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for that bank)
|
|
26540
|
+
*/
|
|
26541
|
+
async handleBankruptcy(bankAddress, processOpts, txOpts) {
|
|
26542
|
+
this.client.logger.debug(
|
|
26543
|
+
{
|
|
26544
|
+
address: this.address.toBase58(),
|
|
26545
|
+
bank: bankAddress.toBase58()
|
|
26546
|
+
},
|
|
26547
|
+
"[lendr:lendr-account:handle-bankruptcy] Handling bankruptcy for lendr account"
|
|
26548
|
+
);
|
|
26549
|
+
const bankruptcyIxs = await this.makeHandleBankruptcyIx(bankAddress);
|
|
26550
|
+
const tx = new import_web330.Transaction().add(...bankruptcyIxs.instructions);
|
|
26551
|
+
const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
|
|
26552
|
+
const solanaTx = addTransactionMetadata(tx, {
|
|
26553
|
+
addressLookupTables: clientLookupTables,
|
|
26554
|
+
type: "HANDLE_BANKRUPTCY" /* HANDLE_BANKRUPTCY */
|
|
26555
|
+
});
|
|
26556
|
+
const sig = await this.client.processTransaction(solanaTx, processOpts, txOpts);
|
|
26557
|
+
this.client.logger.debug(
|
|
26558
|
+
{ address: this.address.toBase58(), sig },
|
|
26559
|
+
"[lendr:lendr-account:handle-bankruptcy] Bankruptcy handled successfully"
|
|
26560
|
+
);
|
|
26561
|
+
return sig;
|
|
26562
|
+
}
|
|
26472
26563
|
//TODO: maybe become usefull someday
|
|
26473
26564
|
// async getBanksUnclaimedOutstandingEmissions(banks: PublicKey[]) {
|
|
26474
26565
|
// const results = await Promise.allSettled(
|
|
@@ -27643,6 +27734,7 @@ var EmodeSettings = class _EmodeSettings {
|
|
|
27643
27734
|
Bank,
|
|
27644
27735
|
BankConfig,
|
|
27645
27736
|
BankConfigFlag,
|
|
27737
|
+
BankFlags,
|
|
27646
27738
|
BankVaultType,
|
|
27647
27739
|
DEFAULT_CLUSTER,
|
|
27648
27740
|
DEFAULT_COMMITMENT,
|
package/dist/index.d.cts
CHANGED
|
@@ -4,8 +4,8 @@ import { TransactionResult } from '@fogo/sessions-sdk';
|
|
|
4
4
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
5
5
|
import { PublicKey, TransactionInstruction, VersionedTransaction, Blockhash, Transaction, AddressLookupTableAccount, Connection, AccountMeta, Commitment, TransactionSignature, Signer, TransactionError, ConfirmOptions, SimulatedTransactionResponse, Keypair, SendOptions } from '@solana/web3.js';
|
|
6
6
|
import { Storage } from 'unstorage';
|
|
7
|
-
import { B as BankVaultType, a as BankExtendedMetadata, L as LendrIdlType, P as Program, b as BankMetadataMap, T as TLogger, A as Amount, c as LendrProgram, I as InstructionsWrapper, S as SolanaTransaction, d as TransactionOptions, E as ExtendedTransaction, e as ExtendedTransactionProperties, f as ExtendedV0Transaction, g as TransactionBroadcastType, W as WrappedI80F48, h as BankMetadata, i as IMetadataFetcher, j as Wallet, k as LendrConfig, l as BanksExtendedMetadataOverrideMap, M as MetadataService, m as BankExtendedMetadataMap, n as AccountType$1, o as LendingAccountDepositOrRepayWithSessionAccounts, p as LendingAccountWithdrawOrBorrowWithSessionAccounts, q as Environment } from './bank-metadata-
|
|
8
|
-
export { v as BankAddress, r as LENDR_IDL, w as LogFn, u as MetadataServiceProps, t as TMetadata, s as metadataSchema } from './bank-metadata-
|
|
7
|
+
import { B as BankVaultType, a as BankExtendedMetadata, L as LendrIdlType, P as Program, b as BankMetadataMap, T as TLogger, A as Amount, c as LendrProgram, I as InstructionsWrapper, S as SolanaTransaction, d as TransactionOptions, E as ExtendedTransaction, e as ExtendedTransactionProperties, f as ExtendedV0Transaction, g as TransactionBroadcastType, W as WrappedI80F48, h as BankMetadata, i as IMetadataFetcher, j as Wallet, k as LendrConfig, l as BanksExtendedMetadataOverrideMap, M as MetadataService, m as BankExtendedMetadataMap, n as AccountType$1, o as LendingAccountDepositOrRepayWithSessionAccounts, p as LendingAccountWithdrawOrBorrowWithSessionAccounts, q as Environment } from './bank-metadata-C06TNYXi.cjs';
|
|
8
|
+
export { v as BankAddress, r as LENDR_IDL, w as LogFn, u as MetadataServiceProps, t as TMetadata, s as metadataSchema } from './bank-metadata-C06TNYXi.cjs';
|
|
9
9
|
import BN from 'bn.js';
|
|
10
10
|
import BigNumber from 'bignumber.js';
|
|
11
11
|
import 'zod';
|
|
@@ -115,6 +115,7 @@ declare class Bank implements BankType {
|
|
|
115
115
|
config: BankConfig;
|
|
116
116
|
readonly totalAssetShares: BigNumber;
|
|
117
117
|
readonly totalLiabilityShares: BigNumber;
|
|
118
|
+
readonly flags: number;
|
|
118
119
|
readonly emissionsActiveBorrowing: boolean;
|
|
119
120
|
readonly emissionsActiveLending: boolean;
|
|
120
121
|
readonly emissionsRate: number;
|
|
@@ -129,7 +130,7 @@ declare class Bank implements BankType {
|
|
|
129
130
|
readonly tokenSymbol?: string | undefined;
|
|
130
131
|
readonly extendedMetadata?: BankExtendedMetadata | undefined;
|
|
131
132
|
readonly owner?: PublicKey | undefined;
|
|
132
|
-
constructor(address: PublicKey, mint: PublicKey, mintDecimals: number, group: PublicKey, mintRate: number | null, mintPrice: number, assetShareValue: BigNumber, liabilityShareValue: BigNumber, liquidityVault: PublicKey, liquidityVaultBump: number, liquidityVaultAuthorityBump: number, insuranceVault: PublicKey, insuranceVaultBump: number, insuranceVaultAuthorityBump: number, collectedInsuranceFeesOutstanding: BigNumber, feeVault: PublicKey, feeVaultBump: number, feeVaultAuthorityBump: number, collectedGroupFeesOutstanding: BigNumber, lastUpdate: number, config: BankConfig, totalAssetShares: BigNumber, totalLiabilityShares: BigNumber, emissionsActiveBorrowing: boolean, emissionsActiveLending: boolean, emissionsRate: number, emissionsMint: PublicKey, emissionsRemaining: BigNumber, oracleKey: PublicKey, emode: EmodeSettings, feesDestinationAccount?: PublicKey | undefined, lendingPositionCount?: BigNumber | undefined, borrowingPositionCount?: BigNumber | undefined, pythShardId?: number | undefined, tokenSymbol?: string | undefined, extendedMetadata?: BankExtendedMetadata | undefined, owner?: PublicKey | undefined);
|
|
133
|
+
constructor(address: PublicKey, mint: PublicKey, mintDecimals: number, group: PublicKey, mintRate: number | null, mintPrice: number, assetShareValue: BigNumber, liabilityShareValue: BigNumber, liquidityVault: PublicKey, liquidityVaultBump: number, liquidityVaultAuthorityBump: number, insuranceVault: PublicKey, insuranceVaultBump: number, insuranceVaultAuthorityBump: number, collectedInsuranceFeesOutstanding: BigNumber, feeVault: PublicKey, feeVaultBump: number, feeVaultAuthorityBump: number, collectedGroupFeesOutstanding: BigNumber, lastUpdate: number, config: BankConfig, totalAssetShares: BigNumber, totalLiabilityShares: BigNumber, flags: number, emissionsActiveBorrowing: boolean, emissionsActiveLending: boolean, emissionsRate: number, emissionsMint: PublicKey, emissionsRemaining: BigNumber, oracleKey: PublicKey, emode: EmodeSettings, feesDestinationAccount?: PublicKey | undefined, lendingPositionCount?: BigNumber | undefined, borrowingPositionCount?: BigNumber | undefined, pythShardId?: number | undefined, tokenSymbol?: string | undefined, extendedMetadata?: BankExtendedMetadata | undefined, owner?: PublicKey | undefined);
|
|
133
134
|
static decodeBankRaw(encoded: Buffer, idl: LendrIdlType): BankRaw;
|
|
134
135
|
static fromBuffer(bankPk: PublicKey, rawData: Buffer, idl: LendrIdlType, feedIdMap: PythPushFeedIdMap): Bank;
|
|
135
136
|
static fromBankType(bankType: BankType): Bank;
|
|
@@ -1159,6 +1160,34 @@ declare class LendrAccountWrapper {
|
|
|
1159
1160
|
*/
|
|
1160
1161
|
simulateRepay(amount: Amount, bankAddress: PublicKey, repayAll?: boolean): Promise<SimulationResult>;
|
|
1161
1162
|
getBankUnclaimedOutstandingEmissions(bank: PublicKey): Promise<BigNumber>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Creates an instruction to handle bankruptcy (bad debt settlement) for this account.
|
|
1165
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
1166
|
+
*
|
|
1167
|
+
* @param bankAddress - The bank where the account has bad debt
|
|
1168
|
+
* @returns An InstructionsWrapper containing the handle bankruptcy instruction
|
|
1169
|
+
*
|
|
1170
|
+
* @remarks
|
|
1171
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
1172
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
1173
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for that bank)
|
|
1174
|
+
*/
|
|
1175
|
+
makeHandleBankruptcyIx(bankAddress: PublicKey): Promise<InstructionsWrapper>;
|
|
1176
|
+
/**
|
|
1177
|
+
* Handles bankruptcy (bad debt settlement) for this account at a specific bank.
|
|
1178
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
1179
|
+
*
|
|
1180
|
+
* @param bankAddress - The bank where the account has bad debt
|
|
1181
|
+
* @param processOpts - Optional processing options for the transaction
|
|
1182
|
+
* @param txOpts - Optional transaction options
|
|
1183
|
+
* @returns The transaction signature of the handle bankruptcy transaction
|
|
1184
|
+
*
|
|
1185
|
+
* @remarks
|
|
1186
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
1187
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
1188
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for that bank)
|
|
1189
|
+
*/
|
|
1190
|
+
handleBankruptcy(bankAddress: PublicKey, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
1162
1191
|
}
|
|
1163
1192
|
/**
|
|
1164
1193
|
* @deprecated This method is deprecated.
|
|
@@ -1230,6 +1259,26 @@ declare enum AssetTag {
|
|
|
1230
1259
|
declare enum BankConfigFlag {
|
|
1231
1260
|
PYTH_MIGRATED = 1
|
|
1232
1261
|
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Bank-level flags stored in the `flags` field of the Bank account.
|
|
1264
|
+
* These control various bank behaviors and permissions.
|
|
1265
|
+
*/
|
|
1266
|
+
declare enum BankFlags {
|
|
1267
|
+
/** Emissions are active for borrowing positions */
|
|
1268
|
+
EMISSIONS_FLAG_BORROW_ACTIVE = 1,// 1
|
|
1269
|
+
/** Emissions are active for lending positions */
|
|
1270
|
+
EMISSIONS_FLAG_LENDING_ACTIVE = 2,// 2
|
|
1271
|
+
/** Anyone can call handle_bankruptcy for this bank (not just admin/risk_admin) */
|
|
1272
|
+
PERMISSIONLESS_BAD_DEBT_SETTLEMENT = 4,// 4
|
|
1273
|
+
/** Bank settings are frozen and cannot be changed */
|
|
1274
|
+
FREEZE_SETTINGS = 8,// 8
|
|
1275
|
+
/** Bank can be closed */
|
|
1276
|
+
CLOSE_ENABLED = 16,// 16
|
|
1277
|
+
/** Tokenless repayments are allowed */
|
|
1278
|
+
TOKENLESS_REPAYMENTS_ALLOWED = 32,// 32
|
|
1279
|
+
/** Tokenless repayments are complete */
|
|
1280
|
+
TOKENLESS_REPAYMENTS_COMPLETE = 64
|
|
1281
|
+
}
|
|
1233
1282
|
interface BankConfigOpt {
|
|
1234
1283
|
assetWeightInit: BigNumber | null;
|
|
1235
1284
|
assetWeightMaint: BigNumber | null;
|
|
@@ -1275,6 +1324,8 @@ interface BankType {
|
|
|
1275
1324
|
mintDecimals: number;
|
|
1276
1325
|
mintRate: number | null;
|
|
1277
1326
|
mintPrice: number;
|
|
1327
|
+
/** Bank-level flags (see BankFlags enum) */
|
|
1328
|
+
flags: number;
|
|
1278
1329
|
assetShareValue: BigNumber;
|
|
1279
1330
|
liabilityShareValue: BigNumber;
|
|
1280
1331
|
liquidityVault: PublicKey;
|
|
@@ -1628,6 +1679,7 @@ interface BankTypeDto {
|
|
|
1628
1679
|
config: BankConfigDto;
|
|
1629
1680
|
totalAssetShares: string;
|
|
1630
1681
|
totalLiabilityShares: string;
|
|
1682
|
+
flags: number;
|
|
1631
1683
|
emissionsActiveBorrowing: boolean;
|
|
1632
1684
|
emissionsActiveLending: boolean;
|
|
1633
1685
|
emissionsRate: number;
|
|
@@ -2967,6 +3019,29 @@ declare function makePulseHealthIx(ldProgram: LendrProgram, accounts: {
|
|
|
2967
3019
|
* - For each balance the user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>
|
|
2968
3020
|
*/
|
|
2969
3021
|
remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
3022
|
+
/**
|
|
3023
|
+
* Creates an instruction to handle bankruptcy (bad debt settlement) for a lendr account.
|
|
3024
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
3025
|
+
*
|
|
3026
|
+
* @param ldProgram - The lendr program instance
|
|
3027
|
+
* @param accounts - The accounts required for this instruction
|
|
3028
|
+
* @returns The handle bankruptcy instruction
|
|
3029
|
+
*
|
|
3030
|
+
* @remarks
|
|
3031
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
3032
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
3033
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for a bank)
|
|
3034
|
+
*/
|
|
3035
|
+
declare function makeHandleBankruptcyIx(ldProgram: LendrProgram, accounts: {
|
|
3036
|
+
bank: PublicKey;
|
|
3037
|
+
lendrAccount: PublicKey;
|
|
3038
|
+
tokenProgram: PublicKey;
|
|
3039
|
+
group?: PublicKey;
|
|
3040
|
+
signer?: PublicKey;
|
|
3041
|
+
liquidityVault?: PublicKey;
|
|
3042
|
+
insuranceVault?: PublicKey;
|
|
3043
|
+
insuranceVaultAuthority?: PublicKey;
|
|
3044
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2970
3045
|
declare const instructions: {
|
|
2971
3046
|
makeDepositIx: typeof makeDepositIx;
|
|
2972
3047
|
makeDepositWithSessionIx: typeof makeDepositWithSessionIx;
|
|
@@ -2992,6 +3067,7 @@ declare const instructions: {
|
|
|
2992
3067
|
makeLendingPoolConfigureBankOracleIx: typeof makeLendingPoolConfigureBankOracleIx;
|
|
2993
3068
|
makePulseHealthIx: typeof makePulseHealthIx;
|
|
2994
3069
|
makeLendingAccountSettleEmissionsIx: typeof makeLendingAccountSettleEmissionsIx;
|
|
3070
|
+
makeHandleBankruptcyIx: typeof makeHandleBankruptcyIx;
|
|
2995
3071
|
};
|
|
2996
3072
|
|
|
2997
3073
|
declare function getConfig({ environment, overrides, }?: {
|
|
@@ -3442,4 +3518,4 @@ declare namespace index {
|
|
|
3442
3518
|
export { index_AccountType as AccountType, index_AggregatorAccount as AggregatorAccount, index_AggregatorAccountData as AggregatorAccountData, type index_Base as Base, index_CorpAction as CorpAction, type index_CrossbarSimulatePayload as CrossbarSimulatePayload, type index_CurrentResult as CurrentResult, type index_Ema as Ema, type index_FeedResponse as FeedResponse, index_MAX_SLOT_DIFFERENCE as MAX_SLOT_DIFFERENCE, type index_OracleSubmission as OracleSubmission, type index_Price as Price, type index_PriceComponent as PriceComponent, type index_PriceData as PriceData, index_PriceStatus as PriceStatus, index_PriceType as PriceType, type index_PullFeedAccountData as PullFeedAccountData, index_SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, index_SinglePoolInstruction as SinglePoolInstruction, type index_StakeAccount as StakeAccount, index_createAccountIx as createAccountIx, index_createPoolOnrampIx as createPoolOnrampIx, index_decodeSwitchboardPullFeedData as decodeSwitchboardPullFeedData, index_findMplMetadataAddress as findMplMetadataAddress, index_findPoolAddress as findPoolAddress, index_findPoolMintAddress as findPoolMintAddress, index_findPoolMintAddressByVoteAccount as findPoolMintAddressByVoteAccount, index_findPoolMintAuthorityAddress as findPoolMintAuthorityAddress, index_findPoolMplAuthorityAddress as findPoolMplAuthorityAddress, index_findPoolOnRampAddress as findPoolOnRampAddress, index_findPoolStakeAddress as findPoolStakeAddress, index_findPoolStakeAuthorityAddress as findPoolStakeAuthorityAddress, index_getStakeAccount as getStakeAccount, index_getSwitchboardProgram as getSwitchboardProgram, index_initializeStakedPoolIxs as initializeStakedPoolIxs, index_initializeStakedPoolTx as initializeStakedPoolTx, index_parsePriceData as parsePriceData, index_parsePriceInfo as parsePriceInfo, index_replenishPoolIx as replenishPoolIx, index_switchboardAccountCoder as switchboardAccountCoder };
|
|
3443
3519
|
}
|
|
3444
3520
|
|
|
3445
|
-
export { AccountFlags, AccountType$1 as AccountType, type ActionEmodeImpact, type ActiveEmodePair, type ActiveStakePoolMap, AssetTag, BUNDLE_TX_SIZE, Balance, type BalanceRaw, type BalanceType, type BalanceTypeDto, Bank, BankConfig, type BankConfigCompactRaw, type BankConfigDto, BankConfigFlag, type BankConfigOpt, type BankConfigOptRaw, type BankConfigRaw, type BankConfigRawDto, type BankConfigType, type BankMap, type BankMetadataRaw, type BankRaw, type BankRawDto, type BankType, type BankTypeDto, BankVaultType, type BroadcastMethodType, 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, type EmodeConfigRaw, type EmodeConfigRawDto, type EmodeEntry, type EmodeEntryDto, EmodeEntryFlags, EmodeFlags, type EmodeImpact, EmodeImpactStatus, type EmodePair, EmodeSettings, type EmodeSettingsDto, type EmodeSettingsRaw, type EmodeSettingsRawDto, type EmodeSettingsType, EmodeTag, Environment, FLASHLOAN_ENABLED_FLAG, type FetchGroupDataFn, type FetchRawBanksArgs, type FlashLoanArgs, type FlashloanActionResult, FogoMetadataFetcher, GROUP_PK, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, type HealthCacheRaw, HealthCacheSimulationError, type HealthCacheType, type HealthCacheTypeDto, IMetadataFetcher, type InterestRateConfig, type InterestRateConfigCompactRaw, type InterestRateConfigDto, type InterestRateConfigOpt, type InterestRateConfigOptRaw, type InterestRateConfigRaw, JUPITER_V6_PROGRAM, LENDR_PROGRAM, LENDR_SPONSORED_SHARD_ID, LST_MINT, LUT_PROGRAM_AUTHORITY_INDEX, LendingAccountDepositOrRepayWithSessionAccounts, LendingAccountWithdrawOrBorrowWithSessionAccounts, LendrAccount, type LendrAccountRaw, type LendrAccountType, type LendrAccountTypeDto, LendrAccountWrapper, LendrClient, type LendrClientFetchOptions, type LendrClientOptions, type LendrClientProps, LendrConfig, LendrGroup, type LendrGroupRaw, type LendrGroupType, type LendrGroupTypeDto, LendrIdlType, LendrProgram, LendrRequirementType, type LendrRequirementTypeRaw, type LoopProps, type LoopTxProps, MAX_ACCOUNT_KEYS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, type MakeBorrowIxOpts, type MakeBorrowWithSessionIxOpts, type MakeDepositIxOpts, type MakeDepositWithSessionIxOpts, type MakeRepayIxOpts, type MakeRepayWithSessionIxOpts, type MakeWithdrawIxOpts, type MakeWithdrawWithSessionIxOpts, MetadataService, MetaplexMetadataFetcher, type MintData, type MintDataMap, OperationalState, type OperationalStateRaw, type OracleConfigOpt, type OracleConfigOptRaw, type OraclePrice, type OraclePriceDto, type OraclePriceMap, OracleSetup, type OracleSetupRaw, 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, type PriceWithConfidence, type PriceWithConfidenceDto, type PriorityFees, ProcessTransactionError, ProcessTransactionErrorType, type ProcessTransactionOpts, type ProcessTransactionStrategy, type ProcessTransactionsClientOpts, type ProgramError, type ProgramErrorWithDescription, type PythPushFeedIdMap, type RatePoint, type RatePointDto, type RatePointRaw, type RepayWithCollateralProps, type RepayWithCollateralTxProps, RiskTier, type RiskTierRaw, 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, type SimulationResult, type SpecificBroadcastMethod, type SpecificBroadcastMethodType, type StakeAccount$1 as StakeAccount, type StakePoolMevMap, type SupportedOracleSetup, TLogger, TRANSFER_ACCOUNT_AUTHORITY_FLAG, type TransactionBuilderResult, USDC_DECIMALS, USDC_MINT, type ValidatorRateData, type ValidatorStakeGroup, type ValidatorStakeGroupDto, 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, isOracleSetupSupported, isWeightedPrice, lendrAccountToDto, makeAddPermissionlessStakedBankIx, makeBundleTipIx, makePoolAddBankIx$1 as makePoolAddBankIx, makePoolConfigureBankIx$1 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx$1 as makePulseHealthIx, makeTxPriorityIx, makeUnwrapSolIx, makeVersionedTransaction, makeWrapSolIxs, 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, index as vendor };
|
|
3521
|
+
export { AccountFlags, AccountType$1 as AccountType, type ActionEmodeImpact, type ActiveEmodePair, type ActiveStakePoolMap, AssetTag, BUNDLE_TX_SIZE, Balance, type BalanceRaw, type BalanceType, type BalanceTypeDto, Bank, BankConfig, type BankConfigCompactRaw, type BankConfigDto, BankConfigFlag, type BankConfigOpt, type BankConfigOptRaw, type BankConfigRaw, type BankConfigRawDto, type BankConfigType, BankFlags, type BankMap, type BankMetadataRaw, type BankRaw, type BankRawDto, type BankType, type BankTypeDto, BankVaultType, type BroadcastMethodType, 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, type EmodeConfigRaw, type EmodeConfigRawDto, type EmodeEntry, type EmodeEntryDto, EmodeEntryFlags, EmodeFlags, type EmodeImpact, EmodeImpactStatus, type EmodePair, EmodeSettings, type EmodeSettingsDto, type EmodeSettingsRaw, type EmodeSettingsRawDto, type EmodeSettingsType, EmodeTag, Environment, FLASHLOAN_ENABLED_FLAG, type FetchGroupDataFn, type FetchRawBanksArgs, type FlashLoanArgs, type FlashloanActionResult, FogoMetadataFetcher, GROUP_PK, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, type HealthCacheRaw, HealthCacheSimulationError, type HealthCacheType, type HealthCacheTypeDto, IMetadataFetcher, type InterestRateConfig, type InterestRateConfigCompactRaw, type InterestRateConfigDto, type InterestRateConfigOpt, type InterestRateConfigOptRaw, type InterestRateConfigRaw, JUPITER_V6_PROGRAM, LENDR_PROGRAM, LENDR_SPONSORED_SHARD_ID, LST_MINT, LUT_PROGRAM_AUTHORITY_INDEX, LendingAccountDepositOrRepayWithSessionAccounts, LendingAccountWithdrawOrBorrowWithSessionAccounts, LendrAccount, type LendrAccountRaw, type LendrAccountType, type LendrAccountTypeDto, LendrAccountWrapper, LendrClient, type LendrClientFetchOptions, type LendrClientOptions, type LendrClientProps, LendrConfig, LendrGroup, type LendrGroupRaw, type LendrGroupType, type LendrGroupTypeDto, LendrIdlType, LendrProgram, LendrRequirementType, type LendrRequirementTypeRaw, type LoopProps, type LoopTxProps, MAX_ACCOUNT_KEYS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, type MakeBorrowIxOpts, type MakeBorrowWithSessionIxOpts, type MakeDepositIxOpts, type MakeDepositWithSessionIxOpts, type MakeRepayIxOpts, type MakeRepayWithSessionIxOpts, type MakeWithdrawIxOpts, type MakeWithdrawWithSessionIxOpts, MetadataService, MetaplexMetadataFetcher, type MintData, type MintDataMap, OperationalState, type OperationalStateRaw, type OracleConfigOpt, type OracleConfigOptRaw, type OraclePrice, type OraclePriceDto, type OraclePriceMap, OracleSetup, type OracleSetupRaw, 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, type PriceWithConfidence, type PriceWithConfidenceDto, type PriorityFees, ProcessTransactionError, ProcessTransactionErrorType, type ProcessTransactionOpts, type ProcessTransactionStrategy, type ProcessTransactionsClientOpts, type ProgramError, type ProgramErrorWithDescription, type PythPushFeedIdMap, type RatePoint, type RatePointDto, type RatePointRaw, type RepayWithCollateralProps, type RepayWithCollateralTxProps, RiskTier, type RiskTierRaw, 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, type SimulationResult, type SpecificBroadcastMethod, type SpecificBroadcastMethodType, type StakeAccount$1 as StakeAccount, type StakePoolMevMap, type SupportedOracleSetup, TLogger, TRANSFER_ACCOUNT_AUTHORITY_FLAG, type TransactionBuilderResult, USDC_DECIMALS, USDC_MINT, type ValidatorRateData, type ValidatorStakeGroup, type ValidatorStakeGroupDto, 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, isOracleSetupSupported, isWeightedPrice, lendrAccountToDto, makeAddPermissionlessStakedBankIx, makeBundleTipIx, makePoolAddBankIx$1 as makePoolAddBankIx, makePoolConfigureBankIx$1 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx$1 as makePulseHealthIx, makeTxPriorityIx, makeUnwrapSolIx, makeVersionedTransaction, makeWrapSolIxs, 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, index as vendor };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { TransactionResult } from '@fogo/sessions-sdk';
|
|
|
4
4
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
5
5
|
import { PublicKey, TransactionInstruction, VersionedTransaction, Blockhash, Transaction, AddressLookupTableAccount, Connection, AccountMeta, Commitment, TransactionSignature, Signer, TransactionError, ConfirmOptions, SimulatedTransactionResponse, Keypair, SendOptions } from '@solana/web3.js';
|
|
6
6
|
import { Storage } from 'unstorage';
|
|
7
|
-
import { B as BankVaultType, a as BankExtendedMetadata, L as LendrIdlType, P as Program, b as BankMetadataMap, T as TLogger, A as Amount, c as LendrProgram, I as InstructionsWrapper, S as SolanaTransaction, d as TransactionOptions, E as ExtendedTransaction, e as ExtendedTransactionProperties, f as ExtendedV0Transaction, g as TransactionBroadcastType, W as WrappedI80F48, h as BankMetadata, i as IMetadataFetcher, j as Wallet, k as LendrConfig, l as BanksExtendedMetadataOverrideMap, M as MetadataService, m as BankExtendedMetadataMap, n as AccountType$1, o as LendingAccountDepositOrRepayWithSessionAccounts, p as LendingAccountWithdrawOrBorrowWithSessionAccounts, q as Environment } from './bank-metadata-
|
|
8
|
-
export { v as BankAddress, r as LENDR_IDL, w as LogFn, u as MetadataServiceProps, t as TMetadata, s as metadataSchema } from './bank-metadata-
|
|
7
|
+
import { B as BankVaultType, a as BankExtendedMetadata, L as LendrIdlType, P as Program, b as BankMetadataMap, T as TLogger, A as Amount, c as LendrProgram, I as InstructionsWrapper, S as SolanaTransaction, d as TransactionOptions, E as ExtendedTransaction, e as ExtendedTransactionProperties, f as ExtendedV0Transaction, g as TransactionBroadcastType, W as WrappedI80F48, h as BankMetadata, i as IMetadataFetcher, j as Wallet, k as LendrConfig, l as BanksExtendedMetadataOverrideMap, M as MetadataService, m as BankExtendedMetadataMap, n as AccountType$1, o as LendingAccountDepositOrRepayWithSessionAccounts, p as LendingAccountWithdrawOrBorrowWithSessionAccounts, q as Environment } from './bank-metadata-C06TNYXi.js';
|
|
8
|
+
export { v as BankAddress, r as LENDR_IDL, w as LogFn, u as MetadataServiceProps, t as TMetadata, s as metadataSchema } from './bank-metadata-C06TNYXi.js';
|
|
9
9
|
import BN from 'bn.js';
|
|
10
10
|
import BigNumber from 'bignumber.js';
|
|
11
11
|
import 'zod';
|
|
@@ -115,6 +115,7 @@ declare class Bank implements BankType {
|
|
|
115
115
|
config: BankConfig;
|
|
116
116
|
readonly totalAssetShares: BigNumber;
|
|
117
117
|
readonly totalLiabilityShares: BigNumber;
|
|
118
|
+
readonly flags: number;
|
|
118
119
|
readonly emissionsActiveBorrowing: boolean;
|
|
119
120
|
readonly emissionsActiveLending: boolean;
|
|
120
121
|
readonly emissionsRate: number;
|
|
@@ -129,7 +130,7 @@ declare class Bank implements BankType {
|
|
|
129
130
|
readonly tokenSymbol?: string | undefined;
|
|
130
131
|
readonly extendedMetadata?: BankExtendedMetadata | undefined;
|
|
131
132
|
readonly owner?: PublicKey | undefined;
|
|
132
|
-
constructor(address: PublicKey, mint: PublicKey, mintDecimals: number, group: PublicKey, mintRate: number | null, mintPrice: number, assetShareValue: BigNumber, liabilityShareValue: BigNumber, liquidityVault: PublicKey, liquidityVaultBump: number, liquidityVaultAuthorityBump: number, insuranceVault: PublicKey, insuranceVaultBump: number, insuranceVaultAuthorityBump: number, collectedInsuranceFeesOutstanding: BigNumber, feeVault: PublicKey, feeVaultBump: number, feeVaultAuthorityBump: number, collectedGroupFeesOutstanding: BigNumber, lastUpdate: number, config: BankConfig, totalAssetShares: BigNumber, totalLiabilityShares: BigNumber, emissionsActiveBorrowing: boolean, emissionsActiveLending: boolean, emissionsRate: number, emissionsMint: PublicKey, emissionsRemaining: BigNumber, oracleKey: PublicKey, emode: EmodeSettings, feesDestinationAccount?: PublicKey | undefined, lendingPositionCount?: BigNumber | undefined, borrowingPositionCount?: BigNumber | undefined, pythShardId?: number | undefined, tokenSymbol?: string | undefined, extendedMetadata?: BankExtendedMetadata | undefined, owner?: PublicKey | undefined);
|
|
133
|
+
constructor(address: PublicKey, mint: PublicKey, mintDecimals: number, group: PublicKey, mintRate: number | null, mintPrice: number, assetShareValue: BigNumber, liabilityShareValue: BigNumber, liquidityVault: PublicKey, liquidityVaultBump: number, liquidityVaultAuthorityBump: number, insuranceVault: PublicKey, insuranceVaultBump: number, insuranceVaultAuthorityBump: number, collectedInsuranceFeesOutstanding: BigNumber, feeVault: PublicKey, feeVaultBump: number, feeVaultAuthorityBump: number, collectedGroupFeesOutstanding: BigNumber, lastUpdate: number, config: BankConfig, totalAssetShares: BigNumber, totalLiabilityShares: BigNumber, flags: number, emissionsActiveBorrowing: boolean, emissionsActiveLending: boolean, emissionsRate: number, emissionsMint: PublicKey, emissionsRemaining: BigNumber, oracleKey: PublicKey, emode: EmodeSettings, feesDestinationAccount?: PublicKey | undefined, lendingPositionCount?: BigNumber | undefined, borrowingPositionCount?: BigNumber | undefined, pythShardId?: number | undefined, tokenSymbol?: string | undefined, extendedMetadata?: BankExtendedMetadata | undefined, owner?: PublicKey | undefined);
|
|
133
134
|
static decodeBankRaw(encoded: Buffer, idl: LendrIdlType): BankRaw;
|
|
134
135
|
static fromBuffer(bankPk: PublicKey, rawData: Buffer, idl: LendrIdlType, feedIdMap: PythPushFeedIdMap): Bank;
|
|
135
136
|
static fromBankType(bankType: BankType): Bank;
|
|
@@ -1159,6 +1160,34 @@ declare class LendrAccountWrapper {
|
|
|
1159
1160
|
*/
|
|
1160
1161
|
simulateRepay(amount: Amount, bankAddress: PublicKey, repayAll?: boolean): Promise<SimulationResult>;
|
|
1161
1162
|
getBankUnclaimedOutstandingEmissions(bank: PublicKey): Promise<BigNumber>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Creates an instruction to handle bankruptcy (bad debt settlement) for this account.
|
|
1165
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
1166
|
+
*
|
|
1167
|
+
* @param bankAddress - The bank where the account has bad debt
|
|
1168
|
+
* @returns An InstructionsWrapper containing the handle bankruptcy instruction
|
|
1169
|
+
*
|
|
1170
|
+
* @remarks
|
|
1171
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
1172
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
1173
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for that bank)
|
|
1174
|
+
*/
|
|
1175
|
+
makeHandleBankruptcyIx(bankAddress: PublicKey): Promise<InstructionsWrapper>;
|
|
1176
|
+
/**
|
|
1177
|
+
* Handles bankruptcy (bad debt settlement) for this account at a specific bank.
|
|
1178
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
1179
|
+
*
|
|
1180
|
+
* @param bankAddress - The bank where the account has bad debt
|
|
1181
|
+
* @param processOpts - Optional processing options for the transaction
|
|
1182
|
+
* @param txOpts - Optional transaction options
|
|
1183
|
+
* @returns The transaction signature of the handle bankruptcy transaction
|
|
1184
|
+
*
|
|
1185
|
+
* @remarks
|
|
1186
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
1187
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
1188
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for that bank)
|
|
1189
|
+
*/
|
|
1190
|
+
handleBankruptcy(bankAddress: PublicKey, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
1162
1191
|
}
|
|
1163
1192
|
/**
|
|
1164
1193
|
* @deprecated This method is deprecated.
|
|
@@ -1230,6 +1259,26 @@ declare enum AssetTag {
|
|
|
1230
1259
|
declare enum BankConfigFlag {
|
|
1231
1260
|
PYTH_MIGRATED = 1
|
|
1232
1261
|
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Bank-level flags stored in the `flags` field of the Bank account.
|
|
1264
|
+
* These control various bank behaviors and permissions.
|
|
1265
|
+
*/
|
|
1266
|
+
declare enum BankFlags {
|
|
1267
|
+
/** Emissions are active for borrowing positions */
|
|
1268
|
+
EMISSIONS_FLAG_BORROW_ACTIVE = 1,// 1
|
|
1269
|
+
/** Emissions are active for lending positions */
|
|
1270
|
+
EMISSIONS_FLAG_LENDING_ACTIVE = 2,// 2
|
|
1271
|
+
/** Anyone can call handle_bankruptcy for this bank (not just admin/risk_admin) */
|
|
1272
|
+
PERMISSIONLESS_BAD_DEBT_SETTLEMENT = 4,// 4
|
|
1273
|
+
/** Bank settings are frozen and cannot be changed */
|
|
1274
|
+
FREEZE_SETTINGS = 8,// 8
|
|
1275
|
+
/** Bank can be closed */
|
|
1276
|
+
CLOSE_ENABLED = 16,// 16
|
|
1277
|
+
/** Tokenless repayments are allowed */
|
|
1278
|
+
TOKENLESS_REPAYMENTS_ALLOWED = 32,// 32
|
|
1279
|
+
/** Tokenless repayments are complete */
|
|
1280
|
+
TOKENLESS_REPAYMENTS_COMPLETE = 64
|
|
1281
|
+
}
|
|
1233
1282
|
interface BankConfigOpt {
|
|
1234
1283
|
assetWeightInit: BigNumber | null;
|
|
1235
1284
|
assetWeightMaint: BigNumber | null;
|
|
@@ -1275,6 +1324,8 @@ interface BankType {
|
|
|
1275
1324
|
mintDecimals: number;
|
|
1276
1325
|
mintRate: number | null;
|
|
1277
1326
|
mintPrice: number;
|
|
1327
|
+
/** Bank-level flags (see BankFlags enum) */
|
|
1328
|
+
flags: number;
|
|
1278
1329
|
assetShareValue: BigNumber;
|
|
1279
1330
|
liabilityShareValue: BigNumber;
|
|
1280
1331
|
liquidityVault: PublicKey;
|
|
@@ -1628,6 +1679,7 @@ interface BankTypeDto {
|
|
|
1628
1679
|
config: BankConfigDto;
|
|
1629
1680
|
totalAssetShares: string;
|
|
1630
1681
|
totalLiabilityShares: string;
|
|
1682
|
+
flags: number;
|
|
1631
1683
|
emissionsActiveBorrowing: boolean;
|
|
1632
1684
|
emissionsActiveLending: boolean;
|
|
1633
1685
|
emissionsRate: number;
|
|
@@ -2967,6 +3019,29 @@ declare function makePulseHealthIx(ldProgram: LendrProgram, accounts: {
|
|
|
2967
3019
|
* - For each balance the user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>
|
|
2968
3020
|
*/
|
|
2969
3021
|
remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
3022
|
+
/**
|
|
3023
|
+
* Creates an instruction to handle bankruptcy (bad debt settlement) for a lendr account.
|
|
3024
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
3025
|
+
*
|
|
3026
|
+
* @param ldProgram - The lendr program instance
|
|
3027
|
+
* @param accounts - The accounts required for this instruction
|
|
3028
|
+
* @returns The handle bankruptcy instruction
|
|
3029
|
+
*
|
|
3030
|
+
* @remarks
|
|
3031
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
3032
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
3033
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for a bank)
|
|
3034
|
+
*/
|
|
3035
|
+
declare function makeHandleBankruptcyIx(ldProgram: LendrProgram, accounts: {
|
|
3036
|
+
bank: PublicKey;
|
|
3037
|
+
lendrAccount: PublicKey;
|
|
3038
|
+
tokenProgram: PublicKey;
|
|
3039
|
+
group?: PublicKey;
|
|
3040
|
+
signer?: PublicKey;
|
|
3041
|
+
liquidityVault?: PublicKey;
|
|
3042
|
+
insuranceVault?: PublicKey;
|
|
3043
|
+
insuranceVaultAuthority?: PublicKey;
|
|
3044
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2970
3045
|
declare const instructions: {
|
|
2971
3046
|
makeDepositIx: typeof makeDepositIx;
|
|
2972
3047
|
makeDepositWithSessionIx: typeof makeDepositWithSessionIx;
|
|
@@ -2992,6 +3067,7 @@ declare const instructions: {
|
|
|
2992
3067
|
makeLendingPoolConfigureBankOracleIx: typeof makeLendingPoolConfigureBankOracleIx;
|
|
2993
3068
|
makePulseHealthIx: typeof makePulseHealthIx;
|
|
2994
3069
|
makeLendingAccountSettleEmissionsIx: typeof makeLendingAccountSettleEmissionsIx;
|
|
3070
|
+
makeHandleBankruptcyIx: typeof makeHandleBankruptcyIx;
|
|
2995
3071
|
};
|
|
2996
3072
|
|
|
2997
3073
|
declare function getConfig({ environment, overrides, }?: {
|
|
@@ -3442,4 +3518,4 @@ declare namespace index {
|
|
|
3442
3518
|
export { index_AccountType as AccountType, index_AggregatorAccount as AggregatorAccount, index_AggregatorAccountData as AggregatorAccountData, type index_Base as Base, index_CorpAction as CorpAction, type index_CrossbarSimulatePayload as CrossbarSimulatePayload, type index_CurrentResult as CurrentResult, type index_Ema as Ema, type index_FeedResponse as FeedResponse, index_MAX_SLOT_DIFFERENCE as MAX_SLOT_DIFFERENCE, type index_OracleSubmission as OracleSubmission, type index_Price as Price, type index_PriceComponent as PriceComponent, type index_PriceData as PriceData, index_PriceStatus as PriceStatus, index_PriceType as PriceType, type index_PullFeedAccountData as PullFeedAccountData, index_SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, index_SinglePoolInstruction as SinglePoolInstruction, type index_StakeAccount as StakeAccount, index_createAccountIx as createAccountIx, index_createPoolOnrampIx as createPoolOnrampIx, index_decodeSwitchboardPullFeedData as decodeSwitchboardPullFeedData, index_findMplMetadataAddress as findMplMetadataAddress, index_findPoolAddress as findPoolAddress, index_findPoolMintAddress as findPoolMintAddress, index_findPoolMintAddressByVoteAccount as findPoolMintAddressByVoteAccount, index_findPoolMintAuthorityAddress as findPoolMintAuthorityAddress, index_findPoolMplAuthorityAddress as findPoolMplAuthorityAddress, index_findPoolOnRampAddress as findPoolOnRampAddress, index_findPoolStakeAddress as findPoolStakeAddress, index_findPoolStakeAuthorityAddress as findPoolStakeAuthorityAddress, index_getStakeAccount as getStakeAccount, index_getSwitchboardProgram as getSwitchboardProgram, index_initializeStakedPoolIxs as initializeStakedPoolIxs, index_initializeStakedPoolTx as initializeStakedPoolTx, index_parsePriceData as parsePriceData, index_parsePriceInfo as parsePriceInfo, index_replenishPoolIx as replenishPoolIx, index_switchboardAccountCoder as switchboardAccountCoder };
|
|
3443
3519
|
}
|
|
3444
3520
|
|
|
3445
|
-
export { AccountFlags, AccountType$1 as AccountType, type ActionEmodeImpact, type ActiveEmodePair, type ActiveStakePoolMap, AssetTag, BUNDLE_TX_SIZE, Balance, type BalanceRaw, type BalanceType, type BalanceTypeDto, Bank, BankConfig, type BankConfigCompactRaw, type BankConfigDto, BankConfigFlag, type BankConfigOpt, type BankConfigOptRaw, type BankConfigRaw, type BankConfigRawDto, type BankConfigType, type BankMap, type BankMetadataRaw, type BankRaw, type BankRawDto, type BankType, type BankTypeDto, BankVaultType, type BroadcastMethodType, 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, type EmodeConfigRaw, type EmodeConfigRawDto, type EmodeEntry, type EmodeEntryDto, EmodeEntryFlags, EmodeFlags, type EmodeImpact, EmodeImpactStatus, type EmodePair, EmodeSettings, type EmodeSettingsDto, type EmodeSettingsRaw, type EmodeSettingsRawDto, type EmodeSettingsType, EmodeTag, Environment, FLASHLOAN_ENABLED_FLAG, type FetchGroupDataFn, type FetchRawBanksArgs, type FlashLoanArgs, type FlashloanActionResult, FogoMetadataFetcher, GROUP_PK, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, type HealthCacheRaw, HealthCacheSimulationError, type HealthCacheType, type HealthCacheTypeDto, IMetadataFetcher, type InterestRateConfig, type InterestRateConfigCompactRaw, type InterestRateConfigDto, type InterestRateConfigOpt, type InterestRateConfigOptRaw, type InterestRateConfigRaw, JUPITER_V6_PROGRAM, LENDR_PROGRAM, LENDR_SPONSORED_SHARD_ID, LST_MINT, LUT_PROGRAM_AUTHORITY_INDEX, LendingAccountDepositOrRepayWithSessionAccounts, LendingAccountWithdrawOrBorrowWithSessionAccounts, LendrAccount, type LendrAccountRaw, type LendrAccountType, type LendrAccountTypeDto, LendrAccountWrapper, LendrClient, type LendrClientFetchOptions, type LendrClientOptions, type LendrClientProps, LendrConfig, LendrGroup, type LendrGroupRaw, type LendrGroupType, type LendrGroupTypeDto, LendrIdlType, LendrProgram, LendrRequirementType, type LendrRequirementTypeRaw, type LoopProps, type LoopTxProps, MAX_ACCOUNT_KEYS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, type MakeBorrowIxOpts, type MakeBorrowWithSessionIxOpts, type MakeDepositIxOpts, type MakeDepositWithSessionIxOpts, type MakeRepayIxOpts, type MakeRepayWithSessionIxOpts, type MakeWithdrawIxOpts, type MakeWithdrawWithSessionIxOpts, MetadataService, MetaplexMetadataFetcher, type MintData, type MintDataMap, OperationalState, type OperationalStateRaw, type OracleConfigOpt, type OracleConfigOptRaw, type OraclePrice, type OraclePriceDto, type OraclePriceMap, OracleSetup, type OracleSetupRaw, 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, type PriceWithConfidence, type PriceWithConfidenceDto, type PriorityFees, ProcessTransactionError, ProcessTransactionErrorType, type ProcessTransactionOpts, type ProcessTransactionStrategy, type ProcessTransactionsClientOpts, type ProgramError, type ProgramErrorWithDescription, type PythPushFeedIdMap, type RatePoint, type RatePointDto, type RatePointRaw, type RepayWithCollateralProps, type RepayWithCollateralTxProps, RiskTier, type RiskTierRaw, 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, type SimulationResult, type SpecificBroadcastMethod, type SpecificBroadcastMethodType, type StakeAccount$1 as StakeAccount, type StakePoolMevMap, type SupportedOracleSetup, TLogger, TRANSFER_ACCOUNT_AUTHORITY_FLAG, type TransactionBuilderResult, USDC_DECIMALS, USDC_MINT, type ValidatorRateData, type ValidatorStakeGroup, type ValidatorStakeGroupDto, 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, isOracleSetupSupported, isWeightedPrice, lendrAccountToDto, makeAddPermissionlessStakedBankIx, makeBundleTipIx, makePoolAddBankIx$1 as makePoolAddBankIx, makePoolConfigureBankIx$1 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx$1 as makePulseHealthIx, makeTxPriorityIx, makeUnwrapSolIx, makeVersionedTransaction, makeWrapSolIxs, 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, index as vendor };
|
|
3521
|
+
export { AccountFlags, AccountType$1 as AccountType, type ActionEmodeImpact, type ActiveEmodePair, type ActiveStakePoolMap, AssetTag, BUNDLE_TX_SIZE, Balance, type BalanceRaw, type BalanceType, type BalanceTypeDto, Bank, BankConfig, type BankConfigCompactRaw, type BankConfigDto, BankConfigFlag, type BankConfigOpt, type BankConfigOptRaw, type BankConfigRaw, type BankConfigRawDto, type BankConfigType, BankFlags, type BankMap, type BankMetadataRaw, type BankRaw, type BankRawDto, type BankType, type BankTypeDto, BankVaultType, type BroadcastMethodType, 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, type EmodeConfigRaw, type EmodeConfigRawDto, type EmodeEntry, type EmodeEntryDto, EmodeEntryFlags, EmodeFlags, type EmodeImpact, EmodeImpactStatus, type EmodePair, EmodeSettings, type EmodeSettingsDto, type EmodeSettingsRaw, type EmodeSettingsRawDto, type EmodeSettingsType, EmodeTag, Environment, FLASHLOAN_ENABLED_FLAG, type FetchGroupDataFn, type FetchRawBanksArgs, type FlashLoanArgs, type FlashloanActionResult, FogoMetadataFetcher, GROUP_PK, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, type HealthCacheRaw, HealthCacheSimulationError, type HealthCacheType, type HealthCacheTypeDto, IMetadataFetcher, type InterestRateConfig, type InterestRateConfigCompactRaw, type InterestRateConfigDto, type InterestRateConfigOpt, type InterestRateConfigOptRaw, type InterestRateConfigRaw, JUPITER_V6_PROGRAM, LENDR_PROGRAM, LENDR_SPONSORED_SHARD_ID, LST_MINT, LUT_PROGRAM_AUTHORITY_INDEX, LendingAccountDepositOrRepayWithSessionAccounts, LendingAccountWithdrawOrBorrowWithSessionAccounts, LendrAccount, type LendrAccountRaw, type LendrAccountType, type LendrAccountTypeDto, LendrAccountWrapper, LendrClient, type LendrClientFetchOptions, type LendrClientOptions, type LendrClientProps, LendrConfig, LendrGroup, type LendrGroupRaw, type LendrGroupType, type LendrGroupTypeDto, LendrIdlType, LendrProgram, LendrRequirementType, type LendrRequirementTypeRaw, type LoopProps, type LoopTxProps, MAX_ACCOUNT_KEYS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, type MakeBorrowIxOpts, type MakeBorrowWithSessionIxOpts, type MakeDepositIxOpts, type MakeDepositWithSessionIxOpts, type MakeRepayIxOpts, type MakeRepayWithSessionIxOpts, type MakeWithdrawIxOpts, type MakeWithdrawWithSessionIxOpts, MetadataService, MetaplexMetadataFetcher, type MintData, type MintDataMap, OperationalState, type OperationalStateRaw, type OracleConfigOpt, type OracleConfigOptRaw, type OraclePrice, type OraclePriceDto, type OraclePriceMap, OracleSetup, type OracleSetupRaw, 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, type PriceWithConfidence, type PriceWithConfidenceDto, type PriorityFees, ProcessTransactionError, ProcessTransactionErrorType, type ProcessTransactionOpts, type ProcessTransactionStrategy, type ProcessTransactionsClientOpts, type ProgramError, type ProgramErrorWithDescription, type PythPushFeedIdMap, type RatePoint, type RatePointDto, type RatePointRaw, type RepayWithCollateralProps, type RepayWithCollateralTxProps, RiskTier, type RiskTierRaw, 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, type SimulationResult, type SpecificBroadcastMethod, type SpecificBroadcastMethodType, type StakeAccount$1 as StakeAccount, type StakePoolMevMap, type SupportedOracleSetup, TLogger, TRANSFER_ACCOUNT_AUTHORITY_FLAG, type TransactionBuilderResult, USDC_DECIMALS, USDC_MINT, type ValidatorRateData, type ValidatorStakeGroup, type ValidatorStakeGroupDto, 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, isOracleSetupSupported, isWeightedPrice, lendrAccountToDto, makeAddPermissionlessStakedBankIx, makeBundleTipIx, makePoolAddBankIx$1 as makePoolAddBankIx, makePoolConfigureBankIx$1 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx$1 as makePulseHealthIx, makeTxPriorityIx, makeUnwrapSolIx, makeVersionedTransaction, makeWrapSolIxs, 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, index as vendor };
|
package/dist/index.js
CHANGED
|
@@ -11181,6 +11181,14 @@ async function makePulseHealthIx(ldProgram, accounts, remainingAccounts = []) {
|
|
|
11181
11181
|
lendrAccount: accounts.lendrAccount
|
|
11182
11182
|
}).remainingAccounts(remainingAccounts).instruction();
|
|
11183
11183
|
}
|
|
11184
|
+
async function makeHandleBankruptcyIx(ldProgram, accounts) {
|
|
11185
|
+
const { bank, lendrAccount, tokenProgram, ...optionalAccounts } = accounts;
|
|
11186
|
+
return ldProgram.methods.lendingPoolHandleBankruptcy().accounts({
|
|
11187
|
+
bank,
|
|
11188
|
+
lendrAccount,
|
|
11189
|
+
tokenProgram
|
|
11190
|
+
}).accountsPartial(optionalAccounts).instruction();
|
|
11191
|
+
}
|
|
11184
11192
|
var instructions = {
|
|
11185
11193
|
makeDepositIx,
|
|
11186
11194
|
makeDepositWithSessionIx,
|
|
@@ -11205,7 +11213,8 @@ var instructions = {
|
|
|
11205
11213
|
makePoolAddPermissionlessStakedBankIx,
|
|
11206
11214
|
makeLendingPoolConfigureBankOracleIx,
|
|
11207
11215
|
makePulseHealthIx,
|
|
11208
|
-
makeLendingAccountSettleEmissionsIx
|
|
11216
|
+
makeLendingAccountSettleEmissionsIx,
|
|
11217
|
+
makeHandleBankruptcyIx
|
|
11209
11218
|
};
|
|
11210
11219
|
var instructions_default = instructions;
|
|
11211
11220
|
|
|
@@ -11340,6 +11349,16 @@ var BankConfigFlag = /* @__PURE__ */ ((BankConfigFlag2) => {
|
|
|
11340
11349
|
BankConfigFlag2[BankConfigFlag2["PYTH_MIGRATED"] = 1] = "PYTH_MIGRATED";
|
|
11341
11350
|
return BankConfigFlag2;
|
|
11342
11351
|
})(BankConfigFlag || {});
|
|
11352
|
+
var BankFlags = /* @__PURE__ */ ((BankFlags2) => {
|
|
11353
|
+
BankFlags2[BankFlags2["EMISSIONS_FLAG_BORROW_ACTIVE"] = 1] = "EMISSIONS_FLAG_BORROW_ACTIVE";
|
|
11354
|
+
BankFlags2[BankFlags2["EMISSIONS_FLAG_LENDING_ACTIVE"] = 2] = "EMISSIONS_FLAG_LENDING_ACTIVE";
|
|
11355
|
+
BankFlags2[BankFlags2["PERMISSIONLESS_BAD_DEBT_SETTLEMENT"] = 4] = "PERMISSIONLESS_BAD_DEBT_SETTLEMENT";
|
|
11356
|
+
BankFlags2[BankFlags2["FREEZE_SETTINGS"] = 8] = "FREEZE_SETTINGS";
|
|
11357
|
+
BankFlags2[BankFlags2["CLOSE_ENABLED"] = 16] = "CLOSE_ENABLED";
|
|
11358
|
+
BankFlags2[BankFlags2["TOKENLESS_REPAYMENTS_ALLOWED"] = 32] = "TOKENLESS_REPAYMENTS_ALLOWED";
|
|
11359
|
+
BankFlags2[BankFlags2["TOKENLESS_REPAYMENTS_COMPLETE"] = 64] = "TOKENLESS_REPAYMENTS_COMPLETE";
|
|
11360
|
+
return BankFlags2;
|
|
11361
|
+
})(BankFlags || {});
|
|
11343
11362
|
var EmodeEntryFlags = /* @__PURE__ */ ((EmodeEntryFlags2) => {
|
|
11344
11363
|
EmodeEntryFlags2[EmodeEntryFlags2["APPLIES_TO_ISOLATED"] = 1] = "APPLIES_TO_ISOLATED";
|
|
11345
11364
|
EmodeEntryFlags2[EmodeEntryFlags2["RESERVED_1"] = 2] = "RESERVED_1";
|
|
@@ -11458,6 +11477,7 @@ function parseBankRaw(address, accountParsed, feedIdMap, bankMetadata, mintData)
|
|
|
11458
11477
|
group,
|
|
11459
11478
|
mint,
|
|
11460
11479
|
mintDecimals,
|
|
11480
|
+
flags,
|
|
11461
11481
|
assetShareValue,
|
|
11462
11482
|
liabilityShareValue,
|
|
11463
11483
|
liquidityVault,
|
|
@@ -11497,6 +11517,7 @@ function dtoToBank(bankDto) {
|
|
|
11497
11517
|
group: new PublicKey7(bankDto.group),
|
|
11498
11518
|
mint: new PublicKey7(bankDto.mint),
|
|
11499
11519
|
mintDecimals: bankDto.mintDecimals,
|
|
11520
|
+
flags: bankDto.flags,
|
|
11500
11521
|
assetShareValue: new BigNumber3(bankDto.assetShareValue),
|
|
11501
11522
|
liabilityShareValue: new BigNumber3(bankDto.liabilityShareValue),
|
|
11502
11523
|
liquidityVault: new PublicKey7(bankDto.liquidityVault),
|
|
@@ -16694,7 +16715,6 @@ function findOracleKey(bankConfig, feedIdMap) {
|
|
|
16694
16715
|
return { oracleKey: feedId };
|
|
16695
16716
|
} catch (error) {
|
|
16696
16717
|
console.error("Error finding oracle key", error);
|
|
16697
|
-
console.log("oracleSetup", bankConfig.oracleSetup);
|
|
16698
16718
|
return { oracleKey: bankConfig.oracleKeys[0] };
|
|
16699
16719
|
}
|
|
16700
16720
|
}
|
|
@@ -20347,6 +20367,7 @@ function toBankDto(bank) {
|
|
|
20347
20367
|
config: toBankConfigDto(bank.config),
|
|
20348
20368
|
totalAssetShares: bank.totalAssetShares.toString(),
|
|
20349
20369
|
totalLiabilityShares: bank.totalLiabilityShares.toString(),
|
|
20370
|
+
flags: bank.flags,
|
|
20350
20371
|
emissionsActiveBorrowing: bank.emissionsActiveBorrowing,
|
|
20351
20372
|
emissionsActiveLending: bank.emissionsActiveLending,
|
|
20352
20373
|
emissionsRate: bank.emissionsRate,
|
|
@@ -21720,7 +21741,7 @@ function computeHealthAccountMetas(banksToInclude, bankMetadataMap, enableSortin
|
|
|
21720
21741
|
const wrapperFn = enableSorting ? composeRemainingAccounts : (banksAndOracles) => banksAndOracles.flat();
|
|
21721
21742
|
const accounts = wrapperFn(
|
|
21722
21743
|
banksToInclude.map((bank) => {
|
|
21723
|
-
const keys = [bank.address, bank.
|
|
21744
|
+
const keys = [bank.address, bank.config.oracleKeys[0]];
|
|
21724
21745
|
if (bank.config.assetTag === 2) {
|
|
21725
21746
|
if (!bankMetadataMap && !bankExtendedMetadata) {
|
|
21726
21747
|
throw Error(`No bank metadata for ${bank.address.toBase58()} provided`);
|
|
@@ -22815,7 +22836,7 @@ import BigNumber13 from "bignumber.js";
|
|
|
22815
22836
|
var SECONDS_PER_DAY2 = 24 * 60 * 60;
|
|
22816
22837
|
var _SECONDS_PER_YEAR = SECONDS_PER_DAY2 * 365.25;
|
|
22817
22838
|
var Bank = class _Bank {
|
|
22818
|
-
constructor(address, mint, mintDecimals, group, mintRate, mintPrice, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, oracleKey, emode, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, pythShardId, tokenSymbol, extendedMetadata, owner) {
|
|
22839
|
+
constructor(address, mint, mintDecimals, group, mintRate, mintPrice, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, flags, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, oracleKey, emode, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, pythShardId, tokenSymbol, extendedMetadata, owner) {
|
|
22819
22840
|
this.address = address;
|
|
22820
22841
|
this.mint = mint;
|
|
22821
22842
|
this.mintDecimals = mintDecimals;
|
|
@@ -22839,6 +22860,7 @@ var Bank = class _Bank {
|
|
|
22839
22860
|
this.config = config;
|
|
22840
22861
|
this.totalAssetShares = totalAssetShares;
|
|
22841
22862
|
this.totalLiabilityShares = totalLiabilityShares;
|
|
22863
|
+
this.flags = flags;
|
|
22842
22864
|
this.emissionsActiveBorrowing = emissionsActiveBorrowing;
|
|
22843
22865
|
this.emissionsActiveLending = emissionsActiveLending;
|
|
22844
22866
|
this.emissionsRate = emissionsRate;
|
|
@@ -22905,6 +22927,7 @@ var Bank = class _Bank {
|
|
|
22905
22927
|
config,
|
|
22906
22928
|
bankType.totalAssetShares,
|
|
22907
22929
|
bankType.totalLiabilityShares,
|
|
22930
|
+
bankType.flags,
|
|
22908
22931
|
bankType.emissionsActiveBorrowing,
|
|
22909
22932
|
bankType.emissionsActiveLending,
|
|
22910
22933
|
bankType.emissionsRate,
|
|
@@ -22945,6 +22968,7 @@ var Bank = class _Bank {
|
|
|
22945
22968
|
props.config,
|
|
22946
22969
|
props.totalAssetShares,
|
|
22947
22970
|
props.totalLiabilityShares,
|
|
22971
|
+
props.flags,
|
|
22948
22972
|
props.emissionsActiveBorrowing,
|
|
22949
22973
|
props.emissionsActiveLending,
|
|
22950
22974
|
props.emissionsRate,
|
|
@@ -24073,6 +24097,8 @@ var LendrAccount = class _LendrAccount {
|
|
|
24073
24097
|
if (liabilityMintData.tokenProgram.equals(TOKEN_2022_PROGRAM_ID)) {
|
|
24074
24098
|
remainingAccounts.push(liabilityMintData.mint);
|
|
24075
24099
|
}
|
|
24100
|
+
remainingAccounts.push(assetBank.config.oracleKeys[0]);
|
|
24101
|
+
remainingAccounts.push(liabilityBank.config.oracleKeys[0]);
|
|
24076
24102
|
const accountMetas = computeHealthAccountMetas(healthAccounts, bankMetadataMap);
|
|
24077
24103
|
remainingAccounts.push(...accountMetas);
|
|
24078
24104
|
ixs.push(ComputeBudgetProgram5.setComputeUnitLimit({ units: 14e5 }));
|
|
@@ -26312,6 +26338,70 @@ var LendrAccountWrapper = class _LendrAccountWrapper {
|
|
|
26312
26338
|
const outstandingEmissions = simulatedLendrAccount.getBalance(bank).emissionsOutstanding;
|
|
26313
26339
|
return outstandingEmissions;
|
|
26314
26340
|
}
|
|
26341
|
+
/**
|
|
26342
|
+
* Creates an instruction to handle bankruptcy (bad debt settlement) for this account.
|
|
26343
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
26344
|
+
*
|
|
26345
|
+
* @param bankAddress - The bank where the account has bad debt
|
|
26346
|
+
* @returns An InstructionsWrapper containing the handle bankruptcy instruction
|
|
26347
|
+
*
|
|
26348
|
+
* @remarks
|
|
26349
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
26350
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
26351
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for that bank)
|
|
26352
|
+
*/
|
|
26353
|
+
async makeHandleBankruptcyIx(bankAddress) {
|
|
26354
|
+
const bank = this.client.getBankByPk(bankAddress);
|
|
26355
|
+
if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
|
|
26356
|
+
const mintData = this.client.mintDatas.get(bankAddress.toBase58());
|
|
26357
|
+
if (!mintData) throw Error(`Mint data for bank ${bankAddress.toBase58()} not found`);
|
|
26358
|
+
const ix = await instructions_default.makeHandleBankruptcyIx(this._program, {
|
|
26359
|
+
bank: bankAddress,
|
|
26360
|
+
lendrAccount: this.address,
|
|
26361
|
+
tokenProgram: mintData.tokenProgram,
|
|
26362
|
+
group: this.client.group.address
|
|
26363
|
+
});
|
|
26364
|
+
return {
|
|
26365
|
+
instructions: [ix],
|
|
26366
|
+
keys: []
|
|
26367
|
+
};
|
|
26368
|
+
}
|
|
26369
|
+
/**
|
|
26370
|
+
* Handles bankruptcy (bad debt settlement) for this account at a specific bank.
|
|
26371
|
+
* This writes off bad debt from the account using the bank's insurance fund.
|
|
26372
|
+
*
|
|
26373
|
+
* @param bankAddress - The bank where the account has bad debt
|
|
26374
|
+
* @param processOpts - Optional processing options for the transaction
|
|
26375
|
+
* @param txOpts - Optional transaction options
|
|
26376
|
+
* @returns The transaction signature of the handle bankruptcy transaction
|
|
26377
|
+
*
|
|
26378
|
+
* @remarks
|
|
26379
|
+
* - If the bank has PERMISSIONLESS_BAD_DEBT_SETTLEMENT flag set, anyone can call this
|
|
26380
|
+
* - Otherwise, only the group admin or risk admin can call this
|
|
26381
|
+
* - The account must have bad debt (liabilities > 0, assets = 0 for that bank)
|
|
26382
|
+
*/
|
|
26383
|
+
async handleBankruptcy(bankAddress, processOpts, txOpts) {
|
|
26384
|
+
this.client.logger.debug(
|
|
26385
|
+
{
|
|
26386
|
+
address: this.address.toBase58(),
|
|
26387
|
+
bank: bankAddress.toBase58()
|
|
26388
|
+
},
|
|
26389
|
+
"[lendr:lendr-account:handle-bankruptcy] Handling bankruptcy for lendr account"
|
|
26390
|
+
);
|
|
26391
|
+
const bankruptcyIxs = await this.makeHandleBankruptcyIx(bankAddress);
|
|
26392
|
+
const tx = new Transaction2().add(...bankruptcyIxs.instructions);
|
|
26393
|
+
const clientLookupTables = await getClientAddressLookupTableAccounts(this.client);
|
|
26394
|
+
const solanaTx = addTransactionMetadata(tx, {
|
|
26395
|
+
addressLookupTables: clientLookupTables,
|
|
26396
|
+
type: "HANDLE_BANKRUPTCY" /* HANDLE_BANKRUPTCY */
|
|
26397
|
+
});
|
|
26398
|
+
const sig = await this.client.processTransaction(solanaTx, processOpts, txOpts);
|
|
26399
|
+
this.client.logger.debug(
|
|
26400
|
+
{ address: this.address.toBase58(), sig },
|
|
26401
|
+
"[lendr:lendr-account:handle-bankruptcy] Bankruptcy handled successfully"
|
|
26402
|
+
);
|
|
26403
|
+
return sig;
|
|
26404
|
+
}
|
|
26315
26405
|
//TODO: maybe become usefull someday
|
|
26316
26406
|
// async getBanksUnclaimedOutstandingEmissions(banks: PublicKey[]) {
|
|
26317
26407
|
// const results = await Promise.allSettled(
|
|
@@ -27485,6 +27575,7 @@ export {
|
|
|
27485
27575
|
Bank,
|
|
27486
27576
|
BankConfig,
|
|
27487
27577
|
BankConfigFlag,
|
|
27578
|
+
BankFlags,
|
|
27488
27579
|
BankVaultType,
|
|
27489
27580
|
DEFAULT_CLUSTER,
|
|
27490
27581
|
DEFAULT_COMMITMENT,
|