import type { Token } from '@saberhq/token-utils' ; import { TokenAmount } from '@saberhq/token-utils' ; export const tryParseTokenAmount = ( token , uiAmount ) : TokenAmount | undefined => { if ( ! token || ! uiAmount ) { return undefined ; } try { return TokenAmount . parse ( token , uiAmount ) ; } catch ( e ) { console . warn ( 'Error parsing token amount' , e ) ; } return undefined ; } ; export const tryTokenAmount = ( token , amount ) : TokenAmount | undefined => { if ( ! token || ! amount ) { return undefined ; } try { return new TokenAmount ( token , amount ) ; } catch ( e ) { console . warn ( 'Error new token amount' , e ) ; } return undefined ; } ;