@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.
- package/dist/cjs/plugins/accounts-counter/AccountsCounterPlugin.js +1 -1
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +85 -584
- package/dist/cjs/sdk/accounts/bots/AccountBotsService.js +132 -0
- package/dist/cjs/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
- package/dist/cjs/sdk/accounts/bots/abi.js +19 -0
- package/dist/cjs/sdk/accounts/bots/index.js +6 -0
- package/dist/cjs/sdk/accounts/bots/types.js +1 -0
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +280 -0
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js +141 -0
- package/dist/cjs/sdk/accounts/credit-account-compressor/index.js +6 -0
- package/dist/cjs/sdk/accounts/credit-account-compressor/types.js +1 -0
- package/dist/cjs/sdk/accounts/index.js +10 -0
- package/dist/cjs/sdk/index.js +8 -0
- package/dist/cjs/sdk/market/ZapperRegister.js +1 -1
- package/dist/cjs/sdk/market/credit/CreditSuite.js +31 -0
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +41 -1
- package/dist/cjs/sdk/market/oracle/PriceOracleV310Contract.js +0 -23
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +1 -1
- package/dist/esm/plugins/accounts-counter/AccountsCounterPlugin.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +87 -586
- package/dist/esm/sdk/accounts/bots/AccountBotsService.js +131 -0
- package/dist/esm/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
- package/dist/esm/sdk/accounts/bots/abi.js +18 -0
- package/dist/esm/sdk/accounts/bots/index.js +4 -0
- package/dist/esm/sdk/accounts/bots/types.js +1 -0
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +279 -0
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js +141 -0
- package/dist/esm/sdk/accounts/credit-account-compressor/index.js +4 -0
- package/dist/esm/sdk/accounts/credit-account-compressor/types.js +1 -0
- package/dist/esm/sdk/accounts/index.js +7 -1
- package/dist/esm/sdk/index.js +5 -1
- package/dist/esm/sdk/market/ZapperRegister.js +1 -1
- package/dist/esm/sdk/market/credit/CreditSuite.js +31 -0
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +41 -1
- package/dist/esm/sdk/market/oracle/PriceOracleV310Contract.js +0 -23
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +1 -1
- package/dist/types/new-sdk/AbstractNamespace.d.ts +2 -2
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
- package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +1 -1
- package/dist/types/plugins/accounts/AccountsPlugin.d.ts +1 -1
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +17 -58
- package/dist/types/sdk/accounts/bots/AccountBotsService.d.ts +38 -0
- package/dist/types/sdk/accounts/bots/PeripheryCompressorV310Contract.d.ts +236 -0
- package/dist/types/sdk/accounts/bots/abi.d.ts +18 -0
- package/dist/types/sdk/accounts/bots/index.d.ts +4 -0
- package/dist/types/sdk/accounts/bots/types.d.ts +143 -0
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +60 -0
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.d.ts +879 -0
- package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +4 -0
- package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +164 -0
- package/dist/types/sdk/accounts/index.d.ts +11 -3
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +2 -2
- package/dist/types/sdk/accounts/liquidations/types.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +13 -194
- package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
- package/dist/types/sdk/base/index.d.ts +2 -2
- package/dist/types/sdk/base/types.d.ts +6 -1
- package/dist/types/sdk/index.d.ts +11 -5
- package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +1 -1
- package/dist/types/sdk/market/MarketSuite.d.ts +1 -1
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +1 -1
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +26 -1
- package/dist/types/sdk/market/credit/types.d.ts +1 -1
- package/dist/types/sdk/market/index.d.ts +2 -2
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +16 -5
- package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +0 -11
- package/dist/types/sdk/market/oracle/index.d.ts +2 -2
- package/dist/types/sdk/market/oracle/types.d.ts +31 -15
- package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +1 -1
- package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +1 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +1 -1
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +1 -1
- package/dist/types/sdk/market/pool/types.d.ts +1 -1
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +1 -1
- package/dist/types/sdk/market/pricefeeds/types.d.ts +1 -1
- package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +2 -2
- package/dist/types/sdk/pools/types.d.ts +1 -1
- package/dist/types/sdk/positions/MultichainPositionsService.d.ts +2 -2
- package/package.json +1 -1
|
@@ -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 };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CreditAccountData } from "../../base/types.js";
|
|
2
|
+
import { StrategyPosition } from "../../../model/positions.js";
|
|
3
|
+
import "../../../model/index.js";
|
|
4
|
+
import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./types.js";
|
|
5
|
+
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
6
|
+
import "../../base/index.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Reads credit accounts of the current chain.
|
|
11
|
+
*
|
|
12
|
+
* Stitches the credit account compressor together with the RWA factories (for
|
|
13
|
+
* accounts owned via an investor EOA) and with the withdrawal compressor (for
|
|
14
|
+
* assets that are on their way out of an account), and describes the result
|
|
15
|
+
* either as raw account data or as {@link StrategyPosition}s.
|
|
16
|
+
*
|
|
17
|
+
* TODO: create and deploy new compressor contract onchain to avoid all this stitching
|
|
18
|
+
**/
|
|
19
|
+
declare class CreditAccountCompressor extends SDKConstruct {
|
|
20
|
+
#private;
|
|
21
|
+
/**
|
|
22
|
+
* Reads data of a single credit account.
|
|
23
|
+
*
|
|
24
|
+
* When the compressor cannot value the account with current prices, the read
|
|
25
|
+
* is retried with price feed updates applied.
|
|
26
|
+
*
|
|
27
|
+
* @param account - Credit account address.
|
|
28
|
+
* @param blockNumber - Block to read at, defaults to the latest block.
|
|
29
|
+
* @returns Account data, or `undefined` if the account does not exist.
|
|
30
|
+
**/
|
|
31
|
+
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData<true> | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Reads all credit accounts matching the options, sorted by health factor
|
|
34
|
+
* ascending.
|
|
35
|
+
*
|
|
36
|
+
* @param options - {@link GetCreditAccountsOptions}
|
|
37
|
+
* @param blockNumber - Block to read at, defaults to the latest block.
|
|
38
|
+
**/
|
|
39
|
+
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<CreditAccountData[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Reads all credit accounts of a borrower, sorted by health factor
|
|
42
|
+
* ascending.
|
|
43
|
+
*
|
|
44
|
+
* Covers accounts the borrower owns directly and RWA accounts they own as an
|
|
45
|
+
* investor, which are owned on-chain by an RWA factory.
|
|
46
|
+
*
|
|
47
|
+
* @param borrower - Wallet address.
|
|
48
|
+
* @param options - {@link GetCreditAccountsOptions}
|
|
49
|
+
* @param blockNumber - Block to read at, defaults to the latest block.
|
|
50
|
+
**/
|
|
51
|
+
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<CreditAccountData<true>[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Describes all credit accounts of a wallet as strategy positions.
|
|
54
|
+
*
|
|
55
|
+
* @param props - {@link ListStrategyPositionsProps}
|
|
56
|
+
**/
|
|
57
|
+
listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { CreditAccountCompressor };
|