@@ -20,10 +20,11 @@ const zora = require("./tokens/zora.json");
2020const solana = require ( "./tokens/solana.json" ) ;
2121const bridgeUtils = require ( "@uniswap/token-list-bridge-utils" ) ;
2222const unichain = require ( "./tokens/unichain.json" ) ;
23+ const xlayer = require ( "./tokens/xlayer.json" ) ;
2324
2425module . exports = async function buildList ( ) {
2526 const parsed = version . split ( "." ) ;
26-
27+
2728 // EVM chains only for bridgeUtils.chainify (which validates Ethereum addresses)
2829 const evmTokens = [
2930 ...mainnet ,
@@ -45,6 +46,7 @@ module.exports = async function buildList() {
4546 ...worldchain ,
4647 ...zora ,
4748 ...unichain ,
49+ ...xlayer ,
4850 ]
4951 // sort them by symbol for easy readability
5052 . sort ( ( t1 , t2 ) => {
@@ -53,7 +55,7 @@ module.exports = async function buildList() {
5355 }
5456 return t1 . chainId < t2 . chainId ? - 1 : 1 ;
5557 } ) ;
56-
58+
5759 const l1List = {
5860 name : "Uniswap Labs Default" ,
5961 timestamp : new Date ( ) . toISOString ( ) ,
@@ -67,19 +69,19 @@ module.exports = async function buildList() {
6769 keywords : [ "uniswap" , "default" ] ,
6870 tokens : evmTokens ,
6971 } ;
70-
72+
7173 // Apply bridge utils to EVM chains only
7274 const listWithBridgeInfo = await bridgeUtils . chainify ( l1List ) ;
73-
75+
7476 listWithBridgeInfo . tokens . push ( ...solana ) ;
75-
77+
7678 // Re-sort all tokens by chainId first, then symbol
7779 listWithBridgeInfo . tokens . sort ( ( t1 , t2 ) => {
7880 if ( t1 . chainId === t2 . chainId ) {
7981 return t1 . symbol . toLowerCase ( ) < t2 . symbol . toLowerCase ( ) ? - 1 : 1 ;
8082 }
8183 return t1 . chainId < t2 . chainId ? - 1 : 1 ;
8284 } ) ;
83-
85+
8486 return listWithBridgeInfo ;
8587} ;
0 commit comments