add constants for token decimals

This commit is contained in:
tjs 2022-05-25 20:27:52 -04:00
parent 0437fd72aa
commit c536a04df4
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
export const getTokenDecimals = (symbol: string) => {
const tokenMeta = tokens.find((t) => t.symbol === symbol);
if (!tokenMeta) throw new Error('TokenDecimalError: Token not found');
return tokenMeta.decimals;
};
const tokens = [
{ symbol: 'USDC', decimals: 6 },
{ symbol: 'SOL', decimals: 9 },
{ symbol: 'BTC', decimals: 6 },
];
export default tokens;