@gearbox-protocol/sdk 12.0.0-next.7 → 12.0.0-next.8
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/bots/config.js +2 -5
- package/dist/cjs/plugins/bots/types.js +2 -5
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +38 -9
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +16 -1
- package/dist/esm/plugins/bots/config.js +2 -5
- package/dist/esm/plugins/bots/types.js +1 -3
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +38 -9
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +17 -2
- package/dist/types/plugins/bots/config.d.ts +1 -1
- package/dist/types/plugins/bots/types.d.ts +2 -4
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +5 -6
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +8 -6
- package/package.json +1 -1
|
@@ -60,13 +60,10 @@ const LEGACY_MIGRATION_BOT = {
|
|
|
60
60
|
address: ACCOUNT_MIGRATOR_BOT,
|
|
61
61
|
previewer: ACCOUNT_MIGRATOR_PREVIEWER,
|
|
62
62
|
version: 310,
|
|
63
|
-
|
|
63
|
+
baseType: "LEGACY_MIGRATION"
|
|
64
64
|
};
|
|
65
65
|
const PERMISSION_BY_TYPE = {
|
|
66
|
-
|
|
67
|
-
import_sdk.BotPermissions.ADD_COLLATERAL | import_sdk.BotPermissions.WITHDRAW_COLLATERAL | import_sdk.BotPermissions.DECREASE_DEBT
|
|
68
|
-
),
|
|
69
|
-
MIGRATION: BigInt(
|
|
66
|
+
LEGACY_MIGRATION: BigInt(
|
|
70
67
|
import_sdk.BotPermissions.EXTERNAL_CALLS | import_sdk.BotPermissions.UPDATE_QUOTA | import_sdk.BotPermissions.DECREASE_DEBT
|
|
71
68
|
)
|
|
72
69
|
};
|
|
@@ -19,8 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var types_exports = {};
|
|
20
20
|
__export(types_exports, {
|
|
21
21
|
BOT_PARAMS_ABI: () => BOT_PARAMS_ABI,
|
|
22
|
-
BOT_PARTIAL_LIQUIDATION: () => BOT_PARTIAL_LIQUIDATION
|
|
23
|
-
MIGRATION_BOT_TYPES: () => MIGRATION_BOT_TYPES
|
|
22
|
+
BOT_PARTIAL_LIQUIDATION: () => BOT_PARTIAL_LIQUIDATION
|
|
24
23
|
});
|
|
25
24
|
module.exports = __toCommonJS(types_exports);
|
|
26
25
|
const BOT_PARTIAL_LIQUIDATION = "BOT::PARTIAL_LIQUIDATION";
|
|
@@ -31,10 +30,8 @@ const BOT_PARAMS_ABI = [
|
|
|
31
30
|
{ type: "uint16", name: "premiumScaleFactor" },
|
|
32
31
|
{ type: "uint16", name: "feeScaleFactor" }
|
|
33
32
|
];
|
|
34
|
-
const MIGRATION_BOT_TYPES = ["MIGRATION_BOT"];
|
|
35
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
34
|
0 && (module.exports = {
|
|
37
35
|
BOT_PARAMS_ABI,
|
|
38
|
-
BOT_PARTIAL_LIQUIDATION
|
|
39
|
-
MIGRATION_BOT_TYPES
|
|
36
|
+
BOT_PARTIAL_LIQUIDATION
|
|
40
37
|
});
|
|
@@ -203,12 +203,12 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
205
205
|
* Method to get all connected bots for credit account
|
|
206
|
-
* @param {Array<
|
|
206
|
+
* @param {Array<AccountToCheck>} accountsToCheck - list of credit accounts
|
|
207
207
|
and their credit managers to check connected bots on
|
|
208
208
|
* @returns call result of getConnectedBots for each credit account
|
|
209
209
|
*/
|
|
210
|
-
async getConnectedBots(accountsToCheck, legacyMigrationBot) {
|
|
211
|
-
const [resp, migration] = await Promise.all([
|
|
210
|
+
async getConnectedBots(accountsToCheck, legacyMigrationBot, additionalBots) {
|
|
211
|
+
const [resp, migration, additional] = await Promise.all([
|
|
212
212
|
this.client.multicall({
|
|
213
213
|
contracts: accountsToCheck.map((o) => {
|
|
214
214
|
const pool = this.sdk.marketRegister.findByCreditManager(
|
|
@@ -223,12 +223,41 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
223
223
|
}),
|
|
224
224
|
allowFailure: true
|
|
225
225
|
}),
|
|
226
|
-
this.getActiveMigrationBots(accountsToCheck, legacyMigrationBot)
|
|
226
|
+
this.getActiveMigrationBots(accountsToCheck, legacyMigrationBot),
|
|
227
|
+
this.getActiveBots(accountsToCheck, additionalBots)
|
|
227
228
|
]);
|
|
228
|
-
return {
|
|
229
|
+
return {
|
|
230
|
+
legacy: resp,
|
|
231
|
+
additionalBots: additional,
|
|
232
|
+
legacyMigration: migration
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
async getActiveBots(accountsToCheck, bots) {
|
|
236
|
+
const result = await this.client.multicall({
|
|
237
|
+
contracts: accountsToCheck.flatMap((ca) => {
|
|
238
|
+
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
239
|
+
return bots.map((bot) => {
|
|
240
|
+
return {
|
|
241
|
+
abi: (0, import_constants.isV300)(cm.creditFacade.version) ? import_v300.iBotListV300Abi : import_generated.iBotListV310Abi,
|
|
242
|
+
address: cm.creditFacade.botList,
|
|
243
|
+
functionName: "getBotStatus",
|
|
244
|
+
args: (0, import_constants.isV300)(cm.creditFacade.version) ? [bot, ca.creditManager, ca.creditAccount] : [bot, ca.creditAccount]
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
}),
|
|
248
|
+
allowFailure: true
|
|
249
|
+
});
|
|
250
|
+
const botsByCAIndex = accountsToCheck.reduce((acc, _, index) => {
|
|
251
|
+
const r = result.slice(index * bots.length, (index + 1) * bots.length);
|
|
252
|
+
acc.push({
|
|
253
|
+
result: r
|
|
254
|
+
});
|
|
255
|
+
return acc;
|
|
256
|
+
}, []);
|
|
257
|
+
return botsByCAIndex;
|
|
229
258
|
}
|
|
230
|
-
async getActiveMigrationBots(accountsToCheck,
|
|
231
|
-
if (
|
|
259
|
+
async getActiveMigrationBots(accountsToCheck, bot) {
|
|
260
|
+
if (bot) {
|
|
232
261
|
const result = await this.client.multicall({
|
|
233
262
|
contracts: accountsToCheck.map((ca) => {
|
|
234
263
|
const cm = this.sdk.marketRegister.findCreditManager(
|
|
@@ -238,12 +267,12 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
238
267
|
abi: (0, import_constants.isV300)(cm.creditFacade.version) ? import_v300.iBotListV300Abi : import_generated.iBotListV310Abi,
|
|
239
268
|
address: cm.creditFacade.botList,
|
|
240
269
|
functionName: "getBotStatus",
|
|
241
|
-
args: (0, import_constants.isV300)(cm.creditFacade.version) ? [
|
|
270
|
+
args: (0, import_constants.isV300)(cm.creditFacade.version) ? [bot, ca.creditManager, ca.creditAccount] : [bot, ca.creditAccount]
|
|
242
271
|
};
|
|
243
272
|
}),
|
|
244
273
|
allowFailure: true
|
|
245
274
|
});
|
|
246
|
-
return { result, botAddress:
|
|
275
|
+
return { result, botAddress: bot };
|
|
247
276
|
}
|
|
248
277
|
return void 0;
|
|
249
278
|
}
|
|
@@ -31,7 +31,7 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
31
31
|
*/
|
|
32
32
|
async setBot({
|
|
33
33
|
botAddress,
|
|
34
|
-
permissions,
|
|
34
|
+
permissions: defaultPermissions,
|
|
35
35
|
targetContract
|
|
36
36
|
}) {
|
|
37
37
|
const cm = this.sdk.marketRegister.findCreditManager(
|
|
@@ -41,6 +41,21 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
|
|
|
41
41
|
creditManager: targetContract.creditManager,
|
|
42
42
|
creditAccount: targetContract
|
|
43
43
|
}) : [];
|
|
44
|
+
const permissions = defaultPermissions !== null ? defaultPermissions : await (0, import_viem.getContract)({
|
|
45
|
+
address: botAddress,
|
|
46
|
+
client: this.sdk.client,
|
|
47
|
+
abi: [
|
|
48
|
+
{
|
|
49
|
+
type: "function",
|
|
50
|
+
name: "requiredPermissions",
|
|
51
|
+
inputs: [],
|
|
52
|
+
outputs: [
|
|
53
|
+
{ name: "", type: "uint192", internalType: "uint192" }
|
|
54
|
+
],
|
|
55
|
+
stateMutability: "view"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}).read.requiredPermissions();
|
|
44
59
|
const addBotCall = {
|
|
45
60
|
target: cm.creditFacade.address,
|
|
46
61
|
callData: (0, import_viem.encodeFunctionData)({
|
|
@@ -33,13 +33,10 @@ const LEGACY_MIGRATION_BOT = {
|
|
|
33
33
|
address: ACCOUNT_MIGRATOR_BOT,
|
|
34
34
|
previewer: ACCOUNT_MIGRATOR_PREVIEWER,
|
|
35
35
|
version: 310,
|
|
36
|
-
|
|
36
|
+
baseType: "LEGACY_MIGRATION"
|
|
37
37
|
};
|
|
38
38
|
const PERMISSION_BY_TYPE = {
|
|
39
|
-
|
|
40
|
-
BotPermissions.ADD_COLLATERAL | BotPermissions.WITHDRAW_COLLATERAL | BotPermissions.DECREASE_DEBT
|
|
41
|
-
),
|
|
42
|
-
MIGRATION: BigInt(
|
|
39
|
+
LEGACY_MIGRATION: BigInt(
|
|
43
40
|
BotPermissions.EXTERNAL_CALLS | BotPermissions.UPDATE_QUOTA | BotPermissions.DECREASE_DEBT
|
|
44
41
|
)
|
|
45
42
|
};
|
|
@@ -6,9 +6,7 @@ const BOT_PARAMS_ABI = [
|
|
|
6
6
|
{ type: "uint16", name: "premiumScaleFactor" },
|
|
7
7
|
{ type: "uint16", name: "feeScaleFactor" }
|
|
8
8
|
];
|
|
9
|
-
const MIGRATION_BOT_TYPES = ["MIGRATION_BOT"];
|
|
10
9
|
export {
|
|
11
10
|
BOT_PARAMS_ABI,
|
|
12
|
-
BOT_PARTIAL_LIQUIDATION
|
|
13
|
-
MIGRATION_BOT_TYPES
|
|
11
|
+
BOT_PARTIAL_LIQUIDATION
|
|
14
12
|
};
|
|
@@ -193,12 +193,12 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Method to get all connected bots for credit account
|
|
196
|
-
* @param {Array<
|
|
196
|
+
* @param {Array<AccountToCheck>} accountsToCheck - list of credit accounts
|
|
197
197
|
and their credit managers to check connected bots on
|
|
198
198
|
* @returns call result of getConnectedBots for each credit account
|
|
199
199
|
*/
|
|
200
|
-
async getConnectedBots(accountsToCheck, legacyMigrationBot) {
|
|
201
|
-
const [resp, migration] = await Promise.all([
|
|
200
|
+
async getConnectedBots(accountsToCheck, legacyMigrationBot, additionalBots) {
|
|
201
|
+
const [resp, migration, additional] = await Promise.all([
|
|
202
202
|
this.client.multicall({
|
|
203
203
|
contracts: accountsToCheck.map((o) => {
|
|
204
204
|
const pool = this.sdk.marketRegister.findByCreditManager(
|
|
@@ -213,12 +213,41 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
213
213
|
}),
|
|
214
214
|
allowFailure: true
|
|
215
215
|
}),
|
|
216
|
-
this.getActiveMigrationBots(accountsToCheck, legacyMigrationBot)
|
|
216
|
+
this.getActiveMigrationBots(accountsToCheck, legacyMigrationBot),
|
|
217
|
+
this.getActiveBots(accountsToCheck, additionalBots)
|
|
217
218
|
]);
|
|
218
|
-
return {
|
|
219
|
+
return {
|
|
220
|
+
legacy: resp,
|
|
221
|
+
additionalBots: additional,
|
|
222
|
+
legacyMigration: migration
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
async getActiveBots(accountsToCheck, bots) {
|
|
226
|
+
const result = await this.client.multicall({
|
|
227
|
+
contracts: accountsToCheck.flatMap((ca) => {
|
|
228
|
+
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
229
|
+
return bots.map((bot) => {
|
|
230
|
+
return {
|
|
231
|
+
abi: isV300(cm.creditFacade.version) ? iBotListV300Abi : iBotListV310Abi,
|
|
232
|
+
address: cm.creditFacade.botList,
|
|
233
|
+
functionName: "getBotStatus",
|
|
234
|
+
args: isV300(cm.creditFacade.version) ? [bot, ca.creditManager, ca.creditAccount] : [bot, ca.creditAccount]
|
|
235
|
+
};
|
|
236
|
+
});
|
|
237
|
+
}),
|
|
238
|
+
allowFailure: true
|
|
239
|
+
});
|
|
240
|
+
const botsByCAIndex = accountsToCheck.reduce((acc, _, index) => {
|
|
241
|
+
const r = result.slice(index * bots.length, (index + 1) * bots.length);
|
|
242
|
+
acc.push({
|
|
243
|
+
result: r
|
|
244
|
+
});
|
|
245
|
+
return acc;
|
|
246
|
+
}, []);
|
|
247
|
+
return botsByCAIndex;
|
|
219
248
|
}
|
|
220
|
-
async getActiveMigrationBots(accountsToCheck,
|
|
221
|
-
if (
|
|
249
|
+
async getActiveMigrationBots(accountsToCheck, bot) {
|
|
250
|
+
if (bot) {
|
|
222
251
|
const result = await this.client.multicall({
|
|
223
252
|
contracts: accountsToCheck.map((ca) => {
|
|
224
253
|
const cm = this.sdk.marketRegister.findCreditManager(
|
|
@@ -228,12 +257,12 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
228
257
|
abi: isV300(cm.creditFacade.version) ? iBotListV300Abi : iBotListV310Abi,
|
|
229
258
|
address: cm.creditFacade.botList,
|
|
230
259
|
functionName: "getBotStatus",
|
|
231
|
-
args: isV300(cm.creditFacade.version) ? [
|
|
260
|
+
args: isV300(cm.creditFacade.version) ? [bot, ca.creditManager, ca.creditAccount] : [bot, ca.creditAccount]
|
|
232
261
|
};
|
|
233
262
|
}),
|
|
234
263
|
allowFailure: true
|
|
235
264
|
});
|
|
236
|
-
return { result, botAddress:
|
|
265
|
+
return { result, botAddress: bot };
|
|
237
266
|
}
|
|
238
267
|
return void 0;
|
|
239
268
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { encodeFunctionData } from "viem";
|
|
1
|
+
import { encodeFunctionData, getContract } from "viem";
|
|
2
2
|
import { iCreditFacadeMulticallV310Abi } from "../../abi/310/generated.js";
|
|
3
3
|
import { MAX_UINT256 } from "../constants/math.js";
|
|
4
4
|
import { AbstractCreditAccountService } from "./AbstractCreditAccountsService.js";
|
|
@@ -8,7 +8,7 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
8
8
|
*/
|
|
9
9
|
async setBot({
|
|
10
10
|
botAddress,
|
|
11
|
-
permissions,
|
|
11
|
+
permissions: defaultPermissions,
|
|
12
12
|
targetContract
|
|
13
13
|
}) {
|
|
14
14
|
const cm = this.sdk.marketRegister.findCreditManager(
|
|
@@ -18,6 +18,21 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
18
18
|
creditManager: targetContract.creditManager,
|
|
19
19
|
creditAccount: targetContract
|
|
20
20
|
}) : [];
|
|
21
|
+
const permissions = defaultPermissions !== null ? defaultPermissions : await getContract({
|
|
22
|
+
address: botAddress,
|
|
23
|
+
client: this.sdk.client,
|
|
24
|
+
abi: [
|
|
25
|
+
{
|
|
26
|
+
type: "function",
|
|
27
|
+
name: "requiredPermissions",
|
|
28
|
+
inputs: [],
|
|
29
|
+
outputs: [
|
|
30
|
+
{ name: "", type: "uint192", internalType: "uint192" }
|
|
31
|
+
],
|
|
32
|
+
stateMutability: "view"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}).read.requiredPermissions();
|
|
21
36
|
const addBotCall = {
|
|
22
37
|
target: cm.creditFacade.address,
|
|
23
38
|
callData: encodeFunctionData({
|
|
@@ -5,4 +5,4 @@ export declare const PARTIAL_LIQUIDATION_BOT_CONFIGS: Partial<Record<NetworkType
|
|
|
5
5
|
export declare const PARTIAL_LIQUIDATION_BOT_SALT = "GEARBOX";
|
|
6
6
|
export declare const PARTIAL_LIQUIDATION_BOT_DEPLOYER: Address;
|
|
7
7
|
export declare const LEGACY_MIGRATION_BOT: MigrationBotState;
|
|
8
|
-
export declare const PERMISSION_BY_TYPE: Record<BotBaseType, bigint>;
|
|
8
|
+
export declare const PERMISSION_BY_TYPE: Record<Extract<BotBaseType, "LEGACY_MIGRATION">, bigint>;
|
|
@@ -40,12 +40,10 @@ export interface BotsPluginStateHuman {
|
|
|
40
40
|
export interface BotsPluginState {
|
|
41
41
|
bots: BotState[];
|
|
42
42
|
}
|
|
43
|
-
export type BotBaseType = "LIQUIDATION_PROTECTION" | "
|
|
44
|
-
export declare const MIGRATION_BOT_TYPES: readonly ["MIGRATION_BOT"];
|
|
45
|
-
export type MigrationBotType = (typeof MIGRATION_BOT_TYPES)[number];
|
|
43
|
+
export type BotBaseType = "LIQUIDATION_PROTECTION" | "LEGACY_MIGRATION";
|
|
46
44
|
export type MigrationBotState = {
|
|
47
45
|
address: Address;
|
|
48
46
|
version: 310;
|
|
49
47
|
previewer: Address;
|
|
50
|
-
|
|
48
|
+
baseType: Extract<BotBaseType, "LEGACY_MIGRATION">;
|
|
51
49
|
};
|
|
@@ -5,7 +5,7 @@ import type { GearboxSDK } from "../GearboxSDK.js";
|
|
|
5
5
|
import type { OnDemandPriceUpdates, PriceUpdateV300, PriceUpdateV310, UpdatePriceFeedsResult } from "../market/index.js";
|
|
6
6
|
import { type Asset, type RouterCASlice } from "../router/index.js";
|
|
7
7
|
import type { MultiCall } from "../types/index.js";
|
|
8
|
-
import type { AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, EnableTokensProps, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, PriceUpdatesOptions, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
|
|
8
|
+
import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, EnableTokensProps, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, PriceUpdatesOptions, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
|
|
9
9
|
export interface CreditAccountServiceOptions {
|
|
10
10
|
batchSize?: number;
|
|
11
11
|
}
|
|
@@ -39,17 +39,16 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
39
39
|
getRewards(creditAccount: Address): Promise<Array<Rewards>>;
|
|
40
40
|
/**
|
|
41
41
|
* Method to get all connected bots for credit account
|
|
42
|
-
* @param {Array<
|
|
42
|
+
* @param {Array<AccountToCheck>} accountsToCheck - list of credit accounts
|
|
43
43
|
and their credit managers to check connected bots on
|
|
44
44
|
* @returns call result of getConnectedBots for each credit account
|
|
45
45
|
*/
|
|
46
|
-
getConnectedBots(accountsToCheck: Array<{
|
|
47
|
-
creditAccount: Address;
|
|
48
|
-
creditManager: Address;
|
|
49
|
-
}>, legacyMigrationBot: Address | undefined): Promise<{
|
|
46
|
+
getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<{
|
|
50
47
|
legacy: GetConnectedBotsResult;
|
|
51
48
|
legacyMigration: GetConnectedMigrationBotsResult;
|
|
49
|
+
additionalBots: Array<Omit<NonNullable<GetConnectedMigrationBotsResult>, "botAddress">>;
|
|
52
50
|
}>;
|
|
51
|
+
private getActiveBots;
|
|
53
52
|
private getActiveMigrationBots;
|
|
54
53
|
/**
|
|
55
54
|
* Generates transaction to liquidate credit account
|
|
@@ -4,7 +4,7 @@ export declare class CreditAccountServiceV310 extends AbstractCreditAccountServi
|
|
|
4
4
|
/**
|
|
5
5
|
* Implements {@link ICreditAccountsService.setBot}
|
|
6
6
|
*/
|
|
7
|
-
setBot({ botAddress, permissions, targetContract, }: SetBotProps): Promise<CreditAccountOperationResult | CreditManagerOperationResult>;
|
|
7
|
+
setBot({ botAddress, permissions: defaultPermissions, targetContract, }: SetBotProps): Promise<CreditAccountOperationResult | CreditManagerOperationResult>;
|
|
8
8
|
/**
|
|
9
9
|
* Implements {@link ICreditAccountsService.withdrawCollateral}
|
|
10
10
|
*/
|
|
@@ -164,6 +164,10 @@ export interface WithdrawCollateralProps extends PrepareUpdateQuotasProps {
|
|
|
164
164
|
*/
|
|
165
165
|
creditAccount: RouterCASlice;
|
|
166
166
|
}
|
|
167
|
+
export type AccountToCheck = {
|
|
168
|
+
creditAccount: Address;
|
|
169
|
+
creditManager: Address;
|
|
170
|
+
};
|
|
167
171
|
export interface ExecuteSwapProps extends PrepareUpdateQuotasProps {
|
|
168
172
|
/**
|
|
169
173
|
* Array of MultiCall from router methods getSingleSwap or getAllSwaps
|
|
@@ -376,7 +380,7 @@ export interface SetBotProps {
|
|
|
376
380
|
/**
|
|
377
381
|
* Permissions to set for the bot
|
|
378
382
|
*/
|
|
379
|
-
permissions: bigint;
|
|
383
|
+
permissions: bigint | null;
|
|
380
384
|
/**
|
|
381
385
|
* Minimal credit account data {@link RouterCASlice} on which operation is performed; if omitted, credit manager data is used
|
|
382
386
|
* Minimal credit manager data {@link CMSlice} on which operation is performed; used only if credit account is omitted
|
|
@@ -435,17 +439,15 @@ export interface ICreditAccountsService extends Construct {
|
|
|
435
439
|
getRewards(creditAccount: Address): Promise<Array<Rewards>>;
|
|
436
440
|
/**
|
|
437
441
|
* Method to get all connected bots for credit account
|
|
438
|
-
* @param {Array<
|
|
442
|
+
* @param {Array<AccountToCheck>} accountsToCheck - list of credit accounts
|
|
439
443
|
* @param {Address | undefined} legacyMigrationBot - address of the bot to check connected bots on
|
|
440
444
|
* and their credit managers to check connected bots on
|
|
441
445
|
* @returns call result of getConnectedBots for each credit account
|
|
442
446
|
*/
|
|
443
|
-
getConnectedBots(accountsToCheck: Array<{
|
|
444
|
-
creditAccount: Address;
|
|
445
|
-
creditManager: Address;
|
|
446
|
-
}>, legacyMigrationBot: Address | undefined): Promise<{
|
|
447
|
+
getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<{
|
|
447
448
|
legacy: GetConnectedBotsResult;
|
|
448
449
|
legacyMigration: GetConnectedMigrationBotsResult;
|
|
450
|
+
additionalBots: Array<Omit<NonNullable<GetConnectedMigrationBotsResult>, "botAddress">>;
|
|
449
451
|
}>;
|
|
450
452
|
/**
|
|
451
453
|
* V3.1 method, throws in V3. Connects/disables a bot and updates prices
|