@gearbox-protocol/sdk 14.12.0-next.65 → 14.12.0-next.67

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 (249) hide show
  1. package/dist/cjs/common-utils/index.js +2 -2
  2. package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.js +3 -3
  3. package/dist/cjs/common-utils/utils/assets-math.js +7 -7
  4. package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +2 -2
  5. package/dist/cjs/common-utils/utils/creditAccount/debt.js +2 -2
  6. package/dist/cjs/common-utils/utils/creditAccount/quota-utils.js +5 -5
  7. package/dist/cjs/common-utils/utils/index.js +2 -2
  8. package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +2 -2
  9. package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +5 -5
  10. package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.js +2 -2
  11. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +2 -2
  12. package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.js +4 -4
  13. package/dist/cjs/dev/index.js +2 -1
  14. package/dist/cjs/dev/kycUtils.js +1 -1
  15. package/dist/cjs/dev/midasUtils.js +104 -0
  16. package/dist/cjs/model/history.js +28 -0
  17. package/dist/cjs/model/history.schema.js +84 -0
  18. package/dist/cjs/model/index.js +64 -0
  19. package/dist/cjs/model/liquidations.js +23 -0
  20. package/dist/cjs/model/liquidations.schema.js +91 -0
  21. package/dist/cjs/model/opportunities.js +55 -0
  22. package/dist/cjs/model/opportunities.schema.js +220 -0
  23. package/dist/cjs/model/package.json +1 -0
  24. package/dist/cjs/model/positions.js +1 -0
  25. package/dist/cjs/model/primitives.js +1 -0
  26. package/dist/cjs/model/primitives.schema.js +85 -0
  27. package/dist/cjs/new-sdk/AbstractNamespace.js +158 -0
  28. package/dist/cjs/new-sdk/GearboxSDK.js +122 -0
  29. package/dist/cjs/new-sdk/index.js +11 -0
  30. package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +122 -0
  31. package/dist/cjs/new-sdk/opportunities/index.js +4 -0
  32. package/dist/cjs/new-sdk/opportunities/types.js +1 -0
  33. package/dist/cjs/new-sdk/package.json +1 -0
  34. package/dist/cjs/new-sdk/types.js +22 -0
  35. package/dist/cjs/new-sdk/utils/history.js +1 -0
  36. package/dist/cjs/new-sdk/utils/index.js +2 -0
  37. package/dist/cjs/offchain/GearboxAPI.js +33 -0
  38. package/dist/cjs/offchain/index.js +8 -0
  39. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +97 -0
  40. package/dist/cjs/offchain/opportunities/index.js +4 -0
  41. package/dist/cjs/offchain/package.json +1 -0
  42. package/dist/cjs/offchain/types.js +1 -0
  43. package/dist/cjs/preview/preview/buildDelayedPreview.js +5 -5
  44. package/dist/cjs/rewards/rewards/api.js +2 -2
  45. package/dist/cjs/rewards/rewards/extra-apy.js +2 -2
  46. package/dist/cjs/sdk/MultichainSDK.js +18 -2
  47. package/dist/cjs/sdk/OnchainSDK.js +8 -1
  48. package/dist/cjs/sdk/accounts/index.js +2 -0
  49. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +150 -106
  50. package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
  51. package/dist/cjs/sdk/accounts/liquidations/constants.js +13 -0
  52. package/dist/cjs/sdk/accounts/liquidations/index.js +2 -0
  53. package/dist/cjs/sdk/base/MultichainConstruct.js +80 -0
  54. package/dist/cjs/sdk/base/TokensMeta.js +51 -0
  55. package/dist/cjs/sdk/base/index.js +2 -0
  56. package/dist/cjs/sdk/chain/chains.js +76 -0
  57. package/dist/cjs/sdk/chain/index.js +4 -0
  58. package/dist/cjs/sdk/core/errors.js +13 -0
  59. package/dist/cjs/sdk/core/index.js +2 -1
  60. package/dist/cjs/sdk/index.js +25 -1
  61. package/dist/cjs/sdk/market/MarketConfiguratorContract.js +14 -0
  62. package/dist/cjs/sdk/market/MarketSuite.js +163 -0
  63. package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +26 -0
  64. package/dist/cjs/sdk/market/credit/CreditSuite.js +102 -0
  65. package/dist/cjs/sdk/market/math.js +104 -0
  66. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
  67. package/dist/cjs/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
  68. package/dist/cjs/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
  69. package/dist/cjs/sdk/market/pool/PoolSuite.js +28 -0
  70. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +27 -0
  71. package/dist/cjs/sdk/market/pool/math.js +44 -0
  72. package/dist/cjs/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
  73. package/dist/cjs/sdk/opportunities/MultichainOpportunitiesService.js +60 -0
  74. package/dist/cjs/sdk/opportunities/OpportunitiesService.js +103 -0
  75. package/dist/cjs/sdk/opportunities/index.js +12 -0
  76. package/dist/cjs/sdk/types/multichain.js +1 -0
  77. package/dist/cjs/{common-utils → sdk}/utils/bigint-math.js +11 -11
  78. package/dist/cjs/sdk/utils/index.js +3 -0
  79. package/dist/cjs/sdk/utils/zod.js +12 -0
  80. package/dist/esm/common-utils/index.js +1 -1
  81. package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.js +1 -1
  82. package/dist/esm/common-utils/utils/assets-math.js +1 -1
  83. package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +1 -1
  84. package/dist/esm/common-utils/utils/creditAccount/debt.js +1 -1
  85. package/dist/esm/common-utils/utils/creditAccount/quota-utils.js +1 -1
  86. package/dist/esm/common-utils/utils/index.js +1 -1
  87. package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +1 -1
  88. package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +1 -1
  89. package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.js +1 -1
  90. package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +1 -1
  91. package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.js +1 -1
  92. package/dist/esm/dev/AccountOpener.js +1 -1
  93. package/dist/esm/dev/index.js +3 -3
  94. package/dist/esm/dev/kycUtils.js +1 -1
  95. package/dist/esm/dev/midasUtils.js +105 -2
  96. package/dist/esm/dev/withdrawalUtils.js +1 -1
  97. package/dist/esm/model/history.js +26 -0
  98. package/dist/esm/model/history.schema.js +76 -0
  99. package/dist/esm/model/index.js +9 -0
  100. package/dist/esm/model/liquidations.js +22 -0
  101. package/dist/esm/model/liquidations.schema.js +83 -0
  102. package/dist/esm/model/opportunities.js +51 -0
  103. package/dist/esm/model/opportunities.schema.js +198 -0
  104. package/dist/esm/model/package.json +1 -0
  105. package/dist/esm/model/positions.js +1 -0
  106. package/dist/esm/model/primitives.js +1 -0
  107. package/dist/esm/model/primitives.schema.js +75 -0
  108. package/dist/esm/new-sdk/AbstractNamespace.js +157 -0
  109. package/dist/esm/new-sdk/GearboxSDK.js +121 -0
  110. package/dist/esm/new-sdk/index.js +7 -0
  111. package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +121 -0
  112. package/dist/esm/new-sdk/opportunities/index.js +3 -0
  113. package/dist/esm/new-sdk/opportunities/types.js +1 -0
  114. package/dist/esm/new-sdk/package.json +1 -0
  115. package/dist/esm/new-sdk/types.js +21 -0
  116. package/dist/esm/new-sdk/utils/history.js +1 -0
  117. package/dist/esm/new-sdk/utils/index.js +2 -0
  118. package/dist/esm/offchain/GearboxAPI.js +32 -0
  119. package/dist/esm/offchain/index.js +5 -0
  120. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +95 -0
  121. package/dist/esm/offchain/opportunities/index.js +2 -0
  122. package/dist/esm/offchain/package.json +1 -0
  123. package/dist/esm/offchain/types.js +1 -0
  124. package/dist/esm/preview/preview/buildDelayedPreview.js +1 -1
  125. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  126. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  127. package/dist/esm/rewards/rewards/api.js +1 -1
  128. package/dist/esm/rewards/rewards/extra-apy.js +1 -1
  129. package/dist/esm/sdk/MultichainSDK.js +18 -2
  130. package/dist/esm/sdk/OnchainSDK.js +8 -1
  131. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
  132. package/dist/esm/sdk/accounts/index.js +2 -2
  133. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +153 -109
  134. package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
  135. package/dist/esm/sdk/accounts/liquidations/constants.js +12 -1
  136. package/dist/esm/sdk/accounts/liquidations/index.js +2 -2
  137. package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  138. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  139. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  140. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  141. package/dist/esm/sdk/base/MultichainConstruct.js +79 -0
  142. package/dist/esm/sdk/base/TokensMeta.js +53 -2
  143. package/dist/esm/sdk/base/index.js +2 -1
  144. package/dist/esm/sdk/chain/chains.js +74 -2
  145. package/dist/esm/sdk/chain/detectNetwork.js +1 -1
  146. package/dist/esm/sdk/chain/index.js +2 -2
  147. package/dist/esm/sdk/core/createAddressProvider.js +1 -1
  148. package/dist/esm/sdk/core/errors.js +13 -1
  149. package/dist/esm/sdk/core/index.js +2 -2
  150. package/dist/esm/sdk/index.js +11 -5
  151. package/dist/esm/sdk/market/MarketConfiguratorContract.js +14 -0
  152. package/dist/esm/sdk/market/MarketSuite.js +163 -0
  153. package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
  154. package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +26 -0
  155. package/dist/esm/sdk/market/credit/CreditSuite.js +102 -0
  156. package/dist/esm/sdk/market/math.js +98 -0
  157. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
  158. package/dist/esm/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
  159. package/dist/esm/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
  160. package/dist/esm/sdk/market/pool/PoolSuite.js +28 -0
  161. package/dist/esm/sdk/market/pool/PoolV310Contract.js +28 -1
  162. package/dist/esm/sdk/market/pool/math.js +41 -0
  163. package/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
  164. package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
  165. package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
  166. package/dist/esm/sdk/opportunities/MultichainOpportunitiesService.js +59 -0
  167. package/dist/esm/sdk/opportunities/OpportunitiesService.js +102 -0
  168. package/dist/esm/sdk/opportunities/index.js +4 -0
  169. package/dist/esm/sdk/pools/PoolService.js +1 -1
  170. package/dist/esm/sdk/types/multichain.js +1 -0
  171. package/dist/esm/{common-utils → sdk}/utils/bigint-math.js +11 -11
  172. package/dist/esm/sdk/utils/index.js +3 -2
  173. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  174. package/dist/esm/sdk/utils/zod.js +13 -2
  175. package/dist/types/common-utils/index.d.ts +1 -1
  176. package/dist/types/common-utils/utils/index.d.ts +1 -1
  177. package/dist/types/dev/index.d.ts +2 -2
  178. package/dist/types/dev/midasUtils.d.ts +31 -2
  179. package/dist/types/model/history.d.ts +105 -0
  180. package/dist/types/model/history.schema.d.ts +66 -0
  181. package/dist/types/model/index.d.ts +9 -0
  182. package/dist/types/model/liquidations.d.ts +230 -0
  183. package/dist/types/model/liquidations.schema.d.ts +292 -0
  184. package/dist/types/model/opportunities.d.ts +543 -0
  185. package/dist/types/model/opportunities.schema.d.ts +1066 -0
  186. package/dist/types/model/positions.d.ts +11 -0
  187. package/dist/types/model/primitives.d.ts +193 -0
  188. package/dist/types/model/primitives.schema.d.ts +81 -0
  189. package/dist/types/new-sdk/AbstractNamespace.d.ts +119 -0
  190. package/dist/types/new-sdk/GearboxSDK.d.ts +78 -0
  191. package/dist/types/new-sdk/index.d.ts +9 -0
  192. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +69 -0
  193. package/dist/types/new-sdk/opportunities/index.d.ts +3 -0
  194. package/dist/types/new-sdk/opportunities/types.d.ts +66 -0
  195. package/dist/types/new-sdk/types.d.ts +149 -0
  196. package/dist/types/new-sdk/utils/history.d.ts +44 -0
  197. package/dist/types/new-sdk/utils/index.d.ts +2 -0
  198. package/dist/types/offchain/GearboxAPI.d.ts +31 -0
  199. package/dist/types/offchain/index.d.ts +5 -0
  200. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +69 -0
  201. package/dist/types/offchain/opportunities/index.d.ts +2 -0
  202. package/dist/types/offchain/types.d.ts +50 -0
  203. package/dist/types/sdk/MultichainSDK.d.ts +15 -2
  204. package/dist/types/sdk/OnchainSDK.d.ts +9 -3
  205. package/dist/types/sdk/accounts/index.d.ts +3 -3
  206. package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +24 -16
  207. package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +26 -20
  208. package/dist/types/sdk/accounts/liquidations/constants.d.ts +12 -1
  209. package/dist/types/sdk/accounts/liquidations/index.d.ts +3 -3
  210. package/dist/types/sdk/accounts/liquidations/types.d.ts +34 -309
  211. package/dist/types/sdk/base/MultichainConstruct.d.ts +57 -0
  212. package/dist/types/sdk/base/TokensMeta.d.ts +26 -0
  213. package/dist/types/sdk/base/index.d.ts +2 -1
  214. package/dist/types/sdk/chain/chains.d.ts +68 -1
  215. package/dist/types/sdk/chain/index.d.ts +2 -2
  216. package/dist/types/sdk/core/errors.d.ts +10 -1
  217. package/dist/types/sdk/core/index.d.ts +2 -2
  218. package/dist/types/sdk/index.d.ts +15 -8
  219. package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +9 -0
  220. package/dist/types/sdk/market/MarketSuite.d.ts +109 -1
  221. package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +14 -0
  222. package/dist/types/sdk/market/credit/CreditSuite.d.ts +47 -0
  223. package/dist/types/sdk/market/credit/types.d.ts +22 -0
  224. package/dist/types/sdk/market/index.d.ts +2 -2
  225. package/dist/types/sdk/market/math.d.ts +74 -0
  226. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +23 -0
  227. package/dist/types/sdk/market/oracle/types.d.ts +46 -0
  228. package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +12 -0
  229. package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +22 -1
  230. package/dist/types/sdk/market/pool/PoolSuite.d.ts +23 -0
  231. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +18 -0
  232. package/dist/types/sdk/market/pool/math.d.ts +57 -0
  233. package/dist/types/sdk/market/pool/types.d.ts +23 -0
  234. package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +6 -0
  235. package/dist/types/sdk/market/pricefeeds/types.d.ts +10 -0
  236. package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +40 -0
  237. package/dist/types/sdk/opportunities/OpportunitiesService.d.ts +47 -0
  238. package/dist/types/sdk/opportunities/index.d.ts +4 -0
  239. package/dist/types/sdk/types/index.d.ts +2 -1
  240. package/dist/types/sdk/types/multichain.d.ts +65 -0
  241. package/dist/types/sdk/types/state.d.ts +1 -1
  242. package/dist/types/sdk/types/transactions.d.ts +3 -0
  243. package/dist/types/{common-utils → sdk}/utils/bigint-math.d.ts +7 -11
  244. package/dist/types/sdk/utils/index.d.ts +3 -2
  245. package/dist/types/sdk/utils/zod.d.ts +6 -2
  246. package/package.json +16 -1
  247. package/dist/cjs/sdk/accounts/liquidations/helpers.js +0 -201
  248. package/dist/esm/sdk/accounts/liquidations/helpers.js +0 -192
  249. package/dist/types/sdk/accounts/liquidations/helpers.d.ts +0 -140
