Skip to content

Commit ca060d2

Browse files
committed
fix: add btach limit to getting accounts
1 parent 87a757d commit ca060d2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/dev/createAnvilClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {
1212
} from "viem";
1313
import { createTestClient, publicActions, toHex, walletActions } from "viem";
1414

15-
interface AnvilNodeInfo {
15+
export interface AnvilNodeInfo {
1616
currentBlockNumber: string; // hexutil.Big is a big number in hex format
1717
currentBlockTimestamp: number;
1818
currentBlockHash: string;
@@ -31,7 +31,7 @@ interface AnvilNodeInfo {
3131
};
3232
}
3333

34-
type AnvilRPCSchema = [
34+
export type AnvilRPCSchema = [
3535
...TestRpcSchema<"anvil">,
3636
{
3737
Method: "anvil_nodeInfo";

src/sdk/accounts/CreditAccountsService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface CreditAccountFilter {
3838
includeZeroDebt?: boolean;
3939
minHealthFactor?: number;
4040
maxHealthFactor?: number;
41+
batchLimit?: bigint;
4142
}
4243

4344
export class CreditAccountsService extends SDKConstruct {
@@ -119,6 +120,7 @@ export class CreditAccountsService extends SDKConstruct {
119120
maxHealthFactor = 65_535, // TODO: this will change to bigint
120121
minHealthFactor = 0,
121122
owner = ADDRESS_0X0,
123+
batchLimit,
122124
} = args ?? {};
123125
// either credit manager or all attached markets
124126
const arg0 = creditManager ?? {
@@ -142,7 +144,9 @@ export class CreditAccountsService extends SDKConstruct {
142144
let offset = 0n;
143145
do {
144146
const [accounts, newOffset] = await this.#getCreditAccounts(
145-
[arg0, { ...caFilter, reverting }, offset],
147+
[arg0, { ...caFilter, reverting }, offset, batchLimit!].filter(
148+
Boolean,
149+
) as unknown as GetCreditAccountsArgs,
146150
priceUpdateTxs,
147151
options,
148152
);

0 commit comments

Comments
 (0)