diff --git a/ts/client/src/constants.ts b/ts/client/src/constants/index.ts similarity index 100% rename from ts/client/src/constants.ts rename to ts/client/src/constants/index.ts diff --git a/ts/client/src/constants/tokens.ts b/ts/client/src/constants/tokens.ts new file mode 100644 index 000000000..9b7cc3ee8 --- /dev/null +++ b/ts/client/src/constants/tokens.ts @@ -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;