add constants for token decimals
This commit is contained in:
parent
0437fd72aa
commit
c536a04df4
|
@ -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;
|
Loading…
Reference in New Issue