mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
16 lines
427 B
TypeScript
16 lines
427 B
TypeScript
export function createTokenUtils(tokens) {
|
|
const getTokenByAddress = address =>
|
|
tokens.find(token => token.address === address);
|
|
const getTokenByKey = key => tokens.find(token => token.key === key);
|
|
const tokenKeys = tokens.map(token => token.key);
|
|
const rootTokens = tokens.map(token => token.root);
|
|
|
|
return {
|
|
allTokens: tokens,
|
|
tokenKeys,
|
|
getTokenByAddress,
|
|
getTokenByKey,
|
|
rootTokens
|
|
};
|
|
}
|