@gearbox-protocol/sdk 13.6.0-kyc.7 → 13.6.0

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 (152) hide show
  1. package/dist/cjs/dev/AccountOpener.js +5 -45
  2. package/dist/cjs/plugins/adapters/abi/actionAbi.js +1 -1
  3. package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +1 -1
  4. package/dist/cjs/plugins/adapters/createAdapter.js +1 -1
  5. package/dist/cjs/plugins/adapters/types.js +1 -1
  6. package/dist/cjs/plugins/apy/ApyPlugin.js +266 -0
  7. package/dist/cjs/plugins/apy/apy-cache.js +120 -0
  8. package/dist/cjs/plugins/apy/apy-parser.js +169 -0
  9. package/dist/cjs/{sdk/market/kyc/securitize → plugins/apy}/constants.js +6 -3
  10. package/dist/cjs/{sdk/market/kyc/securitize → plugins/apy}/index.js +14 -6
  11. package/dist/cjs/{sdk/market/kyc/securitize/types.js → plugins/apy/pool-apy-types.js} +2 -2
  12. package/dist/cjs/plugins/apy/pool-apy-utils.js +141 -0
  13. package/dist/cjs/rewards/rewards/extra-apy.js +10 -8
  14. package/dist/cjs/sdk/GearboxSDK.js +5 -52
  15. package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +16 -324
  16. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1 -7
  17. package/dist/cjs/sdk/base/TokensMeta.js +43 -32
  18. package/dist/cjs/sdk/base/token-types.js +0 -9
  19. package/dist/cjs/sdk/chain/chains.js +32 -17
  20. package/dist/cjs/sdk/constants/address-provider.js +0 -3
  21. package/dist/cjs/sdk/market/MarketRegister.js +116 -70
  22. package/dist/cjs/sdk/market/MarketSuite.js +0 -3
  23. package/dist/cjs/sdk/market/index.js +0 -2
  24. package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
  25. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -11
  26. package/dist/cjs/sdk/market/pool/index.js +0 -2
  27. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
  28. package/dist/cjs/sdk/options.js +1 -7
  29. package/dist/cjs/sdk/pools/PoolService.js +12 -104
  30. package/dist/cjs/sdk/utils/viem/index.js +0 -2
  31. package/dist/cjs/sdk/utils/viem/simulateWithPriceUpdates.js +39 -2
  32. package/dist/esm/dev/AccountOpener.js +6 -47
  33. package/dist/esm/plugins/adapters/abi/actionAbi.js +1 -1
  34. package/dist/esm/plugins/adapters/abi/conctructorAbi.js +1 -1
  35. package/dist/esm/plugins/adapters/createAdapter.js +1 -1
  36. package/dist/esm/plugins/adapters/types.js +1 -1
  37. package/dist/esm/plugins/apy/ApyPlugin.js +255 -0
  38. package/dist/esm/plugins/apy/apy-cache.js +86 -0
  39. package/dist/esm/plugins/apy/apy-parser.js +143 -0
  40. package/dist/esm/plugins/apy/constants.js +6 -0
  41. package/dist/esm/plugins/apy/index.js +7 -0
  42. package/dist/esm/plugins/apy/pool-apy-utils.js +113 -0
  43. package/dist/esm/rewards/rewards/extra-apy.js +10 -8
  44. package/dist/esm/sdk/GearboxSDK.js +6 -56
  45. package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +17 -328
  46. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1 -7
  47. package/dist/esm/sdk/base/TokensMeta.js +45 -32
  48. package/dist/esm/sdk/base/token-types.js +0 -6
  49. package/dist/esm/sdk/chain/chains.js +32 -17
  50. package/dist/esm/sdk/constants/address-provider.js +0 -2
  51. package/dist/esm/sdk/market/MarketRegister.js +118 -74
  52. package/dist/esm/sdk/market/MarketSuite.js +0 -3
  53. package/dist/esm/sdk/market/index.js +0 -1
  54. package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
  55. package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -11
  56. package/dist/esm/sdk/market/pool/index.js +0 -1
  57. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
  58. package/dist/esm/sdk/options.js +1 -7
  59. package/dist/esm/sdk/pools/PoolService.js +13 -109
  60. package/dist/esm/sdk/utils/viem/index.js +0 -1
  61. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +41 -2
  62. package/dist/types/plugins/adapters/types.d.ts +2 -2
  63. package/dist/types/plugins/apy/ApyPlugin.d.ts +46 -0
  64. package/dist/types/plugins/apy/apy-cache.d.ts +28 -0
  65. package/dist/types/plugins/apy/apy-parser.d.ts +5 -0
  66. package/dist/types/plugins/apy/constants.d.ts +2 -0
  67. package/dist/types/plugins/apy/index.d.ts +7 -0
  68. package/dist/types/plugins/apy/pool-apy-types.d.ts +41 -0
  69. package/dist/types/plugins/apy/pool-apy-utils.d.ts +73 -0
  70. package/dist/types/plugins/apy/types.d.ts +37 -0
  71. package/dist/types/rewards/rewards/api.d.ts +10 -1
  72. package/dist/types/rewards/rewards/common.d.ts +0 -10
  73. package/dist/types/rewards/rewards/extra-apy.d.ts +4 -6
  74. package/dist/types/sdk/GearboxSDK.d.ts +0 -7
  75. package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +2 -52
  76. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
  77. package/dist/types/sdk/accounts/types.d.ts +13 -93
  78. package/dist/types/sdk/base/TokensMeta.d.ts +3 -14
  79. package/dist/types/sdk/base/token-types.d.ts +4 -44
  80. package/dist/types/sdk/base/types.d.ts +11 -116
  81. package/dist/types/sdk/chain/chains.d.ts +5 -5
  82. package/dist/types/sdk/constants/address-provider.d.ts +0 -1
  83. package/dist/types/sdk/market/MarketRegister.d.ts +9 -6
  84. package/dist/types/sdk/market/MarketSuite.d.ts +0 -2
  85. package/dist/types/sdk/market/index.d.ts +0 -1
  86. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +2 -3
  87. package/dist/types/sdk/market/oracle/types.d.ts +10 -3
  88. package/dist/types/sdk/market/pool/PoolSuite.d.ts +0 -2
  89. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
  90. package/dist/types/sdk/market/pool/index.d.ts +0 -1
  91. package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +1 -1
  92. package/dist/types/sdk/market/types.d.ts +1 -1
  93. package/dist/types/sdk/options.d.ts +0 -1
  94. package/dist/types/sdk/pools/PoolService.d.ts +8 -8
  95. package/dist/types/sdk/pools/types.d.ts +1 -1
  96. package/dist/types/sdk/types/state-human.d.ts +0 -2
  97. package/dist/types/sdk/types/state.d.ts +0 -5
  98. package/dist/types/sdk/utils/viem/index.d.ts +0 -1
  99. package/package.json +2 -3
  100. package/dist/cjs/abi/kyc/iDSRegistryService.js +0 -70
  101. package/dist/cjs/abi/kyc/iDSToken.js +0 -71
  102. package/dist/cjs/abi/kyc/iKYCCompressor.js +0 -196
  103. package/dist/cjs/abi/kyc/iKYCFactory.js +0 -122
  104. package/dist/cjs/abi/kyc/iKYCUnderlying.js +0 -401
  105. package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +0 -326
  106. package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +0 -319
  107. package/dist/cjs/plugins/pools-history/Pools7DAgoPlugin.js +0 -108
  108. package/dist/cjs/plugins/pools-history/index.js +0 -24
  109. package/dist/cjs/sdk/market/kyc/KYCRegistry.js +0 -269
  110. package/dist/cjs/sdk/market/kyc/index.js +0 -26
  111. package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -244
  112. package/dist/cjs/sdk/market/kyc/types.js +0 -34
  113. package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +0 -38
  114. package/dist/esm/abi/kyc/iDSRegistryService.js +0 -46
  115. package/dist/esm/abi/kyc/iDSToken.js +0 -47
  116. package/dist/esm/abi/kyc/iKYCCompressor.js +0 -172
  117. package/dist/esm/abi/kyc/iKYCFactory.js +0 -98
  118. package/dist/esm/abi/kyc/iKYCUnderlying.js +0 -377
  119. package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +0 -302
  120. package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +0 -295
  121. package/dist/esm/plugins/pools-history/Pools7DAgoPlugin.js +0 -90
  122. package/dist/esm/plugins/pools-history/index.js +0 -2
  123. package/dist/esm/sdk/market/kyc/KYCRegistry.js +0 -253
  124. package/dist/esm/sdk/market/kyc/index.js +0 -3
  125. package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -220
  126. package/dist/esm/sdk/market/kyc/securitize/constants.js +0 -4
  127. package/dist/esm/sdk/market/kyc/securitize/index.js +0 -3
  128. package/dist/esm/sdk/market/kyc/types.js +0 -9
  129. package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +0 -14
  130. package/dist/types/abi/kyc/iDSRegistryService.d.ts +0 -71
  131. package/dist/types/abi/kyc/iDSToken.d.ts +0 -67
  132. package/dist/types/abi/kyc/iKYCCompressor.d.ts +0 -228
  133. package/dist/types/abi/kyc/iKYCFactory.d.ts +0 -139
  134. package/dist/types/abi/kyc/iKYCUnderlying.d.ts +0 -548
  135. package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +0 -404
  136. package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +0 -376
  137. package/dist/types/plugins/pools-history/Pools7DAgoPlugin.d.ts +0 -20
  138. package/dist/types/plugins/pools-history/index.d.ts +0 -2
  139. package/dist/types/plugins/pools-history/types.d.ts +0 -9
  140. package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +0 -52
  141. package/dist/types/sdk/market/kyc/index.d.ts +0 -3
  142. package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +0 -428
  143. package/dist/types/sdk/market/kyc/securitize/constants.d.ts +0 -1
  144. package/dist/types/sdk/market/kyc/securitize/index.d.ts +0 -3
  145. package/dist/types/sdk/market/kyc/securitize/types.d.ts +0 -127
  146. package/dist/types/sdk/market/kyc/types.d.ts +0 -170
  147. package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +0 -28
  148. /package/dist/cjs/plugins/{pools-history → apy}/package.json +0 -0
  149. /package/dist/cjs/plugins/{pools-history → apy}/types.js +0 -0
  150. /package/dist/esm/plugins/{pools-history → apy}/package.json +0 -0
  151. /package/dist/esm/plugins/{pools-history/types.js → apy/pool-apy-types.js} +0 -0
  152. /package/dist/esm/{sdk/market/kyc/securitize → plugins/apy}/types.js +0 -0