@@ -1,110 +1,42 @@
1
- import { NetworkType } from "../../chain/chains.js";
2
- import "../../chain/index.js";
3
- import { Asset } from "../../base/types.js";
4
- import { RawTx } from "../../types/transactions.js";
1
+ import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
2
+ import { MultichainNetworkProps, MultichainNetworksProps, WithMultichain } from "../../types/multichain.js";
3
+ import { LiquidatableAccountFilter } from "../../../model/liquidations.js";
4
+ import "../../../model/index.js";
5
5
  import "../../types/index.js";
6
- import "../../base/index.js";
7
- import { Address } from "viem";
6
+ import { Address, ContractFunctionReturnType } from "viem";
8
7
  //#region src/sdk/accounts/liquidations/types.d.ts
9
8
  /**
10
- * Selects the chain for single-account methods of a multichain service.
9
+ * Raw `LiquidationData` returned by `LiquidationCompressor.getLiquidationData`.
11
10
  **/
12
- interface MultichainNetworkProps {
13
- /**
14
- * Network the credit account lives on.
15
- **/
16
- network: NetworkType;
17
- }
11
+ type OnchainLiquidationData = ContractFunctionReturnType<typeof iLiquidationCompressorV313Abi, "nonpayable", "getLiquidationData">;
18
12
  /**
19
- * Restricts which chains a multichain list method queries.
13
+ * Single element of {@link OnchainLiquidationData.expectedOutputs}.
20
14
  **/
