@@ -16,7 +16,8 @@ import {
1616 avalanche ,
1717 berachain ,
1818 worldchain ,
19- monad
19+ monad ,
20+ abstract ,
2021} from "viem/chains" ;
2122import { NATIVE_SYMBOL_BY_CHAIN_ID , NATIVE_TOKEN_ADDRESS } from "../constants" ;
2223import type { Address } from "viem" ;
@@ -48,6 +49,7 @@ export function isChainIdSupported(
4849 avalanche . id ,
4950 berachain . id ,
5051 worldchain . id ,
52+ abstract . id ,
5153 ] ;
5254 return supportedChainIds . includes ( chainId ) ;
5355}
@@ -111,8 +113,15 @@ export async function transferLogs({
111113 const midpoint = Math . floor ( results . length / 2 ) ;
112114 const enrichedLogs = transferLogsAddresses
113115 . map ( ( log , index ) => {
114- const symbol = results [ index ] . result as string ;
115- const decimals = results [ midpoint + index ] . result as number ;
116+ const symbol = results [ index ] . result ;
117+ const decimals = results [ midpoint + index ] . result ;
118+
119+ // zkSync-style system contracts can emit Transfer-like logs for native accounting,
120+ // but those addresses do not implement ERC20 metadata, so skip them here.
121+ if ( symbol == null || decimals == null || typeof decimals !== "number" ) {
122+ return null ;
123+ }
124+
116125 const amount =
117126 log . data === "0x" ? "0" : formatUnits ( BigInt ( log . data ) , decimals ) ;
118127 const amountRaw = log . data === "0x" ? 0n : BigInt ( log . data ) ;
@@ -123,7 +132,7 @@ export async function transferLogs({
123132
124133 return { to, from, symbol, amount, amountRaw, address, decimals } ;
125134 } )
126- . filter ( ( log ) => log . amount !== "0" ) ;
135+ . filter ( ( log ) : log is EnrichedLog => log != null && log . amount !== "0" )
127136
128137 return enrichedLogs ;
129138}
0 commit comments