@pyron-finance/pyron-client 2.5.2 → 2.6.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 +9488 -0
- package/dist/bank-metadata-X4_5k9-u.d.ts +9488 -0
- package/dist/common/index.cjs +1255 -68
- package/dist/common/index.d.cts +296 -2
- package/dist/common/index.d.ts +296 -2
- package/dist/common/index.js +1159 -2
- package/dist/index.cjs +27305 -25577
- package/dist/index.d.cts +3445 -2
- package/dist/index.d.ts +3445 -2
- package/dist/index.js +27137 -25337
- package/package.json +9 -7
- package/dist/chunk-DcLnE9XY.js +0 -37
- package/dist/common/index-B8FKDxAd.d.cts +0 -2
- package/dist/common/index-CyNmUxZS.d.ts +0 -2
- package/dist/common-DBVYOab7.cjs +0 -1954
- package/dist/common-IgVl6MYx.js +0 -1222
- package/dist/common-IgVl6MYx.js.map +0 -1
- package/dist/index-676IKB7k.d.ts +0 -12674
- package/dist/index-676IKB7k.d.ts.map +0 -1
- package/dist/index-B-Q6sJAm.d.cts +0 -2
- package/dist/index-B6N7zb5f.d.ts +0 -2
- package/dist/index-Mtc43T83.d.cts +0 -12675
- package/dist/index-Mtc43T83.d.cts.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,3445 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as anchor from '@coral-xyz/anchor';
|
|
2
|
+
import { Address, Provider, AnchorProvider, BorshCoder, Program as Program$1 } from '@coral-xyz/anchor';
|
|
3
|
+
import { TransactionResult } from '@fogo/sessions-sdk';
|
|
4
|
+
import * as _solana_web3_js from '@solana/web3.js';
|
|
5
|
+
import { PublicKey, TransactionInstruction, VersionedTransaction, Blockhash, Transaction, AddressLookupTableAccount, Connection, AccountMeta, Commitment, TransactionSignature, Signer, TransactionError, ConfirmOptions, SimulatedTransactionResponse, Keypair, SendOptions } from '@solana/web3.js';
|
|
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-X4_5k9-u.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-X4_5k9-u.js';
|
|
9
|
+
import BN from 'bn.js';
|
|
10
|
+
import BigNumber from 'bignumber.js';
|
|
11
|
+
import 'zod';
|
|
12
|
+
import '@solana/wallet-adapter-base';
|
|
13
|
+
import 'zod/v4-mini';
|
|
14
|
+
|
|
15
|
+
type EstablishedSessionState = {
|
|
16
|
+
walletPublicKey: PublicKey;
|
|
17
|
+
sessionPublicKey: PublicKey;
|
|
18
|
+
payer: PublicKey;
|
|
19
|
+
sendTransaction: (instructions: Array<TransactionInstruction> | VersionedTransaction, options?: {
|
|
20
|
+
variation?: string;
|
|
21
|
+
}) => Promise<TransactionResult>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
interface PriceWithConfidence {
|
|
25
|
+
price: BigNumber;
|
|
26
|
+
confidence: BigNumber;
|
|
27
|
+
lowestPrice: BigNumber;
|
|
28
|
+
highestPrice: BigNumber;
|
|
29
|
+
}
|
|
30
|
+
interface OraclePrice {
|
|
31
|
+
priceRealtime: PriceWithConfidence;
|
|
32
|
+
priceWeighted: PriceWithConfidence;
|
|
33
|
+
timestamp: BigNumber;
|
|
34
|
+
pythShardId?: number;
|
|
35
|
+
}
|
|
36
|
+
declare enum PriceBias {
|
|
37
|
+
Lowest = 0,
|
|
38
|
+
None = 1,
|
|
39
|
+
Highest = 2
|
|
40
|
+
}
|
|
41
|
+
interface PriceWithConfidenceDto {
|
|
42
|
+
price: string;
|
|
43
|
+
confidence: string;
|
|
44
|
+
lowestPrice: string;
|
|
45
|
+
highestPrice: string;
|
|
46
|
+
}
|
|
47
|
+
interface OraclePriceDto {
|
|
48
|
+
priceRealtime: PriceWithConfidenceDto;
|
|
49
|
+
priceWeighted: PriceWithConfidenceDto;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
pythShardId?: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare function getBankVaultSeeds(type: BankVaultType): Buffer;
|
|
55
|
+
/**
|
|
56
|
+
* Compute authority PDA for a specific lendr group bank vault
|
|
57
|
+
*/
|
|
58
|
+
declare function getBankVaultAuthority(bankVaultType: BankVaultType, bankPk: PublicKey, programId: PublicKey): [PublicKey, number];
|
|
59
|
+
declare function makeWrapSolIxs(walletAddress: PublicKey, amount: BigNumber): TransactionInstruction[];
|
|
60
|
+
declare function makeUnwrapSolIx(walletAddress: PublicKey): TransactionInstruction;
|
|
61
|
+
declare function makeVersionedTransaction(blockhash: Blockhash, transaction: Transaction, payer: PublicKey, addressLookupTables?: AddressLookupTableAccount[]): Promise<VersionedTransaction>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a compute budget instruction to set the priority fee for a transaction.
|
|
64
|
+
* The priority fee is specified in micro-lamports per compute unit.
|
|
65
|
+
*
|
|
66
|
+
* @param priorityFeeMicro - Priority fee in micro-lamports per compute unit. If not provided, defaults to 1.
|
|
67
|
+
* @returns A compute budget instruction with the specified priority fee
|
|
68
|
+
*/
|
|
69
|
+
declare function makePriorityFeeMicroIx(priorityFeeMicro?: number): TransactionInstruction;
|
|
70
|
+
declare function makePriorityFeeIx(priorityFeeUi?: number, computeUnitsLimit?: number): TransactionInstruction[];
|
|
71
|
+
declare function feedIdToString(feedId: PublicKey): string;
|
|
72
|
+
type PythPushFeedIdMap = Map<string, {
|
|
73
|
+
feedId: PublicKey;
|
|
74
|
+
shardId?: number;
|
|
75
|
+
}>;
|
|
76
|
+
declare function buildFeedIdMap(bankConfigs: BankConfigRaw[], connection: Connection): Promise<PythPushFeedIdMap>;
|
|
77
|
+
declare function findOracleKey(bankConfig: BankConfig, feedIdMap?: PythPushFeedIdMap): {
|
|
78
|
+
oracleKey: PublicKey;
|
|
79
|
+
shardId?: number;
|
|
80
|
+
};
|
|
81
|
+
declare const PYTH_SPONSORED_SHARD_ID = 0;
|
|
82
|
+
declare const LENDR_SPONSORED_SHARD_ID = 3301;
|
|
83
|
+
declare function findPythPushOracleAddress(feedId: Buffer, programId: PublicKey, shardId: number): PublicKey;
|
|
84
|
+
|
|
85
|
+
declare class EmodeSettings implements EmodeSettingsType {
|
|
86
|
+
emodeTag: EmodeTag;
|
|
87
|
+
timestamp: number;
|
|
88
|
+
flags: EmodeFlags[];
|
|
89
|
+
emodeEntries: EmodeEntry[];
|
|
90
|
+
constructor(emodeTag: EmodeTag, timestamp: number, flags: EmodeFlags[], emodeEntries: EmodeEntry[]);
|
|
91
|
+
static from(emodeSettingsRaw: EmodeSettingsRaw): EmodeSettings;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare class Bank implements BankType {
|
|
95
|
+
readonly address: PublicKey;
|
|
96
|
+
readonly mint: PublicKey;
|
|
97
|
+
readonly mintDecimals: number;
|
|
98
|
+
readonly group: PublicKey;
|
|
99
|
+
readonly mintRate: number | null;
|
|
100
|
+
readonly mintPrice: number;
|
|
101
|
+
readonly assetShareValue: BigNumber;
|
|
102
|
+
readonly liabilityShareValue: BigNumber;
|
|
103
|
+
readonly liquidityVault: PublicKey;
|
|
104
|
+
readonly liquidityVaultBump: number;
|
|
105
|
+
readonly liquidityVaultAuthorityBump: number;
|
|
106
|
+
readonly insuranceVault: PublicKey;
|
|
107
|
+
readonly insuranceVaultBump: number;
|
|
108
|
+
readonly insuranceVaultAuthorityBump: number;
|
|
109
|
+
readonly collectedInsuranceFeesOutstanding: BigNumber;
|
|
110
|
+
readonly feeVault: PublicKey;
|
|
111
|
+
readonly feeVaultBump: number;
|
|
112
|
+
readonly feeVaultAuthorityBump: number;
|
|
113
|
+
readonly collectedGroupFeesOutstanding: BigNumber;
|
|
114
|
+
readonly lastUpdate: number;
|
|
115
|
+
config: BankConfig;
|
|
116
|
+
readonly totalAssetShares: BigNumber;
|
|
117
|
+
readonly totalLiabilityShares: BigNumber;
|
|
118
|
+
readonly emissionsActiveBorrowing: boolean;
|
|
119
|
+
readonly emissionsActiveLending: boolean;
|
|
120
|
+
readonly emissionsRate: number;
|
|
121
|
+
readonly emissionsMint: PublicKey;
|
|
122
|
+
readonly emissionsRemaining: BigNumber;
|
|
123
|
+
readonly oracleKey: PublicKey;
|
|
124
|
+
readonly emode: EmodeSettings;
|
|
125
|
+
readonly feesDestinationAccount?: PublicKey | undefined;
|
|
126
|
+
readonly lendingPositionCount?: BigNumber | undefined;
|
|
127
|
+
readonly borrowingPositionCount?: BigNumber | undefined;
|
|
128
|
+
readonly pythShardId?: number | undefined;
|
|
129
|
+
readonly tokenSymbol?: string | undefined;
|
|
130
|
+
readonly extendedMetadata?: BankExtendedMetadata | undefined;
|
|
131
|
+
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
|
+
static decodeBankRaw(encoded: Buffer, idl: LendrIdlType): BankRaw;
|
|
134
|
+
static fromBuffer(bankPk: PublicKey, rawData: Buffer, idl: LendrIdlType, feedIdMap: PythPushFeedIdMap): Bank;
|
|
135
|
+
static fromBankType(bankType: BankType): Bank;
|
|
136
|
+
static fromAccountParsed(address: PublicKey, accountParsed: BankRaw, feedIdMap?: PythPushFeedIdMap, extendedMetadata?: BankExtendedMetadata, owner?: PublicKey): Bank;
|
|
137
|
+
static withEmodeWeights(bank: Bank, emodeWeights: {
|
|
138
|
+
assetWeightMaint: BigNumber;
|
|
139
|
+
assetWeightInit: BigNumber;
|
|
140
|
+
}): Bank;
|
|
141
|
+
static getPrice(oraclePrice: OraclePrice, priceBias?: PriceBias, weightedPrice?: boolean): BigNumber;
|
|
142
|
+
static computeQuantityFromUsdValue(oraclePrice: OraclePrice, usdValue: BigNumber, priceBias: PriceBias, weightedPrice: boolean): BigNumber;
|
|
143
|
+
getTotalAssetQuantity(): BigNumber;
|
|
144
|
+
getTotalLiabilityQuantity(): BigNumber;
|
|
145
|
+
getAssetQuantity(assetShares: BigNumber): BigNumber;
|
|
146
|
+
getLiabilityQuantity(liabilityShares: BigNumber): BigNumber;
|
|
147
|
+
getAssetShares(assetQuantity: BigNumber): BigNumber;
|
|
148
|
+
getLiabilityShares(liabilityQuantity: BigNumber): BigNumber;
|
|
149
|
+
computeAssetUsdValue(oraclePrice: OraclePrice, assetShares: BigNumber, lendrRequirementType: LendrRequirementType, priceBias: PriceBias): BigNumber;
|
|
150
|
+
computeLiabilityUsdValue(oraclePrice: OraclePrice, liabilityShares: BigNumber, lendrRequirementType: LendrRequirementType, priceBias: PriceBias): BigNumber;
|
|
151
|
+
computeUsdValue(oraclePrice: OraclePrice, quantity: BigNumber, priceBias: PriceBias, weightedPrice: boolean, weight?: BigNumber, scaleToBase?: boolean): BigNumber;
|
|
152
|
+
getAssetWeight(lendrRequirementType: LendrRequirementType, oraclePrice: OraclePrice, ignoreSoftLimits?: boolean, assetWeightInitOverride?: BigNumber): BigNumber;
|
|
153
|
+
getLiabilityWeight(lendrRequirementType: LendrRequirementType): BigNumber;
|
|
154
|
+
computeTvl(oraclePrice: OraclePrice): BigNumber;
|
|
155
|
+
computeInterestRates(): {
|
|
156
|
+
lendingRate: BigNumber;
|
|
157
|
+
borrowingRate: BigNumber;
|
|
158
|
+
};
|
|
159
|
+
computeBaseInterestRate(): BigNumber;
|
|
160
|
+
computeUtilizationRate(): BigNumber;
|
|
161
|
+
computeRemainingCapacity(): {
|
|
162
|
+
depositCapacity: BigNumber;
|
|
163
|
+
borrowCapacity: BigNumber;
|
|
164
|
+
};
|
|
165
|
+
describe(oraclePrice: OraclePrice): string;
|
|
166
|
+
}
|
|
167
|
+
declare class BankConfig implements BankConfigType {
|
|
168
|
+
assetWeightInit: BigNumber;
|
|
169
|
+
assetWeightMaint: BigNumber;
|
|
170
|
+
readonly liabilityWeightInit: BigNumber;
|
|
171
|
+
readonly liabilityWeightMaint: BigNumber;
|
|
172
|
+
readonly depositLimit: BigNumber;
|
|
173
|
+
readonly borrowLimit: BigNumber;
|
|
174
|
+
readonly riskTier: RiskTier;
|
|
175
|
+
readonly totalAssetValueInitLimit: BigNumber;
|
|
176
|
+
readonly assetTag: AssetTag;
|
|
177
|
+
readonly oracleSetup: OracleSetup;
|
|
178
|
+
readonly oracleKeys: PublicKey[];
|
|
179
|
+
readonly oracleMaxAge: number;
|
|
180
|
+
readonly interestRateConfig: InterestRateConfig;
|
|
181
|
+
readonly operationalState: OperationalState;
|
|
182
|
+
readonly oracleMaxConfidence: number;
|
|
183
|
+
readonly fixedPrice: BigNumber;
|
|
184
|
+
readonly configFlags?: BankConfigFlag | undefined;
|
|
185
|
+
constructor(assetWeightInit: BigNumber, assetWeightMaint: BigNumber, liabilityWeightInit: BigNumber, liabilityWeightMaint: BigNumber, depositLimit: BigNumber, borrowLimit: BigNumber, riskTier: RiskTier, totalAssetValueInitLimit: BigNumber, assetTag: AssetTag, oracleSetup: OracleSetup, oracleKeys: PublicKey[], oracleMaxAge: number, interestRateConfig: InterestRateConfig, operationalState: OperationalState, oracleMaxConfidence: number, fixedPrice: BigNumber, configFlags?: BankConfigFlag | undefined);
|
|
186
|
+
static fromAccountParsed(bankConfigRaw: BankConfigRaw): BankConfig;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
declare class Balance implements BalanceType {
|
|
190
|
+
active: boolean;
|
|
191
|
+
bankPk: PublicKey;
|
|
192
|
+
assetShares: BigNumber;
|
|
193
|
+
liabilityShares: BigNumber;
|
|
194
|
+
emissionsOutstanding: BigNumber;
|
|
195
|
+
lastUpdate: number;
|
|
196
|
+
constructor(active: boolean, bankPk: PublicKey, assetShares: BigNumber, liabilityShares: BigNumber, emissionsOutstanding: BigNumber, lastUpdate: number);
|
|
197
|
+
static from(balanceRaw: BalanceRaw): Balance;
|
|
198
|
+
static fromBalanceType(balance: BalanceType): Balance;
|
|
199
|
+
static createEmpty(bankPk: PublicKey): Balance;
|
|
200
|
+
computeUsdValue(bank: Bank, oraclePrice: OraclePrice, lendrRequirementType?: LendrRequirementType): {
|
|
201
|
+
assets: BigNumber;
|
|
202
|
+
liabilities: BigNumber;
|
|
203
|
+
};
|
|
204
|
+
getUsdValueWithPriceBias(bank: Bank, oraclePrice: OraclePrice, lendrRequirementType?: LendrRequirementType): {
|
|
205
|
+
assets: BigNumber;
|
|
206
|
+
liabilities: BigNumber;
|
|
207
|
+
};
|
|
208
|
+
computeQuantity(bank: Bank): {
|
|
209
|
+
assets: BigNumber;
|
|
210
|
+
liabilities: BigNumber;
|
|
211
|
+
};
|
|
212
|
+
computeQuantityUi(bank: Bank): {
|
|
213
|
+
assets: BigNumber;
|
|
214
|
+
liabilities: BigNumber;
|
|
215
|
+
};
|
|
216
|
+
computeTotalOutstandingEmissions(bank: Bank): BigNumber;
|
|
217
|
+
computeClaimedEmissions(bank: Bank, currentTimestamp: number): BigNumber;
|
|
218
|
+
describe(bank: Bank, oraclePrice: OraclePrice): string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
declare class HealthCache implements HealthCacheType {
|
|
222
|
+
assetValue: BigNumber;
|
|
223
|
+
liabilityValue: BigNumber;
|
|
224
|
+
assetValueMaint: BigNumber;
|
|
225
|
+
liabilityValueMaint: BigNumber;
|
|
226
|
+
assetValueEquity: BigNumber;
|
|
227
|
+
liabilityValueEquity: BigNumber;
|
|
228
|
+
timestamp: BigNumber;
|
|
229
|
+
flags: HealthCacheFlags[];
|
|
230
|
+
prices: number[][];
|
|
231
|
+
simulationFailed?: boolean | undefined;
|
|
232
|
+
constructor(assetValue: BigNumber, liabilityValue: BigNumber, assetValueMaint: BigNumber, liabilityValueMaint: BigNumber, assetValueEquity: BigNumber, liabilityValueEquity: BigNumber, timestamp: BigNumber, flags: HealthCacheFlags[], prices: number[][], simulationFailed?: boolean | undefined);
|
|
233
|
+
static from(healthCacheRaw: HealthCacheRaw): HealthCache;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
declare class LendrAccount implements LendrAccountType {
|
|
237
|
+
readonly address: PublicKey;
|
|
238
|
+
readonly group: PublicKey;
|
|
239
|
+
readonly authority: PublicKey;
|
|
240
|
+
readonly balances: Balance[];
|
|
241
|
+
readonly accountFlags: AccountFlags[];
|
|
242
|
+
readonly emissionsDestinationAccount: PublicKey;
|
|
243
|
+
healthCache: HealthCache;
|
|
244
|
+
constructor(address: PublicKey, group: PublicKey, authority: PublicKey, balances: Balance[], accountFlags: AccountFlags[], emissionsDestinationAccount: PublicKey, healthCache: HealthCache);
|
|
245
|
+
static fetch(address: PublicKey, client: LendrClient): Promise<LendrAccount>;
|
|
246
|
+
/**
|
|
247
|
+
* @deprecated use decodeAccountRaw instead
|
|
248
|
+
*/
|
|
249
|
+
static decode(encoded: Buffer, idl: LendrIdlType): LendrAccountRaw;
|
|
250
|
+
static decodeAccountRaw(encoded: Buffer, idl: LendrIdlType): LendrAccountRaw;
|
|
251
|
+
static fromAccountType(account: LendrAccountType): LendrAccount;
|
|
252
|
+
static fromAccountParsed(lendrAccountPk: PublicKey, accountData: LendrAccountRaw): LendrAccount;
|
|
253
|
+
simulateHealthCache(program: Program<LendrIdlType>, bankMap: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, bankMetadataMap: BankMetadataMap): Promise<{
|
|
254
|
+
lendrAccount: LendrAccount;
|
|
255
|
+
error?: HealthCacheSimulationError;
|
|
256
|
+
}>;
|
|
257
|
+
static fromAccountDataRaw(lendrAccountPk: PublicKey, rawData: Buffer, idl: LendrIdlType): LendrAccount;
|
|
258
|
+
get activeBalances(): Balance[];
|
|
259
|
+
getBalance(bankPk: PublicKey): Balance;
|
|
260
|
+
get isDisabled(): boolean;
|
|
261
|
+
get isFlashLoanEnabled(): boolean;
|
|
262
|
+
get isTransferAccountAuthorityEnabled(): boolean;
|
|
263
|
+
setHealthCache(value: HealthCache): void;
|
|
264
|
+
computeFreeCollateral(opts?: {
|
|
265
|
+
clamped?: boolean;
|
|
266
|
+
}): BigNumber;
|
|
267
|
+
computeFreeCollateralLegacy(banks: Map<string, BankType>, oraclePrices: Map<string, OraclePrice>, opts?: {
|
|
268
|
+
clamped?: boolean;
|
|
269
|
+
}): BigNumber;
|
|
270
|
+
computeHealthComponents(lendrReqType: LendrRequirementType): {
|
|
271
|
+
assets: BigNumber;
|
|
272
|
+
liabilities: BigNumber;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* @deprecated use computeHealthComponents instead
|
|
276
|
+
*/
|
|
277
|
+
computeHealthComponentsLegacy(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, lendrReqType: LendrRequirementType, excludedBanks?: PublicKey[]): {
|
|
278
|
+
assets: BigNumber;
|
|
279
|
+
liabilities: BigNumber;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* @deprecated use computeHealthComponents instead
|
|
283
|
+
*/
|
|
284
|
+
computeHealthComponentsWithoutBiasLegacy(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, lendrReqType: LendrRequirementType): {
|
|
285
|
+
assets: BigNumber;
|
|
286
|
+
liabilities: BigNumber;
|
|
287
|
+
};
|
|
288
|
+
computeAccountValue(): BigNumber;
|
|
289
|
+
computeNetApy(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>): number;
|
|
290
|
+
/**
|
|
291
|
+
* Calculate the maximum amount of asset that can be withdrawn from a bank given existing deposits of the asset
|
|
292
|
+
* and the untied collateral of the lendr account.
|
|
293
|
+
*
|
|
294
|
+
* fc = free collateral
|
|
295
|
+
* ucb = untied collateral for bank
|
|
296
|
+
*
|
|
297
|
+
* q = (min(fc, ucb) / (price_lowest_bias * deposit_weight)) + (fc - min(fc, ucb)) / (price_highest_bias * liab_weight)
|
|
298
|
+
*
|
|
299
|
+
*
|
|
300
|
+
*
|
|
301
|
+
* NOTE FOR LIQUIDATORS
|
|
302
|
+
* This function doesn't take into account the collateral received when liquidating an account.
|
|
303
|
+
*/
|
|
304
|
+
computeMaxBorrowForBank(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, bankAddress: PublicKey, opts?: {
|
|
305
|
+
emodeImpactStatus?: EmodeImpactStatus;
|
|
306
|
+
volatilityFactor?: number;
|
|
307
|
+
emodeWeights?: {
|
|
308
|
+
assetWeightMaint: BigNumber;
|
|
309
|
+
assetWeightInit: BigNumber;
|
|
310
|
+
collateralTags: EmodeTag[];
|
|
311
|
+
};
|
|
312
|
+
}, logger?: TLogger): BigNumber;
|
|
313
|
+
/**
|
|
314
|
+
* Calculate the maximum amount that can be withdrawn form a bank without borrowing.
|
|
315
|
+
*/
|
|
316
|
+
computeMaxWithdrawForBank(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, bankAddress: PublicKey, opts?: {
|
|
317
|
+
volatilityFactor?: number;
|
|
318
|
+
}): BigNumber;
|
|
319
|
+
/**
|
|
320
|
+
* Calculate the price at which the user position for the given bank will lead to liquidation, all other prices constant.
|
|
321
|
+
*/
|
|
322
|
+
computeLiquidationPriceForBank(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, bankAddress: PublicKey): number | null;
|
|
323
|
+
/**
|
|
324
|
+
* Calculate the price at which the user position for the given bank will lead to liquidation, all other prices constant.
|
|
325
|
+
*/
|
|
326
|
+
computeLiquidationPriceForBankHealth(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, bankAddress: PublicKey, opts?: {
|
|
327
|
+
assetWeightMaint: BigNumber;
|
|
328
|
+
}): number | null;
|
|
329
|
+
/**
|
|
330
|
+
* Calculate the price at which the user position for the given bank and amount will lead to liquidation, all other prices constant.
|
|
331
|
+
*/
|
|
332
|
+
computeLiquidationPriceForBankAmount(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, bankAddress: PublicKey, isLending: boolean, amount: number): number | null;
|
|
333
|
+
computeMaxLiquidatableAssetAmount(banks: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, assetBankAddress: PublicKey, liabilityBankAddress: PublicKey, logger?: TLogger): BigNumber;
|
|
334
|
+
getHealthCheckAccounts(banks: Map<string, Bank>, mandatoryBanks?: PublicKey[], excludedBanks?: PublicKey[]): BankType[];
|
|
335
|
+
/**
|
|
336
|
+
* Determines which E-mode pairs are currently active for this account based on its balances
|
|
337
|
+
*
|
|
338
|
+
* @param emodePairs - All available E-mode pairs to check against the account's balances
|
|
339
|
+
* @returns Array of active E-mode pairs for this account, or empty array if no E-mode is active
|
|
340
|
+
*/
|
|
341
|
+
computeActiveEmodePairs(emodePairs: EmodePair[]): EmodePair[];
|
|
342
|
+
/**
|
|
343
|
+
* Calculates the impact of different actions on E-mode status for each bank
|
|
344
|
+
*
|
|
345
|
+
* For each bank, this method simulates the following actions and their effect on E-mode:
|
|
346
|
+
* - Borrowing from the bank (for banks not currently borrowed from)
|
|
347
|
+
* - Supplying to the bank (for supported collateral banks not currently supplied)
|
|
348
|
+
* - Repaying all borrowing from the bank (for banks with active liabilities)
|
|
349
|
+
* - Withdrawing all supply from the bank (for banks with active collateral)
|
|
350
|
+
*
|
|
351
|
+
* @param emodePairs - All available E-mode pairs to check against
|
|
352
|
+
* @param banks - Array of bank PublicKeys to calculate impacts for
|
|
353
|
+
* @returns Object mapping bank PublicKey strings to impact analysis for each possible action
|
|
354
|
+
*/
|
|
355
|
+
computeEmodeImpacts(emodePairs: EmodePair[], banks: PublicKey[]): Record<string, ActionEmodeImpact>;
|
|
356
|
+
prepareDepositIx(banks: Map<string, Bank>, mintDatas: Map<string, MintData>, amount: Amount, bankAddress: PublicKey, opts?: MakeDepositIxOpts): Promise<{
|
|
357
|
+
depositIxs: TransactionInstruction[];
|
|
358
|
+
userTokenAtaPk: PublicKey;
|
|
359
|
+
mintData: MintData;
|
|
360
|
+
bank: Bank;
|
|
361
|
+
ixArguments: {
|
|
362
|
+
amount: BN;
|
|
363
|
+
};
|
|
364
|
+
remainingAccounts: AccountMeta[];
|
|
365
|
+
}>;
|
|
366
|
+
makeDepositIx(program: LendrProgram, banks: Map<string, Bank>, mintDatas: Map<string, MintData>, amount: Amount, bankAddress: PublicKey, opts?: MakeDepositIxOpts): Promise<InstructionsWrapper>;
|
|
367
|
+
makeDepositWithSessionIx(program: LendrProgram, banks: Map<string, Bank>, mintDatas: Map<string, MintData>, amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, opts?: MakeDepositWithSessionIxOpts): Promise<InstructionsWrapper>;
|
|
368
|
+
makeSettleEmissionsIx(program: LendrProgram, bank: PublicKey): Promise<InstructionsWrapper>;
|
|
369
|
+
prepareRepayInstruction(program: LendrProgram, banks: Map<string, Bank>, mintDatas: Map<string, MintData>, amount: Amount, bankAddress: PublicKey, repayAll?: boolean, opts?: MakeRepayIxOpts): Promise<{
|
|
370
|
+
repayIxs: TransactionInstruction[];
|
|
371
|
+
mintData: MintData;
|
|
372
|
+
bank: Bank;
|
|
373
|
+
userAta: PublicKey;
|
|
374
|
+
ixArguments: {
|
|
375
|
+
amount: BN;
|
|
376
|
+
repayAll: boolean;
|
|
377
|
+
};
|
|
378
|
+
remainingAccounts: PublicKey[];
|
|
379
|
+
}>;
|
|
380
|
+
makeRepayIx(program: LendrProgram, banks: Map<string, Bank>, mintDatas: Map<string, MintData>, amount: Amount, bankAddress: PublicKey, repayAll?: boolean, opts?: MakeRepayIxOpts): Promise<InstructionsWrapper>;
|
|
381
|
+
makeRepayWithSessionIx(program: LendrProgram, banks: Map<string, Bank>, mintDatas: Map<string, MintData>, amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, repayAll?: boolean, opts?: MakeRepayWithSessionIxOpts): Promise<InstructionsWrapper>;
|
|
382
|
+
prepareWithdrawInstruction(program: LendrProgram, bankMap: Map<string, Bank>, mintDatas: Map<string, MintData>, bankMetadataMap: BankMetadataMap, bankAddress: PublicKey, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawIxOpts & {
|
|
383
|
+
createAtaPayer?: PublicKey;
|
|
384
|
+
}): Promise<{
|
|
385
|
+
withdrawIxs: TransactionInstruction[];
|
|
386
|
+
wrapAndUnwrapSol: boolean;
|
|
387
|
+
mintData: MintData;
|
|
388
|
+
userAta: PublicKey;
|
|
389
|
+
bank: Bank;
|
|
390
|
+
remainingAccounts: {
|
|
391
|
+
pubkey: PublicKey;
|
|
392
|
+
isSigner: boolean;
|
|
393
|
+
isWritable: boolean;
|
|
394
|
+
}[];
|
|
395
|
+
}>;
|
|
396
|
+
makeWithdrawIx(program: LendrProgram, bankMap: Map<string, Bank>, mintDatas: Map<string, MintData>, bankMetadataMap: BankMetadataMap, amount: Amount, bankAddress: PublicKey, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawIxOpts): Promise<InstructionsWrapper>;
|
|
397
|
+
makeWithdrawWithSessionIx(program: LendrProgram, bankMap: Map<string, Bank>, mintDatas: Map<string, MintData>, bankMetadataMap: BankMetadataMap, amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawWithSessionIxOpts): Promise<InstructionsWrapper>;
|
|
398
|
+
prepareBorrowInstrcution(bankMap: Map<string, Bank>, mintDatas: Map<string, MintData>, bankMetadataMap: BankMetadataMap, bankAddress: PublicKey, borrowOpts?: MakeBorrowIxOpts & {
|
|
399
|
+
createAtaPayer?: PublicKey;
|
|
400
|
+
}): Promise<{
|
|
401
|
+
borrowIxs: TransactionInstruction[];
|
|
402
|
+
bank: Bank;
|
|
403
|
+
mintData: MintData;
|
|
404
|
+
userAta: PublicKey;
|
|
405
|
+
wrapAndUnwrapSol: boolean;
|
|
406
|
+
remainingAccounts: {
|
|
407
|
+
pubkey: PublicKey;
|
|
408
|
+
isSigner: boolean;
|
|
409
|
+
isWritable: boolean;
|
|
410
|
+
}[];
|
|
411
|
+
}>;
|
|
412
|
+
makeBorrowIx(program: LendrProgram, bankMap: Map<string, Bank>, mintDatas: Map<string, MintData>, bankMetadataMap: BankMetadataMap, amount: Amount, bankAddress: PublicKey, borrowOpts?: MakeBorrowIxOpts): Promise<InstructionsWrapper>;
|
|
413
|
+
makeBorrowWithSessionIx(program: LendrProgram, bankMap: Map<string, Bank>, mintDatas: Map<string, MintData>, bankMetadataMap: BankMetadataMap, amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, borrowOpts?: MakeBorrowWithSessionIxOpts): Promise<InstructionsWrapper>;
|
|
414
|
+
makeWithdrawEmissionsIx(program: LendrProgram, banks: Map<string, Bank>, mintDatas: Map<string, MintData>, bankAddress: PublicKey): Promise<InstructionsWrapper>;
|
|
415
|
+
makeLendingAccountLiquidateIx(liquidateeLendrAccount: LendrAccount, program: LendrProgram, bankMap: Map<string, Bank>, mintDatas: Map<string, MintData>, bankMetadataMap: BankMetadataMap, assetBankAddress: PublicKey, assetQuantityUi: Amount, liabilityBankAddress: PublicKey): Promise<InstructionsWrapper>;
|
|
416
|
+
makeBeginFlashLoanIx(program: LendrProgram, endIndex: number): Promise<InstructionsWrapper>;
|
|
417
|
+
makeBeginFlashLoanWithSessionIx(program: LendrProgram, endIndex: number, sessionKey: PublicKey): Promise<InstructionsWrapper>;
|
|
418
|
+
makeEndFlashLoanIx(program: LendrProgram, bankMap: Map<string, Bank>, projectedActiveBalances: PublicKey[]): Promise<InstructionsWrapper>;
|
|
419
|
+
makeEndFlashLoanWithSessionIx(program: LendrProgram, bankMap: Map<string, Bank>, projectedActiveBalances: PublicKey[], sessionKey: PublicKey): Promise<InstructionsWrapper>;
|
|
420
|
+
makeAccountAuthorityTransferIx(program: LendrProgram, newAccountAuthority: PublicKey): Promise<InstructionsWrapper>;
|
|
421
|
+
makeCloseAccountIx(program: LendrProgram): Promise<InstructionsWrapper>;
|
|
422
|
+
makePulseHealthIx(program: LendrProgram, banks: Map<string, Bank>, mandatoryBanks: PublicKey[], excludedBanks: PublicKey[], bankMetadataMap: BankMetadataMap): Promise<InstructionsWrapper>;
|
|
423
|
+
projectActiveBalancesNoCpi(program: LendrProgram, instructions: TransactionInstruction[]): PublicKey[];
|
|
424
|
+
wrapInstructionForWSol(ix: TransactionInstruction, amount?: Amount): TransactionInstruction[];
|
|
425
|
+
describe(banks: BankMap, oraclePrices: OraclePriceMap): string;
|
|
426
|
+
}
|
|
427
|
+
declare enum LendrRequirementType {
|
|
428
|
+
Initial = 0,
|
|
429
|
+
Maintenance = 1,
|
|
430
|
+
Equity = 2
|
|
431
|
+
}
|
|
432
|
+
interface MakeDepositIxOpts {
|
|
433
|
+
wrapAndUnwrapSol?: boolean;
|
|
434
|
+
wSolBalanceUi?: number;
|
|
435
|
+
overrideInferAccounts?: {
|
|
436
|
+
group?: PublicKey;
|
|
437
|
+
authority?: PublicKey;
|
|
438
|
+
liquidityVault?: PublicKey;
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
interface MakeDepositWithSessionIxOpts extends MakeDepositIxOpts {
|
|
442
|
+
overrideInferAccounts?: {
|
|
443
|
+
group?: PublicKey;
|
|
444
|
+
liquidityVault?: PublicKey;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
interface MakeRepayIxOpts {
|
|
448
|
+
wrapAndUnwrapSol?: boolean;
|
|
449
|
+
wSolBalanceUi?: number;
|
|
450
|
+
overrideInferAccounts?: {
|
|
451
|
+
group?: PublicKey;
|
|
452
|
+
authority?: PublicKey;
|
|
453
|
+
liquidityVault?: PublicKey;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
interface MakeRepayWithSessionIxOpts extends MakeRepayIxOpts {
|
|
457
|
+
overrideInferAccounts?: {
|
|
458
|
+
group?: PublicKey;
|
|
459
|
+
liquidityVault?: PublicKey;
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
interface MakeWithdrawIxOpts {
|
|
463
|
+
observationBanksOverride?: PublicKey[];
|
|
464
|
+
wrapAndUnwrapSol?: boolean;
|
|
465
|
+
createAtas?: boolean;
|
|
466
|
+
overrideInferAccounts?: {
|
|
467
|
+
group?: PublicKey;
|
|
468
|
+
authority?: PublicKey;
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
interface MakeWithdrawWithSessionIxOpts extends MakeWithdrawIxOpts {
|
|
472
|
+
overrideInferAccounts?: {
|
|
473
|
+
group?: PublicKey;
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
interface MakeBorrowIxOpts {
|
|
477
|
+
observationBanksOverride?: PublicKey[];
|
|
478
|
+
wrapAndUnwrapSol?: boolean;
|
|
479
|
+
createAtas?: boolean;
|
|
480
|
+
overrideInferAccounts?: {
|
|
481
|
+
group?: PublicKey;
|
|
482
|
+
authority?: PublicKey;
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
interface MakeBorrowWithSessionIxOpts extends MakeBorrowIxOpts {
|
|
486
|
+
overrideInferAccounts?: {
|
|
487
|
+
group?: PublicKey;
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
declare function isWeightedPrice(reqType: LendrRequirementType): boolean;
|
|
491
|
+
|
|
492
|
+
interface LoopProps extends LoopTxProps {
|
|
493
|
+
processOpts?: ProcessTransactionsClientOpts;
|
|
494
|
+
txOpts?: TransactionOptions;
|
|
495
|
+
}
|
|
496
|
+
type LoopTxProps = {
|
|
497
|
+
/** Amount to deposit */
|
|
498
|
+
depositAmount: Amount;
|
|
499
|
+
/** Amount to borrow */
|
|
500
|
+
borrowAmount: Amount;
|
|
501
|
+
/** Bank address to deposit into */
|
|
502
|
+
depositBankAddress: PublicKey;
|
|
503
|
+
/** Bank address to borrow from */
|
|
504
|
+
borrowBankAddress: PublicKey;
|
|
505
|
+
/** Swap configuration */
|
|
506
|
+
swap: {
|
|
507
|
+
/** Instructions for swapping borrowed amount */
|
|
508
|
+
instructions: TransactionInstruction[];
|
|
509
|
+
/** Address lookup tables needed for swap instructions */
|
|
510
|
+
lookupTables: AddressLookupTableAccount[];
|
|
511
|
+
};
|
|
512
|
+
/** Optional recent blockhash */
|
|
513
|
+
blockhash?: string;
|
|
514
|
+
/** The amount the user entered to deposit before applying leverage */
|
|
515
|
+
inputDepositAmount?: Amount;
|
|
516
|
+
/** Optional setup banks addresses */
|
|
517
|
+
setupBankAddresses?: PublicKey[];
|
|
518
|
+
/**
|
|
519
|
+
* Optional override for inferred accounts in the transaction instructions.
|
|
520
|
+
* The group and authority public keys can be overridden if the user has
|
|
521
|
+
* custom configuration.
|
|
522
|
+
*/
|
|
523
|
+
overrideInferAccounts?: {
|
|
524
|
+
/**
|
|
525
|
+
* Group public key to use instead of the one inferred from the account
|
|
526
|
+
* type.
|
|
527
|
+
*/
|
|
528
|
+
group?: PublicKey;
|
|
529
|
+
/**
|
|
530
|
+
* Authority public key to use instead of the one inferred from the account
|
|
531
|
+
* type.
|
|
532
|
+
*/
|
|
533
|
+
authority?: PublicKey;
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
interface RepayWithCollateralProps extends RepayWithCollateralTxProps {
|
|
537
|
+
processOpts?: ProcessTransactionsClientOpts;
|
|
538
|
+
txOpts?: TransactionOptions;
|
|
539
|
+
}
|
|
540
|
+
type RepayWithCollateralTxProps = {
|
|
541
|
+
/** Amount to repay */
|
|
542
|
+
repayAmount: Amount;
|
|
543
|
+
/** Amount of collateral to withdraw */
|
|
544
|
+
withdrawAmount: Amount;
|
|
545
|
+
/** Bank address where the loan is being repaid */
|
|
546
|
+
borrowBankAddress: PublicKey;
|
|
547
|
+
/** Bank address where collateral is being withdrawn from */
|
|
548
|
+
depositBankAddress: PublicKey;
|
|
549
|
+
/** Whether to withdraw all collateral from deposit bank */
|
|
550
|
+
withdrawAll?: boolean;
|
|
551
|
+
/** Whether to repay entire loan amount */
|
|
552
|
+
repayAll?: boolean;
|
|
553
|
+
/** Swap configuration */
|
|
554
|
+
swap: {
|
|
555
|
+
instructions: TransactionInstruction[];
|
|
556
|
+
lookupTables: AddressLookupTableAccount[];
|
|
557
|
+
};
|
|
558
|
+
/** Optional recent blockhash */
|
|
559
|
+
blockhash?: string;
|
|
560
|
+
/**
|
|
561
|
+
* @deprecated This property is no longer supported.
|
|
562
|
+
*/
|
|
563
|
+
withdrawOpts?: MakeWithdrawIxOpts;
|
|
564
|
+
/**
|
|
565
|
+
* @deprecated This property is no longer supported.
|
|
566
|
+
*/
|
|
567
|
+
repayOpts?: MakeRepayIxOpts;
|
|
568
|
+
};
|
|
569
|
+
interface TransactionBuilderResult {
|
|
570
|
+
transactions: SolanaTransaction[];
|
|
571
|
+
actionTxIndex: number;
|
|
572
|
+
}
|
|
573
|
+
interface FlashloanActionResult extends TransactionBuilderResult {
|
|
574
|
+
/** Whether transaction size exceeds limits */
|
|
575
|
+
txOverflown: boolean;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
declare class LendrGroup implements LendrGroupType {
|
|
579
|
+
address: PublicKey;
|
|
580
|
+
admin: PublicKey;
|
|
581
|
+
constructor(admin: PublicKey, address: PublicKey);
|
|
582
|
+
static fromAccountParsed(address: PublicKey, accountData: LendrGroupRaw): LendrGroup;
|
|
583
|
+
static fromBuffer(address: PublicKey, rawData: Buffer, idl: LendrIdlType): LendrGroup;
|
|
584
|
+
static decode(encoded: Buffer, idl: LendrIdlType): LendrGroupRaw;
|
|
585
|
+
static encode(decoded: LendrGroupRaw, idl: LendrIdlType): Promise<Buffer>;
|
|
586
|
+
makePoolConfigureBankIx(program: LendrProgram, bank: PublicKey, args: BankConfigOptRaw): Promise<InstructionsWrapper>;
|
|
587
|
+
makeAddPermissionlessStakedBankIx(program: LendrProgram, voteAccountAddress: PublicKey, feePayer: PublicKey, pythOracle: PublicKey): Promise<InstructionsWrapper>;
|
|
588
|
+
makePoolAddBankIx(program: LendrProgram, bankPubkey: PublicKey, bankMint: PublicKey, bankConfig: BankConfigOpt, feePayer?: PublicKey): Promise<InstructionsWrapper>;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
interface SimulationResult {
|
|
592
|
+
banks: Map<string, Bank>;
|
|
593
|
+
lendrAccount: LendrAccountWrapper;
|
|
594
|
+
}
|
|
595
|
+
interface FlashLoanArgs {
|
|
596
|
+
ixs: TransactionInstruction[];
|
|
597
|
+
signers?: Signer[];
|
|
598
|
+
addressLookupTableAccounts?: AddressLookupTableAccount[];
|
|
599
|
+
blockhash?: string;
|
|
600
|
+
}
|
|
601
|
+
declare class LendrAccountWrapper {
|
|
602
|
+
readonly client: LendrClient;
|
|
603
|
+
readonly address: PublicKey;
|
|
604
|
+
private _lendrAccount;
|
|
605
|
+
/**
|
|
606
|
+
* @internal
|
|
607
|
+
*/
|
|
608
|
+
constructor(lendrAccountPk: PublicKey, client: LendrClient, lendrAccount: LendrAccount);
|
|
609
|
+
static fetch(lendrAccountPk: Address, client: LendrClient, commitment?: Commitment): Promise<LendrAccountWrapper>;
|
|
610
|
+
static fromAccountParsed(lendrAccountPk: Address, client: LendrClient, accountData: LendrAccountRaw): LendrAccountWrapper;
|
|
611
|
+
static fromAccountDataRaw(lendrAccountPk: PublicKey, client: LendrClient, lendrAccountRawData: Buffer, idl: LendrIdlType): LendrAccountWrapper;
|
|
612
|
+
get authority(): PublicKey;
|
|
613
|
+
get group(): LendrGroup;
|
|
614
|
+
get balances(): Balance[];
|
|
615
|
+
get data(): LendrAccount;
|
|
616
|
+
get pureAccount(): LendrAccount;
|
|
617
|
+
/** @internal */
|
|
618
|
+
private get _program();
|
|
619
|
+
/** @internal */
|
|
620
|
+
private get _config();
|
|
621
|
+
get activeBalances(): Balance[];
|
|
622
|
+
get isDisabled(): boolean;
|
|
623
|
+
get isFlashLoanEnabled(): boolean;
|
|
624
|
+
get isTransferAccountAuthorityEnabled(): boolean;
|
|
625
|
+
getBalance(bankPk: PublicKey): Balance;
|
|
626
|
+
simulateHealthCache(): Promise<LendrAccountWrapper>;
|
|
627
|
+
canBeLiquidated(): boolean;
|
|
628
|
+
computeHealthComponents(lendrRequirement: LendrRequirementType): {
|
|
629
|
+
assets: BigNumber;
|
|
630
|
+
liabilities: BigNumber;
|
|
631
|
+
};
|
|
632
|
+
computeHealthComponentsLegacy(lendrRequirement: LendrRequirementType, excludedBanks?: PublicKey[]): {
|
|
633
|
+
assets: BigNumber;
|
|
634
|
+
liabilities: BigNumber;
|
|
635
|
+
};
|
|
636
|
+
computeHealthComponentsWithoutBiasLegacy(lendrRequirement: LendrRequirementType): {
|
|
637
|
+
assets: BigNumber;
|
|
638
|
+
liabilities: BigNumber;
|
|
639
|
+
};
|
|
640
|
+
computeFreeCollateral(opts?: {
|
|
641
|
+
clamped?: boolean;
|
|
642
|
+
}): BigNumber;
|
|
643
|
+
computeFreeCollateralLegacy(opts?: {
|
|
644
|
+
clamped?: boolean;
|
|
645
|
+
}): BigNumber;
|
|
646
|
+
computeAccountValue(): BigNumber;
|
|
647
|
+
computeActiveEmodePairs(emodePairs: EmodePair[]): EmodePair[];
|
|
648
|
+
computeEmodeImpacts(emodePairs: EmodePair[]): Record<string, ActionEmodeImpact>;
|
|
649
|
+
computeMaxBorrowForBank(bankAddress: PublicKey, opts?: {
|
|
650
|
+
volatilityFactor?: number;
|
|
651
|
+
emodeWeights?: {
|
|
652
|
+
assetWeightMaint: BigNumber;
|
|
653
|
+
assetWeightInit: BigNumber;
|
|
654
|
+
collateralTags: EmodeTag[];
|
|
655
|
+
};
|
|
656
|
+
}): BigNumber;
|
|
657
|
+
computeMaxWithdrawForBank(bankAddress: PublicKey, opts?: {
|
|
658
|
+
volatilityFactor?: number;
|
|
659
|
+
}): BigNumber;
|
|
660
|
+
computeMaxLiquidatableAssetAmount(assetBankAddress: PublicKey, liabilityBankAddress: PublicKey): BigNumber;
|
|
661
|
+
computeLiquidationPriceForBank(bankAddress: PublicKey): number | null;
|
|
662
|
+
computeLiquidationPriceForBankAmount(bankAddress: PublicKey, isLending: boolean, amount: number): number | null;
|
|
663
|
+
computeNetApy(): number;
|
|
664
|
+
/** Todo move this into client */
|
|
665
|
+
computeLoopingParams(principal: Amount, targetLeverage: number, depositBankAddress: PublicKey, borrowBankAddress: PublicKey): {
|
|
666
|
+
borrowAmount: BigNumber;
|
|
667
|
+
totalDepositAmount: BigNumber;
|
|
668
|
+
};
|
|
669
|
+
makeComputeBudgetIx(): TransactionInstruction[];
|
|
670
|
+
makeSetupIx(banks: PublicKey[]): Promise<TransactionInstruction[]>;
|
|
671
|
+
/**
|
|
672
|
+
* Moves a position from one lendr account to another by withdrawing from source account and depositing to destination account.
|
|
673
|
+
*
|
|
674
|
+
* @param amount - The amount of tokens to move, can be a number or Amount object
|
|
675
|
+
* @param bankAddress - The public key of the bank to move position from/to
|
|
676
|
+
* @param destinationAccount - The lendr account to move the position to
|
|
677
|
+
* @param processOpts - Optional transaction processing configuration
|
|
678
|
+
* @param txOpts - Optional transaction options
|
|
679
|
+
* @returns Array of transaction signatures - includes signatures for any required oracle feed updates, withdraw transaction, and deposit transaction
|
|
680
|
+
*/
|
|
681
|
+
movePosition(amount: Amount, bankAddress: PublicKey, destinationAccountPk: PublicKey, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature[]>;
|
|
682
|
+
/**
|
|
683
|
+
* Creates transactions for moving a position from one lendr account to another.
|
|
684
|
+
*
|
|
685
|
+
* @param amount - The amount of tokens to move, can be a number or Amount object
|
|
686
|
+
* @param bankAddress - The public key of the bank to move position from/to
|
|
687
|
+
* @param destinationAccount - The lendr account to move the position to
|
|
688
|
+
* @returns Object containing feed crank transactions, withdraw transaction, and deposit transaction
|
|
689
|
+
*/
|
|
690
|
+
makeMovePositionTx(amount: Amount, bankAddress: PublicKey, destinationAccountPk: PublicKey): Promise<TransactionBuilderResult>;
|
|
691
|
+
/**
|
|
692
|
+
* Repays a loan using collateral from another bank by:
|
|
693
|
+
* 1. Withdrawing collateral from one bank
|
|
694
|
+
* 2. Swapping it to the repayment asset
|
|
695
|
+
* 3. Repaying the loan in another bank
|
|
696
|
+
*
|
|
697
|
+
* @param {RepayWithCollateralProps} props - Parameters for the repay with collateral transaction
|
|
698
|
+
* @param {Amount} props.repayAmount - Amount to repay
|
|
699
|
+
* @param {Amount} props.withdrawAmount - Amount of collateral to withdraw
|
|
700
|
+
* @param {PublicKey} props.borrowBankAddress - Bank address where the loan is being repaid
|
|
701
|
+
* @param {PublicKey} props.depositBankAddress - Bank address where collateral is being withdrawn from
|
|
702
|
+
* @param {boolean} [props.withdrawAll=false] - Whether to withdraw all collateral from deposit bank
|
|
703
|
+
* @param {boolean} [props.repayAll=false] - Whether to repay entire loan amount
|
|
704
|
+
* @param {Object} props.swap - Swap configuration with instructions and lookup tables
|
|
705
|
+
* @param {ProcessTransactionsClientOpts} [props.processOpts] - Optional transaction processing configuration
|
|
706
|
+
* @param {TransactionOptions} [props.txOpts] - Optional transaction options
|
|
707
|
+
* @returns {Promise<TransactionSignature[]>} Array of transaction signatures
|
|
708
|
+
*/
|
|
709
|
+
repayWithCollatV2(props: RepayWithCollateralProps): Promise<TransactionSignature[]>;
|
|
710
|
+
/**
|
|
711
|
+
* Creates a transaction to repay a loan using collateral by:
|
|
712
|
+
* 1. Withdrawing collateral from one bank
|
|
713
|
+
* 2. Swapping it to the repayment asset
|
|
714
|
+
* 3. Repaying the loan in another bank
|
|
715
|
+
*
|
|
716
|
+
* @param {RepayWithCollateralProps} params - Parameters for the repay with collateral transaction
|
|
717
|
+
* @param {Amount} params.repayAmount - Amount to repay
|
|
718
|
+
* @param {Amount} params.withdrawAmount - Amount of collateral to withdraw
|
|
719
|
+
* @param {PublicKey} params.borrowBankAddress - Bank address where the loan is being repaid
|
|
720
|
+
* @param {PublicKey} params.depositBankAddress - Bank address where collateral is being withdrawn from
|
|
721
|
+
* @param {boolean} [params.withdrawAll=false] - Whether to withdraw all collateral from deposit bank
|
|
722
|
+
* @param {boolean} [params.repayAll=false] - Whether to repay entire loan amount
|
|
723
|
+
* @param {Object} params.swap - Swap configuration with instructions and lookup tables
|
|
724
|
+
* @param {string} [params.blockhash] - Optional recent blockhash
|
|
725
|
+
* @param {MakeWithdrawIxOpts} [params.withdrawOpts] - Optional withdraw configuration
|
|
726
|
+
* @param {MakeRepayIxOpts} [params.repayOpts] - Optional repay configuration
|
|
727
|
+
* @returns {Promise<RepayWithCollateralResult>} Result containing feed crank and flashloan transactions
|
|
728
|
+
*/
|
|
729
|
+
makeRepayWithCollatTxV2({ repayAmount, withdrawAmount, borrowBankAddress, depositBankAddress, withdrawAll, repayAll, swap, blockhash: blockhashArg, }: RepayWithCollateralProps): Promise<FlashloanActionResult>;
|
|
730
|
+
loopV2(props: LoopProps): Promise<TransactionSignature[]>;
|
|
731
|
+
makeLoopTxV2({ depositAmount, inputDepositAmount, borrowAmount, depositBankAddress, borrowBankAddress, swap, blockhash: blockhashArg, setupBankAddresses, overrideInferAccounts, }: LoopTxProps): Promise<FlashloanActionResult>;
|
|
732
|
+
/**
|
|
733
|
+
* Creates instructions for closing a lendr account.
|
|
734
|
+
* The account must have no active positions or balances to be closed.
|
|
735
|
+
* Closing an account will return any remaining SOL to the fee payer.
|
|
736
|
+
*
|
|
737
|
+
* @returns An InstructionsWrapper containing the close account instruction
|
|
738
|
+
*/
|
|
739
|
+
makeCloseAccountIx(): Promise<InstructionsWrapper>;
|
|
740
|
+
/**
|
|
741
|
+
* Closes a lendr account. The account must have no active positions or balances to be closed.
|
|
742
|
+
* Closing an account will return any remaining SOL to the fee payer.
|
|
743
|
+
*
|
|
744
|
+
* @param processOpts - Optional transaction processing configuration
|
|
745
|
+
* @param txOpts - Optional transaction options
|
|
746
|
+
* @returns The transaction signature of the close account operation
|
|
747
|
+
*/
|
|
748
|
+
closeAccount(processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
749
|
+
/**
|
|
750
|
+
* Creates a transaction for closing a lendr account.
|
|
751
|
+
* The account must have no active positions or balances to be closed.
|
|
752
|
+
*
|
|
753
|
+
* @returns A transaction configured to close the lendr account
|
|
754
|
+
*/
|
|
755
|
+
makeCloseAccountTx(): Promise<ExtendedTransaction>;
|
|
756
|
+
/**
|
|
757
|
+
* Creates instructions for depositing tokens into a lendr bank account.
|
|
758
|
+
*
|
|
759
|
+
* @param amount - The amount of tokens to deposit, can be a number or Amount object
|
|
760
|
+
* @param bankAddress - The public key of the bank to deposit into
|
|
761
|
+
* @param depositOpts - Optional deposit configuration parameters
|
|
762
|
+
* @returns An InstructionsWrapper containing the deposit instructions
|
|
763
|
+
*/
|
|
764
|
+
makeDepositIx(amount: Amount, bankAddress: PublicKey, depositOpts?: MakeDepositIxOpts): Promise<InstructionsWrapper>;
|
|
765
|
+
makeDepositWithSessionIx(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, depositOpts?: MakeDepositWithSessionIxOpts): Promise<InstructionsWrapper>;
|
|
766
|
+
/**
|
|
767
|
+
* Creates a transaction for depositing native stake into a lendr staked asset bank account.
|
|
768
|
+
* - Split stake account if required
|
|
769
|
+
* - Authorize stake account to single spl pool pogram
|
|
770
|
+
* - Deposit stake into pool for LST
|
|
771
|
+
* - Deposit LST into lendr bank
|
|
772
|
+
*
|
|
773
|
+
* @param amount - The amount of tokens to deposit, can be a number or Amount object
|
|
774
|
+
* @param bankAddress - The public key of the bank to deposit into
|
|
775
|
+
* @param stakeAccountPk - The public key of the stake account to delegate
|
|
776
|
+
* @param validator - The public key of the validator to delegate to
|
|
777
|
+
* @param depositOpts - Optional deposit configuration parameters
|
|
778
|
+
* @returns A transaction object ready to be signed and sent
|
|
779
|
+
*/
|
|
780
|
+
makeDepositStakedTx(amount: Amount, bankAddress: PublicKey, stakeAccountPk: PublicKey, validator: PublicKey, depositOpts?: MakeDepositIxOpts): Promise<ExtendedTransaction>;
|
|
781
|
+
makeMergeStakeAccountsTx(stakeAccountSrc: PublicKey, stakeAccountDest: PublicKey): Promise<ExtendedTransaction>;
|
|
782
|
+
/**
|
|
783
|
+
* Deposits tokens into a lendr bank account.
|
|
784
|
+
*
|
|
785
|
+
* @param amount - The amount of tokens to deposit, can be a number or Amount object
|
|
786
|
+
* @param bankAddress - The public key of the bank to deposit into
|
|
787
|
+
* @param depositOpts - Optional deposit configuration parameters
|
|
788
|
+
* @param processOpts - Optional transaction processing configuration
|
|
789
|
+
* @param txOpts - Optional transaction options
|
|
790
|
+
* @returns The transaction signature of the deposit
|
|
791
|
+
*/
|
|
792
|
+
deposit(amount: Amount, bankAddress: PublicKey, depositOpts?: MakeDepositIxOpts, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
793
|
+
depositWithSession(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, depositOpts?: MakeDepositWithSessionIxOpts): Promise<TransactionResult>;
|
|
794
|
+
/**
|
|
795
|
+
* Creates a transaction for depositing tokens into a lendr bank account.
|
|
796
|
+
*
|
|
797
|
+
* @param amount - The amount of tokens to deposit, can be a number or Amount object
|
|
798
|
+
* @param bankAddress - The public key of the bank to deposit into
|
|
799
|
+
* @param depositOpts - Optional deposit configuration parameters
|
|
800
|
+
* @returns A transaction object ready to be signed and sent
|
|
801
|
+
*/
|
|
802
|
+
makeDepositTx(amount: Amount, bankAddress: PublicKey, depositOpts?: MakeDepositIxOpts): Promise<ExtendedTransaction>;
|
|
803
|
+
makeDepositWithSessionTx(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, depositOpts?: MakeDepositWithSessionIxOpts): Promise<ExtendedTransaction>;
|
|
804
|
+
/**
|
|
805
|
+
* Simulates a lendr transaction to preview its effects.
|
|
806
|
+
*
|
|
807
|
+
* @param txs - Array of transactions to simulate, can be either VersionedTransaction or Transaction
|
|
808
|
+
* @param bankAddress - The public key of the bank to inspect
|
|
809
|
+
* @param additionalAccountsToInspect - Optional array of additional account public keys to inspect during simulation
|
|
810
|
+
* @returns A SimulationResult containing the preview state of both the lendr account and bank
|
|
811
|
+
* @throws Will throw an error if simulation fails
|
|
812
|
+
*/
|
|
813
|
+
simulateBorrowLendTransaction(txs: (VersionedTransaction | Transaction)[], banksToInspect: PublicKey[], healthSimOptions?: {
|
|
814
|
+
enabled: boolean;
|
|
815
|
+
mandatoryBanks: PublicKey[];
|
|
816
|
+
excludedBanks: PublicKey[];
|
|
817
|
+
}): Promise<SimulationResult>;
|
|
818
|
+
/**
|
|
819
|
+
* Creates a transaction instruction for repaying a loan.
|
|
820
|
+
*
|
|
821
|
+
* @param amount - The amount to repay, can be a number or Amount object
|
|
822
|
+
* @param bankAddress - The public key of the bank to repay to
|
|
823
|
+
* @param repayAll - Whether to repay the entire loan balance, defaults to false
|
|
824
|
+
* @param repayOpts - Optional parameters for the repay instruction
|
|
825
|
+
* @returns An InstructionsWrapper containing the deposit instructions
|
|
826
|
+
* @throws Will throw an error if the repay mint is not found
|
|
827
|
+
*/
|
|
828
|
+
makeRepayIx(amount: Amount, bankAddress: PublicKey, repayAll?: boolean, repayOpts?: MakeRepayIxOpts): Promise<InstructionsWrapper>;
|
|
829
|
+
/**
|
|
830
|
+
* Creates a transaction instruction for repaying a loan.
|
|
831
|
+
*
|
|
832
|
+
* @param amount - The amount to repay, can be a number or Amount object
|
|
833
|
+
* @param bankAddress - The public key of the bank to repay to
|
|
834
|
+
* @param sessionKey - The session key of the logged in user (with session)
|
|
835
|
+
* @param repayAll - Whether to repay the entire loan balance, defaults to false
|
|
836
|
+
* @param repayOpts - Optional parameters for the repay instruction
|
|
837
|
+
* @returns An InstructionsWrapper containing the deposit instructions
|
|
838
|
+
* @throws Will throw an error if the repay mint is not found
|
|
839
|
+
*/
|
|
840
|
+
makeRepayWithSessionIx(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, repayAll?: boolean, repayOpts?: MakeRepayWithSessionIxOpts): Promise<InstructionsWrapper>;
|
|
841
|
+
/**
|
|
842
|
+
* Repays a loan in a lendr bank account.
|
|
843
|
+
*
|
|
844
|
+
* @param amount - The amount to repay, can be a number or Amount object
|
|
845
|
+
* @param bankAddress - The public key of the bank to repay to
|
|
846
|
+
* @param repayAll - Whether to repay the entire loan balance, defaults to false
|
|
847
|
+
* @param repayOpts - Optional parameters for the repay instruction
|
|
848
|
+
* @param processOpts - Optional transaction processing configuration
|
|
849
|
+
* @param txOpts - Optional transaction options
|
|
850
|
+
* @returns The transaction signature of the repayment
|
|
851
|
+
*/
|
|
852
|
+
repay(amount: Amount, bankAddress: PublicKey, repayAll?: boolean, repayOpts?: MakeRepayIxOpts, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
853
|
+
/**
|
|
854
|
+
* Repays a loan in a lendr bank account.
|
|
855
|
+
*
|
|
856
|
+
* @param amount - The amount to repay, can be a number or Amount object
|
|
857
|
+
* @param bankAddress - The public key of the bank to repay to
|
|
858
|
+
* @param session: Session object in Established state (o.w. sendTransaction method won't work!)
|
|
859
|
+
* @param repayAll - Whether to repay the entire loan balance, defaults to false
|
|
860
|
+
* @param repayOpts - Optional parameters for the repay instruction
|
|
861
|
+
* @returns The transaction signature of the repayment
|
|
862
|
+
*/
|
|
863
|
+
repayWithSession(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, repayAll?: boolean, repayOpts?: MakeRepayWithSessionIxOpts): Promise<TransactionResult>;
|
|
864
|
+
/**
|
|
865
|
+
* Creates a transaction for repaying a loan in a lendr bank account.
|
|
866
|
+
*
|
|
867
|
+
* @param amount - The amount to repay, can be a number or Amount object
|
|
868
|
+
* @param bankAddress - The public key of the bank to repay to
|
|
869
|
+
* @param repayAll - Whether to repay the entire loan balance, defaults to false
|
|
870
|
+
* @param repayOpts - Optional parameters for the repay instruction
|
|
871
|
+
* @returns A transaction object containing the repay instructions
|
|
872
|
+
*/
|
|
873
|
+
makeRepayTx(amount: Amount, bankAddress: PublicKey, repayAll?: boolean, repayOpts?: MakeRepayIxOpts): Promise<ExtendedTransaction>;
|
|
874
|
+
/**
|
|
875
|
+
* Creates a transaction for repaying a loan in a lendr bank account.
|
|
876
|
+
*
|
|
877
|
+
* @param amount - The amount to repay, can be a number or Amount object
|
|
878
|
+
* @param bankAddress - The public key of the bank to repay to
|
|
879
|
+
* @param repayAll - Whether to repay the entire loan balance, defaults to false
|
|
880
|
+
* @param repayOpts - Optional parameters for the repay instruction
|
|
881
|
+
* @returns A transaction object containing the repay instructions
|
|
882
|
+
*/
|
|
883
|
+
makeRepayWithSessionTx(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, repayAll?: boolean, repayOpts?: MakeRepayWithSessionIxOpts): Promise<ExtendedTransaction>;
|
|
884
|
+
/**
|
|
885
|
+
* Creates instructions for withdrawing tokens from a lendr bank account.
|
|
886
|
+
*
|
|
887
|
+
* @param amount - The amount of tokens to withdraw, can be a number or Amount object
|
|
888
|
+
* @param bankAddress - The public key of the bank to withdraw from
|
|
889
|
+
* @param withdrawAll - Whether to withdraw the entire balance, defaults to false
|
|
890
|
+
* @param withdrawOpts - Optional parameters for the withdraw instruction
|
|
891
|
+
* @returns An InstructionsWrapper containing the withdraw instructions and signers
|
|
892
|
+
* @throws Will throw an error if the withdraw mint is not found
|
|
893
|
+
*/
|
|
894
|
+
makeWithdrawIx(amount: Amount, bankAddress: PublicKey, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawIxOpts): Promise<InstructionsWrapper>;
|
|
895
|
+
/**
|
|
896
|
+
* Creates instructions for withdrawing tokens from a lendr bank account.
|
|
897
|
+
*
|
|
898
|
+
* @param amount - The amount of tokens to withdraw, can be a number or Amount object
|
|
899
|
+
* @param bankAddress - The public key of the bank to withdraw from
|
|
900
|
+
* @param session - User's logged in session object in Established state.
|
|
901
|
+
* @param withdrawAll - Whether to withdraw the entire balance, defaults to false
|
|
902
|
+
* @param withdrawOpts - Optional parameters for the withdraw instruction
|
|
903
|
+
* @returns An InstructionsWrapper containing the withdraw instructions and signers
|
|
904
|
+
* @throws Will throw an error if the withdraw mint is not found
|
|
905
|
+
*/
|
|
906
|
+
makeWithdrawWithSessionIx(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawWithSessionIxOpts): Promise<InstructionsWrapper>;
|
|
907
|
+
/**
|
|
908
|
+
* Creates a transaction for withdrawing tokens from a lendr bank account and staking them.
|
|
909
|
+
* - Withdraw from lendr bank
|
|
910
|
+
* - Create stake account
|
|
911
|
+
* - Approve mint authority to burn tokens
|
|
912
|
+
* - Delegate stake account
|
|
913
|
+
*
|
|
914
|
+
* @param amount - The amount of tokens to withdraw, can be a number or Amount object
|
|
915
|
+
* @param bankAddress - The public key of the bank to withdraw from
|
|
916
|
+
* @param isWholePosition - Whether to withdraw the entire position, defaults to false
|
|
917
|
+
* @returns A transaction object ready to be signed and sent
|
|
918
|
+
*/
|
|
919
|
+
makeWithdrawStakedTx(amount: Amount, bankAddress: PublicKey, isWholePosition: boolean): Promise<TransactionBuilderResult>;
|
|
920
|
+
/**
|
|
921
|
+
* Creates a transaction for withdrawing all tokens from multiple lendr banks.
|
|
922
|
+
*
|
|
923
|
+
* @param banks - Array of objects containing amount and bank address for each withdrawal
|
|
924
|
+
* @param withdrawOpts - Optional parameters for the withdraw instructions
|
|
925
|
+
* @returns A transaction object ready to be signed and sent
|
|
926
|
+
*/
|
|
927
|
+
makeWithdrawAllTx(banks: {
|
|
928
|
+
amount: Amount;
|
|
929
|
+
bankAddress: PublicKey;
|
|
930
|
+
}[], withdrawOpts?: MakeWithdrawIxOpts): Promise<ExtendedTransaction>;
|
|
931
|
+
/**
|
|
932
|
+
* Creates a transaction for withdrawing all tokens from multiple lendr banks.
|
|
933
|
+
*
|
|
934
|
+
* @param banks - Array of objects containing amount and bank address for each withdrawal
|
|
935
|
+
* @param session - user session object (in Established state)
|
|
936
|
+
* @param withdrawOpts - Optional parameters for the withdraw instructions
|
|
937
|
+
* @returns A transaction object ready to be signed and sent
|
|
938
|
+
*/
|
|
939
|
+
makeWithdrawAllWithSessionTx(banks: {
|
|
940
|
+
amount: Amount;
|
|
941
|
+
bankAddress: PublicKey;
|
|
942
|
+
}[], session: EstablishedSessionState, withdrawOpts?: MakeWithdrawWithSessionIxOpts): Promise<ExtendedTransaction>;
|
|
943
|
+
finalizeWithdrawAllTransaction(withdrawIxsWrapped: InstructionsWrapper[]): Promise<Transaction & ExtendedTransactionProperties>;
|
|
944
|
+
/**
|
|
945
|
+
* Withdraws tokens from a lendr bank account.
|
|
946
|
+
*
|
|
947
|
+
* @param amount - The amount of tokens to withdraw, can be a number or Amount object
|
|
948
|
+
* @param bankAddress - The public key of the bank to withdraw from
|
|
949
|
+
* @param withdrawAll - If true, withdraws entire balance from the bank
|
|
950
|
+
* @param withdrawOpts - Optional withdraw configuration parameters
|
|
951
|
+
* @param processOpts - Optional transaction processing configuration
|
|
952
|
+
* @param txOpts - Optional transaction options
|
|
953
|
+
* @returns Array of transaction signatures - includes signatures for any required oracle feed updates followed by the withdraw transaction
|
|
954
|
+
*/
|
|
955
|
+
withdraw(amount: Amount, bankAddress: PublicKey, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawIxOpts, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature[]>;
|
|
956
|
+
/**
|
|
957
|
+
* Withdraws tokens from a lendr bank account.
|
|
958
|
+
*
|
|
959
|
+
* @param amount - The amount of tokens to withdraw, can be a number or Amount object
|
|
960
|
+
* @param bankAddress - The public key of the bank to withdraw from
|
|
961
|
+
* @param withdrawAll - If true, withdraws entire balance from the bank
|
|
962
|
+
* @param withdrawOpts - Optional withdraw configuration parameters
|
|
963
|
+
* @returns Array of transaction signatures - includes signatures for any required oracle feed updates followed by the withdraw transaction
|
|
964
|
+
*/
|
|
965
|
+
withdrawWithSession(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawWithSessionIxOpts): Promise<TransactionResult>;
|
|
966
|
+
/**
|
|
967
|
+
* Creates a versioned transaction for withdrawing tokens from a lendr bank account.
|
|
968
|
+
*
|
|
969
|
+
* @param amount - The amount of tokens to withdraw, can be a number or Amount object
|
|
970
|
+
* @param bankAddress - The public key of the bank to withdraw from
|
|
971
|
+
* @param withdrawAll - If true, withdraws entire balance from the bank
|
|
972
|
+
* @param withdrawOpts - Optional withdraw configuration parameters
|
|
973
|
+
* @returns Object containing feed crank transactions and the withdraw transaction
|
|
974
|
+
*/
|
|
975
|
+
makeWithdrawTx(amount: Amount, bankAddress: PublicKey, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawIxOpts): Promise<TransactionBuilderResult>;
|
|
976
|
+
/**
|
|
977
|
+
* Creates a versioned transaction for withdrawing tokens from a lendr bank account.
|
|
978
|
+
*
|
|
979
|
+
* @param amount - The amount of tokens to withdraw, can be a number or Amount object
|
|
980
|
+
* @param bankAddress - The public key of the bank to withdraw from
|
|
981
|
+
* @param session - Logged in user session object in Established state.
|
|
982
|
+
* @param withdrawAll - If true, withdraws entire balance from the bank
|
|
983
|
+
* @param withdrawOpts - Optional withdraw configuration parameters
|
|
984
|
+
* @returns Object containing feed crank transactions and the withdraw transaction
|
|
985
|
+
*/
|
|
986
|
+
makeWithdrawWithSessionTx(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, withdrawAll?: boolean, withdrawOpts?: MakeWithdrawWithSessionIxOpts): Promise<{
|
|
987
|
+
transactions: ExtendedV0Transaction[];
|
|
988
|
+
instructions: TransactionInstruction[];
|
|
989
|
+
actionTxIndex: number;
|
|
990
|
+
}>;
|
|
991
|
+
/**
|
|
992
|
+
* Creates instructions for borrowing tokens from a lendr bank account.
|
|
993
|
+
*
|
|
994
|
+
* @param amount - The amount of tokens to borrow, can be a number or Amount object
|
|
995
|
+
* @param bankAddress - The public key of the bank to borrow from
|
|
996
|
+
* @param borrowOpts - Optional borrow configuration parameters
|
|
997
|
+
* @returns An InstructionsWrapper containing the borrow instructions
|
|
998
|
+
*/
|
|
999
|
+
makeBorrowIx(amount: Amount, bankAddress: PublicKey, borrowOpts?: MakeBorrowIxOpts): Promise<InstructionsWrapper>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Creates instructions for borrowing tokens from a lendr bank account.
|
|
1002
|
+
*
|
|
1003
|
+
* @param amount - The amount of tokens to borrow, can be a number or Amount object
|
|
1004
|
+
* @param bankAddress - The public key of the bank to borrow from
|
|
1005
|
+
* @param session
|
|
1006
|
+
* @param borrowOpts - Optional borrow configuration parameters
|
|
1007
|
+
* @returns An InstructionsWrapper containing the borrow instructions
|
|
1008
|
+
*/
|
|
1009
|
+
makeBorrowWithSessionIx(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, borrowOpts?: MakeBorrowWithSessionIxOpts): Promise<InstructionsWrapper>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Borrows tokens from a lendr bank account.
|
|
1012
|
+
*
|
|
1013
|
+
* @param amount - The amount of tokens to borrow, can be a number or Amount object
|
|
1014
|
+
* @param bankAddress - The public key of the bank to borrow from
|
|
1015
|
+
* @param borrowOpts - Optional borrow configuration parameters
|
|
1016
|
+
* @param processOpts - Optional transaction processing configuration
|
|
1017
|
+
* @param txOpts - Optional transaction configuration parameters
|
|
1018
|
+
* @returns Array of transaction signatures from the borrow operation
|
|
1019
|
+
*/
|
|
1020
|
+
borrow(amount: Amount, bankAddress: PublicKey, borrowOpts?: MakeBorrowIxOpts, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature[]>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Borrows tokens from a lendr bank account.
|
|
1023
|
+
*
|
|
1024
|
+
* @param amount - The amount of tokens to borrow, can be a number or Amount object
|
|
1025
|
+
* @param bankAddress - The public key of the bank to borrow from
|
|
1026
|
+
* @param session - Fogo session object in Established state.
|
|
1027
|
+
* @param borrowOpts - Optional borrow configuration parameters
|
|
1028
|
+
* @returns Array of transaction signatures from the borrow operation
|
|
1029
|
+
*/
|
|
1030
|
+
borrowWithSession(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, borrowOpts?: MakeBorrowWithSessionIxOpts): Promise<TransactionResult>;
|
|
1031
|
+
/**
|
|
1032
|
+
* Creates a versioned transaction for borrowing tokens from a lendr bank account.
|
|
1033
|
+
*
|
|
1034
|
+
* @param amount - The amount of tokens to borrow, can be a number or Amount object
|
|
1035
|
+
* @param bankAddress - The public key of the bank to borrow from
|
|
1036
|
+
* @param borrowOpts - Optional borrow configuration parameters
|
|
1037
|
+
* @returns Object containing feed crank transactions and the borrow transaction
|
|
1038
|
+
*/
|
|
1039
|
+
makeBorrowTx(amount: Amount, bankAddress: PublicKey, borrowOpts?: MakeBorrowIxOpts): Promise<TransactionBuilderResult>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Creates a versioned transaction for borrowing tokens from a lendr bank account.
|
|
1042
|
+
*
|
|
1043
|
+
* @param amount - The amount of tokens to borrow, can be a number or Amount object
|
|
1044
|
+
* @param bankAddress - The public key of the bank to borrow from
|
|
1045
|
+
* @param session
|
|
1046
|
+
* @param borrowOpts - Optional borrow configuration parameters
|
|
1047
|
+
* @returns Object containing feed crank transactions and the borrow transaction
|
|
1048
|
+
*/
|
|
1049
|
+
makeBorrowWithSessionTx(amount: Amount, bankAddress: PublicKey, session: EstablishedSessionState, borrowOpts?: MakeBorrowWithSessionIxOpts): Promise<{
|
|
1050
|
+
transactions: ExtendedV0Transaction[];
|
|
1051
|
+
instructions: TransactionInstruction[];
|
|
1052
|
+
actionTxIndex: number;
|
|
1053
|
+
}>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Creates instructions for withdrawing emissions rewards from a lendr bank account.
|
|
1056
|
+
*
|
|
1057
|
+
* @param bankAddress - The public key of the bank to withdraw emissions from
|
|
1058
|
+
* @returns An InstructionsWrapper containing the withdraw emissions instructions
|
|
1059
|
+
*/
|
|
1060
|
+
makeWithdrawEmissionsIx(bankAddress: PublicKey): Promise<InstructionsWrapper>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Creates a versioned transaction for withdrawing emissions rewards from multiple lendr bank accounts.
|
|
1063
|
+
*
|
|
1064
|
+
* @param bankAddresses - Array of public keys for the banks to withdraw emissions from
|
|
1065
|
+
* @returns A versioned transaction containing the withdraw emissions instructions
|
|
1066
|
+
*/
|
|
1067
|
+
makeWithdrawEmissionsTx(bankAddresses: PublicKey[]): Promise<ExtendedV0Transaction>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Withdraws emissions rewards from multiple lendr bank accounts.
|
|
1070
|
+
*
|
|
1071
|
+
* @param bankAddresses - Array of public keys for the banks to withdraw emissions from
|
|
1072
|
+
* @param processOpts - Optional processing options for the transaction
|
|
1073
|
+
* @param txOpts - Optional transaction options
|
|
1074
|
+
* @returns The transaction signature of the withdraw emissions transaction
|
|
1075
|
+
*/
|
|
1076
|
+
withdrawEmissions(bankAddresses: PublicKey[], processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
1077
|
+
/**
|
|
1078
|
+
* Creates an instruction wrapper for liquidating a lending account position.
|
|
1079
|
+
*
|
|
1080
|
+
* @param liquidateeLendrAccount - The lendr account to be liquidated
|
|
1081
|
+
* @param assetBankAddress - Public key of the bank containing the asset to receive in liquidation
|
|
1082
|
+
* @param assetQuantityUi - Amount of the asset to receive, in UI units
|
|
1083
|
+
* @param liabBankAddress - Public key of the bank containing the liability to repay
|
|
1084
|
+
* @returns An instruction wrapper containing the liquidation instructions
|
|
1085
|
+
*/
|
|
1086
|
+
makeLendingAccountLiquidateIx(liquidateeLendrAccount: LendrAccount, assetBankAddress: PublicKey, assetQuantityUi: Amount, liabBankAddress: PublicKey): Promise<InstructionsWrapper>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Liquidates a lending account position.
|
|
1089
|
+
*
|
|
1090
|
+
* @param liquidateeLendrAccount - The lendr account to be liquidated
|
|
1091
|
+
* @param assetBankAddress - Public key of the bank containing the asset to receive in liquidation
|
|
1092
|
+
* @param assetQuantityUi - Amount of the asset to receive, in UI units
|
|
1093
|
+
* @param liabBankAddress - Public key of the bank containing the liability to repay
|
|
1094
|
+
* @param processOpts - Optional processing options for the transaction
|
|
1095
|
+
* @param txOpts - Optional transaction options
|
|
1096
|
+
* @returns The transaction signature of the liquidation transaction
|
|
1097
|
+
*/
|
|
1098
|
+
lendingAccountLiquidate(liquidateeLendrAccount: LendrAccount, assetBankAddress: PublicKey, assetQuantityUi: Amount, liabBankAddress: PublicKey, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
1099
|
+
/**
|
|
1100
|
+
* Creates an instruction to begin a flash loan operation.
|
|
1101
|
+
*
|
|
1102
|
+
* @param endIndex - The index where the flash loan instructions end in the transaction
|
|
1103
|
+
* @returns An InstructionsWrapper containing the begin flash loan instruction
|
|
1104
|
+
*/
|
|
1105
|
+
makeBeginFlashLoanIx(endIndex: number): Promise<InstructionsWrapper>;
|
|
1106
|
+
/**
|
|
1107
|
+
* Creates an instruction to begin a flash loan operation.
|
|
1108
|
+
*
|
|
1109
|
+
* @param endIndex - The index where the flash loan instructions end in the transaction
|
|
1110
|
+
* @param session - established session state
|
|
1111
|
+
* @returns An InstructionsWrapper containing the begin flash loan instruction
|
|
1112
|
+
*/
|
|
1113
|
+
makeBeginFlashLoanWithSessionIx(endIndex: number, session: EstablishedSessionState): Promise<InstructionsWrapper>;
|
|
1114
|
+
/**
|
|
1115
|
+
* Creates an instruction to end a flash loan operation.
|
|
1116
|
+
*
|
|
1117
|
+
* @param projectedActiveBalances - Array of PublicKeys representing the projected active balance accounts after flash loan
|
|
1118
|
+
* @returns An InstructionsWrapper containing the end flash loan instruction
|
|
1119
|
+
*/
|
|
1120
|
+
makeEndFlashLoanIx(projectedActiveBalances: PublicKey[]): Promise<InstructionsWrapper>;
|
|
1121
|
+
/**
|
|
1122
|
+
* Creates an instruction to end a flash loan operation.
|
|
1123
|
+
*
|
|
1124
|
+
* @param projectedActiveBalances - Array of PublicKeys representing the projected active balance accounts after flash loan
|
|
1125
|
+
* @param session - established session state
|
|
1126
|
+
* @returns An InstructionsWrapper containing the end flash loan instruction
|
|
1127
|
+
*/
|
|
1128
|
+
makeEndFlashLoanWithSessionIx(projectedActiveBalances: PublicKey[], session: EstablishedSessionState): Promise<InstructionsWrapper>;
|
|
1129
|
+
flashLoan(args: FlashLoanArgs, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
1130
|
+
flashLoanWithSession(args: FlashLoanArgs, session: EstablishedSessionState): Promise<TransactionResult>;
|
|
1131
|
+
buildFlashLoanTx(args: FlashLoanArgs, lookupTables?: AddressLookupTableAccount[]): Promise<ExtendedV0Transaction>;
|
|
1132
|
+
buildFlashLoanWithSessionTx(args: FlashLoanArgs, session: EstablishedSessionState, lookupTables?: AddressLookupTableAccount[]): Promise<ExtendedV0Transaction>;
|
|
1133
|
+
makeTransferAccountAuthorityIx(newAccountAuthority: PublicKey): Promise<InstructionsWrapper>;
|
|
1134
|
+
transferAccountAuthority(newAccountAuthority: PublicKey, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<string>;
|
|
1135
|
+
makeUpdateFeedIx(newBanksPk: PublicKey[], txLandingBuffer?: number): Promise<{
|
|
1136
|
+
instructions: TransactionInstruction[];
|
|
1137
|
+
luts: AddressLookupTableAccount[];
|
|
1138
|
+
}>;
|
|
1139
|
+
makePulseHealthIx(mandatoryBanks?: PublicKey[], excludedBanks?: PublicKey[]): Promise<InstructionsWrapper>;
|
|
1140
|
+
private static fetchAccountData;
|
|
1141
|
+
static encode(decoded: LendrAccountRaw, idl: LendrIdlType): Promise<Buffer>;
|
|
1142
|
+
reload(): Promise<void>;
|
|
1143
|
+
private _updateFromAccountParsed;
|
|
1144
|
+
describe(): string;
|
|
1145
|
+
/**
|
|
1146
|
+
* @deprecated This method is deprecated. Please use simulateBorrowLendTransaction instead.
|
|
1147
|
+
*/
|
|
1148
|
+
simulateDeposit(amount: Amount, bankAddress: PublicKey): Promise<SimulationResult>;
|
|
1149
|
+
/**
|
|
1150
|
+
* @deprecated This method is deprecated. Please use simulateBorrowLendTransaction instead.
|
|
1151
|
+
*/
|
|
1152
|
+
simulateWithdraw(bankAddress: PublicKey, txs: VersionedTransaction[]): Promise<SimulationResult>;
|
|
1153
|
+
/**
|
|
1154
|
+
* @deprecated This method is deprecated. Please use simulateBorrowLendTransaction instead.
|
|
1155
|
+
*/
|
|
1156
|
+
simulateBorrow(bankAddress: PublicKey, txs: VersionedTransaction[]): Promise<SimulationResult>;
|
|
1157
|
+
/**
|
|
1158
|
+
* @deprecated This method is deprecated. Please use simulateBorrowLendTransaction instead.
|
|
1159
|
+
*/
|
|
1160
|
+
simulateRepay(amount: Amount, bankAddress: PublicKey, repayAll?: boolean): Promise<SimulationResult>;
|
|
1161
|
+
getBankUnclaimedOutstandingEmissions(bank: PublicKey): Promise<BigNumber>;
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* @deprecated This method is deprecated.
|
|
1165
|
+
*/
|
|
1166
|
+
declare function makeTxPriorityIx(feePayer: PublicKey, feeUi?: number, broadcastType?: TransactionBroadcastType, computeUnitsLimit?: number): {
|
|
1167
|
+
bundleTipIx: TransactionInstruction | undefined;
|
|
1168
|
+
priorityFeeIx: TransactionInstruction;
|
|
1169
|
+
};
|
|
1170
|
+
declare function makeBundleTipIx(feePayer: PublicKey, bundleTip?: number): TransactionInstruction;
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* An instruction with some extra information that will be used to build transactions.
|
|
1174
|
+
*/
|
|
1175
|
+
type InstructionWithEphemeralSigners = {
|
|
1176
|
+
/** The instruction */
|
|
1177
|
+
instruction: TransactionInstruction;
|
|
1178
|
+
/** The ephemeral signers that need to sign the transaction where this instruction will be */
|
|
1179
|
+
signers: Signer[];
|
|
1180
|
+
/** The compute units that this instruction requires, useful if greater than `DEFAULT_COMPUTE_BUDGET_UNITS` */
|
|
1181
|
+
computeUnits?: number;
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
declare enum RiskTier {
|
|
1185
|
+
Collateral = "Collateral",
|
|
1186
|
+
Isolated = "Isolated"
|
|
1187
|
+
}
|
|
1188
|
+
declare enum OperationalState {
|
|
1189
|
+
Paused = "Paused",
|
|
1190
|
+
Operational = "Operational",
|
|
1191
|
+
ReduceOnly = "ReduceOnly",
|
|
1192
|
+
KilledByBankruptcy = "KilledByBankruptcy"
|
|
1193
|
+
}
|
|
1194
|
+
interface RatePoint {
|
|
1195
|
+
util: number;
|
|
1196
|
+
rate: number;
|
|
1197
|
+
}
|
|
1198
|
+
interface InterestRateConfig {
|
|
1199
|
+
optimalUtilizationRate: BigNumber;
|
|
1200
|
+
plateauInterestRate: BigNumber;
|
|
1201
|
+
maxInterestRate: BigNumber;
|
|
1202
|
+
insuranceFeeFixedApr: BigNumber;
|
|
1203
|
+
insuranceIrFee: BigNumber;
|
|
1204
|
+
protocolFixedFeeApr: BigNumber;
|
|
1205
|
+
protocolIrFee: BigNumber;
|
|
1206
|
+
protocolOriginationFee: BigNumber;
|
|
1207
|
+
zeroUtilRate: number;
|
|
1208
|
+
hundredUtilRate: number;
|
|
1209
|
+
points: RatePoint[];
|
|
1210
|
+
curveType: number;
|
|
1211
|
+
}
|
|
1212
|
+
interface InterestRateConfigOpt extends Omit<InterestRateConfig, "optimalUtilizationRate" | "plateauInterestRate" | "maxInterestRate" | "curveType"> {
|
|
1213
|
+
}
|
|
1214
|
+
declare enum OracleSetup {
|
|
1215
|
+
None = "None",
|
|
1216
|
+
PythLegacy = "PythLegacy",
|
|
1217
|
+
SwitchboardV2 = "SwitchboardV2",
|
|
1218
|
+
PythPushOracle = "PythPushOracle",
|
|
1219
|
+
SwitchboardPull = "SwitchboardPull",
|
|
1220
|
+
StakedWithPythPush = "StakedWithPythPush",
|
|
1221
|
+
KaminoPythPush = "KaminoPythPush",
|
|
1222
|
+
KaminoSwitchboardPull = "KaminoSwitchboardPull",
|
|
1223
|
+
Fixed = "Fixed"
|
|
1224
|
+
}
|
|
1225
|
+
declare enum AssetTag {
|
|
1226
|
+
DEFAULT = 0,
|
|
1227
|
+
SOL = 1,
|
|
1228
|
+
STAKED = 2
|
|
1229
|
+
}
|
|
1230
|
+
declare enum BankConfigFlag {
|
|
1231
|
+
PYTH_MIGRATED = 1
|
|
1232
|
+
}
|
|
1233
|
+
interface BankConfigOpt {
|
|
1234
|
+
assetWeightInit: BigNumber | null;
|
|
1235
|
+
assetWeightMaint: BigNumber | null;
|
|
1236
|
+
liabilityWeightInit: BigNumber | null;
|
|
1237
|
+
liabilityWeightMaint: BigNumber | null;
|
|
1238
|
+
depositLimit: BigNumber | null;
|
|
1239
|
+
borrowLimit: BigNumber | null;
|
|
1240
|
+
interestRateConfig: InterestRateConfig | null;
|
|
1241
|
+
operationalState: OperationalState | null;
|
|
1242
|
+
riskTier: RiskTier | null;
|
|
1243
|
+
assetTag: AssetTag | null;
|
|
1244
|
+
totalAssetValueInitLimit: BigNumber | null;
|
|
1245
|
+
oracleMaxConfidence: number | null;
|
|
1246
|
+
oracleMaxAge: number | null;
|
|
1247
|
+
permissionlessBadDebtSettlement: boolean | null;
|
|
1248
|
+
freezeSettings: boolean | null;
|
|
1249
|
+
tokenlessRepaymentsAllowed: boolean | null;
|
|
1250
|
+
}
|
|
1251
|
+
interface BankConfigType {
|
|
1252
|
+
assetWeightInit: BigNumber;
|
|
1253
|
+
assetWeightMaint: BigNumber;
|
|
1254
|
+
liabilityWeightInit: BigNumber;
|
|
1255
|
+
liabilityWeightMaint: BigNumber;
|
|
1256
|
+
depositLimit: BigNumber;
|
|
1257
|
+
borrowLimit: BigNumber;
|
|
1258
|
+
riskTier: RiskTier;
|
|
1259
|
+
totalAssetValueInitLimit: BigNumber;
|
|
1260
|
+
assetTag: AssetTag;
|
|
1261
|
+
configFlags?: BankConfigFlag;
|
|
1262
|
+
interestRateConfig: InterestRateConfig;
|
|
1263
|
+
operationalState: OperationalState;
|
|
1264
|
+
oracleSetup: OracleSetup;
|
|
1265
|
+
oracleKeys: PublicKey[];
|
|
1266
|
+
oracleMaxAge: number;
|
|
1267
|
+
oracleMaxConfidence: number;
|
|
1268
|
+
fixedPrice: BigNumber;
|
|
1269
|
+
}
|
|
1270
|
+
interface BankType {
|
|
1271
|
+
address: PublicKey;
|
|
1272
|
+
tokenSymbol?: string;
|
|
1273
|
+
group: PublicKey;
|
|
1274
|
+
mint: PublicKey;
|
|
1275
|
+
mintDecimals: number;
|
|
1276
|
+
mintRate: number | null;
|
|
1277
|
+
mintPrice: number;
|
|
1278
|
+
assetShareValue: BigNumber;
|
|
1279
|
+
liabilityShareValue: BigNumber;
|
|
1280
|
+
liquidityVault: PublicKey;
|
|
1281
|
+
liquidityVaultBump: number;
|
|
1282
|
+
liquidityVaultAuthorityBump: number;
|
|
1283
|
+
insuranceVault: PublicKey;
|
|
1284
|
+
insuranceVaultBump: number;
|
|
1285
|
+
insuranceVaultAuthorityBump: number;
|
|
1286
|
+
collectedInsuranceFeesOutstanding: BigNumber;
|
|
1287
|
+
feeVault: PublicKey;
|
|
1288
|
+
feeVaultBump: number;
|
|
1289
|
+
feeVaultAuthorityBump: number;
|
|
1290
|
+
collectedGroupFeesOutstanding: BigNumber;
|
|
1291
|
+
lastUpdate: number;
|
|
1292
|
+
config: BankConfigType;
|
|
1293
|
+
totalAssetShares: BigNumber;
|
|
1294
|
+
totalLiabilityShares: BigNumber;
|
|
1295
|
+
emissionsActiveBorrowing: boolean;
|
|
1296
|
+
emissionsActiveLending: boolean;
|
|
1297
|
+
emissionsRate: number;
|
|
1298
|
+
emissionsMint: PublicKey;
|
|
1299
|
+
emissionsRemaining: BigNumber;
|
|
1300
|
+
oracleKey: PublicKey;
|
|
1301
|
+
pythShardId?: number;
|
|
1302
|
+
emode: EmodeSettingsType;
|
|
1303
|
+
feesDestinationAccount?: PublicKey;
|
|
1304
|
+
lendingPositionCount?: BigNumber;
|
|
1305
|
+
borrowingPositionCount?: BigNumber;
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Bitwise flags for EMode entry
|
|
1309
|
+
*/
|
|
1310
|
+
declare enum EmodeEntryFlags {
|
|
1311
|
+
/**
|
|
1312
|
+
* If set, isolated banks with this tag also benefit.
|
|
1313
|
+
* If not set, isolated banks continue to offer zero collateral, even if they use this tag.
|
|
1314
|
+
* (NOT YET IMPLEMENTED)
|
|
1315
|
+
*/
|
|
1316
|
+
APPLIES_TO_ISOLATED = 1,// 1
|
|
1317
|
+
/** Reserved for future use */
|
|
1318
|
+
RESERVED_1 = 2,// 2
|
|
1319
|
+
RESERVED_2 = 4,// 4
|
|
1320
|
+
RESERVED_3 = 8,// 8
|
|
1321
|
+
RESERVED_4 = 16,// 16
|
|
1322
|
+
RESERVED_5 = 32
|
|
1323
|
+
}
|
|
1324
|
+
interface EmodeEntry {
|
|
1325
|
+
collateralBankEmodeTag: EmodeTag;
|
|
1326
|
+
flags: EmodeEntryFlags[];
|
|
1327
|
+
assetWeightInit: BigNumber;
|
|
1328
|
+
assetWeightMaint: BigNumber;
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Bitwise flags for EMode settings
|
|
1332
|
+
*/
|
|
1333
|
+
declare enum EmodeFlags {
|
|
1334
|
+
/** If set, at least one entry is configured */
|
|
1335
|
+
EMODE_ON = 1,// 1
|
|
1336
|
+
/** Reserved for future use */
|
|
1337
|
+
RESERVED_1 = 2,// 2
|
|
1338
|
+
RESERVED_2 = 4,// 4
|
|
1339
|
+
RESERVED_3 = 8
|
|
1340
|
+
}
|
|
1341
|
+
declare enum EmodeTag {
|
|
1342
|
+
UNSET = 0,
|
|
1343
|
+
SOL = 501,
|
|
1344
|
+
LST_T1 = 1571,
|
|
1345
|
+
LST_T2 = 1572,
|
|
1346
|
+
UNKNOWN = 9999
|
|
1347
|
+
}
|
|
1348
|
+
interface EmodeSettingsType {
|
|
1349
|
+
emodeTag: EmodeTag;
|
|
1350
|
+
timestamp: number;
|
|
1351
|
+
flags: EmodeFlags[];
|
|
1352
|
+
emodeEntries: EmodeEntry[];
|
|
1353
|
+
}
|
|
1354
|
+
interface OracleConfigOpt {
|
|
1355
|
+
setup: OracleSetup;
|
|
1356
|
+
keys: PublicKey[];
|
|
1357
|
+
}
|
|
1358
|
+
type EmodePair = {
|
|
1359
|
+
collateralBanks: PublicKey[];
|
|
1360
|
+
collateralBankTag: EmodeTag;
|
|
1361
|
+
liabilityBank: PublicKey;
|
|
1362
|
+
liabilityBankTag: EmodeTag;
|
|
1363
|
+
assetWeightMaint: BigNumber;
|
|
1364
|
+
assetWeightInit: BigNumber;
|
|
1365
|
+
};
|
|
1366
|
+
type ActiveEmodePair = {
|
|
1367
|
+
collateralBanks: PublicKey[];
|
|
1368
|
+
collateralBankTags: EmodeTag[];
|
|
1369
|
+
liabilityBanks: PublicKey[];
|
|
1370
|
+
liabilityBankTags: EmodeTag[];
|
|
1371
|
+
assetWeightMaint: BigNumber;
|
|
1372
|
+
assetWeightInit: BigNumber;
|
|
1373
|
+
};
|
|
1374
|
+
declare enum EmodeImpactStatus {
|
|
1375
|
+
ActivateEmode = 0,
|
|
1376
|
+
ExtendEmode = 1,
|
|
1377
|
+
IncreaseEmode = 2,
|
|
1378
|
+
ReduceEmode = 3,
|
|
1379
|
+
RemoveEmode = 4,
|
|
1380
|
+
InactiveEmode = 5
|
|
1381
|
+
}
|
|
1382
|
+
interface EmodeImpact {
|
|
1383
|
+
status: EmodeImpactStatus;
|
|
1384
|
+
resultingPairs: EmodePair[];
|
|
1385
|
+
activePair?: ActiveEmodePair;
|
|
1386
|
+
}
|
|
1387
|
+
interface ActionEmodeImpact {
|
|
1388
|
+
borrowImpact?: EmodeImpact;
|
|
1389
|
+
supplyImpact?: EmodeImpact;
|
|
1390
|
+
repayAllImpact?: EmodeImpact;
|
|
1391
|
+
withdrawAllImpact?: EmodeImpact;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
interface BankRaw {
|
|
1395
|
+
group: PublicKey;
|
|
1396
|
+
mint: PublicKey;
|
|
1397
|
+
mintDecimals: number;
|
|
1398
|
+
assetShareValue: WrappedI80F48;
|
|
1399
|
+
liabilityShareValue: WrappedI80F48;
|
|
1400
|
+
liquidityVault: PublicKey;
|
|
1401
|
+
liquidityVaultBump: number;
|
|
1402
|
+
liquidityVaultAuthorityBump: number;
|
|
1403
|
+
insuranceVault: PublicKey;
|
|
1404
|
+
insuranceVaultBump: number;
|
|
1405
|
+
insuranceVaultAuthorityBump: number;
|
|
1406
|
+
collectedInsuranceFeesOutstanding: WrappedI80F48;
|
|
1407
|
+
feeVault: PublicKey;
|
|
1408
|
+
feeVaultBump: number;
|
|
1409
|
+
feeVaultAuthorityBump: number;
|
|
1410
|
+
collectedGroupFeesOutstanding: WrappedI80F48;
|
|
1411
|
+
lastUpdate: BN;
|
|
1412
|
+
config: BankConfigRaw;
|
|
1413
|
+
totalLiabilityShares: WrappedI80F48;
|
|
1414
|
+
totalAssetShares: WrappedI80F48;
|
|
1415
|
+
flags: BN;
|
|
1416
|
+
emissionsRate: BN;
|
|
1417
|
+
emissionsRemaining: WrappedI80F48;
|
|
1418
|
+
emissionsMint: PublicKey;
|
|
1419
|
+
emode: EmodeSettingsRaw;
|
|
1420
|
+
feesDestinationAccount?: PublicKey;
|
|
1421
|
+
cache?: BankCacheRaw;
|
|
1422
|
+
lendingPositionCount?: number;
|
|
1423
|
+
borrowingPositionCount?: number;
|
|
1424
|
+
}
|
|
1425
|
+
interface BankCacheRaw {
|
|
1426
|
+
baseRate: number;
|
|
1427
|
+
lendingRate: number;
|
|
1428
|
+
borrowingRate: number;
|
|
1429
|
+
interestAccumulatedFor: number;
|
|
1430
|
+
accumulatedSinceLastUpdate: WrappedI80F48;
|
|
1431
|
+
}
|
|
1432
|
+
interface BankConfigRaw {
|
|
1433
|
+
assetWeightInit: WrappedI80F48;
|
|
1434
|
+
assetWeightMaint: WrappedI80F48;
|
|
1435
|
+
liabilityWeightInit: WrappedI80F48;
|
|
1436
|
+
liabilityWeightMaint: WrappedI80F48;
|
|
1437
|
+
depositLimit: BN;
|
|
1438
|
+
interestRateConfig: InterestRateConfigRaw;
|
|
1439
|
+
operationalState: OperationalStateRaw;
|
|
1440
|
+
oracleSetup: OracleSetupRaw;
|
|
1441
|
+
oracleKeys: PublicKey[];
|
|
1442
|
+
borrowLimit: BN;
|
|
1443
|
+
riskTier: RiskTierRaw;
|
|
1444
|
+
assetTag: number;
|
|
1445
|
+
configFlags?: number;
|
|
1446
|
+
totalAssetValueInitLimit: BN;
|
|
1447
|
+
oracleMaxAge: number;
|
|
1448
|
+
oracleMaxConfidence: number;
|
|
1449
|
+
fixedPrice: WrappedI80F48;
|
|
1450
|
+
}
|
|
1451
|
+
interface BankConfigOptRaw {
|
|
1452
|
+
assetWeightInit: WrappedI80F48 | null;
|
|
1453
|
+
assetWeightMaint: WrappedI80F48 | null;
|
|
1454
|
+
liabilityWeightInit: WrappedI80F48 | null;
|
|
1455
|
+
liabilityWeightMaint: WrappedI80F48 | null;
|
|
1456
|
+
depositLimit: BN | null;
|
|
1457
|
+
borrowLimit: BN | null;
|
|
1458
|
+
operationalState: OperationalStateRaw | null;
|
|
1459
|
+
interestRateConfig: InterestRateConfigOptRaw | null;
|
|
1460
|
+
riskTier: RiskTierRaw | null;
|
|
1461
|
+
assetTag: number | null;
|
|
1462
|
+
totalAssetValueInitLimit: BN | null;
|
|
1463
|
+
oracleMaxConfidence: number | null;
|
|
1464
|
+
oracleMaxAge: number | null;
|
|
1465
|
+
permissionlessBadDebtSettlement: boolean | null;
|
|
1466
|
+
freezeSettings: boolean | null;
|
|
1467
|
+
tokenlessRepaymentsAllowed: boolean | null;
|
|
1468
|
+
}
|
|
1469
|
+
interface BankConfigCompactRaw extends Omit<BankConfigRaw, "oracleKeys" | "oracleSetup" | "fixedPrice" | "interestRateConfig"> {
|
|
1470
|
+
interestRateConfig: InterestRateConfigCompactRaw;
|
|
1471
|
+
}
|
|
1472
|
+
type RiskTierRaw = {
|
|
1473
|
+
collateral: {};
|
|
1474
|
+
} | {
|
|
1475
|
+
isolated: {};
|
|
1476
|
+
};
|
|
1477
|
+
type OperationalStateRaw = {
|
|
1478
|
+
paused: {};
|
|
1479
|
+
} | {
|
|
1480
|
+
operational: {};
|
|
1481
|
+
} | {
|
|
1482
|
+
reduceOnly: {};
|
|
1483
|
+
} | {
|
|
1484
|
+
killedByBankruptcy: {};
|
|
1485
|
+
};
|
|
1486
|
+
interface RatePointRaw {
|
|
1487
|
+
util: number;
|
|
1488
|
+
rate: number;
|
|
1489
|
+
}
|
|
1490
|
+
interface InterestRateConfigRaw {
|
|
1491
|
+
optimalUtilizationRate: WrappedI80F48;
|
|
1492
|
+
plateauInterestRate: WrappedI80F48;
|
|
1493
|
+
maxInterestRate: WrappedI80F48;
|
|
1494
|
+
insuranceFeeFixedApr: WrappedI80F48;
|
|
1495
|
+
insuranceIrFee: WrappedI80F48;
|
|
1496
|
+
protocolFixedFeeApr: WrappedI80F48;
|
|
1497
|
+
protocolIrFee: WrappedI80F48;
|
|
1498
|
+
protocolOriginationFee: WrappedI80F48;
|
|
1499
|
+
zeroUtilRate: number;
|
|
1500
|
+
hundredUtilRate: number;
|
|
1501
|
+
points: RatePointRaw[];
|
|
1502
|
+
curveType: number;
|
|
1503
|
+
}
|
|
1504
|
+
interface InterestRateConfigCompactRaw extends Omit<InterestRateConfigRaw, "optimalUtilizationRate" | "plateauInterestRate" | "maxInterestRate" | "curveType"> {
|
|
1505
|
+
}
|
|
1506
|
+
interface InterestRateConfigOptRaw extends InterestRateConfigCompactRaw {
|
|
1507
|
+
}
|
|
1508
|
+
type OracleSetupRaw = {
|
|
1509
|
+
none: {};
|
|
1510
|
+
} | {
|
|
1511
|
+
pythLegacy: {};
|
|
1512
|
+
} | {
|
|
1513
|
+
switchboardV2: {};
|
|
1514
|
+
} | {
|
|
1515
|
+
pythPushOracle: {};
|
|
1516
|
+
} | {
|
|
1517
|
+
switchboardPull: {};
|
|
1518
|
+
} | {
|
|
1519
|
+
stakedWithPythPush: {};
|
|
1520
|
+
} | {
|
|
1521
|
+
kaminoPythPush: {};
|
|
1522
|
+
} | {
|
|
1523
|
+
kaminoSwitchboardPull: {};
|
|
1524
|
+
} | {
|
|
1525
|
+
fixed: {};
|
|
1526
|
+
};
|
|
1527
|
+
interface OracleConfigOptRaw {
|
|
1528
|
+
setup: OracleSetupRaw;
|
|
1529
|
+
keys: PublicKey[];
|
|
1530
|
+
}
|
|
1531
|
+
interface BankMetadataRaw {
|
|
1532
|
+
bank: PublicKey;
|
|
1533
|
+
placeholder: BN;
|
|
1534
|
+
ticker: number[];
|
|
1535
|
+
description: number[];
|
|
1536
|
+
dataBlob: number[];
|
|
1537
|
+
endDescriptionByte: number;
|
|
1538
|
+
endDataBlob: number;
|
|
1539
|
+
endTickerByte: number;
|
|
1540
|
+
bump: number;
|
|
1541
|
+
pad0: number[];
|
|
1542
|
+
}
|
|
1543
|
+
interface EmodeEntryRaw {
|
|
1544
|
+
collateralBankEmodeTag: number;
|
|
1545
|
+
flags: number;
|
|
1546
|
+
assetWeightInit: WrappedI80F48;
|
|
1547
|
+
assetWeightMaint: WrappedI80F48;
|
|
1548
|
+
}
|
|
1549
|
+
interface EmodeSettingsRaw {
|
|
1550
|
+
emodeTag: number;
|
|
1551
|
+
timestamp: BN;
|
|
1552
|
+
flags: BN;
|
|
1553
|
+
emodeConfig: EmodeConfigRaw;
|
|
1554
|
+
}
|
|
1555
|
+
interface EmodeConfigRaw {
|
|
1556
|
+
entries: EmodeEntryRaw[];
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
interface RatePointDto {
|
|
1560
|
+
util: number;
|
|
1561
|
+
rate: number;
|
|
1562
|
+
}
|
|
1563
|
+
interface InterestRateConfigDto {
|
|
1564
|
+
optimalUtilizationRate: string;
|
|
1565
|
+
plateauInterestRate: string;
|
|
1566
|
+
maxInterestRate: string;
|
|
1567
|
+
insuranceFeeFixedApr: string;
|
|
1568
|
+
insuranceIrFee: string;
|
|
1569
|
+
protocolFixedFeeApr: string;
|
|
1570
|
+
protocolIrFee: string;
|
|
1571
|
+
protocolOriginationFee: string;
|
|
1572
|
+
zeroUtilRate: number;
|
|
1573
|
+
hundredUtilRate: number;
|
|
1574
|
+
points: RatePointDto[];
|
|
1575
|
+
curveType: number;
|
|
1576
|
+
}
|
|
1577
|
+
interface BankConfigDto {
|
|
1578
|
+
assetWeightInit: string;
|
|
1579
|
+
assetWeightMaint: string;
|
|
1580
|
+
liabilityWeightInit: string;
|
|
1581
|
+
liabilityWeightMaint: string;
|
|
1582
|
+
depositLimit: string;
|
|
1583
|
+
borrowLimit: string;
|
|
1584
|
+
riskTier: RiskTier;
|
|
1585
|
+
totalAssetValueInitLimit: string;
|
|
1586
|
+
assetTag: AssetTag;
|
|
1587
|
+
configFlags?: BankConfigFlag;
|
|
1588
|
+
interestRateConfig: InterestRateConfigDto;
|
|
1589
|
+
operationalState: OperationalState;
|
|
1590
|
+
oracleSetup: OracleSetup;
|
|
1591
|
+
oracleKeys: string[];
|
|
1592
|
+
oracleMaxAge: number;
|
|
1593
|
+
oracleMaxConfidence: number;
|
|
1594
|
+
fixedPrice: string;
|
|
1595
|
+
}
|
|
1596
|
+
interface EmodeEntryDto {
|
|
1597
|
+
collateralBankEmodeTag: EmodeTag;
|
|
1598
|
+
flags: EmodeEntryFlags[];
|
|
1599
|
+
assetWeightInit: string;
|
|
1600
|
+
assetWeightMaint: string;
|
|
1601
|
+
}
|
|
1602
|
+
interface EmodeSettingsDto {
|
|
1603
|
+
emodeTag: EmodeTag;
|
|
1604
|
+
timestamp: number;
|
|
1605
|
+
flags: EmodeFlags[];
|
|
1606
|
+
emodeEntries: EmodeEntryDto[];
|
|
1607
|
+
}
|
|
1608
|
+
interface BankTypeDto {
|
|
1609
|
+
address: string;
|
|
1610
|
+
tokenSymbol?: string;
|
|
1611
|
+
group: string;
|
|
1612
|
+
mint: string;
|
|
1613
|
+
mintDecimals: number;
|
|
1614
|
+
assetShareValue: string;
|
|
1615
|
+
liabilityShareValue: string;
|
|
1616
|
+
liquidityVault: string;
|
|
1617
|
+
liquidityVaultBump: number;
|
|
1618
|
+
liquidityVaultAuthorityBump: number;
|
|
1619
|
+
insuranceVault: string;
|
|
1620
|
+
insuranceVaultBump: number;
|
|
1621
|
+
insuranceVaultAuthorityBump: number;
|
|
1622
|
+
collectedInsuranceFeesOutstanding: string;
|
|
1623
|
+
feeVault: string;
|
|
1624
|
+
feeVaultBump: number;
|
|
1625
|
+
feeVaultAuthorityBump: number;
|
|
1626
|
+
collectedGroupFeesOutstanding: string;
|
|
1627
|
+
lastUpdate: number;
|
|
1628
|
+
config: BankConfigDto;
|
|
1629
|
+
totalAssetShares: string;
|
|
1630
|
+
totalLiabilityShares: string;
|
|
1631
|
+
emissionsActiveBorrowing: boolean;
|
|
1632
|
+
emissionsActiveLending: boolean;
|
|
1633
|
+
emissionsRate: number;
|
|
1634
|
+
emissionsMint: string;
|
|
1635
|
+
emissionsRemaining: string;
|
|
1636
|
+
oracleKey: string;
|
|
1637
|
+
pythShardId?: number;
|
|
1638
|
+
emode: EmodeSettingsDto;
|
|
1639
|
+
feesDestinationAccount?: string;
|
|
1640
|
+
lendingPositionCount?: string;
|
|
1641
|
+
borrowingPositionCount?: string;
|
|
1642
|
+
}
|
|
1643
|
+
interface BankRawDto {
|
|
1644
|
+
group: string;
|
|
1645
|
+
mint: string;
|
|
1646
|
+
mintDecimals: number;
|
|
1647
|
+
assetShareValue: WrappedI80F48;
|
|
1648
|
+
liabilityShareValue: WrappedI80F48;
|
|
1649
|
+
liquidityVault: string;
|
|
1650
|
+
liquidityVaultBump: number;
|
|
1651
|
+
liquidityVaultAuthorityBump: number;
|
|
1652
|
+
insuranceVault: string;
|
|
1653
|
+
insuranceVaultBump: number;
|
|
1654
|
+
insuranceVaultAuthorityBump: number;
|
|
1655
|
+
collectedInsuranceFeesOutstanding: WrappedI80F48;
|
|
1656
|
+
feeVault: string;
|
|
1657
|
+
feeVaultBump: number;
|
|
1658
|
+
feeVaultAuthorityBump: number;
|
|
1659
|
+
collectedGroupFeesOutstanding: WrappedI80F48;
|
|
1660
|
+
lastUpdate: string;
|
|
1661
|
+
config: BankConfigRawDto;
|
|
1662
|
+
totalLiabilityShares: WrappedI80F48;
|
|
1663
|
+
totalAssetShares: WrappedI80F48;
|
|
1664
|
+
flags: string;
|
|
1665
|
+
emissionsRate: string;
|
|
1666
|
+
emissionsRemaining: WrappedI80F48;
|
|
1667
|
+
emissionsMint: string;
|
|
1668
|
+
feesDestinationAccount?: string;
|
|
1669
|
+
lendingPositionCount?: string;
|
|
1670
|
+
borrowingPositionCount?: string;
|
|
1671
|
+
emode: EmodeSettingsRawDto;
|
|
1672
|
+
}
|
|
1673
|
+
interface BankConfigRawDto {
|
|
1674
|
+
assetWeightInit: WrappedI80F48;
|
|
1675
|
+
assetWeightMaint: WrappedI80F48;
|
|
1676
|
+
liabilityWeightInit: WrappedI80F48;
|
|
1677
|
+
liabilityWeightMaint: WrappedI80F48;
|
|
1678
|
+
depositLimit: string;
|
|
1679
|
+
interestRateConfig: InterestRateConfigRaw;
|
|
1680
|
+
operationalState: OperationalStateRaw;
|
|
1681
|
+
oracleSetup: OracleSetupRaw;
|
|
1682
|
+
oracleKeys: string[];
|
|
1683
|
+
borrowLimit: string;
|
|
1684
|
+
riskTier: RiskTierRaw;
|
|
1685
|
+
assetTag: number;
|
|
1686
|
+
configFlags?: number;
|
|
1687
|
+
totalAssetValueInitLimit: string;
|
|
1688
|
+
oracleMaxAge: number;
|
|
1689
|
+
oracleMaxConfidence: number;
|
|
1690
|
+
fixedPrice: WrappedI80F48;
|
|
1691
|
+
}
|
|
1692
|
+
interface EmodeSettingsRawDto {
|
|
1693
|
+
emodeTag: number;
|
|
1694
|
+
timestamp: string;
|
|
1695
|
+
flags: string;
|
|
1696
|
+
emodeConfig: EmodeConfigRawDto;
|
|
1697
|
+
}
|
|
1698
|
+
interface EmodeConfigRawDto {
|
|
1699
|
+
entries: EmodeEntryRawDto[];
|
|
1700
|
+
}
|
|
1701
|
+
interface EmodeEntryRawDto {
|
|
1702
|
+
collateralBankEmodeTag: number;
|
|
1703
|
+
flags: number;
|
|
1704
|
+
assetWeightInit: WrappedI80F48;
|
|
1705
|
+
assetWeightMaint: WrappedI80F48;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
declare function freezeBankConfigIx(program: LendrProgram, bankAddress: PublicKey, bankConfigOpt: BankConfigOpt): Promise<InstructionsWrapper>;
|
|
1709
|
+
type AddOracleToBanksIxArgs = {
|
|
1710
|
+
program: LendrProgram;
|
|
1711
|
+
bankAddress: PublicKey;
|
|
1712
|
+
/**
|
|
1713
|
+
* The feed ID for the oracle. For Pyth Push oracles, this is the price feed ID.
|
|
1714
|
+
* The function will automatically derive the PDA from this feed ID.
|
|
1715
|
+
*/
|
|
1716
|
+
feedId: PublicKey;
|
|
1717
|
+
/**
|
|
1718
|
+
* The oracle setup type (e.g., PythPushOracle, KaminoPythPush, etc.)
|
|
1719
|
+
*/
|
|
1720
|
+
setup: OracleSetup;
|
|
1721
|
+
/**
|
|
1722
|
+
* The shard ID for Pyth Push oracles. Defaults to PYTH_SPONSORED_SHARD_ID.
|
|
1723
|
+
* Only relevant for PythPushOracle and KaminoPythPush setups.
|
|
1724
|
+
*/
|
|
1725
|
+
shardId?: number;
|
|
1726
|
+
groupAddress?: PublicKey;
|
|
1727
|
+
adminAddress?: PublicKey;
|
|
1728
|
+
};
|
|
1729
|
+
/**
|
|
1730
|
+
* Creates an instruction to configure a bank's oracle.
|
|
1731
|
+
* For Pyth Push oracles, automatically derives the PDA from the feed ID.
|
|
1732
|
+
*/
|
|
1733
|
+
declare function addOracleToBanksIx({ program, bankAddress, feedId, setup, shardId, groupAddress, adminAddress, }: AddOracleToBanksIxArgs): Promise<InstructionsWrapper>;
|
|
1734
|
+
/**
|
|
1735
|
+
* Derive the address of a price feed account
|
|
1736
|
+
* @param shardId The shard ID of the set of price feed accounts. This shard ID allows for multiple price feed accounts for the same price feed id to exist.
|
|
1737
|
+
* @param priceFeedId The price feed ID, as either a 32-byte buffer or hexadecimal string with or without a leading "0x" prefix.
|
|
1738
|
+
* @param pushOracleProgramId The program ID of the Pyth Push Oracle program. If not provided, the default deployment will be used.
|
|
1739
|
+
* @returns The address of the price feed account
|
|
1740
|
+
*/
|
|
1741
|
+
declare function getPriceFeedAccountForProgram(shardId: number, priceFeedId: Buffer | string, pushOracleProgramId?: PublicKey): PublicKey;
|
|
1742
|
+
declare const getTreasuryPda: (treasuryId: number, receiverProgramId: PublicKey) => PublicKey;
|
|
1743
|
+
declare const getConfigPda: (receiverProgramId: PublicKey) => PublicKey;
|
|
1744
|
+
declare function crankPythOracleIx(oracles: {
|
|
1745
|
+
feedId: string;
|
|
1746
|
+
shardId: number;
|
|
1747
|
+
}[], provider: Provider): Promise<{
|
|
1748
|
+
postInstructions: InstructionWithEphemeralSigners[];
|
|
1749
|
+
closeInstructions: InstructionWithEphemeralSigners[];
|
|
1750
|
+
keys: never[];
|
|
1751
|
+
lut: _solana_web3_js.AddressLookupTableAccount | null;
|
|
1752
|
+
}>;
|
|
1753
|
+
|
|
1754
|
+
declare function getPriceWithConfidence(oraclePrice: OraclePrice, weighted: boolean): PriceWithConfidence;
|
|
1755
|
+
declare function getPrice(oraclePrice: OraclePrice, priceBias?: PriceBias, weightedPrice?: boolean): BigNumber;
|
|
1756
|
+
type SupportedOracleSetup = OracleSetup.PythLegacy | OracleSetup.PythPushOracle | OracleSetup.StakedWithPythPush | OracleSetup.SwitchboardV2 | OracleSetup.SwitchboardPull | OracleSetup.KaminoPythPush | OracleSetup.KaminoSwitchboardPull | OracleSetup.Fixed;
|
|
1757
|
+
declare function isOracleSetupSupported(oracleSetup: OracleSetup): oracleSetup is SupportedOracleSetup;
|
|
1758
|
+
declare function parseOraclePriceData(oracleSetup: SupportedOracleSetup, rawData: Buffer, fixedPrice?: BigNumber, logger?: TLogger): OraclePrice;
|
|
1759
|
+
|
|
1760
|
+
declare function dtoToOraclePrice(dto: OraclePriceDto): OraclePrice;
|
|
1761
|
+
|
|
1762
|
+
/**
|
|
1763
|
+
* Extracts oracle keys for Pyth price fetching
|
|
1764
|
+
*/
|
|
1765
|
+
declare const extractPythOracleKeys: (pythBanks: {
|
|
1766
|
+
address: PublicKey;
|
|
1767
|
+
data: BankRaw;
|
|
1768
|
+
}[]) => string[];
|
|
1769
|
+
declare const fetchPythOracleData: (banks: {
|
|
1770
|
+
address: PublicKey;
|
|
1771
|
+
data: BankRaw;
|
|
1772
|
+
}[], bankMetadataMap: {
|
|
1773
|
+
[address: string]: BankMetadata;
|
|
1774
|
+
}, connection?: Connection, opts?: {
|
|
1775
|
+
useApiEndpoint?: boolean;
|
|
1776
|
+
}) => Promise<{
|
|
1777
|
+
pythFeedMap: PythPushFeedIdMap;
|
|
1778
|
+
bankOraclePriceMap: Map<string, OraclePrice>;
|
|
1779
|
+
}>;
|
|
1780
|
+
/**
|
|
1781
|
+
* =============================================================================
|
|
1782
|
+
* SWITCHBOARD ORACLE UTILS
|
|
1783
|
+
* =============================================================================
|
|
1784
|
+
*
|
|
1785
|
+
* Utility functions for fetching Switchboard oracle data
|
|
1786
|
+
*/
|
|
1787
|
+
declare const fetchSwbOracleData: (banks: {
|
|
1788
|
+
address: PublicKey;
|
|
1789
|
+
data: BankRaw;
|
|
1790
|
+
}[], opts?: {
|
|
1791
|
+
useApiEndpoint?: boolean;
|
|
1792
|
+
}) => Promise<{
|
|
1793
|
+
bankOraclePriceMap: Map<string, OraclePrice>;
|
|
1794
|
+
}>;
|
|
1795
|
+
/**
|
|
1796
|
+
* =============================================================================
|
|
1797
|
+
* ORACLE UTILS
|
|
1798
|
+
* =============================================================================
|
|
1799
|
+
*
|
|
1800
|
+
* Utility functions for fetching all oracle data
|
|
1801
|
+
*/
|
|
1802
|
+
declare const fetchOracleData: (banks: {
|
|
1803
|
+
address: PublicKey;
|
|
1804
|
+
data: BankRaw;
|
|
1805
|
+
}[], bankMetadataMap: {
|
|
1806
|
+
[address: string]: BankMetadata;
|
|
1807
|
+
}, connection?: Connection, opts?: {
|
|
1808
|
+
useApiEndpoint?: boolean;
|
|
1809
|
+
}) => Promise<{
|
|
1810
|
+
bankOraclePriceMap: Map<string, OraclePrice>;
|
|
1811
|
+
pythFeedMap: PythPushFeedIdMap;
|
|
1812
|
+
}>;
|
|
1813
|
+
|
|
1814
|
+
declare function oraclePriceToDto(oraclePrice: OraclePrice): OraclePriceDto;
|
|
1815
|
+
|
|
1816
|
+
declare function computeMaxLeverage(depositBank: BankType, borrowBank: BankType, opts?: {
|
|
1817
|
+
assetWeightInit?: BigNumber;
|
|
1818
|
+
liabilityWeightInit?: BigNumber;
|
|
1819
|
+
}): {
|
|
1820
|
+
maxLeverage: number;
|
|
1821
|
+
ltv: number;
|
|
1822
|
+
};
|
|
1823
|
+
declare function computeLoopingParams(principal: Amount, targetLeverage: number, depositBank: BankType, borrowBank: BankType, depositOracleInfo: OraclePrice, borrowOracleInfo: OraclePrice): {
|
|
1824
|
+
borrowAmount: BigNumber;
|
|
1825
|
+
totalDepositAmount: BigNumber;
|
|
1826
|
+
};
|
|
1827
|
+
/** Small getters */
|
|
1828
|
+
declare function getTotalAssetQuantity(bank: BankType): BigNumber;
|
|
1829
|
+
declare function getTotalLiabilityQuantity(bank: BankType): BigNumber;
|
|
1830
|
+
declare function getAssetQuantity(bank: BankType, assetShares: BigNumber): BigNumber;
|
|
1831
|
+
declare function getLiabilityQuantity(bank: BankType, liabilityShares: BigNumber): BigNumber;
|
|
1832
|
+
declare function getAssetShares(bank: BankType, assetQuantity: BigNumber): BigNumber;
|
|
1833
|
+
declare function getLiabilityShares(bank: BankType, liabilityQuantity: BigNumber): BigNumber;
|
|
1834
|
+
declare function getAssetWeight(bank: BankType, lendrRequirementType: LendrRequirementType, oraclePrice: OraclePrice, opts?: {
|
|
1835
|
+
ignoreSoftLimits?: boolean;
|
|
1836
|
+
assetWeightInitOverride?: BigNumber;
|
|
1837
|
+
}): BigNumber;
|
|
1838
|
+
declare function getLiabilityWeight(config: BankConfigType, lendrRequirementType: LendrRequirementType): BigNumber;
|
|
1839
|
+
/** Computes */
|
|
1840
|
+
declare function computeLiabilityUsdValue(bank: BankType, oraclePrice: OraclePrice, liabilityShares: BigNumber, lendrRequirementType: LendrRequirementType, priceBias: PriceBias): BigNumber;
|
|
1841
|
+
declare function computeAssetUsdValue(bank: BankType, oraclePrice: OraclePrice, assetShares: BigNumber, lendrRequirementType: LendrRequirementType, priceBias: PriceBias): BigNumber;
|
|
1842
|
+
declare function computeUsdValue(bank: BankType, oraclePrice: OraclePrice, quantity: BigNumber, priceBias: PriceBias, weightedPrice: boolean, weight?: BigNumber, scaleToBase?: boolean): BigNumber;
|
|
1843
|
+
declare function computeTvl(bank: BankType, oraclePrice: OraclePrice): BigNumber;
|
|
1844
|
+
declare function computeInterestRates(bank: BankType): {
|
|
1845
|
+
lendingRate: BigNumber;
|
|
1846
|
+
borrowingRate: BigNumber;
|
|
1847
|
+
};
|
|
1848
|
+
declare function computeBaseInterestRate(bank: BankType): BigNumber;
|
|
1849
|
+
declare function computeUtilizationRate(bank: BankType): BigNumber;
|
|
1850
|
+
declare function computeRemainingCapacity(bank: BankType): {
|
|
1851
|
+
depositCapacity: BigNumber;
|
|
1852
|
+
borrowCapacity: BigNumber;
|
|
1853
|
+
};
|
|
1854
|
+
|
|
1855
|
+
declare function decodeBankRaw(encoded: Buffer, idl: LendrIdlType): BankRaw;
|
|
1856
|
+
declare function parseEmodeSettingsRaw(emodeSettingsRaw: EmodeSettingsRaw): EmodeSettingsType;
|
|
1857
|
+
declare function parseBankRaw(address: PublicKey, accountParsed: BankRaw, feedIdMap?: PythPushFeedIdMap, bankMetadata?: BankMetadata, mintData?: {
|
|
1858
|
+
mintRate: number | null;
|
|
1859
|
+
mintPrice: number;
|
|
1860
|
+
}): BankType;
|
|
1861
|
+
declare function dtoToBank(bankDto: BankTypeDto): BankType;
|
|
1862
|
+
declare function dtoToEmodeSettings(emodeSettingsDto: EmodeSettingsDto): EmodeSettingsType;
|
|
1863
|
+
declare function dtoToBankConfig(bankConfigDto: BankConfigDto): BankConfigType;
|
|
1864
|
+
declare function dtoToInterestRateConfig(interestRateConfigDto: InterestRateConfigDto): InterestRateConfig;
|
|
1865
|
+
declare function dtoToBankRaw(bankDto: BankRawDto): BankRaw;
|
|
1866
|
+
declare function dtoToEmodeSettingsRaw(emodeSettingsDto: EmodeSettingsRawDto): EmodeSettingsRaw;
|
|
1867
|
+
declare function dtoToBankConfigRaw(bankConfigDto: BankConfigRawDto): BankConfigRaw;
|
|
1868
|
+
declare function parseBankConfigRaw(bankConfigRaw: BankConfigRaw): BankConfigType;
|
|
1869
|
+
declare function parseRiskTier(riskTierRaw: RiskTierRaw): RiskTier;
|
|
1870
|
+
declare function parseOperationalState(operationalStateRaw: OperationalStateRaw): OperationalState;
|
|
1871
|
+
declare function parseOracleSetup(oracleSetupRaw: OracleSetupRaw): OracleSetup;
|
|
1872
|
+
/**
|
|
1873
|
+
* Get all active EMode flags as an array of flag names
|
|
1874
|
+
*/
|
|
1875
|
+
declare function getActiveEmodeFlags(flags: BN): EmodeFlags[];
|
|
1876
|
+
/**
|
|
1877
|
+
* Check if a specific EMode flag is set
|
|
1878
|
+
*/
|
|
1879
|
+
declare function hasEmodeFlag(flags: BN, flag: number): boolean;
|
|
1880
|
+
/**
|
|
1881
|
+
* Get all active EMode entry flags as an array of flag names
|
|
1882
|
+
*/
|
|
1883
|
+
declare function getActiveEmodeEntryFlags(flags: number): EmodeEntryFlags[];
|
|
1884
|
+
/**
|
|
1885
|
+
* Check if a specific EMode entry flag is set
|
|
1886
|
+
*/
|
|
1887
|
+
declare function hasEmodeEntryFlag(flags: number, flag: number): boolean;
|
|
1888
|
+
/**
|
|
1889
|
+
* Parse a raw EMode tag number into the corresponding EmodeTag enum value
|
|
1890
|
+
*/
|
|
1891
|
+
declare function parseEmodeTag(emodeTagRaw: number): EmodeTag;
|
|
1892
|
+
|
|
1893
|
+
declare const fetchMultipleBanks: (program: LendrProgram, opts?: {
|
|
1894
|
+
bankAddresses?: Address[];
|
|
1895
|
+
groupAddress?: PublicKey;
|
|
1896
|
+
}) => Promise<{
|
|
1897
|
+
address: PublicKey;
|
|
1898
|
+
data: BankRaw;
|
|
1899
|
+
}[]>;
|
|
1900
|
+
|
|
1901
|
+
declare function serializeBankConfigOpt(bankConfigOpt: BankConfigOpt): BankConfigOptRaw;
|
|
1902
|
+
declare function serializeRiskTier(riskTier: RiskTier): RiskTierRaw;
|
|
1903
|
+
declare function serializeOperationalState(operationalState: OperationalState): {
|
|
1904
|
+
paused: {};
|
|
1905
|
+
} | {
|
|
1906
|
+
operational: {};
|
|
1907
|
+
} | {
|
|
1908
|
+
reduceOnly: {};
|
|
1909
|
+
};
|
|
1910
|
+
declare function serializeOracleSetupToIndex(oracleSetup: OracleSetup): number;
|
|
1911
|
+
declare function serializeOracleSetup(oracleSetup: OracleSetup): OracleSetupRaw;
|
|
1912
|
+
declare function toBankDto(bank: BankType): BankTypeDto;
|
|
1913
|
+
declare function toEmodeSettingsDto(emodeSettings: EmodeSettingsType): EmodeSettingsDto;
|
|
1914
|
+
declare function toBankConfigDto(bankConfig: BankConfigType): BankConfigDto;
|
|
1915
|
+
declare function toInterestRateConfigDto(interestRateConfig: InterestRateConfig): InterestRateConfigDto;
|
|
1916
|
+
declare function bankConfigToBankConfigRaw(config: BankConfigType): BankConfigRaw;
|
|
1917
|
+
declare function bankRawToDto(bankRaw: BankRaw): BankRawDto;
|
|
1918
|
+
declare function emodeSettingsRawToDto(emodeSettingsRaw: EmodeSettingsRaw): EmodeSettingsRawDto;
|
|
1919
|
+
declare function bankConfigRawToDto(bankConfigRaw: BankConfigRaw): BankConfigRawDto;
|
|
1920
|
+
|
|
1921
|
+
interface BalanceType {
|
|
1922
|
+
active: boolean;
|
|
1923
|
+
bankPk: PublicKey;
|
|
1924
|
+
assetShares: BigNumber;
|
|
1925
|
+
liabilityShares: BigNumber;
|
|
1926
|
+
emissionsOutstanding: BigNumber;
|
|
1927
|
+
lastUpdate: number;
|
|
1928
|
+
}
|
|
1929
|
+
declare enum HealthCacheFlags {
|
|
1930
|
+
/**
|
|
1931
|
+
* If set (1), the account is considered healthy and cannot be liquidated.
|
|
1932
|
+
* If not set (0), the account is unhealthy and can be liquidated.
|
|
1933
|
+
*/
|
|
1934
|
+
HEALTHY = 1,// 1
|
|
1935
|
+
/**
|
|
1936
|
+
* If set (1), the engine did not error during the last health pulse.
|
|
1937
|
+
* If not set (0), the engine would have errored and this cache is likely invalid.
|
|
1938
|
+
* `RiskEngineInitRejected` is ignored and will allow the flag to be set anyways.
|
|
1939
|
+
*/
|
|
1940
|
+
ENGINE_STATUS_OK = 2,// 2
|
|
1941
|
+
/**
|
|
1942
|
+
* If set (1), the engine did not error due to an oracle issue.
|
|
1943
|
+
* If not set (0), engine was passed a bad bank or oracle account, or an oracle was stale.
|
|
1944
|
+
* Check the order in which accounts were passed and ensure each balance has the correct banks/oracles,
|
|
1945
|
+
* and that oracle cranks ran recently enough. Check `internal_err` and `err_index` for more details
|
|
1946
|
+
* in some circumstances. Invalid if generated after borrow/withdraw (these instructions will
|
|
1947
|
+
* ignore oracle issues if health is still satisfactory with some balance zeroed out).
|
|
1948
|
+
*/
|
|
1949
|
+
ORACLE_OK = 4
|
|
1950
|
+
}
|
|
1951
|
+
interface HealthCacheType {
|
|
1952
|
+
assetValue: BigNumber;
|
|
1953
|
+
liabilityValue: BigNumber;
|
|
1954
|
+
assetValueMaint: BigNumber;
|
|
1955
|
+
liabilityValueMaint: BigNumber;
|
|
1956
|
+
assetValueEquity: BigNumber;
|
|
1957
|
+
liabilityValueEquity: BigNumber;
|
|
1958
|
+
timestamp: BigNumber;
|
|
1959
|
+
flags: HealthCacheFlags[];
|
|
1960
|
+
prices: number[][];
|
|
1961
|
+
simulationFailed?: boolean;
|
|
1962
|
+
}
|
|
1963
|
+
interface LendrAccountType {
|
|
1964
|
+
address: PublicKey;
|
|
1965
|
+
group: PublicKey;
|
|
1966
|
+
authority: PublicKey;
|
|
1967
|
+
balances: BalanceType[];
|
|
1968
|
+
accountFlags: AccountFlags[];
|
|
1969
|
+
emissionsDestinationAccount: PublicKey;
|
|
1970
|
+
healthCache: HealthCacheType;
|
|
1971
|
+
}
|
|
1972
|
+
declare enum AccountFlags {
|
|
1973
|
+
ACCOUNT_DISABLED = 1,// 1
|
|
1974
|
+
ACCOUNT_IN_FLASHLOAN = 2,// 2
|
|
1975
|
+
ACCOUNT_FLAG_DEPRECATED = 4,// 4
|
|
1976
|
+
ACCOUNT_TRANSFER_AUTHORITY_ALLOWED = 8
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
interface BalanceTypeDto {
|
|
1980
|
+
active: boolean;
|
|
1981
|
+
bankPk: string;
|
|
1982
|
+
assetShares: string;
|
|
1983
|
+
liabilityShares: string;
|
|
1984
|
+
emissionsOutstanding: string;
|
|
1985
|
+
lastUpdate: number;
|
|
1986
|
+
}
|
|
1987
|
+
interface HealthCacheTypeDto {
|
|
1988
|
+
assetValue: string;
|
|
1989
|
+
liabilityValue: string;
|
|
1990
|
+
assetValueMaint: string;
|
|
1991
|
+
liabilityValueMaint: string;
|
|
1992
|
+
assetValueEquity: string;
|
|
1993
|
+
liabilityValueEquity: string;
|
|
1994
|
+
timestamp: string;
|
|
1995
|
+
flags: HealthCacheFlags[];
|
|
1996
|
+
prices: number[][];
|
|
1997
|
+
simulationFailed?: boolean;
|
|
1998
|
+
}
|
|
1999
|
+
interface LendrAccountTypeDto {
|
|
2000
|
+
address: string;
|
|
2001
|
+
group: string;
|
|
2002
|
+
authority: string;
|
|
2003
|
+
balances: BalanceTypeDto[];
|
|
2004
|
+
accountFlags: AccountFlags[];
|
|
2005
|
+
emissionsDestinationAccount: string;
|
|
2006
|
+
healthCache: HealthCacheTypeDto;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
interface BalanceRaw {
|
|
2010
|
+
active: boolean | number;
|
|
2011
|
+
bankPk: PublicKey;
|
|
2012
|
+
assetShares: WrappedI80F48;
|
|
2013
|
+
liabilityShares: WrappedI80F48;
|
|
2014
|
+
emissionsOutstanding: WrappedI80F48;
|
|
2015
|
+
lastUpdate: BN;
|
|
2016
|
+
}
|
|
2017
|
+
interface HealthCacheRaw {
|
|
2018
|
+
assetValue: WrappedI80F48;
|
|
2019
|
+
liabilityValue: WrappedI80F48;
|
|
2020
|
+
assetValueMaint: WrappedI80F48;
|
|
2021
|
+
liabilityValueMaint: WrappedI80F48;
|
|
2022
|
+
assetValueEquity: WrappedI80F48;
|
|
2023
|
+
liabilityValueEquity: WrappedI80F48;
|
|
2024
|
+
timestamp: BN;
|
|
2025
|
+
flags: number;
|
|
2026
|
+
prices: number[][];
|
|
2027
|
+
errIndex: number;
|
|
2028
|
+
internalErr: number;
|
|
2029
|
+
internalBankruptcyErr: number;
|
|
2030
|
+
internalLiqErr: number;
|
|
2031
|
+
lndrErr: number;
|
|
2032
|
+
}
|
|
2033
|
+
interface LendrAccountRaw {
|
|
2034
|
+
group: PublicKey;
|
|
2035
|
+
authority: PublicKey;
|
|
2036
|
+
lendingAccount: {
|
|
2037
|
+
balances: BalanceRaw[];
|
|
2038
|
+
};
|
|
2039
|
+
accountFlags: BN;
|
|
2040
|
+
emissionsDestinationAccount: PublicKey;
|
|
2041
|
+
healthCache: HealthCacheRaw;
|
|
2042
|
+
padding0?: BN[];
|
|
2043
|
+
}
|
|
2044
|
+
type LendrRequirementTypeRaw = {
|
|
2045
|
+
initial: {};
|
|
2046
|
+
} | {
|
|
2047
|
+
maintenance: {};
|
|
2048
|
+
} | {
|
|
2049
|
+
equity: {};
|
|
2050
|
+
};
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* Custom error class for health cache simulation failures
|
|
2054
|
+
*/
|
|
2055
|
+
declare class HealthCacheSimulationError extends Error {
|
|
2056
|
+
lndrErr: number | null;
|
|
2057
|
+
internalErr: number | null;
|
|
2058
|
+
constructor(message: string, lndrErr: number | null, internalErr: number | null);
|
|
2059
|
+
}
|
|
2060
|
+
declare function simulateAccountHealthCacheWithFallback(props: {
|
|
2061
|
+
program: Program<LendrIdlType>;
|
|
2062
|
+
bankMap: Map<string, Bank>;
|
|
2063
|
+
oraclePrices: Map<string, OraclePrice>;
|
|
2064
|
+
lendrAccount: LendrAccount;
|
|
2065
|
+
balances: Balance[];
|
|
2066
|
+
bankMetadataMap: BankMetadataMap;
|
|
2067
|
+
}): Promise<{
|
|
2068
|
+
lendrAccount: LendrAccount;
|
|
2069
|
+
error?: HealthCacheSimulationError;
|
|
2070
|
+
}>;
|
|
2071
|
+
declare function simulateAccountHealthCache(props: {
|
|
2072
|
+
program: Program<LendrIdlType>;
|
|
2073
|
+
bankMap: Map<string, Bank>;
|
|
2074
|
+
oraclePrices: Map<string, OraclePrice>;
|
|
2075
|
+
lendrAccountPk: PublicKey;
|
|
2076
|
+
balances: Balance[];
|
|
2077
|
+
bankMetadataMap: BankMetadataMap;
|
|
2078
|
+
}): Promise<LendrAccountRaw>;
|
|
2079
|
+
declare function makePulseHealthIx$1(program: LendrProgram, lendrAccountPk: PublicKey, banks: Map<string, BankType>, balances: BalanceType[], mandatoryBanks: PublicKey[], excludedBanks: PublicKey[], bankMetadataMap: BankMetadataMap): Promise<{
|
|
2080
|
+
instructions: TransactionInstruction[];
|
|
2081
|
+
keys: never[];
|
|
2082
|
+
}>;
|
|
2083
|
+
declare function createUpdateFeedIx(_props: {
|
|
2084
|
+
swbPullOracles: PublicKey[];
|
|
2085
|
+
provider: AnchorProvider;
|
|
2086
|
+
}): Promise<{
|
|
2087
|
+
instructions: TransactionInstruction[];
|
|
2088
|
+
luts: AddressLookupTableAccount[];
|
|
2089
|
+
}>;
|
|
2090
|
+
/**
|
|
2091
|
+
* This function creates a new Lendr account transaction and returns a projected dummy account for simulation.
|
|
2092
|
+
* Note: This function is subject to future updates and improvements.
|
|
2093
|
+
*/
|
|
2094
|
+
declare function createLendrAccountTx(props: {
|
|
2095
|
+
lendrAccount: LendrAccountWrapper | null;
|
|
2096
|
+
lendrClient: LendrClient;
|
|
2097
|
+
}): Promise<{
|
|
2098
|
+
account: LendrAccountWrapper;
|
|
2099
|
+
tx: SolanaTransaction;
|
|
2100
|
+
}>;
|
|
2101
|
+
declare function getActiveStaleBanks(balances: Balance[], banks: BankMap, additionalBanks: Bank[], oraclePrices: OraclePriceMap, maxAgeOffset?: number): {
|
|
2102
|
+
stalePythFeeds: {
|
|
2103
|
+
feedId: string;
|
|
2104
|
+
shardId: number;
|
|
2105
|
+
}[];
|
|
2106
|
+
staleSwbOracles: {
|
|
2107
|
+
oracleKey: PublicKey;
|
|
2108
|
+
}[];
|
|
2109
|
+
};
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* Lendr Account Computes
|
|
2113
|
+
* =========================
|
|
2114
|
+
*/
|
|
2115
|
+
declare function computeFreeCollateral(lendrAccount: LendrAccountType, opts?: {
|
|
2116
|
+
clamped?: boolean;
|
|
2117
|
+
}): BigNumber;
|
|
2118
|
+
declare function computeFreeCollateralLegacy(activeBalances: BalanceType[], banks: Map<string, BankType>, oraclePrices: Map<string, OraclePrice>, opts?: {
|
|
2119
|
+
clamped?: boolean;
|
|
2120
|
+
}): BigNumber;
|
|
2121
|
+
declare function computeHealthComponents(lendrAccount: LendrAccountType, lendrReqType: LendrRequirementType): {
|
|
2122
|
+
assets: BigNumber;
|
|
2123
|
+
liabilities: BigNumber;
|
|
2124
|
+
};
|
|
2125
|
+
declare function computeHealthComponentsLegacy(activeBalances: BalanceType[], banks: Map<string, BankType>, oraclePrices: Map<string, OraclePrice>, lendrReqType: LendrRequirementType, excludedBanks?: PublicKey[]): {
|
|
2126
|
+
assets: BigNumber;
|
|
2127
|
+
liabilities: BigNumber;
|
|
2128
|
+
};
|
|
2129
|
+
declare function computeHealthComponentsWithoutBiasLegacy(activeBalances: BalanceType[], banks: Map<string, BankType>, oraclePrices: Map<string, OraclePrice>, lendrReqType: LendrRequirementType): {
|
|
2130
|
+
assets: BigNumber;
|
|
2131
|
+
liabilities: BigNumber;
|
|
2132
|
+
};
|
|
2133
|
+
declare function computeAccountValue(lendrAccount: LendrAccountType): BigNumber;
|
|
2134
|
+
declare function computeNetApy(lendrAccount: LendrAccountType, activeBalances: BalanceType[], banks: Map<string, BankType>, oraclePrices: Map<string, OraclePrice>): number;
|
|
2135
|
+
/**
|
|
2136
|
+
* Lendr Balance Computes
|
|
2137
|
+
* =========================
|
|
2138
|
+
*/
|
|
2139
|
+
declare function computeBalanceUsdValue(balance: BalanceType, bank: BankType, oraclePrice: OraclePrice, lendrRequirementType: LendrRequirementType): {
|
|
2140
|
+
assets: BigNumber;
|
|
2141
|
+
liabilities: BigNumber;
|
|
2142
|
+
};
|
|
2143
|
+
declare function getBalanceUsdValueWithPriceBias(balance: BalanceType, bank: BankType, oraclePrice: OraclePrice, lendrRequirementType: LendrRequirementType): {
|
|
2144
|
+
assets: BigNumber;
|
|
2145
|
+
liabilities: BigNumber;
|
|
2146
|
+
};
|
|
2147
|
+
declare function computeQuantity(balance: BalanceType, bank: BankType): {
|
|
2148
|
+
assets: BigNumber;
|
|
2149
|
+
liabilities: BigNumber;
|
|
2150
|
+
};
|
|
2151
|
+
declare function computeQuantityUi(balance: BalanceType, bank: BankType): {
|
|
2152
|
+
assets: BigNumber;
|
|
2153
|
+
liabilities: BigNumber;
|
|
2154
|
+
};
|
|
2155
|
+
declare function computeClaimedEmissions(balance: BalanceType, bank: BankType, currentTimestamp: number): BigNumber;
|
|
2156
|
+
declare function computeTotalOutstandingEmissions(balance: BalanceType, bank: BankType): BigNumber;
|
|
2157
|
+
declare function computeHealthCheckAccounts(balances: BalanceType[], banks: Map<string, BankType>, mandatoryBanks?: PublicKey[], excludedBanks?: PublicKey[]): BankType[];
|
|
2158
|
+
declare function computeHealthAccountMetas(banksToInclude: BankType[], bankMetadataMap?: BankMetadataMap, enableSorting?: boolean, bankExtendedMetadata?: BankExtendedMetadata): PublicKey[];
|
|
2159
|
+
|
|
2160
|
+
declare function decodeAccountRaw(encoded: Buffer, idl: LendrIdlType): LendrAccountRaw;
|
|
2161
|
+
declare function parseBalanceRaw(balanceRaw: BalanceRaw): BalanceType;
|
|
2162
|
+
declare function parseLendrAccountRaw(lendrAccountPk: PublicKey, accountData: LendrAccountRaw): {
|
|
2163
|
+
address: PublicKey;
|
|
2164
|
+
group: PublicKey;
|
|
2165
|
+
authority: PublicKey;
|
|
2166
|
+
balances: Balance[];
|
|
2167
|
+
accountFlags: AccountFlags[];
|
|
2168
|
+
emissionsDestinationAccount: PublicKey;
|
|
2169
|
+
healthCache: HealthCache;
|
|
2170
|
+
};
|
|
2171
|
+
/**
|
|
2172
|
+
* Get all active account flags as an array of flag names
|
|
2173
|
+
*/
|
|
2174
|
+
declare function getActiveAccountFlags(flags: BN): AccountFlags[];
|
|
2175
|
+
/**
|
|
2176
|
+
* Check if an account flag is set
|
|
2177
|
+
*/
|
|
2178
|
+
declare function hasAccountFlag(flags: BN, flag: number): boolean;
|
|
2179
|
+
/**
|
|
2180
|
+
* Convert on-chain health cache flags (BN) to an array of HealthCacheFlags enum values
|
|
2181
|
+
*
|
|
2182
|
+
* According to the IDL, health cache flags are defined as:
|
|
2183
|
+
* - HEALTHY = 1 (bit 0) - If set, the account cannot be liquidated
|
|
2184
|
+
* - ENGINE_STATUS_OK = 2 (bit 1) - If set, the engine did not error during health calculation
|
|
2185
|
+
* - ORACLE_OK = 4 (bit 2) - If set, the engine did not encounter oracle issues
|
|
2186
|
+
*/
|
|
2187
|
+
declare function getActiveHealthCacheFlags(flags: number): HealthCacheFlags[];
|
|
2188
|
+
/**
|
|
2189
|
+
* Check if a health cache flag is set
|
|
2190
|
+
*/
|
|
2191
|
+
declare function hasHealthCacheFlag(flags: number, flag: HealthCacheFlags): boolean;
|
|
2192
|
+
/**
|
|
2193
|
+
* Convert numeric health cache flags to a human-readable status message
|
|
2194
|
+
*/
|
|
2195
|
+
declare function getHealthCacheStatusDescription(flags: number): string;
|
|
2196
|
+
declare function dtoToLendrAccount(lendrAccountDto: LendrAccountTypeDto): LendrAccountType;
|
|
2197
|
+
declare function dtoToBalance(balanceDto: BalanceTypeDto): BalanceType;
|
|
2198
|
+
declare function dtoToHealthCache(healthCacheDto: HealthCacheTypeDto): HealthCacheType;
|
|
2199
|
+
|
|
2200
|
+
declare function computeEmodeImpacts(emodePairs: EmodePair[], activeLiabilities: PublicKey[], activeCollateral: PublicKey[], allBanks: PublicKey[]): Record<string, ActionEmodeImpact>;
|
|
2201
|
+
declare function computeActiveEmodePairs(emodePairs: EmodePair[], activeLiabilities: PublicKey[], activeCollateral: PublicKey[]): EmodePair[];
|
|
2202
|
+
|
|
2203
|
+
declare const fetchLendrAccountAddresses: (program: LendrProgram, authority: PublicKey, group: PublicKey) => Promise<PublicKey[]>;
|
|
2204
|
+
declare const fetchLendrAccountData: (program: LendrProgram, lendrAccountPk: PublicKey, bankMap: Map<string, Bank>, oraclePrices: Map<string, OraclePrice>, bankMetadataMap: BankMetadataMap) => Promise<{
|
|
2205
|
+
lendrAccount: LendrAccountType;
|
|
2206
|
+
error?: HealthCacheSimulationError;
|
|
2207
|
+
}>;
|
|
2208
|
+
|
|
2209
|
+
/**
|
|
2210
|
+
* Convert numeric flag to BN for Solana compatibility
|
|
2211
|
+
*/
|
|
2212
|
+
declare function accountFlagToBN(flag: AccountFlags): BN;
|
|
2213
|
+
declare function lendrAccountToDto(lendrAccount: LendrAccountType): LendrAccountTypeDto;
|
|
2214
|
+
declare function balanceToDto(balance: BalanceType): BalanceTypeDto;
|
|
2215
|
+
declare function healthCacheToDto(healthCache: HealthCacheType): HealthCacheTypeDto;
|
|
2216
|
+
|
|
2217
|
+
interface FetchRawBanksArgs {
|
|
2218
|
+
program: LendrProgram;
|
|
2219
|
+
groupAddress: PublicKey;
|
|
2220
|
+
logger: TLogger;
|
|
2221
|
+
bankAddresses?: Array<PublicKey>;
|
|
2222
|
+
commitment?: Commitment;
|
|
2223
|
+
}
|
|
2224
|
+
declare class DataFetcher {
|
|
2225
|
+
fetchRawBanks({ program, groupAddress, logger, bankAddresses, commitment }: FetchRawBanksArgs): Promise<{
|
|
2226
|
+
address: PublicKey;
|
|
2227
|
+
data: BankRaw;
|
|
2228
|
+
}[]>;
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
declare function makePoolConfigureBankIx$1(program: LendrProgram, bank: PublicKey, args: BankConfigOptRaw): Promise<InstructionsWrapper>;
|
|
2232
|
+
declare function makeAddPermissionlessStakedBankIx(program: LendrProgram, group: PublicKey, voteAccountAddress: PublicKey, feePayer: PublicKey, pythOracle: PublicKey): Promise<InstructionsWrapper>;
|
|
2233
|
+
declare function makePoolAddBankIx$1(program: LendrProgram, group: PublicKey, bank: PublicKey, feePayer: PublicKey, bankMint: PublicKey, bankConfig: BankConfigOpt, tokenProgram?: PublicKey, overrideOpt?: {
|
|
2234
|
+
admin?: PublicKey;
|
|
2235
|
+
globalFeeWallet?: PublicKey;
|
|
2236
|
+
}): Promise<InstructionsWrapper>;
|
|
2237
|
+
|
|
2238
|
+
type LendrGroupType = {
|
|
2239
|
+
admin: PublicKey;
|
|
2240
|
+
address: PublicKey;
|
|
2241
|
+
};
|
|
2242
|
+
type LendrGroupTypeDto = {
|
|
2243
|
+
admin: string;
|
|
2244
|
+
address: string;
|
|
2245
|
+
};
|
|
2246
|
+
|
|
2247
|
+
interface LendrGroupRaw {
|
|
2248
|
+
admin: PublicKey;
|
|
2249
|
+
padding0: BN[];
|
|
2250
|
+
padding1: BN[];
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
declare function dtoToGroup(groupDto: LendrGroupTypeDto): LendrGroupType;
|
|
2254
|
+
|
|
2255
|
+
declare function groupToDto(group: LendrGroupType): LendrGroupTypeDto;
|
|
2256
|
+
|
|
2257
|
+
declare class DummyMetadataFetcher implements IMetadataFetcher {
|
|
2258
|
+
readonly name = "DummyMetadataFetcher";
|
|
2259
|
+
fetch(mints: Array<string>): Promise<Record<string, {
|
|
2260
|
+
name: string;
|
|
2261
|
+
symbol: string;
|
|
2262
|
+
image: string;
|
|
2263
|
+
uri?: string | undefined;
|
|
2264
|
+
}>>;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
type FogoNetworks = "mainnet" | "testnet";
|
|
2268
|
+
declare class FogoMetadataFetcher implements IMetadataFetcher {
|
|
2269
|
+
network: FogoNetworks;
|
|
2270
|
+
readonly name = "FogoMetadataFetcher";
|
|
2271
|
+
constructor(network?: FogoNetworks);
|
|
2272
|
+
fetch(mints: Array<string>): Promise<Record<string, {
|
|
2273
|
+
name: string;
|
|
2274
|
+
symbol: string;
|
|
2275
|
+
image: string;
|
|
2276
|
+
uri?: string | undefined;
|
|
2277
|
+
}>>;
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
declare class MetaplexMetadataFetcher implements IMetadataFetcher {
|
|
2281
|
+
readonly name = "MetaplexMetadataFetcher";
|
|
2282
|
+
private readonly _umi;
|
|
2283
|
+
constructor(rpcEndpoint: string);
|
|
2284
|
+
fetch(mints: Array<string>): Promise<Record<string, {
|
|
2285
|
+
name: string;
|
|
2286
|
+
symbol: string;
|
|
2287
|
+
image: string;
|
|
2288
|
+
uri?: string | undefined;
|
|
2289
|
+
}>>;
|
|
2290
|
+
private _getImage;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
type ValidatorStakeGroup = {
|
|
2294
|
+
validator: PublicKey;
|
|
2295
|
+
poolKey: PublicKey;
|
|
2296
|
+
poolMintKey: PublicKey;
|
|
2297
|
+
totalStake: number;
|
|
2298
|
+
selectedAccount: {
|
|
2299
|
+
pubkey: PublicKey;
|
|
2300
|
+
amount: number;
|
|
2301
|
+
};
|
|
2302
|
+
accounts: {
|
|
2303
|
+
pubkey: PublicKey;
|
|
2304
|
+
amount: number;
|
|
2305
|
+
}[];
|
|
2306
|
+
};
|
|
2307
|
+
type ValidatorStakeGroupDto = {
|
|
2308
|
+
validator: string;
|
|
2309
|
+
poolKey: string;
|
|
2310
|
+
poolMintKey: string;
|
|
2311
|
+
totalStake: number;
|
|
2312
|
+
selectedAccount: {
|
|
2313
|
+
pubkey: string;
|
|
2314
|
+
amount: number;
|
|
2315
|
+
};
|
|
2316
|
+
accounts: {
|
|
2317
|
+
pubkey: string;
|
|
2318
|
+
amount: number;
|
|
2319
|
+
}[];
|
|
2320
|
+
};
|
|
2321
|
+
type StakeAccount$1 = {
|
|
2322
|
+
discriminant: number;
|
|
2323
|
+
meta: {
|
|
2324
|
+
rentExemptReserve: bigint;
|
|
2325
|
+
authorized: {
|
|
2326
|
+
staker: PublicKey;
|
|
2327
|
+
withdrawer: PublicKey;
|
|
2328
|
+
};
|
|
2329
|
+
lockup: {
|
|
2330
|
+
unixTimestamp: bigint;
|
|
2331
|
+
epoch: bigint;
|
|
2332
|
+
custodian: PublicKey;
|
|
2333
|
+
};
|
|
2334
|
+
};
|
|
2335
|
+
stake: {
|
|
2336
|
+
delegation: {
|
|
2337
|
+
voterPubkey: PublicKey;
|
|
2338
|
+
stake: bigint;
|
|
2339
|
+
activationEpoch: bigint;
|
|
2340
|
+
deactivationEpoch: bigint;
|
|
2341
|
+
};
|
|
2342
|
+
creditsObserved: bigint;
|
|
2343
|
+
};
|
|
2344
|
+
};
|
|
2345
|
+
type StakePoolMevMap = Map<string, {
|
|
2346
|
+
pool: number;
|
|
2347
|
+
onramp: number;
|
|
2348
|
+
}>;
|
|
2349
|
+
type ValidatorRateData = {
|
|
2350
|
+
validator: string;
|
|
2351
|
+
totalApy: number;
|
|
2352
|
+
stakingApy: number;
|
|
2353
|
+
};
|
|
2354
|
+
type ActiveStakePoolMap = Map<string, boolean>;
|
|
2355
|
+
|
|
2356
|
+
declare function dtoToValidatorStakeGroup(validatorStakeGroupDto: ValidatorStakeGroupDto): ValidatorStakeGroup;
|
|
2357
|
+
|
|
2358
|
+
/**
|
|
2359
|
+
* Retrieves all active stake accounts associated with a given public key grouped by validator
|
|
2360
|
+
*
|
|
2361
|
+
* @warning this is an expensive rpc call and should be heavily cached
|
|
2362
|
+
*
|
|
2363
|
+
* @param connection - Solana RPC connection
|
|
2364
|
+
* @param publicKey - Users's public key
|
|
2365
|
+
* @param opts - Options for filtering inactive stake accounts
|
|
2366
|
+
* @returns {Promise<ValidatorStakeGroup[]>} An array of validator stake groups
|
|
2367
|
+
*/
|
|
2368
|
+
declare const fetchNativeStakeAccounts: (connection: Connection, publicKey: PublicKey, opts?: {
|
|
2369
|
+
filterInactive: boolean;
|
|
2370
|
+
}) => Promise<ValidatorStakeGroup[]>;
|
|
2371
|
+
/**
|
|
2372
|
+
* Gets active states for stake pools associated with staked asset banks
|
|
2373
|
+
*
|
|
2374
|
+
* @param connection - Solana RPC connection
|
|
2375
|
+
* @param bankInfos - Array of ExtendedBankInfo objects
|
|
2376
|
+
* @returns Promise<Map<string, boolean>> - Map of bank addresses to active states
|
|
2377
|
+
*/
|
|
2378
|
+
declare const fetchStakePoolActiveStates: (connection: Connection, validatorVoteAccounts: PublicKey[]) => Promise<Map<string, boolean>>;
|
|
2379
|
+
/**
|
|
2380
|
+
* Gets APY rates for validators associated with staked asset banks
|
|
2381
|
+
*
|
|
2382
|
+
* @param validatorVoteAccounts - Array of validator vote account public keys
|
|
2383
|
+
* @returns Promise<Map<string, number>> - Map of bank addresses to APY rates
|
|
2384
|
+
*/
|
|
2385
|
+
declare const fetchStakeAccount: (data: Buffer) => StakeAccount$1;
|
|
2386
|
+
declare const fetchStakePoolMev: (connection: Connection, validatorVoteAccounts: PublicKey[]) => Promise<StakePoolMevMap>;
|
|
2387
|
+
|
|
2388
|
+
declare function validatorStakeGroupToDto(validatorStakeGroup: ValidatorStakeGroup): ValidatorStakeGroupDto;
|
|
2389
|
+
|
|
2390
|
+
interface RpcSimulateBundleTransactionResult {
|
|
2391
|
+
err?: TransactionError;
|
|
2392
|
+
logs: string[];
|
|
2393
|
+
preExecutionAccounts?: any;
|
|
2394
|
+
postExecutionAccounts?: any;
|
|
2395
|
+
unitsConsumed?: string;
|
|
2396
|
+
returnData?: any;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
declare const DEFAULT_PROCESS_TX_OPTS: {
|
|
2400
|
+
broadcastType: TransactionBroadcastType;
|
|
2401
|
+
isSequentialTxs: boolean;
|
|
2402
|
+
isReadOnly: boolean;
|
|
2403
|
+
};
|
|
2404
|
+
interface ProcessTransactionOpts extends ProcessTransactionsClientOpts {
|
|
2405
|
+
isReadOnly?: boolean;
|
|
2406
|
+
programId?: PublicKey;
|
|
2407
|
+
bundleSimRpcEndpoint?: string;
|
|
2408
|
+
addArenaTxTag?: boolean;
|
|
2409
|
+
}
|
|
2410
|
+
type PriorityFees = {
|
|
2411
|
+
bundleTipUi?: number;
|
|
2412
|
+
priorityFeeMicro?: number;
|
|
2413
|
+
maxCapUi?: number;
|
|
2414
|
+
};
|
|
2415
|
+
type BroadcastMethodType = Extract<TransactionBroadcastType, "BUNDLE" | "RPC">;
|
|
2416
|
+
type SpecificBroadcastMethodType = "GRPC_BUNDLE" | "API_BUNDLE" | "RPC_BUNDLE" | "RPC_SEQUENTIAL";
|
|
2417
|
+
type SpecificBroadcastMethod = {
|
|
2418
|
+
method: SpecificBroadcastMethodType;
|
|
2419
|
+
broadcastType: BroadcastMethodType;
|
|
2420
|
+
};
|
|
2421
|
+
type ProcessTransactionStrategy = {
|
|
2422
|
+
splitExecutionsStrategy?: {
|
|
2423
|
+
singleTx: BroadcastMethodType;
|
|
2424
|
+
multiTx: BroadcastMethodType;
|
|
2425
|
+
};
|
|
2426
|
+
fallbackSequence: SpecificBroadcastMethod[];
|
|
2427
|
+
};
|
|
2428
|
+
declare const DEFAULT_PROCESS_TX_STRATEGY: ProcessTransactionStrategy;
|
|
2429
|
+
interface ProcessTransactionsClientOpts extends PriorityFees {
|
|
2430
|
+
broadcastType?: TransactionBroadcastType;
|
|
2431
|
+
dynamicStrategy?: ProcessTransactionStrategy;
|
|
2432
|
+
isSequentialTxs?: boolean;
|
|
2433
|
+
addArenaTxTag?: boolean;
|
|
2434
|
+
callback?: (index?: number, success?: boolean, signature?: string, stepsToAdvance?: number) => void;
|
|
2435
|
+
}
|
|
2436
|
+
type ProcessTransactionsProps = {
|
|
2437
|
+
transactions: SolanaTransaction[];
|
|
2438
|
+
connection: Connection;
|
|
2439
|
+
wallet: Wallet;
|
|
2440
|
+
txOpts?: TransactionOptions;
|
|
2441
|
+
processOpts?: ProcessTransactionOpts;
|
|
2442
|
+
};
|
|
2443
|
+
/**
|
|
2444
|
+
* Processes a batch of Solana transactions by signing, simulating, and sending them to the network.
|
|
2445
|
+
*
|
|
2446
|
+
* @param {ProcessTransactionsProps} props - The properties required to process transactions.
|
|
2447
|
+
* @param {SolanaTransaction[]} props.transactions - The transactions to be processed.
|
|
2448
|
+
* @param {Connection} props.connection - The connection to the Solana network.
|
|
2449
|
+
* @param {Wallet} props.wallet - The wallet used to sign the transactions.
|
|
2450
|
+
* @param {ProcessTransactionOpts} [props.processOpts] - Optional processing options.
|
|
2451
|
+
* @param {TransactionOptions} [props.txOpts] - Optional transaction options.
|
|
2452
|
+
*
|
|
2453
|
+
* @returns {Promise<TransactionSignature[]>} - A promise that resolves to an array of transaction signatures.
|
|
2454
|
+
*
|
|
2455
|
+
* @throws {ProcessTransactionError} - Throws an error if transaction processing fails.
|
|
2456
|
+
*/
|
|
2457
|
+
declare function processTransactions({ transactions, connection, wallet, processOpts: processOptsArgs, txOpts, }: ProcessTransactionsProps): Promise<TransactionSignature[]>;
|
|
2458
|
+
declare const simulateTransactions: (processOpts: ProcessTransactionOpts, connection: Connection, solanaTransactions: VersionedTransaction[] | Transaction[] | SolanaTransaction[], confirmOpts?: ConfirmOptions, txOpts?: {
|
|
2459
|
+
feePayer: PublicKey;
|
|
2460
|
+
blockhash: string;
|
|
2461
|
+
}) => Promise<SimulatedTransactionResponse | RpcSimulateBundleTransactionResult[]>;
|
|
2462
|
+
declare function confirmTransaction(connection: Connection, signature: string, commitment?: Commitment): Promise<_solana_web3_js.SignatureStatus>;
|
|
2463
|
+
|
|
2464
|
+
type BankMap = Map<string, Bank>;
|
|
2465
|
+
type OraclePriceMap = Map<string, OraclePrice>;
|
|
2466
|
+
type MintDataMap = Map<string, MintData>;
|
|
2467
|
+
type MintData = {
|
|
2468
|
+
mint: PublicKey;
|
|
2469
|
+
tokenProgram: PublicKey;
|
|
2470
|
+
feeBps: number;
|
|
2471
|
+
emissionTokenProgram: PublicKey | null;
|
|
2472
|
+
};
|
|
2473
|
+
type FetchGroupDataFn = (props: {
|
|
2474
|
+
connection: Connection;
|
|
2475
|
+
program: LendrProgram;
|
|
2476
|
+
groupAddress: PublicKey;
|
|
2477
|
+
logger?: TLogger;
|
|
2478
|
+
commitment?: Commitment;
|
|
2479
|
+
overrideBankAddresses?: PublicKey[];
|
|
2480
|
+
overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;
|
|
2481
|
+
metadataService: MetadataService;
|
|
2482
|
+
dataFetcher: DataFetcher;
|
|
2483
|
+
}) => Promise<{
|
|
2484
|
+
lendrGroup: LendrGroup;
|
|
2485
|
+
banks: Map<string, Bank>;
|
|
2486
|
+
priceInfos: Map<string, OraclePrice>;
|
|
2487
|
+
tokensData: Map<string, MintData>;
|
|
2488
|
+
feedIdMap: PythPushFeedIdMap;
|
|
2489
|
+
banksExtendedMetadata: BankExtendedMetadataMap;
|
|
2490
|
+
}>;
|
|
2491
|
+
type LendrClientOptions = {
|
|
2492
|
+
confirmOpts?: ConfirmOptions;
|
|
2493
|
+
readOnly?: boolean;
|
|
2494
|
+
overrideBankAddresses?: PublicKey[];
|
|
2495
|
+
overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;
|
|
2496
|
+
bundleSimRpcEndpoint?: string;
|
|
2497
|
+
processTransactionStrategy?: ProcessTransactionStrategy;
|
|
2498
|
+
fetchGroupDataOverride?: FetchGroupDataFn;
|
|
2499
|
+
addressLookupTableAddresses?: PublicKey[];
|
|
2500
|
+
logger?: TLogger;
|
|
2501
|
+
storage?: Storage;
|
|
2502
|
+
metadataFetchers?: Array<IMetadataFetcher>;
|
|
2503
|
+
dataFetcher?: DataFetcher;
|
|
2504
|
+
};
|
|
2505
|
+
interface LendrClientFetchOptions {
|
|
2506
|
+
wallet: Wallet;
|
|
2507
|
+
connection: Connection;
|
|
2508
|
+
clientOptions?: LendrClientOptions;
|
|
2509
|
+
config?: LendrConfig;
|
|
2510
|
+
}
|
|
2511
|
+
interface LendrClientProps {
|
|
2512
|
+
readonly config?: LendrConfig;
|
|
2513
|
+
readonly program: LendrProgram;
|
|
2514
|
+
readonly wallet: Wallet;
|
|
2515
|
+
readonly isReadOnly: boolean;
|
|
2516
|
+
group: LendrGroup;
|
|
2517
|
+
banks: BankMap;
|
|
2518
|
+
priceInfos: OraclePriceMap;
|
|
2519
|
+
mintDatas: MintDataMap;
|
|
2520
|
+
feedIdMap: PythPushFeedIdMap;
|
|
2521
|
+
addressLookupTables?: AddressLookupTableAccount[];
|
|
2522
|
+
processTransactionStrategy?: ProcessTransactionStrategy;
|
|
2523
|
+
lookupTablesAddresses?: Array<PublicKey>;
|
|
2524
|
+
readonly overrideBankAddresses?: PublicKey[];
|
|
2525
|
+
readonly overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;
|
|
2526
|
+
readonly bankMetadataMap?: BankMetadataMap;
|
|
2527
|
+
metadataService: MetadataService;
|
|
2528
|
+
bundleSimRpcEndpoint?: string;
|
|
2529
|
+
logger?: TLogger;
|
|
2530
|
+
storage?: Storage;
|
|
2531
|
+
dataFetcher?: DataFetcher;
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* Entrypoint to interact with the lendr contract.
|
|
2535
|
+
*/
|
|
2536
|
+
declare class LendrClient {
|
|
2537
|
+
readonly program: LendrProgram;
|
|
2538
|
+
readonly wallet: Wallet;
|
|
2539
|
+
readonly config: LendrConfig;
|
|
2540
|
+
readonly isReadOnly: boolean;
|
|
2541
|
+
readonly logger: TLogger;
|
|
2542
|
+
group: LendrGroup;
|
|
2543
|
+
banks: BankMap;
|
|
2544
|
+
oraclePrices: OraclePriceMap;
|
|
2545
|
+
mintDatas: MintDataMap;
|
|
2546
|
+
addressLookupTables: AddressLookupTableAccount[];
|
|
2547
|
+
lookupTablesAddresses: PublicKey[];
|
|
2548
|
+
feedIdMap: PythPushFeedIdMap;
|
|
2549
|
+
processTransactionStrategy?: ProcessTransactionStrategy;
|
|
2550
|
+
private readonly bundleSimRpcEndpoint;
|
|
2551
|
+
bankMetadataMap?: BankMetadataMap;
|
|
2552
|
+
readonly overrideBankAddresses?: Array<PublicKey>;
|
|
2553
|
+
readonly overrideBanksMetadata?: BanksExtendedMetadataOverrideMap;
|
|
2554
|
+
readonly metadataService: MetadataService;
|
|
2555
|
+
readonly storage: Storage;
|
|
2556
|
+
readonly dataFetcher: DataFetcher;
|
|
2557
|
+
constructor({ program, wallet, config, isReadOnly, group, banks, priceInfos, mintDatas, addressLookupTables, feedIdMap, logger, bankMetadataMap, overrideBanksMetadata, overrideBankAddresses, bundleSimRpcEndpoint, processTransactionStrategy, lookupTablesAddresses, storage, metadataService, dataFetcher, }: LendrClientProps);
|
|
2558
|
+
/**
|
|
2559
|
+
* LendrClient factory
|
|
2560
|
+
*
|
|
2561
|
+
* Fetch account data according to the config and instantiate the corresponding LendrAccount.
|
|
2562
|
+
*
|
|
2563
|
+
* @param config lendr config
|
|
2564
|
+
* @param wallet User wallet (used to pay fees and sign transactions)
|
|
2565
|
+
* @param connection Solana web.js Connection object
|
|
2566
|
+
* @param clientOptions optional client options
|
|
2567
|
+
* @returns LendrClient instance
|
|
2568
|
+
*/
|
|
2569
|
+
static fetch({ wallet, connection, clientOptions, config }: LendrClientFetchOptions): Promise<LendrClient>;
|
|
2570
|
+
/**
|
|
2571
|
+
* Fetches address lookup tables from the provided addresses
|
|
2572
|
+
* @param connection The Solana connection
|
|
2573
|
+
* @param addressLookupTableAddresses Optional array of address lookup table addresses to fetch
|
|
2574
|
+
* @param logger Optional logger
|
|
2575
|
+
* @returns Array of address lookup table accounts
|
|
2576
|
+
*/
|
|
2577
|
+
private static fetchAddressLookupTables;
|
|
2578
|
+
/**
|
|
2579
|
+
* Fetches all data for a group, including banks and oracle prices
|
|
2580
|
+
* NOTE: If bankAddresses not provided, this will make 2 RPC calls
|
|
2581
|
+
* @param connection
|
|
2582
|
+
* @param program The Lendr program
|
|
2583
|
+
* @param groupAddress The address of the group
|
|
2584
|
+
* @param logger Optional logger
|
|
2585
|
+
* @param commitment Transaction commitment level
|
|
2586
|
+
* @param overrideBankAddresses Optional list of bank addresses to fetch
|
|
2587
|
+
* @param overrideBanksMetadata Optional bank metadata for overriding on-chain metadata
|
|
2588
|
+
* @param metadataService Metadata service for fetching mint metadata
|
|
2589
|
+
* @returns Lending group data, banks, and oracle prices
|
|
2590
|
+
*/
|
|
2591
|
+
static fetchGroupData: FetchGroupDataFn;
|
|
2592
|
+
reload(): Promise<void>;
|
|
2593
|
+
get groupAddress(): PublicKey;
|
|
2594
|
+
get provider(): AnchorProvider;
|
|
2595
|
+
get programId(): PublicKey;
|
|
2596
|
+
getAllLendrAccountPubkeys(): Promise<PublicKey[]>;
|
|
2597
|
+
/**
|
|
2598
|
+
* Fetches multiple lendr accounts based on an array of public keys using the getMultipleAccounts RPC call.
|
|
2599
|
+
*
|
|
2600
|
+
* @param pubkeys - The public keys of the lendr accounts to fetch.
|
|
2601
|
+
* @returns An array of LendrAccountWrapper instances.
|
|
2602
|
+
*/
|
|
2603
|
+
getMultipleLendrAccounts(pubkeys: PublicKey[]): Promise<LendrAccountWrapper[]>;
|
|
2604
|
+
/**
|
|
2605
|
+
* Retrieves the addresses of all lendr accounts in the underlying group.
|
|
2606
|
+
*
|
|
2607
|
+
* @returns Account addresses
|
|
2608
|
+
*/
|
|
2609
|
+
getAllLendrAccountAddresses(): Promise<PublicKey[]>;
|
|
2610
|
+
/**
|
|
2611
|
+
* Retrieves all lendr accounts under the specified authority.
|
|
2612
|
+
*
|
|
2613
|
+
* @returns LendrAccount instances
|
|
2614
|
+
*/
|
|
2615
|
+
getLendrAccountsForAuthority(authority?: Address): Promise<LendrAccountWrapper[]>;
|
|
2616
|
+
/**
|
|
2617
|
+
* Retrieves the addresses of all accounts owned by the lendr program.
|
|
2618
|
+
*
|
|
2619
|
+
* @returns Account addresses
|
|
2620
|
+
*/
|
|
2621
|
+
getAllProgramAccountAddresses(_type: AccountType$1): Promise<PublicKey[]>;
|
|
2622
|
+
getBankByPk(bankAddress: Address): Bank | null;
|
|
2623
|
+
getBankByMint(mint: Address): Bank | null;
|
|
2624
|
+
getBankByTokenSymbol(tokenSymbol: string): Bank | null;
|
|
2625
|
+
getOraclePriceByBank(bankAddress: Address): OraclePrice | null;
|
|
2626
|
+
/**
|
|
2627
|
+
* Create transaction instruction to create a new lendr account under the authority of the user.
|
|
2628
|
+
*
|
|
2629
|
+
* @returns transaction instruction
|
|
2630
|
+
*/
|
|
2631
|
+
makeCreateLendrAccountIx(lendrAccountPk: PublicKey): Promise<InstructionsWrapper>;
|
|
2632
|
+
makeCreateLendrAccountWithSessionIx(session: EstablishedSessionState, accountIndex: number, thirdPartyId?: number): Promise<InstructionsWrapper>;
|
|
2633
|
+
/**
|
|
2634
|
+
* Create a new lendr account under the authority of the user.
|
|
2635
|
+
*
|
|
2636
|
+
* @param createOpts - Options for creating the account
|
|
2637
|
+
* @param createOpts.newAccountKey - Optional public key to use for the new account. If not provided, a new keypair will be generated.
|
|
2638
|
+
* @param processOpts - Options for processing the transaction
|
|
2639
|
+
* @param txOpts - Transaction options
|
|
2640
|
+
* @returns Object containing the transaction signature and the created LendrAccount instance
|
|
2641
|
+
*/
|
|
2642
|
+
createLendrAccount(createOpts?: {
|
|
2643
|
+
newAccountKey?: PublicKey | undefined;
|
|
2644
|
+
}, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<LendrAccountWrapper>;
|
|
2645
|
+
/**
|
|
2646
|
+
* Create a new lendr account under the authority of the user using fogo session.
|
|
2647
|
+
*
|
|
2648
|
+
* @param session - Session object in Established state
|
|
2649
|
+
* @param commitment - desired commitment level
|
|
2650
|
+
* @param customAccountSeed - undefined/null/0 for canonical lendr account in a group; positive for multi-accounts.
|
|
2651
|
+
*
|
|
2652
|
+
* @returns Object containing the transaction signature and the created LendrAccount instance
|
|
2653
|
+
*/
|
|
2654
|
+
createLendrAccountWithSession(session: EstablishedSessionState, commitment?: Commitment, accountIndex?: number, thirdPartyId?: number): Promise<{
|
|
2655
|
+
account: LendrAccountWrapper | null;
|
|
2656
|
+
accountPublicKey: PublicKey;
|
|
2657
|
+
result: TransactionResult;
|
|
2658
|
+
}>;
|
|
2659
|
+
/**
|
|
2660
|
+
* Create a transaction to initialize a new lendr account under the authority of the user.
|
|
2661
|
+
*
|
|
2662
|
+
* @param createOpts - Options for creating the account
|
|
2663
|
+
* @param createOpts.newAccountKey - Optional public key to use for the new account. If not provided, a new keypair will be generated.
|
|
2664
|
+
* @returns Transaction that can be used to create a new lendr account
|
|
2665
|
+
*/
|
|
2666
|
+
createLendrAccountTx(createOpts?: {
|
|
2667
|
+
accountKeypair?: Keypair;
|
|
2668
|
+
}): Promise<SolanaTransaction>;
|
|
2669
|
+
getLatestBlockHashForSure(): Promise<string>;
|
|
2670
|
+
createVersionTransaction(instructions: TransactionInstruction[], payerKey: PublicKey, signers?: Array<Signer>, extraMetaData?: ExtendedTransactionProperties): Promise<VersionedTransaction>;
|
|
2671
|
+
createLendrAccountWithSessionTx(session: EstablishedSessionState, accountIndex: number, thirdPartyId?: number): Promise<VersionedTransaction>;
|
|
2672
|
+
/**
|
|
2673
|
+
* Create transaction instruction to initialize a new group.
|
|
2674
|
+
*
|
|
2675
|
+
* @returns transaction instruction
|
|
2676
|
+
*/
|
|
2677
|
+
makeCreateLendrGroupIx(lendrGroup: PublicKey): Promise<InstructionsWrapper>;
|
|
2678
|
+
/**
|
|
2679
|
+
* Initiates a new permissionless lendr bank under the authority of the user.
|
|
2680
|
+
*
|
|
2681
|
+
* @param {Object} params - The parameters for creating a permissionless bank.
|
|
2682
|
+
* @param {PublicKey} params.mint - The public key of the mint for the bank.
|
|
2683
|
+
* @param {BankConfigOpt} params.bankConfig - The configuration options for the bank.
|
|
2684
|
+
* @param {PublicKey} params.group - The public key of the group to which the bank belongs.
|
|
2685
|
+
* @param {PublicKey} params.admin - The public key of the admin who will have authority over the bank.
|
|
2686
|
+
* @param {Keypair} [params.seed] - An optional keypair used as a seed for generating the bank account.
|
|
2687
|
+
* @param {TransactionOptions} [params.txOpts] - Optional transaction options for processing.
|
|
2688
|
+
* @param {ProcessTransactionsClientOpts} [params.processOpts] - Optional processing options for transactions.
|
|
2689
|
+
* @returns {Promise<TransactionSignature>} A promise that resolves to the transaction signature as a string.
|
|
2690
|
+
*/
|
|
2691
|
+
createPermissionlessBank({ mint, bankConfig, group: _group, admin, seed, txOpts, processOpts, }: {
|
|
2692
|
+
mint: PublicKey;
|
|
2693
|
+
bankConfig: BankConfigOpt;
|
|
2694
|
+
group: PublicKey;
|
|
2695
|
+
admin: PublicKey;
|
|
2696
|
+
seed?: Keypair;
|
|
2697
|
+
processOpts?: ProcessTransactionsClientOpts;
|
|
2698
|
+
txOpts?: TransactionOptions;
|
|
2699
|
+
}): Promise<TransactionSignature>;
|
|
2700
|
+
/**
|
|
2701
|
+
* Initializes a new lendr group with the specified parameters.
|
|
2702
|
+
*
|
|
2703
|
+
* @param seed - Optional keypair used for generating the group account.
|
|
2704
|
+
* @param additionalIxs - Optional array of additional transaction instructions to include.
|
|
2705
|
+
* @param txOpts - Optional transaction options for processing.
|
|
2706
|
+
* @param processOpts - Optional processing options for transactions.
|
|
2707
|
+
* @returns The public key of the newly created lendr group.
|
|
2708
|
+
*/
|
|
2709
|
+
createLendrGroup(seed?: Keypair, additionalIxs?: TransactionInstruction[], processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<PublicKey>;
|
|
2710
|
+
/**
|
|
2711
|
+
* Create a new bank under the authority of the user.
|
|
2712
|
+
*
|
|
2713
|
+
* @param bankMint - The public key of the token mint for the bank.
|
|
2714
|
+
* @param bankConfig - Configuration options for the bank.
|
|
2715
|
+
* @param seed - Optional keypair for the bank.
|
|
2716
|
+
* @param txOpts - Optional transaction options for processing.
|
|
2717
|
+
* @param processOpts - Optional processing options for transactions.
|
|
2718
|
+
* @returns The bank's public key and the transaction signature
|
|
2719
|
+
*/
|
|
2720
|
+
createLendingPool(bankMint: PublicKey, bankConfig: BankConfigOpt, seed?: Keypair, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<{
|
|
2721
|
+
bankAddress: PublicKey;
|
|
2722
|
+
signature: TransactionSignature;
|
|
2723
|
+
}>;
|
|
2724
|
+
/**
|
|
2725
|
+
* Processes multiple Solana transactions by signing and sending them to the network.
|
|
2726
|
+
*
|
|
2727
|
+
* @param {SolanaTransaction[]} transactions - An array of transactions to be processed.
|
|
2728
|
+
* @param {ProcessTransactionsClientOpts} [processOpts] - Optional processing options for transactions.
|
|
2729
|
+
* @param {TransactionOptions} [txOpts] - Optional transaction options for processing.
|
|
2730
|
+
*
|
|
2731
|
+
* @returns {Promise<TransactionSignature[]>} - A promise that resolves to an array of transaction signatures.
|
|
2732
|
+
*
|
|
2733
|
+
* @throws {ProcessTransactionError} - Throws an error if transaction processing fails.
|
|
2734
|
+
*/
|
|
2735
|
+
processTransactions(transactions: SolanaTransaction[], processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature[]>;
|
|
2736
|
+
/**
|
|
2737
|
+
* Processes a single Solana transaction by signing and sending it to the network.
|
|
2738
|
+
*
|
|
2739
|
+
* @param {SolanaTransaction} transaction - The transaction to be processed.
|
|
2740
|
+
* @param {TransactionOptions} [txOpts] - Optional transaction options.
|
|
2741
|
+
* @param {ProcessTransactionsClientOpts} [processOpts] - Optional processing options.
|
|
2742
|
+
*
|
|
2743
|
+
* @returns {Promise<TransactionSignature>} - A promise that resolves to the transaction signature.
|
|
2744
|
+
*
|
|
2745
|
+
* @throws {ProcessTransactionError} - Throws an error if transaction processing fails.
|
|
2746
|
+
*/
|
|
2747
|
+
processTransaction(transaction: SolanaTransaction, processOpts?: ProcessTransactionsClientOpts, txOpts?: TransactionOptions): Promise<TransactionSignature>;
|
|
2748
|
+
simulateTransactions(transactions: (Transaction | VersionedTransaction)[], accountsToInspect: PublicKey[]): Promise<(Buffer | null)[]>;
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
declare function makeInitLendrAccountIx(ldProgram: LendrProgram, accounts: {
|
|
2752
|
+
lendrGroup: PublicKey;
|
|
2753
|
+
lendrAccount: PublicKey;
|
|
2754
|
+
authority: PublicKey;
|
|
2755
|
+
feePayer: PublicKey;
|
|
2756
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2757
|
+
declare function makeInitLendrAccountWithSessionIx(ldProgram: LendrProgram, { lendrGroup, session, feePayer, }: {
|
|
2758
|
+
lendrGroup: PublicKey;
|
|
2759
|
+
session: EstablishedSessionState;
|
|
2760
|
+
feePayer: PublicKey;
|
|
2761
|
+
}, accountIndex: number, thirdPartyId?: number): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2762
|
+
declare function makeDepositIx(ldProgram: LendrProgram, accounts: {
|
|
2763
|
+
lendrAccount: PublicKey;
|
|
2764
|
+
signerTokenAccount: PublicKey;
|
|
2765
|
+
bank: PublicKey;
|
|
2766
|
+
tokenProgram: PublicKey;
|
|
2767
|
+
group?: PublicKey;
|
|
2768
|
+
authority?: PublicKey;
|
|
2769
|
+
liquidityVault?: PublicKey;
|
|
2770
|
+
}, args: {
|
|
2771
|
+
amount: BN;
|
|
2772
|
+
depositUpToLimit?: boolean;
|
|
2773
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2774
|
+
declare function makeDepositWithSessionIx(ldProgram: LendrProgram, accounts: LendingAccountDepositOrRepayWithSessionAccounts, args: {
|
|
2775
|
+
amount: BN;
|
|
2776
|
+
depositUpToLimit?: boolean;
|
|
2777
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2778
|
+
declare function makeRepayIx(ldProgram: LendrProgram, accounts: {
|
|
2779
|
+
lendrAccount: PublicKey;
|
|
2780
|
+
signerTokenAccount: PublicKey;
|
|
2781
|
+
bank: PublicKey;
|
|
2782
|
+
tokenProgram: PublicKey;
|
|
2783
|
+
group?: PublicKey;
|
|
2784
|
+
authority?: PublicKey;
|
|
2785
|
+
liquidityVault?: PublicKey;
|
|
2786
|
+
}, args: {
|
|
2787
|
+
amount: BN;
|
|
2788
|
+
repayAll?: boolean;
|
|
2789
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2790
|
+
declare function makeRepayWithSessionIx(ldProgram: LendrProgram, accounts: LendingAccountDepositOrRepayWithSessionAccounts, args: {
|
|
2791
|
+
amount: BN;
|
|
2792
|
+
repayAll?: boolean;
|
|
2793
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2794
|
+
declare function makeWithdrawIx(ldProgram: LendrProgram, accounts: {
|
|
2795
|
+
lendrAccount: PublicKey;
|
|
2796
|
+
bank: PublicKey;
|
|
2797
|
+
destinationTokenAccount: PublicKey;
|
|
2798
|
+
tokenProgram: PublicKey;
|
|
2799
|
+
group?: PublicKey;
|
|
2800
|
+
authority?: PublicKey;
|
|
2801
|
+
bankLiquidityVaultAuthority?: PublicKey;
|
|
2802
|
+
liquidityVault?: PublicKey;
|
|
2803
|
+
}, args: {
|
|
2804
|
+
amount: BN;
|
|
2805
|
+
withdrawAll?: boolean;
|
|
2806
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2807
|
+
declare function makeWithdrawWithSessionIx(ldProgram: LendrProgram, accounts: LendingAccountWithdrawOrBorrowWithSessionAccounts, args: {
|
|
2808
|
+
amount: BN;
|
|
2809
|
+
withdrawAll?: boolean;
|
|
2810
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2811
|
+
declare function makeBorrowIx(ldProgram: LendrProgram, accounts: {
|
|
2812
|
+
lendrAccount: PublicKey;
|
|
2813
|
+
bank: PublicKey;
|
|
2814
|
+
destinationTokenAccount: PublicKey;
|
|
2815
|
+
tokenProgram: PublicKey;
|
|
2816
|
+
group?: PublicKey;
|
|
2817
|
+
authority?: PublicKey;
|
|
2818
|
+
bankLiquidityVaultAuthority?: PublicKey;
|
|
2819
|
+
liquidityVault?: PublicKey;
|
|
2820
|
+
}, args: {
|
|
2821
|
+
amount: BN;
|
|
2822
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2823
|
+
declare function makeBorrowWithSessionIx(ldProgram: LendrProgram, accounts: LendingAccountWithdrawOrBorrowWithSessionAccounts, args: {
|
|
2824
|
+
amount: BN;
|
|
2825
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2826
|
+
declare function makeLendingAccountLiquidateIx(ldrProgram: LendrProgram, accounts: {
|
|
2827
|
+
assetBank: PublicKey;
|
|
2828
|
+
liabBank: PublicKey;
|
|
2829
|
+
liquidatorLendrAccount: PublicKey;
|
|
2830
|
+
liquidateeLendrAccount: PublicKey;
|
|
2831
|
+
tokenProgram: PublicKey;
|
|
2832
|
+
group?: PublicKey;
|
|
2833
|
+
authority?: PublicKey;
|
|
2834
|
+
}, args: {
|
|
2835
|
+
assetAmount: BN;
|
|
2836
|
+
liquidateeAccounts: number;
|
|
2837
|
+
liquidatorAccounts: number;
|
|
2838
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2839
|
+
declare function makelendingAccountWithdrawEmissionIx(ldrProgram: LendrProgram, accounts: {
|
|
2840
|
+
lendrAccount: PublicKey;
|
|
2841
|
+
destinationAccount: PublicKey;
|
|
2842
|
+
bank: PublicKey;
|
|
2843
|
+
tokenProgram: PublicKey;
|
|
2844
|
+
group?: PublicKey;
|
|
2845
|
+
authority?: PublicKey;
|
|
2846
|
+
emissionsMint?: PublicKey;
|
|
2847
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2848
|
+
declare function makePoolConfigureBankIx(ldrProgram: LendrProgram, accounts: {
|
|
2849
|
+
bank: PublicKey;
|
|
2850
|
+
group?: PublicKey;
|
|
2851
|
+
admin?: PublicKey;
|
|
2852
|
+
}, args: {
|
|
2853
|
+
bankConfigOpt: BankConfigOptRaw;
|
|
2854
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2855
|
+
declare function makeBeginFlashLoanIx(ldrProgram: LendrProgram, accounts: {
|
|
2856
|
+
lendrAccount: PublicKey;
|
|
2857
|
+
authority?: PublicKey;
|
|
2858
|
+
ixsSysvar?: PublicKey;
|
|
2859
|
+
}, args: {
|
|
2860
|
+
endIndex: BN;
|
|
2861
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2862
|
+
declare function makeBeginFlashLoanWithSessionIx(ldrProgram: LendrProgram, accounts: {
|
|
2863
|
+
sessionKey: PublicKey;
|
|
2864
|
+
lendrAccount: PublicKey;
|
|
2865
|
+
ixsSysvar?: PublicKey;
|
|
2866
|
+
}, args: {
|
|
2867
|
+
endIndex: BN;
|
|
2868
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2869
|
+
declare function makeEndFlashLoanIx(ldrProgram: LendrProgram, accounts: {
|
|
2870
|
+
lendrAccount: PublicKey;
|
|
2871
|
+
authority?: PublicKey;
|
|
2872
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2873
|
+
declare function makeEndFlashLoanWithSessionIx(ldrProgram: LendrProgram, accounts: {
|
|
2874
|
+
sessionKey: PublicKey;
|
|
2875
|
+
lendrAccount: PublicKey;
|
|
2876
|
+
}, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2877
|
+
declare function makeGroupInitIx(ldProgram: LendrProgram, accounts: {
|
|
2878
|
+
lendrGroup: PublicKey;
|
|
2879
|
+
admin: PublicKey;
|
|
2880
|
+
}, args?: {
|
|
2881
|
+
isArenaGroup?: boolean;
|
|
2882
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2883
|
+
/**
|
|
2884
|
+
* Configure the oracle for a bank
|
|
2885
|
+
* @param ldProgram The lendr program
|
|
2886
|
+
* @param accounts The accounts required for this instruction
|
|
2887
|
+
* @param args The oracle setup index and feed id
|
|
2888
|
+
* @param remainingAccounts The remaining accounts required for this instruction, should include the feed oracle key
|
|
2889
|
+
*/
|
|
2890
|
+
declare function makeLendingPoolConfigureBankOracleIx(ldProgram: LendrProgram, accounts: {
|
|
2891
|
+
bank: PublicKey;
|
|
2892
|
+
group?: PublicKey;
|
|
2893
|
+
admin?: PublicKey;
|
|
2894
|
+
}, args: {
|
|
2895
|
+
/**
|
|
2896
|
+
* The oracle setup index, see {@link serializeOracleSetupToIndex}
|
|
2897
|
+
*/
|
|
2898
|
+
setup: number;
|
|
2899
|
+
/**
|
|
2900
|
+
* The oracle feed id
|
|
2901
|
+
*/
|
|
2902
|
+
feedId: PublicKey;
|
|
2903
|
+
},
|
|
2904
|
+
/**
|
|
2905
|
+
* The remaining accounts required for this instruction, should include the feed oracle key (non writable & signable)
|
|
2906
|
+
*/
|
|
2907
|
+
remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2908
|
+
declare function makeLendingAccountSettleEmissionsIx(ldrProgram: LendrProgram, accounts: {
|
|
2909
|
+
lendrAccount: PublicKey;
|
|
2910
|
+
bank: PublicKey;
|
|
2911
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2912
|
+
/**
|
|
2913
|
+
* Creates an instruction to add a permissionless staked bank to a lending pool.
|
|
2914
|
+
* @param ldProgram - The lendr program instance
|
|
2915
|
+
* @param accounts - The accounts required for this instruction
|
|
2916
|
+
* @param remainingAccounts - The remaining accounts required for this instruction, including pythOracle, solPool and bankMint
|
|
2917
|
+
* @param args - Optional arguments for this instruction
|
|
2918
|
+
*/
|
|
2919
|
+
declare function makePoolAddPermissionlessStakedBankIx(ldProgram: LendrProgram, accounts: {
|
|
2920
|
+
stakedSettings: PublicKey;
|
|
2921
|
+
feePayer: PublicKey;
|
|
2922
|
+
bankMint: PublicKey;
|
|
2923
|
+
solPool: PublicKey;
|
|
2924
|
+
stakePool: PublicKey;
|
|
2925
|
+
lendrGroup?: PublicKey;
|
|
2926
|
+
/**
|
|
2927
|
+
* The token program to use for this instruction, defaults to the SPL token program
|
|
2928
|
+
*/
|
|
2929
|
+
tokenProgram?: PublicKey;
|
|
2930
|
+
},
|
|
2931
|
+
/**
|
|
2932
|
+
* The remaining accounts required for this instruction. Should include:
|
|
2933
|
+
* - pythOracle: The pyth oracle key (non writable & non signer)
|
|
2934
|
+
* - solPool: The sol pool key (non writable & non signer)
|
|
2935
|
+
* - bankMint: The bank mint key (non writable & non signer)
|
|
2936
|
+
*/
|
|
2937
|
+
remainingAccounts: AccountMeta[], args: {
|
|
2938
|
+
/**
|
|
2939
|
+
* The seed to use for the bank account. Defaults to 0 (new BN(0)).
|
|
2940
|
+
* If the seed is not specified, the seed is set to 0, and the bank account
|
|
2941
|
+
* will be created at the address {@link findPoolAddress} with the default
|
|
2942
|
+
* bump.
|
|
2943
|
+
*/
|
|
2944
|
+
seed?: BN;
|
|
2945
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2946
|
+
declare function makePoolAddBankIx(ldProgram: LendrProgram, accounts: {
|
|
2947
|
+
lendrGroup: PublicKey;
|
|
2948
|
+
feePayer: PublicKey;
|
|
2949
|
+
bankMint: PublicKey;
|
|
2950
|
+
bank: PublicKey;
|
|
2951
|
+
tokenProgram: PublicKey;
|
|
2952
|
+
admin?: PublicKey;
|
|
2953
|
+
globalFeeWallet?: PublicKey;
|
|
2954
|
+
}, args: {
|
|
2955
|
+
bankConfig: BankConfigCompactRaw;
|
|
2956
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2957
|
+
declare function makeCloseAccountIx(ldProgram: LendrProgram, accounts: {
|
|
2958
|
+
lendrAccount: PublicKey;
|
|
2959
|
+
feePayer: PublicKey;
|
|
2960
|
+
authority?: PublicKey;
|
|
2961
|
+
}): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2962
|
+
declare function makePulseHealthIx(ldProgram: LendrProgram, accounts: {
|
|
2963
|
+
lendrAccount: PublicKey;
|
|
2964
|
+
},
|
|
2965
|
+
/**
|
|
2966
|
+
* The remaining accounts required for this instruction. Should include:
|
|
2967
|
+
* - For each balance the user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>
|
|
2968
|
+
*/
|
|
2969
|
+
remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
|
|
2970
|
+
declare const instructions: {
|
|
2971
|
+
makeDepositIx: typeof makeDepositIx;
|
|
2972
|
+
makeDepositWithSessionIx: typeof makeDepositWithSessionIx;
|
|
2973
|
+
makeRepayIx: typeof makeRepayIx;
|
|
2974
|
+
makeRepayWithSessionIx: typeof makeRepayWithSessionIx;
|
|
2975
|
+
makeWithdrawIx: typeof makeWithdrawIx;
|
|
2976
|
+
makeWithdrawWithSessionIx: typeof makeWithdrawWithSessionIx;
|
|
2977
|
+
makeBorrowIx: typeof makeBorrowIx;
|
|
2978
|
+
makeBorrowWithSessionIx: typeof makeBorrowWithSessionIx;
|
|
2979
|
+
makeInitLendrAccountIx: typeof makeInitLendrAccountIx;
|
|
2980
|
+
makeInitLendrAccountWithSessionIx: typeof makeInitLendrAccountWithSessionIx;
|
|
2981
|
+
makeLendingAccountLiquidateIx: typeof makeLendingAccountLiquidateIx;
|
|
2982
|
+
makelendingAccountWithdrawEmissionIx: typeof makelendingAccountWithdrawEmissionIx;
|
|
2983
|
+
makePoolAddBankIx: typeof makePoolAddBankIx;
|
|
2984
|
+
makePoolConfigureBankIx: typeof makePoolConfigureBankIx;
|
|
2985
|
+
makeBeginFlashLoanIx: typeof makeBeginFlashLoanIx;
|
|
2986
|
+
makeBeginFlashLoanWithSessionIx: typeof makeBeginFlashLoanWithSessionIx;
|
|
2987
|
+
makeEndFlashLoanIx: typeof makeEndFlashLoanIx;
|
|
2988
|
+
makeEndFlashLoanWithSessionIx: typeof makeEndFlashLoanWithSessionIx;
|
|
2989
|
+
makeGroupInitIx: typeof makeGroupInitIx;
|
|
2990
|
+
makeCloseAccountIx: typeof makeCloseAccountIx;
|
|
2991
|
+
makePoolAddPermissionlessStakedBankIx: typeof makePoolAddPermissionlessStakedBankIx;
|
|
2992
|
+
makeLendingPoolConfigureBankOracleIx: typeof makeLendingPoolConfigureBankOracleIx;
|
|
2993
|
+
makePulseHealthIx: typeof makePulseHealthIx;
|
|
2994
|
+
makeLendingAccountSettleEmissionsIx: typeof makeLendingAccountSettleEmissionsIx;
|
|
2995
|
+
};
|
|
2996
|
+
|
|
2997
|
+
declare function getConfig({ environment, overrides, }?: {
|
|
2998
|
+
environment?: Environment;
|
|
2999
|
+
overrides?: Partial<Omit<LendrConfig, "environment">>;
|
|
3000
|
+
}): LendrConfig;
|
|
3001
|
+
|
|
3002
|
+
declare const PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED: Buffer<ArrayBuffer>;
|
|
3003
|
+
declare const PDA_BANK_INSURANCE_VAULT_AUTH_SEED: Buffer<ArrayBuffer>;
|
|
3004
|
+
declare const PDA_BANK_FEE_VAULT_AUTH_SEED: Buffer<ArrayBuffer>;
|
|
3005
|
+
declare const PDA_BANK_LIQUIDITY_VAULT_SEED: Buffer<ArrayBuffer>;
|
|
3006
|
+
declare const PDA_BANK_INSURANCE_VAULT_SEED: Buffer<ArrayBuffer>;
|
|
3007
|
+
declare const PDA_BANK_FEE_VAULT_SEED: Buffer<ArrayBuffer>;
|
|
3008
|
+
|
|
3009
|
+
declare const DEFAULT_COMMITMENT: Commitment;
|
|
3010
|
+
declare const DEFAULT_SEND_OPTS: SendOptions;
|
|
3011
|
+
declare const DEFAULT_CONFIRM_OPTS: ConfirmOptions;
|
|
3012
|
+
declare const MAX_TX_SIZE = 1232;
|
|
3013
|
+
declare const MAX_ACCOUNT_KEYS = 64;
|
|
3014
|
+
declare const BUNDLE_TX_SIZE = 81;
|
|
3015
|
+
declare const PRIORITY_TX_SIZE = 44;
|
|
3016
|
+
declare const SKIP_SIMULATION = false;
|
|
3017
|
+
declare const DEFAULT_ORACLE_MAX_AGE = 60;
|
|
3018
|
+
|
|
3019
|
+
declare const DISABLED_FLAG: number;
|
|
3020
|
+
declare const FLASHLOAN_ENABLED_FLAG: number;
|
|
3021
|
+
declare const TRANSFER_ACCOUNT_AUTHORITY_FLAG: number;
|
|
3022
|
+
|
|
3023
|
+
declare const HOURS_PER_YEAR: number;
|
|
3024
|
+
declare const MAX_U64: string;
|
|
3025
|
+
declare const PYTH_PRICE_CONF_INTERVALS: BigNumber;
|
|
3026
|
+
declare const SWB_PRICE_CONF_INTERVALS: BigNumber;
|
|
3027
|
+
declare const MAX_CONFIDENCE_INTERVAL_RATIO: BigNumber;
|
|
3028
|
+
declare const PYTH_PUSH_ORACLE_ID: PublicKey;
|
|
3029
|
+
declare const GROUP_PK: PublicKey;
|
|
3030
|
+
declare const PROGRAM_ID: PublicKey;
|
|
3031
|
+
declare const DEFAULT_CLUSTER: string;
|
|
3032
|
+
|
|
3033
|
+
declare const LUT_PROGRAM_AUTHORITY_INDEX = 5;
|
|
3034
|
+
declare const JUPITER_V6_PROGRAM: PublicKey;
|
|
3035
|
+
declare const LENDR_PROGRAM: PublicKey;
|
|
3036
|
+
declare const SINGLE_POOL_PROGRAM_ID: PublicKey;
|
|
3037
|
+
declare const STAKE_PROGRAM_ID: PublicKey;
|
|
3038
|
+
declare const MPL_METADATA_PROGRAM_ID: PublicKey;
|
|
3039
|
+
declare const SYSTEM_PROGRAM_ID: PublicKey;
|
|
3040
|
+
declare const SYSVAR_RENT_ID: PublicKey;
|
|
3041
|
+
declare const SYSVAR_CLOCK_ID: PublicKey;
|
|
3042
|
+
declare const SYSVAR_STAKE_HISTORY_ID: PublicKey;
|
|
3043
|
+
declare const STAKE_CONFIG_ID: PublicKey;
|
|
3044
|
+
|
|
3045
|
+
declare const WSOL_MINT: PublicKey;
|
|
3046
|
+
declare const WSOL_EXTENDED_METADATA: BankExtendedMetadata;
|
|
3047
|
+
declare const LST_MINT: PublicKey;
|
|
3048
|
+
declare const USDC_MINT: PublicKey;
|
|
3049
|
+
declare const DUMMY_USDC_MINT: PublicKey;
|
|
3050
|
+
declare const USDC_DECIMALS = 6;
|
|
3051
|
+
|
|
3052
|
+
declare enum ProcessTransactionErrorType {
|
|
3053
|
+
TransactionBuildingError = 0,
|
|
3054
|
+
TransactionSendingError = 1,
|
|
3055
|
+
SimulationError = 2,
|
|
3056
|
+
TransactionTupleError = 3,
|
|
3057
|
+
FallthroughError = 4,
|
|
3058
|
+
TimeoutError = 5
|
|
3059
|
+
}
|
|
3060
|
+
declare class ProcessTransactionError extends Error {
|
|
3061
|
+
logs?: string[];
|
|
3062
|
+
type: ProcessTransactionErrorType;
|
|
3063
|
+
programId?: string;
|
|
3064
|
+
failedTxs?: SolanaTransaction[];
|
|
3065
|
+
_error?: Error;
|
|
3066
|
+
constructor({ message, type, logs, programId, code: _code, failedTxs, _error, }: {
|
|
3067
|
+
message: string;
|
|
3068
|
+
type: ProcessTransactionErrorType;
|
|
3069
|
+
logs?: string[];
|
|
3070
|
+
programId?: string;
|
|
3071
|
+
code?: number;
|
|
3072
|
+
failedTxs?: SolanaTransaction[];
|
|
3073
|
+
_error?: Error;
|
|
3074
|
+
});
|
|
3075
|
+
static withFailedTransactions(error: ProcessTransactionError, failedTxs: SolanaTransaction[]): ProcessTransactionError;
|
|
3076
|
+
}
|
|
3077
|
+
interface ProgramError {
|
|
3078
|
+
programId: string;
|
|
3079
|
+
code: number;
|
|
3080
|
+
}
|
|
3081
|
+
interface ProgramErrorWithDescription extends ProgramError {
|
|
3082
|
+
description: string;
|
|
3083
|
+
}
|
|
3084
|
+
declare function parseTransactionError(error: any, ldrProgramId: PublicKey): {
|
|
3085
|
+
programId: any;
|
|
3086
|
+
type: any;
|
|
3087
|
+
description: any;
|
|
3088
|
+
code: any;
|
|
3089
|
+
};
|
|
3090
|
+
declare function parseErrorFromLogs(logs: string[], ldrProgramId: PublicKey): ProgramErrorWithDescription | null;
|
|
3091
|
+
|
|
3092
|
+
/** Number of slots that can pass before a publisher's price is no longer included in the aggregate. */
|
|
3093
|
+
declare const MAX_SLOT_DIFFERENCE = 25;
|
|
3094
|
+
interface Price {
|
|
3095
|
+
priceComponent: bigint;
|
|
3096
|
+
price: number;
|
|
3097
|
+
confidenceComponent: bigint;
|
|
3098
|
+
confidence: number;
|
|
3099
|
+
status: PriceStatus;
|
|
3100
|
+
corporateAction: CorpAction;
|
|
3101
|
+
publishSlot: number;
|
|
3102
|
+
}
|
|
3103
|
+
declare enum PriceStatus {
|
|
3104
|
+
Unknown = 0,
|
|
3105
|
+
Trading = 1,
|
|
3106
|
+
Halted = 2,
|
|
3107
|
+
Auction = 3,
|
|
3108
|
+
Ignored = 4
|
|
3109
|
+
}
|
|
3110
|
+
declare enum CorpAction {
|
|
3111
|
+
NoCorpAct = 0
|
|
3112
|
+
}
|
|
3113
|
+
interface PriceData extends Base {
|
|
3114
|
+
priceType: PriceType;
|
|
3115
|
+
exponent: number;
|
|
3116
|
+
numComponentPrices: number;
|
|
3117
|
+
numQuoters: number;
|
|
3118
|
+
lastSlot: bigint;
|
|
3119
|
+
validSlot: bigint;
|
|
3120
|
+
emaPrice: Ema;
|
|
3121
|
+
emaConfidence: Ema;
|
|
3122
|
+
timestamp: bigint;
|
|
3123
|
+
minPublishers: number;
|
|
3124
|
+
drv2: number;
|
|
3125
|
+
drv3: number;
|
|
3126
|
+
drv4: number;
|
|
3127
|
+
productAccountKey: PublicKey;
|
|
3128
|
+
nextPriceAccountKey: PublicKey | null;
|
|
3129
|
+
previousSlot: bigint;
|
|
3130
|
+
previousPriceComponent: bigint;
|
|
3131
|
+
previousPrice: number;
|
|
3132
|
+
previousConfidenceComponent: bigint;
|
|
3133
|
+
previousConfidence: number;
|
|
3134
|
+
previousTimestamp: bigint;
|
|
3135
|
+
priceComponents: PriceComponent[];
|
|
3136
|
+
aggregate: Price;
|
|
3137
|
+
price: number | undefined;
|
|
3138
|
+
confidence: number | undefined;
|
|
3139
|
+
status: PriceStatus;
|
|
3140
|
+
}
|
|
3141
|
+
interface Base {
|
|
3142
|
+
magic: number;
|
|
3143
|
+
version: number;
|
|
3144
|
+
type: AccountType;
|
|
3145
|
+
size: number;
|
|
3146
|
+
}
|
|
3147
|
+
declare enum AccountType {
|
|
3148
|
+
Unknown = 0,
|
|
3149
|
+
Mapping = 1,
|
|
3150
|
+
Product = 2,
|
|
3151
|
+
Price = 3,
|
|
3152
|
+
Test = 4,
|
|
3153
|
+
Permission = 5
|
|
3154
|
+
}
|
|
3155
|
+
declare enum PriceType {
|
|
3156
|
+
Unknown = 0,
|
|
3157
|
+
Price = 1
|
|
3158
|
+
}
|
|
3159
|
+
/**
|
|
3160
|
+
* valueComponent = numerator / denominator
|
|
3161
|
+
* value = valueComponent * 10 ^ exponent (from PriceData)
|
|
3162
|
+
*/
|
|
3163
|
+
interface Ema {
|
|
3164
|
+
valueComponent: bigint;
|
|
3165
|
+
value: number;
|
|
3166
|
+
numerator: bigint;
|
|
3167
|
+
denominator: bigint;
|
|
3168
|
+
}
|
|
3169
|
+
interface PriceComponent {
|
|
3170
|
+
publisher: PublicKey;
|
|
3171
|
+
aggregate: Price;
|
|
3172
|
+
latest: Price;
|
|
3173
|
+
}
|
|
3174
|
+
declare const parsePriceData: (data: Buffer, currentSlot?: number) => PriceData;
|
|
3175
|
+
|
|
3176
|
+
type PriceUpdateV2 = {
|
|
3177
|
+
writeAuthority: Buffer;
|
|
3178
|
+
verificationLevel: number;
|
|
3179
|
+
priceMessage: {
|
|
3180
|
+
feedId: Buffer;
|
|
3181
|
+
price: bigint;
|
|
3182
|
+
conf: bigint;
|
|
3183
|
+
exponent: number;
|
|
3184
|
+
publishTime: bigint;
|
|
3185
|
+
prevPublishTime: bigint;
|
|
3186
|
+
emaPrice: bigint;
|
|
3187
|
+
emaConf: bigint;
|
|
3188
|
+
};
|
|
3189
|
+
};
|
|
3190
|
+
declare const parsePriceInfo: (data: Buffer) => PriceUpdateV2;
|
|
3191
|
+
|
|
3192
|
+
/**
|
|
3193
|
+
* Parsed content of an on-chain StakeAccount
|
|
3194
|
+
*
|
|
3195
|
+
* Copied from https://github.com/solana-developers/solana-rpc-get-stake-activation/blob/main/web3js-1.0/src/stake.ts
|
|
3196
|
+
* */
|
|
3197
|
+
type StakeAccount = {
|
|
3198
|
+
discriminant: bigint;
|
|
3199
|
+
meta: {
|
|
3200
|
+
rentExemptReserve: bigint;
|
|
3201
|
+
authorized: {
|
|
3202
|
+
staker: PublicKey;
|
|
3203
|
+
withdrawer: PublicKey;
|
|
3204
|
+
};
|
|
3205
|
+
lockup: {
|
|
3206
|
+
unixTimestamp: bigint;
|
|
3207
|
+
epoch: bigint;
|
|
3208
|
+
custodian: PublicKey;
|
|
3209
|
+
};
|
|
3210
|
+
};
|
|
3211
|
+
stake: {
|
|
3212
|
+
delegation: {
|
|
3213
|
+
voterPubkey: PublicKey;
|
|
3214
|
+
stake: bigint;
|
|
3215
|
+
activationEpoch: bigint;
|
|
3216
|
+
deactivationEpoch: bigint;
|
|
3217
|
+
};
|
|
3218
|
+
creditsObserved: bigint;
|
|
3219
|
+
};
|
|
3220
|
+
};
|
|
3221
|
+
/**
|
|
3222
|
+
* Decode a StakeAccount from parsed account data.
|
|
3223
|
+
*
|
|
3224
|
+
* Copied from https://github.com/solana-developers/solana-rpc-get-stake-activation/blob/main/web3js-1.0/src/stake.ts
|
|
3225
|
+
* */
|
|
3226
|
+
declare const getStakeAccount: (data: Buffer) => StakeAccount;
|
|
3227
|
+
|
|
3228
|
+
declare const SinglePoolInstruction: {
|
|
3229
|
+
initializePool: (voteAccount: PublicKey) => TransactionInstruction;
|
|
3230
|
+
initializeOnRamp: (pool: PublicKey) => TransactionInstruction;
|
|
3231
|
+
depositStake: (pool: PublicKey, userStakeAccount: PublicKey, userTokenAccount: PublicKey, userLamportAccount: PublicKey) => Promise<TransactionInstruction>;
|
|
3232
|
+
withdrawStake: (pool: PublicKey, userStakeAccount: PublicKey, userStakeAuthority: PublicKey, userTokenAccount: PublicKey, tokenAmount: BigNumber) => Promise<TransactionInstruction>;
|
|
3233
|
+
createTokenMetadata: (pool: PublicKey, payer: PublicKey) => Promise<TransactionInstruction>;
|
|
3234
|
+
updateTokenMetadata: (voteAccount: PublicKey, authorizedWithdrawer: PublicKey, tokenName: string, tokenSymbol: string, tokenUri?: string) => Promise<TransactionInstruction>;
|
|
3235
|
+
};
|
|
3236
|
+
declare const findPoolMintAddressByVoteAccount: (voteAccountAddress: PublicKey) => PublicKey;
|
|
3237
|
+
declare const findPoolAddress: (voteAccountAddress: PublicKey) => PublicKey;
|
|
3238
|
+
declare const findPoolMintAddress: (poolAddress: PublicKey) => PublicKey;
|
|
3239
|
+
declare const findPoolStakeAddress: (poolAddress: PublicKey) => PublicKey;
|
|
3240
|
+
declare const findPoolStakeAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
|
|
3241
|
+
declare const findPoolMintAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
|
|
3242
|
+
declare const findPoolMplAuthorityAddress: (poolAddress: PublicKey) => PublicKey;
|
|
3243
|
+
declare const findPoolOnRampAddress: (poolAddress: PublicKey) => PublicKey;
|
|
3244
|
+
declare const findMplMetadataAddress: (poolMintAddress: PublicKey) => Promise<PublicKey>;
|
|
3245
|
+
declare function initializeStakedPoolTx(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey): Promise<Transaction>;
|
|
3246
|
+
declare function initializeStakedPoolIxs(connection: Connection, payer: PublicKey, voteAccountAddress: PublicKey): Promise<TransactionInstruction[]>;
|
|
3247
|
+
declare const createAccountIx: (from: PublicKey, newAccount: PublicKey, lamports: number, space: number, programAddress: PublicKey) => TransactionInstruction;
|
|
3248
|
+
declare const createPoolOnrampIx: (voteAccount: PublicKey) => TransactionInstruction;
|
|
3249
|
+
declare const replenishPoolIx: (voteAccount: PublicKey) => TransactionInstruction;
|
|
3250
|
+
|
|
3251
|
+
declare class Account {
|
|
3252
|
+
program: any;
|
|
3253
|
+
publicKey: any;
|
|
3254
|
+
/**
|
|
3255
|
+
* Account constructor
|
|
3256
|
+
* @param program SwitchboardProgram
|
|
3257
|
+
* @param publicKey PublicKey of the on-chain resource
|
|
3258
|
+
*/
|
|
3259
|
+
constructor(program: any, publicKey: anchor.web3.PublicKey);
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
declare class AggregatorAccount extends Account {
|
|
3263
|
+
static decodeLatestValue(aggregator: {
|
|
3264
|
+
latestConfirmedRound: {
|
|
3265
|
+
numSuccess: any;
|
|
3266
|
+
result: {
|
|
3267
|
+
toBig: () => any;
|
|
3268
|
+
};
|
|
3269
|
+
};
|
|
3270
|
+
}): any;
|
|
3271
|
+
}
|
|
3272
|
+
|
|
3273
|
+
declare class AggregatorAccountData {
|
|
3274
|
+
/** Name of the aggregator to store on-chain. */
|
|
3275
|
+
name: any;
|
|
3276
|
+
/** Metadata of the aggregator to store on-chain. */
|
|
3277
|
+
metadata: any;
|
|
3278
|
+
/** Reserved. */
|
|
3279
|
+
reserved1: any;
|
|
3280
|
+
/** Pubkey of the queue the aggregator belongs to. */
|
|
3281
|
+
queuePubkey: any;
|
|
3282
|
+
/**
|
|
3283
|
+
* CONFIGS
|
|
3284
|
+
* Number of oracles assigned to an update request.
|
|
3285
|
+
*/
|
|
3286
|
+
oracleRequestBatchSize: any;
|
|
3287
|
+
/** Minimum number of oracle responses required before a round is validated. */
|
|
3288
|
+
minOracleResults: any;
|
|
3289
|
+
/** Minimum number of job results before an oracle accepts a result. */
|
|
3290
|
+
minJobResults: any;
|
|
3291
|
+
/** Minimum number of seconds required between aggregator rounds. */
|
|
3292
|
+
minUpdateDelaySeconds: any;
|
|
3293
|
+
/** Unix timestamp for which no feed update will occur before. */
|
|
3294
|
+
startAfter: any;
|
|
3295
|
+
/** Change percentage required between a previous round and the current round. If variance percentage is not met, reject new oracle responses. */
|
|
3296
|
+
varianceThreshold: any;
|
|
3297
|
+
/** Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles. */
|
|
3298
|
+
forceReportPeriod: any;
|
|
3299
|
+
/** Timestamp when the feed is no longer needed. */
|
|
3300
|
+
expiration: any;
|
|
3301
|
+
/** Counter for the number of consecutive failures before a feed is removed from a queue. If set to 0, failed feeds will remain on the queue. */
|
|
3302
|
+
consecutiveFailureCount: any;
|
|
3303
|
+
/** Timestamp when the next update request will be available. */
|
|
3304
|
+
nextAllowedUpdateTime: any;
|
|
3305
|
+
/** Flag for whether an aggregators configuration is locked for editing. */
|
|
3306
|
+
isLocked: any;
|
|
3307
|
+
/** Optional, public key of the crank the aggregator is currently using. Event based feeds do not need a crank. */
|
|
3308
|
+
crankPubkey: any;
|
|
3309
|
+
/** Latest confirmed update request result that has been accepted as valid. */
|
|
3310
|
+
latestConfirmedRound: any;
|
|
3311
|
+
/** Oracle results from the current round of update request that has not been accepted as valid yet. */
|
|
3312
|
+
currentRound: any;
|
|
3313
|
+
/** List of public keys containing the job definitions for how data is sourced off-chain by oracles. */
|
|
3314
|
+
jobPubkeysData: any;
|
|
3315
|
+
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
|
|
3316
|
+
jobHashes: any;
|
|
3317
|
+
/** Number of jobs assigned to an oracle. */
|
|
3318
|
+
jobPubkeysSize: any;
|
|
3319
|
+
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
|
|
3320
|
+
jobsChecksum: any;
|
|
3321
|
+
/** The account delegated as the authority for making account changes. */
|
|
3322
|
+
authority: any;
|
|
3323
|
+
/** Optional, public key of a history buffer account storing the last N accepted results and their timestamps. */
|
|
3324
|
+
historyBuffer: any;
|
|
3325
|
+
/** The previous confirmed round result. */
|
|
3326
|
+
previousConfirmedRoundResult: any;
|
|
3327
|
+
/** The slot when the previous confirmed round was opened. */
|
|
3328
|
+
previousConfirmedRoundSlot: any;
|
|
3329
|
+
/** Whether an aggregator is permitted to join a crank. */
|
|
3330
|
+
disableCrank: any;
|
|
3331
|
+
/** Job weights used for the weighted median of the aggregator's assigned job accounts. */
|
|
3332
|
+
jobWeights: any;
|
|
3333
|
+
/** Unix timestamp when the feed was created. */
|
|
3334
|
+
creationTimestamp: any;
|
|
3335
|
+
/**
|
|
3336
|
+
* Use sliding window or round based resolution
|
|
3337
|
+
* NOTE: This changes result propogation in latest_round_result
|
|
3338
|
+
*/
|
|
3339
|
+
resolutionMode: any;
|
|
3340
|
+
basePriorityFee: any;
|
|
3341
|
+
priorityFeeBump: any;
|
|
3342
|
+
priorityFeeBumpPeriod: any;
|
|
3343
|
+
maxPriorityFeeMultiplier: any;
|
|
3344
|
+
/** Reserved for future info. */
|
|
3345
|
+
ebuf: any;
|
|
3346
|
+
static discriminator: Buffer<ArrayBuffer>;
|
|
3347
|
+
static layout: any;
|
|
3348
|
+
constructor(fields: any);
|
|
3349
|
+
static decode(data: any): AggregatorAccountData;
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
declare const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
|
|
3353
|
+
interface CurrentResult {
|
|
3354
|
+
value: BN;
|
|
3355
|
+
std_dev: BN;
|
|
3356
|
+
mean: BN;
|
|
3357
|
+
range: BN;
|
|
3358
|
+
min_value: BN;
|
|
3359
|
+
max_vaalue: BN;
|
|
3360
|
+
slot: BN;
|
|
3361
|
+
min_slot: BN;
|
|
3362
|
+
max_slot: BN;
|
|
3363
|
+
}
|
|
3364
|
+
interface OracleSubmission {
|
|
3365
|
+
oracle: PublicKey;
|
|
3366
|
+
slot: BN;
|
|
3367
|
+
value: BN;
|
|
3368
|
+
}
|
|
3369
|
+
interface PullFeedAccountData {
|
|
3370
|
+
submissions: OracleSubmission[];
|
|
3371
|
+
authority: PublicKey;
|
|
3372
|
+
queue: PublicKey;
|
|
3373
|
+
feed_hash: Buffer;
|
|
3374
|
+
initialized_at: BN;
|
|
3375
|
+
permissions: BN;
|
|
3376
|
+
max_variance: BN;
|
|
3377
|
+
min_responses: number;
|
|
3378
|
+
name: Buffer;
|
|
3379
|
+
sample_size: number;
|
|
3380
|
+
last_update_timestamp: BN;
|
|
3381
|
+
lut_slot: BN;
|
|
3382
|
+
result: CurrentResult;
|
|
3383
|
+
max_staleness: number;
|
|
3384
|
+
min_sample_size: number;
|
|
3385
|
+
}
|
|
3386
|
+
type CrossbarSimulatePayload = FeedResponse[];
|
|
3387
|
+
interface FeedResponse {
|
|
3388
|
+
feedHash: string;
|
|
3389
|
+
results: number[];
|
|
3390
|
+
}
|
|
3391
|
+
declare const switchboardAccountCoder: BorshCoder<string, string>;
|
|
3392
|
+
declare function getSwitchboardProgram(provider: Provider): Program$1;
|
|
3393
|
+
declare function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountData;
|
|
3394
|
+
|
|
3395
|
+
type index_AccountType = AccountType;
|
|
3396
|
+
declare const index_AccountType: typeof AccountType;
|
|
3397
|
+
type index_AggregatorAccount = AggregatorAccount;
|
|
3398
|
+
declare const index_AggregatorAccount: typeof AggregatorAccount;
|
|
3399
|
+
type index_AggregatorAccountData = AggregatorAccountData;
|
|
3400
|
+
declare const index_AggregatorAccountData: typeof AggregatorAccountData;
|
|
3401
|
+
type index_Base = Base;
|
|
3402
|
+
type index_CorpAction = CorpAction;
|
|
3403
|
+
declare const index_CorpAction: typeof CorpAction;
|
|
3404
|
+
type index_CrossbarSimulatePayload = CrossbarSimulatePayload;
|
|
3405
|
+
type index_CurrentResult = CurrentResult;
|
|
3406
|
+
type index_Ema = Ema;
|
|
3407
|
+
type index_FeedResponse = FeedResponse;
|
|
3408
|
+
declare const index_MAX_SLOT_DIFFERENCE: typeof MAX_SLOT_DIFFERENCE;
|
|
3409
|
+
type index_OracleSubmission = OracleSubmission;
|
|
3410
|
+
type index_Price = Price;
|
|
3411
|
+
type index_PriceComponent = PriceComponent;
|
|
3412
|
+
type index_PriceData = PriceData;
|
|
3413
|
+
type index_PriceStatus = PriceStatus;
|
|
3414
|
+
declare const index_PriceStatus: typeof PriceStatus;
|
|
3415
|
+
type index_PriceType = PriceType;
|
|
3416
|
+
declare const index_PriceType: typeof PriceType;
|
|
3417
|
+
type index_PullFeedAccountData = PullFeedAccountData;
|
|
3418
|
+
declare const index_SWITCHBOARD_ONDEMANDE_PRICE_PRECISION: typeof SWITCHBOARD_ONDEMANDE_PRICE_PRECISION;
|
|
3419
|
+
declare const index_SinglePoolInstruction: typeof SinglePoolInstruction;
|
|
3420
|
+
type index_StakeAccount = StakeAccount;
|
|
3421
|
+
declare const index_createAccountIx: typeof createAccountIx;
|
|
3422
|
+
declare const index_createPoolOnrampIx: typeof createPoolOnrampIx;
|
|
3423
|
+
declare const index_decodeSwitchboardPullFeedData: typeof decodeSwitchboardPullFeedData;
|
|
3424
|
+
declare const index_findMplMetadataAddress: typeof findMplMetadataAddress;
|
|
3425
|
+
declare const index_findPoolAddress: typeof findPoolAddress;
|
|
3426
|
+
declare const index_findPoolMintAddress: typeof findPoolMintAddress;
|
|
3427
|
+
declare const index_findPoolMintAddressByVoteAccount: typeof findPoolMintAddressByVoteAccount;
|
|
3428
|
+
declare const index_findPoolMintAuthorityAddress: typeof findPoolMintAuthorityAddress;
|
|
3429
|
+
declare const index_findPoolMplAuthorityAddress: typeof findPoolMplAuthorityAddress;
|
|
3430
|
+
declare const index_findPoolOnRampAddress: typeof findPoolOnRampAddress;
|
|
3431
|
+
declare const index_findPoolStakeAddress: typeof findPoolStakeAddress;
|
|
3432
|
+
declare const index_findPoolStakeAuthorityAddress: typeof findPoolStakeAuthorityAddress;
|
|
3433
|
+
declare const index_getStakeAccount: typeof getStakeAccount;
|
|
3434
|
+
declare const index_getSwitchboardProgram: typeof getSwitchboardProgram;
|
|
3435
|
+
declare const index_initializeStakedPoolIxs: typeof initializeStakedPoolIxs;
|
|
3436
|
+
declare const index_initializeStakedPoolTx: typeof initializeStakedPoolTx;
|
|
3437
|
+
declare const index_parsePriceData: typeof parsePriceData;
|
|
3438
|
+
declare const index_parsePriceInfo: typeof parsePriceInfo;
|
|
3439
|
+
declare const index_replenishPoolIx: typeof replenishPoolIx;
|
|
3440
|
+
declare const index_switchboardAccountCoder: typeof switchboardAccountCoder;
|
|
3441
|
+
declare namespace index {
|
|
3442
|
+
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
|
+
}
|
|
3444
|
+
|
|
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 };
|