@kamino-finance/klend-sdk 2.10.8 → 2.10.9

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 (39) hide show
  1. package/dist/idl.json +199 -121
  2. package/dist/idl_codegen/accounts/LendingMarket.d.ts +6 -0
  3. package/dist/idl_codegen/accounts/LendingMarket.js +6 -1
  4. package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
  5. package/dist/idl_codegen/accounts/Obligation.d.ts +9 -0
  6. package/dist/idl_codegen/accounts/Obligation.js +11 -1
  7. package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
  8. package/dist/idl_codegen/errors/custom.d.ts +57 -1
  9. package/dist/idl_codegen/errors/custom.js +92 -1
  10. package/dist/idl_codegen/errors/custom.js.map +1 -1
  11. package/dist/idl_codegen/instructions/index.d.ts +6 -6
  12. package/dist/idl_codegen/instructions/index.js +7 -7
  13. package/dist/idl_codegen/instructions/index.js.map +1 -1
  14. package/dist/idl_codegen/instructions/updateSingleReserveConfig.d.ts +1 -0
  15. package/dist/idl_codegen/instructions/updateSingleReserveConfig.js +2 -0
  16. package/dist/idl_codegen/instructions/updateSingleReserveConfig.js.map +1 -1
  17. package/dist/idl_codegen/types/ReserveConfig.d.ts +7 -2
  18. package/dist/idl_codegen/types/ReserveConfig.js +7 -1
  19. package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
  20. package/dist/idl_codegen/types/UpdateConfigMode.d.ts +13 -0
  21. package/dist/idl_codegen/types/UpdateConfigMode.js +27 -1
  22. package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
  23. package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts +24 -4
  24. package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js +36 -5
  25. package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js.map +1 -1
  26. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +13 -0
  27. package/dist/idl_codegen/types/UpdateLendingMarketMode.js +27 -1
  28. package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
  29. package/dist/idl_codegen/types/index.d.ts +6 -6
  30. package/dist/idl_codegen/types/index.js.map +1 -1
  31. package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +4 -1
  32. package/dist/idl_codegen/zero_padding/ObligationZP.js +6 -0
  33. package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
  34. package/dist/lending_operations/repay_with_collateral_calcs.d.ts +3 -1
  35. package/dist/lending_operations/repay_with_collateral_calcs.js +13 -2
  36. package/dist/lending_operations/repay_with_collateral_calcs.js.map +1 -1
  37. package/dist/lending_operations/repay_with_collateral_operations.js +4 -4
  38. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  39. package/package.json +1 -1
package/dist/idl.json CHANGED
@@ -253,6 +253,10 @@
253
253
  32
254
254
  ]
255
255
  }
256
+ },
257
+ {
258
+ "name": "skipValidation",
259
+ "type": "bool"
256
260
  }
257
261
  ]
258
262
  },
@@ -291,6 +295,124 @@
291
295
  }
292
296
  ]
293
297
  },
298
+ {
299
+ "name": "redeemFees",
300
+ "accounts": [
301
+ {
302
+ "name": "reserve",
303
+ "isMut": true,
304
+ "isSigner": false
305
+ },
306
+ {
307
+ "name": "reserveLiquidityFeeReceiver",
308
+ "isMut": true,
309
+ "isSigner": false
310
+ },
311
+ {
312
+ "name": "reserveSupplyLiquidity",
313
+ "isMut": true,
314
+ "isSigner": false
315
+ },
316
+ {
317
+ "name": "lendingMarket",
318
+ "isMut": false,
319
+ "isSigner": false
320
+ },
321
+ {
322
+ "name": "lendingMarketAuthority",
323
+ "isMut": false,
324
+ "isSigner": false
325
+ },
326
+ {
327
+ "name": "tokenProgram",
328
+ "isMut": false,
329
+ "isSigner": false
330
+ }
331
+ ],
332
+ "args": []
333
+ },
334
+ {
335
+ "name": "socializeLoss",
336
+ "accounts": [
337
+ {
338
+ "name": "riskCouncil",
339
+ "isMut": false,
340
+ "isSigner": true
341
+ },
342
+ {
343
+ "name": "obligation",
344
+ "isMut": true,
345
+ "isSigner": false
346
+ },
347
+ {
348
+ "name": "lendingMarket",
349
+ "isMut": false,
350
+ "isSigner": false
351
+ },
352
+ {
353
+ "name": "reserve",
354
+ "isMut": true,
355
+ "isSigner": false
356
+ },
357
+ {
358
+ "name": "instructionSysvarAccount",
359
+ "isMut": false,
360
+ "isSigner": false
361
+ }
362
+ ],
363
+ "args": [
364
+ {
365
+ "name": "liquidityAmount",
366
+ "type": "u64"
367
+ }
368
+ ]
369
+ },
370
+ {
371
+ "name": "withdrawProtocolFee",
372
+ "accounts": [
373
+ {
374
+ "name": "lendingMarketOwner",
375
+ "isMut": false,
376
+ "isSigner": true
377
+ },
378
+ {
379
+ "name": "lendingMarket",
380
+ "isMut": false,
381
+ "isSigner": false
382
+ },
383
+ {
384
+ "name": "reserve",
385
+ "isMut": false,
386
+ "isSigner": false
387
+ },
388
+ {
389
+ "name": "lendingMarketAuthority",
390
+ "isMut": false,
391
+ "isSigner": false
392
+ },
393
+ {
394
+ "name": "feeVault",
395
+ "isMut": true,
396
+ "isSigner": false
397
+ },
398
+ {
399
+ "name": "lendingMarketOwnerAta",
400
+ "isMut": true,
401
+ "isSigner": false
402
+ },
403
+ {
404
+ "name": "tokenProgram",
405
+ "isMut": false,
406
+ "isSigner": false
407
+ }
408
+ ],
409
+ "args": [
410
+ {
411
+ "name": "amount",
412
+ "type": "u64"
413
+ }
414
+ ]
415
+ },
294
416
  {
295
417
  "name": "refreshReserve",
296
418
  "accounts": [
@@ -1137,42 +1259,6 @@
1137
1259
  }
1138
1260
  ]
1139
1261
  },
