@gearbox-protocol/sdk 13.5.0 → 13.6.0-kyc.2

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 (98) hide show
  1. package/dist/cjs/abi/kyc/iKYCCompressor.js +196 -0
  2. package/dist/cjs/abi/kyc/iKYCFactory.js +122 -0
  3. package/dist/cjs/abi/kyc/iKYCUnderlying.js +401 -0
  4. package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +326 -0
  5. package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +319 -0
  6. package/dist/cjs/dev/AccountOpener.js +45 -5
  7. package/dist/cjs/sdk/GearboxSDK.js +51 -4
  8. package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +331 -16
  9. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +7 -1
  10. package/dist/cjs/sdk/base/TokensMeta.js +32 -43
  11. package/dist/cjs/sdk/base/token-types.js +9 -0
  12. package/dist/cjs/sdk/chain/chains.js +2 -1
  13. package/dist/cjs/sdk/constants/address-provider.js +3 -0
  14. package/dist/cjs/sdk/market/MarketRegister.js +70 -116
  15. package/dist/cjs/sdk/market/MarketSuite.js +3 -0
  16. package/dist/cjs/sdk/market/kyc/KYCRegister.js +255 -0
  17. package/dist/cjs/sdk/market/kyc/index.js +24 -0
  18. package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +229 -0
  19. package/dist/cjs/sdk/market/kyc/securitize/constants.js +28 -0
  20. package/dist/cjs/sdk/market/kyc/securitize/index.js +26 -0
  21. package/dist/cjs/sdk/market/kyc/securitize/types.js +16 -0
  22. package/dist/cjs/sdk/market/kyc/types.js +29 -0
  23. package/dist/cjs/sdk/market/pool/PoolSuite.js +3 -0
  24. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +11 -2
  25. package/dist/cjs/sdk/market/pool/index.js +2 -0
  26. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
  27. package/dist/cjs/sdk/options.js +6 -0
  28. package/dist/cjs/sdk/pools/PoolService.js +104 -12
  29. package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +38 -0
  30. package/dist/cjs/sdk/utils/viem/index.js +2 -0
  31. package/dist/esm/abi/kyc/iKYCCompressor.js +172 -0
  32. package/dist/esm/abi/kyc/iKYCFactory.js +98 -0
  33. package/dist/esm/abi/kyc/iKYCUnderlying.js +377 -0
  34. package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +302 -0
  35. package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +295 -0
  36. package/dist/esm/dev/AccountOpener.js +47 -6
  37. package/dist/esm/sdk/GearboxSDK.js +55 -5
  38. package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +332 -17
  39. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +7 -1
  40. package/dist/esm/sdk/base/TokensMeta.js +32 -45
  41. package/dist/esm/sdk/base/token-types.js +6 -0
  42. package/dist/esm/sdk/chain/chains.js +2 -1
  43. package/dist/esm/sdk/constants/address-provider.js +2 -0
  44. package/dist/esm/sdk/market/MarketRegister.js +74 -118
  45. package/dist/esm/sdk/market/MarketSuite.js +3 -0
  46. package/dist/esm/sdk/market/kyc/KYCRegister.js +239 -0
  47. package/dist/esm/sdk/market/kyc/index.js +2 -0
  48. package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +205 -0
  49. package/dist/esm/sdk/market/kyc/securitize/constants.js +4 -0
  50. package/dist/esm/sdk/market/kyc/securitize/index.js +3 -0
  51. package/dist/esm/sdk/market/kyc/securitize/types.js +0 -0
  52. package/dist/esm/sdk/market/kyc/types.js +5 -0
  53. package/dist/esm/sdk/market/pool/PoolSuite.js +3 -0
  54. package/dist/esm/sdk/market/pool/PoolV310Contract.js +11 -2
  55. package/dist/esm/sdk/market/pool/index.js +1 -0
  56. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
  57. package/dist/esm/sdk/options.js +6 -0
  58. package/dist/esm/sdk/pools/PoolService.js +109 -13
  59. package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +14 -0
  60. package/dist/esm/sdk/utils/viem/index.js +1 -0
  61. package/dist/types/abi/kyc/iKYCCompressor.d.ts +228 -0
  62. package/dist/types/abi/kyc/iKYCFactory.d.ts +139 -0
  63. package/dist/types/abi/kyc/iKYCUnderlying.d.ts +548 -0
  64. package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +404 -0
  65. package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +376 -0
  66. package/dist/types/sdk/GearboxSDK.d.ts +7 -0
  67. package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +55 -2
  68. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
  69. package/dist/types/sdk/accounts/types.d.ts +93 -13
  70. package/dist/types/sdk/base/TokensMeta.d.ts +14 -3
  71. package/dist/types/sdk/base/token-types.d.ts +44 -4
  72. package/dist/types/sdk/base/types.d.ts +116 -2
  73. package/dist/types/sdk/chain/chains.d.ts +5 -1
  74. package/dist/types/sdk/constants/address-provider.d.ts +1 -0
  75. package/dist/types/sdk/market/MarketRegister.d.ts +6 -9
  76. package/dist/types/sdk/market/MarketSuite.d.ts +2 -0
  77. package/dist/types/sdk/market/kyc/KYCRegister.d.ts +31 -0
  78. package/dist/types/sdk/market/kyc/index.d.ts +2 -0
  79. package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +420 -0
  80. package/dist/types/sdk/market/kyc/securitize/constants.d.ts +1 -0
  81. package/dist/types/sdk/market/kyc/securitize/index.d.ts +3 -0
  82. package/dist/types/sdk/market/kyc/securitize/types.d.ts +62 -0
  83. package/dist/types/sdk/market/kyc/types.d.ts +93 -0
  84. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +3 -2
  85. package/dist/types/sdk/market/oracle/types.d.ts +3 -10
  86. package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -0
  87. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +6 -2
  88. package/dist/types/sdk/market/pool/index.d.ts +1 -0
  89. package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +1 -1
  90. package/dist/types/sdk/market/types.d.ts +1 -1
  91. package/dist/types/sdk/options.d.ts +1 -0
  92. package/dist/types/sdk/pools/PoolService.d.ts +8 -8
  93. package/dist/types/sdk/pools/types.d.ts +1 -1
  94. package/dist/types/sdk/types/state-human.d.ts +2 -0
  95. package/dist/types/sdk/types/state.d.ts +5 -0
  96. package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +11 -0
  97. package/dist/types/sdk/utils/viem/index.d.ts +1 -0
  98. package/package.json +3 -2
