File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { isAddress } from "viem";
2
2
import { getTokenInfo } from "./erc20" ;
3
3
import { type TokenInfo } from "./types" ;
4
4
5
- type SymbolMapping = Record < string , TokenInfo > ;
5
+ type SymbolMapping = Record < string , TokenInfo | undefined > ;
6
6
type ChainId = number ;
7
7
export type BlockchainMapping = Record < ChainId , SymbolMapping > ;
8
8
@@ -36,7 +36,7 @@ export async function getTokenDetails(
36
36
chainId : number ,
37
37
symbolOrAddress : string ,
38
38
tokenMap ?: BlockchainMapping ,
39
- ) : Promise < TokenInfo > {
39
+ ) : Promise < TokenInfo | undefined > {
40
40
if ( isAddress ( symbolOrAddress , { strict : false } ) ) {
41
41
return getTokenInfo ( chainId , symbolOrAddress ) ;
42
42
}
Original file line number Diff line number Diff line change @@ -12,4 +12,9 @@ describe("getTokenDetails", () => {
12
12
) ;
13
13
expect ( tokenDetails ) . toBeDefined ( ) ;
14
14
} ) ;
15
+
16
+ it ( "should return the token details for a given symbol" , async ( ) => {
17
+ const tokenDetails = await getTokenDetails ( 43114 , "UNI" ) ;
18
+ expect ( tokenDetails ) . toBeUndefined ( ) ;
19
+ } ) ;
15
20
} ) ;
You can’t perform that action at this time.
0 commit comments