diff --git a/src/screens/SpotScreen/RightBlock/CreateOrder/CreateOrderVM.tsx b/src/screens/SpotScreen/RightBlock/CreateOrder/CreateOrderVM.tsx index 634c530..03e8068 100644 --- a/src/screens/SpotScreen/RightBlock/CreateOrder/CreateOrderVM.tsx +++ b/src/screens/SpotScreen/RightBlock/CreateOrder/CreateOrderVM.tsx @@ -419,7 +419,7 @@ class CreateOrderVM { const formatOrder = (order: Order) => new SpotMarketOrder({ ...order, - quoteAssetId: CONFIG.TOKENS_BY_SYMBOL.KMLA.assetId, + quoteAssetId: market.quoteToken.assetId, }); if ("ActiveSellOrder" in activeOrders.data) { diff --git a/src/stores/SwapStore.ts b/src/stores/SwapStore.ts index d1ac3ef..a1fdd5c 100644 --- a/src/stores/SwapStore.ts +++ b/src/stores/SwapStore.ts @@ -123,12 +123,15 @@ class SwapStore { swapTokens = async ({ slippage }: { slippage: number }): Promise => { const { notificationStore, tradeStore } = this.rootStore; - const baseToken = tradeStore.market?.baseToken; + + if (!tradeStore.market) return false; + + const { baseToken, quoteToken } = tradeStore.market; const isBuy = baseToken?.assetId === this.buyToken.assetId; const bcNetwork = FuelNetwork.getInstance(); const params: GetActiveOrdersParams = { limit: 50, // or more if needed - market: [tradeStore.market!.contractAddress], + market: [tradeStore.market.contractAddress], asset: baseToken?.assetId, orderType: !isBuy ? OrderType.Buy : OrderType.Sell, }; @@ -140,7 +143,7 @@ class SwapStore { const formatOrder = (order: Order) => new SpotMarketOrder({ ...order, - quoteAssetId: CONFIG.TOKENS_BY_SYMBOL.KMLA.assetId, + quoteAssetId: quoteToken.assetId, }); if ("ActiveSellOrder" in activeOrders.data) {