@@ -0,0 +1,376 @@
1
+ export declare const iSecuritizeKYCFactoryAbi: readonly [{
2
+ readonly type: "function";
3
+ readonly name: "contractType";
4
+ readonly inputs: readonly [];
5
+ readonly outputs: readonly [{
6
+ readonly name: "";
7
+ readonly type: "bytes32";
8
+ readonly internalType: "bytes32";
9
+ }];
10
+ readonly stateMutability: "view";
11
+ }, {
12
+ readonly type: "function";
13
+ readonly name: "getCreditAccounts";
14
+ readonly inputs: readonly [{
15
+ readonly name: "investor";
16
+ readonly type: "address";
17
+ readonly internalType: "address";
18
+ }];
19
+ readonly outputs: readonly [{
20
+ readonly name: "";
21
+ readonly type: "address[]";
22
+ readonly internalType: "address[]";
23
+ }];
24
+ readonly stateMutability: "view";
25
+ }, {
26
+ readonly type: "function";
27
+ readonly name: "getDegenNFT";
28
+ readonly inputs: readonly [];
29
+ readonly outputs: readonly [{
30
+ readonly name: "";
31
+ readonly type: "address";
32
+ readonly internalType: "address";
33
+ }];
34
+ readonly stateMutability: "view";
35
+ }, {
36
+ readonly type: "function";
37
+ readonly name: "getInvestor";
38
+ readonly inputs: readonly [{
39
+ readonly name: "creditAccount";
40
+ readonly type: "address";
41
+ readonly internalType: "address";
42
+ }];
43
+ readonly outputs: readonly [{
44
+ readonly name: "";
45
+ readonly type: "address";
46
+ readonly internalType: "address";
47
+ }];
48
+ readonly stateMutability: "view";
49
+ }, {
50
+ readonly type: "function";
51
+ readonly name: "getTokens";
52
+ readonly inputs: readonly [];
53
+ readonly outputs: readonly [{
54
+ readonly name: "";
55
+ readonly type: "address[]";
56
+ readonly internalType: "address[]";
57
+ }];
58
+ readonly stateMutability: "view";
59
+ }, {
60
+ readonly type: "function";
61
+ readonly name: "getWallet";
62
+ readonly inputs: readonly [{
63
+ readonly name: "creditAccount";
64
+ readonly type: "address";
65
+ readonly internalType: "address";
66
+ }];
67
+ readonly outputs: readonly [{
68
+ readonly name: "";
69
+ readonly type: "address";
70
+ readonly internalType: "address";
71
+ }];
72
+ readonly stateMutability: "view";
73
+ }, {
74
+ readonly type: "function";
75
+ readonly name: "isCreditAccount";
76
+ readonly inputs: readonly [{
77
+ readonly name: "creditAccount";
78
+ readonly type: "address";
79
+ readonly internalType: "address";
80
+ }];
81
+ readonly outputs: readonly [{
82
+ readonly name: "";
83
+ readonly type: "bool";
84
+ readonly internalType: "bool";
85
+ }];
86
+ readonly stateMutability: "view";
87
+ }, {
88
+ readonly type: "function";
89
+ readonly name: "isFrozen";
90
+ readonly inputs: readonly [{
91
+ readonly name: "creditAccount";
92
+ readonly type: "address";
93
+ readonly internalType: "address";
94
+ }];
95
+ readonly outputs: readonly [{
96
+ readonly name: "";
97
+ readonly type: "bool";
98
+ readonly internalType: "bool";
99
+ }];
100
+ readonly stateMutability: "view";
101
+ }, {
102
+ readonly type: "function";
103
+ readonly name: "multicall";
104
+ readonly inputs: readonly [{
105
+ readonly name: "creditAccount";
106
+ readonly type: "address";
107
+ readonly internalType: "address";
108
+ }, {
109
+ readonly name: "calls";
110
+ readonly type: "tuple[]";
111
+ readonly internalType: "struct MultiCall[]";
112
+ readonly components: readonly [{
113
+ readonly name: "target";
114
+ readonly type: "address";
115
+ readonly internalType: "address";
116
+ }, {
117
+ readonly name: "callData";
118
+ readonly type: "bytes";
119
+ readonly internalType: "bytes";
120
+ }];
121
+ }, {
122
+ readonly name: "tokensToRegister";
123
+ readonly type: "address[]";
124
+ readonly internalType: "address[]";
125
+ }, {
126
+ readonly name: "signaturesToCache";
127
+ readonly type: "tuple[]";
128
+ readonly internalType: "struct ISecuritizeDegenNFT.RegisterMessage[]";
129
+ readonly components: readonly [{
130
+ readonly name: "token";
131
+ readonly type: "address";
132
+ readonly internalType: "address";
133
+ }, {
134
+ readonly name: "signature";
135
+ readonly type: "tuple";
136
+ readonly internalType: "struct ISecuritizeDegenNFT.Signature";
137
+ readonly components: readonly [{
138
+ readonly name: "deadline";
139
+ readonly type: "uint256";
140
+ readonly internalType: "uint256";
141
+ }, {
142
+ readonly name: "signature";
143
+ readonly type: "bytes";
144
+ readonly internalType: "bytes";
145
+ }];
146
+ }];
147
+ }];
148
+ readonly outputs: readonly [];
149
+ readonly stateMutability: "nonpayable";
150
+ }, {
151
+ readonly type: "function";
152
+ readonly name: "openCreditAccount";
153
+ readonly inputs: readonly [{
154
+ readonly name: "creditManager";
155
+ readonly type: "address";
156
+ readonly internalType: "address";
157
+ }, {
158
+ readonly name: "calls";
159
+ readonly type: "tuple[]";
160
+ readonly internalType: "struct MultiCall[]";
161
+ readonly components: readonly [{
162
+ readonly name: "target";
163
+ readonly type: "address";
164
+ readonly internalType: "address";
165
+ }, {
166
+ readonly name: "callData";
167
+ readonly type: "bytes";
168
+ readonly internalType: "bytes";
169
+ }];
170
+ }, {
171
+ readonly name: "tokensToRegister";
172
+ readonly type: "address[]";
173
+ readonly internalType: "address[]";
174
+ }, {
175
+ readonly name: "signaturesToCache";
176
+ readonly type: "tuple[]";
177
+ readonly internalType: "struct ISecuritizeDegenNFT.RegisterMessage[]";
178
+ readonly components: readonly [{
179
+ readonly name: "token";
180
+ readonly type: "address";
181
+ readonly internalType: "address";
182
+ }, {
183
+ readonly name: "signature";
184
+ readonly type: "tuple";
185
+ readonly internalType: "struct ISecuritizeDegenNFT.Signature";
186
+ readonly components: readonly [{
187
+ readonly name: "deadline";
188
+ readonly type: "uint256";
189
+ readonly internalType: "uint256";
190
+ }, {
191
+ readonly name: "signature";
192
+ readonly type: "bytes";
193
+ readonly internalType: "bytes";
194
+ }];
195
+ }];
196
+ }];
197
+ readonly outputs: readonly [{
198
+ readonly name: "creditAccount";
199
+ readonly type: "address";
200
+ readonly internalType: "address";
201
+ }, {
202
+ readonly name: "wallet";
203
+ readonly type: "address";
204
+ readonly internalType: "address";
205
+ }];
206
+ readonly stateMutability: "nonpayable";
207
+ }, {
208
+ readonly type: "function";
209
+ readonly name: "precomputeWalletAddress";
210
+ readonly inputs: readonly [{
211
+ readonly name: "creditManager";
212
+ readonly type: "address";
213
+ readonly internalType: "address";
214
+ }, {
215
+ readonly name: "investor";
216
+ readonly type: "address";
217
+ readonly internalType: "address";
218
+ }];
219
+ readonly outputs: readonly [{
220
+ readonly name: "";
221
+ readonly type: "address";
222
+ readonly internalType: "address";
223
+ }];
224
+ readonly stateMutability: "view";
225
+ }, {
226
+ readonly type: "function";
227
+ readonly name: "serialize";
228
+ readonly inputs: readonly [];
229
+ readonly outputs: readonly [{
230
+ readonly name: "serializedData";
231
+ readonly type: "bytes";
232
+ readonly internalType: "bytes";
233
+ }];
234
+ readonly stateMutability: "view";
235
+ }, {
236
+ readonly type: "function";
237
+ readonly name: "setFrozenStatus";
238
+ readonly inputs: readonly [{
239
+ readonly name: "creditAccount";
240
+ readonly type: "address";
241
+ readonly internalType: "address";
242
+ }, {
243
+ readonly name: "frozen";
244
+ readonly type: "bool";
245
+ readonly internalType: "bool";
246
+ }];
247
+ readonly outputs: readonly [];
248
+ readonly stateMutability: "nonpayable";
249
+ }, {
250
+ readonly type: "function";
251
+ readonly name: "setInvestor";
252
+ readonly inputs: readonly [{
253
+ readonly name: "creditAccount";
254
+ readonly type: "address";
255
+ readonly internalType: "address";
256
+ }, {
257
+ readonly name: "investor";
258
+ readonly type: "address";
259
+ readonly internalType: "address";
260
+ }];
261
+ readonly outputs: readonly [];
262
+ readonly stateMutability: "nonpayable";
263
+ }, {
264
+ readonly type: "function";
265
+ readonly name: "version";
266
+ readonly inputs: readonly [];
267
+ readonly outputs: readonly [{
268
+ readonly name: "";
269
+ readonly type: "uint256";
270
+ readonly internalType: "uint256";
271
+ }];
272
+ readonly stateMutability: "view";
273
+ }, {
274
+ readonly type: "event";
275
+ readonly name: "CreateWallet";
276
+ readonly inputs: readonly [{
277
+ readonly name: "creditAccount";
278
+ readonly type: "address";
279
+ readonly indexed: true;
280
+ readonly internalType: "address";
281
+ }, {
282
+ readonly name: "wallet";
283
+ readonly type: "address";
284
+ readonly indexed: true;
285
+ readonly internalType: "address";
286
+ }, {
287
+ readonly name: "investor";
288
+ readonly type: "address";
289
+ readonly indexed: true;
290
+ readonly internalType: "address";
291
+ }];
292
+ readonly anonymous: false;
293
+ }, {
294
+ readonly type: "event";
295
+ readonly name: "SetFrozenStatus";
296
+ readonly inputs: readonly [{
297
+ readonly name: "creditAccount";
298
+ readonly type: "address";
299
+ readonly indexed: true;
300
+ readonly internalType: "address";
301
+ }, {
302
+ readonly name: "frozen";
303
+ readonly type: "bool";
304
+ readonly indexed: false;
305
+ readonly internalType: "bool";
306
+ }];
307
+ readonly anonymous: false;
308
+ }, {
309
+ readonly type: "event";
310
+ readonly name: "SetInvestor";
311
+ readonly inputs: readonly [{
312
+ readonly name: "creditAccount";
313
+ readonly type: "address";
314
+ readonly indexed: true;
315
+ readonly internalType: "address";
316
+ }, {
317
+ readonly name: "oldInvestor";
318
+ readonly type: "address";
319
+ readonly indexed: true;
320
+ readonly internalType: "address";
321
+ }, {
322
+ readonly name: "newInvestor";
323
+ readonly type: "address";
324
+ readonly indexed: true;
325
+ readonly internalType: "address";
326
+ }];
327
+ readonly anonymous: false;
328
+ }, {
329
+ readonly type: "error";
330
+ readonly name: "CallerIsNotInvestorException";
331
+ readonly inputs: readonly [{
332
+ readonly name: "caller";
333
+ readonly type: "address";
334
+ readonly internalType: "address";
335
+ }, {
336
+ readonly name: "creditAccount";
337
+ readonly type: "address";
338
+ readonly internalType: "address";
339
+ }];
340
+ }, {
341
+ readonly type: "error";
342
+ readonly name: "FrozenCreditAccountException";
343
+ readonly inputs: readonly [{
344
+ readonly name: "creditAccount";
345
+ readonly type: "address";
346
+ readonly internalType: "address";
347
+ }];
348
+ }, {
349
+ readonly type: "error";
350
+ readonly name: "InvalidCreditManagerException";
351
+ readonly inputs: readonly [{
352
+ readonly name: "creditManager";
353
+ readonly type: "address";
354
+ readonly internalType: "address";
355
+ }];
356
+ }, {
357
+ readonly type: "error";
358
+ readonly name: "InvalidUnderlyingTokenException";
359
+ readonly inputs: readonly [{
360
+ readonly name: "underlying";
361
+ readonly type: "address";
362
+ readonly internalType: "address";
363
+ }];
364
+ }, {
365
+ readonly type: "error";
366
+ readonly name: "UnknownCreditAccountException";
367
+ readonly inputs: readonly [{
368
+ readonly name: "creditAccount";
369
+ readonly type: "address";
370
+ readonly internalType: "address";
371
+ }];
372
+ }, {
373
+ readonly type: "error";
374
+ readonly name: "ZeroAddressException";
375
+ readonly inputs: readonly [];
376
+ }];
@@ -6,6 +6,7 @@ import { ChainContractsRegister } from "./base/index.js";
6
6
  import type { GearboxChain, NetworkType } from "./chain/chains.js";
