diff --git a/spark-frontend/src/screens/TradeScreen/LeftBlock/CreateOrderSpot/CreateOrderSpotVM.tsx b/spark-frontend/src/screens/TradeScreen/LeftBlock/CreateOrderSpot/CreateOrderSpotVM.tsx index 7246e82c..dcc0910f 100644 --- a/spark-frontend/src/screens/TradeScreen/LeftBlock/CreateOrderSpot/CreateOrderSpotVM.tsx +++ b/spark-frontend/src/screens/TradeScreen/LeftBlock/CreateOrderSpot/CreateOrderSpotVM.tsx @@ -142,6 +142,11 @@ class CreateOrderSpotVM { const { tradeStore, balanceStore } = this.rootStore; this.inputAmount = amount.toDecimalPlaces(0); + if (this.inputPrice.eq(BN.ZERO)) { + this.inputTotal = BN.ZERO; + return; + } + if (!sync) return; const formattedInputPrice = BN.formatUnits(this.inputPrice, DEFAULT_DECIMALS); @@ -170,6 +175,11 @@ class CreateOrderSpotVM { const { tradeStore, balanceStore } = this.rootStore; this.inputTotal = total; + if (this.inputPrice.eq(BN.ZERO)) { + this.inputAmount = BN.ZERO; + return; + } + if (!sync) return; const formattedInputPrice = BN.formatUnits(this.inputPrice, DEFAULT_DECIMALS); diff --git a/spark-frontend/src/stores/SettingsStore.ts b/spark-frontend/src/stores/SettingsStore.ts index 87aff50c..73553b26 100644 --- a/spark-frontend/src/stores/SettingsStore.ts +++ b/spark-frontend/src/stores/SettingsStore.ts @@ -5,9 +5,9 @@ import { THEME_TYPE } from "@src/themes/ThemeProvider"; import RootStore from "@stores/RootStore"; export interface ISerializedSettingStore { - isUserAgreedWithTerms: boolean; - tradeTableSize: number; - orderType: ORDER_TYPE; + isUserAgreedWithTerms?: boolean; + tradeTableSize?: number; + orderType?: ORDER_TYPE; } export enum TRADE_TABLE_SIZE { @@ -25,9 +25,9 @@ class SettingsStore { this.rootStore = rootStore; makeAutoObservable(this); if (initState) { - this.setIsUserAgreedWithTerms(initState.isUserAgreedWithTerms); - this.setTradeTableSize(initState.tradeTableSize); - this.setOrderType(initState.orderType); + this.setIsUserAgreedWithTerms(initState.isUserAgreedWithTerms ?? false); + this.setTradeTableSize(initState.tradeTableSize ?? TRADE_TABLE_SIZE.S); + this.setOrderType(initState.orderType ?? ORDER_TYPE.Market); } }