Skip to content

Commit

Permalink
Add chainId to lists name
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Jun 14, 2024
1 parent 3210d6f commit 49f2486
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/token_list_gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export const generateTokenList = async (
name:
options && options.preserveListName
? name
: listNameToArbifiedListName(name),
: listNameToArbifiedListName(name, l2.network.chainID),
timestamp: new Date().toISOString(),
version,
tokens: arbifiedTokenList,
Expand Down
9 changes: 7 additions & 2 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@ for (const address of Object.keys(logoUris)) {
logoUris[address.toLowerCase()] = logoUris[address];
}

export const listNameToArbifiedListName = (name: string) => {
export const listNameToArbifiedListName = (
name: string,
childChainId: number,
) => {
const prefix = 'Arbed ';

let fileName = sanitizeNameString(name);
if (!fileName.startsWith(prefix)) {
fileName = prefix + fileName;
}
return fileName.split(' ').slice(0, 2).join(' ').slice(0, 20);

const baseName = fileName.split(' ').slice(0, 2).join(' ').slice(0, 20);
return `${baseName} ${childChainId}`;
};

export const getL1TokenAndL2Gateway = async (
Expand Down

0 comments on commit 49f2486

Please sign in to comment.