@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.
- package/_generated/_dependencies/pyth-2/price-identifier/structs.d.ts +46 -0
- package/_generated/_dependencies/{source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e → pyth-2}/price-identifier/structs.js +45 -25
- package/_generated/_dependencies/std/ascii/structs.d.ts +100 -0
- package/_generated/_dependencies/{source/0x1 → std}/ascii/structs.js +153 -103
- package/_generated/_dependencies/{source/0x1 → std}/option/structs.d.ts +29 -21
- package/_generated/_dependencies/std/option/structs.js +155 -0
- package/_generated/_dependencies/std/type-name/structs.d.ts +65 -0
- package/_generated/_dependencies/{source/0x1 → std}/type-name/structs.js +49 -22
- package/_generated/_dependencies/sui/bag/structs.d.ts +75 -0
- package/_generated/_dependencies/sui/bag/structs.js +154 -0
- package/_generated/_dependencies/{source/0x2 → sui}/balance/structs.d.ts +80 -60
- package/_generated/_dependencies/sui/balance/structs.js +306 -0
- package/_generated/_dependencies/sui/object/structs.d.ts +104 -0
- package/_generated/_dependencies/{source/0x2 → sui}/object/structs.js +98 -46
- package/_generated/_dependencies/{source/0x2 → sui}/object-table/structs.d.ts +37 -30
- package/_generated/_dependencies/sui/object-table/structs.js +164 -0
- package/_generated/_envs/index.d.ts +3 -0
- package/_generated/_envs/index.js +18 -0
- package/_generated/_envs/mainnet.d.ts +2 -0
- package/_generated/_envs/mainnet.js +490 -0
- package/_generated/_framework/env.d.ts +137 -0
- package/_generated/_framework/env.js +261 -0
- package/_generated/_framework/reified.d.ts +68 -36
- package/_generated/_framework/reified.js +110 -98
- package/_generated/_framework/util.d.ts +4 -4
- package/_generated/_framework/util.js +82 -79
- package/_generated/_framework/vector.d.ts +11 -9
- package/_generated/_framework/vector.js +10 -10
- package/_generated/suilend/cell/structs.d.ts +24 -22
- package/_generated/suilend/cell/structs.js +68 -24
- package/_generated/suilend/decimal/structs.d.ts +28 -24
- package/_generated/suilend/decimal/structs.js +45 -24
- package/_generated/suilend/index.d.ts +5 -6
- package/_generated/suilend/index.js +10 -19
- package/_generated/suilend/lending-market/functions.d.ts +1123 -149
- package/_generated/suilend/lending-market/functions.js +1121 -207
- package/_generated/suilend/lending-market/structs.d.ts +985 -1290
- package/_generated/suilend/lending-market/structs.js +2482 -1282
- package/_generated/suilend/lending-market-registry/functions.d.ts +32 -3
- package/_generated/suilend/lending-market-registry/functions.js +30 -6
- package/_generated/suilend/liquidity-mining/structs.d.ts +200 -333
- package/_generated/suilend/liquidity-mining/structs.js +449 -319
- package/_generated/suilend/obligation/structs.d.ts +406 -918
- package/_generated/suilend/obligation/structs.js +786 -596
- package/_generated/suilend/rate-limiter/functions.d.ts +134 -15
- package/_generated/suilend/rate-limiter/functions.js +139 -21
- package/_generated/suilend/rate-limiter/structs.d.ts +72 -80
- package/_generated/suilend/rate-limiter/structs.js +98 -48
- package/_generated/suilend/reserve/structs.d.ts +611 -904
- package/_generated/suilend/reserve/structs.js +1528 -736
- package/_generated/suilend/reserve-config/functions.d.ts +718 -96
- package/_generated/suilend/reserve-config/functions.js +751 -157
- package/_generated/suilend/reserve-config/structs.d.ts +148 -163
- package/_generated/suilend/reserve-config/structs.js +260 -94
- package/client.d.ts +2 -2
- package/client.js +22 -39
- package/lib/initialize.d.ts +617 -83
- package/lib/initialize.js +151 -48
- package/lib/proCompatible.js +5 -5
- package/package.json +1 -1
- package/parsers/lendingMarket.d.ts +9 -9
- package/parsers/obligation.d.ts +14 -14
- package/parsers/obligation.js +4 -4
- package/parsers/rateLimiter.d.ts +1 -1
- package/parsers/reserve.d.ts +12 -12
- package/parsers/reserve.js +2 -2
- package/strategies.d.ts +14 -14
- package/utils/obligation.d.ts +3 -0
- package/utils/obligation.js +10 -0
- package/utils/simulate.d.ts +1 -1
- package/utils/simulate.js +5 -5
- package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +0 -84
- package/_generated/_dependencies/source/0x1/index.d.ts +0 -3
- package/_generated/_dependencies/source/0x1/index.js +0 -3
- package/_generated/_dependencies/source/0x1/option/structs.js +0 -110
- package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +0 -47
- package/_generated/_dependencies/source/0x2/bag/structs.d.ts +0 -52
- package/_generated/_dependencies/source/0x2/bag/structs.js +0 -113
- package/_generated/_dependencies/source/0x2/balance/structs.js +0 -210
- package/_generated/_dependencies/source/0x2/index.d.ts +0 -3
- package/_generated/_dependencies/source/0x2/index.js +0 -3
- package/_generated/_dependencies/source/0x2/object/structs.d.ts +0 -82
- package/_generated/_dependencies/source/0x2/object-table/structs.js +0 -115
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.d.ts +0 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js +0 -4
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +0 -46
|
@@ -1,117 +1,356 @@
|
|
|
1
|
-
import { Transaction, TransactionArgument, TransactionObjectInput } from
|
|
2
|
-
|
|
1
|
+
import { Transaction, TransactionArgument, TransactionObjectInput, TransactionResult } from '@mysten/sui/transactions';
|
|
2
|
+
import type { EnvConfig } from '../../_envs';
|
|
3
|
+
export declare function init(tx: Transaction, otw: TransactionObjectInput, options?: {
|
|
4
|
+
env?: EnvConfig;
|
|
5
|
+
}): TransactionResult;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new lending market, and sets the fee receivers.
|
|
8
|
+
*
|
|
9
|
+
* The function initializes a `LendingMarket` object with empty reserves
|
|
10
|
+
* and obligations, a default rate limiter, and the sender as the fee receiver.
|
|
11
|
+
*
|
|
12
|
+
* It then calls the `set_fee_receivers` function to set the initial fee receiver to the creator of the market with a weight of 100.
|
|
13
|
+
*
|
|
14
|
+
* # Returns
|
|
15
|
+
*
|
|
16
|
+
* * `LendingMarketOwnerCap<P>` - The ownership capability for the newly created lending market.
|
|
17
|
+
* * `LendingMarket<P>` - The newly created lending market object.
|
|
18
|
+
*
|
|
19
|
+
* # Panics
|
|
20
|
+
*
|
|
21
|
+
* This function calls `set_fee_receivers`, which can panic under the following conditions:
|
|
22
|
+
*
|
|
23
|
+
* * If the `receivers` and `weights` vectors do not have the same length (EInvalidFeeReceivers).
|
|
24
|
+
* * If the `receivers` vector is empty (EInvalidFeeReceivers).
|
|
25
|
+
* * If the sum of `weights` is zero (EInvalidFeeReceivers).
|
|
26
|
+
*/
|
|
27
|
+
export declare function createLendingMarket(tx: Transaction, typeArg: string, options?: {
|
|
28
|
+
env?: EnvConfig;
|
|
29
|
+
}): TransactionResult;
|
|
30
|
+
export interface RefreshReservePriceArgs {
|
|
3
31
|
lendingMarket: TransactionObjectInput;
|
|
4
|
-
|
|
5
|
-
obligationOwnerCap: TransactionObjectInput;
|
|
32
|
+
u64: bigint | TransactionArgument;
|
|
6
33
|
clock: TransactionObjectInput;
|
|
7
|
-
|
|
34
|
+
priceInfoObject: TransactionObjectInput;
|
|
8
35
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Deprecated tombstone — kept only because Sui's upgrade compatibility rules
|
|
38
|
+
* freeze a published function's signature. Pyth froze every legacy on-chain
|
|
39
|
+
* feed at the 2026-08-26 cutover; nothing has written to one since, so this
|
|
40
|
+
* now aborts unconditionally instead of silently refreshing against a
|
|
41
|
+
* permanently-stale price. Use `refresh_reserve_price_pro_compatible`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function refreshReservePrice(tx: Transaction, typeArg: string, args: RefreshReservePriceArgs, options?: {
|
|
44
|
+
env?: EnvConfig;
|
|
45
|
+
}): TransactionResult;
|
|
46
|
+
export interface RefreshReservePriceProCompatibleArgs {
|
|
12
47
|
lendingMarket: TransactionObjectInput;
|
|
48
|
+
reserveArrayIndex: bigint | TransactionArgument;
|
|
49
|
+
clock: TransactionObjectInput;
|
|
50
|
+
priceInfo: TransactionObjectInput;
|
|
13
51
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
52
|
+
/**
|
|
53
|
+
* `refresh_reserve_price` against the upgraded Pyth package. From the
|
|
54
|
+
* 2026-08-18 cutover this is the only working refresh path; the legacy one
|
|
55
|
+
* above can no longer be supplied with a verifiable `PriceInfoObject`, and
|
|
56
|
+
* is retained only because published signatures are frozen.
|
|
57
|
+
*/
|
|
58
|
+
export declare function refreshReservePriceProCompatible(tx: Transaction, typeArg: string, args: RefreshReservePriceProCompatibleArgs, options?: {
|
|
59
|
+
env?: EnvConfig;
|
|
60
|
+
}): TransactionResult;
|
|
61
|
+
/** Creates a new obligation. */
|
|
62
|
+
export declare function createObligation(tx: Transaction, typeArg: string, lendingMarket: TransactionObjectInput, options?: {
|
|
63
|
+
env?: EnvConfig;
|
|
64
|
+
}): TransactionResult;
|
|
65
|
+
export interface DepositLiquidityAndMintCtokensArgs {
|
|
17
66
|
lendingMarket: TransactionObjectInput;
|
|
18
67
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
19
|
-
|
|
68
|
+
clock: TransactionObjectInput;
|
|
69
|
+
deposit: TransactionObjectInput;
|
|
20
70
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Deposits liquidity into a reserve and mints cTokens in return.
|
|
73
|
+
*
|
|
74
|
+
* This function allows a user to deposit a certain amount of a token into a reserve
|
|
75
|
+
* and receive cTokens, which represent their share of the reserve's assets.
|
|
76
|
+
* The amount of cTokens minted is proportional to the amount of liquidity deposited
|
|
77
|
+
* and the current cToken ratio of the reserve.
|
|
78
|
+
*
|
|
79
|
+
* # Arguments
|
|
80
|
+
*
|
|
81
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
82
|
+
* * `reserve_array_index` - The index of the reserve to deposit into.
|
|
83
|
+
* * `clock` - A reference to the `Clock` to compound interest before depositing.
|
|
84
|
+
* * `deposit` - The `Coin` object representing the liquidity to deposit.
|
|
85
|
+
*
|
|
86
|
+
* # Returns
|
|
87
|
+
*
|
|
88
|
+
* * `Coin<CToken<P, T>>` - A `Coin` of cTokens representing the deposited liquidity and accrued interest.
|
|
89
|
+
*
|
|
90
|
+
* # Panics
|
|
91
|
+
*
|
|
92
|
+
* This function will panic if:
|
|
93
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
94
|
+
* * The deposit amount is zero (ETooSmall).
|
|
95
|
+
* * The `coin_type` of the reserve does not match the type of the deposited coin (EWrongType).
|
|
96
|
+
* * The deposit would exceed the reserve's deposit limit (`EDepositLimitExceeded` from the `reserve` module).
|
|
97
|
+
* * If ctokens are outstanding but unclaimed spread fees have consumed the entire total
|
|
98
|
+
* supply, leaving them unbacked (`EReserveInDeficit` from the `reserve` module).
|
|
99
|
+
* * The minted cToken amount is zero (ETooSmall).
|
|
100
|
+
* * `reserve_array_index` is out of bounds.
|
|
101
|
+
*/
|
|
102
|
+
export declare function depositLiquidityAndMintCtokens(tx: Transaction, typeArgs: [string, string], args: DepositLiquidityAndMintCtokensArgs, options?: {
|
|
103
|
+
env?: EnvConfig;
|
|
104
|
+
}): TransactionResult;
|
|
105
|
+
export interface RedeemCtokensAndWithdrawLiquidityArgs {
|
|
24
106
|
lendingMarket: TransactionObjectInput;
|
|
25
107
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
26
|
-
isDepositReward: boolean | TransactionArgument;
|
|
27
|
-
rewards: TransactionObjectInput;
|
|
28
|
-
startTimeMs: bigint | TransactionArgument;
|
|
29
|
-
endTimeMs: bigint | TransactionArgument;
|
|
30
108
|
clock: TransactionObjectInput;
|
|
109
|
+
ctokens: TransactionObjectInput;
|
|
110
|
+
rateLimiterExemption: TransactionObjectInput | null;
|
|
31
111
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Redeems cTokens for the underlying liquidity.
|
|
114
|
+
*
|
|
115
|
+
* This function allows a user to redeem their cTokens for the underlying asset.
|
|
116
|
+
* The amount of the underlying asset received depends on the amount of cTokens redeemed
|
|
117
|
+
* and the current cToken ratio of the reserve.
|
|
118
|
+
*
|
|
119
|
+
* # Arguments
|
|
120
|
+
*
|
|
121
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
122
|
+
* * `reserve_array_index` - The index of the reserve to redeem from.
|
|
123
|
+
* * `clock` - A reference to the `Clock` to compound interest before redeeming.
|
|
124
|
+
* * `ctokens` - The `Coin` of cTokens to redeem.
|
|
125
|
+
* * `rate_limiter_exemption` - An optional exemption from the rate limiter.
|
|
126
|
+
*
|
|
127
|
+
* # Returns
|
|
128
|
+
*
|
|
129
|
+
* * `Coin<T>` - A `Coin` of the underlying asset.
|
|
130
|
+
*
|
|
131
|
+
* # Panics
|
|
132
|
+
*
|
|
133
|
+
* This function will panic if:
|
|
134
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
135
|
+
* * The amount of cTokens to redeem is zero (ETooSmall).
|
|
136
|
+
* * The `coin_type` of the reserve does not match the type of the cTokens (EWrongType).
|
|
137
|
+
* * If ctokens are outstanding but unclaimed spread fees have consumed the entire total
|
|
138
|
+
* supply, leaving them unbacked (`EReserveInDeficit` from the `reserve` module).
|
|
139
|
+
* * The redemption would violate the minimum available amount of the reserve (`EMinAvailableAmountViolated` from the `reserve` module).
|
|
140
|
+
* * The withdrawal amount exceeds the rate limit, and no exemption is provided.
|
|
141
|
+
* * The redemption would floor to zero underlying, i.e. this reserve's ctoken ratio is
|
|
142
|
+
* below one and the amount redeemed is below its reciprocal (ETooSmall). Refused rather
|
|
143
|
+
* than burning the ctokens for nothing, mirroring the deposit-side zero-mint refusal above.
|
|
144
|
+
* * `reserve_array_index` is out of bounds.
|
|
145
|
+
*/
|
|
146
|
+
export declare function redeemCtokensAndWithdrawLiquidity(tx: Transaction, typeArgs: [string, string], args: RedeemCtokensAndWithdrawLiquidityArgs, options?: {
|
|
147
|
+
env?: EnvConfig;
|
|
148
|
+
}): TransactionResult;
|
|
149
|
+
export interface RedeemCtokensAndWithdrawLiquidityRequestArgs {
|
|
35
150
|
lendingMarket: TransactionObjectInput;
|
|
36
151
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
37
|
-
isDepositReward: boolean | TransactionArgument;
|
|
38
|
-
rewardIndex: bigint | TransactionArgument;
|
|
39
152
|
clock: TransactionObjectInput;
|
|
153
|
+
ctokens: TransactionObjectInput;
|
|
154
|
+
rateLimiterExemption: TransactionObjectInput | null;
|
|
40
155
|
}
|
|
41
|
-
|
|
42
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Creates a liquidity request to withdraw liquidity by redeeming cTokens.
|
|
158
|
+
*
|
|
159
|
+
* Initiates the process of redeeming cTokens for the underlying asset.
|
|
160
|
+
* It checks for rate limit exemptions, processes the withdrawal against the rate limiter if necessary,
|
|
161
|
+
* and then creates a `LiquidityRequest` by calling the `redeem_ctokens` function in the `reserve` module.
|
|
162
|
+
*
|
|
163
|
+
* # Arguments
|
|
164
|
+
*
|
|
165
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
166
|
+
* * `reserve_array_index` - The index of the reserve to redeem from.
|
|
167
|
+
* * `clock` - A reference to the `Clock` to compound interest before redeeming.
|
|
168
|
+
* * `ctokens` - The `Coin` of cTokens to redeem.
|
|
169
|
+
* * `rate_limiter_exemption` - An optional exemption from the rate limiter.
|
|
170
|
+
*
|
|
171
|
+
* # Returns
|
|
172
|
+
*
|
|
173
|
+
* * `LiquidityRequest<P, T>` - A request to withdraw liquidity from the reserve.
|
|
174
|
+
*
|
|
175
|
+
* # Panics
|
|
176
|
+
*
|
|
177
|
+
* This function will panic if:
|
|
178
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
179
|
+
* * The amount of cTokens to redeem is zero (ETooSmall).
|
|
180
|
+
* * The `coin_type` of the reserve does not match the type of the cTokens (EWrongType).
|
|
181
|
+
* * If ctokens are outstanding but unclaimed spread fees have consumed the entire total
|
|
182
|
+
* supply, leaving them unbacked (`EReserveInDeficit` from the `reserve` module).
|
|
183
|
+
* * The redemption would violate the minimum available amount of the reserve (`EMinAvailableAmountViolated` from the `reserve` module).
|
|
184
|
+
* * The withdrawal amount exceeds the rate limit, and no exemption is provided.
|
|
185
|
+
* * The redemption would floor to zero underlying, i.e. this reserve's ctoken ratio is
|
|
186
|
+
* below one and the amount redeemed is below its reciprocal (ETooSmall). Refused rather
|
|
187
|
+
* than burning the ctokens for nothing, mirroring the deposit-side zero-mint refusal above.
|
|
188
|
+
* * `reserve_array_index` is out of bounds.
|
|
189
|
+
*/
|
|
190
|
+
export declare function redeemCtokensAndWithdrawLiquidityRequest(tx: Transaction, typeArgs: [string, string], args: RedeemCtokensAndWithdrawLiquidityRequestArgs, options?: {
|
|
191
|
+
env?: EnvConfig;
|
|
192
|
+
}): TransactionResult;
|
|
193
|
+
export interface DepositCtokensIntoObligationArgs {
|
|
43
194
|
lendingMarket: TransactionObjectInput;
|
|
44
|
-
|
|
195
|
+
reserveArrayIndex: bigint | TransactionArgument;
|
|
196
|
+
obligationOwnerCap: TransactionObjectInput;
|
|
45
197
|
clock: TransactionObjectInput;
|
|
46
|
-
|
|
47
|
-
rewardIndex: bigint | TransactionArgument;
|
|
48
|
-
isDepositReward: boolean | TransactionArgument;
|
|
198
|
+
deposit: TransactionObjectInput;
|
|
49
199
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Deposits cTokens into an obligation, which can be used as collateral for borrowing.
|
|
202
|
+
*
|
|
203
|
+
* # Arguments
|
|
204
|
+
*
|
|
205
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
206
|
+
* * `reserve_array_index` - The index of the reserve corresponding to the cTokens being deposited.
|
|
207
|
+
* * `obligation_owner_cap` - The ownership capability for the obligation.
|
|
208
|
+
* * `clock` - A reference to the `Clock`.
|
|
209
|
+
* * `deposit` - The `Coin` of cTokens to deposit.
|
|
210
|
+
*
|
|
211
|
+
* # Panics
|
|
212
|
+
*
|
|
213
|
+
* This function will panic if:
|
|
214
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
215
|
+
* * The deposit amount is zero (ETooSmall).
|
|
216
|
+
* * The `coin_type` of the reserve does not match the type of the deposited cTokens (EWrongType).
|
|
217
|
+
* * `reserve_array_index` is out of bounds.
|
|
218
|
+
* * `obligation_id` is not a valid key in the `obligations` table.
|
|
219
|
+
*/
|
|
220
|
+
export declare function depositCtokensIntoObligation(tx: Transaction, typeArgs: [string, string], args: DepositCtokensIntoObligationArgs, options?: {
|
|
221
|
+
env?: EnvConfig;
|
|
222
|
+
}): TransactionResult;
|
|
223
|
+
export interface BorrowArgs {
|
|
53
224
|
lendingMarket: TransactionObjectInput;
|
|
54
225
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
55
|
-
|
|
56
|
-
rewardIndex: bigint | TransactionArgument;
|
|
226
|
+
obligationOwnerCap: TransactionObjectInput;
|
|
57
227
|
clock: TransactionObjectInput;
|
|
228
|
+
amount: bigint | TransactionArgument;
|
|
58
229
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Borrows a specified amount of a token from a reserve. A fee is charged on the borrowed amount.
|
|
232
|
+
*
|
|
233
|
+
* # Arguments
|
|
234
|
+
*
|
|
235
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
236
|
+
* * `reserve_array_index` - The index of the reserve to borrow from.
|
|
237
|
+
* * `obligation_owner_cap` - The ownership capability for the obligation.
|
|
238
|
+
* * `clock` - A reference to the `Clock`.
|
|
239
|
+
* * `amount` - The amount to borrow.
|
|
240
|
+
*
|
|
241
|
+
* # Returns
|
|
242
|
+
*
|
|
243
|
+
* * `Coin<T>` - A `Coin` of the borrowed asset.
|
|
244
|
+
*
|
|
245
|
+
* # Panics
|
|
246
|
+
*
|
|
247
|
+
* This function will panic if:
|
|
248
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
249
|
+
* * The borrow amount is zero (ETooSmall).
|
|
250
|
+
* * The `coin_type` of the reserve does not match the type of the asset being borrowed (EWrongType).
|
|
251
|
+
* * The reserve's price is stale (`EPriceStale` from the `reserve` module).
|
|
252
|
+
* * The borrow would exceed the reserve's borrow limit (`EBorrowLimitExceeded` from the `reserve` module).
|
|
253
|
+
* * The borrow would violate the minimum available amount of the reserve (`EMinAvailableAmountViolated` from the `reserve` module).
|
|
254
|
+
* * The obligation has stale oracle prices.
|
|
255
|
+
* * The borrow amount exceeds the rate limit.
|
|
256
|
+
* * `reserve_array_index` is out of bounds.
|
|
257
|
+
* * `obligation_id` is not a valid key in the `obligations` table.
|
|
258
|
+
*/
|
|
259
|
+
export declare function borrow(tx: Transaction, typeArgs: [string, string], args: BorrowArgs, options?: {
|
|
260
|
+
env?: EnvConfig;
|
|
261
|
+
}): TransactionResult;
|
|
62
262
|
export interface CompoundInterestArgs {
|
|
63
263
|
lendingMarket: TransactionObjectInput;
|
|
64
264
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
65
265
|
clock: TransactionObjectInput;
|
|
66
266
|
}
|
|
67
|
-
|
|
68
|
-
export
|
|
267
|
+
/** Compound interest for reserve of type T */
|
|
268
|
+
export declare function compoundInterest(tx: Transaction, typeArg: string, args: CompoundInterestArgs, options?: {
|
|
269
|
+
env?: EnvConfig;
|
|
270
|
+
}): TransactionResult;
|
|
271
|
+
export interface RefreshObligationArgs {
|
|
69
272
|
lendingMarket: TransactionObjectInput;
|
|
70
|
-
|
|
273
|
+
obligationId: string | TransactionArgument;
|
|
71
274
|
clock: TransactionObjectInput;
|
|
72
|
-
deposit: TransactionObjectInput;
|
|
73
275
|
}
|
|
74
|
-
|
|
75
|
-
export
|
|
276
|
+
/** Refresh the obligation's state and assert no stale oracles */
|
|
277
|
+
export declare function refreshObligation(tx: Transaction, typeArg: string, args: RefreshObligationArgs, options?: {
|
|
278
|
+
env?: EnvConfig;
|
|
279
|
+
}): TransactionResult;
|
|
280
|
+
export interface BorrowRequestArgs {
|
|
76
281
|
lendingMarket: TransactionObjectInput;
|
|
77
282
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
export declare function fulfillLiquidityRequest(tx: Transaction, typeArgs: [string, string], args: FulfillLiquidityRequestArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
81
|
-
export interface InitStakerArgs {
|
|
82
|
-
lendingMarket: TransactionObjectInput;
|
|
83
|
-
lendingMarketOwnerCap: TransactionObjectInput;
|
|
84
|
-
suiReserveArrayIndex: bigint | TransactionArgument;
|
|
85
|
-
treasuryCap: TransactionObjectInput;
|
|
86
|
-
}
|
|
87
|
-
export declare function initStaker(tx: Transaction, typeArgs: [string, string], args: InitStakerArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
88
|
-
export interface MaxBorrowAmountArgs {
|
|
89
|
-
rateLimiter: TransactionObjectInput;
|
|
90
|
-
obligation: TransactionObjectInput;
|
|
91
|
-
reserve: TransactionObjectInput;
|
|
283
|
+
obligationOwnerCap: TransactionObjectInput;
|
|
92
284
|
clock: TransactionObjectInput;
|
|
285
|
+
amount: bigint | TransactionArgument;
|
|
93
286
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
287
|
+
/**
|
|
288
|
+
* Creates a borrow request for a specified amount of a token from a reserve. A fee is charged
|
|
289
|
+
* on the borrowed amount. The returned `LiquidityRequest` must be fulfilled by calling
|
|
290
|
+
* `fulfill_liquidity_request`.
|
|
291
|
+
*
|
|
292
|
+
* # Arguments
|
|
293
|
+
*
|
|
294
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
295
|
+
* * `reserve_array_index` - The index of the reserve to borrow from.
|
|
296
|
+
* * `obligation_owner_cap` - The ownership capability for the obligation.
|
|
297
|
+
* * `clock` - A reference to the `Clock`.
|
|
298
|
+
* * `amount` - The amount to borrow.
|
|
299
|
+
*
|
|
300
|
+
* # Returns
|
|
301
|
+
*
|
|
302
|
+
* * `LiquidityRequest<P, T>` - A request that must be fulfilled to complete the borrow.
|
|
303
|
+
*
|
|
304
|
+
* # Panics
|
|
305
|
+
*
|
|
306
|
+
* This function will panic if:
|
|
307
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
308
|
+
* * The borrow amount is zero (ETooSmall).
|
|
309
|
+
* * The `coin_type` of the reserve does not match the type of the asset being borrowed (EWrongType).
|
|
310
|
+
* * The reserve's price is stale (`EPriceStale` from the `reserve` module).
|
|
311
|
+
* * The borrow would exceed the reserve's borrow limit (`EBorrowLimitExceeded` from the `reserve` module).
|
|
312
|
+
* * The borrow would violate the minimum available amount of the reserve (`EMinAvailableAmountViolated` from the `reserve` module).
|
|
313
|
+
* * The obligation has stale oracle prices.
|
|
314
|
+
* * The borrow amount exceeds the rate limit.
|
|
315
|
+
* * `reserve_array_index` is out of bounds.
|
|
316
|
+
* * `obligation_id` is not a valid key in the `obligations` table.
|
|
317
|
+
*/
|
|
318
|
+
export declare function borrowRequest(tx: Transaction, typeArgs: [string, string], args: BorrowRequestArgs, options?: {
|
|
319
|
+
env?: EnvConfig;
|
|
320
|
+
}): TransactionResult;
|
|
321
|
+
export interface FulfillLiquidityRequestArgs {
|
|
110
322
|
lendingMarket: TransactionObjectInput;
|
|
111
323
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
112
|
-
|
|
324
|
+
liquidityRequest: TransactionObjectInput;
|
|
113
325
|
}
|
|
114
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Fulfills a liquidity request from a reserve.
|
|
328
|
+
*
|
|
329
|
+
* This function is called after a liquidity request has been created by either
|
|
330
|
+
* `redeem_ctokens_and_withdraw_liquidity_request` or `borrow_request`. It takes the
|
|
331
|
+
* `LiquidityRequest` and processes it, returning the requested amount of the
|
|
332
|
+
* underlying asset as a `Coin`.
|
|
333
|
+
*
|
|
334
|
+
* # Arguments
|
|
335
|
+
*
|
|
336
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
337
|
+
* * `reserve_array_index` - The index of the reserve to fulfill the request from.
|
|
338
|
+
* * `liquidity_request` - The `LiquidityRequest` to be fulfilled.
|
|
339
|
+
*
|
|
340
|
+
* # Returns
|
|
341
|
+
*
|
|
342
|
+
* * `Coin<T>` - A `Coin` of the underlying asset.
|
|
343
|
+
*
|
|
344
|
+
* # Panics
|
|
345
|
+
*
|
|
346
|
+
* This function will panic if:
|
|
347
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
348
|
+
* * The `coin_type` of the reserve does not match the type of the liquidity request (EWrongType).
|
|
349
|
+
* * `reserve_array_index` is out of bounds.
|
|
350
|
+
*/
|
|
351
|
+
export declare function fulfillLiquidityRequest(tx: Transaction, typeArgs: [string, string], args: FulfillLiquidityRequestArgs, options?: {
|
|
352
|
+
env?: EnvConfig;
|
|
353
|
+
}): TransactionResult;
|
|
115
354
|
export interface WithdrawCtokensArgs {
|
|
116
355
|
lendingMarket: TransactionObjectInput;
|
|
117
356
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
@@ -119,14 +358,112 @@ export interface WithdrawCtokensArgs {
|
|
|
119
358
|
clock: TransactionObjectInput;
|
|
120
359
|
amount: bigint | TransactionArgument;
|
|
121
360
|
}
|
|
122
|
-
|
|
123
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Withdraws cTokens from an obligation.
|
|
363
|
+
*
|
|
364
|
+
* This function allows a user to withdraw their cTokens from an obligation,
|
|
365
|
+
* making them available for redemption or transfer.
|
|
366
|
+
*
|
|
367
|
+
* # Arguments
|
|
368
|
+
*
|
|
369
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
370
|
+
* * `reserve_array_index` - The index of the reserve corresponding to the cTokens being withdrawn.
|
|
371
|
+
* * `obligation_owner_cap` - The ownership capability for the obligation.
|
|
372
|
+
* * `clock` - A reference to the `Clock`.
|
|
373
|
+
* * `amount` - The amount of cTokens to withdraw. If `U64_MAX` is provided, the maximum possible amount will be withdrawn.
|
|
374
|
+
*
|
|
375
|
+
* # Returns
|
|
376
|
+
*
|
|
377
|
+
* * `Coin<CToken<P, T>>` - A `Coin` of the withdrawn cTokens.
|
|
378
|
+
*
|
|
379
|
+
* # Panics
|
|
380
|
+
*
|
|
381
|
+
* This function will panic if:
|
|
382
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
383
|
+
* * The withdraw amount is zero (ETooSmall).
|
|
384
|
+
* * The `coin_type` of the reserve does not match the type of the cTokens being withdrawn (EWrongType).
|
|
385
|
+
* * The obligation has stale oracle prices.
|
|
386
|
+
* * The withdrawal would leave the obligation in an unhealthy state.
|
|
387
|
+
* * `reserve_array_index` is out of bounds.
|
|
388
|
+
* * `obligation_id` is not a valid key in the `obligations` table.
|
|
389
|
+
*/
|
|
390
|
+
export declare function withdrawCtokens(tx: Transaction, typeArgs: [string, string], args: WithdrawCtokensArgs, options?: {
|
|
391
|
+
env?: EnvConfig;
|
|
392
|
+
}): TransactionResult;
|
|
393
|
+
export interface LiquidateArgs {
|
|
124
394
|
lendingMarket: TransactionObjectInput;
|
|
125
395
|
obligationId: string | TransactionArgument;
|
|
396
|
+
repayReserveArrayIndex: bigint | TransactionArgument;
|
|
397
|
+
withdrawReserveArrayIndex: bigint | TransactionArgument;
|
|
398
|
+
clock: TransactionObjectInput;
|
|
399
|
+
repayCoins: TransactionObjectInput;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Liquidates an unhealthy obligation by repaying a borrow and seizing collateral.
|
|
403
|
+
*
|
|
404
|
+
* This function allows a liquidator to repay a portion of an unhealthy obligation's
|
|
405
|
+
* debt in exchange for a discounted amount of their collateral. Any leftover repay
|
|
406
|
+
* coins are returned to the liquidator.
|
|
407
|
+
*
|
|
408
|
+
* # Arguments
|
|
409
|
+
*
|
|
410
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
411
|
+
* * `obligation_id` - The ID of the obligation to liquidate.
|
|
412
|
+
* * `repay_reserve_array_index` - The index of the reserve to repay the debt to.
|
|
413
|
+
* * `withdraw_reserve_array_index` - The index of the reserve to withdraw collateral from.
|
|
414
|
+
* * `clock` - A reference to the `Clock`.
|
|
415
|
+
* * `repay_coins` - A mutable reference to the `Coin` used to repay the debt.
|
|
416
|
+
*
|
|
417
|
+
* # Returns
|
|
418
|
+
*
|
|
419
|
+
* * `(Coin<CToken<P, Withdraw>>, RateLimiterExemption<P, Withdraw>)` - A tuple containing the withdrawn collateral as cTokens and a rate limiter exemption.
|
|
420
|
+
*
|
|
421
|
+
* # Panics
|
|
422
|
+
*
|
|
423
|
+
* This function will panic if:
|
|
424
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
425
|
+
* * The repay amount is zero (ETooSmall).
|
|
426
|
+
* * The obligation is not unhealthy.
|
|
427
|
+
* * The obligation has stale oracle prices.
|
|
428
|
+
* * The `coin_type` of the repay reserve does not match the type of the repay coin.
|
|
429
|
+
* * The `coin_type` of the withdraw reserve does not match the type of the withdrawn cTokens.
|
|
430
|
+
* * `repay_reserve_array_index` or `withdraw_reserve_array_index` are out of bounds.
|
|
431
|
+
* * `obligation_id` is not a valid key in the `obligations` table.
|
|
432
|
+
*/
|
|
433
|
+
export declare function liquidate(tx: Transaction, typeArgs: [string, string, string], args: LiquidateArgs, options?: {
|
|
434
|
+
env?: EnvConfig;
|
|
435
|
+
}): TransactionResult;
|
|
436
|
+
export interface RepayArgs {
|
|
437
|
+
lendingMarket: TransactionObjectInput;
|
|
438
|
+
reserveArrayIndex: bigint | TransactionArgument;
|
|
439
|
+
obligationId: string | TransactionArgument;
|
|
440
|
+
clock: TransactionObjectInput;
|
|
441
|
+
maxRepayCoins: TransactionObjectInput;
|
|
126
442
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Repays a borrow, reducing the obligation's debt and increasing the reserve's liquidity.
|
|
445
|
+
*
|
|
446
|
+
* Any leftover repay coins are returned to the caller.
|
|
447
|
+
*
|
|
448
|
+
* # Arguments
|
|
449
|
+
*
|
|
450
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
451
|
+
* * `reserve_array_index` - The index of the reserve to repay the debt to.
|
|
452
|
+
* * `obligation_id` - The ID of the obligation to repay.
|
|
453
|
+
* * `clock` - A reference to the `Clock`.
|
|
454
|
+
* * `max_repay_coins` - A mutable reference to the `Coin` used to repay the debt.
|
|
455
|
+
*
|
|
456
|
+
* # Panics
|
|
457
|
+
*
|
|
458
|
+
* This function will panic if:
|
|
459
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
460
|
+
* * The `coin_type` of the reserve does not match the type of the repay coin (EWrongType).
|
|
461
|
+
* * `reserve_array_index` is out of bounds.
|
|
462
|
+
* * `obligation_id` is not a valid key in the `obligations` table.
|
|
463
|
+
*/
|
|
464
|
+
export declare function repay(tx: Transaction, typeArgs: [string, string], args: RepayArgs, options?: {
|
|
465
|
+
env?: EnvConfig;
|
|
466
|
+
}): TransactionResult;
|
|
130
467
|
export interface ForgiveArgs {
|
|
131
468
|
lendingMarketOwnerCap: TransactionObjectInput;
|
|
132
469
|
lendingMarket: TransactionObjectInput;
|
|
@@ -135,34 +472,305 @@ export interface ForgiveArgs {
|
|
|
135
472
|
clock: TransactionObjectInput;
|
|
136
473
|
maxForgiveAmount: bigint | TransactionArgument;
|
|
137
474
|
}
|
|
138
|
-
|
|
139
|
-
|
|
475
|
+
/**
|
|
476
|
+
* Forgives a debt on an obligation, effectively reducing the borrow amount without requiring repayment.
|
|
477
|
+
*
|
|
478
|
+
* This is an admin-only function that can be used to handle bad debt or other special circumstances.
|
|
479
|
+
* It reduces the borrowed amount for a specific reserve within an obligation.
|
|
480
|
+
*
|
|
481
|
+
* # Arguments
|
|
482
|
+
*
|
|
483
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
484
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
485
|
+
* * `reserve_array_index` - The index of the reserve for which to forgive the debt.
|
|
486
|
+
* * `obligation_id` - The ID of the obligation to forgive the debt for.
|
|
487
|
+
* * `clock` - A reference to the `Clock`.
|
|
488
|
+
* * `max_forgive_amount` - The maximum amount of debt to forgive.
|
|
489
|
+
*
|
|
490
|
+
* # Panics
|
|
491
|
+
*
|
|
492
|
+
* This function will panic if:
|
|
493
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
494
|
+
* * `obligation_id` is not a valid key in the `obligations` table.
|
|
495
|
+
* * The obligation has stale oracle prices.
|
|
496
|
+
* * The `coin_type` of the reserve does not match the type of the debt being forgiven (EWrongType).
|
|
497
|
+
* * `reserve_array_index` is out of bounds.
|
|
498
|
+
* * If the forgiveness would leave the reserve's total supply below its ctoken supply in
|
|
499
|
+
* scaled units (`EForgiveWouldZeroBacking` from the `reserve` module).
|
|
500
|
+
*/
|
|
501
|
+
export declare function forgive(tx: Transaction, typeArgs: [string, string], args: ForgiveArgs, options?: {
|
|
502
|
+
env?: EnvConfig;
|
|
503
|
+
}): TransactionResult;
|
|
504
|
+
export interface ClaimRewardsArgs {
|
|
505
|
+
lendingMarket: TransactionObjectInput;
|
|
506
|
+
cap: TransactionObjectInput;
|
|
507
|
+
clock: TransactionObjectInput;
|
|
508
|
+
reserveId: bigint | TransactionArgument;
|
|
509
|
+
rewardIndex: bigint | TransactionArgument;
|
|
510
|
+
isDepositReward: boolean | TransactionArgument;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Claims rewards earned by an obligation.
|
|
514
|
+
*
|
|
515
|
+
* This function allows an obligation owner to claim rewards that have accrued
|
|
516
|
+
* from either depositing or borrowing on a reserve.
|
|
517
|
+
*
|
|
518
|
+
* # Arguments
|
|
519
|
+
*
|
|
520
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
521
|
+
* * `cap` - The `ObligationOwnerCap` to authorize the operation.
|
|
522
|
+
* * `clock` - A reference to the `Clock`.
|
|
523
|
+
* * `reserve_id` - The array index of the reserve that is giving out the rewards.
|
|
524
|
+
* * `reward_index` - The index of the reward pool to claim from.
|
|
525
|
+
* * `is_deposit_reward` - A boolean indicating whether to claim deposit rewards (true) or borrow rewards (false).
|
|
526
|
+
*
|
|
527
|
+
* # Returns
|
|
528
|
+
*
|
|
529
|
+
* * `Coin<RewardType>` - A `Coin` containing the claimed rewards.
|
|
530
|
+
*
|
|
531
|
+
* # Panics
|
|
532
|
+
*
|
|
533
|
+
* This function will panic if:
|
|
534
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
535
|
+
* * It will also panic if the underlying `claim_rewards_by_obligation_id` panics.
|
|
536
|
+
*/
|
|
537
|
+
export declare function claimRewards(tx: Transaction, typeArgs: [string, string], args: ClaimRewardsArgs, options?: {
|
|
538
|
+
env?: EnvConfig;
|
|
539
|
+
}): TransactionResult;
|
|
540
|
+
export interface ClaimRewardsAndDepositArgs {
|
|
140
541
|
lendingMarket: TransactionObjectInput;
|
|
141
542
|
obligationId: string | TransactionArgument;
|
|
142
|
-
repayReserveArrayIndex: bigint | TransactionArgument;
|
|
143
|
-
withdrawReserveArrayIndex: bigint | TransactionArgument;
|
|
144
543
|
clock: TransactionObjectInput;
|
|
145
|
-
|
|
544
|
+
rewardReserveId: bigint | TransactionArgument;
|
|
545
|
+
rewardIndex: bigint | TransactionArgument;
|
|
546
|
+
isDepositReward: boolean | TransactionArgument;
|
|
547
|
+
depositReserveId: bigint | TransactionArgument;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Claims rewards earned by an obligation and deposits them back into the obligation.
|
|
551
|
+
*
|
|
552
|
+
* This is a permissionless function that can be called by anyone to "crank" rewards for a given obligation.
|
|
553
|
+
* It first claims the rewards from the specified reward pool and then, if the obligation has a borrow of the
|
|
554
|
+
* same asset, it repays the borrow. The remaining rewards are deposited as liquidity into the specified
|
|
555
|
+
* reserve and the resulting CTokens are deposited into the obligation to be used as collateral.
|
|
556
|
+
*
|
|
557
|
+
* # Arguments
|
|
558
|
+
*
|
|
559
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
560
|
+
* * `obligation_id` - The ID of the obligation to claim rewards for and deposit into.
|
|
561
|
+
* * `clock` - A reference to the `Clock`.
|
|
562
|
+
* * `reward_reserve_id` - The array index of the reserve that is giving out the rewards.
|
|
563
|
+
* * `reward_index` - The index of the reward pool to claim from.
|
|
564
|
+
* * `is_deposit_reward` - A boolean indicating whether to claim deposit rewards (true) or borrow rewards (false).
|
|
565
|
+
* * `deposit_reserve_id` - The array index of the reserve to deposit the claimed rewards into.
|
|
566
|
+
*
|
|
567
|
+
* # Panics
|
|
568
|
+
*
|
|
569
|
+
* This function will panic if:
|
|
570
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
571
|
+
* * The reward period is not over.
|
|
572
|
+
* * The `coin_type` of the deposit reserve does not match the type of the reward.
|
|
573
|
+
* * It will also panic if the underlying `claim_rewards_by_obligation_id` or `repay` or `deposit_liquidity_and_mint_ctokens` panics.
|
|
574
|
+
* * If ctokens are outstanding but unclaimed spread fees have consumed the entire total
|
|
575
|
+
* supply, leaving them unbacked (`EReserveInDeficit` from the `reserve` module).
|
|
576
|
+
*
|
|
577
|
+
* For expired points campaign types: instead of claiming
|
|
578
|
+
* and depositing, force-closes the UserReward entry on the obligation. The pool reward must
|
|
579
|
+
* have been cancelled and drained first. deposit_reserve_id is ignored.
|
|
580
|
+
*/
|
|
581
|
+
export declare function claimRewardsAndDeposit(tx: Transaction, typeArgs: [string, string], args: ClaimRewardsAndDepositArgs, options?: {
|
|
582
|
+
env?: EnvConfig;
|
|
583
|
+
}): TransactionResult;
|
|
584
|
+
export interface InitStakerArgs {
|
|
585
|
+
lendingMarket: TransactionObjectInput;
|
|
586
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
587
|
+
suiReserveArrayIndex: bigint | TransactionArgument;
|
|
588
|
+
treasuryCap: TransactionObjectInput;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Initializes a staker for a SUI reserve.
|
|
592
|
+
*
|
|
593
|
+
* This function is used to set up a staker for a SUI reserve, which allows the reserve
|
|
594
|
+
* to participate in staking and earn rewards. It can only be called by the owner of the
|
|
595
|
+
* lending market.
|
|
596
|
+
*
|
|
597
|
+
* # Arguments
|
|
598
|
+
*
|
|
599
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
600
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
601
|
+
* * `sui_reserve_array_index` - The index of the SUI reserve to initialize the staker for.
|
|
602
|
+
* * `treasury_cap` - The `TreasuryCap` for the staker.
|
|
603
|
+
*
|
|
604
|
+
* # Panics
|
|
605
|
+
*
|
|
606
|
+
* This function will panic if:
|
|
607
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
608
|
+
* * The reserve at `sui_reserve_array_index` is not a SUI reserve (EWrongType).
|
|
609
|
+
* * `sui_reserve_array_index` is out of bounds.
|
|
610
|
+
*/
|
|
611
|
+
export declare function initStaker(tx: Transaction, typeArgs: [string, string], args: InitStakerArgs, options?: {
|
|
612
|
+
env?: EnvConfig;
|
|
613
|
+
}): TransactionResult;
|
|
614
|
+
export interface RebalanceStakerArgs {
|
|
615
|
+
lendingMarket: TransactionObjectInput;
|
|
616
|
+
suiReserveArrayIndex: bigint | TransactionArgument;
|
|
617
|
+
systemState: TransactionObjectInput;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Rebalances a staker by staking or unstaking SUI to match the target staking amount.
|
|
621
|
+
*
|
|
622
|
+
* This function is a wrapper around `reserve::rebalance_staker`. It ensures that the
|
|
623
|
+
* lending market is on the correct version and that the specified reserve is a SUI
|
|
624
|
+
* reserve before proceeding with the rebalancing.
|
|
625
|
+
*
|
|
626
|
+
* # Arguments
|
|
627
|
+
*
|
|
628
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
629
|
+
* * `sui_reserve_array_index` - The index of the SUI reserve to rebalance.
|
|
630
|
+
* * `system_state` - A mutable reference to the `SuiSystemState`.
|
|
631
|
+
*
|
|
632
|
+
* # Panics
|
|
633
|
+
*
|
|
634
|
+
* This function will panic if:
|
|
635
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
636
|
+
* * The reserve at `sui_reserve_array_index` is not a SUI reserve (EWrongType).
|
|
637
|
+
* * `sui_reserve_array_index` is out of bounds.
|
|
638
|
+
*/
|
|
639
|
+
export declare function rebalanceStaker(tx: Transaction, typeArg: string, args: RebalanceStakerArgs, options?: {
|
|
640
|
+
env?: EnvConfig;
|
|
641
|
+
}): TransactionResult;
|
|
642
|
+
export interface UnstakeSuiFromStakerArgs {
|
|
643
|
+
lendingMarket: TransactionObjectInput;
|
|
644
|
+
suiReserveArrayIndex: bigint | TransactionArgument;
|
|
645
|
+
liquidityRequest: TransactionObjectInput;
|
|
646
|
+
systemState: TransactionObjectInput;
|
|
146
647
|
}
|
|
147
|
-
|
|
148
|
-
|
|
648
|
+
/**
|
|
649
|
+
* Unstakes SUI from a staker.
|
|
650
|
+
*
|
|
651
|
+
* This function is a wrapper around `reserve::unstake_sui_from_staker`. It ensures that the
|
|
652
|
+
* lending market is on the correct version and that the specified reserve is a SUI
|
|
653
|
+
* reserve before proceeding with the unstaking.
|
|
654
|
+
*
|
|
655
|
+
* # Arguments
|
|
656
|
+
*
|
|
657
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
658
|
+
* * `sui_reserve_array_index` - The index of the SUI reserve to unstake from.
|
|
659
|
+
* * `liquidity_request` - A reference to the `LiquidityRequest` for the unstake.
|
|
660
|
+
* * `system_state` - A mutable reference to the `SuiSystemState`.
|
|
661
|
+
*
|
|
662
|
+
* # Panics
|
|
663
|
+
*
|
|
664
|
+
* This function will panic if:
|
|
665
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
666
|
+
* * `sui_reserve_array_index` is out of bounds.
|
|
667
|
+
*/
|
|
668
|
+
export declare function unstakeSuiFromStaker(tx: Transaction, typeArg: string, args: UnstakeSuiFromStakerArgs, options?: {
|
|
669
|
+
env?: EnvConfig;
|
|
670
|
+
}): TransactionResult;
|
|
671
|
+
/** Get a reference to the lending market's reserves vector. */
|
|
672
|
+
export declare function reserves(tx: Transaction, typeArg: string, lendingMarket: TransactionObjectInput, options?: {
|
|
673
|
+
env?: EnvConfig;
|
|
674
|
+
}): TransactionResult;
|
|
675
|
+
export interface MaxBorrowAmountArgs {
|
|
676
|
+
rateLimiter: TransactionObjectInput;
|
|
677
|
+
obligation: TransactionObjectInput;
|
|
678
|
+
reserve: TransactionObjectInput;
|
|
679
|
+
clock: TransactionObjectInput;
|
|
680
|
+
}
|
|
681
|
+
export declare function maxBorrowAmount(tx: Transaction, typeArg: string, args: MaxBorrowAmountArgs, options?: {
|
|
682
|
+
env?: EnvConfig;
|
|
683
|
+
}): TransactionResult;
|
|
149
684
|
export interface MaxWithdrawAmountArgs {
|
|
150
685
|
rateLimiter: TransactionObjectInput;
|
|
151
686
|
obligation: TransactionObjectInput;
|
|
152
687
|
reserve: TransactionObjectInput;
|
|
153
688
|
clock: TransactionObjectInput;
|
|
154
689
|
}
|
|
155
|
-
export declare function maxWithdrawAmount(tx: Transaction, typeArg: string, args: MaxWithdrawAmountArgs
|
|
156
|
-
|
|
690
|
+
export declare function maxWithdrawAmount(tx: Transaction, typeArg: string, args: MaxWithdrawAmountArgs, options?: {
|
|
691
|
+
env?: EnvConfig;
|
|
692
|
+
}): TransactionResult;
|
|
693
|
+
/** Get the obligation ID from an `ObligationOwnerCap`. */
|
|
694
|
+
export declare function obligationId(tx: Transaction, typeArg: string, cap: TransactionObjectInput, options?: {
|
|
695
|
+
env?: EnvConfig;
|
|
696
|
+
}): TransactionResult;
|
|
697
|
+
/**
|
|
698
|
+
* Get the array index of a reserve by its coin type.
|
|
699
|
+
* slow function. use sparingly.
|
|
700
|
+
*/
|
|
701
|
+
export declare function reserveArrayIndex(tx: Transaction, typeArgs: [string, string], lendingMarket: TransactionObjectInput, options?: {
|
|
702
|
+
env?: EnvConfig;
|
|
703
|
+
}): TransactionResult;
|
|
704
|
+
/** Get a reference to a reserve by its coin type. */
|
|
705
|
+
export declare function reserve(tx: Transaction, typeArgs: [string, string], lendingMarket: TransactionObjectInput, options?: {
|
|
706
|
+
env?: EnvConfig;
|
|
707
|
+
}): TransactionResult;
|
|
708
|
+
/**
|
|
709
|
+
* Seeds a `ReserveConfigBuilder` from a reserve's live on-chain config in a
|
|
710
|
+
* single call, so the `&ReserveConfig` `reserve::config` returns never has
|
|
711
|
+
* to cross a PTB command boundary into `reserve_config::from`.
|
|
712
|
+
*/
|
|
713
|
+
export declare function reserveConfigBuilder(tx: Transaction, typeArgs: [string, string], lendingMarket: TransactionObjectInput, options?: {
|
|
714
|
+
env?: EnvConfig;
|
|
715
|
+
}): TransactionResult;
|
|
716
|
+
export interface ObligationArgs {
|
|
157
717
|
lendingMarket: TransactionObjectInput;
|
|
158
|
-
reserveArrayIndex: bigint | TransactionArgument;
|
|
159
718
|
obligationId: string | TransactionArgument;
|
|
160
|
-
clock: TransactionObjectInput;
|
|
161
|
-
maxRepayCoins: TransactionObjectInput;
|
|
162
719
|
}
|
|
163
|
-
|
|
164
|
-
export declare function
|
|
720
|
+
/** Get a reference to an obligation by its ID. */
|
|
721
|
+
export declare function obligation(tx: Transaction, typeArg: string, args: ObligationArgs, options?: {
|
|
722
|
+
env?: EnvConfig;
|
|
723
|
+
}): TransactionResult;
|
|
724
|
+
/** Get the fee receiver address. */
|
|
725
|
+
export declare function feeReceiver(tx: Transaction, typeArg: string, lendingMarket: TransactionObjectInput, options?: {
|
|
726
|
+
env?: EnvConfig;
|
|
727
|
+
}): TransactionResult;
|
|
728
|
+
/** Get the amount of a rate limiter exemption. */
|
|
729
|
+
export declare function rateLimiterExemptionAmount(tx: Transaction, typeArgs: [string, string], exemption: TransactionObjectInput, options?: {
|
|
730
|
+
env?: EnvConfig;
|
|
731
|
+
}): TransactionResult;
|
|
732
|
+
export interface MigrateArgs {
|
|
733
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
734
|
+
lendingMarket: TransactionObjectInput;
|
|
735
|
+
}
|
|
736
|
+
/** Migrates the lending market to the current version. */
|
|
737
|
+
export declare function migrate(tx: Transaction, typeArg: string, args: MigrateArgs, options?: {
|
|
738
|
+
env?: EnvConfig;
|
|
739
|
+
}): TransactionResult;
|
|
165
740
|
export interface AddReserveArgs {
|
|
741
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
742
|
+
lendingMarket: TransactionObjectInput;
|
|
743
|
+
priceInfoObject: TransactionObjectInput;
|
|
744
|
+
reserveConfig: TransactionObjectInput;
|
|
745
|
+
coinMetadata: TransactionObjectInput;
|
|
746
|
+
clock: TransactionObjectInput;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Deprecated tombstone — kept only because Sui's upgrade compatibility rules
|
|
750
|
+
* freeze a published function's signature. Pyth froze every legacy on-chain
|
|
751
|
+
* feed at the 2026-08-26 cutover; nothing has written to one since, so this
|
|
752
|
+
* now aborts unconditionally instead of creating a reserve seeded from a
|
|
753
|
+
* permanently-stale price. Use `add_reserve_pro_compatible`.
|
|
754
|
+
*/
|
|
755
|
+
export declare function addReserve(tx: Transaction, typeArgs: [string, string], args: AddReserveArgs, options?: {
|
|
756
|
+
env?: EnvConfig;
|
|
757
|
+
}): TransactionResult;
|
|
758
|
+
export interface AddReserveV2Args {
|
|
759
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
760
|
+
lendingMarket: TransactionObjectInput;
|
|
761
|
+
priceInfoObject: TransactionObjectInput;
|
|
762
|
+
reserveConfig: TransactionObjectInput;
|
|
763
|
+
currency: TransactionObjectInput;
|
|
764
|
+
clock: TransactionObjectInput;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Deprecated tombstone, for the same reason as `add_reserve`. Use
|
|
768
|
+
* `add_reserve_v2_pro_compatible`.
|
|
769
|
+
*/
|
|
770
|
+
export declare function addReserveV2(tx: Transaction, typeArgs: [string, string], args: AddReserveV2Args, options?: {
|
|
771
|
+
env?: EnvConfig;
|
|
772
|
+
}): TransactionResult;
|
|
773
|
+
export interface AddReserveProCompatibleArgs {
|
|
166
774
|
lendingMarketOwnerCap: TransactionObjectInput;
|
|
167
775
|
lendingMarket: TransactionObjectInput;
|
|
168
776
|
priceInfo: TransactionObjectInput;
|
|
@@ -170,103 +778,469 @@ export interface AddReserveArgs {
|
|
|
170
778
|
coinMetadata: TransactionObjectInput;
|
|
171
779
|
clock: TransactionObjectInput;
|
|
172
780
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
781
|
+
/**
|
|
782
|
+
* `add_reserve` against the upgraded Pyth package. Only this path can
|
|
783
|
+
* consume payloads after the 2026-08-18 cutover.
|
|
784
|
+
*/
|
|
785
|
+
export declare function addReserveProCompatible(tx: Transaction, typeArgs: [string, string], args: AddReserveProCompatibleArgs, options?: {
|
|
786
|
+
env?: EnvConfig;
|
|
787
|
+
}): TransactionResult;
|
|
788
|
+
export interface AddReserveV2ProCompatibleArgs {
|
|
789
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
176
790
|
lendingMarket: TransactionObjectInput;
|
|
177
|
-
|
|
178
|
-
|
|
791
|
+
priceInfo: TransactionObjectInput;
|
|
792
|
+
config: TransactionObjectInput;
|
|
793
|
+
currency: TransactionObjectInput;
|
|
179
794
|
clock: TransactionObjectInput;
|
|
180
|
-
amount: bigint | TransactionArgument;
|
|
181
795
|
}
|
|
182
|
-
|
|
183
|
-
|
|
796
|
+
/**
|
|
797
|
+
* `add_reserve_v2` against the upgraded Pyth package. Only this path can
|
|
798
|
+
* consume payloads after the 2026-08-18 cutover.
|
|
799
|
+
*/
|
|
800
|
+
export declare function addReserveV2ProCompatible(tx: Transaction, typeArgs: [string, string], args: AddReserveV2ProCompatibleArgs, options?: {
|
|
801
|
+
env?: EnvConfig;
|
|
802
|
+
}): TransactionResult;
|
|
803
|
+
export interface UpdateReserveConfigArgs {
|
|
184
804
|
lendingMarketOwnerCap: TransactionObjectInput;
|
|
185
805
|
lendingMarket: TransactionObjectInput;
|
|
186
806
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
187
|
-
|
|
188
|
-
clock: TransactionObjectInput;
|
|
807
|
+
config: TransactionObjectInput;
|
|
189
808
|
}
|
|
190
|
-
|
|
191
|
-
|
|
809
|
+
/**
|
|
810
|
+
* Updates the configuration of a reserve.
|
|
811
|
+
*
|
|
812
|
+
* This function allows the owner of the lending market to update the configuration of a specific reserve.
|
|
813
|
+
* It can only be called by the owner of the lending market.
|
|
814
|
+
*
|
|
815
|
+
* # Arguments
|
|
816
|
+
*
|
|
817
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
818
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
819
|
+
* * `reserve_array_index` - The index of the reserve to update.
|
|
820
|
+
* * `config` - The new configuration for the reserve.
|
|
821
|
+
*
|
|
822
|
+
* # Panics
|
|
823
|
+
*
|
|
824
|
+
* This function will panic if:
|
|
825
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
826
|
+
* * `reserve_array_index` is out of bounds.
|
|
827
|
+
* * The `coin_type` of the reserve does not match the type `T` (EWrongType).
|
|
828
|
+
*/
|
|
829
|
+
export declare function updateReserveConfig(tx: Transaction, typeArgs: [string, string], args: UpdateReserveConfigArgs, options?: {
|
|
830
|
+
env?: EnvConfig;
|
|
831
|
+
}): TransactionResult;
|
|
832
|
+
export interface SetReservePriceGuardArgs {
|
|
833
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
192
834
|
lendingMarket: TransactionObjectInput;
|
|
193
|
-
|
|
835
|
+
reserveArrayIndex: bigint | TransactionArgument;
|
|
836
|
+
maxPriceChangeBps: bigint | TransactionArgument;
|
|
837
|
+
minUpdateIntervalS: bigint | TransactionArgument;
|
|
194
838
|
clock: TransactionObjectInput;
|
|
195
|
-
rewardReserveId: bigint | TransactionArgument;
|
|
196
|
-
rewardIndex: bigint | TransactionArgument;
|
|
197
|
-
isDepositReward: boolean | TransactionArgument;
|
|
198
|
-
depositReserveId: bigint | TransactionArgument;
|
|
199
839
|
}
|
|
200
|
-
|
|
201
|
-
|
|
840
|
+
/**
|
|
841
|
+
* Sets a reserve's price guard, bounding how far its price and smoothed price may
|
|
842
|
+
* move per `min_update_interval_s`. Seeds both anchors from the reserve's current
|
|
843
|
+
* prices, so widening the band and refreshing is how the owner admits a genuine move.
|
|
844
|
+
*
|
|
845
|
+
* # Panics
|
|
846
|
+
*
|
|
847
|
+
* This function will panic if:
|
|
848
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
849
|
+
* * `reserve_array_index` is out of bounds.
|
|
850
|
+
* * The `coin_type` of the reserve does not match the type `T` (EWrongType).
|
|
851
|
+
* * The band reaches the reserve's liquidation buffer (EPriceBandAboveLiquidationBuffer).
|
|
852
|
+
*/
|
|
853
|
+
export declare function setReservePriceGuard(tx: Transaction, typeArgs: [string, string], args: SetReservePriceGuardArgs, options?: {
|
|
854
|
+
env?: EnvConfig;
|
|
855
|
+
}): TransactionResult;
|
|
856
|
+
export interface ChangeReservePriceFeedArgs {
|
|
857
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
202
858
|
lendingMarket: TransactionObjectInput;
|
|
203
|
-
|
|
859
|
+
u64: bigint | TransactionArgument;
|
|
860
|
+
priceInfoObject: TransactionObjectInput;
|
|
204
861
|
clock: TransactionObjectInput;
|
|
205
|
-
reserveId: bigint | TransactionArgument;
|
|
206
|
-
rewardIndex: bigint | TransactionArgument;
|
|
207
|
-
isDepositReward: boolean | TransactionArgument;
|
|
208
|
-
failIfRewardPeriodNotOver: boolean | TransactionArgument;
|
|
209
862
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
863
|
+
/**
|
|
864
|
+
* Deprecated tombstone — kept only because Sui's upgrade compatibility rules
|
|
865
|
+
* freeze a published function's signature. Pyth froze every legacy on-chain
|
|
866
|
+
* feed at the 2026-08-26 cutover; nothing has written to one since, so this
|
|
867
|
+
* now aborts unconditionally instead of repointing a reserve at a
|
|
868
|
+
* permanently-stale feed. Use `change_reserve_price_feed_pro_compatible`.
|
|
869
|
+
*/
|
|
870
|
+
export declare function changeReservePriceFeed(tx: Transaction, typeArgs: [string, string], args: ChangeReservePriceFeedArgs, options?: {
|
|
871
|
+
env?: EnvConfig;
|
|
872
|
+
}): TransactionResult;
|
|
873
|
+
export interface ChangeReservePriceFeedProCompatibleArgs {
|
|
874
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
213
875
|
lendingMarket: TransactionObjectInput;
|
|
214
876
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
215
|
-
|
|
877
|
+
priceInfoObj: TransactionObjectInput;
|
|
216
878
|
clock: TransactionObjectInput;
|
|
217
|
-
deposit: TransactionObjectInput;
|
|
218
879
|
}
|
|
219
|
-
|
|
220
|
-
|
|
880
|
+
/**
|
|
881
|
+
* `change_reserve_price_feed` against the upgraded Pyth package. Same
|
|
882
|
+
* owner-cap gate and coin-type check; only the object's package differs.
|
|
883
|
+
*/
|
|
884
|
+
export declare function changeReservePriceFeedProCompatible(tx: Transaction, typeArgs: [string, string], args: ChangeReservePriceFeedProCompatibleArgs, options?: {
|
|
885
|
+
env?: EnvConfig;
|
|
886
|
+
}): TransactionResult;
|
|
887
|
+
export interface AddPoolRewardArgs {
|
|
888
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
221
889
|
lendingMarket: TransactionObjectInput;
|
|
222
890
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
223
|
-
|
|
891
|
+
isDepositReward: boolean | TransactionArgument;
|
|
892
|
+
rewards: TransactionObjectInput;
|
|
893
|
+
startTimeMs: bigint | TransactionArgument;
|
|
894
|
+
endTimeMs: bigint | TransactionArgument;
|
|
224
895
|
clock: TransactionObjectInput;
|
|
225
|
-
deposit: TransactionObjectInput;
|
|
226
896
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
897
|
+
/**
|
|
898
|
+
* Adds a new reward pool to a reserve for either deposits or borrows.
|
|
899
|
+
*
|
|
900
|
+
* This function allows the owner of the lending market to incentivize users by adding rewards
|
|
901
|
+
* to a specific reserve. The rewards are distributed over a specified time period.
|
|
902
|
+
*
|
|
903
|
+
* # Arguments
|
|
904
|
+
*
|
|
905
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
906
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
907
|
+
* * `reserve_array_index` - The index of the reserve to add the reward pool to.
|
|
908
|
+
* * `is_deposit_reward` - A boolean indicating whether the reward is for deposits (`true`) or borrows (`false`).
|
|
909
|
+
* * `rewards` - The `Coin` containing the total amount of rewards to be distributed.
|
|
910
|
+
* * `start_time_ms` - The timestamp in milliseconds when the reward distribution starts.
|
|
911
|
+
* * `end_time_ms` - The timestamp in milliseconds when the reward distribution ends.
|
|
912
|
+
* * `clock` - A reference to the `Clock`.
|
|
913
|
+
*
|
|
914
|
+
* # Panics
|
|
915
|
+
*
|
|
916
|
+
* This function will panic if:
|
|
917
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
918
|
+
* * `reserve_array_index` is out of bounds.
|
|
919
|
+
* * The underlying `liquidity_mining::add_pool_reward` function panics (e.g., if `start_time_ms` >= `end_time_ms` or reward amount is zero).
|
|
920
|
+
*/
|
|
921
|
+
export declare function addPoolReward(tx: Transaction, typeArgs: [string, string], args: AddPoolRewardArgs, options?: {
|
|
922
|
+
env?: EnvConfig;
|
|
923
|
+
}): TransactionResult;
|
|
924
|
+
export interface CancelPoolRewardArgs {
|
|
230
925
|
lendingMarketOwnerCap: TransactionObjectInput;
|
|
231
926
|
lendingMarket: TransactionObjectInput;
|
|
232
|
-
|
|
927
|
+
reserveArrayIndex: bigint | TransactionArgument;
|
|
928
|
+
isDepositReward: boolean | TransactionArgument;
|
|
929
|
+
rewardIndex: bigint | TransactionArgument;
|
|
930
|
+
clock: TransactionObjectInput;
|
|
233
931
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
932
|
+
/**
|
|
933
|
+
* Cancels a reward pool from a reserve.
|
|
934
|
+
*
|
|
935
|
+
* This is an admin-only function that allows the lending market owner to cancel a reward pool
|
|
936
|
+
* that is currently active. When a reward pool is cancelled, any unallocated rewards are
|
|
937
|
+
* returned to the owner.
|
|
938
|
+
*
|
|
939
|
+
* # Arguments
|
|
940
|
+
*
|
|
941
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
942
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
943
|
+
* * `reserve_array_index` - The index of the reserve to cancel the reward pool from.
|
|
944
|
+
* * `is_deposit_reward` - A boolean indicating whether the reward is for deposits (`true`) or borrows (`false`).
|
|
945
|
+
* * `reward_index` - The index of the reward pool to cancel.
|
|
946
|
+
* * `clock` - A reference to the `Clock`.
|
|
947
|
+
*
|
|
948
|
+
* # Returns
|
|
949
|
+
*
|
|
950
|
+
* * `Coin<RewardType>` - A `Coin` containing the unallocated rewards from the cancelled pool.
|
|
951
|
+
*
|
|
952
|
+
* # Panics
|
|
953
|
+
*
|
|
954
|
+
* This function will panic if:
|
|
955
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
956
|
+
* * `reserve_array_index` is out of bounds.
|
|
957
|
+
* * The underlying `liquidity_mining::cancel_pool_reward` function panics.
|
|
958
|
+
*/
|
|
959
|
+
export declare function cancelPoolReward(tx: Transaction, typeArgs: [string, string], args: CancelPoolRewardArgs, options?: {
|
|
960
|
+
env?: EnvConfig;
|
|
961
|
+
}): TransactionResult;
|
|
962
|
+
export interface ClosePoolRewardArgs {
|
|
963
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
237
964
|
lendingMarket: TransactionObjectInput;
|
|
238
965
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
966
|
+
isDepositReward: boolean | TransactionArgument;
|
|
967
|
+
rewardIndex: bigint | TransactionArgument;
|
|
239
968
|
clock: TransactionObjectInput;
|
|
240
|
-
ctokens: TransactionObjectInput;
|
|
241
|
-
rateLimiterExemption: TransactionObjectInput | TransactionArgument | null;
|
|
242
969
|
}
|
|
243
|
-
|
|
244
|
-
|
|
970
|
+
/**
|
|
971
|
+
* Closes a reward pool from a reserve after its distribution period has ended.
|
|
972
|
+
*
|
|
973
|
+
* This is an admin-only function that allows the lending market owner to close a reward pool
|
|
974
|
+
* that has finished distributing rewards. When a reward pool is closed, any unallocated rewards
|
|
975
|
+
* due to rounding or other factors are returned to the owner. This function can only be called
|
|
976
|
+
* after the pool's `end_time_ms` has passed.
|
|
977
|
+
*
|
|
978
|
+
* # Arguments
|
|
979
|
+
*
|
|
980
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
981
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
982
|
+
* * `reserve_array_index` - The index of the reserve to close the reward pool from.
|
|
983
|
+
* * `is_deposit_reward` - A boolean indicating whether the reward is for deposits (`true`) or borrows (`false`).
|
|
984
|
+
* * `reward_index` - The index of the reward pool to close.
|
|
985
|
+
* * `clock` - A reference to the `Clock`.
|
|
986
|
+
*
|
|
987
|
+
* # Returns
|
|
988
|
+
*
|
|
989
|
+
* * `Coin<RewardType>` - A `Coin` containing the unallocated rewards from the closed pool.
|
|
990
|
+
*
|
|
991
|
+
* # Panics
|
|
992
|
+
*
|
|
993
|
+
* This function will panic if:
|
|
994
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
995
|
+
* * `reserve_array_index` is out of bounds.
|
|
996
|
+
* * The underlying `liquidity_mining::close_pool_reward` function panics (e.g., if the reward period is not over).
|
|
997
|
+
*/
|
|
998
|
+
export declare function closePoolReward(tx: Transaction, typeArgs: [string, string], args: ClosePoolRewardArgs, options?: {
|
|
999
|
+
env?: EnvConfig;
|
|
1000
|
+
}): TransactionResult;
|
|
1001
|
+
export interface DrainPointsRewardArgs {
|
|
1002
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
245
1003
|
lendingMarket: TransactionObjectInput;
|
|
246
1004
|
reserveArrayIndex: bigint | TransactionArgument;
|
|
1005
|
+
isDepositReward: boolean | TransactionArgument;
|
|
1006
|
+
rewardIndex: bigint | TransactionArgument;
|
|
247
1007
|
clock: TransactionObjectInput;
|
|
248
|
-
ctokens: TransactionObjectInput;
|
|
249
|
-
rateLimiterExemption: TransactionObjectInput | TransactionArgument | null;
|
|
250
1008
|
}
|
|
251
|
-
|
|
252
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* Drains all remaining balance from a Suilend/Steamm points reward after its period has ended.
|
|
1011
|
+
* UserReward entries are cleaned up when users next interact with the protocol.
|
|
1012
|
+
* cancel_pool_reward must be called first to stop accumulation, then drain_points_reward to reclaim the remaining balance.
|
|
1013
|
+
*/
|
|
1014
|
+
export declare function drainPointsReward(tx: Transaction, typeArgs: [string, string], args: DrainPointsRewardArgs, options?: {
|
|
1015
|
+
env?: EnvConfig;
|
|
1016
|
+
}): TransactionResult;
|
|
1017
|
+
export interface UpdateRateLimiterConfigArgs {
|
|
1018
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
253
1019
|
lendingMarket: TransactionObjectInput;
|
|
254
|
-
reserveArrayIndex: bigint | TransactionArgument;
|
|
255
1020
|
clock: TransactionObjectInput;
|
|
256
|
-
|
|
1021
|
+
config: TransactionObjectInput;
|
|
257
1022
|
}
|
|
258
|
-
|
|
1023
|
+
/**
|
|
1024
|
+
* Updates the rate limiter configuration.
|
|
1025
|
+
*
|
|
1026
|
+
* This is an admin-only function that allows the lending market owner to update the rate
|
|
1027
|
+
* limiter configuration. The new configuration will replace the existing one.
|
|
1028
|
+
*
|
|
1029
|
+
* # Arguments
|
|
1030
|
+
*
|
|
1031
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
1032
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
1033
|
+
* * `clock` - A reference to the `Clock` to get the current timestamp.
|
|
1034
|
+
* * `config` - The new `RateLimiterConfig` to apply.
|
|
1035
|
+
*
|
|
1036
|
+
* # Panics
|
|
1037
|
+
*
|
|
1038
|
+
* This function will panic if:
|
|
1039
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
1040
|
+
*/
|
|
1041
|
+
export declare function updateRateLimiterConfig(tx: Transaction, typeArg: string, args: UpdateRateLimiterConfigArgs, options?: {
|
|
1042
|
+
env?: EnvConfig;
|
|
1043
|
+
}): TransactionResult;
|
|
259
1044
|
export interface SetFeeReceiversArgs {
|
|
260
1045
|
lendingMarketOwnerCap: TransactionObjectInput;
|
|
261
1046
|
lendingMarket: TransactionObjectInput;
|
|
262
1047
|
receivers: Array<string | TransactionArgument> | TransactionArgument;
|
|
263
1048
|
weights: Array<bigint | TransactionArgument> | TransactionArgument;
|
|
264
1049
|
}
|
|
265
|
-
|
|
266
|
-
|
|
1050
|
+
/**
|
|
1051
|
+
* Sets the fee receivers for the lending market.
|
|
1052
|
+
*
|
|
1053
|
+
* This is an admin-only function that allows the lending market owner to set the fee receivers
|
|
1054
|
+
* and their respective weights for distributing protocol fees. The fees are distributed
|
|
1055
|
+
* proportionally based on these weights.
|
|
1056
|
+
*
|
|
1057
|
+
* # Arguments
|
|
1058
|
+
*
|
|
1059
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
1060
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
1061
|
+
* * `receivers` - A vector of addresses that will receive the fees.
|
|
1062
|
+
* * `weights` - A vector of weights corresponding to each receiver.
|
|
1063
|
+
*
|
|
1064
|
+
* # Panics
|
|
1065
|
+
*
|
|
1066
|
+
* This function will panic if:
|
|
1067
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
1068
|
+
* * The `receivers` and `weights` vectors do not have the same length (EInvalidFeeReceivers).
|
|
1069
|
+
* * The `receivers` vector is empty (EInvalidFeeReceivers).
|
|
1070
|
+
* * The sum of `weights` is zero (EInvalidFeeReceivers).
|
|
1071
|
+
*/
|
|
1072
|
+
export declare function setFeeReceivers(tx: Transaction, typeArg: string, args: SetFeeReceiversArgs, options?: {
|
|
1073
|
+
env?: EnvConfig;
|
|
1074
|
+
}): TransactionResult;
|
|
1075
|
+
export interface ClaimFeesArgs {
|
|
1076
|
+
lendingMarket: TransactionObjectInput;
|
|
1077
|
+
reserveArrayIndex: bigint | TransactionArgument;
|
|
1078
|
+
systemState: TransactionObjectInput;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Claims the fees from a reserve and distributes them to the fee receivers.
|
|
1082
|
+
*
|
|
1083
|
+
* This is a permissionless entry function that can be called by anyone to trigger the
|
|
1084
|
+
* distribution of accumulated protocol fees from a specific reserve. The fees, which
|
|
1085
|
+
* can be in both the underlying asset and cTokens, are transferred to the fee receivers
|
|
1086
|
+
* according to the weights configured via `set_fee_receivers`.
|
|
1087
|
+
*
|
|
1088
|
+
* # Arguments
|
|
1089
|
+
*
|
|
1090
|
+
* * `lending_market` - A mutable reference to the `LendingMarket`.
|
|
1091
|
+
* * `reserve_array_index` - The index of the reserve to claim fees from.
|
|
1092
|
+
* * `system_state` - A mutable reference to the `SuiSystemState`, required for claiming staking rewards.
|
|
1093
|
+
*
|
|
1094
|
+
* # Panics
|
|
1095
|
+
*
|
|
1096
|
+
* This function will panic if:
|
|
1097
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
1098
|
+
* * The generic type `T` does not match the coin type of the reserve at `reserve_array_index` (EWrongType).
|
|
1099
|
+
* * `reserve_array_index` is out of bounds.
|
|
1100
|
+
* * The `FeeReceivers` dynamic field has not been set on the lending market.
|
|
1101
|
+
*/
|
|
1102
|
+
export declare function claimFees(tx: Transaction, typeArgs: [string, string], args: ClaimFeesArgs, options?: {
|
|
1103
|
+
env?: EnvConfig;
|
|
1104
|
+
}): TransactionResult;
|
|
1105
|
+
export interface NewObligationOwnerCapArgs {
|
|
1106
|
+
lendingMarketOwnerCap: TransactionObjectInput;
|
|
1107
|
+
lendingMarket: TransactionObjectInput;
|
|
1108
|
+
obligationId: string | TransactionArgument;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Creates a new obligation owner cap for an existing obligation.
|
|
1112
|
+
*
|
|
1113
|
+
* This is an admin-only function that allows the lending market owner to create a new
|
|
1114
|
+
* `ObligationOwnerCap` for an obligation that already exists. This can be useful for
|
|
1115
|
+
* recovery purposes or administrative actions where a new capability object is needed.
|
|
1116
|
+
*
|
|
1117
|
+
* # Arguments
|
|
1118
|
+
*
|
|
1119
|
+
* * `_` - The `LendingMarketOwnerCap` to authorize the operation.
|
|
1120
|
+
* * `lending_market` - A reference to the `LendingMarket`.
|
|
1121
|
+
* * `obligation_id` - The ID of the obligation to create a new owner cap for.
|
|
1122
|
+
*
|
|
1123
|
+
* # Returns
|
|
1124
|
+
*
|
|
1125
|
+
* * `ObligationOwnerCap<P>` - The newly created ownership capability for the specified obligation.
|
|
1126
|
+
*
|
|
1127
|
+
* # Panics
|
|
1128
|
+
*
|
|
1129
|
+
* This function will panic if:
|
|
1130
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
1131
|
+
* * The `obligation_id` is not found in the lending market's obligations (EInvalidObligationId).
|
|
1132
|
+
*/
|
|
1133
|
+
export declare function newObligationOwnerCap(tx: Transaction, typeArg: string, args: NewObligationOwnerCapArgs, options?: {
|
|
1134
|
+
env?: EnvConfig;
|
|
1135
|
+
}): TransactionResult;
|
|
1136
|
+
export interface NewPauseCapArgs {
|
|
267
1137
|
lendingMarketOwnerCap: TransactionObjectInput;
|
|
268
1138
|
lendingMarket: TransactionObjectInput;
|
|
1139
|
+
recipient: string | TransactionArgument;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Mints a fresh `EmergencyPauseCap` at the next generation, revoking every
|
|
1143
|
+
* previously-issued cap for this market (their `generation` no longer matches).
|
|
1144
|
+
*
|
|
1145
|
+
* # Panics
|
|
1146
|
+
*
|
|
1147
|
+
* This function will panic if:
|
|
1148
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
1149
|
+
*/
|
|
1150
|
+
export declare function newPauseCap(tx: Transaction, typeArg: string, args: NewPauseCapArgs, options?: {
|
|
1151
|
+
env?: EnvConfig;
|
|
1152
|
+
}): TransactionResult;
|
|
1153
|
+
export interface SetMarketPausedArgs {
|
|
1154
|
+
cap: TransactionObjectInput;
|
|
1155
|
+
lendingMarket: TransactionObjectInput;
|
|
1156
|
+
paused: boolean | TransactionArgument;
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Pauses or resumes the entire market. Gated on possession of the
|
|
1160
|
+
* current-generation `EmergencyPauseCap`; a cap from a superseded generation aborts.
|
|
1161
|
+
*
|
|
1162
|
+
* # Panics
|
|
1163
|
+
*
|
|
1164
|
+
* This function will panic if:
|
|
1165
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
1166
|
+
* * `cap` was not minted for this `lending_market` (EWrongLendingMarket).
|
|
1167
|
+
* * `cap`'s generation has been superseded by a later `new_pause_cap` call (EStalePauseCap).
|
|
1168
|
+
*/
|
|
1169
|
+
export declare function setMarketPaused(tx: Transaction, typeArg: string, args: SetMarketPausedArgs, options?: {
|
|
1170
|
+
env?: EnvConfig;
|
|
1171
|
+
}): TransactionResult;
|
|
1172
|
+
export interface SetReservePausedArgs {
|
|
1173
|
+
cap: TransactionObjectInput;
|
|
1174
|
+
lendingMarket: TransactionObjectInput;
|
|
1175
|
+
reserveArrayIndex: bigint | TransactionArgument;
|
|
1176
|
+
paused: boolean | TransactionArgument;
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Pauses or resumes a single reserve. Gated on possession of the current-generation
|
|
1180
|
+
* `EmergencyPauseCap`; a cap from a superseded generation aborts.
|
|
1181
|
+
*
|
|
1182
|
+
* # Panics
|
|
1183
|
+
*
|
|
1184
|
+
* This function will panic if:
|
|
1185
|
+
* * The `lending_market` version is not `CURRENT_VERSION` (EIncorrectVersion).
|
|
1186
|
+
* * `cap` was not minted for this `lending_market` (EWrongLendingMarket).
|
|
1187
|
+
* * `cap`'s generation has been superseded by a later `new_pause_cap` call (EStalePauseCap).
|
|
1188
|
+
* * `reserve_array_index` is out of bounds.
|
|
1189
|
+
*/
|
|
1190
|
+
export declare function setReservePaused(tx: Transaction, typeArg: string, args: SetReservePausedArgs, options?: {
|
|
1191
|
+
env?: EnvConfig;
|
|
1192
|
+
}): TransactionResult;
|
|
1193
|
+
/**
|
|
1194
|
+
* True if the market has been paused. Absent the dynamic field, the market is
|
|
1195
|
+
* unpaused. Pure: no aborts, no side effects. Public so a UI or bot can check
|
|
1196
|
+
* pause state before building a PTB, instead of discovering it as an abort.
|
|
1197
|
+
*/
|
|
1198
|
+
export declare function isMarketPaused(tx: Transaction, typeArg: string, lendingMarket: TransactionObjectInput, options?: {
|
|
1199
|
+
env?: EnvConfig;
|
|
1200
|
+
}): TransactionResult;
|
|
1201
|
+
export interface AssertValidPauseCapArgs {
|
|
1202
|
+
cap: TransactionObjectInput;
|
|
1203
|
+
lendingMarket: TransactionObjectInput;
|
|
1204
|
+
}
|
|
1205
|
+
export declare function assertValidPauseCap(tx: Transaction, typeArg: string, args: AssertValidPauseCapArgs, options?: {
|
|
1206
|
+
env?: EnvConfig;
|
|
1207
|
+
}): TransactionResult;
|
|
1208
|
+
export interface AssertNotPausedArgs {
|
|
1209
|
+
lendingMarket: TransactionObjectInput;
|
|
1210
|
+
reserve: TransactionObjectInput;
|
|
1211
|
+
}
|
|
1212
|
+
export declare function assertNotPaused(tx: Transaction, typeArg: string, args: AssertNotPausedArgs, options?: {
|
|
1213
|
+
env?: EnvConfig;
|
|
1214
|
+
}): TransactionResult;
|
|
1215
|
+
export interface DepositCtokensIntoObligationByIdArgs {
|
|
1216
|
+
lendingMarket: TransactionObjectInput;
|
|
1217
|
+
reserveArrayIndex: bigint | TransactionArgument;
|
|
1218
|
+
obligationId: string | TransactionArgument;
|
|
1219
|
+
clock: TransactionObjectInput;
|
|
1220
|
+
deposit: TransactionObjectInput;
|
|
1221
|
+
}
|
|
1222
|
+
export declare function depositCtokensIntoObligationById(tx: Transaction, typeArgs: [string, string], args: DepositCtokensIntoObligationByIdArgs, options?: {
|
|
1223
|
+
env?: EnvConfig;
|
|
1224
|
+
}): TransactionResult;
|
|
1225
|
+
export interface ClaimRewardsByObligationIdArgs {
|
|
1226
|
+
lendingMarket: TransactionObjectInput;
|
|
1227
|
+
obligationId: string | TransactionArgument;
|
|
269
1228
|
clock: TransactionObjectInput;
|
|
1229
|
+
reserveId: bigint | TransactionArgument;
|
|
1230
|
+
rewardIndex: bigint | TransactionArgument;
|
|
1231
|
+
isDepositReward: boolean | TransactionArgument;
|
|
1232
|
+
failIfRewardPeriodNotOver: boolean | TransactionArgument;
|
|
1233
|
+
}
|
|
1234
|
+
export declare function claimRewardsByObligationId(tx: Transaction, typeArgs: [string, string], args: ClaimRewardsByObligationIdArgs, options?: {
|
|
1235
|
+
env?: EnvConfig;
|
|
1236
|
+
}): TransactionResult;
|
|
1237
|
+
export interface AddReserveInternalProCompatibleArgs {
|
|
1238
|
+
lendingMarket: TransactionObjectInput;
|
|
1239
|
+
priceInfo: TransactionObjectInput;
|
|
270
1240
|
config: TransactionObjectInput;
|
|
1241
|
+
decimals: number | TransactionArgument;
|
|
1242
|
+
clock: TransactionObjectInput;
|
|
271
1243
|
}
|
|
272
|
-
export declare function
|
|
1244
|
+
export declare function addReserveInternalProCompatible(tx: Transaction, typeArgs: [string, string], args: AddReserveInternalProCompatibleArgs, options?: {
|
|
1245
|
+
env?: EnvConfig;
|
|
1246
|
+
}): TransactionResult;
|