@suilend/sdk 12.7.0 → 13.0.0-next.g122801a

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 (86) hide show
  1. package/_generated/_dependencies/pyth-2/price-identifier/structs.d.ts +46 -0
  2. package/_generated/_dependencies/{source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e → pyth-2}/price-identifier/structs.js +45 -25
  3. package/_generated/_dependencies/std/ascii/structs.d.ts +100 -0
  4. package/_generated/_dependencies/{source/0x1 → std}/ascii/structs.js +153 -103
  5. package/_generated/_dependencies/{source/0x1 → std}/option/structs.d.ts +29 -21
  6. package/_generated/_dependencies/std/option/structs.js +155 -0
  7. package/_generated/_dependencies/std/type-name/structs.d.ts +65 -0
  8. package/_generated/_dependencies/{source/0x1 → std}/type-name/structs.js +49 -22
  9. package/_generated/_dependencies/sui/bag/structs.d.ts +75 -0
  10. package/_generated/_dependencies/sui/bag/structs.js +154 -0
  11. package/_generated/_dependencies/{source/0x2 → sui}/balance/structs.d.ts +80 -60
  12. package/_generated/_dependencies/sui/balance/structs.js +306 -0
  13. package/_generated/_dependencies/sui/object/structs.d.ts +104 -0
  14. package/_generated/_dependencies/{source/0x2 → sui}/object/structs.js +98 -46
  15. package/_generated/_dependencies/{source/0x2 → sui}/object-table/structs.d.ts +37 -30
  16. package/_generated/_dependencies/sui/object-table/structs.js +164 -0
  17. package/_generated/_envs/index.d.ts +3 -0
  18. package/_generated/_envs/index.js +18 -0
  19. package/_generated/_envs/mainnet.d.ts +2 -0
  20. package/_generated/_envs/mainnet.js +490 -0
  21. package/_generated/_framework/env.d.ts +137 -0
  22. package/_generated/_framework/env.js +261 -0
  23. package/_generated/_framework/reified.d.ts +68 -36
  24. package/_generated/_framework/reified.js +110 -98
  25. package/_generated/_framework/util.d.ts +4 -4
  26. package/_generated/_framework/util.js +82 -79
  27. package/_generated/_framework/vector.d.ts +11 -9
  28. package/_generated/_framework/vector.js +10 -10
  29. package/_generated/suilend/cell/structs.d.ts +24 -22
  30. package/_generated/suilend/cell/structs.js +68 -24
  31. package/_generated/suilend/decimal/structs.d.ts +28 -24
  32. package/_generated/suilend/decimal/structs.js +45 -24
  33. package/_generated/suilend/index.d.ts +5 -6
  34. package/_generated/suilend/index.js +10 -19
  35. package/_generated/suilend/lending-market/functions.d.ts +1123 -149
  36. package/_generated/suilend/lending-market/functions.js +1121 -207
  37. package/_generated/suilend/lending-market/structs.d.ts +985 -1290
  38. package/_generated/suilend/lending-market/structs.js +2482 -1282
  39. package/_generated/suilend/lending-market-registry/functions.d.ts +32 -3
  40. package/_generated/suilend/lending-market-registry/functions.js +30 -6
  41. package/_generated/suilend/liquidity-mining/structs.d.ts +200 -333
  42. package/_generated/suilend/liquidity-mining/structs.js +449 -319
  43. package/_generated/suilend/obligation/structs.d.ts +406 -918
  44. package/_generated/suilend/obligation/structs.js +786 -596
  45. package/_generated/suilend/rate-limiter/functions.d.ts +134 -15
  46. package/_generated/suilend/rate-limiter/functions.js +139 -21
  47. package/_generated/suilend/rate-limiter/structs.d.ts +72 -80
  48. package/_generated/suilend/rate-limiter/structs.js +98 -48
  49. package/_generated/suilend/reserve/structs.d.ts +611 -904
  50. package/_generated/suilend/reserve/structs.js +1528 -736
  51. package/_generated/suilend/reserve-config/functions.d.ts +718 -96
  52. package/_generated/suilend/reserve-config/functions.js +751 -157
  53. package/_generated/suilend/reserve-config/structs.d.ts +148 -163
  54. package/_generated/suilend/reserve-config/structs.js +260 -94
  55. package/client.d.ts +2 -2
  56. package/client.js +22 -39
  57. package/lib/initialize.d.ts +617 -83
  58. package/lib/initialize.js +151 -48
  59. package/lib/proCompatible.js +5 -5
  60. package/package.json +1 -1
  61. package/parsers/lendingMarket.d.ts +9 -9
  62. package/parsers/obligation.d.ts +14 -14
  63. package/parsers/obligation.js +4 -4
  64. package/parsers/rateLimiter.d.ts +1 -1
  65. package/parsers/reserve.d.ts +12 -12
  66. package/parsers/reserve.js +2 -2
  67. package/strategies.d.ts +14 -14
  68. package/utils/obligation.d.ts +3 -0
  69. package/utils/obligation.js +10 -0
  70. package/utils/simulate.d.ts +1 -1
  71. package/utils/simulate.js +5 -5
  72. package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +0 -84
  73. package/_generated/_dependencies/source/0x1/index.d.ts +0 -3
  74. package/_generated/_dependencies/source/0x1/index.js +0 -3
  75. package/_generated/_dependencies/source/0x1/option/structs.js +0 -110
  76. package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +0 -47
  77. package/_generated/_dependencies/source/0x2/bag/structs.d.ts +0 -52
  78. package/_generated/_dependencies/source/0x2/bag/structs.js +0 -113
  79. package/_generated/_dependencies/source/0x2/balance/structs.js +0 -210
  80. package/_generated/_dependencies/source/0x2/index.d.ts +0 -3
  81. package/_generated/_dependencies/source/0x2/index.js +0 -3
  82. package/_generated/_dependencies/source/0x2/object/structs.d.ts +0 -82
  83. package/_generated/_dependencies/source/0x2/object-table/structs.js +0 -115
  84. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.d.ts +0 -4
  85. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js +0 -4
  86. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +0 -46
