@gearbox-protocol/sdk 14.12.0-next.74 → 14.12.0-next.76

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 (79) hide show
  1. package/dist/cjs/plugins/accounts-counter/AccountsCounterPlugin.js +1 -1
  2. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +85 -584
  3. package/dist/cjs/sdk/accounts/bots/AccountBotsService.js +132 -0
  4. package/dist/cjs/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
  5. package/dist/cjs/sdk/accounts/bots/abi.js +19 -0
  6. package/dist/cjs/sdk/accounts/bots/index.js +6 -0
  7. package/dist/cjs/sdk/accounts/bots/types.js +1 -0
  8. package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +280 -0
  9. package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js +141 -0
  10. package/dist/cjs/sdk/accounts/credit-account-compressor/index.js +6 -0
  11. package/dist/cjs/sdk/accounts/credit-account-compressor/types.js +1 -0
  12. package/dist/cjs/sdk/accounts/index.js +10 -0
  13. package/dist/cjs/sdk/index.js +8 -0
  14. package/dist/cjs/sdk/market/ZapperRegister.js +1 -1
  15. package/dist/cjs/sdk/market/credit/CreditSuite.js +31 -0
  16. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +41 -1
  17. package/dist/cjs/sdk/market/oracle/PriceOracleV310Contract.js +0 -23
  18. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +1 -1
  19. package/dist/esm/plugins/accounts-counter/AccountsCounterPlugin.js +1 -1
  20. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +87 -586
  21. package/dist/esm/sdk/accounts/bots/AccountBotsService.js +131 -0
  22. package/dist/esm/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
  23. package/dist/esm/sdk/accounts/bots/abi.js +18 -0
  24. package/dist/esm/sdk/accounts/bots/index.js +4 -0
  25. package/dist/esm/sdk/accounts/bots/types.js +1 -0
  26. package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +279 -0
  27. package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js +141 -0
  28. package/dist/esm/sdk/accounts/credit-account-compressor/index.js +4 -0
  29. package/dist/esm/sdk/accounts/credit-account-compressor/types.js +1 -0
  30. package/dist/esm/sdk/accounts/index.js +7 -1
  31. package/dist/esm/sdk/index.js +5 -1
  32. package/dist/esm/sdk/market/ZapperRegister.js +1 -1
  33. package/dist/esm/sdk/market/credit/CreditSuite.js +31 -0
  34. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +41 -1
  35. package/dist/esm/sdk/market/oracle/PriceOracleV310Contract.js +0 -23
  36. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +1 -1
  37. package/dist/types/new-sdk/AbstractNamespace.d.ts +2 -2
  38. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  39. package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +1 -1
  40. package/dist/types/plugins/accounts/AccountsPlugin.d.ts +1 -1
  41. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +17 -58
  42. package/dist/types/sdk/accounts/bots/AccountBotsService.d.ts +38 -0
  43. package/dist/types/sdk/accounts/bots/PeripheryCompressorV310Contract.d.ts +236 -0
  44. package/dist/types/sdk/accounts/bots/abi.d.ts +18 -0
  45. package/dist/types/sdk/accounts/bots/index.d.ts +4 -0
  46. package/dist/types/sdk/accounts/bots/types.d.ts +143 -0
  47. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +60 -0
  48. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.d.ts +879 -0
  49. package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +4 -0
  50. package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +164 -0
  51. package/dist/types/sdk/accounts/index.d.ts +11 -3
  52. package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +2 -2
  53. package/dist/types/sdk/accounts/liquidations/types.d.ts +1 -1
  54. package/dist/types/sdk/accounts/types.d.ts +13 -194
  55. package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
  56. package/dist/types/sdk/base/index.d.ts +2 -2
  57. package/dist/types/sdk/base/types.d.ts +6 -1
  58. package/dist/types/sdk/index.d.ts +11 -5
  59. package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +1 -1
  60. package/dist/types/sdk/market/MarketSuite.d.ts +1 -1
  61. package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +1 -1
  62. package/dist/types/sdk/market/credit/CreditSuite.d.ts +26 -1
  63. package/dist/types/sdk/market/credit/types.d.ts +1 -1
  64. package/dist/types/sdk/market/index.d.ts +2 -2
  65. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +16 -5
  66. package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +0 -11
  67. package/dist/types/sdk/market/oracle/index.d.ts +2 -2
  68. package/dist/types/sdk/market/oracle/types.d.ts +31 -15
  69. package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +1 -1
  70. package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +1 -1
  71. package/dist/types/sdk/market/pool/PoolSuite.d.ts +1 -1
  72. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +1 -1
  73. package/dist/types/sdk/market/pool/types.d.ts +1 -1
  74. package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +1 -1
  75. package/dist/types/sdk/market/pricefeeds/types.d.ts +1 -1
  76. package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +2 -2
  77. package/dist/types/sdk/pools/types.d.ts +1 -1
  78. package/dist/types/sdk/positions/MultichainPositionsService.d.ts +2 -2
  79. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps } from "./types.js";