21
- interface MultichainNetworksProps {
22
- /**
23
- * Networks to query. All chains configured in {@link MultichainSDK} when
24
- * omitted.
25
- **/
26
- networks?: NetworkType[];
27
- }
15
+ type OnchainLiquidationOutput = OnchainLiquidationData["expectedOutputs"][number];
28
16
  /**
29
- * Adds chain-scoping props `T` only when the service spans multiple chains.
17
+ * Single call built by the liquidation compressor.
30
18
  **/
31
- type WithMultichain<Multichain extends boolean, T extends object> = Multichain extends true ? T : {};
19
+ type OnchainLiquidationCall = OnchainLiquidationData["liquidationCall"];
32
20
  /**
33
- * Chain-independent part of {@link GetLiquidatableAccountsProps}.
34
- * All filters are optional and applied after liquidatable accounts are fetched.
21
+ * A dedicated RWA liquidator contract (Midas / Securitize) discovered by
22
+ * `LiquidationCompressor.getRWALiquidators`. `contractType` is the bytes32
23
+ * contract type of the liquidator itself (e.g. `RWA_LIQUIDATOR::MIDAS`),
24
+ * not of the phantom token it was found through.
35
25
  **/
36
- interface GetLiquidatableAccountsPropsBase {
37
- /**
38
- * Only return accounts whose main liquidated {@link LiquidatableAccount.asset}
39
- * is one of these tokens.
40
- **/
41
- assets?: Address[];
42
- /**
43
- * When set, only return accounts with (`true`) or without (`false`)
44
- * delayed (phantom-token) withdrawals.
45
- **/
46
- delayed?: boolean;
47
- }
26
+ type RWALiquidatorInfo = ContractFunctionReturnType<typeof iLiquidationCompressorV313Abi, "view", "getRWALiquidators">[number];
48
27
  /**
49
- * Props for {@link ILiquidationsService.getLiquidatableAccounts}.
28
+ * Chain-independent part of {@link GetLiquidatableAccountsProps}.
29
+ *
30
+ * The filter itself lives in the read model, so the chain and the backend
31
+ * cannot disagree on what a criterion selects. Chain scoping is expressed as
32
+ * `networks` by {@link MultichainNetworksProps} rather than as the model's
33
+ * `chainIds`, which is why it is omitted here.
50
34
  **/
