@gearbox-protocol/sdk 14.12.0-next.75 → 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 (54) hide show
  1. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +13 -140
  2. package/dist/cjs/sdk/accounts/bots/AccountBotsService.js +132 -0
  3. package/dist/cjs/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
  4. package/dist/cjs/sdk/accounts/bots/abi.js +19 -0
  5. package/dist/cjs/sdk/accounts/bots/index.js +6 -0
  6. package/dist/cjs/sdk/accounts/bots/types.js +1 -0
  7. package/dist/cjs/sdk/accounts/index.js +5 -0
  8. package/dist/cjs/sdk/index.js +4 -0
  9. package/dist/cjs/sdk/market/ZapperRegister.js +1 -1
  10. package/dist/cjs/sdk/market/credit/CreditSuite.js +31 -0
  11. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +15 -142
  12. package/dist/esm/sdk/accounts/bots/AccountBotsService.js +131 -0
  13. package/dist/esm/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
  14. package/dist/esm/sdk/accounts/bots/abi.js +18 -0
  15. package/dist/esm/sdk/accounts/bots/index.js +4 -0
  16. package/dist/esm/sdk/accounts/bots/types.js +1 -0
  17. package/dist/esm/sdk/accounts/index.js +4 -1
  18. package/dist/esm/sdk/index.js +3 -1
  19. package/dist/esm/sdk/market/ZapperRegister.js +1 -1
  20. package/dist/esm/sdk/market/credit/CreditSuite.js +31 -0
  21. package/dist/types/new-sdk/AbstractNamespace.d.ts +2 -2
  22. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  23. package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +1 -1
  24. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +9 -16
  25. package/dist/types/sdk/accounts/bots/AccountBotsService.d.ts +38 -0
  26. package/dist/types/sdk/accounts/bots/PeripheryCompressorV310Contract.d.ts +236 -0
  27. package/dist/types/sdk/accounts/bots/abi.d.ts +18 -0
  28. package/dist/types/sdk/accounts/bots/index.d.ts +4 -0
  29. package/dist/types/sdk/accounts/bots/types.d.ts +143 -0
  30. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +1 -1
  31. package/dist/types/sdk/accounts/index.d.ts +6 -2
  32. package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +2 -2
  33. package/dist/types/sdk/accounts/liquidations/types.d.ts +1 -1
  34. package/dist/types/sdk/accounts/types.d.ts +10 -84
  35. package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
  36. package/dist/types/sdk/index.d.ts +5 -2
  37. package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +1 -1
  38. package/dist/types/sdk/market/MarketSuite.d.ts +1 -1
  39. package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +1 -1
  40. package/dist/types/sdk/market/credit/CreditSuite.d.ts +26 -1
  41. package/dist/types/sdk/market/credit/types.d.ts +1 -1
  42. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +2 -2
  43. package/dist/types/sdk/market/oracle/types.d.ts +2 -2
  44. package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +1 -1
  45. package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +1 -1
  46. package/dist/types/sdk/market/pool/PoolSuite.d.ts +1 -1
  47. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +1 -1
  48. package/dist/types/sdk/market/pool/types.d.ts +1 -1
  49. package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +1 -1
  50. package/dist/types/sdk/market/pricefeeds/types.d.ts +1 -1
  51. package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +2 -2
  52. package/dist/types/sdk/pools/types.d.ts +1 -1
  53. package/dist/types/sdk/positions/MultichainPositionsService.d.ts +2 -2
  54. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ import { SDKConstruct } from "../../base/SDKConstruct.js";
