import type { Token } from "../types";

/**
 * Function to convert tokens from {id: Token[]} to Token[] format
 * @returns Token[]
 */
export function getFormattedTokenList(tokens: { [chainId: string]: Token[] }) {
	const _tokens = Object.values(tokens ?? []);
	if (_tokens) {
		return _tokens.reduce((newArr, currentArr) => {
			return newArr.concat(...currentArr);
		}, []);
	}
	return [];
}