51
- type GetLiquidatableAccountsProps<Multichain extends boolean = false> = GetLiquidatableAccountsPropsBase & WithMultichain<Multichain, MultichainNetworksProps>;
35
+ type GetLiquidatableAccountsPropsBase = Omit<LiquidatableAccountFilter, "chainIds">;
52
36
  /**
53
- * A credit account that can be liquidated, with amounts precomputed for
54
- * manual liquidation via the frontend.
37
+ * Props for {@link LiquidationsService.getLiquidatableAccounts}.
55
38
  **/
56
- interface LiquidatableAccount {
57
- /**
58
- * Credit account address.
59
- **/
60
- creditAccount: Address;
61
- /**
62
- * Credit manager the account is opened in.
63
- **/
64
- creditManager: Address;
65
- /**
66
- * Network the account lives on.
67
- **/
68
- network: NetworkType;
69
- /**
70
- * Main asset being liquidated: the most valuable enabled non-underlying
71
- * collateral token. For delayed-withdrawal phantom tokens, the source
72
- * asset (e.g. ACRED) is reported instead of the phantom token. Falls back
73
- * to the underlying when the account holds no other collateral.
74
- **/
75
- asset: Address;
76
- /**
77
- * Account total value. The token is the unwrapped asset (e.g. USDC) for
78
- * RWA credit managers (1:1 with the wrapped underlying), the credit
79
- * manager underlying otherwise.
80
- **/
81
- totalValue: Asset;
82
- /**
83
- * Account total value in USD (8 decimals).
84
- **/
85
- totalValueUSD: bigint;
86
- /**
87
- * Estimated amount the liquidator pays to fully liquidate the account:
88
- * `totalValue * liquidationDiscount`. Same token as {@link totalValue}.
89
- **/
90
- repaymentAmount: Asset;
91
- /**
92
- * Estimated liquidator profit: `totalValue * (1 - liquidationDiscount)`.
93
- * Same token as {@link totalValue}.
94
- **/
95
- estimatedProfit: Asset;
96
- /**
97
- * `true` when the account holds a delayed-withdrawal phantom token above
98
- * dust, i.e. the liquidation transfers withdrawal redeemers into the
99
- * liquidator's ownership instead of instantly receivable tokens.
100
- **/
101
- isDelayed: boolean;
102
- /**
103
- * `true` when the credit manager's facade is paused. Liquidations of such
104
- * accounts only succeed for emergency liquidators approved in the market.
105
- **/
106
- paused: boolean;
107
- }
39
+ type GetLiquidatableAccountsProps<Multichain extends boolean = false> = GetLiquidatableAccountsPropsBase & WithMultichain<Multichain, MultichainNetworksProps>;
108
40
  /**
109
41
  * Chain-independent part of {@link GetLiquidationDetailsProps}.
110
42
  **/
@@ -128,7 +60,7 @@ interface GetLiquidationDetailsPropsBase {
128
60
  ignoreReservePrices?: boolean;
129
61
  }
130
62
  /**
131
- * Props for {@link ILiquidationsService.getLiquidationDetails}.
63
+ * Props for {@link LiquidationsService.getLiquidationDetails}.
132
64
  **/
133
65
  type GetLiquidationDetailsProps<Multichain extends boolean = false> = GetLiquidationDetailsPropsBase & WithMultichain<Multichain, MultichainNetworkProps>;
134
66
  /**
@@ -151,57 +83,13 @@ interface BuildLiquidationTxPropsBase {
151
83
  ignoreReservePrices?: boolean;
152
84
  }
153
85
  /**
154
- * Props for {@link ILiquidationsService.buildLiquidationTx}.
86
+ * Props for {@link LiquidationsService.buildLiquidationTx}.
155
87
  **/
156
88
  type BuildLiquidationTxProps<Multichain extends boolean = false> = BuildLiquidationTxPropsBase & WithMultichain<Multichain, MultichainNetworkProps>;
157
89
  /**
158
- * A token received directly from the credit account balance upon liquidation.
159
- **/
160
- interface InstantReceivedAsset {
161
- isDelayed: false;
162
- /**
163
- * Token received by the liquidator.
164
- **/
165
- token: Address;
166
- /**
167
- * Amount of `token` received.
168
- **/
169
- amount: bigint;
170
- }
171
- /**
172
- * A token produced by a delayed withdrawal whose redeemer is transferred to
173
- * the liquidator upon liquidation.
174
- **/
175
- interface DelayedReceivedAsset {
176
- isDelayed: true;
177
- /**
178
- * Receivable token (e.g. USDC).
179
- **/
180
- token: Address;
181
- /**
182
- * Amount of `token`: exact for claimable withdrawals, estimated for
183
- * pending ones.
184
- **/
185
- amount: bigint;
186
- /**
187
- * Redeemer contract transferred to the liquidator, from which `token`
188
- * becomes claimable. `undefined` when the compressor does not report one.
189
- **/
190
- redeemerAddress?: Address;
191
- /**
192
- * Estimated unix timestamp (in seconds) when a pending withdrawal becomes
193
- * claimable. `undefined` means the withdrawal is claimable now.
194
- **/
195
- claimableAt?: bigint;
196
- }
197
- /**
198
- * A single asset the liquidator receives when fully liquidating an account.
199
- **/
200
- type ReceivedAsset = InstantReceivedAsset | DelayedReceivedAsset;
201
- /**
202
- * Chain-independent part of {@link GetLiquidatorWithdrawalsProps}.
90
+ * Chain-independent part of {@link GetLiquidationPositionsProps}.
203
91
  **/
