1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Merge branch 'main' into feature/account_page

This commit is contained in:
Matthias Kretschmann 2021-09-02 18:51:56 +02:00
commit 30f262de33
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,5 @@
import React, { ReactElement, useEffect, useState } from 'react' 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 styles from './Swap.module.css'
import TradeInput from './TradeInput' import TradeInput from './TradeInput'
import Button from '../../../atoms/Button' import Button from '../../../atoms/Button'
@ -13,6 +13,7 @@ import { useOcean } from '../../../../providers/Ocean'
import PriceImpact from './PriceImpact' import PriceImpact from './PriceImpact'
import Decimal from 'decimal.js' import Decimal from 'decimal.js'
import { BestPrice } from '../../../../models/BestPrice'
Decimal.set({ toExpNeg: -18, precision: 18, rounding: 1 }) Decimal.set({ toExpNeg: -18, precision: 18, rounding: 1 })
@ -36,7 +37,7 @@ export default function Swap({
const { ocean, config } = useOcean() const { ocean, config } = useOcean()
const [oceanItem, setOceanItem] = useState<TradeItem>({ const [oceanItem, setOceanItem] = useState<TradeItem>({
amount: '0', amount: '0',
token: config.oceanTokenSymbol, token: price.oceanSymbol,
maxAmount: '0' maxAmount: '0'
}) })
const [dtItem, setDtItem] = useState<TradeItem>({ const [dtItem, setDtItem] = useState<TradeItem>({

View File

@ -79,9 +79,11 @@ const FreQuery = gql`
fixedRateExchanges(orderBy: id, where: { datatoken_in: $datatoken_in }) { fixedRateExchanges(orderBy: id, where: { datatoken_in: $datatoken_in }) {
rate rate
id id
baseTokenSymbol
datatoken { datatoken {
id id
address address
symbol
} }
} }
} }
@ -92,6 +94,12 @@ const AssetFreQuery = gql`
fixedRateExchanges(orderBy: id, where: { datatoken: $datatoken }) { fixedRateExchanges(orderBy: id, where: { datatoken: $datatoken }) {
rate rate
id id
baseTokenSymbol
datatoken {
id
address
symbol
}
} }
} }
` `
@ -303,6 +311,7 @@ function transformPriceToBestPrice(
value: frePrice[0]?.rate, value: frePrice[0]?.rate,
address: frePrice[0]?.id, address: frePrice[0]?.id,
exchangeId: frePrice[0]?.id, exchangeId: frePrice[0]?.id,
oceanSymbol: frePrice[0]?.baseTokenSymbol,
ocean: 0, ocean: 0,
datatoken: 0, datatoken: 0,
pools: [], pools: [],