@@ -84,7 +84,6 @@ class CreateOrderSpotVM {
84
84
this . inputPrice . eq ( BN . ZERO ) &&
85
85
this . activeInput !== ACTIVE_INPUT . Price
86
86
) {
87
- console . log ( orderType === ORDER_TYPE . Limit , this . inputPrice . eq ( BN . ZERO ) , this . activeInput ) ;
88
87
this . setInputPriceDebounce ( price ) ;
89
88
}
90
89
} ,
@@ -96,13 +95,15 @@ class CreateOrderSpotVM {
96
95
}
97
96
98
97
get canProceed ( ) {
99
- return this . inputAmount . gt ( 0 ) && this . inputPrice . gt ( 0 ) && this . inputTotal . gt ( 0 ) && ! this . inputTotalError ;
98
+ return this . inputAmount . gt ( 0 ) && this . inputPrice . gt ( 0 ) && this . inputTotal . gt ( 0 ) && ! this . isInputError ;
100
99
}
101
100
102
- get inputTotalError ( ) : boolean {
101
+ get isInputError ( ) : boolean {
103
102
const { tradeStore, balanceStore } = this . rootStore ;
103
+ const { market } = tradeStore ;
104
104
const amount = this . isSell ? this . inputAmount : this . inputTotal ;
105
- const balance = balanceStore . getBalance ( tradeStore . market ! . quoteToken . assetId ) ;
105
+ const token = this . isSell ? market ! . baseToken . assetId : market ! . quoteToken . assetId ;
106
+ const balance = balanceStore . getBalance ( token ) ;
106
107
return balance ? amount . gt ( balance ) : false ;
107
108
}
108
109
@@ -151,7 +152,6 @@ class CreateOrderSpotVM {
151
152
const formattedAmount = BN . formatUnits ( this . inputAmount , tradeStore . market ! . baseToken . decimals ) ;
152
153
const formattedTotal = BN . formatUnits ( this . inputTotal , tradeStore . market ! . quoteToken . decimals ) ;
153
154
154
- console . log ( this . activeInput === ACTIVE_INPUT . Price ) ;
155
155
if ( this . activeInput === ACTIVE_INPUT . Amount || this . activeInput === ACTIVE_INPUT . Price ) {
156
156
const total = BN . parseUnits ( formattedAmount . times ( formattedPrice ) , tradeStore . market ! . quoteToken . decimals ) ;
157
157
this . setInputTotal ( total ) ;
0 commit comments