@@ -1,303 +1,897 @@
1
- import { PUBLISHED_AT } from "../index.js";
2
- import { generic, obj, pure } from "../../_framework/util.js";
3
- export function set(tx, typeArgs, args) {
4
- return tx.moveCall({
5
- target: `${PUBLISHED_AT}::reserve_config::set`,
6
- typeArguments: typeArgs,
1
+ import { getPublishedAt } from '../../_envs/index.js';
2
+ import { generic, obj, pure } from '../../_framework/util.js';
3
+ /**
4
+ * Creates a new reserve configuration with the specified parameters.
5
+ *
6
+ * Validates the configuration to ensure it meets all required constraints before returning.
7
+ *
8
+ * # Arguments
9
+ *
10
+ * * `open_ltv_pct` - Loan-to-value percentage for opening positions (0-100).
11
+ * * `close_ltv_pct` - Loan-to-value percentage for closing positions (0-100).
12
+ * * `max_close_ltv_pct` - Maximum close LTV percentage (unused, 0-100).
13
+ * * `borrow_weight_bps` - Borrow weight in basis points (minimum 10,000).
14
+ * * `deposit_limit` - Maximum deposit amount in token units.
15
+ * * `borrow_limit` - Maximum borrow amount in token units.
16
+ * * `liquidation_bonus_bps` - Bonus for liquidators in basis points.
17
+ * * `max_liquidation_bonus_bps` - Maximum liquidation bonus in basis points (unused).
18
+ * * `deposit_limit_usd` - Maximum deposit amount in USD.
19
+ * * `borrow_limit_usd` - Maximum borrow amount in USD.
20
+ * * `borrow_fee_bps` - Fee for borrowing in basis points (maximum 10,000).
21
+ * * `spread_fee_bps` - Spread fee in basis points (maximum 10,000).
22
+ * * `protocol_liquidation_fee_bps` - Protocol fee on liquidations in basis points.
23
+ * * `interest_rate_utils` - Vector of utilization rates for interest rate calculation (0-100).
24
+ * * `interest_rate_aprs` - Vector of APRs corresponding to utilization rates.
25
+ * * `isolated` - If true, asset is isolated (can only be borrowed in isolation).
26
+ * * `open_attributed_borrow_limit_usd` - Open attributed borrow limit in USD (unused).
27
+ * * `close_attributed_borrow_limit_usd` - Close attributed borrow limit in USD (unused).
28
+ *
29
+ * # Returns
30
+ *
31
+ * * `ReserveConfig` - A validated reserve configuration.
32
+ *
33
+ * # Panics
34
+ *
35
+ * * If `open_ltv_pct`, `close_ltv_pct`, or `max_close_ltv_pct` exceeds 100 (`EInvalidReserveConfig`).
36
+ * * If `open_ltv_pct` is greater than `close_ltv_pct` (`EInvalidReserveConfig`).
37
+ * * If `close_ltv_pct` is greater than `max_close_ltv_pct` (`EInvalidReserveConfig`).
38
+ * * If `borrow_weight_bps` is less than 10,000 (`EInvalidReserveConfig`).
39
+ * * If `liquidation_bonus_bps` exceeds `max_liquidation_bonus_bps` (`EInvalidReserveConfig`).
40
+ * * If `liquidation_bonus_bps + protocol_liquidation_fee_bps` exceeds 2,000 (`EInvalidReserveConfig`).
41
+ * * If `isolated` is true and `open_ltv_pct` or `close_ltv_pct` is non-zero (`EInvalidReserveConfig`).
42
+ * * If `borrow_fee_bps` or `spread_fee_bps` exceeds 10,000 (`EInvalidReserveConfig`).
43
+ * * If `open_attributed_borrow_limit_usd` exceeds `close_attributed_borrow_limit_usd` (`EInvalidReserveConfig`).
44
+ * * If `interest_rate_utils` has fewer than 2 elements, does not start with 0, or end with 100 (`EInvalidReserveConfig`).
45
+ * * If `interest_rate_utils` and `interest_rate_aprs` have different lengths (`EInvalidReserveConfig`).
46
+ * * If `interest_rate_utils` is not strictly increasing or `interest_rate_aprs` is not monotonically increasing (`EInvalidReserveConfig`).
47
+ */
48
+ export function createReserveConfig(tx, args, options) {
49
+ return tx.moveCall({
50
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::create_reserve_config`,
7
51
  arguments: [
8
- obj(tx, args.builder),
9
- generic(tx, `${typeArgs[0]}`, args.field),
10
- generic(tx, `${typeArgs[1]}`, args.value),
52
+ pure(tx, args.openLtvPct, `u8`),
53
+ pure(tx, args.closeLtvPct, `u8`),
54
+ pure(tx, args.maxCloseLtvPct, `u8`),
55
+ pure(tx, args.borrowWeightBps, `u64`),
56
+ pure(tx, args.depositLimit, `u64`),
57
+ pure(tx, args.borrowLimit, `u64`),
58
+ pure(tx, args.liquidationBonusBps, `u64`),
59
+ pure(tx, args.maxLiquidationBonusBps, `u64`),
60
+ pure(tx, args.depositLimitUsd, `u64`),
61
+ pure(tx, args.borrowLimitUsd, `u64`),
62
+ pure(tx, args.borrowFeeBps, `u64`),
63
+ pure(tx, args.spreadFeeBps, `u64`),
64
+ pure(tx, args.protocolLiquidationFeeBps, `u64`),
65
+ pure(tx, args.interestRateUtils, `vector<u8>`),
66
+ pure(tx, args.interestRateAprs, `vector<u64>`),
67
+ pure(tx, args.isolated, `bool`),
68
+ pure(tx, args.openAttributedBorrowLimitUsd, `u64`),
69
+ pure(tx, args.closeAttributedBorrowLimitUsd, `u64`),
11
70
  ],
12
71
  });
13
72
  }
14
- export function destroy(tx, config) {
73
+ /**
74
+ * The raw basis-points value backing `confidence_multiplier`. Kept separate so `from()`
75
+ * can reseed a builder from the stored bps integer directly, rather than reconstructing
76
+ * it from the `Decimal` `confidence_multiplier` returns -- `decimal.move` has no reverse
77
+ * conversion back to bps.
78
+ */
79
+ export function confidenceMultiplierBps(tx, config, options) {
15
80
  return tx.moveCall({
16
- target: `${PUBLISHED_AT}::reserve_config::destroy`,
81
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::confidence_multiplier_bps`,
17
82
  arguments: [obj(tx, config)],
18
83
  });
19
84
  }
20
- export function from(tx, config) {
85
+ /**
86
+ * A confidence-margin multiplier `k`, stored in basis points (10_000 = 1x) and
87
+ * returned already scaled to a `Decimal`. It is intended to scale Pyth's raw
88
+ * confidence interval `conf` (same decimal exponent as the price):
89
+ * `price_lower_bound = min(spot, ema) - k * conf`,
90
+ * `price_upper_bound = max(spot, ema) + k * conf`.
91
+ * Zero (the default, and every reserve's value until explicitly set) means every
92
+ * valuation is bit-for-bit identical to before this field existed.
93
+ */
94
+ export function confidenceMultiplier(tx, config, options) {
21
95
  return tx.moveCall({
22
- target: `${PUBLISHED_AT}::reserve_config::from`,
96
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::confidence_multiplier`,
23
97
  arguments: [obj(tx, config)],
24
98
  });
25
99
  }
26
- export function setSpreadFeeBps(tx, args) {
100
+ /**
101
+ * Sets a reserve's confidence multiplier `k` (in basis points) on a config under
102
+ * construction, overwriting any existing value -- including removing the entry
103
+ * entirely when `confidence_multiplier_bps == 0`, so `confidence_multiplier` afterwards
104
+ * always reads back `decimal::from_bps(confidence_multiplier_bps)`.
105
+ */
106
+ export function setConfidenceMultiplier(tx, args, options) {
27
107
  return tx.moveCall({
28
- target: `${PUBLISHED_AT}::reserve_config::set_spread_fee_bps`,
29
- arguments: [obj(tx, args.builder), pure(tx, args.spreadFeeBps, `u64`)],
108
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_confidence_multiplier`,
109
+ arguments: [
110
+ obj(tx, args.config),
111
+ pure(tx, args.confidenceMultiplierBps, `u64`),
112
+ ],
30
113
  });
31
114
  }
32
- // reserve_config::set_confidence_multiplier_builder is published (v25), but
33
- // this SDK's PUBLISHED_AT/PKG_V* constants haven't been bumped to v25 yet, so
34
- // there's nothing to regenerate a binding from until that separate regen
35
- // pass happens. Hand-written to match the shape codegen already produces for
36
- // every other u64 builder setter in this file (e.g. setSpreadFeeBps above).
37
- // Replace it with the real generated output once that regen lands.
38
- export function setConfidenceMultiplierBuilder(tx, args) {
39
- return tx.moveCall({
40
- target: `${PUBLISHED_AT}::reserve_config::set_confidence_multiplier_builder`,
115
+ /**
116
+ * Shared by `set_confidence_multiplier`'s zero branch and `destroy()`, the two places
117
+ * a confidence-multiplier entry is ever dropped from a `Bag`.
118
+ */
119
+ export function removeConfidenceMultiplierIfPresent(tx, bag, options) {
120
+ return tx.moveCall({
121
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::remove_confidence_multiplier_if_present`,
122
+ arguments: [obj(tx, bag)],
123
+ });
124
+ }
125
+ /**
126
+ * Validates the reserve configuration to ensure it meets all constraints.
127
+ *
128
+ * Checks various parameters for correctness, including LTVs, borrow weight, liquidation bonuses,
129
+ * fees, and interest rate vectors.
130
+ *
131
+ * # Arguments
132
+ *
133
+ * * `config` - A reference to the `ReserveConfig` to validate.
134
+ *
135
+ * # Panics
136
+ *
137
+ * * If `open_ltv_pct`, `close_ltv_pct`, or `max_close_ltv_pct` exceeds 100 (`EInvalidReserveConfig`).
138
+ * * If `open_ltv_pct` is greater than `close_ltv_pct` (`EInvalidReserveConfig`).
139
+ * * If `close_ltv_pct` is greater than `max_close_ltv_pct` (`EInvalidReserveConfig`).
140
+ * * If `borrow_weight_bps` is less than 10,000 (`EInvalidReserveConfig`).
141
+ * * If `liquidation_bonus_bps` exceeds `max_liquidation_bonus_bps` (`EInvalidReserveConfig`).
142
+ * * If `liquidation_bonus_bps + protocol_liquidation_fee_bps` exceeds 2,000 (`EInvalidReserveConfig`).
143
+ * * If `isolated` is true and `open_ltv_pct` or `close_ltv_pct` is non-zero (`EInvalidReserveConfig`).
144
+ * * If `borrow_fee_bps` or `spread_fee_bps` exceeds 10,000 (`EInvalidReserveConfig`).
145
+ * * If `open_attributed_borrow_limit_usd` exceeds `close_attributed_borrow_limit_usd` (`EInvalidReserveConfig`).
146
+ * * If `interest_rate_utils` has fewer than 2 elements, does not start with 0, or end with 100 (`EInvalidReserveConfig`).
147
+ * * If `interest_rate_utils` and `interest_rate_aprs` have different lengths (`EInvalidReserveConfig`).
148
+ * * If `interest_rate_utils` is not strictly increasing or `interest_rate_aprs` is not monotonically increasing (`EInvalidReserveConfig`).
149
+ */
150
+ export function validateReserveConfig(tx, config, options) {
151
+ return tx.moveCall({
152
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::validate_reserve_config`,
153
+ arguments: [obj(tx, config)],
154
+ });
155
+ }
156
+ /**
157
+ * Validates the interest rate utilization and APR vectors.
158
+ *
159
+ * Ensures the utilization rates are strictly increasing, start at 0, end at 100, and
160
+ * match the length of the APR vector, which must be monotonically increasing.
161
+ *
162
+ * # Arguments
163
+ *
164
+ * * `utils` - A reference to the vector of utilization rates (0-100).
165
+ * * `aprs` - A reference to the vector of APRs in basis points.
166
+ *
167
+ * # Panics
168
+ *
169
+ * * If `utils` has fewer than 2 elements (`EInvalidReserveConfig`).
170
+ * * If `utils` and `aprs` have different lengths (`EInvalidReserveConfig`).
171
+ * * If `utils` does not start with 0 or end with 100 (`EInvalidReserveConfig`).
172
+ * * If `utils` is not strictly increasing (`EInvalidReserveConfig`).
173
+ * * If `aprs` is not monotonically increasing (`EInvalidReserveConfig`).
174
+ */
175
+ export function validateUtilsAndAprs(tx, args, options) {
176
+ return tx.moveCall({
177
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::validate_utils_and_aprs`,
41
178
  arguments: [
42
- obj(tx, args.builder),
43
- pure(tx, args.confidenceMultiplierBps, `u64`),
179
+ pure(tx, args.utils, `vector<u8>`),
180
+ pure(tx, args.aprs, `vector<u64>`),
44
181
  ],
45
182
  });
46
183
  }
47
- export function spreadFee(tx, config) {
48
- return tx.moveCall({
49
- target: `${PUBLISHED_AT}::reserve_config::spread_fee`,
184
+ /**
185
+ * Gets the open loan-to-value (LTV) ratio as a decimal.
186
+ *
187
+ * # Arguments
188
+ *
189
+ * * `config` - A reference to the `ReserveConfig` to query.
190
+ *
191
+ * # Returns
192
+ *
193
+ * * `Decimal` - The open LTV ratio as a decimal (e.g., 50% = 0.5).
194
+ */
195
+ export function openLtv(tx, config, options) {
196
+ return tx.moveCall({
197
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::open_ltv`,
50
198
  arguments: [obj(tx, config)],
51
199
  });
52
200
  }
53
- export function borrowFee(tx, config) {
54
- return tx.moveCall({
55
- target: `${PUBLISHED_AT}::reserve_config::borrow_fee`,
201
+ /**
202
+ * Gets the close loan-to-value (LTV) ratio as a decimal.
203
+ *
204
+ * # Arguments
205
+ *
206
+ * * `config` - A reference to the `ReserveConfig` to query.
207
+ *
208
+ * # Returns
209
+ *
210
+ * * `Decimal` - The close LTV ratio as a decimal (e.g., 50% = 0.5).
211
+ */
212
+ export function closeLtv(tx, config, options) {
213
+ return tx.moveCall({
214
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::close_ltv`,
56
215
  arguments: [obj(tx, config)],
57
216
  });
58
217
  }
59
- export function borrowLimit(tx, config) {
218
+ export function openLtvPct(tx, config, options) {
60
219
  return tx.moveCall({
61
- target: `${PUBLISHED_AT}::reserve_config::borrow_limit`,
220
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::open_ltv_pct`,
62
221
  arguments: [obj(tx, config)],
63
222
  });
64
223
  }
65
- export function borrowLimitUsd(tx, config) {
224
+ export function closeLtvPct(tx, config, options) {
66
225
  return tx.moveCall({
67
- target: `${PUBLISHED_AT}::reserve_config::borrow_limit_usd`,
226
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::close_ltv_pct`,
68
227
  arguments: [obj(tx, config)],
69
228
  });
70
229
  }
71
- export function borrowWeight(tx, config) {
72
- return tx.moveCall({
73
- target: `${PUBLISHED_AT}::reserve_config::borrow_weight`,
230
+ /**
231
+ * Gets the borrow weight as a decimal.
232
+ *
233
+ * # Arguments
234
+ *
235
+ * * `config` - A reference to the `ReserveConfig` to query.
236
+ *
237
+ * # Returns
238
+ *
239
+ * * `Decimal` - The borrow weight as a decimal (e.g., 10,000 bps = 1.0).
240
+ */
241
+ export function borrowWeight(tx, config, options) {
242
+ return tx.moveCall({
243
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::borrow_weight`,
74
244
  arguments: [obj(tx, config)],
75
245
  });
76
246
  }
77
- export function build(tx, builder) {
78
- return tx.moveCall({
79
- target: `${PUBLISHED_AT}::reserve_config::build`,
80
- arguments: [obj(tx, builder)],
247
+ /**
248
+ * Gets the deposit limit in token units.
249
+ *
250
+ * # Arguments
251
+ *
252
+ * * `config` - A reference to the `ReserveConfig` to query.
253
+ *
254
+ * # Returns
255
+ *
256
+ * * `u64` - The maximum deposit amount in token units.
257
+ */
258
+ export function depositLimit(tx, config, options) {
259
+ return tx.moveCall({
260
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::deposit_limit`,
261
+ arguments: [obj(tx, config)],
81
262
  });
82
263
  }
83
- export function calculateApr(tx, args) {
84
- return tx.moveCall({
85
- target: `${PUBLISHED_AT}::reserve_config::calculate_apr`,
86
- arguments: [obj(tx, args.config), obj(tx, args.curUtil)],
264
+ /**
265
+ * Gets the borrow limit in token units.
266
+ *
267
+ * # Arguments
268
+ *
269
+ * * `config` - A reference to the `ReserveConfig` to query.
270
+ *
271
+ * # Returns
272
+ *
273
+ * * `u64` - The maximum borrow amount in token units.
274
+ */
275
+ export function borrowLimit(tx, config, options) {
276
+ return tx.moveCall({
277
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::borrow_limit`,
278
+ arguments: [obj(tx, config)],
87
279
  });
88
280
  }
89
- export function calculateSupplyApr(tx, args) {
90
- return tx.moveCall({
91
- target: `${PUBLISHED_AT}::reserve_config::calculate_supply_apr`,
92
- arguments: [
93
- obj(tx, args.config),
94
- obj(tx, args.curUtil),
95
- obj(tx, args.borrowApr),
96
- ],
281
+ /**
282
+ * Gets the liquidation bonus as a decimal.
283
+ *
284
+ * # Arguments
285
+ *
286
+ * * `config` - A reference to the `ReserveConfig` to query.
287
+ *
288
+ * # Returns
289
+ *
290
+ * * `Decimal` - The liquidation bonus as a decimal (e.g., 500 bps = 0.05).
291
+ */
292
+ export function liquidationBonus(tx, config, options) {
293
+ return tx.moveCall({
294
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::liquidation_bonus`,
295
+ arguments: [obj(tx, config)],
97
296
  });
98
297
  }
99
- export function closeLtv(tx, config) {
100
- return tx.moveCall({
101
- target: `${PUBLISHED_AT}::reserve_config::close_ltv`,
298
+ /**
299
+ * Gets the deposit limit in USD.
300
+ *
301
+ * # Arguments
302
+ *
303
+ * * `config` - A reference to the `ReserveConfig` to query.
304
+ *
305
+ * # Returns
306
+ *
307
+ * * `u64` - The maximum deposit amount in USD.
308
+ */
309
+ export function depositLimitUsd(tx, config, options) {
310
+ return tx.moveCall({
311
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::deposit_limit_usd`,
102
312
  arguments: [obj(tx, config)],
103
313
  });
104
314
  }
105
- export function createReserveConfig(tx, args) {
106
- return tx.moveCall({
107
- target: `${PUBLISHED_AT}::reserve_config::create_reserve_config`,
108
- arguments: [
109
- pure(tx, args.openLtvPct, `u8`),
110
- pure(tx, args.closeLtvPct, `u8`),
111
- pure(tx, args.maxCloseLtvPct, `u8`),
112
- pure(tx, args.borrowWeightBps, `u64`),
113
- pure(tx, args.depositLimit, `u64`),
114
- pure(tx, args.borrowLimit, `u64`),
115
- pure(tx, args.liquidationBonusBps, `u64`),
116
- pure(tx, args.maxLiquidationBonusBps, `u64`),
117
- pure(tx, args.depositLimitUsd, `u64`),
118
- pure(tx, args.borrowLimitUsd, `u64`),
119
- pure(tx, args.borrowFeeBps, `u64`),
120
- pure(tx, args.spreadFeeBps, `u64`),
121
- pure(tx, args.protocolLiquidationFeeBps, `u64`),
122
- pure(tx, args.interestRateUtils, `vector<u8>`),
123
- pure(tx, args.interestRateAprs, `vector<u64>`),
124
- pure(tx, args.isolated, `bool`),
125
- pure(tx, args.openAttributedBorrowLimitUsd, `u64`),
126
- pure(tx, args.closeAttributedBorrowLimitUsd, `u64`),
127
- ],
315
+ /**
316
+ * Gets the borrow limit in USD.
317
+ *
318
+ * # Arguments
319
+ *
320
+ * * `config` - A reference to the `ReserveConfig` to query.
321
+ *
322
+ * # Returns
323
+ *
324
+ * * `u64` - The maximum borrow amount in USD.
325
+ */
326
+ export function borrowLimitUsd(tx, config, options) {
327
+ return tx.moveCall({
328
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::borrow_limit_usd`,
329
+ arguments: [obj(tx, config)],
128
330
  });
129
331
  }
130
- export function depositLimit(tx, config) {
131
- return tx.moveCall({
132
- target: `${PUBLISHED_AT}::reserve_config::deposit_limit`,
332
+ /**
333
+ * Gets the borrow fee as a decimal.
334
+ *
335
+ * # Arguments
336
+ *
337
+ * * `config` - A reference to the `ReserveConfig` to query.
338
+ *
339
+ * # Returns
340
+ *
341
+ * * `Decimal` - The borrow fee as a decimal (e.g., 10 bps = 0.001).
342
+ */
343
+ export function borrowFee(tx, config, options) {
344
+ return tx.moveCall({
345
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::borrow_fee`,
133
346
  arguments: [obj(tx, config)],
134
347
  });
135
348
  }
136
- export function depositLimitUsd(tx, config) {
137
- return tx.moveCall({
138
- target: `${PUBLISHED_AT}::reserve_config::deposit_limit_usd`,
349
+ /**
350
+ * Gets the protocol liquidation fee as a decimal.
351
+ *
352
+ * # Arguments
353
+ *
354
+ * * `config` - A reference to the `ReserveConfig` to query.
355
+ *
356
+ * # Returns
357
+ *
358
+ * * `Decimal` - The protocol liquidation fee as a decimal (e.g., 300 bps = 0.03).
359
+ */
360
+ export function protocolLiquidationFee(tx, config, options) {
361
+ return tx.moveCall({
362
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::protocol_liquidation_fee`,
139
363
  arguments: [obj(tx, config)],
140
364
  });
141
365
  }
142
- export function isolated(tx, config) {
143
- return tx.moveCall({
144
- target: `${PUBLISHED_AT}::reserve_config::isolated`,
366
+ /**
367
+ * Gets the isolation status of the reserve.
368
+ *
369
+ * # Arguments
370
+ *
371
+ * * `config` - A reference to the `ReserveConfig` to query.
372
+ *
373
+ * # Returns
374
+ *
375
+ * * `bool` - True if the asset is isolated, false otherwise.
376
+ */
377
+ export function isolated(tx, config, options) {
378
+ return tx.moveCall({
379
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::isolated`,
145
380
  arguments: [obj(tx, config)],
146
381
  });
147
382
  }
148
- export function liquidationBonus(tx, config) {
149
- return tx.moveCall({
150
- target: `${PUBLISHED_AT}::reserve_config::liquidation_bonus`,
383
+ /**
384
+ * Whether this reserve has been fully retired: no borrowing power, no liquidation value,
385
+ * and closed to new positions on both sides.
386
+ *
387
+ * This is deliberately STRICTER than `open_ltv == 0`. Zeroing open ltv alone is how a
388
+ * reserve is wound down while existing positions survive — the close ltv has to stay put,
389
+ * because zeroing it insta-liquidates every depositor. Such a reserve is still ordinary
390
+ * collateral, priced by a live feed, and worth real money. On MAIN as of 2026-08-18 the two
391
+ * groups are nothing alike: five wound-down reserves (wUSDC, wUSDT, AUSD, WETH, yapSUI) hold
392
+ * $133,635 backing $48,818 of live debt at close ltvs of 75-80%, while every fully retired
393
+ * reserve sits at close ltv 0.
394
+ *
395
+ * Retirement is therefore the honest test for "this deposit is not worth chasing": an
396
+ * operator only reaches this state once the asset backs nothing anyone can realize. Guards
397
+ * that ask what an obligation's collateral is WORTH use this; guards that only ask whether a
398
+ * deposit grants borrowing power use `open_ltv` directly.
399
+ *
400
+ * The off-chain twin is `mayUseOnChainPrice` in `common/utils/reservePriceFallback.ts`,
401
+ * which tests the same four fields and must keep agreeing with this.
402
+ */
403
+ export function isRetired(tx, config, options) {
404
+ return tx.moveCall({
405
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::is_retired`,
151
406
  arguments: [obj(tx, config)],
152
407
  });
153
408
  }
154
- export function openLtv(tx, config) {
155
- return tx.moveCall({
156
- target: `${PUBLISHED_AT}::reserve_config::open_ltv`,
409
+ /**
410
+ * Gets the spread fee as a decimal.
411
+ *
412
+ * # Arguments
413
+ *
414
+ * * `config` - A reference to the `ReserveConfig` to query.
415
+ *
416
+ * # Returns
417
+ *
418
+ * * `Decimal` - The spread fee as a decimal (e.g., 2000 bps = 0.2).
419
+ */
420
+ export function spreadFee(tx, config, options) {
421
+ return tx.moveCall({
422
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::spread_fee`,
157
423
  arguments: [obj(tx, config)],
158
424
  });
159
425
  }
160
- export function protocolLiquidationFee(tx, config) {
161
- return tx.moveCall({
162
- target: `${PUBLISHED_AT}::reserve_config::protocol_liquidation_fee`,
426
+ /**
427
+ * Calculates the annual percentage rate (APR) based on the current utilization.
428
+ *
429
+ * Interpolates the APR based on the utilization rate using the provided `interest_rate_utils`
430
+ * and `interest_rate_aprs` vectors.
431
+ *
432
+ * # Arguments
433
+ *
434
+ * * `config` - A reference to the `ReserveConfig` containing the interest rate data.
435
+ * * `cur_util` - The current utilization rate as a decimal (0 to 1).
436
+ *
437
+ * # Returns
438
+ *
439
+ * * `Decimal` - The calculated APR as a decimal.
440
+ *
441
+ * # Panics
442
+ *
443
+ * * If `cur_util` is greater than 1 (`EInvalidUtil`).
444
+ * * If the interpolation logic fails due to invalid configuration (`EInvalidReserveConfig`).
445
+ */
446
+ export function calculateApr(tx, args, options) {
447
+ return tx.moveCall({
448
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::calculate_apr`,
449
+ arguments: [
450
+ obj(tx, args.config),
451
+ obj(tx, args.curUtil),
452
+ ],
453
+ });
454
+ }
455
+ /**
456
+ * Calculates the supply APR based on the current utilization and borrow APR.
457
+ *
458
+ * Applies the spread fee to the borrow APR and scales it by the utilization rate.
459
+ *
460
+ * # Arguments
461
+ *
462
+ * * `config` - A reference to the `ReserveConfig` containing the spread fee.
463
+ * * `cur_util` - The current utilization rate as a decimal (0 to 1).
464
+ * * `borrow_apr` - The borrow APR as a decimal.
465
+ *
466
+ * # Returns
467
+ *
468
+ * * `Decimal` - The calculated supply APR as a decimal.
469
+ */
470
+ export function calculateSupplyApr(tx, args, options) {
471
+ return tx.moveCall({
472
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::calculate_supply_apr`,
473
+ arguments: [
474
+ obj(tx, args.config),
475
+ obj(tx, args.curUtil),
476
+ obj(tx, args.borrowApr),
477
+ ],
478
+ });
479
+ }
480
+ /**
481
+ * Destroys a reserve configuration, ensuring the additional fields bag is empty.
482
+ *
483
+ * # Arguments
484
+ *
485
+ * * `config` - The `ReserveConfig` to destroy.
486
+ *
487
+ * Drains the confidence multiplier from `additional_fields` before requiring it
488
+ * empty -- callers never need to remove it themselves first.
489
+ *
490
+ * # Panics
491
+ *
492
+ * * If `additional_fields` holds anything other than the confidence multiplier.
493
+ */
494
+ export function destroy(tx, config, options) {
495
+ return tx.moveCall({
496
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::destroy`,
163
497
  arguments: [obj(tx, config)],
164
498
  });
165
499
  }
166
- export function setBorrowFeeBps(tx, args) {
500
+ /**
501
+ * Creates a new reserve configuration builder from an existing configuration.
502
+ *
503
+ * Initializes a `ReserveConfigBuilder` with the fields from the provided `ReserveConfig`.
504
+ *
505
+ * # Arguments
506
+ *
507
+ * * `config` - A reference to the `ReserveConfig` to initialize the builder from.
508
+ *
509
+ * # Returns
510
+ *
511
+ * * `ReserveConfigBuilder` - A new builder initialized with the config's fields.
512
+ */
513
+ export function from(tx, config, options) {
514
+ return tx.moveCall({
515
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::from`,
516
+ arguments: [obj(tx, config)],
517
+ });
518
+ }
519
+ /**
520
+ * Sets the confidence multiplier `k` (in basis points) in the builder. Seeded
521
+ * automatically by `from` from the source config's current value, so
522
+ * `from(...) -> tweak -> build(...)` carries `k` forward the same way every other
523
+ * field already does.
524
+ */
525
+ export function setConfidenceMultiplierBuilder(tx, args, options) {
167
526
  return tx.moveCall({
168
- target: `${PUBLISHED_AT}::reserve_config::set_borrow_fee_bps`,
169
- arguments: [obj(tx, args.builder), pure(tx, args.borrowFeeBps, `u64`)],
527
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_confidence_multiplier_builder`,
528
+ arguments: [
529
+ obj(tx, args.builder),
530
+ pure(tx, args.confidenceMultiplierBps, `u64`),
531
+ ],
170
532
  });
171
533
  }
172
- export function setBorrowLimit(tx, args) {
534
+ /**
535
+ * Sets a field in the reserve configuration builder.
536
+ *
537
+ * Updates an existing field or adds a new one to the builder's fields bag.
538
+ *
539
+ * # Arguments
540
+ *
541
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
542
+ * * `field` - The key for the field to set.
543
+ * * `value` - The value to set for the field.
544
+ */
545
+ export function set(tx, typeArgs, args, options) {
546
+ return tx.moveCall({
547
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set`,
548
+ typeArguments: typeArgs,
549
+ arguments: [
550
+ obj(tx, args.builder),
551
+ generic(tx, `${typeArgs[0]}`, args.field),
552
+ generic(tx, `${typeArgs[1]}`, args.value),
553
+ ],
554
+ });
555
+ }
556
+ export function upsert(tx, typeArgs, args, options) {
173
557
  return tx.moveCall({
174
- target: `${PUBLISHED_AT}::reserve_config::set_borrow_limit`,
175
- arguments: [obj(tx, args.builder), pure(tx, args.borrowLimit, `u64`)],
558
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::upsert`,
559
+ typeArguments: typeArgs,
560
+ arguments: [
561
+ obj(tx, args.bag),
562
+ generic(tx, `${typeArgs[0]}`, args.key),
563
+ generic(tx, `${typeArgs[1]}`, args.value),
564
+ ],
176
565
  });
177
566
  }
178
- export function setBorrowLimitUsd(tx, args) {
567
+ /**
568
+ * Sets the open LTV percentage in the builder.
569
+ *
570
+ * # Arguments
571
+ *
572
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
573
+ * * `open_ltv_pct` - The open LTV percentage to set.
574
+ */
575
+ export function setOpenLtvPct(tx, args, options) {
179
576
  return tx.moveCall({
180
- target: `${PUBLISHED_AT}::reserve_config::set_borrow_limit_usd`,
181
- arguments: [obj(tx, args.builder), pure(tx, args.borrowLimitUsd, `u64`)],
577
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_open_ltv_pct`,
578
+ arguments: [
579
+ obj(tx, args.builder),
580
+ pure(tx, args.openLtvPct, `u8`),
581
+ ],
182
582
  });
183
583
  }
184
- export function setBorrowWeightBps(tx, args) {
584
+ /**
585
+ * Sets the close LTV percentage in the builder.
586
+ *
587
+ * # Arguments
588
+ *
589
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
590
+ * * `close_ltv_pct` - The close LTV percentage to set.
591
+ */
592
+ export function setCloseLtvPct(tx, args, options) {
185
593
  return tx.moveCall({
186
- target: `${PUBLISHED_AT}::reserve_config::set_borrow_weight_bps`,
187
- arguments: [obj(tx, args.builder), pure(tx, args.borrowWeightBps, `u64`)],
594
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_close_ltv_pct`,
595
+ arguments: [
596
+ obj(tx, args.builder),
597
+ pure(tx, args.closeLtvPct, `u8`),
598
+ ],
188
599
  });
189
600
  }
190
- export function setCloseAttributedBorrowLimitUsd(tx, args) {
601
+ /**
602
+ * Sets the maximum close LTV percentage in the builder.
603
+ *
604
+ * # Arguments
605
+ *
606
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
607
+ * * `max_close_ltv_pct` - The maximum close LTV percentage to set.
608
+ */
609
+ export function setMaxCloseLtvPct(tx, args, options) {
191
610
  return tx.moveCall({
192
- target: `${PUBLISHED_AT}::reserve_config::set_close_attributed_borrow_limit_usd`,
611
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_max_close_ltv_pct`,
193
612
  arguments: [
194
613
  obj(tx, args.builder),
195
- pure(tx, args.closeAttributedBorrowLimitUsd, `u64`),
614
+ pure(tx, args.maxCloseLtvPct, `u8`),
196
615
  ],
197
616
  });
198
617
  }
199
- export function setCloseLtvPct(tx, args) {
618
+ /**
619
+ * Sets the borrow weight in basis points in the builder.
620
+ *
621
+ * # Arguments
622
+ *
623
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
624
+ * * `borrow_weight_bps` - The borrow weight in basis points to set.
625
+ */
626
+ export function setBorrowWeightBps(tx, args, options) {
200
627
  return tx.moveCall({
201
- target: `${PUBLISHED_AT}::reserve_config::set_close_ltv_pct`,
202
- arguments: [obj(tx, args.builder), pure(tx, args.closeLtvPct, `u8`)],
628
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_borrow_weight_bps`,
629
+ arguments: [
630
+ obj(tx, args.builder),
631
+ pure(tx, args.borrowWeightBps, `u64`),
632
+ ],
203
633
  });
204
634
  }
205
- export function setDepositLimit(tx, args) {
635
+ /**
636
+ * Sets the deposit limit in token units in the builder.
637
+ *
638
+ * # Arguments
639
+ *
640
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
641
+ * * `deposit_limit` - The deposit limit in token units to set.
642
+ */
643
+ export function setDepositLimit(tx, args, options) {
206
644
  return tx.moveCall({
207
- target: `${PUBLISHED_AT}::reserve_config::set_deposit_limit`,
208
- arguments: [obj(tx, args.builder), pure(tx, args.depositLimit, `u64`)],
645
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_deposit_limit`,
646
+ arguments: [
647
+ obj(tx, args.builder),
648
+ pure(tx, args.depositLimit, `u64`),
649
+ ],
209
650
  });
210
651
  }
211
- export function setDepositLimitUsd(tx, args) {
652
+ /**
653
+ * Sets the borrow limit in token units in the builder.
654
+ *
655
+ * # Arguments
656
+ *
657
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
658
+ * * `borrow_limit` - The borrow limit in token units to set.
659
+ */
660
+ export function setBorrowLimit(tx, args, options) {
212
661
  return tx.moveCall({
213
- target: `${PUBLISHED_AT}::reserve_config::set_deposit_limit_usd`,
214
- arguments: [obj(tx, args.builder), pure(tx, args.depositLimitUsd, `u64`)],
662
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_borrow_limit`,
663
+ arguments: [
664
+ obj(tx, args.builder),
665
+ pure(tx, args.borrowLimit, `u64`),
666
+ ],
215
667
  });
216
668
  }
217
- export function setInterestRateAprs(tx, args) {
669
+ /**
670
+ * Sets the liquidation bonus in basis points in the builder.
671
+ *
672
+ * # Arguments
673
+ *
674
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
675
+ * * `liquidation_bonus_bps` - The liquidation bonus in basis points to set.
676
+ */
677
+ export function setLiquidationBonusBps(tx, args, options) {
218
678
  return tx.moveCall({
219
- target: `${PUBLISHED_AT}::reserve_config::set_interest_rate_aprs`,
679
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_liquidation_bonus_bps`,
220
680
  arguments: [
221
681
  obj(tx, args.builder),
222
- pure(tx, args.interestRateAprs, `vector<u64>`),
682
+ pure(tx, args.liquidationBonusBps, `u64`),
223
683
  ],
224
684
  });
225
685
  }
226
- export function setInterestRateUtils(tx, args) {
686
+ /**
687
+ * Sets the maximum liquidation bonus in basis points in the builder.
688
+ *
689
+ * # Arguments
690
+ *
691
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
692
+ * * `max_liquidation_bonus_bps` - The maximum liquidation bonus in basis points to set.
693
+ */
694
+ export function setMaxLiquidationBonusBps(tx, args, options) {
227
695
  return tx.moveCall({
228
- target: `${PUBLISHED_AT}::reserve_config::set_interest_rate_utils`,
696
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_max_liquidation_bonus_bps`,
229
697
  arguments: [
230
698
  obj(tx, args.builder),
231
- pure(tx, args.interestRateUtils, `vector<u8>`),
699
+ pure(tx, args.maxLiquidationBonusBps, `u64`),
232
700
  ],
233
701
  });
234
702
  }
235
- export function setIsolated(tx, args) {
703
+ /**
704
+ * Sets the deposit limit in USD in the builder.
705
+ *
706
+ * # Arguments
707
+ *
708
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
709
+ * * `deposit_limit_usd` - The deposit limit in USD to set.
710
+ */
711
+ export function setDepositLimitUsd(tx, args, options) {
236
712
  return tx.moveCall({
237
- target: `${PUBLISHED_AT}::reserve_config::set_isolated`,
238
- arguments: [obj(tx, args.builder), pure(tx, args.isolated, `bool`)],
713
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_deposit_limit_usd`,
714
+ arguments: [
715
+ obj(tx, args.builder),
716
+ pure(tx, args.depositLimitUsd, `u64`),
717
+ ],
239
718
  });
240
719
  }
241
- export function setLiquidationBonusBps(tx, args) {
720
+ /**
721
+ * Sets the borrow limit in USD in the builder.
722
+ *
723
+ * # Arguments
724
+ *
725
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
726
+ * * `borrow_limit_usd` - The borrow limit in USD to set.
727
+ */
728
+ export function setBorrowLimitUsd(tx, args, options) {
242
729
  return tx.moveCall({
243
- target: `${PUBLISHED_AT}::reserve_config::set_liquidation_bonus_bps`,
730
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_borrow_limit_usd`,
244
731
  arguments: [
245
732
  obj(tx, args.builder),
246
- pure(tx, args.liquidationBonusBps, `u64`),
733
+ pure(tx, args.borrowLimitUsd, `u64`),
247
734
  ],
248
735
  });
249
736
  }
250
- export function setMaxCloseLtvPct(tx, args) {
737
+ /**
738
+ * Sets the interest rate utilization vector in the builder.
739
+ *
740
+ * # Arguments
741
+ *
742
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
743
+ * * `interest_rate_utils` - The vector of utilization rates to set.
744
+ */
745
+ export function setInterestRateUtils(tx, args, options) {
251
746
  return tx.moveCall({
252
- target: `${PUBLISHED_AT}::reserve_config::set_max_close_ltv_pct`,
253
- arguments: [obj(tx, args.builder), pure(tx, args.maxCloseLtvPct, `u8`)],
747
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_interest_rate_utils`,
748
+ arguments: [
749
+ obj(tx, args.builder),
750
+ pure(tx, args.interestRateUtils, `vector<u8>`),
751
+ ],
254
752
  });
255
753
  }
256
- export function setMaxLiquidationBonusBps(tx, args) {
754
+ /**
755
+ * Sets the interest rate APR vector in the builder.
756
+ *
757
+ * # Arguments
758
+ *
759
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
760
+ * * `interest_rate_aprs` - The vector of APRs to set.
761
+ */
762
+ export function setInterestRateAprs(tx, args, options) {
257
763
  return tx.moveCall({
258
- target: `${PUBLISHED_AT}::reserve_config::set_max_liquidation_bonus_bps`,
764
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_interest_rate_aprs`,
259
765
  arguments: [
260
766
  obj(tx, args.builder),
261
- pure(tx, args.maxLiquidationBonusBps, `u64`),
767
+ pure(tx, args.interestRateAprs, `vector<u64>`),
262
768
  ],
263
769
  });
264
770
  }
265
- export function setOpenAttributedBorrowLimitUsd(tx, args) {
771
+ /**
772
+ * Sets the borrow fee in basis points in the builder.
773
+ *
774
+ * # Arguments
775
+ *
776
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
777
+ * * `borrow_fee_bps` - The borrow fee in basis points to set.
778
+ */
779
+ export function setBorrowFeeBps(tx, args, options) {
266
780
  return tx.moveCall({
267
- target: `${PUBLISHED_AT}::reserve_config::set_open_attributed_borrow_limit_usd`,
781
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_borrow_fee_bps`,
268
782
  arguments: [
269
783
  obj(tx, args.builder),
270
- pure(tx, args.openAttributedBorrowLimitUsd, `u64`),
784
+ pure(tx, args.borrowFeeBps, `u64`),
271
785
  ],
272
786
  });
273
787
  }
274
- export function setOpenLtvPct(tx, args) {
788
+ /**
789
+ * Sets the spread fee in basis points in the builder.
790
+ *
791
+ * # Arguments
792
+ *
793
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
794
+ * * `spread_fee_bps` - The spread fee in basis points to set.
795
+ */
796
+ export function setSpreadFeeBps(tx, args, options) {
275
797
  return tx.moveCall({
276
- target: `${PUBLISHED_AT}::reserve_config::set_open_ltv_pct`,
277
- arguments: [obj(tx, args.builder), pure(tx, args.openLtvPct, `u8`)],
798
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_spread_fee_bps`,
799
+ arguments: [
800
+ obj(tx, args.builder),
801
+ pure(tx, args.spreadFeeBps, `u64`),
802
+ ],
278
803
  });
279
804
  }
280
- export function setProtocolLiquidationFeeBps(tx, args) {
805
+ /**
806
+ * Sets the protocol liquidation fee in basis points in the builder.
807
+ *
808
+ * # Arguments
809
+ *
810
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
811
+ * * `protocol_liquidation_fee_bps` - The protocol liquidation fee in basis points to set.
812
+ */
813
+ export function setProtocolLiquidationFeeBps(tx, args, options) {
281
814
  return tx.moveCall({
282
- target: `${PUBLISHED_AT}::reserve_config::set_protocol_liquidation_fee_bps`,
815
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_protocol_liquidation_fee_bps`,
283
816
  arguments: [
284
817
  obj(tx, args.builder),
285
818
  pure(tx, args.protocolLiquidationFeeBps, `u64`),
286
819
  ],
287
820
  });
288
821
  }
289
- export function validateReserveConfig(tx, config) {
822
+ /**
823
+ * Sets the isolation status in the builder.
824
+ *
825
+ * # Arguments
826
+ *
827
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
828
+ * * `isolated` - The isolation status to set.
829
+ */
830
+ export function setIsolated(tx, args, options) {
290
831
  return tx.moveCall({
291
- target: `${PUBLISHED_AT}::reserve_config::validate_reserve_config`,
292
- arguments: [obj(tx, config)],
832
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_isolated`,
833
+ arguments: [
834
+ obj(tx, args.builder),
835
+ pure(tx, args.isolated, `bool`),
836
+ ],
293
837
  });
294
838
  }
295
- export function validateUtilsAndAprs(tx, args) {
839
+ /**
840
+ * Sets the open attributed borrow limit in USD in the builder.
841
+ *
842
+ * # Arguments
843
+ *
844
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
845
+ * * `open_attributed_borrow_limit_usd` - The open attributed borrow limit in USD to set.
846
+ */
847
+ export function setOpenAttributedBorrowLimitUsd(tx, args, options) {
296
848
  return tx.moveCall({
297
- target: `${PUBLISHED_AT}::reserve_config::validate_utils_and_aprs`,
849
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_open_attributed_borrow_limit_usd`,
298
850
  arguments: [
299
- pure(tx, args.utils, `vector<u8>`),
300
- pure(tx, args.aprs, `vector<u64>`),
851
+ obj(tx, args.builder),
852
+ pure(tx, args.openAttributedBorrowLimitUsd, `u64`),
301
853
  ],
302
854
  });
303
855
  }
856
+ /**
857
+ * Sets the close attributed borrow limit in USD in the builder.
858
+ *
859
+ * # Arguments
860
+ *
861
+ * * `builder` - A mutable reference to the `ReserveConfigBuilder`.
862
+ * * `close_attributed_borrow_limit_usd` - The close attributed borrow limit in USD to set.
863
+ */
864
+ export function setCloseAttributedBorrowLimitUsd(tx, args, options) {
865
+ return tx.moveCall({
866
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::set_close_attributed_borrow_limit_usd`,
867
+ arguments: [
868
+ obj(tx, args.builder),
869
+ pure(tx, args.closeAttributedBorrowLimitUsd, `u64`),
870
+ ],
871
+ });
872
+ }
873
+ /**
874
+ * Builds a reserve configuration from the builder.
875
+ *
876
+ * Constructs a `ReserveConfig` by extracting all fields from the builder's bag and
877
+ * validating the resulting configuration.
878
+ *
879
+ * # Arguments
880
+ *
881
+ * * `builder` - The `ReserveConfigBuilder` to build from.
882
+ *
883
+ * # Returns
884
+ *
885
+ * * `ReserveConfig` - The constructed and validated reserve configuration.
886
+ *
887
+ * # Panics
888
+ *
889
+ * * If any required field is missing from the builder's bag.
890
+ * * If the constructed configuration fails validation (see `validate_reserve_config` for details).
891
+ */
892
+ export function build(tx, builder, options) {
893
+ return tx.moveCall({
894
+ target: `${getPublishedAt('suilend', options?.env)}::reserve_config::build`,
895
+ arguments: [obj(tx, builder)],
896
+ });
897
+ }