2
+ import { CreditAccountCompressor } from "./CreditAccountCompressor.js";
3
+ import { CreditAccountCompressorV310Contract } from "./CreditAccountCompressorV310Contract.js";
4
+ export { CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps };
@@ -0,0 +1,164 @@
1
+ import { creditAccountCompressorAbi } from "../../../abi/compressors/creditAccountCompressor.js";
2
+ import { IPriceUpdateTx } from "../../types/transactions.js";
3
+ import "../../types/index.js";
4
+ import { Address, ContractFunctionArgs, ContractFunctionParameters } from "viem";
5
+ //#region src/sdk/accounts/credit-account-compressor/types.d.ts
6
+ /**
7
+ * @internal
8
+ * Arguments tuple for the credit account compressor's `getCreditAccounts` view method.
9
+ **/
10
+ type GetCreditAccountsArgs = ContractFunctionArgs<typeof creditAccountCompressorAbi, "pure" | "view", "getCreditAccounts">;
11
+ /**
12
+ * @internal
13
+ * Descriptor of a `getCreditAccountData` call, so that it can be batched with
14
+ * calls to other contracts.
15
+ **/
16
+ type CreditAccountDataCall = ContractFunctionParameters<typeof creditAccountCompressorAbi, "pure" | "view", "getCreditAccountData">;
17
+ /**
18
+ * @internal
19
+ * Descriptor of a `getCreditAccounts` call, so that it can be batched with
20
+ * calls to other contracts.
21
+ **/
22
+ type CreditAccountsCall = ContractFunctionParameters<typeof creditAccountCompressorAbi, "pure" | "view", "getCreditAccounts">;
23
+ /**
24
+ * @internal
25
+ * Filtering criteria applied to individual credit accounts when querying the compressor.
26
+ **/
27
+ interface CreditAccountFilter {
28
+ /**
29
+ * Filter by account owner address.
30
+ **/
31
+ owner: Address;
32
+ /**
33
+ * Whether to include accounts with zero outstanding debt.
34
+ **/
35
+ includeZeroDebt: boolean;
36
+ /**
37
+ * Minimum health factor threshold (inclusive).
38
+ * 18 digits precision (10^18 = 1)
39
+ **/
40
+ minHealthFactor: bigint;
41
+ /**
42
+ * Maximum health factor threshold (inclusive).
43
+ * 18 digits precision (10^18 = 1)
44
+ **/
45
+ maxHealthFactor: bigint;
46
+ /**
47
+ * Whether to return only accounts whose health computation reverts.
48
+ **/
49
+ reverting: boolean;
50
+ }
51
+ /**
52
+ * @internal
53
+ * Filtering criteria to select which credit managers to query.
54
+ **/
55
+ interface CreditManagerFilter {
56
+ /**
57
+ * Only include credit managers owned by these market configurators.
58
+ **/
59
+ configurators: readonly Address[];
60
+ /**
61
+ * Only include these specific credit manager addresses.
62
+ **/
63
+ creditManagers: readonly Address[];
64
+ /**
65
+ * Only include credit managers linked to these pool addresses.
66
+ **/
67
+ pools: readonly Address[];
68
+ /**
69
+ * Only include credit managers with this underlying token.
70
+ **/
71
+ underlying: Address;
72
+ }
73
+ /**
74
+ * @internal
75
+ * Credit managers a compressor query runs over: either one credit manager
76
+ * address, or a filter matching many of them.
77
+ **/
78
+ type CreditAccountsTarget = Address | CreditManagerFilter;
79
+ /**
80
+ * @internal
81
+ * Account-level criteria of a compressor query, without `reverting`: the
82
+ * compressor treats that flag as exclusive, so a full query has to run both
83
+ * passes and callers do not choose one.
84
+ **/
85
+ type CreditAccountsQuery = Omit<CreditAccountFilter, "reverting">;
86
+ /**
87
+ * @internal
88
+ * Common options of a credit account compressor read.
89
+ **/
90
+ interface CreditAccountReadOptions {
91
+ /**
92
+ * Block to read at. Defaults to the latest block.
93
+ **/
94
+ blockNumber?: bigint;
95
+ /**
96
+ * Price feed update transactions to execute before the read, so that
97
+ * accounts holding tokens with on-demand price feeds can be valued.
98
+ **/
99
+ priceUpdateTxs?: IPriceUpdateTx[];
100
+ }
101
+ /**
102
+ * @internal
103
+ * Options of a paginated credit account compressor read.
104
+ **/
105
+ interface CreditAccountsReadOptions extends CreditAccountReadOptions {
106
+ /**
107
+ * Maximum number of accounts to fetch per call. When set, accounts are
108
+ * loaded in pages of this size until all are fetched.
109
+ *
110
+ * @default undefined - no limit, the compressor returns as many accounts as
111
+ * it can per call
112
+ **/
113
+ batchSize?: bigint;
114
+ }
115
+ /**
116
+ * Options for fetching credit accounts, allowing filtering by credit manager, owner, and health factor range.
117
+ **/
118
+ interface GetCreditAccountsOptions {
119
+ /**
120
+ * If set, only return accounts from this credit manager; otherwise query all attached markets.
121
+ **/
122
+ creditManager?: Address;
123
+ /**
124
+ * If set, only return accounts owned by this address.
125
+ **/
126
+ owner?: Address;
127
+ /**
128
+ * Whether to include accounts with zero outstanding debt.
129
+ * @default false
130
+ **/
131
+ includeZeroDebt?: boolean;
132
+ /**
133
+ * Minimum health factor threshold (inclusive).
134
+ * 18 digits precision (10^18 = 1)
135
+ * @default 0n
136
+ **/
137
+ minHealthFactor?: bigint;
138
+ /**
139
+ * Maximum health factor threshold (inclusive).
140
+ * 18 digits precision (10^18 = 1)
141
+ * @default MAX_UINT256
142
+ **/
143
+ maxHealthFactor?: bigint;
144
+ /**
145
+ * If true, exclude reserve price feed updates from the query.
146
+ **/
147
+ ignoreReservePrices?: boolean;
148
+ }
149
+ /**
150
+ * Props for {@link CreditAccountCompressor.listPositions}.
151
+ **/
152
+ interface ListStrategyPositionsProps {
153
+ /**
154
+ * Wallet whose credit accounts to describe. RWA accounts are resolved from
155
+ * the investor EOA, see {@link CreditAccountCompressor.getBorrowerCreditAccounts}.
156
+ **/
157
+ owner: Address;
158
+ /**
159
+ * Whether to include accounts that carry no debt.
160
+ **/
161
+ includeZeroDebt: boolean;
162
+ }
163
+ //#endregion
164
+ export { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps };
@@ -1,4 +1,8 @@
1
1
  import { ClaimableWithdrawal, CurrentWithdrawals, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, PendingWithdrawal, RedemptionLog, RequestableWithdrawal, WithdrawableAsset, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, toWithdrawalStatus } from "./withdrawal-compressor/types.js";