204
- interface GetLiquidatorWithdrawalsPropsBase {
92
+ interface GetLiquidationPositionsPropsBase {
205
93
  /**
206
94
  * Liquidator wallet that owns the redemption receipts (redeemer contracts
207
95
  * received as a result of liquidations).
@@ -209,176 +97,13 @@ interface GetLiquidatorWithdrawalsPropsBase {
209
97
  liquidator: Address;
210
98
  }
211
99
  /**
212
- * Props for {@link ILiquidationsService.getLiquidatorWithdrawals}.
100
+ * Props for {@link LiquidationsService.getLiquidationPositions}.
213
101
  **/
214
- type GetLiquidatorWithdrawalsProps<Multichain extends boolean = false> = GetLiquidatorWithdrawalsPropsBase & WithMultichain<Multichain, MultichainNetworksProps>;
102
+ type GetLiquidationPositionsProps<Multichain extends boolean = false> = GetLiquidationPositionsPropsBase & WithMultichain<Multichain, MultichainNetworksProps>;
215
103
  /**
216
- * Props for {@link ILiquidationsService.loadRWALiquidators}.
104
+ * Props for {@link MultichainLiquidationsService.loadRWALiquidators}. The
105
+ * per-chain {@link LiquidationsService.loadRWALiquidators} takes no props.
217
106
  **/
218
107
  type LoadRWALiquidatorsProps<Multichain extends boolean = false> = WithMultichain<Multichain, MultichainNetworksProps>;
219
- /**
220
- * A single delayed-withdrawal position owned by the liquidator.
221
- **/
222
- interface LiquidatorWithdrawal {
223
- /**
224
- * Network the withdrawal lives on.
225
- **/
226
- network: NetworkType;
227
- /**
228
- * Chain id the withdrawal lives on.
229
- **/
230
- chainId: number;
231
- /**
232
- * Source asset spent by the delayed withdrawal (e.g. ACRED).
233
- **/
234
- sourceToken: Address;
235
- /**
236
- * Receivable asset (e.g. USDC) and its amount: exact for claimable
237
- * withdrawals, estimated for pending ones.
238
- **/
239
- output: Asset;
240
- /**
241
- * Estimated unix timestamp (in seconds) when a pending withdrawal becomes
242
- * claimable. `undefined` means the withdrawal is claimable now.
243
- **/
244
- claimableAt?: bigint;
245
- /**
246
- * Transaction that claims the withdrawal. `undefined` for pending
247
- * withdrawals and when the compressor reports no claim call.
248
- **/
249
- claimTx?: RawTx;
250
- /**
251
- * Redeemer contract the withdrawal is claimed from, owned by the liquidator.
252
- * `undefined` on compressor versions below 313, which do not report it.
253
- **/
254
- redeemer?: Address;
255
- }
256
- /**
257
- * ERC-20 approval the liquidator must grant before sending the liquidation
258
- * transaction.
259
- **/
260
- interface LiquidationApproval {
261
- /**
262
- * Address to approve: the credit manager when the liquidation goes directly
263
- * through the credit facade (the facade forwards `msg.sender` as the payer
264
- * and the credit manager executes the transfer), or the dedicated liquidator
265
- * contract (Midas / Securitize) when the liquidation goes through one, since
266
- * such contracts pull the token to themselves first.
267
- **/
268
- spender: Address;
269
- /**
270
- * Token pulled from the liquidator, as reported by the compressor for the
271
- * liquidation path it selected: the credit manager underlying for standard
272
- * liquidations, the unwrapped stablecoin (e.g. USDC) for RWA ones.
273
- **/
274
- token: Address;
275
- /**
276
- * Amount to approve: the amount the liquidation transaction pulls plus 0.5%
277
- * of headroom. The Securitize liquidator recomputes the amount on-chain, so
278
- * the approval must survive price movements after the preview.
279
- **/
280
- amount: bigint;
281
- }
282
- /**
283
- * Detailed information about a liquidatable credit account, including
284
- * the full breakdown of assets the liquidator receives.
285
- *
286
- **/
287
- interface LiquidationDetails extends LiquidatableAccount {
288
- /**
289
- * Exact amount the liquidator pays for the liquidation path the compressor
290
- * selected, superseding the estimate of {@link LiquidatableAccount}. The
291
- * token is {@link LiquidationApproval.token}, which for RWA markets is the
292
- * unwrapped stablecoin rather than {@link LiquidatableAccount.totalValue}'s
293
- * token; it falls back to the latter when nothing is pulled.
294
- **/
295
- repaymentAmount: Asset;
296
- /**
297
- * Assets the liquidator receives upon full liquidation: direct credit
298
- * account balances plus outputs of delayed withdrawals (claimable and
299
- * pending).
300
- **/
301
- receivedAssets: ReceivedAsset[];
302
- /**
303
- * Whether the liquidator passes the KYC checks of the liquidated assets.
304
- * When {@link GetLiquidationDetailsPropsBase.liquidator} was not provided,
305
- * `false` only means that the liquidation is KYC-gated, not that a
306
- * particular wallet was rejected.
307
- **/
308
- isLiquidatorEligible: boolean;
309
- /**
310
- * `true` when the credit account is frozen by the RWA factory
311
- * (`isFrozen`) and cannot move its RWA collateral. Always `false` for
312
- * non-RWA liquidation paths.
313
- **/
314
- isCreditAccountFrozen: boolean;
315
- /**
316
- * Name of the KYC protocol the liquidator must be whitelisted in
317
- * (e.g. `"securitize"`). `undefined` when the liquidation is not KYC-gated.
318
- **/
319
- kycProtocol?: string;
320
- /**
321
- * Token the liquidator must be whitelisted for in {@link kycProtocol}.
322
- * `undefined` when the liquidation is not KYC-gated.
323
- **/
324
- kycToken?: Address;
325
- /**
326
- * ERC-20 approval required before sending the liquidation transaction.
327
- * `undefined` when the selected liquidation path needs no capital from the
328
- * liquidator, i.e. {@link repaymentAmount} is zero.
329
- **/
330
- approve?: LiquidationApproval;
331
- }
332
- /**
333
- * Service for discovering liquidatable credit accounts and previewing manual
334
- * liquidations. Implemented per-chain by {@link LiquidationsService} and
335
- * across all configured chains by {@link MultichainLiquidationsService}.
336
- *
337
- * @typeParam Multichain - When `true`, props select the chain to operate on:
338
- * {@link MultichainNetworkProps} for single-account methods and
339
- * {@link MultichainNetworksProps} for list methods. A per-chain service
340
- * operates on the network its SDK is attached to and takes no network props.
341
- **/
342
- interface ILiquidationsService<Multichain extends boolean = false> {
343
- /**
344
- * Returns all liquidatable credit accounts: accounts with health factor
345
- * below 1 plus accounts of expired credit managers with outstanding debt.
346
- * Accounts whose collateral computation failed are excluded.
347
- *
348
- * @param props - Optional filters, see {@link GetLiquidatableAccountsProps}
349
- **/
350
- getLiquidatableAccounts(props?: GetLiquidatableAccountsProps<Multichain>): Promise<LiquidatableAccount[]>;
351
- /**
352
- * Returns detailed information about a liquidatable credit account,
353
- * including the full list of assets the liquidator receives.
354
- *
355
- * @param props - See {@link GetLiquidationDetailsProps}
356
- * @throws When the account is not found or its collateral computation fails.
357
- **/
358
- getLiquidationDetails(props: GetLiquidationDetailsProps<Multichain>): Promise<LiquidationDetails>;
359
- /**
360
- * Builds the transaction that fully liquidates a credit account, repaying
361
- * the debt from own funds and receiving the collateral from the credit account.
362
- *
363
- * @param props - See {@link BuildLiquidationTxProps}
364
- **/
365
- buildLiquidationTx(props: BuildLiquidationTxProps<Multichain>): Promise<RawTx>;
366
- /**
367
- * Returns the status of delayed-withdrawal positions (redemption receipts)
368
- * owned by a liquidator wallet: what is receivable, how much, and when it
369
- * becomes claimable.
370
- *
371
- * @param props - See {@link GetLiquidatorWithdrawalsProps}
372
- **/
373
- getLiquidatorWithdrawals(props: GetLiquidatorWithdrawalsProps<Multichain>): Promise<LiquidatorWithdrawal[]>;
374
- /**
375
- * Discovers the dedicated RWA liquidator contracts (Securitize, Midas)
376
- * deployed for the markets of the chain and registers them in the SDK
377
- * contracts register.
378
- *
379
- * @param props - See {@link LoadRWALiquidatorsProps}
380
- **/
381
- loadRWALiquidators(props?: LoadRWALiquidatorsProps<Multichain>): Promise<void>;
382
- }
383
108
  //#endregion
384
- export { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, DelayedReceivedAsset, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidatorWithdrawalsProps, GetLiquidatorWithdrawalsPropsBase, ILiquidationsService, InstantReceivedAsset, LiquidatableAccount, LiquidationApproval, LiquidationDetails, LiquidatorWithdrawal, LoadRWALiquidatorsProps, MultichainNetworkProps, MultichainNetworksProps, ReceivedAsset, WithMultichain };
109
+ export { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, LoadRWALiquidatorsProps, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, RWALiquidatorInfo };
@@ -0,0 +1,57 @@
1
+ import { NetworkType } from "../chain/chains.js";
2
+ import { MultichainResult } from "../types/multichain.js";
3
+ import { PluginsMap } from "../plugins/types.js";
4
+ import "../plugins/index.js";
5
+ import { OnchainSDK } from "../OnchainSDK.js";
6
+ import "../types/index.js";
7
+ import { MultichainSDK } from "../MultichainSDK.js";
8
+ //#region src/sdk/base/MultichainConstruct.d.ts
9
+ /**
10
+ * Describes a request that is sent to every queried chain.
11
+ *
12
+ * @typeParam T - Payload returned by a single chain.
13
+ * @typeParam Plugins - Map of attached plugin types.
14
+ **/
15
+ interface ChainQueryProps<T, Plugins extends PluginsMap = {}> {
16
+ /**
17
+ * Networks to query. All configured chains when omitted.
18
+ **/
19
+ networks?: NetworkType[];
20
+ /**
21
+ * Action description used in warnings, e.g. `"get liquidatable accounts"`.
22
+ **/
23
+ label: string;
24
+ /**
25
+ * Request sent to a single chain.
26
+ **/
27
+ run: (sdk: OnchainSDK<Plugins>) => Promise<T>;
28
+ }
29
+ /**
30
+ * @internal
31
+ * Base class for services that fan out over the chains of a
32
+ * {@link MultichainSDK}, the cross-chain counterpart of {@link SDKConstruct}.
33
+ *
34
+ * Requests are soft-failing: a chain that rejects (including a chain that is
35
+ * not configured in the SDK) is logged as a warning and contributes no payload,
36
+ * while the remaining chains still return their results. Every queried chain is
37
+ * reported in {@link MultichainResult.meta}.
38
+ *
39
+ * @typeParam Plugins - Map of attached plugin types.
40
+ **/
41
+ declare abstract class MultichainConstruct<const Plugins extends PluginsMap = {}> {
42
+ #private;
43
+ protected readonly sdk: MultichainSDK<Plugins>;
44
+ constructor(sdk: MultichainSDK<Plugins>);
45
+ /**
46
+ * Fans out a request that returns a list, concatenating the lists of all
47
+ * chains that responded successfully.
48
+ **/
49
+ protected queryChains<T>(props: ChainQueryProps<T[], Plugins>): Promise<MultichainResult<T[]>>;
50
+ /**
51
+ * Fans out a request with no payload, reporting the outcome of every queried
52
+ * chain in {@link MultichainResult.meta}.
53
+ **/
54
+ protected runChains(props: ChainQueryProps<void, Plugins>): Promise<MultichainResult<void>>;
55
+ }
56
+ //#endregion
57
+ export { ChainQueryProps, MultichainConstruct };
@@ -1,4 +1,5 @@
1
1
  import { ILogger } from "../types/logger.js";
2
+ import { Token } from "../../model/primitives.js";
2
3
  import { AddressMap } from "../utils/AddressMap.js";
3
4
  import { Asset } from "./types.js";
4
5
  import "../utils/index.js";
@@ -68,6 +69,31 @@ declare class TokensMeta extends AddressMap<TokenMetaData> {
68
69
  * Throws if token data is not loaded
69
70
  */
70
71
  get rwaUnderlyings(): AddressMap<RWATokenMeta>;
72
+ /**
73
+ * Describes a token the way the shared read model does.
74
+ *
75
+ * @param address - Token address.
76
+ * @throws If the token is not in the registry.
77
+ */
78
+ mustGetToken(address: Address): Token;
79
+ /**
80
+ * Like {@link mustGetToken}, but returns `undefined` instead of throwing when the
81
+ * token is not in the registry.
82
+ *
83
+ * @param address - Token address.
84
+ */
85
+ getToken(address: Address): Token | undefined;
86
+ /**
87
+ * The token an RWA wrapper holds, or the token itself when it is not one.
88
+ *
89
+ * An RWA market borrows a compliance wrapper (e.g. `dcUSDC`) that converts
90
+ * one-for-one with the token behind it (`USDC`), and only that token means
91
+ * anything to a reader. Pricing still goes through the wrapper, which is what
92
+ * a market's oracle knows.
93
+ *
94
+ * @param token - Token address, wrapper or not.
95
+ */
96
+ unwrapRWA(token: Address): Address;
71
97
  /**
72
98
  * Formats a raw token amount into a human-readable decimal string,
73
99
  * dividing by `10^decimals` for the token.
@@ -5,6 +5,7 @@ import { ChainContractsRegister, ContractOrInterface } from "./ChainContractsReg
5
5
  import { Construct, ConstructOptions } from "./Construct.js";
6
6
  import { BaseContract, BaseContractArgs, ContractParseError, ContractParseErrorOptions } from "./BaseContract.js";
7
7
  import { MissingSerializedParamsError } from "./errors.js";
8
+ import { ChainQueryProps, MultichainConstruct } from "./MultichainConstruct.js";
8
9
  import { PlaceholderContract } from "./PlaceholderContract.js";
9
10
  import { SDKConstruct } from "./SDKConstruct.js";
10
- export { AdapterData, AssertAssignable, Asset, BaseContract, BaseContractArgs, BaseParams, BaseState, ChainContractsRegister, ConnectedBotData, Construct, ConstructOptions, ContractOrInterface, ContractParseError, ContractParseErrorOptions, CreditAccountData, CreditAccountDataPayload, CreditConfiguratorState, CreditFacadeState, CreditManagerDebtParams, CreditManagerState, CreditSuiteState, FormatBNOptions, GaugeData, IBaseContract, LPMonopolizedPoolMeta, MarketData, MarketFilter, MissingSerializedParamsError, PHANTOM_TOKEN_CONTRACT_TYPES, ParsedCall, ParsedCallArgs, ParsedCallV2, PhantomTokenContractType, PhantomTokenMeta, PlaceholderContract, PoolState, PriceFeedAnswer, PriceFeedMapEntry, PriceFeedTreeNode, PriceOracleData, QuotaKeeperState, QuotaState, RWADefaultTokenMeta, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWATokenMeta, RWAUnderlyingContractType, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RateKeeperState, RelaxedBaseParams, RewardInfo, SDKConstruct, SimpleTokenMeta, TokenInfo, TokenMetaData, TokensMeta, Unarray, VotingContractStatus };
11
+ export { AdapterData, AssertAssignable, Asset, BaseContract, BaseContractArgs, BaseParams, BaseState, ChainContractsRegister, ChainQueryProps, ConnectedBotData, Construct, ConstructOptions, ContractOrInterface, ContractParseError, ContractParseErrorOptions, CreditAccountData, CreditAccountDataPayload, CreditConfiguratorState, CreditFacadeState, CreditManagerDebtParams, CreditManagerState, CreditSuiteState, FormatBNOptions, GaugeData, IBaseContract, LPMonopolizedPoolMeta, MarketData, MarketFilter, MissingSerializedParamsError, MultichainConstruct, PHANTOM_TOKEN_CONTRACT_TYPES, ParsedCall, ParsedCallArgs, ParsedCallV2, PhantomTokenContractType, PhantomTokenMeta, PlaceholderContract, PoolState, PriceFeedAnswer, PriceFeedMapEntry, PriceFeedTreeNode, PriceOracleData, QuotaKeeperState, QuotaState, RWADefaultTokenMeta, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWATokenMeta, RWAUnderlyingContractType, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RateKeeperState, RelaxedBaseParams, RewardInfo, SDKConstruct, SimpleTokenMeta, TokenInfo, TokenMetaData, TokensMeta, Unarray, VotingContractStatus };
@@ -1,3 +1,4 @@
1
+ import { AssetType } from "../../model/primitives.js";
1
2
  import { Address, Chain } from "viem";
2
3
  import { z } from "zod/v4";
3
4
  //#region src/sdk/chain/chains.d.ts
@@ -6,6 +7,14 @@ import { z } from "zod/v4";
6
7
  *
7
8
  **/
8
9
  type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "KPK" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs" | "Securitize" | "Testnet Curator";
10
+ /**
11
+ * One strategy of the sunset list, identified the same way a strategy
12
+ * opportunity is: the credit manager plus the collateral it is built around.
13
+ **/
14
+ interface SunsetStrategy {
15
+ creditManager: Address;
16
+ collateral: Address;
17
+ }
9
18
  /**
10
19
  * Extended viem {@link Chain} with Gearbox-specific metadata.
11
20
  *
@@ -29,6 +38,30 @@ interface GearboxChain extends Chain {
29
38
  * Market configurators used in test/staging environments.
30
39
  **/
31
40
  testMarketConfigurators?: Record<Address, Curator>;
41
+ /**
42
+ * Denomination class of the market underlyings on this chain.
43
+ *
44
+ * Nothing on-chain says what a token is denominated in, so this is a manually
45
+ * curated table. It only covers underlyings — there are few of them — and a
46
+ * token missing from it is simply unclassified. An RWA market's compliance
47
+ * wrapper does not belong here: it is unwrapped before the lookup, so the
48
+ * token it holds is what needs an entry.
49
+ **/
50
+ underlyingAssetTypes?: Record<Address, AssetType>;
51
+ /**
52
+ * Tokens on this chain that represent a real-world asset. A market that
53
+ * accepts one of them as collateral is reported as an RWA opportunity.
54
+ **/
55
+ rwaTokens?: Address[];
56
+ /**
57
+ * Pools being wound down. Curated, and unrelated to any on-chain flag.
58
+ **/
59
+ sunsetPools?: Address[];
60
+ /**
61
+ * Strategies being wound down. Curated, and unrelated to the credit facade's
62
+ * expiration date.
63
+ **/
64
+ sunsetStrategies?: SunsetStrategy[];
32
65
  /**
33
66
  * Whether this chain is production-ready
34
67
  **/
@@ -131,5 +164,39 @@ declare function getCuratorName(marketConfigurator: Address, network?: NetworkTy
131
164
  * has no configurator on this network.
132
165
  **/
133
166
  declare function findCuratorMarketConfigurator(curator: Curator, network: NetworkType): Address | undefined;
167
+ /**
168
+ * Looks up the {@link AssetType} of a token in hardcoded classifier.
169
+ * Not all tokens are classified, only underlyings, so the default answer is `undefined`.
170
+ *
171
+ * @param token - Token address
172
+ * @param network - Network the token lives on.
173
+ * @returns The asset type, or `undefined` when the token is not classified
174
+ **/
175
+ declare function getAssetType(token: Address, network: NetworkType): AssetType | undefined;
176
+ /**
177
+ * Checks whether a token represents a real-world asset, per the curated list of
178
+ * a network.
179
+ *
180
+ * @param token - Token address.
181
+ * @param network - Network the token lives on.
182
+ **/
183
+ declare function isRWAToken(token: Address, network: NetworkType): boolean;
184
+ /**
185
+ * Checks whether a pool is on the sunset list of a network.
186
+ *
187
+ * @param pool - Pool address.
188
+ * @param network - Network the pool lives on.
189
+ **/
190
+ declare function isSunsetPool(pool: Address, network: NetworkType): boolean;
191
+ /**
192
+ * Checks whether a strategy is on the sunset list of a network. Both halves of
193
+ * the strategy key must match: a credit manager can wind down one collateral
194
+ * and keep the rest.
195
+ *
196
+ * @param creditManager - Credit manager address.
197
+ * @param collateral - Target collateral of the strategy.
198
+ * @param network - Network the strategy lives on.
199
+ **/
200
+ declare function isSunsetStrategy(creditManager: Address, collateral: Address, network: NetworkType): boolean;
134
201
  //#endregion
135
- export { Curator, GearboxChain, NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getChain, getCuratorName, getNetworkType, isPublicNetwork, isSupportedNetwork };
202
+ export { Curator, GearboxChain, NetworkType, SUPPORTED_NETWORKS, SunsetStrategy, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork };
@@ -1,3 +1,3 @@
1
- import { Curator, GearboxChain, NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getChain, getCuratorName, getNetworkType, isPublicNetwork, isSupportedNetwork } from "./chains.js";
1
+ import { Curator, GearboxChain, NetworkType, SUPPORTED_NETWORKS, SunsetStrategy, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork } from "./chains.js";
2
2
  import { detectNetwork } from "./detectNetwork.js";
3
- export { Curator, GearboxChain, NetworkType, SUPPORTED_NETWORKS, chains, detectNetwork, findCuratorMarketConfigurator, getChain, getCuratorName, getNetworkType, isPublicNetwork, isSupportedNetwork };
3
+ export { Curator, GearboxChain, NetworkType, SUPPORTED_NETWORKS, SunsetStrategy, chains, detectNetwork, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork };
@@ -41,6 +41,15 @@ declare class SdkMissingChainStateError extends BaseError {
41
41
  name: string;
42
42
  constructor(network: NetworkType);
43
43
  }
44
+ /**
45
+ * Thrown when a chain that is not configured in {@link MultichainSDK} is
46
+ * requested.
47
+ */
48
+ declare class ChainNotConfiguredError extends BaseError {
49
+ name: string;
50
+ readonly network: NetworkType | number;
51
+ constructor(network: NetworkType | number);
52
+ }
44
53
  /**
45
54
  * Thrown by {@link MultichainSDK.syncState} when one or more per-chain syncs
46
55
  * fail. Wraps the individual errors keyed by network.
@@ -51,4 +60,4 @@ declare class SdkSyncFailedError extends BaseError {
51
60
  constructor(perChainErrors: Partial<Record<NetworkType, unknown>>);
52
61
  }
53
62
  //#endregion
54
- export { SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError };
63
+ export { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError };
@@ -1,5 +1,5 @@
1
1
  import { AddressProviderAddresses, AddressProviderState, IAddressProviderContract } from "./types.js";
2
2
  import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
3
3
  import { createAddressProvider, hydrateAddressProvider } from "./createAddressProvider.js";
4
- import { SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./errors.js";
5
- export { AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, IAddressProviderContract, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, createAddressProvider, hydrateAddressProvider };
4
+ import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./errors.js";
5
+ export { AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, ChainNotConfiguredError, IAddressProviderContract, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, createAddressProvider, hydrateAddressProvider };