mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
Revert pairs cleanup (#13972)
This commit is contained in:
parent
9a9cfd8936
commit
9af1b65377
File diff suppressed because it is too large
Load Diff
|
@ -268,9 +268,7 @@ function sort(list: List) {
|
||||||
return t1.address.localeCompare(t2.address);
|
return t1.address.localeCompare(t2.address);
|
||||||
});
|
});
|
||||||
list.tokens.forEach(t => {
|
list.tokens.forEach(t => {
|
||||||
if (t.pairs) {
|
|
||||||
t.pairs.sort((p1, p2) => p1.base.localeCompare(p2.base));
|
t.pairs.sort((p1, p2) => p1.base.localeCompare(p2.base));
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,14 +296,6 @@ export function diffTokenlist(listOrig1: List, listOrig2: List): unknown {
|
||||||
return diffs;
|
return diffs;
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjustTokenList(list: List) {
|
|
||||||
list.tokens.forEach(t => {
|
|
||||||
if (t.pairs.length == 0) {
|
|
||||||
delete t.pairs;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function rebuildTokenlist(chainName: string, pairs: [TokenItem, TokenItem][], listName: string, forceExcludeList: string[]): Promise<void> {
|
export async function rebuildTokenlist(chainName: string, pairs: [TokenItem, TokenItem][], listName: string, forceExcludeList: string[]): Promise<void> {
|
||||||
// sanity check, prevent deletion of many pairs
|
// sanity check, prevent deletion of many pairs
|
||||||
if (!pairs || pairs.length < 5) {
|
if (!pairs || pairs.length < 5) {
|
||||||
|
@ -345,8 +335,6 @@ export async function rebuildTokenlist(chainName: string, pairs: [TokenItem, Tok
|
||||||
await addPairIfNeeded(p[0], p[1], list);
|
await addPairIfNeeded(p[0], p[1], list);
|
||||||
});
|
});
|
||||||
console.log(`Tokenlist updated: ${list.tokens.length} tokens`);
|
console.log(`Tokenlist updated: ${list.tokens.length} tokens`);
|
||||||
adjustTokenList(list);
|
|
||||||
console.log(`Tokenlist adjusted: ${list.tokens.length} tokens`);
|
|
||||||
|
|
||||||
const newList = createTokensList(listName, list.tokens,
|
const newList = createTokensList(listName, list.tokens,
|
||||||
"2021-01-29T01:02:03.000+00:00", // use constant here to prevent changing time every time
|
"2021-01-29T01:02:03.000+00:00", // use constant here to prevent changing time every time
|
||||||
|
|
Loading…
Reference in New Issue
Block a user