@gearbox-protocol/sdk 14.12.0-next.75 → 14.12.0-next.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/cjs/model/curators.js +1 -0
  2. package/dist/cjs/model/curators.schema.js +38 -0
  3. package/dist/cjs/model/index.js +4 -1
  4. package/dist/cjs/model/opportunities.schema.js +3 -1
  5. package/dist/cjs/model/primitives.schema.js +0 -9
  6. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +13 -140
  7. package/dist/cjs/sdk/accounts/bots/AccountBotsService.js +132 -0
  8. package/dist/cjs/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
  9. package/dist/cjs/sdk/accounts/bots/abi.js +19 -0
  10. package/dist/cjs/sdk/accounts/bots/index.js +6 -0
  11. package/dist/cjs/sdk/accounts/bots/types.js +1 -0
  12. package/dist/cjs/sdk/accounts/index.js +5 -0
  13. package/dist/cjs/sdk/chain/chains.js +1 -1
  14. package/dist/cjs/sdk/index.js +4 -0
  15. package/dist/cjs/sdk/market/MarketConfiguratorContract.js +2 -14
  16. package/dist/cjs/sdk/market/MarketSuite.js +1 -0
  17. package/dist/cjs/sdk/market/ZapperRegister.js +1 -1
  18. package/dist/cjs/sdk/market/credit/CreditSuite.js +31 -0
  19. package/dist/esm/dev/AccountOpener.js +1 -1
  20. package/dist/esm/dev/withdrawalUtils.js +1 -1
  21. package/dist/esm/model/curators.js +1 -0
  22. package/dist/esm/model/curators.schema.js +36 -0
  23. package/dist/esm/model/index.js +4 -2
  24. package/dist/esm/model/opportunities.schema.js +3 -1
  25. package/dist/esm/model/primitives.schema.js +1 -9
  26. package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
  27. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  28. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  29. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +17 -144
  30. package/dist/esm/sdk/accounts/bots/AccountBotsService.js +131 -0
  31. package/dist/esm/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
  32. package/dist/esm/sdk/accounts/bots/abi.js +18 -0
  33. package/dist/esm/sdk/accounts/bots/index.js +4 -0
  34. package/dist/esm/sdk/accounts/bots/types.js +1 -0
  35. package/dist/esm/sdk/accounts/index.js +4 -1
  36. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -1
  37. package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  38. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  39. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  40. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  41. package/dist/esm/sdk/base/TokensMeta.js +2 -2
  42. package/dist/esm/sdk/chain/chains.js +1 -1
  43. package/dist/esm/sdk/chain/detectNetwork.js +1 -1
  44. package/dist/esm/sdk/core/createAddressProvider.js +1 -1
  45. package/dist/esm/sdk/index.js +3 -1
  46. package/dist/esm/sdk/market/MarketConfiguratorContract.js +2 -14
  47. package/dist/esm/sdk/market/MarketSuite.js +1 -0
  48. package/dist/esm/sdk/market/ZapperRegister.js +1 -1
  49. package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
  50. package/dist/esm/sdk/market/credit/CreditSuite.js +31 -0
  51. package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
  52. package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
  53. package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
  54. package/dist/esm/sdk/pools/PoolService.js +1 -1
  55. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  56. package/dist/types/model/curators.d.ts +33 -0
  57. package/dist/types/model/curators.schema.d.ts +50 -0
  58. package/dist/types/model/index.d.ts +5 -3
  59. package/dist/types/model/opportunities.d.ts +6 -1
  60. package/dist/types/model/opportunities.schema.d.ts +160 -9
  61. package/dist/types/model/primitives.d.ts +1 -25
  62. package/dist/types/model/primitives.schema.d.ts +1 -9
  63. package/dist/types/new-sdk/AbstractNamespace.d.ts +2 -2
  64. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  65. package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +1 -1
  66. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +9 -16
  67. package/dist/types/sdk/accounts/bots/AccountBotsService.d.ts +38 -0
  68. package/dist/types/sdk/accounts/bots/PeripheryCompressorV310Contract.d.ts +236 -0
  69. package/dist/types/sdk/accounts/bots/abi.d.ts +18 -0
  70. package/dist/types/sdk/accounts/bots/index.d.ts +4 -0
  71. package/dist/types/sdk/accounts/bots/types.d.ts +143 -0
  72. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +1 -1
  73. package/dist/types/sdk/accounts/index.d.ts +6 -2
  74. package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +2 -2
  75. package/dist/types/sdk/accounts/liquidations/types.d.ts +1 -1
  76. package/dist/types/sdk/accounts/types.d.ts +10 -84
  77. package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
  78. package/dist/types/sdk/chain/chains.d.ts +7 -11
  79. package/dist/types/sdk/chain/index.d.ts +2 -2
  80. package/dist/types/sdk/index.d.ts +6 -3
  81. package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +3 -8
  82. package/dist/types/sdk/market/MarketSuite.d.ts +3 -2
  83. package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +1 -1
  84. package/dist/types/sdk/market/credit/CreditSuite.d.ts +26 -1
  85. package/dist/types/sdk/market/credit/types.d.ts +1 -1
  86. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +2 -2
  87. package/dist/types/sdk/market/oracle/types.d.ts +2 -2
  88. package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +1 -1
  89. package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +1 -1
  90. package/dist/types/sdk/market/pool/PoolSuite.d.ts +1 -1
  91. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +1 -1
  92. package/dist/types/sdk/market/pool/types.d.ts +1 -1
  93. package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +1 -1
  94. package/dist/types/sdk/market/pricefeeds/types.d.ts +1 -1
  95. package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +2 -2
  96. package/dist/types/sdk/pools/types.d.ts +1 -1
  97. package/dist/types/sdk/positions/MultichainPositionsService.d.ts +2 -2
  98. package/package.json +1 -1