7
7
  import type { VersionRange } from "./constants/index.js";
8
8
  import type { IAddressProviderContract } from "./core/index.js";
9
+ import { KYCRegister } from "./market/kyc/index.js";
9
10
  import { MarketRegister } from "./market/MarketRegister.js";
10
11
  import { PriceFeedRegister } from "./market/pricefeeds/index.js";
11
12
  import type { SDKOptions } from "./options.js";
@@ -299,6 +300,12 @@ export declare class GearboxSDK<const Plugins extends PluginsMap = {}> extends C
299
300
  * @throws If the SDK has not been attached or hydrated yet.
300
301
  **/
301
302
  get marketRegister(): MarketRegister;
303
+ /**
304
+ * KYC register for KYC-wrapped underlying tokens and factories.
305
+ *
306
+ * @throws If the SDK has not been attached or hydrated yet.
307
+ **/
308
+ get kyc(): KYCRegister;
302
309
  /**
303
310
  * Resolves the appropriate router contract for a given credit manager,
304
311
  * credit facade, or explicit version range.
@@ -4,9 +4,10 @@ import { SDKConstruct } from "../base/index.js";
4
4
  import type { GearboxSDK } from "../GearboxSDK.js";
5
5
  import type { CreditSuite } from "../market/index.js";
6
6
  import { type PriceUpdate, type UpdatePriceFeedsResult } from "../market/index.js";
7
+ import type { OpenAccountRequirements } from "../market/kyc/index.js";
7
8
  import { type Asset, type RouterCASlice } from "../router/index.js";
8
9
  import type { MultiCall, RawTx } from "../types/index.js";
9
- import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, CreditAccountOperationResult, CreditAccountTokensSlice, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
10
+ import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, CreditAccountOperationResult, CreditAccountTokensSlice, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
10
11
  /**
11
12
  * Options for configuring the credit account service.
12
13
  **/
