mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
fix community fee displayed value (#1417)
* fix community fee displayed value
* get value fix
* Revert "fix community fee displayed value"
This reverts commit 06258f8904
.
* import fix
* naming fix
Co-authored-by: ClaudiaHolhos <claudia@oceanprotocol.com>
This commit is contained in:
parent
8819a66e67
commit
a2bf3b2a1c
@ -8,6 +8,7 @@ import { getOpcFees } from '../../../@utils/subgraph'
|
|||||||
import { OpcFeesQuery_opc as OpcFeesData } from '../../../@types/subgraph/OpcFeesQuery'
|
import { OpcFeesQuery_opc as OpcFeesData } from '../../../@types/subgraph/OpcFeesQuery'
|
||||||
import { useWeb3 } from '@context/Web3'
|
import { useWeb3 } from '@context/Web3'
|
||||||
import { useMarketMetadata } from '@context/MarketMetadata'
|
import { useMarketMetadata } from '@context/MarketMetadata'
|
||||||
|
import Decimal from 'decimal.js'
|
||||||
|
|
||||||
const Default = ({
|
const Default = ({
|
||||||
title,
|
title,
|
||||||
@ -43,13 +44,17 @@ export default function Fees({
|
|||||||
pricingType: 'dynamic' | 'fixed'
|
pricingType: 'dynamic' | 'fixed'
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const [field, meta] = useField('pricing.swapFee')
|
const [field, meta] = useField('pricing.swapFee')
|
||||||
const [opcFees, setOpcFees] = useState<OpcFeesData>(undefined)
|
const [oceanCommunitySwapFee, setOceanCommunitySwapFee] = useState<string>('')
|
||||||
const { chainId } = useWeb3()
|
const { chainId } = useWeb3()
|
||||||
const { appConfig } = useMarketMetadata()
|
const { appConfig } = useMarketMetadata()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getOpcFees(chainId || 1).then((response: OpcFeesData) => {
|
getOpcFees(chainId || 1).then((response: OpcFeesData) => {
|
||||||
setOpcFees(response)
|
setOceanCommunitySwapFee(
|
||||||
|
response?.swapOceanFee
|
||||||
|
? new Decimal(response.swapOceanFee).mul(100).toString()
|
||||||
|
: '0'
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}, [chainId])
|
}, [chainId])
|
||||||
|
|
||||||
@ -76,10 +81,10 @@ export default function Fees({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<Default
|
<Default
|
||||||
title="Community Fee"
|
title="Community Swap Fee"
|
||||||
name="communityFee"
|
name="communityFee"
|
||||||
tooltip={tooltips.communityFee}
|
tooltip={tooltips.communityFee}
|
||||||
value={opcFees?.swapOceanFee || '0'}
|
value={oceanCommunitySwapFee}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Default
|
<Default
|
||||||
|
Loading…
Reference in New Issue
Block a user