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

Add symbol for fixed rate exchange (#835)

* add symbol for fre

* add symbol to fre

* update symbol in swap
This commit is contained in:
mihaisc 2021-09-02 18:01:25 +03:00 committed by GitHub
parent 4123dae431
commit b5afccbb49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -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<TradeItem>({
amount: '0',
token: config.oceanTokenSymbol,
token: price.oceanSymbol,
maxAmount: '0'
})
const [dtItem, setDtItem] = useState<TradeItem>({

View File

@ -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: [],