Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ export type Chain = {

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

const CHAINS: Chain[] = [
const MAX_GET_LOGS_RANGE: number = 1900;

// Override maxGetLogsRange for specific chains by chain name
const MAX_GET_LOGS_RANGE_BY_CHAIN_NAME: Record<string, number> = {
"scroll-sepolia": 2000, // As example
};

const RAW_CHAINS: Chain[] = [
{
id: 1,
name: "mainnet",
Expand Down Expand Up @@ -1305,7 +1312,6 @@ const CHAINS: Chain[] = [
.default("https://sepolia-rpc.scroll.io")
.parse(process.env.SCROLL_SEPOLIA_RPC_URL),
pricesFromTimestamp: Date.UTC(2024, 0, 1, 0, 0, 0),
maxGetLogsRange: 2000,
tokens: [
{
code: "ETH",
Expand Down Expand Up @@ -1376,7 +1382,6 @@ const CHAINS: Chain[] = [
.default("https://rpc.scroll.io")
.parse(process.env.SCROLL_RPC_URL),
pricesFromTimestamp: Date.UTC(2024, 0, 1, 0, 0, 0),
maxGetLogsRange: 9000,
tokens: [
{
code: "ETH",
Expand Down Expand Up @@ -1512,7 +1517,6 @@ const CHAINS: Chain[] = [
.default("https://evm-rpc.sei-apis.com")
.parse(process.env.SEI_MAINNET_RPC_URL),
pricesFromTimestamp: Date.UTC(2024, 0, 1, 0, 0, 0),
maxGetLogsRange: 10000,
tokens: [
{
code: "SEI",
Expand Down Expand Up @@ -1854,7 +1858,6 @@ const CHAINS: Chain[] = [
.default("https://mainnet.hashio.io/api")
.parse(process.env.HEDERA_RPC_URL),
pricesFromTimestamp: Date.UTC(2025, 1, 1, 0, 0, 0),
maxGetLogsRange: 9000,
tokens: [
{
code: "HBAR",
Expand Down Expand Up @@ -1891,6 +1894,12 @@ const CHAINS: Chain[] = [
},
];

const CHAINS = RAW_CHAINS.map((chain) => ({
...chain,
maxGetLogsRange:
MAX_GET_LOGS_RANGE_BY_CHAIN_NAME[chain.name] ?? MAX_GET_LOGS_RANGE,
}));

export const getDecimalsForToken = (
chainId: ChainId,
tokenAddress: string
Expand Down