Skip to content

Commit

Permalink
fix: correct bug with quote
Browse files Browse the repository at this point in the history
  • Loading branch information
EchoDex committed Nov 11, 2024
1 parent 438d657 commit ff7b801
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions src/stores/SwapStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,15 @@ class SwapStore {

swapTokens = async ({ slippage }: { slippage: number }): Promise<boolean> => {
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,
};
Expand All @@ -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) {
Expand Down

0 comments on commit ff7b801

Please sign in to comment.