1140
- {
1141
- "name": "redeemFees",
1142
- "accounts": [
1143
- {
1144
- "name": "reserve",
1145
- "isMut": true,
1146
- "isSigner": false
1147
- },
1148
- {
1149
- "name": "reserveLiquidityFeeReceiver",
1150
- "isMut": true,
1151
- "isSigner": false
1152
- },
1153
- {
1154
- "name": "reserveSupplyLiquidity",
1155
- "isMut": true,
1156
- "isSigner": false
1157
- },
1158
- {
1159
- "name": "lendingMarket",
1160
- "isMut": false,
1161
- "isSigner": false
1162
- },
1163
- {
1164
- "name": "lendingMarketAuthority",
1165
- "isMut": false,
1166
- "isSigner": false
1167
- },
1168
- {
1169
- "name": "tokenProgram",
1170
- "isMut": false,
1171
- "isSigner": false
1172
- }
1173
- ],
1174
- "args": []
1175
- },
1176
1262
  {
1177
1263
  "name": "flashRepayReserveLiquidity",
1178
1264
  "accounts": [
@@ -1313,42 +1399,6 @@
1313
1399
  }
1314
1400
  ]
1315
1401
  },
1316
- {
1317
- "name": "socializeLoss",
1318
- "accounts": [
1319
- {
1320
- "name": "riskCouncil",
1321
- "isMut": false,
1322
- "isSigner": true
1323
- },
1324
- {
1325
- "name": "obligation",
1326
- "isMut": true,
1327
- "isSigner": false
1328
- },
1329
- {
1330
- "name": "lendingMarket",
1331
- "isMut": false,
1332
- "isSigner": false
1333
- },
1334
- {
1335
- "name": "reserve",
1336
- "isMut": true,
1337
- "isSigner": false
1338
- },
1339
- {
1340
- "name": "instructionSysvarAccount",
1341
- "isMut": false,
1342
- "isSigner": false
1343
- }
1344
- ],
1345
- "args": [
1346
- {
1347
- "name": "liquidityAmount",
1348
- "type": "u64"
1349
- }
1350
- ]
1351
- },
1352
1402
  {
1353
1403
  "name": "requestElevationGroup",
1354
1404
  "accounts": [
@@ -1504,52 +1554,6 @@
1504
1554
  ],
1505
1555
  "args": []
1506
1556
  },
1507
- {
1508
- "name": "withdrawProtocolFee",
1509
- "accounts": [
1510
- {
1511
- "name": "lendingMarketOwner",
1512
- "isMut": false,
1513
- "isSigner": true
1514
- },
1515
- {
1516
- "name": "lendingMarket",
1517
- "isMut": false,
1518
- "isSigner": false
1519
- },
1520
- {
1521
- "name": "reserve",
1522
- "isMut": false,
1523
- "isSigner": false
1524
- },
1525
- {
1526
- "name": "lendingMarketAuthority",
1527
- "isMut": false,
1528
- "isSigner": false
1529
- },
1530
- {
1531
- "name": "feeVault",
1532
- "isMut": true,
1533
- "isSigner": false
1534
- },
1535
- {
1536
- "name": "lendingMarketOwnerAta",
1537
- "isMut": true,
1538
- "isSigner": false
1539
- },
1540
- {
1541
- "name": "tokenProgram",
1542
- "isMut": false,
1543
- "isSigner": false
1544
- }
1545
- ],
1546
- "args": [
1547
- {
1548
- "name": "amount",
1549
- "type": "u64"
1550
- }
1551
- ]
1552
- },
1553
1557
  {
1554
1558
  "name": "initReferrerStateAndShortUrl",
1555
1559
  "accounts": [
@@ -1985,12 +1989,19 @@
1985
1989
  ]
1986
1990
  }
1987
1991
  },
1992
+ {
1993
+ "name": "minNetValueInObligationSf",
1994
+ "docs": [
1995
+ "Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals)"
1996
+ ],
1997
+ "type": "u128"
1998
+ },
1988
1999
  {
1989
2000
  "name": "padding1",
1990
2001
  "type": {
1991
2002
  "array": [
1992
2003
  "u64",
1993
- 180
2004
+ 178
1994
2005
  ]
1995
2006
  }
1996
2007
  }
@@ -2158,12 +2169,28 @@
2158
2169
  ],
2159
2170
  "type": "publicKey"
2160
2171
  },
2172
+ {
2173
+ "name": "borrowingDisabled",
2174
+ "docs": [
2175
+ "Marked = 1 if borrowing disabled, 0 = borrowing enabled"
2176
+ ],
2177
+ "type": "u8"
2178
+ },
2179
+ {
2180
+ "name": "reserved",
2181
+ "type": {
2182
+ "array": [
2183
+ "u8",
2184
+ 7
2185
+ ]
2186
+ }
2187
+ },
2161
2188
  {
2162
2189
  "name": "padding3",
2163
2190
  "type": {
2164
2191
  "array": [
2165
2192
  "u64",
2166
- 128
2193
+ 127
2167
2194
  ]
2168
2195
  }
2169
2196
  }
@@ -2545,6 +2572,9 @@
2545
2572
  },
2546
2573
  {
2547
2574
  "name": "UpdateFarmDebt"
2575
+ },
2576
+ {
2577
+ "name": "UpdateDisableUsageAsCollateralOutsideEmode"
2548
2578
  }
2549
2579
  ]
2550
2580
  }
@@ -2589,6 +2619,12 @@
2589
2619
  "u64"
2590
2620
  ]
2591
2621
  },
2622
+ {
2623
+ "name": "U128",
2624
+ "fields": [
2625
+ "u128"
2626
+ ]
2627
+ },
2592
2628
  {
2593
2629
  "name": "Pubkey",
2594
2630
  "fields": [
@@ -2655,6 +2691,9 @@
2655
2691
  },
2656
2692
  {
2657
2693
  "name": "UpdateBorrowingDisabled"
2694
+ },
2695
+ {
2696
+ "name": "UpdateMinNetValueObligationPostAction"
2658
2697
  }
2659
2698
  ]
2660
2699
  }
@@ -3169,12 +3208,16 @@
3169
3208
  ]
3170
3209
  }
