@@ -4,13 +4,15 @@ import { encodeFunctionData } from "viem";
44import {
55 iCreditAccountCompressorAbi ,
66 iCreditFacadeV3MulticallAbi ,
7+ iPeripheryCompressorAbi ,
78 iRewardsCompressorAbi ,
89} from "../abi" ;
9- import type { CreditAccountData , RewardInfo } from "../base" ;
10+ import type { BotData , CreditAccountData , RewardInfo } from "../base" ;
1011import { SDKConstruct } from "../base" ;
1112import {
1213 ADDRESS_0X0 ,
1314 AP_CREDIT_ACCOUNT_COMPRESSOR ,
15+ AP_PERIPHERY_COMPRESSOR ,
1416 AP_REWARDS_COMPRESSOR ,
1517 MAX_UINT256 ,
1618 MIN_INT96 ,
@@ -296,6 +298,19 @@ export class CreditAccountsService extends SDKConstruct {
296298 return [ ...rewards ] ;
297299 }
298300
301+ async getActiveBots (
302+ marketConfigurator : Address ,
303+ account : Address ,
304+ ) : Promise < BotData [ ] > {
305+ const botsData = await this . provider . publicClient . readContract ( {
306+ abi : iPeripheryCompressorAbi ,
307+ address : this . peripheryCompressor ,
308+ functionName : "getActiveBots" ,
309+ args : [ marketConfigurator , account ] ,
310+ } ) ;
311+ return [ ...botsData ] ;
312+ }
313+
299314 /**
300315 * Generates transaction to liquidate credit account
301316 * @param account
@@ -1047,4 +1062,8 @@ export class CreditAccountsService extends SDKConstruct {
10471062 private get rewardCompressor ( ) : Address {
10481063 return this . sdk . addressProvider . getLatestVersion ( AP_REWARDS_COMPRESSOR ) ;
10491064 }
1065+
1066+ private get peripheryCompressor ( ) : Address {
1067+ return this . sdk . addressProvider . getLatestVersion ( AP_PERIPHERY_COMPRESSOR ) ;
1068+ }
10501069}
0 commit comments