import type { Address } from "viem"; import type { CreditAccountData } from "../base/index.js"; import { SDKConstruct } from "../base/index.js"; import { type PriceUpdate } from "../market/index.js"; import type { RWAOpenAccountRequirements } from "../market/rwa/index.js"; import type { OnchainSDK } from "../OnchainSDK.js"; import { type RouterCASlice } from "../router/index.js"; import type { MultiCall, RawTx } from "../types/index.js"; import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerOperationResult, DefaultPartialLiquidationParams, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, Rewards, SetBotProps, StartDelayedWithdrawalProps, UpdateQuotasProps, WithdrawCollateralProps } from "./types.js"; /** * Options for configuring the credit account service. **/ export interface CreditAccountServiceOptions { /** * Maximum number of credit accounts to fetch per compressor call. * When set, accounts are loaded in batches of this size until all are fetched. **/ batchSize?: number; } /** * Returns the withdrawal compressor contract address for the given chain, or `undefined` if none is configured. * @param chainId - Numeric chain ID. * @returns Withdrawal compressor address, or `undefined`. **/ export declare function getWithdrawalCompressorAddress(chainId: number): { address: Address; version: 311 | 310; }; /** * Service for querying and operating on Gearbox credit accounts. * * Provides methods to fetch account data, build transactions for common operations * (open, close, liquidate, swap, manage collateral/debt/quotas), and generate * the price feed updates required by the credit facade. * * @see {@link ICreditAccountsService} **/ export declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditAccountsService { #private; constructor(sdk: OnchainSDK, options?: CreditAccountServiceOptions); setBatchSize(batchSize: number): void; /** * {@inheritDoc ICreditAccountsService.getCreditAccountData} **/ getCreditAccountData(account: Address, blockNumber?: bigint): Promise | undefined>; /** * {@inheritDoc ICreditAccountsService.getCreditAccounts} **/ getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise>; /** * {@inheritDoc ICreditAccountsService.getBorrowerCreditAccounts} **/ getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise>>; /** * {@inheritDoc ICreditAccountsService.getRewards} **/ getRewards(creditAccount: Address): Promise>; /** * {@inheritDoc ICreditAccountsService.getConnectedBots} **/ getConnectedBots(accountsToCheck: Array, legacyMigrationBot: Address | undefined, additionalBots: Array
): Promise<{ legacy: GetConnectedBotsResult; legacyMigration: GetConnectedMigrationBotsResult; additionalBots: Array, "botAddress">>; }>; /** * {@inheritDoc ICreditAccountsService.fullyLiquidate} **/ fullyLiquidate(props: FullyLiquidateProps): Promise; /** * {@inheritDoc ICreditAccountsService.defaultPartialLiquidationParams} */ defaultPartialLiquidationParams(ca: CreditAccountData): DefaultPartialLiquidationParams; /** * {@inheritDoc ICreditAccountsService.partiallyLiquidate} */ partiallyLiquidate(props: PartiallyLiquidateProps): Promise; /** * {@inheritDoc ICreditAccountsService.closeCreditAccount} **/ closeCreditAccount({ operation, assetsToWithdraw, creditAccount: ca, to, slippage, closePath, }: CloseCreditAccountProps): Promise; /** * {@inheritDoc ICreditAccountsService.updateQuotas} **/ updateQuotas({ minQuota, averageQuota, creditAccount, }: UpdateQuotasProps): Promise; /** * {@inheritDoc ICreditAccountsService.addCollateral} **/ addCollateral({ creditAccount, asset, permit, ethAmount, minQuota, averageQuota, }: AddCollateralProps): Promise; /** * {@inheritDoc ICreditAccountsService.changeDebt} **/ changeDebt({ creditAccount, amount, collateral, }: ChangeDeptProps): Promise; /** * {@inheritDoc ICreditAccountsService.executeSwap} **/ executeSwap({ creditAccount, calls: swapCalls, minQuota, averageQuota, }: ExecuteSwapProps): Promise; /** * {@inheritDoc ICreditAccountsService.previewDelayedWithdrawal} **/ previewDelayedWithdrawal({ creditAccount, amount, token, }: PreviewDelayedWithdrawalProps): Promise; /** * {@inheritDoc ICreditAccountsService.getPendingWithdrawals} **/ getPendingWithdrawals({ creditAccount, }: GetPendingWithdrawalsProps): Promise; /** * {@inheritDoc ICreditAccountsService.startDelayedWithdrawal} **/ startDelayedWithdrawal({ creditAccount, minQuota, averageQuota, preview, }: StartDelayedWithdrawalProps): Promise; /** * {@inheritDoc ICreditAccountsService.claimDelayed} **/ claimDelayed({ creditAccount, minQuota, averageQuota, claimableNow, }: ClaimDelayedProps): Promise; /** * {@inheritDoc ICreditAccountsService.getApprovalAddress} **/ getApprovalAddress(options: GetApprovalAddressProps): Promise
; /** * {@inheritDoc ICreditAccountsService.getOpenAccountRequirements} */ getOpenAccountRequirements(borrower: Address, creditManager: Address, props: GetOpenAccountRequirementsProps): Promise; /** * {@inheritDoc ICreditAccountsService.openCA} **/ openCA(props: OpenCAProps): Promise; /** * {@inheritDoc ICreditAccountsService.getBorrowRate} **/ getBorrowRate(ca: CreditAccountData): bigint; /** * {@inheritDoc ICreditAccountsService.getOptimalHFForPartialLiquidation} **/ getOptimalHFForPartialLiquidation(ca: CreditAccountData): bigint; /** * Returns multicall entries to redeem (unwrap) RWA ERC-4626 vault shares into underlying for the given credit manager. * Used when withdrawing debt from a RWA market: redeems adapter vault shares so the underlying can be withdrawn. * Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured. * @param amount - Number of vault shares (adapter tokens) to redeem * @param creditManager - Credit manager address * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured */ getRWAUnwrapCalls(amount: bigint, creditManager: Address): Promise | undefined>; /** * Returns multicall entries to deposit (wrap) underlying into RWA ERC-4626 vault shares for the given credit manager. * Used when adding debt on a RWA market: deposits underlying into the adapter vault so shares are minted on the account. * Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured. * @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals) * @param creditManager - Credit manager address * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured */ getRWAWrapCalls(amount: bigint, creditManager: Address): Promise | undefined>; /** * Returns multicall entries to call redeemDiff on the RWA ERC-4626 adapter for the given credit manager. * Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess RWA vault tokens. * Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured. * @param amount - Leftover vault share amount to redeem (in adapter/vault decimals) * @param creditManager - Credit manager address * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured */ getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise | undefined>; /** * Returns multicall entries to call depositDiff on the RWA ERC-4626 adapter for the given credit manager. * Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying. * Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured. * @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals) * @param creditManager - Credit manager address * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured */ getDepositDiffCalls(amount: bigint, creditManager: Address): Promise | undefined>; /** * {@inheritDoc ICreditAccountsService.setBot} */ setBot({ botAddress, permissions: defaultPermissions, targetContract, }: SetBotProps): Promise; /** * {@inheritDoc ICreditAccountsService.withdrawCollateral} */ withdrawCollateral({ creditAccount, assetsToWithdraw, to, minQuota, averageQuota, }: WithdrawCollateralProps): Promise; /** * {@inheritDoc ICreditAccountsService.repayCreditAccount} */ repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, calls: wrapCalls, }: RepayCreditAccountProps): Promise; /** * {@inheritDoc ICreditAccountsService.repayAndLiquidateCreditAccount} */ repayAndLiquidateCreditAccount({ collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayAndLiquidateCreditAccountProps): Promise; /** * {@inheritDoc ICreditAccountsService.claimFarmRewards} */ claimFarmRewards({ calls: externalCalls, creditAccount: ca, minQuota, averageQuota, tokensToClaim, }: ClaimFarmRewardsProps): Promise; /** * Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute * {@inheritDoc ICreditAccountsService.getOnDemandPriceUpdates} **/ getOnDemandPriceUpdates(account: CreditAccountTokensSlice, ignoreReservePrices?: boolean): Promise; /** * {@inheritDoc ICreditAccountsService.multicall} */ multicall(creditAccount: RouterCASlice, calls: MultiCall[], options?: { ignoreReservePrices?: boolean; }): Promise; /** * {@inheritDoc ICreditAccountsService.botMulticall} */ botMulticall(creditAccount: RouterCASlice, calls: MultiCall[], options?: { ignoreReservePrices?: boolean; }): Promise; /** * Returns addresses of market configurators */ private get marketConfigurators(); private get rewardCompressor(); private get peripheryCompressor(); private get compressor(); }