3171
3210
  },
3211
+ {
3212
+ "name": "disableUsageAsCollOutsideEmode",
3213
+ "type": "u8"
3214
+ },
3172
3215
  {
3173
3216
  "name": "reserved1",
3174
3217
  "type": {
3175
3218
  "array": [
3176
3219
  "u8",
3177
- 4
3220
+ 3
3178
3221
  ]
3179
3222
  }
3180
3223
  }
@@ -4097,6 +4140,41 @@
4097
4140
  "code": 6090,
4098
4141
  "name": "DepositLimitExceeded",
4099
4142
  "msg": "Cannot deposit above deposit limit"
4143
+ },
4144
+ {
4145
+ "code": 6091,
4146
+ "name": "BorrowingDisabledOutsideElevationGroup",
4147
+ "msg": "Reserve does not accept any new borrows outside elevation group"
4148
+ },
4149
+ {
4150
+ "code": 6092,
4151
+ "name": "NetValueRemainingTooSmall",
4152
+ "msg": "Net value remaining too small"
4153
+ },
4154
+ {
4155
+ "code": 6093,
4156
+ "name": "WorseLTVBlocked",
4157
+ "msg": "Cannot get the obligation in a worse position"
4158
+ },
4159
+ {
4160
+ "code": 6094,
4161
+ "name": "LiabilitiesBiggerThanAssets",
4162
+ "msg": "Cannot have more liabilities than assets in a position"
4163
+ },
4164
+ {
4165
+ "code": 6095,
4166
+ "name": "ReserveTokenBalanceMismatch",
4167
+ "msg": "Reserve state and token account cannot drift"
4168
+ },
4169
+ {
4170
+ "code": 6096,
4171
+ "name": "ReserveVaultBalanceMismatch",
4172
+ "msg": "Reserve token account has been unexpectedly modified"
4173
+ },
4174
+ {
4175
+ "code": 6097,
4176
+ "name": "ReserveAccountingMismatch",
4177
+ "msg": "Reserve internal state accounting has been unexpectedly modified"
4100
4178
  }
4101
4179
  ]
4102
4180
  }
@@ -47,6 +47,8 @@ export interface LendingMarketFields {
47
47
  /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */
48
48
  elevationGroups: Array<types.ElevationGroupFields>;
49
49
  elevationGroupPadding: Array<BN>;
50
+ /** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */
51
+ minNetValueInObligationSf: BN;
50
52
  padding1: Array<BN>;
51
53
  }
52
54
  export interface LendingMarketJSON {
@@ -94,6 +96,8 @@ export interface LendingMarketJSON {
94
96
  /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */
95
97
  elevationGroups: Array<types.ElevationGroupJSON>;
96
98
  elevationGroupPadding: Array<string>;
99
+ /** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */
100
+ minNetValueInObligationSf: string;
97
101
  padding1: Array<string>;
98
102
  }
99
103
  export declare class LendingMarket {
@@ -141,6 +145,8 @@ export declare class LendingMarket {
141
145
  /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */
142
146
  readonly elevationGroups: Array<types.ElevationGroup>;
143
147
  readonly elevationGroupPadding: Array<BN>;
148
+ /** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */
149
+ readonly minNetValueInObligationSf: BN;
144
150
  readonly padding1: Array<BN>;
145
151
  static readonly discriminator: Buffer;
146
152
  static readonly layout: any;
@@ -66,6 +66,7 @@ class LendingMarket {
66
66
  this.multiplierPointsTagBoost = fields.multiplierPointsTagBoost;
67
67
  this.elevationGroups = fields.elevationGroups.map((item) => new types.ElevationGroup(Object.assign({}, item)));
68
68
  this.elevationGroupPadding = fields.elevationGroupPadding;
69
+ this.minNetValueInObligationSf = fields.minNetValueInObligationSf;
69
70
  this.padding1 = fields.padding1;
70
71
  }
71
72
  static fetch(c, address, programId = programId_1.PROGRAM_ID) {
@@ -120,6 +121,7 @@ class LendingMarket {
120
121
  multiplierPointsTagBoost: dec.multiplierPointsTagBoost,
121
122
  elevationGroups: dec.elevationGroups.map((item /* eslint-disable-line @typescript-eslint/no-explicit-any */) => types.ElevationGroup.fromDecoded(item)),
122
123
  elevationGroupPadding: dec.elevationGroupPadding,
124
+ minNetValueInObligationSf: dec.minNetValueInObligationSf,
123
125
  padding1: dec.padding1,
124
126
  });
125
127
  }
@@ -145,6 +147,7 @@ class LendingMarket {
145
147
  multiplierPointsTagBoost: this.multiplierPointsTagBoost,
146
148
  elevationGroups: this.elevationGroups.map((item) => item.toJSON()),
147
149
  elevationGroupPadding: this.elevationGroupPadding.map((item) => item.toString()),
150
+ minNetValueInObligationSf: this.minNetValueInObligationSf.toString(),
148
151
  padding1: this.padding1.map((item) => item.toString()),
149
152
  };
150
153
  }
@@ -170,6 +173,7 @@ class LendingMarket {
170
173
  multiplierPointsTagBoost: obj.multiplierPointsTagBoost,
171
174
  elevationGroups: obj.elevationGroups.map((item) => types.ElevationGroup.fromJSON(item)),
172
175
  elevationGroupPadding: obj.elevationGroupPadding.map((item) => new bn_js_1.default(item)),
176
+ minNetValueInObligationSf: new bn_js_1.default(obj.minNetValueInObligationSf),
173
177
  padding1: obj.padding1.map((item) => new bn_js_1.default(item)),
174
178
  });
175
179
  }
@@ -199,6 +203,7 @@ LendingMarket.layout = borsh.struct([
199
203
  borsh.array(borsh.u8(), 8, "multiplierPointsTagBoost"),
200
204
  borsh.array(types.ElevationGroup.layout(), 32, "elevationGroups"),
201
205
  borsh.array(borsh.u64(), 90, "elevationGroupPadding"),
202
- borsh.array(borsh.u64(), 180, "padding1"),
206
+ borsh.u128("minNetValueInObligationSf"),
207
+ borsh.array(borsh.u64(), 178, "padding1"),
203
208
  ]);
