File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
packages/wallet/backend/src/quote Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -51,23 +51,24 @@ export class QuoteService implements IQuoteService {
5151 params . userId
5252 )
5353
54+ let asset : Pick < Asset , 'scale' | 'code' > | undefined =
55+ await this . rafikiClient . getAssetById ( assetId )
56+ if ( ! asset ) {
57+ throw new NotFound ( )
58+ }
59+
5460 const account = await this . accountService . getAccountById (
5561 params . userId ,
5662 existingWalletAddress . accountId
5763 )
5864 const balance = account . balance
5965
60- if ( Number ( balance ) < params . amount ) {
61- throw new BadRequest ( 'Not enough funds in account' )
62- }
66+ const originalValue = BigInt ( ( params . amount * 10 ** asset . scale ) . toFixed ( ) )
6367
64- let asset : Pick < Asset , 'scale' | 'code' > | undefined =
65- await this . rafikiClient . getAssetById ( assetId )
66- if ( ! asset ) {
67- throw new NotFound ( )
68+ if ( Number ( balance ) < originalValue ) {
69+ throw new BadRequest ( 'Not enough funds in account' )
6870 }
6971
70- const originalValue = BigInt ( ( params . amount * 10 ** asset . scale ) . toFixed ( ) )
7172 let value = originalValue
7273
7374 let paymentUrl = params . receiver
You can’t perform that action at this time.
0 commit comments