2
+ import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
3
+ import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
4
+ import { CreditAccountCompressorV310Contract } from "./credit-account-compressor/CreditAccountCompressorV310Contract.js";
5
+ import "./credit-account-compressor/index.js";
2
6
  import { AbstractWithdrawalCompressorContract, OnchainRequestableWithdrawal, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./withdrawal-compressor/AbstractWithdrawalCompressorContract.js";
3
7
  import { WithdrawalCompressorLocation, WithdrawalCompressorVersion, getWithdrawalCompressorAddress } from "./withdrawal-compressor/addresses.js";
4
8
  import { createRedemptionLogger } from "./withdrawal-compressor/createRedemptionLogger.js";
@@ -10,8 +14,12 @@ import { WithdrawalCompressorV310Contract } from "./withdrawal-compressor/Withdr
10
14
  import { WithdrawalCompressorV311Contract } from "./withdrawal-compressor/WithdrawalCompressorV311Contract.js";
11
15
  import { WithdrawalCompressorV313Contract } from "./withdrawal-compressor/WithdrawalCompressorV313Contract.js";
12
16
  import "./withdrawal-compressor/index.js";
13
- import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CloseCreditAccountResult, CreditAccountFilter, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerFilter, CreditManagerOperationResult, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps } from "./types.js";
14
- import { CreditAccountServiceOptions, CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
17
+ import { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditManagerOperationResult, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards } from "./types.js";
18
+ import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, SetBotProps, SetBotResult } from "./bots/types.js";
19
+ import { AccountBotsService } from "./bots/AccountBotsService.js";
20
+ import { PeripheryCompressorV310Contract } from "./bots/PeripheryCompressorV310Contract.js";
21
+ import "./bots/index.js";
22
+ import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
15
23
  import { CreditAccountSlice, IntentPreviewResult } from "./intents/types.js";