@@ -166,29 +166,5 @@ interface TxCall {
166
166
  **/
167
167
  value?: bigint;
168
168
  }
169
- /**
170
- * The entity that curates a market: sets risk parameters, picks collateral and
171
- * operates the market configurator.
172
- **/
173
- interface Curator {
174
- /**
175
- * Address of the market configurator the curator operates. This is the
176
- * on-chain identity of a curator, not a personal wallet.
177
- **/
178
- address: Address;
179
- /**
180
- * Display name.
181
- *
182
- * @example `"Chaos Labs"`
183
- **/
184
- name: string;
185
- /**
186
- * Link to the curator's page, or `null` when unknown. The chain knows no
187
- * URLs, so this is `null` for anything served from the on-chain source.
188
- *
189
- * @mode offchain
190
- **/
191
- url: string | null;
192
- }
193
169
  //#endregion
194
- export { Amount, AssetType, Bps, ChainId, Curator, Leverage, Timestamp, Token, TokenAmount, TxCall };
170
+ export { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall };
@@ -69,13 +69,5 @@ declare const txCallSchema: z.ZodObject<{
69
69
  callData: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
70
70
  value: z.ZodOptional<z.ZodBigInt>;
71
71
  }, z.core.$strip>;
72
- /**
73
- * {@link Curator}
74
- **/
75
- declare const curatorSchema: z.ZodObject<{
76
- address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
77
- name: z.ZodString;
78
- url: z.ZodNullable<z.ZodString>;
79
- }, z.core.$strip>;
80
72
  //#endregion
81
- export { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, curatorSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema };
73
+ export { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema };
@@ -1,8 +1,8 @@
1
- import { ChainId } from "../model/primitives.js";
2
- import "../model/index.js";
3
1
  import { ILogger } from "../sdk/types/logger.js";
2
+ import { ChainId } from "../model/primitives.js";
4
3
  import { NetworkType } from "../sdk/chain/chains.js";
5
4
  import { MultichainNetworkMeta } from "../sdk/types/multichain.js";
5
+ import "../model/index.js";
6
6
  import { MultichainSDK } from "../sdk/MultichainSDK.js";
7
7
  import "../sdk/index.js";
8
8
  import { OffchainResult } from "../offchain/types.js";
@@ -1,7 +1,7 @@
1
+ import { ILogger } from "../../sdk/types/logger.js";
1
2
  import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
2
3
  import { PoolHistoryMetric, StrategyHistoryMetric } from "../../model/history.js";
3
4
  import "../../model/index.js";
4
- import { ILogger } from "../../sdk/types/logger.js";
5
5
  import { MultichainSDK } from "../../sdk/MultichainSDK.js";
6
6
  import "../../sdk/index.js";
7
7
  import { GearboxAPI } from "../../offchain/GearboxAPI.js";
@@ -1,7 +1,7 @@
1
+ import { ILogger } from "../../sdk/types/logger.js";
1
2
  import { PoolPositionRef, Position, PositionFilter, StrategyPositionRef } from "../../model/positions.js";