204
209
  //# sourceMappingURL=LendingMarket.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LendingMarket.js","sourceRoot":"","sources":["../../../src/idl_codegen/accounts/Lend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AC,GAAG,CAAC,4BAA4B,CAAC;IACvC,KAAK,CAAC,GAAG,CAAC,0BAA0B,CAAC;IACrC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAC9B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,0BAA0B,CAAC;IACtD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,iBAAiB,CAAC;IACjE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,uBAAuB,CAAC;IACrD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC;CAC1C,CAAC,CAAA","sourcesContent":["import { PublicKey, Connection } from \"@solana/web3.js\"\nimport BN from \"bn.js\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as borsh from \"@coral-xyz/borsh\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as types from \"../types\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport { PROGRAM_ID } from \"../programId\"\n\nexport interface LendingMarketFields {\n /** Version of lending market */\n version: BN\n /** Bump seed for derived authority address */\n bumpSeed: BN\n /** Owner authority which can add new reserves */\n lendingMarketOwner: PublicKey\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n lendingMarketOwnerCached: PublicKey\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n referralFeeBps: number\n emergencyMode: number\n autodeleverageEnabled: number\n /** Padding used for alignment */\n borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n minFullLiquidationValueThreshold: BN\n /** Max allowed liquidation value in one ix call */\n maxLiquidatableDebtMarketValueAtOnce: BN\n /** Global maximum unhealthy borrow value allowed for any obligation */\n globalUnhealthyBorrowValue: BN\n /** Global maximum allowed borrow value allowed for any obligation */\n globalAllowedBorrowValue: BN\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n riskCouncil: PublicKey\n /** Reward points multiplier per obligation type */\n multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n elevationGroups: Array<types.ElevationGroupFields>\n elevationGroupPadding: Array<BN>\n padding1: Array<BN>\n}\n\nexport interface LendingMarketJSON {\n /** Version of lending market */\n version: string\n /** Bump seed for derived authority address */\n bumpSeed: string\n /** Owner authority which can add new reserves */\n lendingMarketOwner: string\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n lendingMarketOwnerCached: string\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n referralFeeBps: number\n emergencyMode: number\n autodeleverageEnabled: number\n /** Padding used for alignment */\n borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n minFullLiquidationValueThreshold: string\n /** Max allowed liquidation value in one ix call */\n maxLiquidatableDebtMarketValueAtOnce: string\n /** Global maximum unhealthy borrow value allowed for any obligation */\n globalUnhealthyBorrowValue: string\n /** Global maximum allowed borrow value allowed for any obligation */\n globalAllowedBorrowValue: string\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n riskCouncil: string\n /** Reward points multiplier per obligation type */\n multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n elevationGroups: Array<types.ElevationGroupJSON>\n elevationGroupPadding: Array<string>\n padding1: Array<string>\n}\n\nexport class LendingMarket {\n /** Version of lending market */\n readonly version: BN\n /** Bump seed for derived authority address */\n readonly bumpSeed: BN\n /** Owner authority which can add new reserves */\n readonly lendingMarketOwner: PublicKey\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n readonly lendingMarketOwnerCached: PublicKey\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n readonly quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n readonly referralFeeBps: number\n readonly emergencyMode: number\n readonly autodeleverageEnabled: number\n /** Padding used for alignment */\n readonly borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n readonly priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n readonly liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n readonly insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n readonly minFullLiquidationValueThreshold: BN\n /** Max allowed liquidation value in one ix call */\n readonly maxLiquidatableDebtMarketValueAtOnce: BN\n /** Global maximum unhealthy borrow value allowed for any obligation */\n readonly globalUnhealthyBorrowValue: BN\n /** Global maximum allowed borrow value allowed for any obligation */\n readonly globalAllowedBorrowValue: BN\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n readonly riskCouncil: PublicKey\n /** Reward points multiplier per obligation type */\n readonly multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n readonly elevationGroups: Array<types.ElevationGroup>\n readonly elevationGroupPadding: Array<BN>\n readonly padding1: Array<BN>\n\n static readonly discriminator = Buffer.from([\n 246, 114, 50, 98, 72, 157, 28, 120,\n ])\n\n static readonly layout = borsh.struct([\n borsh.u64(\"version\"),\n borsh.u64(\"bumpSeed\"),\n borsh.publicKey(\"lendingMarketOwner\"),\n borsh.publicKey(\"lendingMarketOwnerCached\"),\n borsh.array(borsh.u8(), 32, \"quoteCurrency\"),\n borsh.u16(\"referralFeeBps\"),\n borsh.u8(\"emergencyMode\"),\n borsh.u8(\"autodeleverageEnabled\"),\n borsh.u8(\"borrowDisabled\"),\n borsh.u8(\"priceRefreshTriggerToMaxAgePct\"),\n borsh.u8(\"liquidationMaxDebtCloseFactorPct\"),\n borsh.u8(\"insolvencyRiskUnhealthyLtvPct\"),\n borsh.u64(\"minFullLiquidationValueThreshold\"),\n borsh.u64(\"maxLiquidatableDebtMarketValueAtOnce\"),\n borsh.u64(\"globalUnhealthyBorrowValue\"),\n borsh.u64(\"globalAllowedBorrowValue\"),\n borsh.publicKey(\"riskCouncil\"),\n borsh.array(borsh.u8(), 8, \"multiplierPointsTagBoost\"),\n borsh.array(types.ElevationGroup.layout(), 32, \"elevationGroups\"),\n borsh.array(borsh.u64(), 90, \"elevationGroupPadding\"),\n borsh.array(borsh.u64(), 180, \"padding1\"),\n ])\n\n constructor(fields: LendingMarketFields) {\n this.version = fields.version\n this.bumpSeed = fields.bumpSeed\n this.lendingMarketOwner = fields.lendingMarketOwner\n this.lendingMarketOwnerCached = fields.lendingMarketOwnerCached\n this.quoteCurrency = fields.quoteCurrency\n this.referralFeeBps = fields.referralFeeBps\n this.emergencyMode = fields.emergencyMode\n this.autodeleverageEnabled = fields.autodeleverageEnabled\n this.borrowDisabled = fields.borrowDisabled\n this.priceRefreshTriggerToMaxAgePct = fields.priceRefreshTriggerToMaxAgePct\n this.liquidationMaxDebtCloseFactorPct =\n fields.liquidationMaxDebtCloseFactorPct\n this.insolvencyRiskUnhealthyLtvPct = fields.insolvencyRiskUnhealthyLtvPct\n this.minFullLiquidationValueThreshold =\n fields.minFullLiquidationValueThreshold\n this.maxLiquidatableDebtMarketValueAtOnce =\n fields.maxLiquidatableDebtMarketValueAtOnce\n this.globalUnhealthyBorrowValue = fields.globalUnhealthyBorrowValue\n this.globalAllowedBorrowValue = fields.globalAllowedBorrowValue\n this.riskCouncil = fields.riskCouncil\n this.multiplierPointsTagBoost = fields.multiplierPointsTagBoost\n this.elevationGroups = fields.elevationGroups.map(\n (item) => new types.ElevationGroup({ ...item })\n )\n this.elevationGroupPadding = fields.elevationGroupPadding\n this.padding1 = fields.padding1\n }\n\n static async fetch(\n c: Connection,\n address: PublicKey,\n programId: PublicKey = PROGRAM_ID\n ): Promise<LendingMarket | null> {\n const info = await c.getAccountInfo(address)\n\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n }\n\n static async fetchMultiple(\n c: Connection,\n addresses: PublicKey[],\n programId: PublicKey = PROGRAM_ID\n ): Promise<Array<LendingMarket | null>> {\n const infos = await c.getMultipleAccountsInfo(addresses)\n\n return infos.map((info) => {\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n })\n }\n\n static decode(data: Buffer): LendingMarket {\n if (!data.slice(0, 8).equals(LendingMarket.discriminator)) {\n throw new Error(\"invalid account discriminator\")\n }\n\n const dec = LendingMarket.layout.decode(data.slice(8))\n\n return new LendingMarket({\n version: dec.version,\n bumpSeed: dec.bumpSeed,\n lendingMarketOwner: dec.lendingMarketOwner,\n lendingMarketOwnerCached: dec.lendingMarketOwnerCached,\n quoteCurrency: dec.quoteCurrency,\n referralFeeBps: dec.referralFeeBps,\n emergencyMode: dec.emergencyMode,\n autodeleverageEnabled: dec.autodeleverageEnabled,\n borrowDisabled: dec.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: dec.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: dec.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: dec.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold: dec.minFullLiquidationValueThreshold,\n maxLiquidatableDebtMarketValueAtOnce:\n dec.maxLiquidatableDebtMarketValueAtOnce,\n globalUnhealthyBorrowValue: dec.globalUnhealthyBorrowValue,\n globalAllowedBorrowValue: dec.globalAllowedBorrowValue,\n riskCouncil: dec.riskCouncil,\n multiplierPointsTagBoost: dec.multiplierPointsTagBoost,\n elevationGroups: dec.elevationGroups.map(\n (\n item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */\n ) => types.ElevationGroup.fromDecoded(item)\n ),\n elevationGroupPadding: dec.elevationGroupPadding,\n padding1: dec.padding1,\n })\n }\n\n toJSON(): LendingMarketJSON {\n return {\n version: this.version.toString(),\n bumpSeed: this.bumpSeed.toString(),\n lendingMarketOwner: this.lendingMarketOwner.toString(),\n lendingMarketOwnerCached: this.lendingMarketOwnerCached.toString(),\n quoteCurrency: this.quoteCurrency,\n referralFeeBps: this.referralFeeBps,\n emergencyMode: this.emergencyMode,\n autodeleverageEnabled: this.autodeleverageEnabled,\n borrowDisabled: this.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: this.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: this.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: this.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold:\n this.minFullLiquidationValueThreshold.toString(),\n maxLiquidatableDebtMarketValueAtOnce:\n this.maxLiquidatableDebtMarketValueAtOnce.toString(),\n globalUnhealthyBorrowValue: this.globalUnhealthyBorrowValue.toString(),\n globalAllowedBorrowValue: this.globalAllowedBorrowValue.toString(),\n riskCouncil: this.riskCouncil.toString(),\n multiplierPointsTagBoost: this.multiplierPointsTagBoost,\n elevationGroups: this.elevationGroups.map((item) => item.toJSON()),\n elevationGroupPadding: this.elevationGroupPadding.map((item) =>\n item.toString()\n ),\n padding1: this.padding1.map((item) => item.toString()),\n }\n }\n\n static fromJSON(obj: LendingMarketJSON): LendingMarket {\n return new LendingMarket({\n version: new BN(obj.version),\n bumpSeed: new BN(obj.bumpSeed),\n lendingMarketOwner: new PublicKey(obj.lendingMarketOwner),\n lendingMarketOwnerCached: new PublicKey(obj.lendingMarketOwnerCached),\n quoteCurrency: obj.quoteCurrency,\n referralFeeBps: obj.referralFeeBps,\n emergencyMode: obj.emergencyMode,\n autodeleverageEnabled: obj.autodeleverageEnabled,\n borrowDisabled: obj.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: obj.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: obj.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: obj.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold: new BN(\n obj.minFullLiquidationValueThreshold\n ),\n maxLiquidatableDebtMarketValueAtOnce: new BN(\n obj.maxLiquidatableDebtMarketValueAtOnce\n ),\n globalUnhealthyBorrowValue: new BN(obj.globalUnhealthyBorrowValue),\n globalAllowedBorrowValue: new BN(obj.globalAllowedBorrowValue),\n riskCouncil: new PublicKey(obj.riskCouncil),\n multiplierPointsTagBoost: obj.multiplierPointsTagBoost,\n elevationGroups: obj.elevationGroups.map((item) =>\n types.ElevationGroup.fromJSON(item)\n ),\n elevationGroupPadding: obj.elevationGroupPadding.map(\n (item) => new BN(item)\n ),\n padding1: obj.padding1.map((item) => new BN(item)),\n })\n }\n}\n"]}