@@ -4,10 +4,9 @@ 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";
8
7
  import { type Asset, type RouterCASlice } from "../router/index.js";
9
8
  import type { MultiCall, RawTx } from "../types/index.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";
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";
11
10
  /**
12
11
  * Options for configuring the credit account service.
13
12
  **/
@@ -33,15 +32,11 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
33
32
  /**
34
33
  * {@inheritDoc ICreditAccountsService.getCreditAccountData}
35
34
  **/
36
- getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData<true> | undefined>;
35
+ getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
37
36
  /**
38
37
  * {@inheritDoc ICreditAccountsService.getCreditAccounts}
39
38
  **/
40
39
  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>>>;
45
40
  /**
46
41
  * {@inheritDoc ICreditAccountsService.getRewards}
47
42
  **/
@@ -94,14 +89,6 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
94
89
  * {@inheritDoc ICreditAccountsService.claimDelayed}
95
90
  **/
96
91
  claimDelayed({ creditAccount, minQuota, averageQuota, claimableNow, }: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
97
- /**
98
- * {@inheritDoc ICreditAccountsService.getApprovalAddress}
99
- **/
100
- getApprovalAddress(options: GetApprovalAddressProps): Promise<Address>;
101
- /**
102
- * {@inheritDoc ICreditAccountsService.getOpenAccountRequirements}
103
- */
104
- getOpenAccountRequirements(borrower: Address, props: Pick<OpenCAProps, "creditManager">): Promise<OpenAccountRequirements | undefined>;
105
92
  /**
106
93
  * {@inheritDoc ICreditAccountsService.openCA}
107
94
  **/
@@ -115,43 +102,6 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
115
102
  **/
116
103
  getOptimalHFForPartialLiquidation(ca: CreditAccountData): bigint;
117
104
  /**
118
- * Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
119
- * Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
120
- * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
121
- * @param amount - Number of vault shares (adapter tokens) to redeem
122
- * @param creditManager - Credit manager address
123
- * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
124
- */
125
- getKYCUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
126
- /**
127
- * Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
128
- * Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
129
- * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
130
- * @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
131
- * @param creditManager - Credit manager address
132
- * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
133
- */
134
- getKYCWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
135
- /**
136
- * Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
137
- * Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
138
- * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
139
- * @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
140
- * @param creditManager - Credit manager address
141
- * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
142
- */
143
- getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
144
- /**
145
- * Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
146
- * Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
147
- * Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
148
- * @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
149
- * @param creditManager - Credit manager address
150
- * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
151
- */
152
- getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
153
- /**
154
- * Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
155
105
  * {@inheritDoc ICreditAccountsService.getOnDemandPriceUpdates}
156
106
  **/
157
107
  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, calls: wrapCalls, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
24
+ repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
25
25
  /**
26
26
  * {@inheritDoc ICreditAccountsService.repayAndLiquidateCreditAccount}
27
27
  */
@@ -4,7 +4,6 @@ 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";
8
7
  import type { Asset, RouterCASlice, RouterCloseResult } from "../router/index.js";
9
8
  import type { MultiCall, RawTx } from "../types/index.js";
10
9
  /**
@@ -183,10 +182,6 @@ export interface CloseCreditAccountProps {
183
182
  closePath?: RouterCloseResult;
184
183
  }
185
184
  export interface RepayCreditAccountProps extends RepayAndLiquidateCreditAccountProps {
186
- /**
187
- * Swap calls for repay
188
- */
189
- calls?: Array<MultiCall>;
190
185
  /**
191
186
  * close or zeroDebt
192
187
  */
@@ -444,10 +439,6 @@ export interface ChangeDeptProps {
444
439
  * Assets to add as collateral
445
440
  */
446
441
  collateral?: [Asset];
447
- /**
448
- * Assets to wrap
449
- */
450
- wrapAsset?: [Asset];
451
442
  }
452
443
  export interface FullyLiquidateProps {
453
444
  /**
@@ -591,46 +582,25 @@ export type GetConnectedMigrationBotsResult = {
591
582
  })[];
592
583
  botAddress: Address;
593
584
  } | 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
- };
604
585
  export interface ICreditAccountsService extends Construct {
605
586
  sdk: GearboxSDK;
606
587
  /**
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
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
613
593
  */
614
- getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData<true> | undefined>;
594
+ getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
615
595
  /**
616
- * Returns all credit accounts with optional filtering.
617
- * Performs all necessary price feed updates under the hood.
596
+ * Methods to get all credit accounts with some optional filtering
597
+ * Performs all necessary price feed updates under the hood
618
598
  *
619
- * @param options - Filter options
620
- * @param blockNumber - Optional block number for the read
621
- * @returns Credit accounts sorted by health factor ascending
599
+ * @param options
600
+ * @param blockNumber
601
+ * @returns returned credit accounts are sorted by health factor in ascending order
622
602
  */
623
603
  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>>>;
634
604
  /**
635
605
  * Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards).
636
606
  * Associates rewards by adapter + stakedPhantomToken.
@@ -659,9 +629,9 @@ export interface ICreditAccountsService extends Construct {
659
629
  /**
660
630
  * Generates transaction to liquidate credit account
661
631
  * @param props - {@link FullyLiquidateProps}
662
- * @returns Transaction data and optional loss policy data
632
+ * @returns
663
633
  */
664
- fullyLiquidate(props: FullyLiquidateProps): Promise<FullyLiquidateResult>;
634
+ fullyLiquidate(props: FullyLiquidateProps): Promise<CloseCreditAccountResult>;
665
635
  /**
666
636
  * Closes credit account or closes credit account and keeps it open with zero debt.
667
637
  * - Ca is closed in the following order: price update -> close path to swap all tokens into underlying ->
@@ -724,20 +694,6 @@ export interface ICreditAccountsService extends Construct {
724
694
  * @returns
725
695
  */
726
696
  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: Pick<OpenCAProps, "creditManager">): Promise<OpenAccountRequirements | undefined>;
741
697
  /**
742
698
  * Executes swap specified by given calls, update quotas of affected tokens
743
699
  * - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
@@ -793,42 +749,6 @@ export interface ICreditAccountsService extends Construct {
793
749
  botMulticall(creditAccount: RouterCASlice, calls: Array<MultiCall>, options?: {
794
750
  ignoreReservePrices?: boolean;
795
751
  }): 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>;
832
752
  /**
833
753
  * Withdraws a single collateral from credit account to wallet to and updates quotas;
834
754
  * technically can withdraw several tokens at once
@@ -1,8 +1,8 @@
1
- import type { Address, Chain, PublicClient, Transport } from "viem";
1
+ import { type Address, type Chain, type PublicClient, type Transport } from "viem";
2
2
  import type { Asset } from "../router/index.js";
3
3
  import type { ILogger } from "../types/logger.js";
4
4
  import { AddressMap } from "../utils/index.js";
5
- import type { KYCTokenMeta, PhantomTokenMeta, TokenMetaData } from "./token-types.js";
5
+ import type { PhantomTokenMeta, TokenMetaData } from "./token-types.js";
6
6
  /**
7
7
  * Options for {@link TokensMeta.formatBN}.
8
8
  **/
@@ -50,22 +50,11 @@ export declare class TokensMeta extends AddressMap<TokenMetaData> {
50
50
  * @returns
51
51
  */
52
52
  isPhantomToken(t: TokenMetaData): t is PhantomTokenMeta;
53
- /**
54
- * Returns true if the token is a KYC underlying token, throws if the token data is not loaded
55
- * @param t
56
- * @returns
57
- */
58
- isKYCUnderlying(t: TokenMetaData): t is KYCTokenMeta;
59
53
  /**
60
54
  * Returns a map of all phantom tokens
61
55
  * Throws if token data is not loaded
62
56
  */
63
57
  get phantomTokens(): AddressMap<PhantomTokenMeta>;
64
- /**
65
- * Returns a map of all KYC underlying tokens
66
- * Throws if token data is not loaded
67
- */
68
- get kycUnderlyings(): AddressMap<KYCTokenMeta>;
69
58
  /**
70
59
  * Formats a raw token amount into a human-readable decimal string,
71
60
  * dividing by `10^decimals` for the token.
@@ -96,7 +85,7 @@ export declare class TokensMeta extends AddressMap<TokenMetaData> {
96
85
  mustFindBySymbol(symbol: string): TokenMetaData;
97
86
  /**
98
87
  * Loads token information about phantom tokens
99
- * In future other custom tokens types that do not have compressors might be handled here
88
+ * Other special tokens may be loaded here in the future
100
89
  *
101
90
  * @param tokens - tokens to load data for, defaults to all tokens
102
91
  */
@@ -1,53 +1,13 @@
1
- import type { Address } from "viem";
2
1
  import type { MarketData, Unarray } from "./types.js";
3
2
  type TokenData = Unarray<MarketData["tokens"]>;
4
3
  export declare const PHANTOM_TOKEN_CONTRACT_TYPES: readonly ["PHANTOM_TOKEN::CONVEX", "PHANTOM_TOKEN::INFINIFI_UNWIND", "PHANTOM_TOKEN::INFRARED", "PHANTOM_TOKEN::MELLOW_WITHDRAWAL", "PHANTOM_TOKEN::MIDAS_REDEMPTION", "PHANTOM_TOKEN::STAKING_REWARDS", "PHANTOM_TOKEN::UPSHIFT_WITHDRAW"];
5
- export declare const KYC_UNDERLYING_DEFAULT = "KYC_UNDERLYING::DEFAULT";
6
- export declare const KYC_UNDERLYING_ON_DEMAND = "KYC_UNDERLYING::ON_DEMAND";
7
- export type KYCUnderlyingContractType = typeof KYC_UNDERLYING_DEFAULT | typeof KYC_UNDERLYING_ON_DEMAND;
8
- export declare const KYC_ON_DEMAND_LP_MONOPOLIZED = "ON_DEMAND_LP::MONOPOLIZED";
9
- export type KYCOnDemandLpContractType = typeof KYC_ON_DEMAND_LP_MONOPOLIZED;
10
4
  export type PhantomTokenContractType = (typeof PHANTOM_TOKEN_CONTRACT_TYPES)[number];
11
- export interface SimpleTokenMeta extends TokenData {
5
+ export type SimpleTokenMeta = TokenData & {
6
+ isDSToken?: boolean;
12
7
  contractType?: string;
13
- }
8
+ };
14
9
  export type PhantomTokenMeta = SimpleTokenMeta & {
15
10
  contractType: PhantomTokenContractType;
16
11
  };
17
- export interface KYCDefaultTokenMeta extends SimpleTokenMeta {
18
- contractType: typeof KYC_UNDERLYING_DEFAULT;
19
- kycFactory: Address;
20
- asset: Address;
21
- }
22
- export interface LPMonopolizedPoolMeta {
23
- pool: Address;
24
- wrappedUnderlying: Address;
25
- unwrappedUnderlying: Address;
26
- depositAllowance: bigint;
27
- claimableAmount: bigint;
28
- }
29
- export interface KYCOnDemandLPMonopolizedMeta {
30
- addr: Address;
31
- version: bigint;
32
- contractType: typeof KYC_ON_DEMAND_LP_MONOPOLIZED;
33
- marketConfigurator: Address;
34
- /**
35
- * Only this user can deposit into the pool and withdraw
36
- * Other users should not see it at all
37
- */
38
- depositor: Address;
39
- pools: LPMonopolizedPoolMeta[];
40
- }
41
- export type KYCOnDemandLPMeta = KYCOnDemandLPMonopolizedMeta;
42
- export interface KYCOnDemandTokenMeta extends SimpleTokenMeta {
43
- contractType: typeof KYC_UNDERLYING_ON_DEMAND;
44
- kycFactory: Address;
45
- asset: Address;
46
- pool: Address;
47
- marketConfigurator: Address;
48
- allowedDepositors: Address[];
49
- liquidityProvider: KYCOnDemandLPMeta;
50
- }
51
- export type KYCTokenMeta = KYCDefaultTokenMeta | KYCOnDemandTokenMeta;
52
- export type TokenMetaData = SimpleTokenMeta | PhantomTokenMeta | KYCTokenMeta;
12
+ export type TokenMetaData = SimpleTokenMeta | PhantomTokenMeta;
53
13
  export {};
@@ -1,9 +1,11 @@
1
1
  import type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype";
2
2
  import type { Address, Hex } from "viem";
3
+ import type { creditAccountCompressorAbi } from "../../abi/compressors/creditAccountCompressor.js";
3
4
  import type { gaugeCompressorAbi } from "../../abi/compressors/gaugeCompressor.js";
4
5
  import type { marketCompressorAbi } from "../../abi/compressors/marketCompressor.js";
5
6
  import type { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
6
7
  import type { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
8
+ import type { NetworkType } from "../chain/index.js";
7
9
  /**
8
10
  * Recursively unwraps array types to their element type.
9
11
  **/
@@ -61,125 +63,10 @@ export interface BaseState {
61
63
  * Filter criteria for querying markets.
62
64
  **/
63
65
  export type MarketFilter = AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof marketCompressorAbi, "getMarkets">["inputs"]>[0];
64
- /**
65
- * Info on credit account's assets
66
- **/
67
- export interface TokenInfo {
68
- /**
69
- * Token address.
70
- **/
71
- token: Address;
72
- /**
73
- * Token mask in the credit manager.
74
- **/
75
- mask: bigint;
76
- /**
77
- * Account's balance of token.
78
- **/
79
- balance: bigint;
80
- /**
81
- * Account's quota of token.
82
- **/
83
- quota: bigint;
84
- /**
85
- * Whether balance call was successful.
86
- **/
87
- success: boolean;
88
- }
89
- /**
90
- * On-chain state of a credit account.
91
- *
92
- * @remarks
93
- * Fields from `totalDebtUSD` through `healthFactor` are not filled when
94
- * `success` is `false`.
95
- *
96
- **/
97
- export interface CreditAccountDataPayload {
98
- /**
99
- * Credit account address.
100
- **/
101
- creditAccount: Address;
102
- /**
103
- * Credit manager account is opened in.
104
- **/
105
- creditManager: Address;
106
- /**
107
- * Facade connected to account's credit manager.
108
- **/
109
- creditFacade: Address;
110
- /**
111
- * Credit manager's underlying token.
112
- **/
113
- underlying: Address;
114
- /**
115
- * Credit account's owner (contract address for KYC accounts, EOA for
116
- * normal accounts).
117
- **/
118
- owner: Address;
119
- /**
120
- * Expiration timestamp, in case facade is expirable.
121
- **/
122
- expirationDate: number;
123
- /**
124
- * Bitmask of tokens enabled on credit account as collateral.
125
- **/
126
- enabledTokensMask: bigint;
127
- /**
128
- * Credit account's debt principal in underlying.
129
- **/
130
- debt: bigint;
131
- /**
132
- * Base and quota interest accrued on the credit account.
133
- **/
134
- accruedInterest: bigint;
135
- /**
136
- * Fees accrued on the credit account.
137
- **/
138
- accruedFees: bigint;
139
- /**
140
- * Account's total debt in USD.
141
- **/
142
- totalDebtUSD: bigint;
143
- /**
144
- * Account's total value in USD.
145
- **/
146
- totalValueUSD: bigint;
147
- /**
148
- * Account's threshold-weighted value in USD.
149
- **/
150
- twvUSD: bigint;
151
- /**
152
- * Account's total value in underlying.
153
- **/
154
- totalValue: bigint;
155
- /**
156
- * Account's health factor, i.e. ratio of `twvUSD` to `totalDebtUSD`,
157
- * with 18 decimals precision.
158
- **/
159
- healthFactor: bigint;
160
- /**
161
- * Whether collateral calculation was successful.
162
- **/
163
- success: boolean;
164
- /**
165
- * Info on credit account's enabled tokens and tokens with non-zero balance.
166
- **/
167
- tokens: readonly TokenInfo[];
168
- }
169
66
  /**
170
67
  * Full on-chain snapshot of a single credit account.
171
- *
172
- * @typeParam WithInvestor - When `true`, the result includes an `investor`
173
- * field (`Address | undefined`). Defaults to `false` (no investor field).
174
68
  **/
175
- export type CreditAccountData<WithInvestor extends boolean = false> = WithInvestor extends true ? CreditAccountDataPayload & {
176
- /**
177
- * Investor EOA address (the real person behind the account).
178
- * - KYC accounts: resolved from KYC factory, always defined.
179
- * - Normal accounts: `undefined` (owner IS the investor).
180
- **/
181
- investor: Address | undefined;
182
- } : CreditAccountDataPayload;
69
+ export type CreditAccountData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof creditAccountCompressorAbi, "getCreditAccountData">["outputs"]>>;
183
70
  /**
184
71
  * Reward distribution details for a single reward token.
185
72
  **/
@@ -358,6 +245,14 @@ export interface IBaseContract {
358
245
  * labeling methods for user-facing output.
359
246
  */
360
247
  readonly name: string;
248
+ /**
249
+ * Chain ID of the contract.
250
+ **/
251
+ readonly chainId: number;
252
+ /**
253
+ * Network type of the contract.
254
+ **/
255
+ readonly networkType: NetworkType;
361
256
  /**
362
257
  * @internal
363
258
  * `true` when the local state has diverged from on-chain and needs a sync.
@@ -4,7 +4,7 @@ import { z } from "zod/v4";
4
4
  * Known curator names that manage Gearbox markets.
5
5
  *
6
6
  **/
7
- export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs" | "Securitize";
7
+ export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs";
8
8
  /**
9
9
  * Extended viem {@link Chain} with Gearbox-specific metadata.
10
10
  *
@@ -20,10 +20,6 @@ export interface GearboxChain extends Chain {
20
20
  * Market configurator addresses operated by known curators on this chain.
21
21
  **/
22
22
  defaultMarketConfigurators: Record<Address, Curator>;
23
- /**
24
- * Known KYC factory addresses on this chain
25
- */
26
- kycFactories?: Address[];
27
23
  /**
28
24
  * Market configurators used in test/staging environments.
29
25
  **/
@@ -46,6 +42,10 @@ export interface GearboxChain extends Chain {
46
42
  * Block number when the Gearbox address provider was deployed.
47
43
  **/
48
44
  firstBlock?: bigint;
45
+ /**
46
+ * Default read-only calls gas limit for this chain.
47
+ */
48
+ gasLimit: bigint;
49
49
  }
50
50
  /**
51
51
  * Tuple of all network labels the SDK can work with.
@@ -31,7 +31,6 @@ export declare const AP_WETH_GATEWAY = "WETH_GATEWAY";
31
31
  export declare const AP_WETH_TOKEN = "WETH_TOKEN";
32
32
  export declare const AP_ZAPPER_REGISTER = "ZAPPER_REGISTER";
33
33
  export declare const AP_ZERO_PRICE_FEED = "ZERO_PRICE_FEED";
34
- export declare const AP_KYC_COMPRESSOR = "GLOBAL::KYC_COMPRESSOR";
35
34
  /**
36
35
  * Default address provider address for v3.1.0
37
36
  * Is determenistic and does not depend on the network type
@@ -3,7 +3,6 @@ import type { MarketData, MarketFilter } from "../base/index.js";
3
3
  import type { GearboxSDK } from "../GearboxSDK.js";
4
4
  import type { MarketStateHuman } from "../types/index.js";
5
5
  import { AddressMap } from "../utils/index.js";
6
- import { type DelegatedMulticall } from "../utils/viem/index.js";
7
6
  import type { CreditSuite } from "./credit/index.js";
8
7
  import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
9
8
  import { MarketSuite } from "./MarketSuite.js";
@@ -31,13 +30,13 @@ export declare class MarketRegister extends ZapperRegister {
31
30
  **/
32
31
  hydrate(state: MarketData[]): void;
33
32
  /**
34
- * @internal
35
- * Returns delegated multicalls for loading all markets from the on-chain
36
- * market compressor. Used by the SDK to compose batched RPC calls.
33
+ * Fetches all markets from the on-chain for the given market configurators.
37
34
  *
38
- * @param configurators - Addresses of market configurator contracts to query.
35
+ * @param marketConfigurators - Addresses of market configurator contracts to query.
36
+ * @param ignoreUpdateablePrices - When `true`, skips generating off-chain
37
+ * price updates before loading
39
38
  **/
40
- getLoadMulticalls(configurators: Address[]): DelegatedMulticall[];
39
+ loadMarkets(marketConfigurators: Address[], ignoreUpdateablePrices?: boolean): Promise<void>;
41
40
  /**
42
41
  * The active filter used to scope market compressor queries.
43
42
  * @throws If the register has not been hydrated or attached yet.
@@ -53,6 +52,10 @@ export declare class MarketRegister extends ZapperRegister {
53
52
  * @param ignoreUpdateablePrices - When `true`, skips off-chain price updates.
54
53
  **/
55
54
  syncState(ignoreUpdateablePrices?: boolean): Promise<void>;
55
+ /**
56
+ * Loads new prices and price feeds for given oracles from PriceFeedCompressor, defaults to all oracles
57
+ */
58
+ updatePrices(oracles?: Address[]): Promise<void>;
56
59
  get watchAddresses(): Set<Address>;
57
60
  /**
58
61
  * Serializable snapshot of all loaded markets, suitable for hydration.
@@ -4,7 +4,6 @@ import { SDKConstruct } from "../base/index.js";
4
4
  import type { GearboxSDK } from "../GearboxSDK.js";
5
5
  import type { MarketStateHuman } from "../types/index.js";
6
6
  import { CreditSuite } from "./credit/index.js";
7
- import type { IKYCFactory } from "./kyc/types.js";
8
7
  import { type ILossPolicyContract } from "./loss-policy/index.js";
9
8
  import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
10
9
  import type { IPriceOracleContract } from "./oracle/index.js";
@@ -23,7 +22,6 @@ export declare class MarketSuite extends SDKConstruct {
23
22
  readonly state: MarketData;
24
23
  constructor(sdk: GearboxSDK, marketData: MarketData);
25
24
  get underlying(): Address;
26
- get kycFactory(): IKYCFactory | undefined;
27
25
  get dirty(): boolean;
28
26
  get watchAddresses(): Set<Address>;
29
27
  stateHuman(raw?: boolean): MarketStateHuman;
@@ -1,6 +1,5 @@
1
1
  export * from "./adapters/index.js";
2
2
  export * from "./credit/index.js";
3
- export * from "./kyc/index.js";
4
3
  export * from "./MarketRegister.js";
5
4
  export * from "./MarketSuite.js";
6
5
  export * from "./oracle/index.js";
@@ -5,11 +5,10 @@ import { BaseContract } from "../../base/index.js";
5
5
  import type { GearboxSDK } from "../../GearboxSDK.js";
6
6
  import type { PriceOracleStateHuman } from "../../types/index.js";
7
7
  import { AddressMap } from "../../utils/index.js";
8
- import type { DelegatedMulticall } from "../../utils/viem/index.js";
9
8
  import type { IPriceFeedContract, UpdatePriceFeedsResult } from "../pricefeeds/index.js";
10
9
  import { PriceFeedRef } from "../pricefeeds/index.js";
11
10
  import PriceFeedAnswerMap from "./PriceFeedAnswerMap.js";
12
- import type { IPriceOracleContract, OnDemandPriceUpdates, PriceFeedsForTokensOptions } from "./types.js";
11
+ import type { DelegatedOracleMulticall, IPriceOracleContract, OnDemandPriceUpdates, PriceFeedsForTokensOptions } from "./types.js";
13
12
  /**
14
13
  * Base implementation of the Gearbox price oracle.
15
14
  *
@@ -75,7 +74,7 @@ export declare abstract class PriceOracleBaseContract<abi extends Abi | readonly
75
74
  /**
76
75
  * {@inheritDoc IPriceOracleContract.syncStateMulticall}
77
76
  **/
78
- syncStateMulticall(): DelegatedMulticall;
77
+ syncStateMulticall(): DelegatedOracleMulticall;
79
78
  /**
80
79
  * {@inheritDoc IPriceOracleContract.watchAddresses}
81
80
  **/