()
useEffect(() => {
@@ -51,23 +27,16 @@ export default function Network(): ReactElement {
// to figure out if network is supported.
const isSupportedNetwork = Boolean(new ConfigHelper().getConfig(network))
setIsSupportedNetwork(isSupportedNetwork)
+ }, [networkId, networkIdConfig])
- // Figure out if we're on a chain's testnet, or not
- const networkData = getNetworkData(networksList, network)
- setIsTestnet(networkData.network !== 'mainnet')
-
- const networkName = getNetworkDisplayName(networkData, network)
- setNetworkName(networkName)
- }, [networkId, networkIdConfig, networksList])
-
- return !isEthMainnet && networkName ? (
+ return !isEthMainnet && networkDisplayName ? (
{!isSupportedNetwork && (
)}
- {networkName}
+ {networkDisplayName}
{isTestnet && }
) : null
diff --git a/src/components/molecules/Wallet/index.tsx b/src/components/molecules/Wallet/index.tsx
index 282e17b1a..e417015f7 100644
--- a/src/components/molecules/Wallet/index.tsx
+++ b/src/components/molecules/Wallet/index.tsx
@@ -3,11 +3,11 @@ import Account from './Account'
import Details from './Details'
import Tooltip from '../../atoms/Tooltip'
import Network from './Network'
-import { useOcean } from '@oceanprotocol/react'
import styles from './index.module.css'
+import { useWeb3 } from '../../../providers/Web3'
export default function Wallet(): ReactElement {
- const { accountId } = useOcean()
+ const { accountId } = useWeb3()
return (
diff --git a/src/components/organisms/AssetActions/Compute.tsx b/src/components/organisms/AssetActions/Compute.tsx
index 2d31b504c..6646a4987 100644
--- a/src/components/organisms/AssetActions/Compute.tsx
+++ b/src/components/organisms/AssetActions/Compute.tsx
@@ -2,21 +2,18 @@ import React, { useState, ReactElement, ChangeEvent, useEffect } from 'react'
import { DDO, Logger } from '@oceanprotocol/lib'
import Loader from '../../atoms/Loader'
import Web3Feedback from '../../molecules/Wallet/Feedback'
-import Dropzone from '../../atoms/Dropzone'
import Price from '../../atoms/Price'
import File from '../../atoms/File'
-import {
- computeOptions,
- useCompute,
- readFileContent,
- useOcean,
- usePricing
-} from '@oceanprotocol/react'
+import { computeOptions, useCompute } from '../../../hooks/useCompute'
import styles from './Compute.module.css'
import Input from '../../atoms/Input'
import Alert from '../../atoms/Alert'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
import checkPreviousOrder from '../../../utils/checkPreviousOrder'
+import { useOcean } from '../../../providers/Ocean'
+import { useWeb3 } from '../../../providers/Web3'
+import { usePricing } from '../../../hooks/usePricing'
+import { useAsset } from '../../../providers/Asset'
export default function Compute({
ddo,
@@ -28,11 +25,11 @@ export default function Compute({
dtBalance: string
}): ReactElement {
const { marketFeeAddress } = useSiteMetadata()
-
- const { ocean, accountId } = useOcean()
+ const { accountId } = useWeb3()
+ const { ocean } = useOcean()
const { compute, isLoading, computeStepText, computeError } = useCompute()
const { buyDT, dtSymbol } = usePricing(ddo)
-
+ const { price } = useAsset()
const computeService = ddo.findServiceByType('compute')
const metadataService = ddo.findServiceByType('metadata')
@@ -66,12 +63,6 @@ export default function Compute({
checkPreviousOrders()
}, [ocean, ddo, accountId])
- const onDrop = async (files: File[]) => {
- setFile(files[0])
- const fileText = await readFileContent(files[0])
- setAlgorithmRawCode(fileText)
- }
-
const handleSelectChange = (event: ChangeEvent) => {
const comType = event.target.value
setComputeType(comType)
@@ -81,36 +72,36 @@ export default function Compute({
setComputeContainer(selectedComputeOption.value)
}
- const startJob = async () => {
- try {
- if (!ocean) return
+ // const startJob = async () => {
+ // try {
+ // if (!ocean) return
- setIsJobStarting(true)
- setIsPublished(false)
- setError('')
+ // setIsJobStarting(true)
+ // setIsPublished(false)
+ // setError('')
- !hasPreviousOrder && !hasDatatoken && (await buyDT('1'))
+ // !hasPreviousOrder && !hasDatatoken && (await buyDT('1'))
- await compute(
- ddo.id,
- computeService,
- ddo.dataToken,
- algorithmRawCode,
- computeContainer,
- marketFeeAddress,
- previousOrderId
- )
+ // await compute(
+ // ddo.id,
+ // computeService,
+ // ddo.dataToken,
+ // algorithmRawCode,
+ // computeContainer,
+ // marketFeeAddress,
+ // previousOrderId
+ // )
- setHasPreviousOrder(true)
- setIsPublished(true)
- setFile(null)
- } catch (error) {
- setError('Failed to start job!')
- Logger.error(error.message)
- } finally {
- setIsJobStarting(false)
- }
- }
+ // setHasPreviousOrder(true)
+ // setIsPublished(true)
+ // setFile(null)
+ // } catch (error) {
+ // setError('Failed to start job!')
+ // Logger.error(error.message)
+ // } finally {
+ // setIsJobStarting(false)
+ // }
+ // }
return (
<>
@@ -119,7 +110,7 @@ export default function Compute({
-
+
{hasDatatoken && (
You own {dtBalance} {dtSymbol} allowing you to use this data set
@@ -139,7 +130,6 @@ export default function Compute({
options={computeOptions.map((x) => x.name)}
onChange={handleSelectChange}
/>
-
{isLoading ? (
diff --git a/src/components/organisms/AssetActions/Consume.tsx b/src/components/organisms/AssetActions/Consume.tsx
index 314281951..a5256ca68 100644
--- a/src/components/organisms/AssetActions/Consume.tsx
+++ b/src/components/organisms/AssetActions/Consume.tsx
@@ -7,14 +7,16 @@ import Price from '../../atoms/Price'
import Web3Feedback from '../../molecules/Wallet/Feedback'
import styles from './Consume.module.css'
import Loader from '../../atoms/Loader'
-import { useOcean, useConsume, usePricing } from '@oceanprotocol/react'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
-import checkPreviousOrder from '../../../utils/checkPreviousOrder'
import { useAsset } from '../../../providers/Asset'
import { secondsToString } from '../../../utils/metadata'
import { gql, useQuery } from '@apollo/client'
import { OrdersData } from '../../../@types/apollo/OrdersData'
import BigNumber from 'bignumber.js'
+import { useOcean } from '../../../providers/Ocean'
+import { useWeb3 } from '../../../providers/Web3'
+import { usePricing } from '../../../hooks/usePricing'
+import { useConsume } from '../../../hooks/useConsume'
const previousOrderQuery = gql`
query PreviousOrder($id: String!, $account: String!) {
@@ -61,7 +63,8 @@ export default function Consume({
isBalanceSufficient: boolean
dtBalance: string
}): ReactElement {
- const { ocean, accountId } = useOcean()
+ const { accountId } = useWeb3()
+ const { ocean } = useOcean()
const { marketFeeAddress } = useSiteMetadata()
const [hasPreviousOrder, setHasPreviousOrder] = useState(false)
const [previousOrderId, setPreviousOrderId] = useState()
@@ -141,7 +144,7 @@ export default function Consume({
])
async function handleConsume() {
- !hasPreviousOrder && !hasDatatoken && (await buyDT('1'))
+ !hasPreviousOrder && !hasDatatoken && (await buyDT('1', price))
await consume(
ddo.id,
ddo.dataToken,
@@ -191,7 +194,7 @@ export default function Consume({
diff --git a/src/components/organisms/AssetActions/Edit/FormEditMetadata.tsx b/src/components/organisms/AssetActions/Edit/FormEditMetadata.tsx
index 238b4cd24..cf4b5794c 100644
--- a/src/components/organisms/AssetActions/Edit/FormEditMetadata.tsx
+++ b/src/components/organisms/AssetActions/Edit/FormEditMetadata.tsx
@@ -3,10 +3,11 @@ import styles from './FormEditMetadata.module.css'
import { Field, Form, FormikContextType, useFormikContext } from 'formik'
import Button from '../../../atoms/Button'
import Input from '../../../atoms/Input'
-import { useOcean } from '@oceanprotocol/react'
import { FormFieldProps } from '../../../../@types/Form'
import { MetadataPublishForm } from '../../../../@types/MetaData'
import { checkIfTimeoutInPredefinedValues } from '../../../../utils/metadata'
+import { useOcean } from '../../../../providers/Ocean'
+import { useWeb3 } from '../../../../providers/Web3'
function handleTimeoutCustomOption(
data: FormFieldProps[],
@@ -53,7 +54,8 @@ export default function FormEditMetadata({
setTimeoutStringValue: (value: string) => void
values: Partial
}): ReactElement {
- const { ocean, accountId } = useOcean()
+ const { accountId } = useWeb3()
+ const { ocean } = useOcean()
const {
isValid,
validateField,
diff --git a/src/components/organisms/AssetActions/Edit/index.tsx b/src/components/organisms/AssetActions/Edit/index.tsx
index 60b13f78c..6bfc8ab34 100644
--- a/src/components/organisms/AssetActions/Edit/index.tsx
+++ b/src/components/organisms/AssetActions/Edit/index.tsx
@@ -1,4 +1,3 @@
-import { useOcean } from '@oceanprotocol/react'
import { Formik } from 'formik'
import React, { ReactElement, useState } from 'react'
import { MetadataEditForm } from '../../../../@types/MetaData'
@@ -17,6 +16,8 @@ import styles from './index.module.css'
import { Logger } from '@oceanprotocol/lib'
import MetadataFeedback from '../../../molecules/MetadataFeedback'
import { graphql, useStaticQuery } from 'gatsby'
+import { useWeb3 } from '../../../../providers/Web3'
+import { useOcean } from '../../../../providers/Ocean'
const contentQuery = graphql`
query EditMetadataQuery {
@@ -57,7 +58,8 @@ export default function Edit({
const content = data.content.edges[0].node.childPagesJson
const { debug } = useUserPreferences()
- const { ocean, accountId } = useOcean()
+ const { accountId } = useWeb3()
+ const { ocean } = useOcean()
const { metadata, ddo, refreshDdo } = useAsset()
const [success, setSuccess] = useState()
const [error, setError] = useState()
diff --git a/src/components/organisms/AssetActions/Pool/Actions.tsx b/src/components/organisms/AssetActions/Pool/Actions.tsx
index ff78f4b40..73d617f82 100644
--- a/src/components/organisms/AssetActions/Pool/Actions.tsx
+++ b/src/components/organisms/AssetActions/Pool/Actions.tsx
@@ -2,9 +2,10 @@ import React, { ReactElement } from 'react'
import Loader from '../../../atoms/Loader'
import Button from '../../../atoms/Button'
import styles from './Actions.module.css'
-import EtherscanLink from '../../../atoms/EtherscanLink'
+import ExplorerLink from '../../../atoms/ExplorerLink'
import SuccessConfetti from '../../../atoms/SuccessConfetti'
-import { useOcean } from '@oceanprotocol/react'
+import { useOcean } from '../../../../providers/Ocean'
+import { useWeb3 } from '../../../../providers/Web3'
export default function Actions({
isLoading,
@@ -23,7 +24,8 @@ export default function Actions({
action: () => void
isDisabled?: boolean
}): ReactElement {
- const { networkId, ocean } = useOcean()
+ const { networkId } = useWeb3()
+ const { ocean } = useOcean()
return (
<>
@@ -46,9 +48,9 @@ export default function Actions({
className={styles.success}
success={successMessage}
action={
-
- See on Etherscan
-
+
+ View transaction
+
}
/>
)}
diff --git a/src/components/organisms/AssetActions/Pool/Add/FormAdd.tsx b/src/components/organisms/AssetActions/Pool/Add/FormAdd.tsx
index 793b36a4d..20c96755c 100644
--- a/src/components/organisms/AssetActions/Pool/Add/FormAdd.tsx
+++ b/src/components/organisms/AssetActions/Pool/Add/FormAdd.tsx
@@ -10,9 +10,9 @@ import {
import Button from '../../../../atoms/Button'
import CoinSelect from '../CoinSelect'
import { FormAddLiquidity } from '.'
-import { useOcean } from '@oceanprotocol/react'
-import TokenBalance from '../../../../../@types/TokenBalance'
+import { PoolBalance } from '../../../../../@types/TokenBalance'
import UserLiquidity from '../../../../atoms/UserLiquidity'
+import { useOcean } from '../../../../../providers/Ocean'
export default function FormAdd({
coin,
@@ -32,7 +32,7 @@ export default function FormAdd({
amountMax: string
setCoin: (value: string) => void
totalPoolTokens: string
- totalBalance: TokenBalance
+ totalBalance: PoolBalance
poolAddress: string
setNewPoolTokens: (value: string) => void
setNewPoolShare: (value: string) => void
diff --git a/src/components/organisms/AssetActions/Pool/Add/Output.tsx b/src/components/organisms/AssetActions/Pool/Add/Output.tsx
index cff2a71a6..f84601bd6 100644
--- a/src/components/organisms/AssetActions/Pool/Add/Output.tsx
+++ b/src/components/organisms/AssetActions/Pool/Add/Output.tsx
@@ -2,7 +2,7 @@ import { FormikContextType, useFormikContext } from 'formik'
import { graphql, useStaticQuery } from 'gatsby'
import React, { ReactElement, useEffect, useState } from 'react'
import { FormAddLiquidity } from '.'
-import TokenBalance from '../../../../../@types/TokenBalance'
+import { PoolBalance } from '../../../../../@types/TokenBalance'
import FormHelp from '../../../../atoms/Input/Help'
import Token from '../Token'
import styles from './Output.module.css'
@@ -44,7 +44,7 @@ export default function Output({
swapFee: string
dtSymbol: string
totalPoolTokens: string
- totalBalance: TokenBalance
+ totalBalance: PoolBalance
coin: string
}): ReactElement {
const data = useStaticQuery(contentQuery)
diff --git a/src/components/organisms/AssetActions/Pool/Add/index.tsx b/src/components/organisms/AssetActions/Pool/Add/index.tsx
index c67edd017..555f4266f 100644
--- a/src/components/organisms/AssetActions/Pool/Add/index.tsx
+++ b/src/components/organisms/AssetActions/Pool/Add/index.tsx
@@ -1,5 +1,4 @@
import React, { ReactElement, useState, useEffect } from 'react'
-import { useOcean } from '@oceanprotocol/react'
import Header from '../Header'
import { toast } from 'react-toastify'
import Actions from '../Actions'
@@ -9,10 +8,12 @@ import { Formik } from 'formik'
import FormAdd from './FormAdd'
import styles from './index.module.css'
import Alert from '../../../../atoms/Alert'
-import TokenBalance from '../../../../../@types/TokenBalance'
+import { PoolBalance } from '../../../../../@types/TokenBalance'
import { useUserPreferences } from '../../../../../providers/UserPreferences'
import Output from './Output'
import DebugOutput from '../../../../atoms/DebugOutput'
+import { useOcean } from '../../../../../providers/Ocean'
+import { useWeb3 } from '../../../../../providers/Web3'
const contentQuery = graphql`
query PoolAddQuery {
@@ -56,7 +57,7 @@ export default function Add({
refreshInfo: () => void
poolAddress: string
totalPoolTokens: string
- totalBalance: TokenBalance
+ totalBalance: PoolBalance
swapFee: string
dtSymbol: string
dtAddress: string
@@ -64,7 +65,8 @@ export default function Add({
const data = useStaticQuery(contentQuery)
const content = data.content.edges[0].node.childContentJson.pool.add
- const { ocean, accountId, balance } = useOcean()
+ const { accountId } = useWeb3()
+ const { ocean, balance } = useOcean()
const { debug } = useUserPreferences()
const [txId, setTxId] = useState()
const [coin, setCoin] = useState('OCEAN')
diff --git a/src/components/organisms/AssetActions/Pool/Remove.tsx b/src/components/organisms/AssetActions/Pool/Remove.tsx
index ba434c3fc..fed7c35b3 100644
--- a/src/components/organisms/AssetActions/Pool/Remove.tsx
+++ b/src/components/organisms/AssetActions/Pool/Remove.tsx
@@ -7,7 +7,6 @@ import React, {
useRef
} from 'react'
import styles from './Remove.module.css'
-import { useOcean } from '@oceanprotocol/react'
import Header from './Header'
import { toast } from 'react-toastify'
import Actions from './Actions'
@@ -19,6 +18,8 @@ import { getMaxPercentRemove } from './utils'
import { graphql, useStaticQuery } from 'gatsby'
import debounce from 'lodash.debounce'
import UserLiquidity from '../../../atoms/UserLiquidity'
+import { useOcean } from '../../../../providers/Ocean'
+import { useWeb3 } from '../../../../providers/Web3'
const contentQuery = graphql`
query PoolRemoveQuery {
@@ -63,7 +64,8 @@ export default function Remove({
const data = useStaticQuery(contentQuery)
const content = data.content.edges[0].node.childContentJson.pool.remove
- const { ocean, accountId } = useOcean()
+ const { accountId } = useWeb3()
+ const { ocean } = useOcean()
const [amountPercent, setAmountPercent] = useState('0')
const [amountMaxPercent, setAmountMaxPercent] = useState('100')
const [amountPoolShares, setAmountPoolShares] = useState('0')
diff --git a/src/components/organisms/AssetActions/Pool/index.tsx b/src/components/organisms/AssetActions/Pool/index.tsx
index 77e644ee1..6b57c387c 100644
--- a/src/components/organisms/AssetActions/Pool/index.tsx
+++ b/src/components/organisms/AssetActions/Pool/index.tsx
@@ -1,5 +1,4 @@
import React, { ReactElement, useEffect, useState } from 'react'
-import { useOcean } from '@oceanprotocol/react'
import { Logger } from '@oceanprotocol/lib'
import styles from './index.module.css'
import stylesActions from './Actions.module.css'
@@ -8,16 +7,18 @@ import Button from '../../../atoms/Button'
import Add from './Add'
import Remove from './Remove'
import Tooltip from '../../../atoms/Tooltip'
-import EtherscanLink from '../../../atoms/EtherscanLink'
+import ExplorerLink from '../../../atoms/ExplorerLink'
import Token from './Token'
import TokenList from './TokenList'
import { graphql, useStaticQuery } from 'gatsby'
-import TokenBalance from '../../../../@types/TokenBalance'
+import { PoolBalance } from '../../../../@types/TokenBalance'
import Transactions from './Transactions'
import Graph from './Graph'
import { useAsset } from '../../../../providers/Asset'
import { gql, useQuery } from '@apollo/client'
import { PoolLiquidity } from '../../../../@types/apollo/PoolLiquidity'
+import { useOcean } from '../../../../providers/Ocean'
+import { useWeb3 } from '../../../../providers/Web3'
const contentQuery = graphql`
query PoolQuery {
@@ -60,20 +61,14 @@ export default function Pool(): ReactElement {
const data = useStaticQuery(contentQuery)
const content = data.content.edges[0].node.childContentJson.pool
- const { ocean, accountId, networkId } = useOcean()
- const {
- isInPurgatory,
- ddo,
- owner,
- price,
- refreshInterval,
- refreshPrice
- } = useAsset()
+ const { accountId, networkId } = useWeb3()
+ const { ocean } = useOcean()
+ const { isInPurgatory, ddo, owner, price, refreshInterval } = useAsset()
const dtSymbol = ddo?.dataTokenInfo.symbol
const [poolTokens, setPoolTokens] = useState()
const [totalPoolTokens, setTotalPoolTokens] = useState()
- const [userLiquidity, setUserLiquidity] = useState()
+ const [userLiquidity, setUserLiquidity] = useState()
const [swapFee, setSwapFee] = useState()
const [weightOcean, setWeightOcean] = useState()
const [weightDt, setWeightDt] = useState()
@@ -91,7 +86,7 @@ export default function Pool(): ReactElement {
creatorTotalLiquidityInOcean,
setCreatorTotalLiquidityInOcean
] = useState(0)
- const [creatorLiquidity, setCreatorLiquidity] = useState()
+ const [creatorLiquidity, setCreatorLiquidity] = useState()
const [creatorPoolTokens, setCreatorPoolTokens] = useState()
const [creatorPoolShare, setCreatorPoolShare] = useState()
@@ -209,7 +204,9 @@ export default function Pool(): ReactElement {
const refreshInfo = async () => {
setRefreshPool(!refreshPool)
- await refreshPrice()
+
+ // need some form of replacement or something.
+ // await refreshPrice()
}
return (
@@ -244,18 +241,22 @@ export default function Pool(): ReactElement {
-
Pool
-
-
+
Datatoken
-
+
diff --git a/src/components/organisms/AssetActions/Trade/FormTrade.tsx b/src/components/organisms/AssetActions/Trade/FormTrade.tsx
index c66b2d26d..87abdfa68 100644
--- a/src/components/organisms/AssetActions/Trade/FormTrade.tsx
+++ b/src/components/organisms/AssetActions/Trade/FormTrade.tsx
@@ -1,5 +1,4 @@
import React, { ReactElement, useState } from 'react'
-import { useOcean } from '@oceanprotocol/react'
import { BestPrice, DDO, Logger } from '@oceanprotocol/lib'
import * as Yup from 'yup'
import { Formik } from 'formik'
@@ -8,11 +7,13 @@ import { graphql, useStaticQuery } from 'gatsby'
import { useUserPreferences } from '../../../../providers/UserPreferences'
import { toast } from 'react-toastify'
import Swap from './Swap'
-import TokenBalance from '../../../../@types/TokenBalance'
+import { PoolBalance } from '../../../../@types/TokenBalance'
import Alert from '../../../atoms/Alert'
import styles from './FormTrade.module.css'
import { FormTradeData, initialValues } from '../../../../models/FormTrade'
import Decimal from 'decimal.js'
+import { useOcean } from '../../../../providers/Ocean'
+import { useWeb3 } from '../../../../providers/Web3'
const contentQuery = graphql`
query TradeQuery {
@@ -39,14 +40,15 @@ export default function FormTrade({
price
}: {
ddo: DDO
- balance: TokenBalance
+ balance: PoolBalance
maxDt: number
maxOcean: number
price: BestPrice
}): ReactElement {
const data = useStaticQuery(contentQuery)
const content = data.content.edges[0].node.childContentJson.trade
- const { ocean, accountId } = useOcean()
+ const { accountId } = useWeb3()
+ const { ocean } = useOcean()
const { debug } = useUserPreferences()
const [txId, setTxId] = useState()
diff --git a/src/components/organisms/AssetActions/Trade/Output.tsx b/src/components/organisms/AssetActions/Trade/Output.tsx
index dc6c99630..f108b6473 100644
--- a/src/components/organisms/AssetActions/Trade/Output.tsx
+++ b/src/components/organisms/AssetActions/Trade/Output.tsx
@@ -1,7 +1,7 @@
-import { useOcean } from '@oceanprotocol/react'
import { FormikContextType, useFormikContext } from 'formik'
import React, { ReactElement, useEffect, useState } from 'react'
import { FormTradeData } from '../../../../models/FormTrade'
+import { useOcean } from '../../../../providers/Ocean'
import Token from '../Pool/Token'
import styles from './Output.module.css'
diff --git a/src/components/organisms/AssetActions/Trade/Swap.tsx b/src/components/organisms/AssetActions/Trade/Swap.tsx
index d1b58f939..5193c2bf3 100644
--- a/src/components/organisms/AssetActions/Trade/Swap.tsx
+++ b/src/components/organisms/AssetActions/Trade/Swap.tsx
@@ -1,15 +1,15 @@
import React, { ReactElement, useEffect, useState } from 'react'
-import { useOcean } from '@oceanprotocol/react'
import { BestPrice, DDO } from '@oceanprotocol/lib'
import styles from './Swap.module.css'
import TradeInput from './TradeInput'
import Button from '../../../atoms/Button'
import { ReactComponent as Arrow } from '../../../../images/arrow.svg'
import { FormikContextType, useFormikContext } from 'formik'
-import TokenBalance from '../../../../@types/TokenBalance'
+import { PoolBalance } from '../../../../@types/TokenBalance'
import Output from './Output'
import Slippage from './Slippage'
import { FormTradeData, TradeItem } from '../../../../models/FormTrade'
+import { useOcean } from '../../../../providers/Ocean'
export default function Swap({
ddo,
@@ -23,7 +23,7 @@ export default function Swap({
ddo: DDO
maxDt: number
maxOcean: number
- balance: TokenBalance
+ balance: PoolBalance
price: BestPrice
setMaximumDt: (value: number) => void
setMaximumOcean: (value: number) => void
diff --git a/src/components/organisms/AssetActions/Trade/TradeInput.tsx b/src/components/organisms/AssetActions/Trade/TradeInput.tsx
index 7f033cfce..f990380cc 100644
--- a/src/components/organisms/AssetActions/Trade/TradeInput.tsx
+++ b/src/components/organisms/AssetActions/Trade/TradeInput.tsx
@@ -1,18 +1,16 @@
import React, { ChangeEvent, ReactElement } from 'react'
import styles from './TradeInput.module.css'
-
import {
Field,
FieldInputProps,
FormikContextType,
useFormikContext
} from 'formik'
-
-import { useOcean } from '@oceanprotocol/react'
import Input from '../../../atoms/Input'
import Button from '../../../atoms/Button'
import UserLiquidity from '../../../atoms/UserLiquidity'
import { FormTradeData, TradeItem } from '../../../../models/FormTrade'
+import { useOcean } from '../../../../providers/Ocean'
export default function TradeInput({
name,
diff --git a/src/components/organisms/AssetActions/Trade/index.tsx b/src/components/organisms/AssetActions/Trade/index.tsx
index 38931c4cd..6079a5d55 100644
--- a/src/components/organisms/AssetActions/Trade/index.tsx
+++ b/src/components/organisms/AssetActions/Trade/index.tsx
@@ -1,12 +1,14 @@
import React, { ReactElement, useEffect, useState } from 'react'
-import { useOcean } from '@oceanprotocol/react'
import FormTrade from './FormTrade'
-import TokenBalance from '../../../../@types/TokenBalance'
+import { PoolBalance } from '../../../../@types/TokenBalance'
import { useAsset } from '../../../../providers/Asset'
+import { useOcean } from '../../../../providers/Ocean'
+import { useWeb3 } from '../../../../providers/Web3'
export default function Trade(): ReactElement {
- const { ocean, balance, accountId } = useOcean()
- const [tokenBalance, setTokenBalance] = useState()
+ const { accountId } = useWeb3()
+ const { ocean, balance } = useOcean()
+ const [tokenBalance, setTokenBalance] = useState()
const { price, ddo } = useAsset()
const [maxDt, setMaxDt] = useState(0)
const [maxOcean, setMaxOcean] = useState(0)
diff --git a/src/components/organisms/AssetActions/index.tsx b/src/components/organisms/AssetActions/index.tsx
index 3d1c38f12..869683f6c 100644
--- a/src/components/organisms/AssetActions/index.tsx
+++ b/src/components/organisms/AssetActions/index.tsx
@@ -3,16 +3,17 @@ import styles from './index.module.css'
import Compute from './Compute'
import Consume from './Consume'
import { Logger } from '@oceanprotocol/lib'
-import { ConfigHelperConfig } from '@oceanprotocol/lib/dist/node/utils/ConfigHelper'
import Tabs from '../../atoms/Tabs'
-import { useOcean } from '@oceanprotocol/react'
import compareAsBN from '../../../utils/compareAsBN'
import Pool from './Pool'
import Trade from './Trade'
import { useAsset } from '../../../providers/Asset'
+import { useOcean } from '../../../providers/Ocean'
+import { useWeb3 } from '../../../providers/Web3'
export default function AssetActions(): ReactElement {
- const { ocean, balance, accountId } = useOcean()
+ const { accountId } = useWeb3()
+ const { ocean, balance, account } = useOcean()
const { price, ddo, metadata } = useAsset()
const [isBalanceSufficient, setIsBalanceSufficient] = useState()
@@ -40,7 +41,7 @@ export default function AssetActions(): ReactElement {
// Check user balance against price
useEffect(() => {
- if (!price?.value || !accountId || !balance?.ocean || !dtBalance) return
+ if (!price?.value || !account || !balance?.ocean || !dtBalance) return
setIsBalanceSufficient(
compareAsBN(balance.ocean, `${price.value}`) || Number(dtBalance) >= 1
@@ -49,7 +50,7 @@ export default function AssetActions(): ReactElement {
return () => {
setIsBalanceSufficient(false)
}
- }, [balance, accountId, price, dtBalance])
+ }, [balance, account, price, dtBalance])
const UseContent = isCompute ? (
{receipts?.map((receipt) => (
-
+
edited{' '}
-
+
))}
-
+
published
-
+