1
+ {"version":3,"file":"LendingMarket.js","sourceRoot":"","sources":["../../../src/idl_codegen/accounts/LendingMarket.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAuD;AACvD,kDAAsB,CAAC,wDAAwD;AAC/E,wDAAyC,CAAC,wDAAwD;AAClG,gDAAiC,CAAC,wDAAwD;AAC1F,4CAAyC;AAsGzC,MAAa,aAAa;IA8ExB,YAAY,MAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;QAC/B,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAA;QACnD,IAAI,CAAC,wBAAwB,GAAG,MAAM,CAAC,wBAAwB,CAAA;QAC/D,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAA;QACzC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAA;QAC3C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAA;QACzC,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAA;QACzD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAA;QAC3C,IAAI,CAAC,8BAA8B,GAAG,MAAM,CAAC,8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ection } from \"@solana/web3.js\"\nimport BN from \"bn.js\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as borsh from \"@coral-xyz/borsh\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport * as types from \"../types\" // eslint-disable-line @typescript-eslint/no-unused-vars\nimport { PROGRAM_ID } from \"../programId\"\n\nexport interface LendingMarketFields {\n /** Version of lending market */\n version: BN\n /** Bump seed for derived authority address */\n bumpSeed: BN\n /** Owner authority which can add new reserves */\n lendingMarketOwner: PublicKey\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n lendingMarketOwnerCached: PublicKey\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n referralFeeBps: number\n emergencyMode: number\n autodeleverageEnabled: number\n /** Padding used for alignment */\n borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n minFullLiquidationValueThreshold: BN\n /** Max allowed liquidation value in one ix call */\n maxLiquidatableDebtMarketValueAtOnce: BN\n /** Global maximum unhealthy borrow value allowed for any obligation */\n globalUnhealthyBorrowValue: BN\n /** Global maximum allowed borrow value allowed for any obligation */\n globalAllowedBorrowValue: BN\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n riskCouncil: PublicKey\n /** Reward points multiplier per obligation type */\n multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n elevationGroups: Array<types.ElevationGroupFields>\n elevationGroupPadding: Array<BN>\n /** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */\n minNetValueInObligationSf: BN\n padding1: Array<BN>\n}\n\nexport interface LendingMarketJSON {\n /** Version of lending market */\n version: string\n /** Bump seed for derived authority address */\n bumpSeed: string\n /** Owner authority which can add new reserves */\n lendingMarketOwner: string\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n lendingMarketOwnerCached: string\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n referralFeeBps: number\n emergencyMode: number\n autodeleverageEnabled: number\n /** Padding used for alignment */\n borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n minFullLiquidationValueThreshold: string\n /** Max allowed liquidation value in one ix call */\n maxLiquidatableDebtMarketValueAtOnce: string\n /** Global maximum unhealthy borrow value allowed for any obligation */\n globalUnhealthyBorrowValue: string\n /** Global maximum allowed borrow value allowed for any obligation */\n globalAllowedBorrowValue: string\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n riskCouncil: string\n /** Reward points multiplier per obligation type */\n multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n elevationGroups: Array<types.ElevationGroupJSON>\n elevationGroupPadding: Array<string>\n /** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */\n minNetValueInObligationSf: string\n padding1: Array<string>\n}\n\nexport class LendingMarket {\n /** Version of lending market */\n readonly version: BN\n /** Bump seed for derived authority address */\n readonly bumpSeed: BN\n /** Owner authority which can add new reserves */\n readonly lendingMarketOwner: PublicKey\n /** Temporary cache of the lending market owner, used in update_lending_market_owner */\n readonly lendingMarketOwnerCached: PublicKey\n /**\n * Currency market prices are quoted in\n * e.g. \"USD\" null padded (`*b\"USD\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"`) or a SPL token mint pubkey\n */\n readonly quoteCurrency: Array<number>\n /** Referral fee for the lending market, as bps out of the total protocol fee */\n readonly referralFeeBps: number\n readonly emergencyMode: number\n readonly autodeleverageEnabled: number\n /** Padding used for alignment */\n readonly borrowDisabled: number\n /**\n * Refresh price from oracle only if it's older than this percentage of the price max age.\n * e.g. if the max age is set to 100s and this is set to 80%, the price will be refreshed if it's older than 80s.\n * Price is always refreshed if this set to 0.\n */\n readonly priceRefreshTriggerToMaxAgePct: number\n /** Percentage of the total borrowed value in an obligation available for liquidation */\n readonly liquidationMaxDebtCloseFactorPct: number\n /** Minimum acceptable unhealthy LTV before max_debt_close_factor_pct becomes 100% */\n readonly insolvencyRiskUnhealthyLtvPct: number\n /** Minimum liquidation value threshold triggering full liquidation for an obligation */\n readonly minFullLiquidationValueThreshold: BN\n /** Max allowed liquidation value in one ix call */\n readonly maxLiquidatableDebtMarketValueAtOnce: BN\n /** Global maximum unhealthy borrow value allowed for any obligation */\n readonly globalUnhealthyBorrowValue: BN\n /** Global maximum allowed borrow value allowed for any obligation */\n readonly globalAllowedBorrowValue: BN\n /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */\n readonly riskCouncil: PublicKey\n /** Reward points multiplier per obligation type */\n readonly multiplierPointsTagBoost: Array<number>\n /** Elevation groups are used to group together reserves that have the same risk parameters and can bump the ltv and liquidation threshold */\n readonly elevationGroups: Array<types.ElevationGroup>\n readonly elevationGroupPadding: Array<BN>\n /** Min net value accepted to be found in a position after any lending action in an obligation (scaled by quote currency decimals) */\n readonly minNetValueInObligationSf: BN\n readonly padding1: Array<BN>\n\n static readonly discriminator = Buffer.from([\n 246, 114, 50, 98, 72, 157, 28, 120,\n ])\n\n static readonly layout = borsh.struct([\n borsh.u64(\"version\"),\n borsh.u64(\"bumpSeed\"),\n borsh.publicKey(\"lendingMarketOwner\"),\n borsh.publicKey(\"lendingMarketOwnerCached\"),\n borsh.array(borsh.u8(), 32, \"quoteCurrency\"),\n borsh.u16(\"referralFeeBps\"),\n borsh.u8(\"emergencyMode\"),\n borsh.u8(\"autodeleverageEnabled\"),\n borsh.u8(\"borrowDisabled\"),\n borsh.u8(\"priceRefreshTriggerToMaxAgePct\"),\n borsh.u8(\"liquidationMaxDebtCloseFactorPct\"),\n borsh.u8(\"insolvencyRiskUnhealthyLtvPct\"),\n borsh.u64(\"minFullLiquidationValueThreshold\"),\n borsh.u64(\"maxLiquidatableDebtMarketValueAtOnce\"),\n borsh.u64(\"globalUnhealthyBorrowValue\"),\n borsh.u64(\"globalAllowedBorrowValue\"),\n borsh.publicKey(\"riskCouncil\"),\n borsh.array(borsh.u8(), 8, \"multiplierPointsTagBoost\"),\n borsh.array(types.ElevationGroup.layout(), 32, \"elevationGroups\"),\n borsh.array(borsh.u64(), 90, \"elevationGroupPadding\"),\n borsh.u128(\"minNetValueInObligationSf\"),\n borsh.array(borsh.u64(), 178, \"padding1\"),\n ])\n\n constructor(fields: LendingMarketFields) {\n this.version = fields.version\n this.bumpSeed = fields.bumpSeed\n this.lendingMarketOwner = fields.lendingMarketOwner\n this.lendingMarketOwnerCached = fields.lendingMarketOwnerCached\n this.quoteCurrency = fields.quoteCurrency\n this.referralFeeBps = fields.referralFeeBps\n this.emergencyMode = fields.emergencyMode\n this.autodeleverageEnabled = fields.autodeleverageEnabled\n this.borrowDisabled = fields.borrowDisabled\n this.priceRefreshTriggerToMaxAgePct = fields.priceRefreshTriggerToMaxAgePct\n this.liquidationMaxDebtCloseFactorPct =\n fields.liquidationMaxDebtCloseFactorPct\n this.insolvencyRiskUnhealthyLtvPct = fields.insolvencyRiskUnhealthyLtvPct\n this.minFullLiquidationValueThreshold =\n fields.minFullLiquidationValueThreshold\n this.maxLiquidatableDebtMarketValueAtOnce =\n fields.maxLiquidatableDebtMarketValueAtOnce\n this.globalUnhealthyBorrowValue = fields.globalUnhealthyBorrowValue\n this.globalAllowedBorrowValue = fields.globalAllowedBorrowValue\n this.riskCouncil = fields.riskCouncil\n this.multiplierPointsTagBoost = fields.multiplierPointsTagBoost\n this.elevationGroups = fields.elevationGroups.map(\n (item) => new types.ElevationGroup({ ...item })\n )\n this.elevationGroupPadding = fields.elevationGroupPadding\n this.minNetValueInObligationSf = fields.minNetValueInObligationSf\n this.padding1 = fields.padding1\n }\n\n static async fetch(\n c: Connection,\n address: PublicKey,\n programId: PublicKey = PROGRAM_ID\n ): Promise<LendingMarket | null> {\n const info = await c.getAccountInfo(address)\n\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n }\n\n static async fetchMultiple(\n c: Connection,\n addresses: PublicKey[],\n programId: PublicKey = PROGRAM_ID\n ): Promise<Array<LendingMarket | null>> {\n const infos = await c.getMultipleAccountsInfo(addresses)\n\n return infos.map((info) => {\n if (info === null) {\n return null\n }\n if (!info.owner.equals(programId)) {\n throw new Error(\"account doesn't belong to this program\")\n }\n\n return this.decode(info.data)\n })\n }\n\n static decode(data: Buffer): LendingMarket {\n if (!data.slice(0, 8).equals(LendingMarket.discriminator)) {\n throw new Error(\"invalid account discriminator\")\n }\n\n const dec = LendingMarket.layout.decode(data.slice(8))\n\n return new LendingMarket({\n version: dec.version,\n bumpSeed: dec.bumpSeed,\n lendingMarketOwner: dec.lendingMarketOwner,\n lendingMarketOwnerCached: dec.lendingMarketOwnerCached,\n quoteCurrency: dec.quoteCurrency,\n referralFeeBps: dec.referralFeeBps,\n emergencyMode: dec.emergencyMode,\n autodeleverageEnabled: dec.autodeleverageEnabled,\n borrowDisabled: dec.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: dec.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: dec.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: dec.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold: dec.minFullLiquidationValueThreshold,\n maxLiquidatableDebtMarketValueAtOnce:\n dec.maxLiquidatableDebtMarketValueAtOnce,\n globalUnhealthyBorrowValue: dec.globalUnhealthyBorrowValue,\n globalAllowedBorrowValue: dec.globalAllowedBorrowValue,\n riskCouncil: dec.riskCouncil,\n multiplierPointsTagBoost: dec.multiplierPointsTagBoost,\n elevationGroups: dec.elevationGroups.map(\n (\n item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */\n ) => types.ElevationGroup.fromDecoded(item)\n ),\n elevationGroupPadding: dec.elevationGroupPadding,\n minNetValueInObligationSf: dec.minNetValueInObligationSf,\n padding1: dec.padding1,\n })\n }\n\n toJSON(): LendingMarketJSON {\n return {\n version: this.version.toString(),\n bumpSeed: this.bumpSeed.toString(),\n lendingMarketOwner: this.lendingMarketOwner.toString(),\n lendingMarketOwnerCached: this.lendingMarketOwnerCached.toString(),\n quoteCurrency: this.quoteCurrency,\n referralFeeBps: this.referralFeeBps,\n emergencyMode: this.emergencyMode,\n autodeleverageEnabled: this.autodeleverageEnabled,\n borrowDisabled: this.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: this.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: this.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: this.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold:\n this.minFullLiquidationValueThreshold.toString(),\n maxLiquidatableDebtMarketValueAtOnce:\n this.maxLiquidatableDebtMarketValueAtOnce.toString(),\n globalUnhealthyBorrowValue: this.globalUnhealthyBorrowValue.toString(),\n globalAllowedBorrowValue: this.globalAllowedBorrowValue.toString(),\n riskCouncil: this.riskCouncil.toString(),\n multiplierPointsTagBoost: this.multiplierPointsTagBoost,\n elevationGroups: this.elevationGroups.map((item) => item.toJSON()),\n elevationGroupPadding: this.elevationGroupPadding.map((item) =>\n item.toString()\n ),\n minNetValueInObligationSf: this.minNetValueInObligationSf.toString(),\n padding1: this.padding1.map((item) => item.toString()),\n }\n }\n\n static fromJSON(obj: LendingMarketJSON): LendingMarket {\n return new LendingMarket({\n version: new BN(obj.version),\n bumpSeed: new BN(obj.bumpSeed),\n lendingMarketOwner: new PublicKey(obj.lendingMarketOwner),\n lendingMarketOwnerCached: new PublicKey(obj.lendingMarketOwnerCached),\n quoteCurrency: obj.quoteCurrency,\n referralFeeBps: obj.referralFeeBps,\n emergencyMode: obj.emergencyMode,\n autodeleverageEnabled: obj.autodeleverageEnabled,\n borrowDisabled: obj.borrowDisabled,\n priceRefreshTriggerToMaxAgePct: obj.priceRefreshTriggerToMaxAgePct,\n liquidationMaxDebtCloseFactorPct: obj.liquidationMaxDebtCloseFactorPct,\n insolvencyRiskUnhealthyLtvPct: obj.insolvencyRiskUnhealthyLtvPct,\n minFullLiquidationValueThreshold: new BN(\n obj.minFullLiquidationValueThreshold\n ),\n maxLiquidatableDebtMarketValueAtOnce: new BN(\n obj.maxLiquidatableDebtMarketValueAtOnce\n ),\n globalUnhealthyBorrowValue: new BN(obj.globalUnhealthyBorrowValue),\n globalAllowedBorrowValue: new BN(obj.globalAllowedBorrowValue),\n riskCouncil: new PublicKey(obj.riskCouncil),\n multiplierPointsTagBoost: obj.multiplierPointsTagBoost,\n elevationGroups: obj.elevationGroups.map((item) =>\n types.ElevationGroup.fromJSON(item)\n ),\n elevationGroupPadding: obj.elevationGroupPadding.map(\n (item) => new BN(item)\n ),\n minNetValueInObligationSf: new BN(obj.minNetValueInObligationSf),\n padding1: obj.padding1.map((item) => new BN(item)),\n })\n }\n}\n"]}
@@ -42,6 +42,9 @@ export interface ObligationFields {
42
42
  hasDebt: number;
43
43
  /** Wallet address of the referrer */
44
44
  referrer: PublicKey;
45
+ /** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
46
+ borrowingDisabled: number;
47
+ reserved: Array<number>;
45
48
  padding3: Array<BN>;
46
49
  }
47
50
  export interface ObligationJSON {
@@ -84,6 +87,9 @@ export interface ObligationJSON {
84
87
  hasDebt: number;
85
88
  /** Wallet address of the referrer */
86
89
  referrer: string;
90
+ /** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
91
+ borrowingDisabled: number;
92
+ reserved: Array<number>;
87
93
  padding3: Array<string>;
88
94
  }
89
95
  /** Lending market obligation state */
@@ -127,6 +133,9 @@ export declare class Obligation {
127
133
  readonly hasDebt: number;
128
134
  /** Wallet address of the referrer */
129
135
  readonly referrer: PublicKey;
136
+ /** Marked = 1 if borrowing disabled, 0 = borrowing enabled */
137
+ readonly borrowingDisabled: number;
138
+ readonly reserved: Array<number>;
130
139
  readonly padding3: Array<BN>;
131
140
  static readonly discriminator: Buffer;
132
141
  static readonly layout: any;
@@ -63,6 +63,8 @@ class Obligation {
63
63
  this.numOfObsoleteReserves = fields.numOfObsoleteReserves;
64
64
  this.hasDebt = fields.hasDebt;
65
65
  this.referrer = fields.referrer;
66
+ this.borrowingDisabled = fields.borrowingDisabled;
67
+ this.reserved = fields.reserved;
66
68
  this.padding3 = fields.padding3;
67
69
  }
68
70
  static fetch(c, address, programId = programId_1.PROGRAM_ID) {
@@ -115,6 +117,8 @@ class Obligation {
115
117
  numOfObsoleteReserves: dec.numOfObsoleteReserves,
116
118
  hasDebt: dec.hasDebt,
117
119
  referrer: dec.referrer,
120
+ borrowingDisabled: dec.borrowingDisabled,
121
+ reserved: dec.reserved,
118
122
  padding3: dec.padding3,
119
123
  });
120
124
  }
@@ -138,6 +142,8 @@ class Obligation {
138
142
  numOfObsoleteReserves: this.numOfObsoleteReserves,
139
143
  hasDebt: this.hasDebt,
140
144
  referrer: this.referrer.toString(),
145
+ borrowingDisabled: this.borrowingDisabled,
146
+ reserved: this.reserved,
141
147
  padding3: this.padding3.map((item) => item.toString()),
142
148
  };
143
149
  }
@@ -161,6 +167,8 @@ class Obligation {
161
167
  numOfObsoleteReserves: obj.numOfObsoleteReserves,
162
168
  hasDebt: obj.hasDebt,
163
169
  referrer: new web3_js_1.PublicKey(obj.referrer),
170
+ borrowingDisabled: obj.borrowingDisabled,
171
+ reserved: obj.reserved,
164
172
  padding3: obj.padding3.map((item) => new bn_js_1.default(item)),
165
173
  });
166
174
  }
@@ -188,6 +196,8 @@ Obligation.layout = borsh.struct([
188
196
  borsh.u8("numOfObsoleteReserves"),
189
197
  borsh.u8("hasDebt"),
190
198
  borsh.publicKey("referrer"),
191
- borsh.array(borsh.u64(), 128, "padding3"),
199
+ borsh.u8("borrowingDisabled"),
200
+ borsh.array(borsh.u8(), 7, "reserved"),
201
+ borsh.array(borsh.u64(), 127, "padding3"),
192
202
  ]);
193
203
  //# sourceMappingURL=Obligation.js.map