@sonarwatch/portfolio-plugins 0.14.132 → 0.14.133

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +1 -1
  3. package/src/plugins/citrus/loansFetcher.js +34 -68
  4. package/src/plugins/citrus/loansFetcher.js.map +1 -1
  5. package/src/plugins/debridge/dlmmVaultsFetcher.js +1 -0
  6. package/src/plugins/debridge/dlmmVaultsFetcher.js.map +1 -1
  7. package/src/plugins/jupiter/exchange/valueAverageFetcher.js +1 -1
  8. package/src/plugins/jupiter/exchange/valueAverageFetcher.js.map +1 -1
  9. package/src/plugins/rain/banksFetcher.js +47 -0
  10. package/src/plugins/rain/banksFetcher.js.map +1 -0
  11. package/src/plugins/rain/collectionsJob.js +9 -7
  12. package/src/plugins/rain/collectionsJob.js.map +1 -1
  13. package/src/plugins/rain/constants.d.ts +7 -2
  14. package/src/plugins/rain/constants.js +11 -3
  15. package/src/plugins/rain/constants.js.map +1 -1
  16. package/src/plugins/rain/defiBorrowsFetcher.d.ts +3 -0
  17. package/src/plugins/rain/defiBorrowsFetcher.js +52 -0
  18. package/src/plugins/rain/defiBorrowsFetcher.js.map +1 -0
  19. package/src/plugins/rain/index.js +10 -3
  20. package/src/plugins/rain/index.js.map +1 -1
  21. package/src/plugins/rain/nftBorrowsFetcher.d.ts +3 -0
  22. package/src/plugins/rain/nftBorrowsFetcher.js +76 -0
  23. package/src/plugins/rain/nftBorrowsFetcher.js.map +1 -0
  24. package/src/plugins/rain/poolsFetcher.js +79 -42
  25. package/src/plugins/rain/poolsFetcher.js.map +1 -1
  26. package/src/plugins/rain/structs.d.ts +455 -0
  27. package/src/plugins/rain/structs.js +425 -0
  28. package/src/plugins/rain/structs.js.map +1 -0
  29. package/src/plugins/rain/types.d.ts +18 -144
  30. package/src/plugins/sharky/loansFetcher.js +38 -73
  31. package/src/plugins/sharky/loansFetcher.js.map +1 -1
  32. package/src/utils/elementbuilder/AssetCollectibleBuilder.d.ts +10 -0
  33. package/src/utils/elementbuilder/AssetCollectibleBuilder.js +53 -0
  34. package/src/utils/elementbuilder/AssetCollectibleBuilder.js.map +1 -0
  35. package/src/utils/elementbuilder/ElementBorrowlendBuilder.d.ts +9 -1
  36. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +41 -3
  37. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -1
  38. package/src/utils/elementbuilder/ElementRegistry.js +9 -1
  39. package/src/utils/elementbuilder/ElementRegistry.js.map +1 -1
  40. package/src/utils/elementbuilder/Params.d.ts +14 -0
  41. package/src/utils/solana/das/heliusAssetToAssetCollectible.js +3 -2
  42. package/src/utils/solana/das/heliusAssetToAssetCollectible.js.map +1 -1
  43. package/src/plugins/rain/filters.d.ts +0 -7
  44. package/src/plugins/rain/filters.js +0 -53
  45. package/src/plugins/rain/filters.js.map +0 -1
  46. package/src/plugins/rain/helpers.d.ts +0 -9
  47. package/src/plugins/rain/helpers.js +0 -66
  48. package/src/plugins/rain/helpers.js.map +0 -1
  49. package/src/plugins/rain/loansFetcher.js +0 -139
  50. package/src/plugins/rain/loansFetcher.js.map +0 -1
  51. package/src/plugins/rain/structs/loan.d.ts +0 -86
  52. package/src/plugins/rain/structs/loan.js +0 -86
  53. package/src/plugins/rain/structs/loan.js.map +0 -1
  54. package/src/plugins/rain/structs/pool.d.ts +0 -79
  55. package/src/plugins/rain/structs/pool.js +0 -76
  56. package/src/plugins/rain/structs/pool.js.map +0 -1
  57. /package/src/plugins/rain/{loansFetcher.d.ts → banksFetcher.d.ts} +0 -0