2
+ import "../../base/index.js";
3
+ import { AccountToCheck, GetConnectedBotsResponse, SetBotProps, SetBotResult } from "./types.js";
4
+ import { Address } from "viem";
5
+ //#region src/sdk/accounts/bots/AccountBotsService.d.ts
6
+ /**
7
+ * Bots of credit accounts.
8
+ *
9
+ * Reads which bots are connected to an account and with which permissions,
10
+ * and builds the transactions that connect or disconnect one.
11
+ **/
12
+ declare class AccountBotsService extends SDKConstruct {
13
+ #private;
14
+ /**
15
+ * Reads the bots connected to each of the given credit accounts.
16
+ *
17
+ * All reads go out as a single multicall, split into three groups: the
18
+ * periphery compressor's view of each account, the status of the legacy
19
+ * migration bot on each account, and the status of every bot in
20
+ * `additionalBots` on every account.
21
+ *
22
+ * @param accountsToCheck - Accounts to read, with their credit managers.
23
+ * @param legacyMigrationBot - Legacy migration bot to check, if any.
24
+ * @param additionalBots - Bots to check on every account.
25
+ **/
26
+ getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<GetConnectedBotsResponse>;
27
+ /**
28
+ * Connects or disconnects a bot, and updates prices when the bot is set on a
29
+ * credit account.
30
+ *
31
+ * @param props - {@link SetBotProps}
32
+ * @returns Everything needed to execute the operation. Setting a bot on a
33
+ * credit manager only yields calls, since it is not a standalone transaction.
34
+ **/
35
+ setBot({ botAddress, permissions: defaultPermissions, targetContract }: SetBotProps): Promise<SetBotResult>;
36
+ }
37
+ //#endregion
38
+ export { AccountBotsService };
@@ -0,0 +1,236 @@
1
+ import { OnchainSDK } from "../../OnchainSDK.js";
2
+ import { BaseContract } from "../../base/BaseContract.js";
3
+ import "../../base/index.js";
4
+ import { ConnectedBotsCall } from "./types.js";
5
+ import { Address } from "viem";
6
+ //#region src/sdk/accounts/bots/PeripheryCompressorV310Contract.d.ts
7
+ declare const abi: readonly [{
8
+ readonly type: "constructor";
9
+ readonly inputs: readonly [{
10
+ readonly name: "addressProvider_";
11
+ readonly type: "address";
12
+ readonly internalType: "address";
13
+ }];
14
+ readonly stateMutability: "nonpayable";
15
+ }, {
16
+ readonly type: "function";
17
+ readonly name: "addressProvider";
18
+ readonly inputs: readonly [];
19
+ readonly outputs: readonly [{
20
+ readonly name: "";
21
+ readonly type: "address";
22
+ readonly internalType: "address";
23
+ }];
24
+ readonly stateMutability: "view";
25
+ }, {
26
+ readonly type: "function";
27
+ readonly name: "contractType";
28
+ readonly inputs: readonly [];
29
+ readonly outputs: readonly [{
30
+ readonly name: "";
31
+ readonly type: "bytes32";
32
+ readonly internalType: "bytes32";
33
+ }];
34
+ readonly stateMutability: "view";
35
+ }, {
36
+ readonly type: "function";
37
+ readonly name: "getBots";
38
+ readonly inputs: readonly [{
39
+ readonly name: "marketConfigurator";
40
+ readonly type: "address";
41
+ readonly internalType: "address";
42
+ }];
43
+ readonly outputs: readonly [{
44
+ readonly name: "botStates";
45
+ readonly type: "tuple[]";
46
+ readonly internalType: "struct BotState[]";
47
+ readonly components: readonly [{
48
+ readonly name: "baseParams";
49
+ readonly type: "tuple";
50
+ readonly internalType: "struct BaseParams";
51
+ readonly components: readonly [{
52
+ readonly name: "addr";
53
+ readonly type: "address";
54
+ readonly internalType: "address";
55
+ }, {
56
+ readonly name: "version";
57
+ readonly type: "uint256";
58
+ readonly internalType: "uint256";
59
+ }, {
60
+ readonly name: "contractType";
61
+ readonly type: "bytes32";
62
+ readonly internalType: "bytes32";
63
+ }, {
64
+ readonly name: "serializedParams";
65
+ readonly type: "bytes";
66
+ readonly internalType: "bytes";
67
+ }];
68
+ }, {
69
+ readonly name: "requiredPermissions";
70
+ readonly type: "uint192";
71
+ readonly internalType: "uint192";
72
+ }];
73
+ }];
74
+ readonly stateMutability: "view";
75
+ }, {
76
+ readonly type: "function";
77
+ readonly name: "getConnectedBots";
78
+ readonly inputs: readonly [{
79
+ readonly name: "marketConfigurator";
80
+ readonly type: "address";
81
+ readonly internalType: "address";
82
+ }, {
83
+ readonly name: "creditAccount";
84
+ readonly type: "address";
85
+ readonly internalType: "address";
86
+ }];
87
+ readonly outputs: readonly [{
88
+ readonly name: "botStates";
89
+ readonly type: "tuple[]";
90
+ readonly internalType: "struct ConnectedBotState[]";
91
+ readonly components: readonly [{
92
+ readonly name: "baseParams";
93
+ readonly type: "tuple";
94
+ readonly internalType: "struct BaseParams";
95
+ readonly components: readonly [{
96
+ readonly name: "addr";
97
+ readonly type: "address";
98
+ readonly internalType: "address";
99
+ }, {
100
+ readonly name: "version";
101
+ readonly type: "uint256";
102
+ readonly internalType: "uint256";
103
+ }, {
104
+ readonly name: "contractType";
105
+ readonly type: "bytes32";
106
+ readonly internalType: "bytes32";
107
+ }, {
108
+ readonly name: "serializedParams";
109
+ readonly type: "bytes";
110
+ readonly internalType: "bytes";
111
+ }];
112
+ }, {
113
+ readonly name: "requiredPermissions";
114
+ readonly type: "uint192";
115
+ readonly internalType: "uint192";
116
+ }, {
117
+ readonly name: "creditAccount";
118
+ readonly type: "address";
119
+ readonly internalType: "address";
120
+ }, {
121
+ readonly name: "permissions";
122
+ readonly type: "uint192";
123
+ readonly internalType: "uint192";
124
+ }, {
125
+ readonly name: "forbidden";
126
+ readonly type: "bool";
127
+ readonly internalType: "bool";
128
+ }];
129
+ }];
130
+ readonly stateMutability: "view";
131
+ }, {
132
+ readonly type: "function";
133
+ readonly name: "getZappers";
134
+ readonly inputs: readonly [{
135
+ readonly name: "marketConfigurator";
136
+ readonly type: "address";
137
+ readonly internalType: "address";
138
+ }, {
139
+ readonly name: "pool";
140
+ readonly type: "address";
141
+ readonly internalType: "address";
142
+ }];
143
+ readonly outputs: readonly [{
144
+ readonly name: "zappers";
145
+ readonly type: "tuple[]";
146
+ readonly internalType: "struct ZapperState[]";
147
+ readonly components: readonly [{
148
+ readonly name: "baseParams";
149
+ readonly type: "tuple";
150
+ readonly internalType: "struct BaseParams";
151
+ readonly components: readonly [{
152
+ readonly name: "addr";
153
+ readonly type: "address";
154
+ readonly internalType: "address";
155
+ }, {
156
+ readonly name: "version";
157
+ readonly type: "uint256";
158
+ readonly internalType: "uint256";
159
+ }, {
160
+ readonly name: "contractType";
161
+ readonly type: "bytes32";
162
+ readonly internalType: "bytes32";
163
+ }, {
164
+ readonly name: "serializedParams";
165
+ readonly type: "bytes";
166
+ readonly internalType: "bytes";
167
+ }];
168
+ }, {
169
+ readonly name: "tokenIn";
170
+ readonly type: "tuple";
171
+ readonly internalType: "struct TokenData";
172
+ readonly components: readonly [{
173
+ readonly name: "addr";
174
+ readonly type: "address";
175
+ readonly internalType: "address";
176
+ }, {
177
+ readonly name: "symbol";
178
+ readonly type: "string";
179
+ readonly internalType: "string";
180
+ }, {
181
+ readonly name: "name";
182
+ readonly type: "string";
183
+ readonly internalType: "string";
184
+ }, {
185
+ readonly name: "decimals";
186
+ readonly type: "uint8";
187
+ readonly internalType: "uint8";
188
+ }];
189
+ }, {
190
+ readonly name: "tokenOut";
191
+ readonly type: "tuple";
192
+ readonly internalType: "struct TokenData";
193
+ readonly components: readonly [{
194
+ readonly name: "addr";
195
+ readonly type: "address";
196
+ readonly internalType: "address";
197
+ }, {
198
+ readonly name: "symbol";
199
+ readonly type: "string";
200
+ readonly internalType: "string";
201
+ }, {
202
+ readonly name: "name";
203
+ readonly type: "string";
204
+ readonly internalType: "string";
205
+ }, {
206
+ readonly name: "decimals";
207
+ readonly type: "uint8";
208
+ readonly internalType: "uint8";
209
+ }];
210
+ }];
211
+ }];
212
+ readonly stateMutability: "view";
213
+ }, {
214
+ readonly type: "function";
215
+ readonly name: "version";
216
+ readonly inputs: readonly [];
217
+ readonly outputs: readonly [{
218
+ readonly name: "";
219
+ readonly type: "uint256";
220
+ readonly internalType: "uint256";
221
+ }];
222
+ readonly stateMutability: "view";
223
+ }];
224
+ type abi = typeof abi;
225
+ declare class PeripheryCompressorV310Contract extends BaseContract<abi> {
226
+ constructor(sdk: OnchainSDK, address: Address);
227
+ /**
228
+ * Descriptor of a `getConnectedBots` call on this compressor.
229
+ *
230
+ * @param marketConfigurator - Configurator that governs the account's market.
231
+ * @param creditAccount - Credit account to list the connected bots of.
232
+ **/
233
+ connectedBotsCall(marketConfigurator: Address, creditAccount: Address): ConnectedBotsCall;
234
+ }
235
+ //#endregion
236
+ export { PeripheryCompressorV310Contract };
@@ -0,0 +1,18 @@
1
+ //#region src/sdk/accounts/bots/abi.d.ts
2
+ /**
3
+ * Minimal bot interface: the permissions a bot needs to operate on a credit
4
+ * account, which the SDK reads when the caller does not specify them.
5
+ **/
6
+ declare const iBotAbi: readonly [{
7
+ readonly type: "function";
8
+ readonly name: "requiredPermissions";
9
+ readonly inputs: readonly [];
10
+ readonly outputs: readonly [{
11
+ readonly name: "";
12
+ readonly type: "uint192";
13
+ readonly internalType: "uint192";
14
+ }];
15
+ readonly stateMutability: "view";
16
+ }];
17
+ //#endregion
18
+ export { iBotAbi };
@@ -0,0 +1,4 @@
1
+ import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, SetBotProps, SetBotResult } from "./types.js";
2
+ import { AccountBotsService } from "./AccountBotsService.js";
3
+ import { PeripheryCompressorV310Contract } from "./PeripheryCompressorV310Contract.js";
4
+ export { AccountBotsService, AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, PeripheryCompressorV310Contract, SetBotProps, SetBotResult };
@@ -0,0 +1,143 @@
1
+ import { iBotListV310Abi } from "../../../abi/310/generated.js";
2
+ import { peripheryCompressorAbi } from "../../../abi/compressors/peripheryCompressor.js";
3
+ import { ConnectedBotData } from "../../base/types.js";
4
+ import { RouterCASlice } from "../../router/types.js";
5
+ import "../../router/index.js";
6
+ import { CreditAccountOperationResult, CreditManagerOperationResult } from "../types.js";
7
+ import "../../base/index.js";
8
+ import { Address, ContractFunctionParameters } from "viem";
9
+ //#region src/sdk/accounts/bots/types.d.ts
10
+ /**
11
+ * @internal
12
+ * Descriptor of a `getConnectedBots` call on the periphery compressor, so that
13
+ * it can be batched with calls to other contracts.
14
+ **/
15
+ type ConnectedBotsCall = ContractFunctionParameters<typeof peripheryCompressorAbi, "pure" | "view", "getConnectedBots">;
16
+ /**
17
+ * @internal
18
+ * Descriptor of a `getBotStatus` call on a bot list, so that it can be batched
19
+ * with calls to other contracts.
20
+ **/
21
+ type BotStatusCall = ContractFunctionParameters<typeof iBotListV310Abi, "pure" | "view", "getBotStatus">;
22
+ /**
23
+ * @internal
24
+ * Result of a `multicall` with `allowFailure: true`.
25
+ **/
26
+ type MulticallWithFailure<T> = ({
27
+ error?: undefined;
28
+ result: T;
29
+ status: "success";
30
+ } | {
31
+ error: Error;
32
+ result?: undefined;
33
+ status: "failure";
34
+ })[];
35
+ /**
36
+ * @internal
37
+ * Raw responses of a bot list's `getBotStatus`.
38
+ **/
39
+ type BotsDirectResponse = MulticallWithFailure<readonly [bigint, boolean, boolean] | readonly [bigint, boolean]>;
40
+ /**
41
+ * Credit account and credit manager address pair, used for batch queries such as connected bot lookups.
42
+ **/
43
+ type AccountToCheck = {
44
+ /**
45
+ * Address of the credit account.
46
+ **/
47
+ creditAccount: Address;
48
+ /**
49
+ * Address of the credit manager that manages this account.
50
+ **/
51
+ creditManager: Address;
52
+ };
53
+ /**
54
+ * Minimal credit manager data an operation can be performed on, when it does
55
+ * not target a specific credit account.
56
+ **/
57
+ interface CMSlice {
58
+ creditManager: Address;
59
+ creditFacade: Address;
60
+ type: "creditManager";
61
+ }
62
+ /**
63
+ * Props for {@link AccountBotsService.setBot}.
64
+ **/
65
+ interface SetBotProps {
66
+ /**
67
+ * Address of a bot that is being updated
68
+ */
69
+ botAddress: Address;
70
+ /**
71
+ * Permissions to set for the bot
72
+ */
73
+ permissions: bigint | null;
74
+ /**
75
+ * Minimal credit account data {@link RouterCASlice} on which operation is performed; if omitted, credit manager data is used
76
+ * Minimal credit manager data {@link CMSlice} on which operation is performed; used only if credit account is omitted
77
+ * At least one of credit account or credit manager must be provided
78
+ */
79
+ targetContract: (RouterCASlice & {
80
+ type: "creditAccount";
81
+ }) | CMSlice;
82
+ }
83
+ /**
84
+ * Multicall result of querying connected bots across multiple credit accounts.
85
+ **/
86
+ type GetConnectedBotsResult = Array<{
87
+ error?: undefined;
88
+ result: readonly ConnectedBotData[];
89
+ status: "success";
90
+ } | {
91
+ error: Error;
92
+ result?: undefined;
93
+ status: "failure";
94
+ }>;
95
+ /**
96
+ * Result of querying a migration bot's status across credit accounts, or `undefined` if no migration bot was provided.
97
+ **/
98
+ type GetConnectedMigrationBotsResult = {
99
+ result: ({
100
+ error: Error;
101
+ result?: undefined;
102
+ status: "failure";
103
+ } | {
104
+ error?: undefined;
105
+ result: readonly [bigint, boolean, boolean] | readonly [bigint, boolean];
106
+ status: "success";
107
+ })[];
108
+ botAddress: Address;
109
+ } | undefined;
110
+ /**
111
+ * Statuses of the queried bots on one credit account, in the order the bots
112
+ * were passed in.
113
+ **/
114
+ interface ConnectedBotsPerAccount {
115
+ result: BotsDirectResponse;
116
+ }
117
+ /**
118
+ * Result of {@link AccountBotsService.getConnectedBots}.
119
+ **/
120
+ interface GetConnectedBotsResponse {
121
+ /**
122
+ * Bots the periphery compressor reports for each checked account, in the
123
+ * order the accounts were passed in.
124
+ **/
125
+ legacy: GetConnectedBotsResult;
126
+ /**
127
+ * Status of the legacy migration bot on each checked account, or
128
+ * `undefined` when no migration bot was passed in.
129
+ **/
130
+ legacyMigration: GetConnectedMigrationBotsResult;
131
+ /**
132
+ * Statuses of the additionally requested bots, one entry per checked
133
+ * account.
134
+ **/
135
+ additionalBots: Array<ConnectedBotsPerAccount>;
136
+ }
137
+ /**
138
+ * Result of {@link AccountBotsService.setBot}: a full transaction when the bot
139
+ * is set on a credit account, calls only when it is set on a credit manager.
140
+ **/
141
+ type SetBotResult = CreditAccountOperationResult | CreditManagerOperationResult;
142
+ //#endregion
143
+ export { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, SetBotProps, SetBotResult };
@@ -1,6 +1,6 @@
1
+ import { CreditAccountData } from "../../base/types.js";
1
2
  import { StrategyPosition } from "../../../model/positions.js";
