diff --git a/src/components/organisms/AssetActions/Trade/Swap.tsx b/src/components/organisms/AssetActions/Trade/Swap.tsx index 63dd2fbe7..55cb5c9a4 100644 --- a/src/components/organisms/AssetActions/Trade/Swap.tsx +++ b/src/components/organisms/AssetActions/Trade/Swap.tsx @@ -1,5 +1,5 @@ import React, { ReactElement, useEffect, useState } from 'react' -import { BestPrice, DDO } from '@oceanprotocol/lib' +import { DDO } from '@oceanprotocol/lib' import styles from './Swap.module.css' import TradeInput from './TradeInput' import Button from '../../../atoms/Button' @@ -13,6 +13,7 @@ import { useOcean } from '../../../../providers/Ocean' import PriceImpact from './PriceImpact' import Decimal from 'decimal.js' +import { BestPrice } from '../../../../models/BestPrice' Decimal.set({ toExpNeg: -18, precision: 18, rounding: 1 }) @@ -36,7 +37,7 @@ export default function Swap({ const { ocean, config } = useOcean() const [oceanItem, setOceanItem] = useState({ amount: '0', - token: config.oceanTokenSymbol, + token: price.oceanSymbol, maxAmount: '0' }) const [dtItem, setDtItem] = useState({ diff --git a/src/utils/subgraph.ts b/src/utils/subgraph.ts index d9af5dfd3..ce594a6c5 100644 --- a/src/utils/subgraph.ts +++ b/src/utils/subgraph.ts @@ -70,9 +70,11 @@ const FreQuery = gql` fixedRateExchanges(orderBy: id, where: { datatoken_in: $datatoken_in }) { rate id + baseTokenSymbol datatoken { id address + symbol } } } @@ -83,6 +85,12 @@ const AssetFreQuery = gql` fixedRateExchanges(orderBy: id, where: { datatoken: $datatoken }) { rate id + baseTokenSymbol + datatoken { + id + address + symbol + } } } ` @@ -257,6 +265,7 @@ function transformPriceToBestPrice( value: frePrice[0]?.rate, address: frePrice[0]?.id, exchangeId: frePrice[0]?.id, + oceanSymbol: frePrice[0]?.baseTokenSymbol, ocean: 0, datatoken: 0, pools: [],