@@ -13,54 +13,91 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const web3_js_1 = require("@solana/web3.js");
17
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
16
18
  const constants_1 = require("./constants");
17
19
  const clients_1 = require("../../utils/clients");
18
- const pool_1 = require("./structs/pool");
19
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
- const helpers_1 = require("./helpers");
21
- const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
20
+ const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
21
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
22
+ const structs_1 = require("./structs");
22
23
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
24
  const client = (0, clients_1.getClientSolana)();
24
- // Trying to get https://solscan.io/account/4g5zooignaoVrS6NdUWEcNLxZmJGN9UJBAGtrUiBwieF
25
- const poolAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, pool_1.poolStruct, (0, helpers_1.getPoolPda)(owner));
26
- if (!poolAccount || poolAccount.totalAmount.isZero())
25
+ const pools = yield ParsedGpa_1.ParsedGpa.build(client, structs_1.poolStruct, constants_1.defiLendingProgramId)
26
+ .addFilter('accountDiscriminator', [241, 154, 109, 4, 17, 177, 109, 188])
27
+ .addFilter('owner', new web3_js_1.PublicKey(owner))
28
+ .run();
29
+ if (!pools.length)
27
30
  return [];
28
- const tokenPrice = yield cache.getTokenPrice(poolAccount.currency.toString(), portfolio_core_1.NetworkId.solana);
29
- if (!tokenPrice)
31
+ const allDefiLoans = yield Promise.all(pools.map((pool) => ParsedGpa_1.ParsedGpa.build(client, structs_1.defiLoanStruct, constants_1.defiLendingProgramId)
32
+ .addFilter('accountDiscriminator', [20, 195, 70, 117, 165, 227, 182, 1])
33
+ .addFilter('pool', pool.pubkey)
34
+ .run()));
35
+ const allNftsLoans = yield Promise.all(pools.map((pool) => ParsedGpa_1.ParsedGpa.build(client, structs_1.nftLoanStruct, constants_1.nftLendingProgramId)
36
+ .addFilter('accountDiscriminator', [20, 195, 70, 117, 165, 227, 182, 1])
37
+ .addFilter('pool', pool.pubkey)
38
+ .run()));
39
+ if (allDefiLoans.flat().length === 0 && allNftsLoans.flat().length === 0)
30
40
  return [];
31
- const borrowedAssets = [];
32
- const borrowedYields = [];
33
- const suppliedAssets = [];
34
- const suppliedYields = [];
35
- const rewardAssets = [];
36
- const amount = poolAccount.totalAmount
37
- .dividedBy(Math.pow(10, tokenPrice.decimals))
38
- .toNumber();
39
- suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.solana, tokenPrice));
40
- if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
41
- return [];
42
- const { borrowedValue, healthRatio, rewardValue, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)({ suppliedAssets, borrowedAssets, rewardAssets });
43
- return [
44
- {
45
- type: portfolio_core_1.PortfolioElementType.borrowlend,
46
- networkId: portfolio_core_1.NetworkId.solana,
47
- platformId: constants_1.platformId,
48
- label: 'Lending',
49
- value,
50
- data: {
51
- borrowedAssets,
52
- borrowedValue,
53
- borrowedYields,
54
- suppliedAssets,
55
- suppliedValue,
56
- suppliedYields,
57
- healthRatio,
58
- rewardValue,
59
- rewardAssets,
60
- value,
61
- },
62
- },
63
- ];
41
+ const [collections, solTokenPrice] = yield Promise.all([
42
+ constants_1.collectionsMemo.getItem(cache),
43
+ cache.getTokenPrice(portfolio_core_1.solanaNativeAddress, portfolio_core_1.NetworkId.solana),
44
+ ]);
45
+ if (!collections.length)
46
+ throw new Error('Collections not cached');
47
+ if (!solTokenPrice)
48
+ throw new Error('Sol price not cached');
49
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
50
+ pools.forEach((pool, i) => {
51
+ const defiLoans = allDefiLoans[i];
52
+ const nftLoans = allNftsLoans[i];
53
+ defiLoans.forEach((loan) => {
54
+ if (loan.status !== structs_1.LoanStatus.Ongoing)
55
+ return;
56
+ const element = elementRegistry.addElementBorrowlend({
57
+ label: 'Lending',
58
+ ref: loan.pubkey,
59
+ link: `https://app.rain.fi/dashboard/loans?address=${loan.pubkey}`,
60
+ });
61
+ element.setFixedTerms(true, loan.expiredAt.multipliedBy(1000));
62
+ element.addSuppliedAsset({
63
+ address: loan.principal,
64
+ amount: loan.borrowedAmount,
65
+ });
66
+ element.addBorrowedAsset({
67
+ address: loan.collateral,
68
+ amount: loan.collateralAmount,
69
+ });
70
+ });
71
+ nftLoans.forEach((loan) => {
72
+ if (loan.status !== structs_1.LoanStatus.Ongoing)
73
+ return;
74
+ const collection = collections.find((c) => c.collectionId === loan.collection);
75
+ if (!collection)
76
+ return;
77
+ const element = elementRegistry.addElementBorrowlend({
78
+ label: 'Lending',
79
+ ref: loan.pubkey,
80
+ link: `https://app.rain.fi/dashboard/loans?address=${loan.pubkey}`,
81
+ });
82
+ element.setFixedTerms(false, loan.expiredAt.multipliedBy(1000));
83
+ element.addBorrowedCollectibleAsset({
84
+ address: loan.collateral.toString(),
85
+ collection: {
86
+ name: collection.name,
87
+ floorPrice: new bignumber_js_1.default(collection.floorPrice)
88
+ .shiftedBy(-solTokenPrice.decimals)
89
+ .multipliedBy(solTokenPrice.price),
90
+ imageUri: collection.metadata.thumbnail,
91
+ },
92
+ attributes: { tags: [portfolio_core_1.collectibleFreezedTag] },
93
+ });
94
+ element.addSuppliedAsset({
95
+ address: loan.principal,
96
+ amount: loan.borrowedAmount,
97
+ });
98
+ });
99
+ });
100
+ return elementRegistry.getElements(cache);
64
101
  });