2
3
  import { PoolPositionHistoryMetric, StrategyPositionHistoryMetric } from "../../model/history.js";
3
4
  import "../../model/index.js";
4
- import { ILogger } from "../../sdk/types/logger.js";
5
5
  import { MultichainSDK } from "../../sdk/MultichainSDK.js";
6
6
  import "../../sdk/index.js";
7
7
  import { GearboxAPI } from "../../offchain/GearboxAPI.js";
@@ -1,7 +1,7 @@
1
- import { StrategyPosition } from "../../model/positions.js";
2
- import "../../model/index.js";
3
1
  import { RequestableWithdrawal } from "./withdrawal-compressor/types.js";
4
2
  import { Asset, CreditAccountData, CreditAccountTokensSlice } from "../base/types.js";
3
+ import { StrategyPosition } from "../../model/positions.js";
4
+ import "../../model/index.js";
5
5
  import { RWAOpenAccountRequirements } from "../market/rwa/types.js";
6
6
  import "../market/rwa/index.js";
7
7
  import { RouterCASlice } from "../router/types.js";
@@ -9,7 +9,7 @@ import "../router/index.js";
9
9
  import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
10
10
  import "./credit-account-compressor/index.js";
11
11
  import "./withdrawal-compressor/index.js";
12
- import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CreditAccountOperationResult, CreditManagerOperationResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps } from "./types.js";
12
+ import { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards } from "./types.js";
13
13
  import { PriceUpdate } from "../market/pricefeeds/types.js";
14
14
  import "../market/index.js";
15
15
  import { MultiCall, RawTx } from "../types/transactions.js";
@@ -17,6 +17,8 @@ import { OnchainSDK } from "../OnchainSDK.js";
17
17
  import "../types/index.js";
18
18
  import { SDKConstruct } from "../base/SDKConstruct.js";
19
19
  import "../base/index.js";
20
+ import { AccountBotsService } from "./bots/AccountBotsService.js";
21
+ import "./bots/index.js";
20
22
  import { Address } from "viem";
21
23
  //#region src/sdk/accounts/CreditAccountsServiceV310.d.ts
22
24
  /**
@@ -30,6 +32,10 @@ import { Address } from "viem";
30
32
  **/
31
33
  declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditAccountsService {
32
34
  #private;
35
+ /**
36
+ * {@inheritDoc ICreditAccountsService.bots}
37
+ **/
38
+ readonly bots: AccountBotsService;
33
39
  constructor(sdk: OnchainSDK);
34
40
  /**
35
41
  * {@inheritDoc ICreditAccountsService.getCreditAccountData}
@@ -51,14 +57,6 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
51
57
  * {@inheritDoc ICreditAccountsService.getRewards}
52
58
  **/
53
59
  getRewards(creditAccount: Address): Promise<Array<Rewards>>;
54
- /**
55
- * {@inheritDoc ICreditAccountsService.getConnectedBots}
56
- **/
57
- getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<{
58
- legacy: GetConnectedBotsResult;
59
- legacyMigration: GetConnectedMigrationBotsResult;
60
- additionalBots: Array<Omit<NonNullable<GetConnectedMigrationBotsResult>, "botAddress">>;
61
- }>;
62
60
  /**
63
61
  * {@inheritDoc ICreditAccountsService.fullyLiquidate}
64
62
  **/
@@ -115,10 +113,6 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
115
113
  * {@inheritDoc ICreditAccountsService.assembleDepositDiffCalls}
116
114
  */
117
115
  assembleDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
118
- /**
119
- * {@inheritDoc ICreditAccountsService.setBot}
120
- */
121
- setBot({ botAddress, permissions: defaultPermissions, targetContract }: SetBotProps): Promise<CreditAccountOperationResult | CreditManagerOperationResult>;
122
116
  /**
123
117
  * {@inheritDoc ICreditAccountsService.assembleRepayCreditAccountCalls}
124
118
  */
@@ -170,7 +164,6 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
170
164
  */
171
165
  prepareAddCollateral(creditFacade: Address, assets: Array<Asset>, permits: Record<string, PermitResult>): Array<MultiCall>;
172
166
  private get rewardCompressor();
173
- private get peripheryCompressor();
174
167
  }
175
168
  //#endregion
176
169
  export { CreditAccountsServiceV310 };
@@ -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