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

fix most remaining typing errors

This commit is contained in:
Matthias Kretschmann 2021-06-11 11:23:24 +02:00
parent b8930cc738
commit f9f3768f5f
Signed by: m
GPG Key ID: 606EEEF3C479A91F
7 changed files with 26 additions and 15 deletions

View File

@ -13,6 +13,7 @@ import { FormAddLiquidity } from '.'
import { PoolBalance } from '../../../../../@types/TokenBalance'
import UserLiquidity from '../../../../atoms/UserLiquidity'
import { useOcean } from '../../../../../providers/Ocean'
import { useWeb3 } from '../../../../../providers/Web3'
export default function FormAdd({
coin,
@ -37,7 +38,8 @@ export default function FormAdd({
setNewPoolTokens: (value: string) => void
setNewPoolShare: (value: string) => void
}): ReactElement {
const { ocean, balance } = useOcean()
const { balance } = useWeb3()
const { ocean } = useOcean()
// Connect with form
const {

View File

@ -65,8 +65,8 @@ export default function Add({
const data = useStaticQuery(contentQuery)
const content = data.content.edges[0].node.childContentJson.pool.add
const { accountId } = useWeb3()
const { ocean, balance } = useOcean()
const { accountId, balance } = useWeb3()
const { ocean } = useOcean()
const { debug } = useUserPreferences()
const [txId, setTxId] = useState<string>()
const [coin, setCoin] = useState('OCEAN')

View File

@ -6,8 +6,8 @@ import { useOcean } from '../../../../providers/Ocean'
import { useWeb3 } from '../../../../providers/Web3'
export default function Trade(): ReactElement {
const { accountId } = useWeb3()
const { ocean, balance } = useOcean()
const { accountId, balance } = useWeb3()
const { ocean } = useOcean()
const [tokenBalance, setTokenBalance] = useState<PoolBalance>()
const { price, ddo } = useAsset()
const [maxDt, setMaxDt] = useState(0)

View File

@ -16,8 +16,8 @@ import { getFileInfo } from '../../../utils/provider'
import axios from 'axios'
export default function AssetActions(): ReactElement {
const { accountId } = useWeb3()
const { ocean, balance, account } = useOcean()
const { accountId, balance } = useWeb3()
const { ocean, config, account } = useOcean()
const { price, ddo, metadata, type, isAssetNetwork } = useAsset()
const [isBalanceSufficient, setIsBalanceSufficient] = useState<boolean>()
@ -28,6 +28,7 @@ export default function AssetActions(): ReactElement {
useEffect(() => {
if (!config) return
const source = axios.CancelToken.source()
async function initFileInfo() {
setFileIsLoading(true)
@ -45,6 +46,10 @@ export default function AssetActions(): ReactElement {
}
}
initFileInfo()
return () => {
source.cancel()
}
}, [config, ddo.id])
// Get and set user DT balance

View File

@ -23,8 +23,8 @@ export default function Dynamic({
ddo: DDO
content: any
}): ReactElement {
const { networkId } = useWeb3()
const { account, balance } = useOcean()
const { networkId, balance } = useWeb3()
const { account } = useOcean()
const [firstPrice, setFirstPrice] = useState<string>()
// Connect with form

View File

@ -101,7 +101,7 @@ async function getAssetMetadata(
export default function ComputeJobs(): ReactElement {
const { appConfig } = useSiteMetadata()
const { ocean, account } = useOcean()
const { ocean, account, config } = useOcean()
const { accountId } = useWeb3()
const [isLoading, setIsLoading] = useState(true)
const [jobs, setJobs] = useState<ComputeJobMetaData[]>([])

View File

@ -6,9 +6,9 @@ import web3 from 'web3'
import AssetTitle from '../../molecules/AssetListTitle'
import { useWeb3 } from '../../../providers/Web3'
import axios from 'axios'
import { useOcean } from '../../../providers/Ocean'
import { retrieveDDO } from '../../../utils/aquarius'
import { Logger } from '@oceanprotocol/lib'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
const getTokenOrders = gql`
query OrdersData($user: String!) {
@ -61,10 +61,10 @@ export default function ComputeDownloads(): ReactElement {
const { data } = useQuery(getTokenOrders, {
variables: { user: accountId?.toLowerCase() }
})
const { metadataCacheUri } = useOcean()
const { appConfig } = useSiteMetadata()
useEffect(() => {
if (!metadataCacheUri || !data) return
if (!appConfig.metadataCacheUri || !data) return
async function filterAssets() {
const filteredOrders: DownloadedAssets[] = []
@ -76,7 +76,11 @@ export default function ComputeDownloads(): ReactElement {
const did = web3.utils
.toChecksumAddress(data.tokenOrders[i].datatokenId.address)
.replace('0x', 'did:op:')
const ddo = await retrieveDDO(did, metadataCacheUri, source.token)
const ddo = await retrieveDDO(
did,
appConfig.metadataCacheUri,
source.token
)
if (ddo.service[1].type === 'access') {
filteredOrders.push({
did: did,
@ -94,7 +98,7 @@ export default function ComputeDownloads(): ReactElement {
}
filterAssets()
}, [metadataCacheUri, data])
}, [appConfig.metadataCacheUri, data])
return (
<Table