65
102
  const fetcher = {
66
103
  id: `${constants_1.platformId}-pools`,
@@ -1 +1 @@
1
- {"version":3,"file":"poolsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/poolsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,yCAA4C;AAC5C,qGAA6E;AAC7E,uCAAuC;AACvC,kFAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;I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AS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,WAAW;gBACX,WAAW;gBACX,YAAY;gBACZ,KAAK;aACN;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"poolsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/poolsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAC5C,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAsD;AACtD,kEAA+D;AAC/D,gFAA6E;AAC7E,uCAKmB;AAEnB,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,KAAK,GAAG,MAAM,qBAAS,CAAC,KAAK,CAAC,MAAM,EAAE,oBAAU,EAAE,gCAAoB,CAAC;SAC1E,SAAS,CAAC,sBAAsB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;SACxE,SAAS,CAAC,OAAO,EAAE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC;SACxC,GAAG,EAAE,CAAC;IAET,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAE7B,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,KAAK,CAAC,G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js" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
3
+ import { PublicKey } from '@solana/web3.js';
4
+ import { FixableBeetStruct, BeetStruct } from '@metaplex-foundation/beet';
5
+ import BigNumber from 'bignumber.js';
6
+ export declare const poolLiquidationStruct: BeetStruct<PoolLiquidation, Partial<PoolLiquidation>>;
7
+ export declare const poolLimitStruct: FixableBeetStruct<PoolLimit, Partial<PoolLimit>>;
8
+ export declare const poolCurrencyStruct: BeetStruct<PoolCurrency, Partial<PoolCurrency>>;
9
+ export declare const delegatorStruct: BeetStruct<Delegator, Partial<Delegator>>;
10
+ export declare const poolConditionStruct: FixableBeetStruct<PoolCondition, Partial<PoolCondition>>;
11
+ export declare const personalBankStruct: FixableBeetStruct<PersonalBank, Partial<PersonalBank>>;
12
+ export declare enum BankType {
13
+ Personal = 0,
14
+ Shared = 1
15
+ }
16
+ export declare enum CurveConfig {
17
+ Apr = 0
18
+ }
19
+ export declare enum CurveType {
20
+ Apr = 0
21
+ }
22
+ export declare enum DelegatorType {
23
+ Empty = 0,
24
+ Marginfi = 1
25
+ }
26
+ export declare enum LoanKind {
27
+ Classic = 0,
28
+ MarginSwap = 1,
29
+ Request = 2
30
+ }
31
+ export declare enum LoanKindConfig {
32
+ Classic = 0,
33
+ MarginSwap = 1
34
+ }
35
+ export declare enum LoanStatus {
36
+ Ongoing = 0,
37
+ Repaid = 1,
38
+ Liquidated = 2,
39
+ Sold = 3
40
+ }
41
+ export declare enum OracleConfig {
42
+ None = 0,
43
+ Pyth = 1,
44
+ Switchboard = 2,
45
+ SwitchboardOnDemand = 3
46
+ }
47
+ export declare enum OracleType {
48
+ Empty = 0,
49
+ Pyth = 1,
50
+ Switchboard = 2,
51
+ SwitchboardOnDemand = 3
52
+ }
53
+ export declare enum PoolStatus {
54
+ Enabled = 0,
55
+ Disabled = 1
56
+ }
57
+ export declare enum QuoteStep {
58
+ Open = 0,
59
+ Start = 1,
60
+ End = 2,
61
+ Close = 3
62
+ }
63
+ export declare enum QuoteType {
64
+ None = 0,
65
+ MarginSwap = 1,
66
+ InstantSell = 2,
67
+ Liquidate = 3
68
+ }
69
+ export declare enum SetConfig {
70
+ UpdateMinDuration = 0,
71
+ UpdateMaxDuration = 1,
72
+ UpdateMaxAmountUsd = 2,
73
+ UpdateMinAmountUsd = 3
74
+ }
75
+ export declare enum SetCurrencyConfig {
76
+ UpdateIsLocked = 0,
77
+ UpdateOracle = 1
78
+ }
79
+ export declare enum SetPoolConfig {
80
+ EnablePool = 0,
81
+ DisablePool = 1,
82
+ EnableAutoSell = 2,
83
+ DisableAutoSell = 3,
84
+ UpdateCurve = 4,
85
+ UpdateCurrencies = 5,
86
+ UpdateConditions = 6,
87
+ UpdateLimits = 7
88
+ }
89
+ export type Bank = {
90
+ accountDiscriminator: number[];
91
+ owner: PublicKey;
92
+ mint: PublicKey;
93
+ vault: PublicKey;
94
+ authority: PublicKey;
95
+ bankType: BankType;
96
+ bankTypeDetail: PersonalBank;
97
+ totalLiquidity: BigNumber;
98
+ availableLiquidity: BigNumber;
99
+ delegatedLiquidity: BigNumber;
100
+ cooldownLiquidity: BigNumber;
101
+ cooldownPeriod: BigNumber;
102
+ delegators: Delegator[];
103
+ createdAt: BigNumber;
104
+ depositedAt: BigNumber;
105
+ withdrawnAt: BigNumber;
106
+ borrowedAt: BigNumber;
107
+ repaidAt: BigNumber;
108
+ frozenUntil: BigNumber;
109
+ reserved: number[];
110
+ };
111
+ export declare const bankStruct: FixableBeetStruct<Bank, Partial<Bank>>;
112
+ export type Config = {
113
+ accountDiscriminator: number[];
114
+ minDuration: number;
115
+ maxDuration: number;
116
+ maxAmountUsd: number;
117
+ minAmountUsd: number;
118
+ admins: PublicKey[];
119
+ managers: PublicKey[];
120
+ reserved: number[];
121
+ };
122
+ export declare const configStruct: FixableBeetStruct<Config, Partial<Config>>;
123
+ export type Currency = {
124
+ accountDiscriminator: number[];
125
+ currencyId: number;
126
+ padding1: number[];
127
+ mint: PublicKey;
128
+ tokenProgram: PublicKey;
129
+ isLocked: number;
130
+ decimals: number;
131
+ padding2: number[];
132
+ oracles: OracleType[];
133
+ padding3: number[];
134
+ currentLoan: BigNumber;
135
+ createdAt: BigNumber;
136
+ updatedAt: BigNumber;
137
+ reserved: number[];
138
+ };
139
+ export declare const currencyStruct: FixableBeetStruct<Currency, Partial<Currency>>;
140
+ export type DefiLoan = {
141
+ accountDiscriminator: number[];
142
+ kind: LoanKind;
143
+ kindDetail: number[];
144
+ status: LoanStatus;
145
+ isCustom: number;
146
+ padding1: number[];
147
+ borrower: PublicKey;
148
+ bank: PublicKey;
149
+ pool: PublicKey;
150
+ collateral: PublicKey;
151
+ principal: PublicKey;
152
+ referrer: PublicKey;
153
+ interest: BigNumber;
154
+ borrowedAmount: BigNumber;
155
+ collateralAmount: BigNumber;
156
+ duration: number;
157
+ currency: number;
158
+ liquidation: number;
159
+ padding2: number[];
160
+ createdAt: BigNumber;
161
+ expiredAt: BigNumber;
162
+ repaidAt: BigNumber;
163
+ liquidatedAt: BigNumber;
164
+ soldAmount: BigNumber;
165
+ reserved: BigNumber[];
166
+ };
167
+ export declare const defiLoanStruct: FixableBeetStruct<DefiLoan, Partial<DefiLoan>>;
168
+ export type Pool = {
169
+ accountDiscriminator: number[];
170
+ owner: PublicKey;
171
+ seed: number[];
172
+ status: PoolStatus;
173
+ bump: number;
174
+ padding1: number[];
175
+ currentLoan: BigNumber;
176
+ curve: CurveType;
177
+ conditions: PoolCondition;
178
+ liquidation: PoolLiquidation;
179
+ limits: PoolLimit;
180
+ totalLiquidations: BigNumber;
181
+ totalLoans: BigNumber;
182
+ totalInterest: BigNumber;
183
+ createdAt: BigNumber;
184
+ updatedAt: BigNumber;
185
+ currenciesUpdatedAt: BigNumber;
186
+ lastLoanAt: BigNumber;
187
+ reserved: BigNumber[];
188
+ currencies: PoolCurrency[];
189
+ };
190
+ export declare const poolStruct: FixableBeetStruct<Pool, Partial<Pool>>;
191
+ export type Quote = {
192
+ accountDiscriminator: number[];
193
+ quoteType: QuoteType;
194
+ quoteStep: QuoteStep;
195
+ padding1: number[];
196
+ quote: PublicKey;
197
+ payer: PublicKey;
198
+ borrower: PublicKey;
199
+ loan: PublicKey;
200
+ inVault: PublicKey;
201
+ outVault: PublicKey;
202
+ borrowedAmount: BigNumber;
203
+ inAmountJup: BigNumber;
204
+ minSwappedAmount: BigNumber;
205
+ tempValue: BigNumber;
206
+ dataLength: BigNumber;
207
+ jupVec: number[];
208
+ slot: BigNumber;
209
+ createdAt: BigNumber;
210
+ bump: number;
211
+ padding2: number[];
212
+ };
213
+ export declare const quoteStruct: FixableBeetStruct<Quote, Partial<Quote>>;
214
+ export type Request = {
215
+ accountDiscriminator: number[];
216
+ payer: PublicKey;
217
+ borrower: PublicKey;
218
+ request: PublicKey;
219
+ collateral: PublicKey;
220
+ principal: PublicKey;
221
+ requestVault: PublicKey;
222
+ collateralAmount: BigNumber;
223
+ principalAmount: BigNumber;
224
+ interest: BigNumber;
225
+ duration: number;
226
+ padding1: number;
227
+ padding2: number;
228
+ bump: number;
229
+ createdAt: BigNumber;
230
+ reserved: number[];
231
+ };
232
+ export declare const requestStruct: FixableBeetStruct<Request, Partial<Request>>;
233
+ export type UserStats = {
234
+ accountDiscriminator: number[];
235
+ owner: PublicKey;
236
+ totalLoan: BigNumber;
237
+ totalLiquidation: BigNumber;
238
+ currentLoan: BigNumber;
239
+ totalVolume: BigNumber;
240
+ points: BigNumber;
241
+ creditScore: BigNumber;
242
+ referrer: PublicKey;
243
+ createdAt: BigNumber;
244
+ bump: number;
245
+ padding1: number[];
246
+ reserved: number[];
247
+ };
248
+ export declare const userStatsStruct: FixableBeetStruct<UserStats, Partial<UserStats>>;
249
+ export type Vault = {
250
+ accountDiscriminator: number[];
251
+ mint: PublicKey;
252
+ tokenAccount: PublicKey;
253
+ tokenProgram: PublicKey;
254
+ oracles: OracleType[];
255
+ padding1: number[];
256
+ ixGate: BigNumber;
257
+ vaultBump: number;
258
+ tokenAccountBump: number;
259
+ decimals: number;
260
+ padding2: number[];
261
+ deposited: BigNumber;
262
+ maxDeposit: BigNumber;
263
+ withdrawalWindow: BigNumber;
264
+ withdrawalWindowLimit: BigNumber;
265
+ withdrawalWindowStart: BigNumber;
266
+ withdrawalWindowAccumulator: BigNumber;
267
+ createdAt: BigNumber;
268
+ updatedAt: BigNumber;
269
+ depositedAt: BigNumber;
270
+ withdrawnAt: BigNumber;
271
+ reserved: number[];
272
+ };
273
+ export declare const vaultStruct: FixableBeetStruct<Vault, Partial<Vault>>;
274
+ export type ClassicLoan = {
275
+ reserved: number[];
276
+ };
277
+ export declare const classicLoanStruct: FixableBeetStruct<ClassicLoan, Partial<ClassicLoan>>;
278
+ export type ConditionConfig = {
279
+ minAge: BigNumber;
280
+ minLoan: BigNumber;
281
+ minVolume: BigNumber;
282
+ liquidationThreshold: number;
283
+ isEnabled: number;
284
+ whitelist: PublicKey;
285
+ };
286
+ export declare const conditionConfigStruct: BeetStruct<ConditionConfig, Partial<ConditionConfig>>;
287
+ export type CurrencyConfig = {
288
+ currency: number;
289
+ currencyLtv: number;
290
+ exposure: number;
291
+ };
292
+ export declare const currencyConfigStruct: BeetStruct<CurrencyConfig, Partial<CurrencyConfig>>;
293
+ export type CurrencyConfigFake = {
294
+ currency: number;
295
+ currencyLtv: number;
296
+ exposure: number;
297
+ borrowedAmount: BigNumber;
298
+ };
299
+ export declare const currencyConfigFakeStruct: BeetStruct<CurrencyConfigFake, Partial<CurrencyConfigFake>>;
300
+ export type CurrencyDeletedEvent = {
301
+ currency: PublicKey;
302
+ };
303
+ export declare const currencyDeletedEventStruct: BeetStruct<CurrencyDeletedEvent, Partial<CurrencyDeletedEvent>>;
304
+ export type CurveApr = {
305
+ apr: number;
306
+ padding2: number[];
307
+ padding1: BigNumber[];
308
+ };
309
+ export declare const curveAprStruct: FixableBeetStruct<CurveApr, Partial<CurveApr>>;
310
+ export type CurveAprConfig = {
311
+ apr: number;
312
+ };
313
+ export declare const curveAprConfigStruct: BeetStruct<CurveAprConfig, Partial<CurveAprConfig>>;
314
+ export type Delegator = {
315
+ delegatorType: DelegatorType;
316
+ delegatedAmount: BigNumber;
317
+ };
318
+ export type EmptyDelegator = {
319
+ reserved: number[];
320
+ reserved1: number[];
321
+ reserved2: number[];
322
+ reserved3: number[];
323
+ };
324
+ export declare const emptyDelegatorStruct: FixableBeetStruct<EmptyDelegator, Partial<EmptyDelegator>>;
325
+ export type EmptyOracle = {
326
+ reserved: number[];
327
+ reserved1: number[];
328
+ reserved2: number[];
329
+ reserved3: number[];
330
+ };
331
+ export declare const emptyOracleStruct: FixableBeetStruct<EmptyOracle, Partial<EmptyOracle>>;
332
+ export type LimitConfig = {
333
+ minDuration: number;
334
+ maxDuration: number;
335
+ maxAmountUsd: number;
336
+ minAmountUsd: number;
337
+ };
338
+ export declare const limitConfigStruct: BeetStruct<LimitConfig, Partial<LimitConfig>>;
339
+ export type MarginSwapLoan = {
340
+ downPayment: BigNumber;
341
+ reserved: number[];
342
+ reserved1: number[];
343
+ };
344
+ export declare const marginSwapLoanStruct: FixableBeetStruct<MarginSwapLoan, Partial<MarginSwapLoan>>;
345
+ export type MarginfiDelegator = {
346
+ marginfiBank: PublicKey;
347
+ reserved1: number[];
348
+ reserved2: number[];
349
+ reserved3: number[];
350
+ };
351
+ export declare const marginfiDelegatorStruct: FixableBeetStruct<MarginfiDelegator, Partial<MarginfiDelegator>>;
352
+ export type PersonalBank = {
353
+ reserved: number[];
354
+ reserved1: number[];
355
+ reserved2: number[];
356
+ };
357
+ export type PoolCondition = {
358
+ minAge: BigNumber;
359
+ minLoan: BigNumber;
360
+ minVolume: BigNumber;
361
+ unused: BigNumber;
362
+ liquidationThreshold: number;
363
+ isEnabled: number;
364
+ padding1: number[];
365
+ whitelist: PublicKey;
366
+ reserved: BigNumber[];
367
+ };
368
+ export type PoolCurrency = {
369
+ currency: number;
370
+ currencyLtv: number;
371
+ exposure: number;
372
+ borrowedAmount: BigNumber;
373
+ };
374
+ export type PoolDeletedEvent = {
375
+ pool: PublicKey;
376
+ };
377
+ export declare const poolDeletedEventStruct: BeetStruct<PoolDeletedEvent, Partial<PoolDeletedEvent>>;
378
+ export type PoolLimit = {
379
+ minDuration: number;
380
+ maxDuration: number;
381
+ maxAmountUsd: number;
382
+ minAmountUsd: number;
383
+ reserved: BigNumber[];
384
+ };
385
+ export type PoolLiquidation = {
386
+ loanLiquidation: number;
387
+ mortgageLiquidation: number;
388
+ isAutoSellEnabled: number;
389
+ padding1: number;
390
+ padding2: number;
391
+ };
392
+ export type PythV2Oracle = {
393
+ feedId: number[];
394
+ reserved: number[];
395
+ reserved1: number[];
396
+ reserved2: number[];
397
+ };
398
+ export declare const pythV2OracleStruct: FixableBeetStruct<PythV2Oracle, Partial<PythV2Oracle>>;
399
+ export type RequestDeletedEvent = {
400
+ request: PublicKey;
401
+ };
402
+ export declare const requestDeletedEventStruct: BeetStruct<RequestDeletedEvent, Partial<RequestDeletedEvent>>;
403
+ export type RequestLoan = {
404
+ reserved: number[];
405
+ };
406
+ export declare const requestLoanStruct: FixableBeetStruct<RequestLoan, Partial<RequestLoan>>;
407
+ export type SharedBank = {
408
+ lpMint: PublicKey;
409
+ lpRate: BigNumber;
410
+ lpSupply: BigNumber;
411
+ padding1: number[];
412
+ lpDecimals: number;
413
+ padding2: number[];
414
+ };
415
+ export declare const sharedBankStruct: FixableBeetStruct<SharedBank, Partial<SharedBank>>;
416
+ export type SwitchboardOnDemandOracle = {
417
+ account: PublicKey;
418
+ reserved: number[];
419
+ reserved1: number[];
420
+ reserved2: number[];
421
+ };
422
+ export declare const switchboardOnDemandOracleStruct: FixableBeetStruct<SwitchboardOnDemandOracle, Partial<SwitchboardOnDemandOracle>>;
423
+ export type SwitchboardOracle = {
424
+ account: PublicKey;
425
+ reserved: number[];
426
+ reserved1: number[];
427
+ reserved2: number[];
428
+ };
429
+ export declare const switchboardOracleStruct: FixableBeetStruct<SwitchboardOracle, Partial<SwitchboardOracle>>;
430
+ export type NftLoan = {
431
+ accountDiscriminator: number[];
432
+ kind: LoanKind;
433
+ kindDetail: number[];
434
+ status: LoanStatus;
435
+ isCustom: number;
436
+ padding1: number[];
437
+ borrower: PublicKey;
438
+ bank: PublicKey;
439
+ pool: PublicKey;
440
+ collateral: PublicKey;
441
+ principal: PublicKey;
442
+ referrer: PublicKey;
443
+ interest: BigNumber;
444
+ borrowedAmount: BigNumber;
445
+ duration: number;
446
+ collection: number;
447
+ liquidation: number;
448
+ padding2: number[];
449
+ createdAt: BigNumber;
450
+ expiredAt: BigNumber;
451
+ repaidAt: BigNumber;
452
+ liquidatedAt: BigNumber;
453
+ reserved: BigNumber[];
454
+ };
455
+ export declare const nftLoanStruct: FixableBeetStruct<NftLoan, Partial<NftLoan>>;