diff --git a/ts/client/src/client.ts b/ts/client/src/client.ts index bac5bdbb8..b44b34402 100644 --- a/ts/client/src/client.ts +++ b/ts/client/src/client.ts @@ -36,7 +36,6 @@ import { Serum3SelfTradeBehavior, Serum3Side, } from './accounts/serum3'; -import { getTokenDecimals } from './constants/tokens'; import { IDL, MangoV4 } from './mango_v4'; import { MarginTradeWithdraw } from './types'; import { @@ -345,10 +344,8 @@ export class MangoClient { const healthRemainingAccounts: PublicKey[] = await this.buildHealthRemainingAccounts(group, mangoAccount, [bank]); - const tokenDecimals = getTokenDecimals(tokenName); - return await this.program.methods - .deposit(toNativeDecimals(amount, tokenDecimals)) + .deposit(toNativeDecimals(amount, bank.mintDecimals)) .accounts({ group: group.publicKey, account: mangoAccount.publicKey, diff --git a/ts/client/src/constants/tokens.ts b/ts/client/src/constants/tokens.ts deleted file mode 100644 index 9b7cc3ee8..000000000 --- a/ts/client/src/constants/tokens.ts +++ /dev/null @@ -1,15 +0,0 @@ -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;