@@ -32,11 +33,15 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
32
33
  /**
33
34
  * {@inheritDoc ICreditAccountsService.getCreditAccountData}
34
35
  **/
35
- getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
36
+ getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData<true> | undefined>;
36
37
  /**
37
38
  * {@inheritDoc ICreditAccountsService.getCreditAccounts}
38
39
  **/
39
40
  getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData>>;
41
+ /**
42
+ * {@inheritDoc ICreditAccountsService.getBorrowerCreditAccounts}
43
+ **/
44
+ getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
40
45
  /**
41
46
  * {@inheritDoc ICreditAccountsService.getRewards}
42
47
  **/
@@ -89,6 +94,17 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
89
94
  * {@inheritDoc ICreditAccountsService.claimDelayed}
90
95
  **/
91
96
  claimDelayed({ creditAccount, minQuota, averageQuota, claimableNow, }: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
97
+ /**
98
+ * Returns address to which approval should be given on collateral token
99
+ * It's credit manager for classical markets and special wallet for KYC markets
100
+ * @param options - {@link GetApprovalAddressProps}
101
+ * @returns
102
+ **/
103
+ getApprovalAddress(options: GetApprovalAddressProps): Promise<Address>;
104
+ /**
105
+ * {@inheritDoc ICreditAccountsService.getOpenAccountRequirements}
106
+ */
107
+ getOpenAccountRequirements(borrower: Address, props: OpenCAProps): Promise<OpenAccountRequirements | undefined>;
92
108
  /**
93
109
  * {@inheritDoc ICreditAccountsService.openCA}
94
110
  **/
@@ -102,6 +118,43 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
102
118
  **/
103
119
  getOptimalHFForPartialLiquidation(ca: CreditAccountData): bigint;
104
120
  /**
121
+ * Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
122
+ * Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
123
+ * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
124
+ * @param amount - Number of vault shares (adapter tokens) to redeem
125
+ * @param creditManager - Credit manager address
126
+ * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
127
+ */
128
+ getKYCUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
129
+ /**
130
+ * Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
131
+ * Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
132
+ * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
133
+ * @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
134
+ * @param creditManager - Credit manager address
135
+ * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
136
+ */
137
+ getKYCWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
138
+ /**
139
+ * Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
140
+ * Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
141
+ * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
142
+ * @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
143
+ * @param creditManager - Credit manager address
144
+ * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
145
+ */
146
+ getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
147
+ /**
148
+ * Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
149
+ * Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
150
+ * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
151
+ * @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
152
+ * @param creditManager - Credit manager address
153
+ * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
154
+ */
155
+ getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
156
+ /**
157
+ * Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
105
158
  * {@inheritDoc ICreditAccountsService.getOnDemandPriceUpdates}
106
159
  **/
107
160
  getOnDemandPriceUpdates(account: CreditAccountTokensSlice, ignoreReservePrices?: boolean): Promise<PriceUpdate[]>;
@@ -21,7 +21,7 @@ export declare class CreditAccountServiceV310 extends AbstractCreditAccountServi
21
21
  /**
22
22
  * {@inheritDoc ICreditAccountsService.repayCreditAccount}
23
23
  */
24
- repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
24
+ repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, calls: wrapCalls, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
25
25
  /**
26
26
  * {@inheritDoc ICreditAccountsService.repayAndLiquidateCreditAccount}
27
27
  */
@@ -4,6 +4,7 @@ import type { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompress
4
4
  import type { ConnectedBotData, Construct, CreditAccountData } from "../base/index.js";
5
5
  import type { GearboxSDK } from "../GearboxSDK.js";
6
6
  import type { CreditSuite, PriceUpdate } from "../market/index.js";
7
+ import type { OpenAccountRequirements } from "../market/kyc/index.js";
7
8
  import type { Asset, RouterCASlice, RouterCloseResult } from "../router/index.js";
8
9
  import type { MultiCall, RawTx } from "../types/index.js";
9
10
  /**
@@ -182,6 +183,10 @@ export interface CloseCreditAccountProps {
182
183
  closePath?: RouterCloseResult;
183
184
  }
184
185
  export interface RepayCreditAccountProps extends RepayAndLiquidateCreditAccountProps {
186
+ /**
187
+ * Swap calls for repay
188
+ */
189
+ calls?: Array<MultiCall>;
185
190
  /**
186
191
  * close or zeroDebt
187
192
  */
@@ -439,6 +444,10 @@ export interface ChangeDeptProps {
439
444
  * Assets to add as collateral
440
445
  */
441
446
  collateral?: [Asset];
447
+ /**
448
+ * Assets to wrap
449
+ */
450
+ wrapAsset?: [Asset];
442
451
  }
443
452
  export interface FullyLiquidateProps {
444
453
  /**
@@ -582,25 +591,46 @@ export type GetConnectedMigrationBotsResult = {
582
591
  })[];
583
592
  botAddress: Address;
584
593
  } | undefined;
594
+ /**
595
+ * Options to get approval address for collateral token
596
+ */
597
+ export type GetApprovalAddressProps = {
598
+ creditManager: Address;
599
+ borrower: Address;
600
+ } | {
601
+ creditManager: Address;
602
+ creditAccount: Address;
603
+ };
585
604
  export interface ICreditAccountsService extends Construct {
586
605
  sdk: GearboxSDK;
587
606
  /**
588
- * Returns single credit account data, or undefined if it's not found
589
- * Performs all necessary price feed updates under the hood
590
- * @param account
591
- * @param blockNumber
592
- * @returns
607
+ * Returns single credit account data with investor resolved, or undefined
608
+ * if the account is not found.
609
+ * Performs all necessary price feed updates under the hood.
610
+ * @param account - Credit account address
611
+ * @param blockNumber - Optional block number for the read
612
+ * @returns Credit account data with investor, or undefined
593
613
  */
594
- getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
614
+ getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData<true> | undefined>;
595
615
  /**
596
- * Methods to get all credit accounts with some optional filtering
597
- * Performs all necessary price feed updates under the hood
616
+ * Returns all credit accounts with optional filtering.
617
+ * Performs all necessary price feed updates under the hood.
598
618
  *
599
- * @param options
600
- * @param blockNumber
601
- * @returns returned credit accounts are sorted by health factor in ascending order
619
+ * @param options - Filter options
620
+ * @param blockNumber - Optional block number for the read
621
+ * @returns Credit accounts sorted by health factor ascending
602
622
  */
603
623
  getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData>>;
624
+ /**
625
+ * Returns all credit accounts for a borrower,
626
+ * both normal and KYC accounts with investor resolved on each.
627
+ *
628
+ * @param borrower - Actual owner of credit account
629
+ * @param options - Filter options (creditManager, health factor, etc.)
630
+ * @param blockNumber - Optional block number for the read
631
+ * @returns Credit accounts (with investor) sorted by health factor ascending
632
+ */
633
+ getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
604
634
  /**
605
635
  * Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards).
606
636
  * Associates rewards by adapter + stakedPhantomToken.
@@ -629,9 +659,9 @@ export interface ICreditAccountsService extends Construct {
629
659
  /**
630
660
  * Generates transaction to liquidate credit account
631
661
  * @param props - {@link FullyLiquidateProps}
632
- * @returns
662
+ * @returns Transaction data and optional loss policy data
633
663
  */
634
- fullyLiquidate(props: FullyLiquidateProps): Promise<CloseCreditAccountResult>;
664
+ fullyLiquidate(props: FullyLiquidateProps): Promise<FullyLiquidateResult>;
635
665
  /**
636
666
  * Closes credit account or closes credit account and keeps it open with zero debt.
637
667
  * - Ca is closed in the following order: price update -> close path to swap all tokens into underlying ->
@@ -694,6 +724,20 @@ export interface ICreditAccountsService extends Construct {
694
724
  * @returns
695
725
  */
696
726
  claimDelayed(props: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
727
+ /**
728
+ * Returns address to which approval should be given on collateral token
729
+ * It's credit manager for classical markets and special wallet for KYC markets
730
+ * @param props - {@link GetApprovalAddressProps}
731
+ * @returns
732
+ */
733
+ getApprovalAddress(props: GetApprovalAddressProps): Promise<Address>;
734
+ /**
735
+ * Returns open account requirements for a borrower
736
+ * @param borrower - Borrower address
737
+ * @param props - {@link OpenCAProps}
738
+ * @returns Open account requirements or undefined if the user can open a credit account without any further actions
739
+ */
740
+ getOpenAccountRequirements(borrower: Address, props: OpenCAProps): Promise<OpenAccountRequirements | undefined>;
697
741
  /**
698
742
  * Executes swap specified by given calls, update quotas of affected tokens
699
743
  * - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
@@ -749,6 +793,42 @@ export interface ICreditAccountsService extends Construct {
749
793
  botMulticall(creditAccount: RouterCASlice, calls: Array<MultiCall>, options?: {
750
794
  ignoreReservePrices?: boolean;
751
795
  }): Promise<RawTx>;
796
+ /**
797
+ * Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
798
+ * Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
799
+ * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
800
+ * @param amount - Number of vault shares (adapter tokens) to redeem
801
+ * @param creditManager - Credit manager address
802
+ * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
803
+ */
804
+ getKYCUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
805
+ /**
806
+ * Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
807
+ * Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
808
+ * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
809
+ * @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
810
+ * @param creditManager - Credit manager address
811
+ * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
812
+ */
813
+ getKYCWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
814
+ /**
815
+ * Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
816
+ * Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
817
+ * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
818
+ * @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
819
+ * @param creditManager - Credit manager address
820
+ * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
821
+ */
822
+ getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
823
+ /**
824
+ * Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
825
+ * Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
826
+ * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
827
+ * @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
828
+ * @param creditManager - Credit manager address
829
+ * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
830
+ */
831
+ getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
752
832
  /**
753
833
  * Withdraws a single collateral from credit account to wallet to and updates quotas;
754
834
  * technically can withdraw several tokens at once