2
3
  import "../../../model/index.js";
3
- import { CreditAccountData } from "../../base/types.js";
4
4
  import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./types.js";
5
5
  import { SDKConstruct } from "../../base/SDKConstruct.js";
6
6
  import "../../base/index.js";
@@ -14,7 +14,11 @@ import { WithdrawalCompressorV310Contract } from "./withdrawal-compressor/Withdr
14
14
  import { WithdrawalCompressorV311Contract } from "./withdrawal-compressor/WithdrawalCompressorV311Contract.js";
15
15
  import { WithdrawalCompressorV313Contract } from "./withdrawal-compressor/WithdrawalCompressorV313Contract.js";
16
16
  import "./withdrawal-compressor/index.js";
17
- import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditManagerOperationResult, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps } from "./types.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";
18
22
  import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
19
23
  import { CreditAccountSlice, IntentPreviewResult } from "./intents/types.js";
20
24
  import { primaryInstantOutput } from "./intents/operations/claim-delayed/index.js";
@@ -24,4 +28,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
24
28
  import { LiquidationsService } from "./liquidations/LiquidationsService.js";
25
29
  import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
26
30
  import "./liquidations/index.js";
27
- export { AbstractWithdrawalCompressorContract, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, 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, 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,7 +1,7 @@
1
+ import { ClaimableWithdrawal, DelayedIntent, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/types.js";
2
+ import { Asset, CreditAccountData, CreditAccountTokensSlice } from "../base/types.js";
1
3
  import { StrategyPosition } from "../../model/positions.js";
2
4
  import "../../model/index.js";
3
- import { ClaimableWithdrawal, DelayedIntent, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/types.js";
4
- import { Asset, ConnectedBotData, CreditAccountData, CreditAccountTokensSlice } from "../base/types.js";
5
5
  import { RWAOpenAccountRequirements, RWAOperationArgs } from "../market/rwa/types.js";
6
6
  import "../market/rwa/index.js";
7
7
  import { RouterCASlice, RouterCloseResult } from "../router/types.js";
@@ -18,6 +18,8 @@ import { OnchainSDK } from "../OnchainSDK.js";
18
18
  import { Construct } from "../base/Construct.js";
19
19
  import "../types/index.js";
20
20
  import "../base/index.js";
21
+ import { AccountBotsService } from "./bots/AccountBotsService.js";
22
+ import "./bots/index.js";
21
23
  import { Address, Hex } from "viem";
22
24
  //#region src/sdk/accounts/types.d.ts
23
25
  /**
@@ -123,19 +125,6 @@ interface PrepareUpdateQuotasProps {
123
125
  */
124
126
  minQuota: Array<Asset>;
125
127
  }
126
- /**
127
- * Credit account and credit manager address pair, used for batch queries such as connected bot lookups.
128
- **/
129
- type AccountToCheck = {
130
- /**
131
- * Address of the credit account.
132
- **/
133
- creditAccount: Address;
134
- /**
135
- * Address of the credit manager that manages this account.
136
- **/
137
- creditManager: Address;
138
- };
139
128
  interface PreviewDelayedWithdrawalProps {
140
129
  /**
141
130
  * Amount of source token (ex. cp0xlrt)
@@ -396,56 +385,6 @@ interface GetOpenAccountRequirementsProps {
396
385
  */
397
386
  tokenOutAddress: Address;
398
387
  }
399
- interface CMSlice {
400
- creditManager: Address;
401
- creditFacade: Address;
402
- type: "creditManager";
403
- }
404
- interface SetBotProps {
405
- /**
406
- * Address of a bot that is being updated
407
- */
408
- botAddress: Address;
409
- /**
410
- * Permissions to set for the bot
411
- */
412
- permissions: bigint | null;
413
- /**
414
- * Minimal credit account data {@link RouterCASlice} on which operation is performed; if omitted, credit manager data is used
415
- * Minimal credit manager data {@link CMSlice} on which operation is performed; used only if credit account is omitted
416
- * At least one of credit account or credit manager must be provided
417
- */
418
- targetContract: (RouterCASlice & {
419
- type: "creditAccount";
420
- }) | CMSlice;
421
- }
422
- /**
423
- * Multicall result of querying connected bots across multiple credit accounts.
424
- **/
425
- type GetConnectedBotsResult = Array<{
426
- error?: undefined;
427
- result: readonly ConnectedBotData[];
428
- status: "success";
429
- } | {
430
- error: Error;
431
- result?: undefined;
432
- status: "failure";
433
- }>;
434
- /**
435
- * Result of querying a migration bot's status across credit accounts, or `undefined` if no migration bot was provided.
436
- **/
437
- type GetConnectedMigrationBotsResult = {
438
- result: ({
439
- error: Error;
440
- result?: undefined;
441
- status: "failure";
442
- } | {
443
- error?: undefined;
444
- result: readonly [bigint, boolean, boolean] | readonly [bigint, boolean];
445
- status: "success";
446
- })[];
447
- botAddress: Address;
448
- } | undefined;
449
388
  /**
450
389
  * Options to get approval address for collateral token
451
390
  */
@@ -502,6 +441,11 @@ type AssembleCaOperationsProps = {
502
441
  };
503
442
  interface ICreditAccountsService extends Construct {
504
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;
505
449
  /**
506
450
  * Returns single credit account data with investor resolved, or undefined
507
451
  * if the account is not found.
@@ -546,24 +490,6 @@ interface ICreditAccountsService extends Construct {
546
490
  * @returns {Array<Rewards>} list of {@link Rewards} that can be claimed
547
491
  */
548
492
  getRewards(creditAccount: Address): Promise<Array<Rewards>>;
549
- /**
550
- * Method to get all connected bots for credit account
551
- * @param {Array<AccountToCheck>} accountsToCheck - list of credit accounts
552
- * @param {Address | undefined} legacyMigrationBot - address of the bot to check connected bots on
553
- * and their credit managers to check connected bots on
554
- * @returns call result of getConnectedBots for each credit account
555
- */
556
- getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<{
557
- legacy: GetConnectedBotsResult;
558
- legacyMigration: GetConnectedMigrationBotsResult;
559
- additionalBots: Array<Omit<NonNullable<GetConnectedMigrationBotsResult>, "botAddress">>;
560
- }>;
561
- /**
562
- * Connects/disables a bot and updates prices
563
- * @param props - {@link SetBotProps}
564
- * @return All necessary data to execute the transaction (call, credit facade)
565
- */
566
- setBot: (props: SetBotProps) => Promise<CreditAccountOperationResult | CreditManagerOperationResult>;
567
493
  /**
568
494
  * Generates transaction to liquidate credit account
569
495
  * @param props - {@link FullyLiquidateProps}
@@ -811,4 +737,4 @@ interface ICreditAccountsService extends Construct {
811
737
  claimFarmRewards(props: ClaimFarmRewardsProps): Promise<RawTx>;
812
738
  }
813
739
  //#endregion
814
- export { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditManagerOperationResult, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, 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";