Skip to content

Commit 57eab2b

Browse files
authored
chore: set default maxGetLogsRange with override functionality (#711)
1 parent 493518c commit 57eab2b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/config.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ export type Chain = {
5353

5454
const rpcUrl = z.string().url();
5555

56-
const CHAINS: Chain[] = [
56+
const MAX_GET_LOGS_RANGE: number = 1900;
57+
58+
// Override maxGetLogsRange for specific chains by chain name
59+
const MAX_GET_LOGS_RANGE_BY_CHAIN_NAME: Record<string, number> = {
60+
"scroll-sepolia": 2000, // As example
61+
};
62+
63+
const RAW_CHAINS: Chain[] = [
5764
{
5865
id: 1,
5966
name: "mainnet",
@@ -1305,7 +1312,6 @@ const CHAINS: Chain[] = [
13051312
.default("https://sepolia-rpc.scroll.io")
13061313
.parse(process.env.SCROLL_SEPOLIA_RPC_URL),
13071314
pricesFromTimestamp: Date.UTC(2024, 0, 1, 0, 0, 0),
1308-
maxGetLogsRange: 2000,
13091315
tokens: [
13101316
{
13111317
code: "ETH",
@@ -1376,7 +1382,6 @@ const CHAINS: Chain[] = [
13761382
.default("https://rpc.scroll.io")
13771383
.parse(process.env.SCROLL_RPC_URL),
13781384
pricesFromTimestamp: Date.UTC(2024, 0, 1, 0, 0, 0),
1379-
maxGetLogsRange: 9000,
13801385
tokens: [
13811386
{
13821387
code: "ETH",
@@ -1512,7 +1517,6 @@ const CHAINS: Chain[] = [
15121517
.default("https://evm-rpc.sei-apis.com")
15131518
.parse(process.env.SEI_MAINNET_RPC_URL),
15141519
pricesFromTimestamp: Date.UTC(2024, 0, 1, 0, 0, 0),
1515-
maxGetLogsRange: 10000,
15161520
tokens: [
15171521
{
15181522
code: "SEI",
@@ -1854,7 +1858,6 @@ const CHAINS: Chain[] = [
18541858
.default("https://mainnet.hashio.io/api")
18551859
.parse(process.env.HEDERA_RPC_URL),
18561860
pricesFromTimestamp: Date.UTC(2025, 1, 1, 0, 0, 0),
1857-
maxGetLogsRange: 9000,
18581861
tokens: [
18591862
{
18601863
code: "HBAR",
@@ -1891,6 +1894,12 @@ const CHAINS: Chain[] = [
18911894
},
18921895
];
18931896

1897+
const CHAINS = RAW_CHAINS.map((chain) => ({
1898+
...chain,
1899+
maxGetLogsRange:
1900+
MAX_GET_LOGS_RANGE_BY_CHAIN_NAME[chain.name] ?? MAX_GET_LOGS_RANGE,
1901+
}));
1902+
18941903
export const getDecimalsForToken = (
18951904
chainId: ChainId,
18961905
tokenAddress: string

0 commit comments

Comments
 (0)