16
24
  import { primaryInstantOutput } from "./intents/operations/claim-delayed/index.js";
17
25
  import { CreditAccountOperationsService } from "./intents/index.js";
@@ -20,4 +28,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
20
28
  import { LiquidationsService } from "./liquidations/LiquidationsService.js";
21
29
  import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
22
30
  import "./liquidations/index.js";
23
- export { AbstractWithdrawalCompressorContract, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountServiceOptions, type CreditAccountSlice, CreditAccountTokensSlice, CreditAccountsServiceV310, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, ListStrategyPositionsProps, LoadRWALiquidatorsProps, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, Rewards, SetBotProps, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
31
+ export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, ListStrategyPositionsProps, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PeripheryCompressorV310Contract, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, Rewards, SetBotProps, SetBotResult, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
@@ -1,9 +1,9 @@
1
1
  import { TxCall } from "../../../model/primitives.js";
2
- import { LiquidatableAccount, LiquidationDetails, LiquidationPosition } from "../../../model/liquidations.js";
3
- import "../../../model/index.js";
4
2
  import { MultichainResult } from "../../types/multichain.js";
5
3
  import { PluginsMap } from "../../plugins/types.js";
6
4
  import "../../plugins/index.js";
5
+ import { LiquidatableAccount, LiquidationDetails, LiquidationPosition } from "../../../model/liquidations.js";
6
+ import "../../../model/index.js";
7
7
  import "../../types/index.js";
8
8
  import { MultichainConstruct } from "../../base/MultichainConstruct.js";
9
9
  import "../../base/index.js";
@@ -1,7 +1,7 @@
1
1
  import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
2
+ import { MultichainNetworkProps, MultichainNetworksProps, WithMultichain } from "../../types/multichain.js";
2
3
  import { LiquidatableAccountFilter } from "../../../model/liquidations.js";
3
4
  import "../../../model/index.js";
4
- import { MultichainNetworkProps, MultichainNetworksProps, WithMultichain } from "../../types/multichain.js";
5
5
  import "../../types/index.js";
6
6
  import { Address, ContractFunctionReturnType } from "viem";
7
7
  //#region src/sdk/accounts/liquidations/types.d.ts
@@ -1,12 +1,13 @@
1
- import { creditAccountCompressorAbi } from "../../abi/compressors/creditAccountCompressor.js";
1
+ import { ClaimableWithdrawal, DelayedIntent, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/types.js";
2
+ import { Asset, CreditAccountData, CreditAccountTokensSlice } from "../base/types.js";
2
3
  import { StrategyPosition } from "../../model/positions.js";
3
4
  import "../../model/index.js";
4
- import { ClaimableWithdrawal, DelayedIntent, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/types.js";
5
- import { Asset, ConnectedBotData, CreditAccountData } from "../base/types.js";
6
5
  import { RWAOpenAccountRequirements, RWAOperationArgs } from "../market/rwa/types.js";
7
6
  import "../market/rwa/index.js";
8
7
  import { RouterCASlice, RouterCloseResult } from "../router/types.js";
9
8
  import "../router/index.js";
9
+ import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
10
+ import "./credit-account-compressor/index.js";
10
11
  import "./withdrawal-compressor/index.js";
11
12
  import { PriceUpdate } from "../market/pricefeeds/types.js";
12
13
  import { PartialLiquidationParams } from "../market/credit/types.js";
@@ -17,116 +18,10 @@ import { OnchainSDK } from "../OnchainSDK.js";
17
18
  import { Construct } from "../base/Construct.js";
18
19
  import "../types/index.js";
19
20
  import "../base/index.js";
20
- import { Address, ContractFunctionArgs, Hex } from "viem";
21
+ import { AccountBotsService } from "./bots/AccountBotsService.js";
22
+ import "./bots/index.js";
23
+ import { Address, Hex } from "viem";
21
24
  //#region src/sdk/accounts/types.d.ts
22
- /**
23
- * @internal
24
- * Arguments tuple for the credit account compressor's `getCreditAccounts` view method.
25
- **/
26
- type GetCreditAccountsArgs = ContractFunctionArgs<typeof creditAccountCompressorAbi, "pure" | "view", "getCreditAccounts">;
27
- /**
28
- * @internal
29
- * Filtering criteria applied to individual credit accounts when querying the compressor.
30
- **/
31
- interface CreditAccountFilter {
32
- /**
33
- * Filter by account owner address.
34
- **/
35
- owner: Address;
36
- /**
37
- * Whether to include accounts with zero outstanding debt.
38
- **/
39
- includeZeroDebt: boolean;
40
- /**
41
- * Minimum health factor threshold (inclusive).
42
- * 18 digits precision (10^18 = 1)
43
- **/
44
- minHealthFactor: bigint;
45
- /**
46
- * Maximum health factor threshold (inclusive).
47
- * 18 digits precision (10^18 = 1)
48
- **/
49
- maxHealthFactor: bigint;
50
- /**
51
- * Whether to return only accounts whose health computation reverts.
52
- **/
53
- reverting: boolean;
54
- }
55
- /**
56
- * @internal
57
- * Filtering criteria to select which credit managers to query.
58
- **/
59
- interface CreditManagerFilter {
60
- /**
61
- * Only include credit managers owned by these market configurators.
62
- **/
63
- configurators: readonly Address[];
64
- /**
65
- * Only include these specific credit manager addresses.
66
- **/
67
- creditManagers: readonly Address[];
68
- /**
69
- * Only include credit managers linked to these pool addresses.
70
- **/
71
- pools: readonly Address[];
72
- /**
73
- * Only include credit managers with this underlying token.
74
- **/
75
- underlying: Address;
76
- }
77
- /**
78
- * Options for fetching credit accounts, allowing filtering by credit manager, owner, and health factor range.
79
- **/
80
- interface GetCreditAccountsOptions {
81
- /**
82
- * If set, only return accounts from this credit manager; otherwise query all attached markets.
83
- **/
84
- creditManager?: Address;
85
- /**
86
- * If set, only return accounts owned by this address.
87
- **/
88
- owner?: Address;
89
- /**
90
- * Whether to include accounts with zero outstanding debt.
91
- * @default false
92
- **/
93
- includeZeroDebt?: boolean;
94
- /**
95
- * Minimum health factor threshold (inclusive).
96
- * 18 digits precision (10^18 = 1)
97
- * @default 0n
98
- **/
99
- minHealthFactor?: bigint;
100
- /**
101
- * Maximum health factor threshold (inclusive).
102
- * 18 digits precision (10^18 = 1)
103
- * @default MAX_UINT256
104
- **/
105
- maxHealthFactor?: bigint;
106
- /**
107
- * If true, exclude reserve price feed updates from the query.
108
- **/
109
- ignoreReservePrices?: boolean;
110
- }
111
- /**
112
- * Props for {@link ICreditAccountsService.listPositions}.
113
- **/
114
- interface ListStrategyPositionsProps {
115
- /**
116
- * Wallet whose credit accounts to describe. RWA accounts are resolved from
117
- * the investor EOA, see {@link ICreditAccountsService.getBorrowerCreditAccounts}.
118
- **/
119
- owner: Address;
120
- /**
121
- * Whether to include accounts that carry no debt.
122
- **/
123
- includeZeroDebt: boolean;
124
- }
125
- /**
126
- * Lightweight slice of credit-account data containing only token
127
- * balances and the enabled-tokens bitmask.
128
- **/
129
- type CreditAccountTokensSlice = Pick<CreditAccountData, "creditManager" | "creditAccount" | "tokens" | "enabledTokensMask">;
130
25
  /**
131
26
  * Result of closing or liquidating a credit account, including the router's optimal close path.
132
27
  **/
@@ -230,19 +125,6 @@ interface PrepareUpdateQuotasProps {
230
125
  */
231
126
  minQuota: Array<Asset>;
232
127
  }
233
- /**
234
- * Credit account and credit manager address pair, used for batch queries such as connected bot lookups.
235
- **/
236
- type AccountToCheck = {
237
- /**
238
- * Address of the credit account.
239
- **/
240
- creditAccount: Address;
241
- /**
242
- * Address of the credit manager that manages this account.
243
- **/
244
- creditManager: Address;
245
- };
246
128
  interface PreviewDelayedWithdrawalProps {
247
129
  /**
248
130
  * Amount of source token (ex. cp0xlrt)
@@ -503,56 +385,6 @@ interface GetOpenAccountRequirementsProps {
503
385
  */
504
386
  tokenOutAddress: Address;
505
387
  }
506
- interface CMSlice {
507
- creditManager: Address;
508
- creditFacade: Address;
509
- type: "creditManager";
510
- }
511
- interface SetBotProps {
512
- /**
513
- * Address of a bot that is being updated
514
- */
515
- botAddress: Address;
516
- /**
517
- * Permissions to set for the bot
518
- */
519
- permissions: bigint | null;
520
- /**
521
- * Minimal credit account data {@link RouterCASlice} on which operation is performed; if omitted, credit manager data is used
522
- * Minimal credit manager data {@link CMSlice} on which operation is performed; used only if credit account is omitted
523
- * At least one of credit account or credit manager must be provided
524
- */
525
- targetContract: (RouterCASlice & {
526
- type: "creditAccount";
527
- }) | CMSlice;
528
- }
529
- /**
530
- * Multicall result of querying connected bots across multiple credit accounts.
531
- **/
532
- type GetConnectedBotsResult = Array<{
533
- error?: undefined;
534
- result: readonly ConnectedBotData[];
535
- status: "success";
536
- } | {
537
- error: Error;
538
- result?: undefined;
539
- status: "failure";
540
- }>;
541
- /**
542
- * Result of querying a migration bot's status across credit accounts, or `undefined` if no migration bot was provided.
543
- **/
544
- type GetConnectedMigrationBotsResult = {
545
- result: ({
546
- error: Error;
547
- result?: undefined;
548
- status: "failure";
549
- } | {
550
- error?: undefined;
551
- result: readonly [bigint, boolean, boolean] | readonly [bigint, boolean];
552
- status: "success";
553
- })[];
554
- botAddress: Address;
555
- } | undefined;
556
388
  /**
557
389
  * Options to get approval address for collateral token
558
390
  */
@@ -609,6 +441,11 @@ type AssembleCaOperationsProps = {
609
441
  };
610
442
  interface ICreditAccountsService extends Construct {
611
443
  sdk: OnchainSDK;
444
+ /**
445
+ * Bots connected to credit accounts: which ones are active, with which
446
+ * permissions, and how to connect or disconnect them.
447
+ */
448
+ readonly bots: AccountBotsService;
612
449
  /**
613
450
  * Returns single credit account data with investor resolved, or undefined
614
451
  * if the account is not found.
@@ -653,24 +490,6 @@ interface ICreditAccountsService extends Construct {
653
490
  * @returns {Array<Rewards>} list of {@link Rewards} that can be claimed
654
491
  */
655
492
  getRewards(creditAccount: Address): Promise<Array<Rewards>>;
656
- /**
657
- * Method to get all connected bots for credit account
658
- * @param {Array<AccountToCheck>} accountsToCheck - list of credit accounts
659
- * @param {Address | undefined} legacyMigrationBot - address of the bot to check connected bots on
660
- * and their credit managers to check connected bots on
661
- * @returns call result of getConnectedBots for each credit account
662
- */
663
- getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<{
664
- legacy: GetConnectedBotsResult;
665
- legacyMigration: GetConnectedMigrationBotsResult;
666
- additionalBots: Array<Omit<NonNullable<GetConnectedMigrationBotsResult>, "botAddress">>;
667
- }>;
668
- /**
669
- * Connects/disables a bot and updates prices
670
- * @param props - {@link SetBotProps}
671
- * @return All necessary data to execute the transaction (call, credit facade)
672
- */
673
- setBot: (props: SetBotProps) => Promise<CreditAccountOperationResult | CreditManagerOperationResult>;
674
493
  /**
675
494
  * Generates transaction to liquidate credit account
676
495
  * @param props - {@link FullyLiquidateProps}
@@ -918,4 +737,4 @@ interface ICreditAccountsService extends Construct {
918
737
  claimFarmRewards(props: ClaimFarmRewardsProps): Promise<RawTx>;
919
738
  }
920
739
  //#endregion
921
- export { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CloseCreditAccountResult, CreditAccountFilter, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerFilter, CreditManagerOperationResult, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps };
740
+ export { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditManagerOperationResult, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards };
@@ -1,5 +1,5 @@
1
- import { Token } from "../../model/primitives.js";
2
1
  import { ILogger } from "../types/logger.js";
2
+ import { Token } from "../../model/primitives.js";
3
3
  import { AddressMap } from "../utils/AddressMap.js";
4
4
  import { Asset } from "./types.js";
5
5
  import "../utils/index.js";
@@ -1,4 +1,4 @@
1
- import { AdapterData, AssertAssignable, Asset, BaseParams, BaseState, ConnectedBotData, CreditAccountData, CreditAccountDataPayload, CreditConfiguratorState, CreditFacadeState, CreditManagerDebtParams, CreditManagerState, CreditSuiteState, GaugeData, IBaseContract, MarketData, MarketFilter, ParsedCall, ParsedCallArgs, ParsedCallV2, PoolState, PriceFeedAnswer, PriceFeedMapEntry, PriceFeedTreeNode, PriceOracleData, QuotaKeeperState, QuotaState, RateKeeperState, RelaxedBaseParams, RewardInfo, TokenInfo, Unarray, VotingContractStatus } from "./types.js";
1
+ import { AdapterData, AssertAssignable, Asset, BaseParams, BaseState, ConnectedBotData, CreditAccountData, CreditAccountDataPayload, CreditAccountTokensSlice, CreditConfiguratorState, CreditFacadeState, CreditManagerDebtParams, CreditManagerState, CreditSuiteState, GaugeData, IBaseContract, MarketData, MarketFilter, ParsedCall, ParsedCallArgs, ParsedCallV2, PoolState, PriceFeedAnswer, PriceFeedMapEntry, PriceFeedTreeNode, PriceOracleData, QuotaKeeperState, QuotaState, RateKeeperState, RelaxedBaseParams, RewardInfo, TokenInfo, Unarray, VotingContractStatus } from "./types.js";
2
2
  import { LPMonopolizedPoolMeta, PHANTOM_TOKEN_CONTRACT_TYPES, PhantomTokenContractType, PhantomTokenMeta, RWADefaultTokenMeta, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWATokenMeta, RWAUnderlyingContractType, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, SimpleTokenMeta, TokenMetaData } from "./token-types.js";
3
3
  import { FormatBNOptions, TokensMeta } from "./TokensMeta.js";
4
4
  import { ChainContractsRegister, ContractOrInterface } from "./ChainContractsRegister.js";
@@ -8,4 +8,4 @@ import { MissingSerializedParamsError } from "./errors.js";
8
8
  import { ChainQueryProps, MultichainConstruct } from "./MultichainConstruct.js";
9
9
  import { PlaceholderContract } from "./PlaceholderContract.js";
10
10
  import { SDKConstruct } from "./SDKConstruct.js";
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 };
11
+ export { AdapterData, AssertAssignable, Asset, BaseContract, BaseContractArgs, BaseParams, BaseState, ChainContractsRegister, ChainQueryProps, ConnectedBotData, Construct, ConstructOptions, ContractOrInterface, ContractParseError, ContractParseErrorOptions, CreditAccountData, CreditAccountDataPayload, CreditAccountTokensSlice, 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 };
@@ -210,6 +210,11 @@ type CreditAccountData<WithInvestor extends boolean = false> = WithInvestor exte
210
210
  **/
211
211
  investor: Address | undefined;
212
212
  } : CreditAccountDataPayload;
213
+ /**
214
+ * Lightweight slice of credit-account data: everything needed to tell which
215
+ * tokens of an account have to be priced.
216
+ **/
217
+ type CreditAccountTokensSlice = Pick<CreditAccountDataPayload, "creditManager" | "creditAccount" | "underlying" | "tokens" | "enabledTokensMask">;
213
218
  /**
214
219
  * Reward distribution details for a single reward token.
215
220
  **/
@@ -440,4 +445,4 @@ interface IBaseContract {
440
445
  parseFunctionDataV2: (calldata: Hex, strict?: boolean) => ParsedCallV2;
441
446
  }
442
447
  //#endregion
443
- export { AdapterData, AssertAssignable, Asset, BaseParams, BaseState, ConnectedBotData, CreditAccountData, CreditAccountDataPayload, CreditConfiguratorState, CreditFacadeState, CreditManagerDebtParams, CreditManagerState, CreditSuiteState, GaugeData, IBaseContract, MarketData, MarketFilter, ParsedCall, ParsedCallArgs, ParsedCallV2, PoolState, PriceFeedAnswer, PriceFeedMapEntry, PriceFeedTreeNode, PriceOracleData, QuotaKeeperState, QuotaState, RateKeeperState, RelaxedBaseParams, RewardInfo, TokenInfo, Unarray, VotingContractStatus };
448
+ export { AdapterData, AssertAssignable, Asset, BaseParams, BaseState, ConnectedBotData, CreditAccountData, CreditAccountDataPayload, CreditAccountTokensSlice, CreditConfiguratorState, CreditFacadeState, CreditManagerDebtParams, CreditManagerState, CreditSuiteState, GaugeData, IBaseContract, MarketData, MarketFilter, ParsedCall, ParsedCallArgs, ParsedCallV2, PoolState, PriceFeedAnswer, PriceFeedMapEntry, PriceFeedTreeNode, PriceOracleData, QuotaKeeperState, QuotaState, RateKeeperState, RelaxedBaseParams, RewardInfo, TokenInfo, Unarray, VotingContractStatus };