mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Fix/old lib dep (#959)
* fixes * change aqua url * update future v4 url
This commit is contained in:
parent
b0adbf8071
commit
4caf72d0c9
@ -7,7 +7,7 @@ module.exports = {
|
|||||||
// return appConfig.metadataCacheUri
|
// return appConfig.metadataCacheUri
|
||||||
metadataCacheUri:
|
metadataCacheUri:
|
||||||
process.env.NEXT_PUBLIC_METADATACACHE_URI ||
|
process.env.NEXT_PUBLIC_METADATACACHE_URI ||
|
||||||
'https://aquarius.oceanprotocol.com',
|
'https://aquariusv4.oceanprotocol.com',
|
||||||
|
|
||||||
// List of chainIds which metadata cache queries will return by default.
|
// List of chainIds which metadata cache queries will return by default.
|
||||||
// This preselects the Chains user preferences.
|
// This preselects the Chains user preferences.
|
||||||
|
32683
package-lock.json
generated
32683
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -23,13 +23,14 @@
|
|||||||
"@coingecko/cryptoformat": "^0.4.4",
|
"@coingecko/cryptoformat": "^0.4.4",
|
||||||
"@loadable/component": "^5.15.0",
|
"@loadable/component": "^5.15.0",
|
||||||
"@oceanprotocol/art": "^3.2.0",
|
"@oceanprotocol/art": "^3.2.0",
|
||||||
"@oceanprotocol/lib": "^0.19.2",
|
"@oceanprotocol/lib": "file:../ocean.js",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@portis/web3": "^4.0.6",
|
"@portis/web3": "^4.0.6",
|
||||||
"@tippyjs/react": "^4.2.5",
|
"@tippyjs/react": "^4.2.5",
|
||||||
"@urql/introspection": "^0.3.0",
|
"@urql/introspection": "^0.3.0",
|
||||||
"@walletconnect/web3-provider": "^1.6.6",
|
"@walletconnect/web3-provider": "^1.6.6",
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
|
"bignumber.js": "^9.0.1",
|
||||||
"chart.js": "^2.9.4",
|
"chart.js": "^2.9.4",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"d3": "^7.1.1",
|
"d3": "^7.1.1",
|
||||||
@ -50,6 +51,7 @@
|
|||||||
"lodash.omit": "^4.5.0",
|
"lodash.omit": "^4.5.0",
|
||||||
"next": "^12.0.3",
|
"next": "^12.0.3",
|
||||||
"query-string": "^7.0.1",
|
"query-string": "^7.0.1",
|
||||||
|
"querystring": "^0.2.1",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-chartjs-2": "^2.11.2",
|
"react-chartjs-2": "^2.11.2",
|
||||||
"react-clipboard.js": "^2.0.16",
|
"react-clipboard.js": "^2.0.16",
|
||||||
@ -70,6 +72,7 @@
|
|||||||
"urql": "^2.0.5",
|
"urql": "^2.0.5",
|
||||||
"use-dark-mode": "^2.3.1",
|
"use-dark-mode": "^2.3.1",
|
||||||
"web3": "^1.6.0",
|
"web3": "^1.6.0",
|
||||||
|
"web3-utils": "^1.5.3",
|
||||||
"web3modal": "^1.9.4",
|
"web3modal": "^1.9.4",
|
||||||
"yup": "^0.32.11"
|
"yup": "^0.32.11"
|
||||||
},
|
},
|
||||||
|
@ -7,8 +7,7 @@ import React, {
|
|||||||
useCallback,
|
useCallback,
|
||||||
ReactNode
|
ReactNode
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { PurgatoryData } from '@oceanprotocol/lib/dist/node/ddo/interfaces/PurgatoryData'
|
|
||||||
import getAssetPurgatoryData from '@utils/purgatory'
|
import getAssetPurgatoryData from '@utils/purgatory'
|
||||||
import { CancelToken } from 'axios'
|
import { CancelToken } from 'axios'
|
||||||
import { retrieveDDO } from '@utils/aquarius'
|
import { retrieveDDO } from '@utils/aquarius'
|
||||||
@ -31,6 +30,12 @@ interface AssetProviderValue {
|
|||||||
refreshDdo: (token?: CancelToken) => Promise<void>
|
refreshDdo: (token?: CancelToken) => Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// temp, just to get rid of the error
|
||||||
|
export interface PurgatoryData {
|
||||||
|
did: string
|
||||||
|
reason: string
|
||||||
|
}
|
||||||
|
|
||||||
const AssetContext = createContext({} as AssetProviderValue)
|
const AssetContext = createContext({} as AssetProviderValue)
|
||||||
|
|
||||||
const refreshInterval = 10000 // 10 sec.
|
const refreshInterval = 10000 // 10 sec.
|
||||||
@ -59,7 +64,7 @@ function AssetProvider({
|
|||||||
const newCancelToken = useCancelToken()
|
const newCancelToken = useCancelToken()
|
||||||
|
|
||||||
const fetchDdo = async (token?: CancelToken) => {
|
const fetchDdo = async (token?: CancelToken) => {
|
||||||
Logger.log('[asset] Init asset, get DDO')
|
LoggerInstance.log('[asset] Init asset, get DDO')
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const ddo = await retrieveDDO(asset as string, token)
|
const ddo = await retrieveDDO(asset as string, token)
|
||||||
|
|
||||||
@ -77,7 +82,7 @@ function AssetProvider({
|
|||||||
const refreshDdo = async (token?: CancelToken) => {
|
const refreshDdo = async (token?: CancelToken) => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const ddo = await fetchDdo(token)
|
const ddo = await fetchDdo(token)
|
||||||
Logger.debug('[asset] Got DDO', ddo)
|
LoggerInstance.debug('[asset] Got DDO', ddo)
|
||||||
setDDO(ddo)
|
setDDO(ddo)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@ -91,7 +96,7 @@ function AssetProvider({
|
|||||||
setIsInPurgatory(isInPurgatory)
|
setIsInPurgatory(isInPurgatory)
|
||||||
isInPurgatory && setPurgatoryData(result)
|
isInPurgatory && setPurgatoryData(result)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error)
|
LoggerInstance.error(error)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@ -106,7 +111,7 @@ function AssetProvider({
|
|||||||
async function init() {
|
async function init() {
|
||||||
const ddo = await fetchDdo(newCancelToken())
|
const ddo = await fetchDdo(newCancelToken())
|
||||||
if (!isMounted || !ddo) return
|
if (!isMounted || !ddo) return
|
||||||
Logger.debug('[asset] Got DDO', ddo)
|
LoggerInstance.debug('[asset] Got DDO', ddo)
|
||||||
setDDO(ddo)
|
setDDO(ddo)
|
||||||
setDID(asset as string)
|
setDID(asset as string)
|
||||||
setTitle(ddo.metadata.name)
|
setTitle(ddo.metadata.name)
|
||||||
|
@ -7,16 +7,13 @@ import React, {
|
|||||||
ReactNode,
|
ReactNode,
|
||||||
useEffect
|
useEffect
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { Ocean, Logger, Account, ConfigHelperConfig } from '@oceanprotocol/lib'
|
import { Config, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useWeb3 } from './Web3'
|
import { useWeb3 } from './Web3'
|
||||||
import { getDevelopmentConfig, getOceanConfig } from '@utils/ocean'
|
import { getDevelopmentConfig, getOceanConfig } from '@utils/ocean'
|
||||||
import { useAsset } from './Asset'
|
import { useAsset } from './Asset'
|
||||||
|
|
||||||
interface OceanProviderValue {
|
interface OceanProviderValue {
|
||||||
ocean: Ocean
|
config: Config
|
||||||
account: Account
|
|
||||||
config: ConfigHelperConfig
|
|
||||||
connect: (config: ConfigHelperConfig) => Promise<void>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const OceanContext = createContext({} as OceanProviderValue)
|
const OceanContext = createContext({} as OceanProviderValue)
|
||||||
@ -25,30 +22,29 @@ function OceanProvider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
const { web3, accountId } = useWeb3()
|
const { web3, accountId } = useWeb3()
|
||||||
const { ddo } = useAsset()
|
const { ddo } = useAsset()
|
||||||
|
|
||||||
const [ocean, setOcean] = useState<Ocean>()
|
const [config, setConfig] = useState<Config>()
|
||||||
const [account, setAccount] = useState<Account>()
|
|
||||||
const [config, setConfig] = useState<ConfigHelperConfig>()
|
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// Helper: Create Ocean instance
|
// Helper: Create Ocean instance
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
const connect = useCallback(
|
const connect = useCallback(
|
||||||
async (config: ConfigHelperConfig) => {
|
async (config: Config) => {
|
||||||
if (!web3) return
|
if (!web3) return
|
||||||
|
|
||||||
const newConfig: ConfigHelperConfig = {
|
const newConfig: Config = {
|
||||||
...config,
|
...config,
|
||||||
web3Provider: web3
|
web3Provider: web3
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Logger.log('[ocean] Connecting Ocean...', newConfig)
|
LoggerInstance.log(
|
||||||
const newOcean = await Ocean.getInstance(newConfig)
|
'[ocean] Connecting Ocean... not anymore ',
|
||||||
setOcean(newOcean)
|
newConfig
|
||||||
|
)
|
||||||
|
|
||||||
setConfig(newConfig)
|
setConfig(newConfig)
|
||||||
Logger.log('[ocean] Ocean instance created.', newOcean)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('[ocean] Error: ', error.message)
|
LoggerInstance.error('[ocean] Error: ', error.message)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[web3]
|
[web3]
|
||||||
@ -78,23 +74,21 @@ function OceanProvider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// Get user info, handle account change from web3
|
// Get user info, handle account change from web3
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (!ocean || !accountId || !web3) return
|
// if ( !accountId || !web3) return
|
||||||
|
|
||||||
async function getInfo() {
|
// async function getInfo() {
|
||||||
const account = (await ocean.accounts.list())[0]
|
// const account = (await ocean.accounts.list())[0]
|
||||||
Logger.log('[ocean] Account: ', account)
|
// LoggerInstance.log('[ocean] Account: ', account)
|
||||||
setAccount(account)
|
// setAccount(account)
|
||||||
}
|
// }
|
||||||
getInfo()
|
// getInfo()
|
||||||
}, [ocean, accountId, web3])
|
// }, [ocean, accountId, web3])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<OceanContext.Provider
|
<OceanContext.Provider
|
||||||
value={
|
value={
|
||||||
{
|
{
|
||||||
ocean,
|
|
||||||
account,
|
|
||||||
connect,
|
connect,
|
||||||
config
|
config
|
||||||
// refreshBalance
|
// refreshBalance
|
||||||
|
@ -8,7 +8,7 @@ import React, {
|
|||||||
import { fetchData } from '@utils/fetch'
|
import { fetchData } from '@utils/fetch'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
interface PricesValue {
|
interface PricesValue {
|
||||||
[key: string]: number
|
[key: string]: number
|
||||||
@ -39,7 +39,7 @@ export default function PricesProvider({
|
|||||||
|
|
||||||
const onSuccess = async (data: { [tokenId]: { [key: string]: number } }) => {
|
const onSuccess = async (data: { [tokenId]: { [key: string]: number } }) => {
|
||||||
if (!data) return
|
if (!data) return
|
||||||
Logger.log('[prices] Got new OCEAN spot prices.', data[tokenId])
|
LoggerInstance.log('[prices] Got new OCEAN spot prices.', data[tokenId])
|
||||||
setPrices(data[tokenId])
|
setPrices(data[tokenId])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
} from '@utils/subgraph'
|
} from '@utils/subgraph'
|
||||||
import { useUserPreferences } from './UserPreferences'
|
import { useUserPreferences } from './UserPreferences'
|
||||||
import { PoolShares_poolShares as PoolShare } from '../@types/apollo/PoolShares'
|
import { PoolShares_poolShares as PoolShare } from '../@types/apollo/PoolShares'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { getDownloadAssets, getPublishedAssets } from '@utils/aquarius'
|
import { getDownloadAssets, getPublishedAssets } from '@utils/aquarius'
|
||||||
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
||||||
import { accountTruncate } from '@utils/web3'
|
import { accountTruncate } from '@utils/web3'
|
||||||
@ -70,7 +70,7 @@ function ProfileProvider({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!accountEns) return
|
if (!accountEns) return
|
||||||
Logger.log(`[profile] ENS name found for ${accountId}:`, accountEns)
|
LoggerInstance.log(`[profile] ENS name found for ${accountId}:`, accountEns)
|
||||||
}, [accountId, accountEns])
|
}, [accountId, accountEns])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -109,10 +109,10 @@ function ProfileProvider({
|
|||||||
...prevState,
|
...prevState,
|
||||||
...newProfile
|
...newProfile
|
||||||
}))
|
}))
|
||||||
Logger.log('[profile] Found and set 3box profile.', newProfile)
|
LoggerInstance.log('[profile] Found and set 3box profile.', newProfile)
|
||||||
} else {
|
} else {
|
||||||
// setProfile(clearedProfile)
|
// setProfile(clearedProfile)
|
||||||
Logger.log('[profile] No 3box profile found.')
|
LoggerInstance.log('[profile] No 3box profile found.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getInfo()
|
getInfo()
|
||||||
@ -137,12 +137,12 @@ function ProfileProvider({
|
|||||||
setIsPoolSharesLoading(true)
|
setIsPoolSharesLoading(true)
|
||||||
const poolShares = await getPoolSharesData(accountId, chainIds)
|
const poolShares = await getPoolSharesData(accountId, chainIds)
|
||||||
setPoolShares(poolShares)
|
setPoolShares(poolShares)
|
||||||
Logger.log(
|
LoggerInstance.log(
|
||||||
`[profile] Fetched ${poolShares.length} pool shares.`,
|
`[profile] Fetched ${poolShares.length} pool shares.`,
|
||||||
poolShares
|
poolShares
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Error fetching pool shares: ', error.message)
|
LoggerInstance.error('Error fetching pool shares: ', error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setIsPoolSharesLoading(false)
|
setIsPoolSharesLoading(false)
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ function ProfileProvider({
|
|||||||
)
|
)
|
||||||
setAssets(result.results)
|
setAssets(result.results)
|
||||||
setAssetsTotal(result.totalResults)
|
setAssetsTotal(result.totalResults)
|
||||||
Logger.log(
|
LoggerInstance.log(
|
||||||
`[profile] Fetched ${result.totalResults} assets.`,
|
`[profile] Fetched ${result.totalResults} assets.`,
|
||||||
result.results
|
result.results
|
||||||
)
|
)
|
||||||
@ -199,7 +199,7 @@ function ProfileProvider({
|
|||||||
// const assetsWithPrices = await getAssetsBestPrices(result.results)
|
// const assetsWithPrices = await getAssetsBestPrices(result.results)
|
||||||
// setAssetsWithPrices(assetsWithPrices)
|
// setAssetsWithPrices(assetsWithPrices)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getAllPublished()
|
getAllPublished()
|
||||||
@ -239,7 +239,7 @@ function ProfileProvider({
|
|||||||
)
|
)
|
||||||
setDownloads(downloads)
|
setDownloads(downloads)
|
||||||
setDownloadsTotal(downloads.length)
|
setDownloadsTotal(downloads.length)
|
||||||
Logger.log(
|
LoggerInstance.log(
|
||||||
`[profile] Fetched ${downloads.length} download orders.`,
|
`[profile] Fetched ${downloads.length} download orders.`,
|
||||||
downloads
|
downloads
|
||||||
)
|
)
|
||||||
@ -257,7 +257,7 @@ function ProfileProvider({
|
|||||||
setIsDownloadsLoading(true)
|
setIsDownloadsLoading(true)
|
||||||
await fetchDownloads(cancelTokenSource.token)
|
await fetchDownloads(cancelTokenSource.token)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Logger.log(err.message)
|
LoggerInstance.log(err.message)
|
||||||
} finally {
|
} finally {
|
||||||
setIsDownloadsLoading(false)
|
setIsDownloadsLoading(false)
|
||||||
}
|
}
|
||||||
@ -289,9 +289,9 @@ function ProfileProvider({
|
|||||||
try {
|
try {
|
||||||
const result = await getUserSales(accountId, chainIds)
|
const result = await getUserSales(accountId, chainIds)
|
||||||
setSales(result)
|
setSales(result)
|
||||||
Logger.log(`[profile] Fetched sales number: ${result}.`, result)
|
LoggerInstance.log(`[profile] Fetched sales number: ${result}.`, result)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getUserSalesNumber()
|
getUserSalesNumber()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createClient, Provider, Client } from 'urql'
|
import { createClient, Provider, Client } from 'urql'
|
||||||
import React, { useState, useEffect, ReactNode, ReactElement } from 'react'
|
import React, { useState, useEffect, ReactNode, ReactElement } from 'react'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { getOceanConfig } from '@utils/ocean'
|
import { getOceanConfig } from '@utils/ocean'
|
||||||
|
|
||||||
let urqlClient: Client
|
let urqlClient: Client
|
||||||
@ -33,7 +33,7 @@ export default function UrqlClientProvider({
|
|||||||
const oceanConfig = getOceanConfig(1)
|
const oceanConfig = getOceanConfig(1)
|
||||||
|
|
||||||
if (!oceanConfig?.subgraphUri) {
|
if (!oceanConfig?.subgraphUri) {
|
||||||
Logger.error(
|
LoggerInstance.error(
|
||||||
'No subgraphUri defined, preventing UrqlProvider from initialization.'
|
'No subgraphUri defined, preventing UrqlProvider from initialization.'
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@ -42,7 +42,7 @@ export default function UrqlClientProvider({
|
|||||||
const newClient = createUrqlClient(oceanConfig.subgraphUri)
|
const newClient = createUrqlClient(oceanConfig.subgraphUri)
|
||||||
urqlClient = newClient
|
urqlClient = newClient
|
||||||
setClient(newClient)
|
setClient(newClient)
|
||||||
Logger.log(`[URQL] Client connected to ${oceanConfig.subgraphUri}`)
|
LoggerInstance.log(`[URQL] Client connected to ${oceanConfig.subgraphUri}`)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return client ? <Provider value={client}>{children}</Provider> : <></>
|
return client ? <Provider value={client}>{children}</Provider> : <></>
|
||||||
|
@ -6,7 +6,7 @@ import React, {
|
|||||||
useState,
|
useState,
|
||||||
useEffect
|
useEffect
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { Logger, LogLevel } from '@oceanprotocol/lib'
|
import { LoggerInstance, LogLevel } from '@oceanprotocol/lib'
|
||||||
import { isBrowser } from '@utils/index'
|
import { isBrowser } from '@utils/index'
|
||||||
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
||||||
|
|
||||||
@ -102,8 +102,8 @@ function UserPreferencesProvider({
|
|||||||
// Set ocean.js log levels, default: Error
|
// Set ocean.js log levels, default: Error
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
debug === true
|
debug === true
|
||||||
? Logger.setLevel(LogLevel.Verbose)
|
? LoggerInstance.setLevel(LogLevel.Verbose)
|
||||||
: Logger.setLevel(LogLevel.Error)
|
: LoggerInstance.setLevel(LogLevel.Error)
|
||||||
}, [debug])
|
}, [debug])
|
||||||
|
|
||||||
// Get locale always from user's browser
|
// Get locale always from user's browser
|
||||||
|
@ -11,7 +11,7 @@ import Web3 from 'web3'
|
|||||||
import Web3Modal, { getProviderInfo, IProviderInfo } from 'web3modal'
|
import Web3Modal, { getProviderInfo, IProviderInfo } from 'web3modal'
|
||||||
import { infuraProjectId as infuraId, portisId } from '../../app.config'
|
import { infuraProjectId as infuraId, portisId } from '../../app.config'
|
||||||
import WalletConnectProvider from '@walletconnect/web3-provider'
|
import WalletConnectProvider from '@walletconnect/web3-provider'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { isBrowser } from '@utils/index'
|
import { isBrowser } from '@utils/index'
|
||||||
import { getEnsName } from '@utils/ens'
|
import { getEnsName } from '@utils/ens'
|
||||||
import { getOceanBalance } from '@utils/ocean'
|
import { getOceanBalance } from '@utils/ocean'
|
||||||
@ -115,28 +115,28 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
setWeb3Loading(true)
|
setWeb3Loading(true)
|
||||||
Logger.log('[web3] Connecting Web3...')
|
LoggerInstance.log('[web3] Connecting Web3...')
|
||||||
|
|
||||||
const provider = await web3Modal?.connect()
|
const provider = await web3Modal?.connect()
|
||||||
setWeb3Provider(provider)
|
setWeb3Provider(provider)
|
||||||
|
|
||||||
const web3 = new Web3(provider)
|
const web3 = new Web3(provider)
|
||||||
setWeb3(web3)
|
setWeb3(web3)
|
||||||
Logger.log('[web3] Web3 created.', web3)
|
LoggerInstance.log('[web3] Web3 created.', web3)
|
||||||
|
|
||||||
const networkId = await web3.eth.net.getId()
|
const networkId = await web3.eth.net.getId()
|
||||||
setNetworkId(networkId)
|
setNetworkId(networkId)
|
||||||
Logger.log('[web3] network id ', networkId)
|
LoggerInstance.log('[web3] network id ', networkId)
|
||||||
|
|
||||||
const chainId = await web3.eth.getChainId()
|
const chainId = await web3.eth.getChainId()
|
||||||
setChainId(chainId)
|
setChainId(chainId)
|
||||||
Logger.log('[web3] chain id ', chainId)
|
LoggerInstance.log('[web3] chain id ', chainId)
|
||||||
|
|
||||||
const accountId = (await web3.eth.getAccounts())[0]
|
const accountId = (await web3.eth.getAccounts())[0]
|
||||||
setAccountId(accountId)
|
setAccountId(accountId)
|
||||||
Logger.log('[web3] account id', accountId)
|
LoggerInstance.log('[web3] account id', accountId)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('[web3] Error: ', error.message)
|
LoggerInstance.error('[web3] Error: ', error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setWeb3Loading(false)
|
setWeb3Loading(false)
|
||||||
}
|
}
|
||||||
@ -154,9 +154,9 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
ocean: await getOceanBalance(accountId, networkId, web3)
|
ocean: await getOceanBalance(accountId, networkId, web3)
|
||||||
}
|
}
|
||||||
setBalance(balance)
|
setBalance(balance)
|
||||||
Logger.log('[web3] Balance: ', balance)
|
LoggerInstance.log('[web3] Balance: ', balance)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('[web3] Error: ', error.message)
|
LoggerInstance.error('[web3] Error: ', error.message)
|
||||||
}
|
}
|
||||||
}, [accountId, networkId, web3])
|
}, [accountId, networkId, web3])
|
||||||
|
|
||||||
@ -175,9 +175,12 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
const accountEns = await getEnsName(accountId)
|
const accountEns = await getEnsName(accountId)
|
||||||
setAccountEns(accountEns)
|
setAccountEns(accountEns)
|
||||||
accountEns &&
|
accountEns &&
|
||||||
Logger.log(`[web3] ENS name found for ${accountId}:`, accountEns)
|
LoggerInstance.log(
|
||||||
|
`[web3] ENS name found for ${accountId}:`,
|
||||||
|
accountEns
|
||||||
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('[web3] Error: ', error.message)
|
LoggerInstance.error('[web3] Error: ', error.message)
|
||||||
}
|
}
|
||||||
}, [accountId])
|
}, [accountId])
|
||||||
|
|
||||||
@ -194,7 +197,10 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
// note: needs artificial await here so the log message is reached and output
|
// note: needs artificial await here so the log message is reached and output
|
||||||
const web3ModalInstance = await new Web3Modal(web3ModalOpts)
|
const web3ModalInstance = await new Web3Modal(web3ModalOpts)
|
||||||
setWeb3Modal(web3ModalInstance)
|
setWeb3Modal(web3ModalInstance)
|
||||||
Logger.log('[web3] Web3Modal instance created.', web3ModalInstance)
|
LoggerInstance.log(
|
||||||
|
'[web3] Web3Modal instance created.',
|
||||||
|
web3ModalInstance
|
||||||
|
)
|
||||||
}
|
}
|
||||||
init()
|
init()
|
||||||
}, [connect, web3Modal])
|
}, [connect, web3Modal])
|
||||||
@ -206,7 +212,7 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
if (!web3Modal?.cachedProvider) return
|
if (!web3Modal?.cachedProvider) return
|
||||||
|
|
||||||
async function connectCached() {
|
async function connectCached() {
|
||||||
Logger.log(
|
LoggerInstance.log(
|
||||||
'[web3] Connecting to cached provider: ',
|
'[web3] Connecting to cached provider: ',
|
||||||
web3Modal.cachedProvider
|
web3Modal.cachedProvider
|
||||||
)
|
)
|
||||||
@ -243,7 +249,7 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
if (!networkId) return
|
if (!networkId) return
|
||||||
const networkData = getNetworkDataById(networksList, networkId)
|
const networkData = getNetworkDataById(networksList, networkId)
|
||||||
setNetworkData(networkData)
|
setNetworkData(networkData)
|
||||||
Logger.log(
|
LoggerInstance.log(
|
||||||
networkData
|
networkData
|
||||||
? `[web3] Network metadata found.`
|
? `[web3] Network metadata found.`
|
||||||
: `[web3] No network metadata found.`,
|
: `[web3] No network metadata found.`,
|
||||||
@ -259,7 +265,9 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
networkData?.network !== 'mainnet' && networkData.network !== 'moonriver'
|
networkData?.network !== 'mainnet' && networkData.network !== 'moonriver'
|
||||||
)
|
)
|
||||||
|
|
||||||
Logger.log(`[web3] Network display name set to: ${networkDisplayName}`)
|
LoggerInstance.log(
|
||||||
|
`[web3] Network display name set to: ${networkDisplayName}`
|
||||||
|
)
|
||||||
}, [networkId, networksList])
|
}, [networkId, networksList])
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
@ -271,7 +279,7 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
async function getBlock() {
|
async function getBlock() {
|
||||||
const block = await web3.eth.getBlockNumber()
|
const block = await web3.eth.getBlockNumber()
|
||||||
setBlock(block)
|
setBlock(block)
|
||||||
Logger.log('[web3] Head block: ', block)
|
LoggerInstance.log('[web3] Head block: ', block)
|
||||||
}
|
}
|
||||||
getBlock()
|
getBlock()
|
||||||
}, [web3, networkId])
|
}, [web3, networkId])
|
||||||
@ -302,21 +310,21 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
// Handle change events
|
// Handle change events
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
async function handleChainChanged(chainId: string) {
|
async function handleChainChanged(chainId: string) {
|
||||||
Logger.log('[web3] Chain changed', chainId)
|
LoggerInstance.log('[web3] Chain changed', chainId)
|
||||||
const networkId = await web3.eth.net.getId()
|
const networkId = await web3.eth.net.getId()
|
||||||
setChainId(Number(chainId))
|
setChainId(Number(chainId))
|
||||||
setNetworkId(Number(networkId))
|
setNetworkId(Number(networkId))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleNetworkChanged(networkId: string) {
|
async function handleNetworkChanged(networkId: string) {
|
||||||
Logger.log('[web3] Network changed', networkId)
|
LoggerInstance.log('[web3] Network changed', networkId)
|
||||||
const chainId = await web3.eth.getChainId()
|
const chainId = await web3.eth.getChainId()
|
||||||
setNetworkId(Number(networkId))
|
setNetworkId(Number(networkId))
|
||||||
setChainId(Number(chainId))
|
setChainId(Number(chainId))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleAccountsChanged(accounts: string[]) {
|
async function handleAccountsChanged(accounts: string[]) {
|
||||||
Logger.log('[web3] Account changed', accounts[0])
|
LoggerInstance.log('[web3] Account changed', accounts[0])
|
||||||
setAccountId(accounts[0])
|
setAccountId(accounts[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { PurgatoryDataAccount, getAccountPurgatoryData } from '@utils/purgatory'
|
import { PurgatoryDataAccount, getAccountPurgatoryData } from '@utils/purgatory'
|
||||||
|
|
||||||
interface UseAccountPurgatory {
|
interface UseAccountPurgatory {
|
||||||
@ -24,7 +24,7 @@ function useAccountPurgatory(accountId: string): UseAccountPurgatory {
|
|||||||
setIsInPurgatory(isInPurgatory)
|
setIsInPurgatory(isInPurgatory)
|
||||||
isInPurgatory && setPurgatoryData(result)
|
isInPurgatory && setPurgatoryData(result)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error)
|
LoggerInstance.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { consumeFeedback } from '@utils/feedback'
|
import { consumeFeedback } from '@utils/feedback'
|
||||||
import { DID, Logger, ServiceType } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useOcean } from '@context/Ocean'
|
import { useOcean } from '@context/Ocean'
|
||||||
import { useWeb3 } from '@context/Web3'
|
import { useWeb3 } from '@context/Web3'
|
||||||
|
|
||||||
interface UseConsume {
|
interface UseConsume {
|
||||||
consume: (
|
consume: (
|
||||||
did: DID | string,
|
did: string,
|
||||||
dataTokenAddress: string,
|
dataTokenAddress: string,
|
||||||
serviceType: ServiceType,
|
serviceType: string,
|
||||||
marketFeeAddress: string,
|
marketFeeAddress: string,
|
||||||
orderId?: string
|
orderId?: string
|
||||||
) => Promise<string>
|
) => Promise<string>
|
||||||
@ -20,7 +20,6 @@ interface UseConsume {
|
|||||||
|
|
||||||
function useConsume(): UseConsume {
|
function useConsume(): UseConsume {
|
||||||
const { accountId } = useWeb3()
|
const { accountId } = useWeb3()
|
||||||
const { ocean, account } = useOcean()
|
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
const [consumeStep, setConsumeStep] = useState<number | undefined>()
|
const [consumeStep, setConsumeStep] = useState<number | undefined>()
|
||||||
const [consumeStepText, setConsumeStepText] = useState<string | undefined>()
|
const [consumeStepText, setConsumeStepText] = useState<string | undefined>()
|
||||||
@ -32,13 +31,13 @@ function useConsume(): UseConsume {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function consume(
|
async function consume(
|
||||||
did: DID | string,
|
did: string,
|
||||||
dataTokenAddress: string,
|
dataTokenAddress: string,
|
||||||
serviceType: ServiceType = 'access',
|
serviceType = 'access',
|
||||||
marketFeeAddress: string,
|
marketFeeAddress: string,
|
||||||
orderId?: string
|
orderId?: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
if (!ocean || !account || !accountId) return
|
if (!accountId) return
|
||||||
|
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
setConsumeError(undefined)
|
setConsumeError(undefined)
|
||||||
@ -47,47 +46,47 @@ function useConsume(): UseConsume {
|
|||||||
setStep(0)
|
setStep(0)
|
||||||
if (!orderId) {
|
if (!orderId) {
|
||||||
// if we don't have a previous valid order, get one
|
// if we don't have a previous valid order, get one
|
||||||
const userOwnedTokens = await ocean.accounts.getTokenBalance(
|
// const userOwnedTokens = await ocean.accounts.getTokenBalance(
|
||||||
dataTokenAddress,
|
// dataTokenAddress,
|
||||||
account
|
// account
|
||||||
)
|
// )
|
||||||
if (parseFloat(userOwnedTokens) < 1) {
|
// if (parseFloat(userOwnedTokens) < 1) {
|
||||||
setConsumeError('Not enough datatokens')
|
// setConsumeError('Not enough datatokens')
|
||||||
return 'Not enough datatokens'
|
// return 'Not enough datatokens'
|
||||||
} else {
|
// } else {
|
||||||
setStep(1)
|
// setStep(1)
|
||||||
try {
|
// try {
|
||||||
orderId = await ocean.assets.order(
|
// orderId = await ocean.assets.order(
|
||||||
did as string,
|
// did as string,
|
||||||
serviceType,
|
// serviceType,
|
||||||
accountId,
|
// accountId,
|
||||||
undefined,
|
// undefined,
|
||||||
marketFeeAddress,
|
// marketFeeAddress,
|
||||||
undefined,
|
// undefined,
|
||||||
null,
|
// null,
|
||||||
false
|
// false
|
||||||
)
|
// )
|
||||||
Logger.log('order created', orderId)
|
// LoggerInstance.log('order created', orderId)
|
||||||
setStep(2)
|
// setStep(2)
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
setConsumeError(error.message)
|
// setConsumeError(error.message)
|
||||||
return error.message
|
// return error.message
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
setStep(3)
|
setStep(3)
|
||||||
if (orderId)
|
// if (orderId)
|
||||||
await ocean.assets.download(
|
// await ocean.assets.download(
|
||||||
did as string,
|
// did as string,
|
||||||
orderId,
|
// orderId,
|
||||||
dataTokenAddress,
|
// dataTokenAddress,
|
||||||
account,
|
// account,
|
||||||
''
|
// ''
|
||||||
)
|
// )
|
||||||
setStep(4)
|
setStep(4)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setConsumeError(error.message)
|
setConsumeError(error.message)
|
||||||
Logger.error(error)
|
LoggerInstance.error(error)
|
||||||
return error.message
|
return error.message
|
||||||
} finally {
|
} finally {
|
||||||
setConsumeStep(undefined)
|
setConsumeStep(undefined)
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { useOcean } from '@context/Ocean'
|
import { useOcean } from '@context/Ocean'
|
||||||
import { useWeb3 } from '@context/Web3'
|
import { useWeb3 } from '@context/Web3'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { Config, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import { ConfigHelperConfig } from '@oceanprotocol/lib/dist/node/utils/ConfigHelper'
|
|
||||||
import axios, { AxiosResponse } from 'axios'
|
import axios, { AxiosResponse } from 'axios'
|
||||||
|
|
||||||
const blockDifferenceThreshold = 30
|
const blockDifferenceThreshold = 30
|
||||||
@ -27,11 +26,11 @@ async function fetchGraph(
|
|||||||
const response = await axios.post(url, { ...JSON.parse(queryBody) })
|
const response = await axios.post(url, { ...JSON.parse(queryBody) })
|
||||||
return response
|
return response
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Error parsing json: ' + error.message)
|
LoggerInstance.error('Error parsing json: ' + error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getBlockHead(config: ConfigHelperConfig) {
|
async function getBlockHead(config: Config) {
|
||||||
// for ETH main, get block from graph fetch
|
// for ETH main, get block from graph fetch
|
||||||
if (config.network === 'mainnet') {
|
if (config.network === 'mainnet') {
|
||||||
const response: any = await fetchGraph(ethGraphUrl, ethGraphQuery)
|
const response: any = await fetchGraph(ethGraphUrl, ethGraphQuery)
|
||||||
@ -68,7 +67,7 @@ export function useGraphSyncStatus(): UseGraphSyncStatus {
|
|||||||
async function initBlockHead() {
|
async function initBlockHead() {
|
||||||
const blockHead = block || (await getBlockHead(config))
|
const blockHead = block || (await getBlockHead(config))
|
||||||
setBlockHead(blockHead)
|
setBlockHead(blockHead)
|
||||||
Logger.log('[GraphStatus] Head block: ', blockHead)
|
LoggerInstance.log('[GraphStatus] Head block: ', blockHead)
|
||||||
}
|
}
|
||||||
initBlockHead()
|
initBlockHead()
|
||||||
}, [web3Loading, block, config])
|
}, [web3Loading, block, config])
|
||||||
@ -82,7 +81,10 @@ export function useGraphSyncStatus(): UseGraphSyncStatus {
|
|||||||
const blockGraph = await getBlockSubgraph(config.subgraphUri)
|
const blockGraph = await getBlockSubgraph(config.subgraphUri)
|
||||||
setBlockGraph(blockGraph)
|
setBlockGraph(blockGraph)
|
||||||
setSubgraphLoading(false)
|
setSubgraphLoading(false)
|
||||||
Logger.log('[GraphStatus] Latest block from subgraph: ', blockGraph)
|
LoggerInstance.log(
|
||||||
|
'[GraphStatus] Latest block from subgraph: ',
|
||||||
|
blockGraph
|
||||||
|
)
|
||||||
}
|
}
|
||||||
initBlockSubgraph()
|
initBlockSubgraph()
|
||||||
}, [config])
|
}, [config])
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { TransactionReceipt } from 'web3-core'
|
import { TransactionReceipt } from 'web3-core'
|
||||||
import { Decimal } from 'decimal.js'
|
import { Decimal } from 'decimal.js'
|
||||||
@ -34,27 +34,29 @@ interface UsePricing {
|
|||||||
|
|
||||||
function usePricing(): UsePricing {
|
function usePricing(): UsePricing {
|
||||||
const { accountId } = useWeb3()
|
const { accountId } = useWeb3()
|
||||||
const { ocean, config } = useOcean()
|
const { config } = useOcean()
|
||||||
const [pricingIsLoading, setPricingIsLoading] = useState(false)
|
const [pricingIsLoading, setPricingIsLoading] = useState(false)
|
||||||
const [pricingStep, setPricingStep] = useState<number>()
|
const [pricingStep, setPricingStep] = useState<number>()
|
||||||
const [pricingStepText, setPricingStepText] = useState<string>()
|
const [pricingStepText, setPricingStepText] = useState<string>()
|
||||||
const [pricingError, setPricingError] = useState<string>()
|
const [pricingError, setPricingError] = useState<string>()
|
||||||
|
|
||||||
async function getDTSymbol(ddo: Asset): Promise<string> {
|
async function getDTSymbol(ddo: Asset): Promise<string> {
|
||||||
if (!ocean || !accountId) return
|
if (!accountId) return
|
||||||
|
|
||||||
const { dataTokenInfo } = ddo
|
const { dataTokenInfo } = ddo
|
||||||
return dataTokenInfo
|
return dataTokenInfo.symbol
|
||||||
? dataTokenInfo.symbol
|
// return dataTokenInfo
|
||||||
: await ocean?.datatokens.getSymbol(dataTokenInfo.address)
|
// ? dataTokenInfo.symbol
|
||||||
|
// : await ocean?.datatokens.getSymbol(dataTokenInfo.address)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDTName(ddo: Asset): Promise<string> {
|
async function getDTName(ddo: Asset): Promise<string> {
|
||||||
if (!ocean || !accountId) return
|
if (!accountId) return
|
||||||
const { dataTokenInfo } = ddo
|
const { dataTokenInfo } = ddo
|
||||||
return dataTokenInfo
|
return dataTokenInfo.name
|
||||||
? dataTokenInfo.name
|
// return dataTokenInfo
|
||||||
: await ocean?.datatokens.getName(dataTokenInfo.address)
|
// ? dataTokenInfo.name
|
||||||
|
// : await ocean?.datatokens.getName(dataTokenInfo.address)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for setting steps & feedback for all flows
|
// Helper for setting steps & feedback for all flows
|
||||||
@ -95,20 +97,20 @@ function usePricing(): UsePricing {
|
|||||||
ddo: Asset
|
ddo: Asset
|
||||||
): Promise<TransactionReceipt | void> {
|
): Promise<TransactionReceipt | void> {
|
||||||
const { dataTokenInfo } = ddo
|
const { dataTokenInfo } = ddo
|
||||||
Logger.log('mint function', dataTokenInfo.address, accountId)
|
LoggerInstance.log('mint function', dataTokenInfo.address, accountId)
|
||||||
const balance = new Decimal(
|
// const balance = new Decimal(
|
||||||
await ocean.datatokens.balance(dataTokenInfo.address, accountId)
|
// await ocean.datatokens.balance(dataTokenInfo.address, accountId)
|
||||||
)
|
// )
|
||||||
const tokens = new Decimal(tokensToMint)
|
// const tokens = new Decimal(tokensToMint)
|
||||||
if (tokens.greaterThan(balance)) {
|
// if (tokens.greaterThan(balance)) {
|
||||||
const mintAmount = tokens.minus(balance)
|
// const mintAmount = tokens.minus(balance)
|
||||||
const tx = await ocean.datatokens.mint(
|
// const tx = await ocean.datatokens.mint(
|
||||||
dataTokenInfo.address,
|
// dataTokenInfo.address,
|
||||||
accountId,
|
// accountId,
|
||||||
mintAmount.toString()
|
// mintAmount.toString()
|
||||||
)
|
// )
|
||||||
return tx
|
// return tx
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function buyDT(
|
async function buyDT(
|
||||||
@ -116,7 +118,7 @@ function usePricing(): UsePricing {
|
|||||||
price: BestPrice,
|
price: BestPrice,
|
||||||
ddo: Asset
|
ddo: Asset
|
||||||
): Promise<TransactionReceipt | void> {
|
): Promise<TransactionReceipt | void> {
|
||||||
if (!ocean || !accountId) return
|
if (!accountId) return
|
||||||
|
|
||||||
let tx
|
let tx
|
||||||
|
|
||||||
@ -125,7 +127,7 @@ function usePricing(): UsePricing {
|
|||||||
setPricingError(undefined)
|
setPricingError(undefined)
|
||||||
setStep(1, 'buy', ddo)
|
setStep(1, 'buy', ddo)
|
||||||
|
|
||||||
Logger.log('Price found for buying', price)
|
LoggerInstance.log('Price found for buying', price)
|
||||||
Decimal.set({ precision: 18 })
|
Decimal.set({ precision: 18 })
|
||||||
|
|
||||||
switch (price?.type) {
|
switch (price?.type) {
|
||||||
@ -134,78 +136,78 @@ function usePricing(): UsePricing {
|
|||||||
const maxPrice = new Decimal(price.value).times(2).toString()
|
const maxPrice = new Decimal(price.value).times(2).toString()
|
||||||
|
|
||||||
setStep(2, 'buy', ddo)
|
setStep(2, 'buy', ddo)
|
||||||
Logger.log(
|
LoggerInstance.log(
|
||||||
'Buying token from pool',
|
'Buying token from pool',
|
||||||
price,
|
price,
|
||||||
accountId,
|
accountId,
|
||||||
oceanAmmount,
|
oceanAmmount,
|
||||||
maxPrice
|
maxPrice
|
||||||
)
|
)
|
||||||
tx = await ocean.pool.buyDT(
|
// tx = await ocean.pool.buyDT(
|
||||||
accountId,
|
// accountId,
|
||||||
price.address,
|
// price.address,
|
||||||
String(amountDataToken),
|
// String(amountDataToken),
|
||||||
oceanAmmount,
|
// oceanAmmount,
|
||||||
maxPrice
|
// maxPrice
|
||||||
)
|
// )
|
||||||
setStep(3, 'buy', ddo)
|
setStep(3, 'buy', ddo)
|
||||||
Logger.log('DT buy response', tx)
|
LoggerInstance.log('DT buy response', tx)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'fixed': {
|
case 'fixed': {
|
||||||
if (!config.oceanTokenAddress) {
|
if (!config.oceanTokenAddress) {
|
||||||
Logger.error(`'oceanTokenAddress' not set in config`)
|
LoggerInstance.error(`'oceanTokenAddress' not set in config`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!config.fixedRateExchangeAddress) {
|
if (!config.fixedRateExchangeAddress) {
|
||||||
Logger.error(`'fixedRateExchangeAddress' not set in config`)
|
LoggerInstance.error(`'fixedRateExchangeAddress' not set in config`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Logger.log('Buying token from exchange', price, accountId)
|
LoggerInstance.log('Buying token from exchange', price, accountId)
|
||||||
await ocean.datatokens.approve(
|
// await ocean.datatokens.approve(
|
||||||
config.oceanTokenAddress,
|
// config.oceanTokenAddress,
|
||||||
config.fixedRateExchangeAddress,
|
// config.fixedRateExchangeAddress,
|
||||||
`${price.value}`,
|
// `${price.value}`,
|
||||||
accountId
|
// accountId
|
||||||
)
|
// )
|
||||||
setStep(2, 'buy', ddo)
|
setStep(2, 'buy', ddo)
|
||||||
tx = await ocean.fixedRateExchange.buyDT(
|
// tx = await ocean.fixedRateExchange.buyDT(
|
||||||
price.address,
|
// price.address,
|
||||||
`${amountDataToken}`,
|
// `${amountDataToken}`,
|
||||||
accountId
|
// accountId
|
||||||
)
|
// )
|
||||||
setStep(3, 'buy', ddo)
|
setStep(3, 'buy', ddo)
|
||||||
Logger.log('DT exchange buy response', tx)
|
LoggerInstance.log('DT exchange buy response', tx)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'free': {
|
case 'free': {
|
||||||
setStep(1, 'dispense', ddo)
|
setStep(1, 'dispense', ddo)
|
||||||
const isDispensable = await ocean.OceanDispenser.isDispensable(
|
// const isDispensable = await ocean.OceanDispenser.isDispensable(
|
||||||
ddo?.services[0].datatokenAddress,
|
// ddo?.services[0].datatokenAddress,
|
||||||
accountId,
|
// accountId,
|
||||||
'1'
|
// '1'
|
||||||
)
|
// )
|
||||||
|
|
||||||
if (!isDispensable) {
|
// if (!isDispensable) {
|
||||||
Logger.error(
|
// LoggerInstance.error(
|
||||||
`Dispenser for ${ddo?.services[0].datatokenAddress} failed to dispense`
|
// `Dispenser for ${ddo?.services[0].datatokenAddress} failed to dispense`
|
||||||
)
|
// )
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
tx = await ocean.OceanDispenser.dispense(
|
// tx = await ocean.OceanDispenser.dispense(
|
||||||
ddo?.services[0].datatokenAddress,
|
// ddo?.services[0].datatokenAddress,
|
||||||
accountId,
|
// accountId,
|
||||||
'1'
|
// '1'
|
||||||
)
|
// )
|
||||||
setStep(2, 'dispense', ddo)
|
setStep(2, 'dispense', ddo)
|
||||||
Logger.log('DT dispense response', tx)
|
LoggerInstance.log('DT dispense response', tx)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setPricingError(error.message)
|
setPricingError(error.message)
|
||||||
Logger.error(error)
|
LoggerInstance.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setStep(0, 'buy', ddo)
|
setStep(0, 'buy', ddo)
|
||||||
setPricingStepText(undefined)
|
setPricingStepText(undefined)
|
||||||
@ -222,7 +224,7 @@ function usePricing(): UsePricing {
|
|||||||
const dataToken = ddo?.services[0].datatokenAddress
|
const dataToken = ddo?.services[0].datatokenAddress
|
||||||
const dtSymbol = await getDTSymbol(ddo)
|
const dtSymbol = await getDTSymbol(ddo)
|
||||||
|
|
||||||
if (!ocean || !accountId || !dtSymbol) return
|
if (!accountId || !dtSymbol) return
|
||||||
|
|
||||||
const { type, amountOcean, price, weightOnDataToken, swapFee } =
|
const { type, amountOcean, price, weightOnDataToken, swapFee } =
|
||||||
priceOptions
|
priceOptions
|
||||||
@ -231,7 +233,7 @@ function usePricing(): UsePricing {
|
|||||||
const isPool = type === 'dynamic'
|
const isPool = type === 'dynamic'
|
||||||
|
|
||||||
if (!isPool && !config.fixedRateExchangeAddress) {
|
if (!isPool && !config.fixedRateExchangeAddress) {
|
||||||
Logger.error(`'fixedRateExchangeAddress' not set in config.`)
|
LoggerInstance.error(`'fixedRateExchangeAddress' not set in config.`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +245,7 @@ function usePricing(): UsePricing {
|
|||||||
try {
|
try {
|
||||||
if (type === 'free') {
|
if (type === 'free') {
|
||||||
setStep(99, 'free', ddo)
|
setStep(99, 'free', ddo)
|
||||||
await ocean.OceanDispenser.activate(dataToken, '1', '1', accountId)
|
// await ocean.OceanDispenser.activate(dataToken, '1', '1', accountId)
|
||||||
} else {
|
} else {
|
||||||
// if fixedPrice set dt to max amount
|
// if fixedPrice set dt to max amount
|
||||||
if (!isPool) amountDataToken = 1000
|
if (!isPool) amountDataToken = 1000
|
||||||
@ -251,29 +253,30 @@ function usePricing(): UsePricing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// amountDataToken for fixed price is set to max
|
// amountDataToken for fixed price is set to max
|
||||||
const tx = isPool
|
// const tx = isPool
|
||||||
? await ocean.pool
|
// ? await ocean.pool
|
||||||
.create(
|
// .create(
|
||||||
accountId,
|
// accountId,
|
||||||
dataToken,
|
// dataToken,
|
||||||
`${amountDataToken}`,
|
// `${amountDataToken}`,
|
||||||
weightOnDataToken,
|
// weightOnDataToken,
|
||||||
`${amountOcean}`,
|
// `${amountOcean}`,
|
||||||
`${swapFee}`
|
// `${swapFee}`
|
||||||
)
|
// )
|
||||||
.next((step: number) => setStep(step, 'pool', ddo))
|
// .next((step: number) => setStep(step, 'pool', ddo))
|
||||||
: type === 'fixed'
|
// : type === 'fixed'
|
||||||
? await ocean.fixedRateExchange
|
// ? await ocean.fixedRateExchange
|
||||||
.create(dataToken, `${price}`, accountId, `${amountDataToken}`)
|
// .create(dataToken, `${price}`, accountId, `${amountDataToken}`)
|
||||||
.next((step: number) => setStep(step, 'exchange', ddo))
|
// .next((step: number) => setStep(step, 'exchange', ddo))
|
||||||
: await ocean.OceanDispenser.makeMinter(dataToken, accountId).next(
|
// : await ocean.OceanDispenser.makeMinter(dataToken, accountId).next(
|
||||||
(step: number) => setStep(step, 'free', ddo)
|
// (step: number) => setStep(step, 'free', ddo)
|
||||||
)
|
// )
|
||||||
await sleep(20000)
|
// we should remove this sleep , why do we have sleep for 20 seconds !?!?!?!?!?!?!!?
|
||||||
return tx
|
// await sleep(20000)
|
||||||
|
// return tx
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setPricingError(error.message)
|
setPricingError(error.message)
|
||||||
Logger.error(error)
|
LoggerInstance.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setPricingStep(0)
|
setPricingStep(0)
|
||||||
setPricingStepText(undefined)
|
setPricingStepText(undefined)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { AssetSelectionAsset } from '@shared/FormFields/AssetSelection'
|
import { AssetSelectionAsset } from '@shared/FormFields/AssetSelection'
|
||||||
import { PriceList, getAssetsPriceList } from './subgraph'
|
import { PriceList, getAssetsPriceList } from './subgraph'
|
||||||
import axios, { CancelToken, AxiosResponse } from 'axios'
|
import axios, { CancelToken, AxiosResponse } from 'axios'
|
||||||
@ -99,9 +99,9 @@ export async function queryMetadata(
|
|||||||
return transformQueryResult(response.data, query.from, query.size)
|
return transformQueryResult(response.data, query.from, query.size)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isCancel(error)) {
|
if (axios.isCancel(error)) {
|
||||||
Logger.log(error.message)
|
LoggerInstance.log(error.message)
|
||||||
} else {
|
} else {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,9 +121,9 @@ export async function retrieveDDO(
|
|||||||
return data
|
return data
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isCancel(error)) {
|
if (axios.isCancel(error)) {
|
||||||
Logger.log(error.message)
|
LoggerInstance.log(error.message)
|
||||||
} else {
|
} else {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,9 +142,9 @@ export async function getAssetsNames(
|
|||||||
return response.data
|
return response.data
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isCancel(error)) {
|
if (axios.isCancel(error)) {
|
||||||
Logger.log(error.message)
|
LoggerInstance.log(error.message)
|
||||||
} else {
|
} else {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ export async function getAssetsFromDidList(
|
|||||||
const queryResult = await queryMetadata(query, cancelToken)
|
const queryResult = await queryMetadata(query, cancelToken)
|
||||||
return queryResult
|
return queryResult
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ export async function retrieveDDOListByDIDs(
|
|||||||
})
|
})
|
||||||
return orderedDDOListByDIDList
|
return orderedDDOListByDIDList
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,9 +318,9 @@ export async function getPublishedAssets(
|
|||||||
return result
|
return result
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isCancel(error)) {
|
if (axios.isCancel(error)) {
|
||||||
Logger.log(error.message)
|
LoggerInstance.log(error.message)
|
||||||
} else {
|
} else {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,6 +361,6 @@ export async function getDownloadAssets(
|
|||||||
|
|
||||||
return downloadedAssets
|
return downloadedAssets
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
import { Ocean } from '@oceanprotocol/lib'
|
|
||||||
import { getServiceByName } from './ddo'
|
|
||||||
|
|
||||||
export default async function checkPreviousOrder(
|
|
||||||
ocean: Ocean,
|
|
||||||
accountId: string,
|
|
||||||
ddo: Asset,
|
|
||||||
serviceType: 'access' | 'compute'
|
|
||||||
): Promise<string> {
|
|
||||||
if (!ocean) return
|
|
||||||
|
|
||||||
const service = getServiceByName(ddo, serviceType)
|
|
||||||
// apparenlty cost and timeout are not found, even though they are there...
|
|
||||||
// const previousOrder = await ocean.datatokens.getPreviousValidOrders(
|
|
||||||
// ddo?.services[0].datatokenAddress,
|
|
||||||
// service.cost,
|
|
||||||
// service.index,
|
|
||||||
// service.timeout,
|
|
||||||
// accountId
|
|
||||||
// )
|
|
||||||
// return previousOrder
|
|
||||||
return 'dummy'
|
|
||||||
}
|
|
@ -1,15 +1,14 @@
|
|||||||
import {
|
// import {
|
||||||
ServiceComputePrivacy,
|
// ServiceComputePrivacy,
|
||||||
publisherTrustedAlgorithm as PublisherTrustedAlgorithm,
|
// publisherTrustedAlgorithm as PublisherTrustedAlgorithm,
|
||||||
Service,
|
// Service,
|
||||||
Logger,
|
// LoggerInstance,
|
||||||
Provider,
|
// Provider,
|
||||||
Config,
|
// Config,
|
||||||
Ocean,
|
// Ocean,
|
||||||
Account
|
// Account
|
||||||
} from '@oceanprotocol/lib'
|
// } from '@oceanprotocol/lib'
|
||||||
import web3 from 'web3'
|
// import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/Compute'
|
||||||
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/Compute'
|
|
||||||
import { CancelToken } from 'axios'
|
import { CancelToken } from 'axios'
|
||||||
import { gql } from 'urql'
|
import { gql } from 'urql'
|
||||||
import { queryMetadata, getFilterTerm, generateBaseQuery } from './aquarius'
|
import { queryMetadata, getFilterTerm, generateBaseQuery } from './aquarius'
|
||||||
@ -98,7 +97,7 @@ function getServiceEndpoints(data: TokenOrder[], assets: Asset[]): string[] {
|
|||||||
// if (wasProviderQueried) continue
|
// if (wasProviderQueried) continue
|
||||||
// serviceEndpoints.push(providerEndpoint)
|
// serviceEndpoints.push(providerEndpoint)
|
||||||
// } catch (err) {
|
// } catch (err) {
|
||||||
// Logger.error(err.message)
|
// LoggerInstance.error(err.message)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -107,190 +106,190 @@ function getServiceEndpoints(data: TokenOrder[], assets: Asset[]): string[] {
|
|||||||
return ['dummy']
|
return ['dummy']
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getProviders(
|
// async function getProviders(
|
||||||
serviceEndpoints: string[],
|
// serviceEndpoints: string[],
|
||||||
config: Config,
|
// config: Config,
|
||||||
ocean: Ocean
|
// ocean: Ocean
|
||||||
): Promise<Provider[]> {
|
// ): Promise<Provider[]> {
|
||||||
const providers: Provider[] = []
|
// const providers: Provider[] = []
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
for (let i = 0; i < serviceEndpoints?.length; i++) {
|
// for (let i = 0; i < serviceEndpoints?.length; i++) {
|
||||||
const instanceConfig = {
|
// const instanceConfig = {
|
||||||
config,
|
// config,
|
||||||
web3: config.web3Provider,
|
// web3: config.web3Provider,
|
||||||
logger: Logger,
|
// logger: LoggerInstance,
|
||||||
ocean
|
// ocean
|
||||||
}
|
// }
|
||||||
const provider = await Provider.getInstance(instanceConfig)
|
// const provider = await Provider.getInstance(instanceConfig)
|
||||||
await provider.setBaseUrl(serviceEndpoints[i])
|
// await provider.setBaseUrl(serviceEndpoints[i])
|
||||||
const hasSameCompute =
|
// const hasSameCompute =
|
||||||
providers.filter((x) => x.computeAddress === provider.computeAddress)
|
// providers.filter((x) => x.computeAddress === provider.computeAddress)
|
||||||
.length > 0
|
// .length > 0
|
||||||
if (!hasSameCompute) providers.push(provider)
|
// if (!hasSameCompute) providers.push(provider)
|
||||||
}
|
// }
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
Logger.error(err.message)
|
// LoggerInstance.error(err.message)
|
||||||
}
|
// }
|
||||||
|
|
||||||
return providers
|
// return providers
|
||||||
}
|
// }
|
||||||
|
|
||||||
async function getJobs(
|
// async function getJobs(
|
||||||
providers: Provider[],
|
// providers: Provider[],
|
||||||
account: Account,
|
// account: Account,
|
||||||
assets: Asset[]
|
// assets: Asset[]
|
||||||
): Promise<ComputeJobMetaData[]> {
|
// ): Promise<ComputeJobMetaData[]> {
|
||||||
const computeJobs: ComputeJobMetaData[] = []
|
// const computeJobs: ComputeJobMetaData[] = []
|
||||||
|
|
||||||
for (let i = 0; i < providers.length; i++) {
|
// for (let i = 0; i < providers.length; i++) {
|
||||||
try {
|
// try {
|
||||||
const providerComputeJobs = (await providers[i].computeStatus(
|
// const providerComputeJobs = (await providers[i].computeStatus(
|
||||||
'',
|
// '',
|
||||||
account,
|
// account,
|
||||||
undefined,
|
// undefined,
|
||||||
undefined,
|
// undefined,
|
||||||
false
|
// false
|
||||||
)) as ComputeJob[]
|
// )) as ComputeJob[]
|
||||||
|
|
||||||
// means the provider uri is not good, so we ignore it and move on
|
// // means the provider uri is not good, so we ignore it and move on
|
||||||
if (!providerComputeJobs) continue
|
// if (!providerComputeJobs) continue
|
||||||
providerComputeJobs.sort((a, b) => {
|
// providerComputeJobs.sort((a, b) => {
|
||||||
if (a.dateCreated > b.dateCreated) {
|
// if (a.dateCreated > b.dateCreated) {
|
||||||
return -1
|
// return -1
|
||||||
}
|
// }
|
||||||
if (a.dateCreated < b.dateCreated) {
|
// if (a.dateCreated < b.dateCreated) {
|
||||||
return 1
|
// return 1
|
||||||
}
|
// }
|
||||||
return 0
|
// return 0
|
||||||
})
|
// })
|
||||||
|
|
||||||
for (let j = 0; j < providerComputeJobs?.length; j++) {
|
// for (let j = 0; j < providerComputeJobs?.length; j++) {
|
||||||
const job = providerComputeJobs[j]
|
// const job = providerComputeJobs[j]
|
||||||
const did = job.inputDID[0]
|
// const did = job.inputDID[0]
|
||||||
const ddo = assets.filter((x) => x.id === did)[0]
|
// const ddo = assets.filter((x) => x.id === did)[0]
|
||||||
|
|
||||||
if (!ddo) continue
|
// if (!ddo) continue
|
||||||
|
|
||||||
const compJob: ComputeJobMetaData = {
|
// const compJob: ComputeJobMetaData = {
|
||||||
...job,
|
// ...job,
|
||||||
assetName: ddo.metadata.name,
|
// assetName: ddo.metadata.name,
|
||||||
assetDtSymbol: ddo.dataTokenInfo.symbol,
|
// assetDtSymbol: ddo.dataTokenInfo.symbol,
|
||||||
networkId: ddo.chainId
|
// networkId: ddo.chainId
|
||||||
}
|
// }
|
||||||
computeJobs.push(compJob)
|
// computeJobs.push(compJob)
|
||||||
}
|
// }
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
Logger.error(err.message)
|
// LoggerInstance.error(err.message)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return computeJobs
|
// return computeJobs
|
||||||
}
|
// }
|
||||||
|
|
||||||
function getDtList(data: TokenOrder[]): string[] {
|
// function getDtList(data: TokenOrder[]): string[] {
|
||||||
const dtList = []
|
// const dtList = []
|
||||||
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
// for (let i = 0; i < data.length; i++) {
|
||||||
dtList.push(data[i].datatokenId.address)
|
// dtList.push(data[i].datatokenId.address)
|
||||||
}
|
// }
|
||||||
|
|
||||||
return dtList
|
// return dtList
|
||||||
}
|
// }
|
||||||
|
|
||||||
export async function getComputeJobs(
|
// export async function getComputeJobs(
|
||||||
chainIds: number[],
|
// chainIds: number[],
|
||||||
config: Config,
|
// config: Config,
|
||||||
ocean: Ocean,
|
// ocean: Ocean,
|
||||||
account: Account,
|
// account: Account,
|
||||||
ddo?: Asset,
|
// ddo?: Asset,
|
||||||
token?: CancelToken
|
// token?: CancelToken
|
||||||
): Promise<ComputeResults> {
|
// ): Promise<ComputeResults> {
|
||||||
const assetDTAddress = ddo?.dataTokenInfo?.address
|
// const assetDTAddress = ddo?.dataTokenInfo?.address
|
||||||
let computeResult: ComputeResults = {
|
// let computeResult: ComputeResults = {
|
||||||
computeJobs: [],
|
// computeJobs: [],
|
||||||
isLoaded: false
|
// isLoaded: false
|
||||||
}
|
// }
|
||||||
let isLoading = true
|
// let isLoading = true
|
||||||
const variables = assetDTAddress
|
// const variables = assetDTAddress
|
||||||
? {
|
// ? {
|
||||||
user: account?.getId().toLowerCase(),
|
// user: account?.getId().toLowerCase(),
|
||||||
datatokenAddress: assetDTAddress.toLowerCase()
|
// datatokenAddress: assetDTAddress.toLowerCase()
|
||||||
}
|
// }
|
||||||
: {
|
// : {
|
||||||
user: account?.getId().toLowerCase()
|
// user: account?.getId().toLowerCase()
|
||||||
}
|
// }
|
||||||
|
|
||||||
const result = await fetchDataForMultipleChains(
|
// const result = await fetchDataForMultipleChains(
|
||||||
assetDTAddress ? getComputeOrdersByDatatokenAddress : getComputeOrders,
|
// assetDTAddress ? getComputeOrdersByDatatokenAddress : getComputeOrders,
|
||||||
variables,
|
// variables,
|
||||||
assetDTAddress ? [ddo?.chainId] : chainIds
|
// assetDTAddress ? [ddo?.chainId] : chainIds
|
||||||
)
|
// )
|
||||||
let data: TokenOrder[] = []
|
// let data: TokenOrder[] = []
|
||||||
for (let i = 0; i < result.length; i++) {
|
// for (let i = 0; i < result.length; i++) {
|
||||||
if (!result[i]?.tokenOrders || result[i].tokenOrders.length === 0) continue
|
// if (!result[i]?.tokenOrders || result[i].tokenOrders.length === 0) continue
|
||||||
result[i]?.tokenOrders.forEach((tokenOrder: TokenOrder) => {
|
// result[i]?.tokenOrders.forEach((tokenOrder: TokenOrder) => {
|
||||||
data.push(tokenOrder)
|
// data.push(tokenOrder)
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
if (!ocean || !account || !data) return
|
// if (!ocean || !account || !data) return
|
||||||
|
|
||||||
if (data.length === 0) {
|
// if (data.length === 0) {
|
||||||
return computeResult
|
// return computeResult
|
||||||
}
|
// }
|
||||||
|
|
||||||
data = data.sort((a, b) => b.timestamp - a.timestamp)
|
// data = data.sort((a, b) => b.timestamp - a.timestamp)
|
||||||
const queryDtList = getDtList(data)
|
// const queryDtList = getDtList(data)
|
||||||
if (!queryDtList) return
|
// if (!queryDtList) return
|
||||||
|
|
||||||
const assets = await getAssetMetadata(queryDtList, token, chainIds)
|
// const assets = await getAssetMetadata(queryDtList, token, chainIds)
|
||||||
const serviceEndpoints = getServiceEndpoints(data, assets)
|
// const serviceEndpoints = getServiceEndpoints(data, assets)
|
||||||
const providers: Provider[] = await getProviders(
|
// const providers: Provider[] = await getProviders(
|
||||||
serviceEndpoints,
|
// serviceEndpoints,
|
||||||
config,
|
// config,
|
||||||
ocean
|
// ocean
|
||||||
)
|
// )
|
||||||
const computeJobs = await getJobs(providers, account, assets)
|
// const computeJobs = await getJobs(providers, account, assets)
|
||||||
isLoading = false
|
// isLoading = false
|
||||||
computeResult = {
|
// computeResult = {
|
||||||
computeJobs: computeJobs,
|
// computeJobs: computeJobs,
|
||||||
isLoaded: isLoading
|
// isLoaded: isLoading
|
||||||
}
|
// }
|
||||||
|
|
||||||
return computeResult
|
// return computeResult
|
||||||
}
|
// }
|
||||||
|
|
||||||
export async function createTrustedAlgorithmList(
|
// export async function createTrustedAlgorithmList(
|
||||||
selectedAlgorithms: string[], // list of DIDs
|
// selectedAlgorithms: string[], // list of DIDs
|
||||||
ocean: Ocean
|
// ocean: Ocean
|
||||||
): Promise<PublisherTrustedAlgorithm[]> {
|
// ): Promise<PublisherTrustedAlgorithm[]> {
|
||||||
const trustedAlgorithms = []
|
// const trustedAlgorithms = []
|
||||||
|
|
||||||
for (const selectedAlgorithm of selectedAlgorithms) {
|
// for (const selectedAlgorithm of selectedAlgorithms) {
|
||||||
const trustedAlgorithm =
|
// const trustedAlgorithm =
|
||||||
await ocean.compute.createPublisherTrustedAlgorithmfromDID(
|
// await ocean.compute.createPublisherTrustedAlgorithmfromDID(
|
||||||
selectedAlgorithm
|
// selectedAlgorithm
|
||||||
)
|
// )
|
||||||
trustedAlgorithms.push(trustedAlgorithm)
|
// trustedAlgorithms.push(trustedAlgorithm)
|
||||||
}
|
// }
|
||||||
return trustedAlgorithms
|
// return trustedAlgorithms
|
||||||
}
|
// }
|
||||||
|
|
||||||
export async function transformComputeFormToServiceComputePrivacy(
|
// export async function transformComputeFormToServiceComputePrivacy(
|
||||||
values: ComputePrivacyForm,
|
// values: ComputePrivacyForm,
|
||||||
ocean: Ocean
|
// ocean: Ocean
|
||||||
): Promise<ServiceComputePrivacy> {
|
// ): Promise<ServiceComputePrivacy> {
|
||||||
const { allowAllPublishedAlgorithms } = values
|
// const { allowAllPublishedAlgorithms } = values
|
||||||
const publisherTrustedAlgorithms = values.allowAllPublishedAlgorithms
|
// const publisherTrustedAlgorithms = values.allowAllPublishedAlgorithms
|
||||||
? []
|
// ? []
|
||||||
: await createTrustedAlgorithmList(values.publisherTrustedAlgorithms, ocean)
|
// : await createTrustedAlgorithmList(values.publisherTrustedAlgorithms, ocean)
|
||||||
|
|
||||||
const privacy: ServiceComputePrivacy = {
|
// const privacy: ServiceComputePrivacy = {
|
||||||
allowNetworkAccess: false,
|
// allowNetworkAccess: false,
|
||||||
allowRawAlgorithm: false,
|
// allowRawAlgorithm: false,
|
||||||
allowAllPublishedAlgorithms,
|
// allowAllPublishedAlgorithms,
|
||||||
publisherTrustedAlgorithms
|
// publisherTrustedAlgorithms
|
||||||
}
|
// }
|
||||||
|
|
||||||
return privacy
|
// return privacy
|
||||||
}
|
// }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import isUrl from 'is-url-superb'
|
import isUrl from 'is-url-superb'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
@ -25,7 +25,7 @@ async function isDockerHubImageValid(
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
toast.error(
|
toast.error(
|
||||||
'Could not fetch docker hub image info. Please check image name and tag and try again'
|
'Could not fetch docker hub image info. Please check image name and tag and try again'
|
||||||
)
|
)
|
||||||
@ -44,7 +44,7 @@ async function is3rdPartyImageValid(imageURL: string): Promise<boolean> {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
toast.error(
|
toast.error(
|
||||||
'Could not fetch docker image info. Please check URL and try again'
|
'Could not fetch docker image info. Please check URL and try again'
|
||||||
)
|
)
|
||||||
|
@ -1,41 +1,41 @@
|
|||||||
import { Logger, Ocean } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { TransactionReceipt } from 'web3-core'
|
import { TransactionReceipt } from 'web3-core'
|
||||||
|
|
||||||
export async function setMinterToPublisher(
|
export async function setMinterToPublisher(
|
||||||
ocean: Ocean,
|
|
||||||
dataTokenAddress: string,
|
dataTokenAddress: string,
|
||||||
accountId: string,
|
accountId: string,
|
||||||
setError: (msg: string) => void
|
setError: (msg: string) => void
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
// free pricing v3 workaround part1
|
// free pricing v3 workaround part1
|
||||||
const status = await ocean.OceanDispenser.status(dataTokenAddress)
|
// const status = await ocean.OceanDispenser.status(dataTokenAddress)
|
||||||
if (!status?.minterApproved) return
|
// if (!status?.minterApproved) return
|
||||||
|
// const response = await ocean.OceanDispenser.cancelMinter(
|
||||||
const response = await ocean.OceanDispenser.cancelMinter(
|
// dataTokenAddress,
|
||||||
dataTokenAddress,
|
// accountId
|
||||||
accountId
|
// )
|
||||||
)
|
// if (!response) {
|
||||||
if (!response) {
|
// setError('Updating DDO failed.')
|
||||||
setError('Updating DDO failed.')
|
// LoggerInstance.error('Failed at cancelMinter')
|
||||||
Logger.error('Failed at cancelMinter')
|
// }
|
||||||
}
|
// return response
|
||||||
return response
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setMinterToDispenser(
|
export async function setMinterToDispenser(
|
||||||
ocean: Ocean,
|
|
||||||
dataTokenAddress: string,
|
dataTokenAddress: string,
|
||||||
accountId: string,
|
accountId: string,
|
||||||
setError: (msg: string) => void
|
setError: (msg: string) => void
|
||||||
): Promise<TransactionReceipt> {
|
): Promise<TransactionReceipt> {
|
||||||
// free pricing v3 workaround part2
|
// free pricing v3 workaround part2
|
||||||
const response = await ocean.OceanDispenser.makeMinter(
|
// const response = await ocean.OceanDispenser.makeMinter(
|
||||||
dataTokenAddress,
|
// dataTokenAddress,
|
||||||
accountId
|
// accountId
|
||||||
)
|
// )
|
||||||
if (!response) {
|
// if (!response) {
|
||||||
setError('Updating DDO failed.')
|
// setError('Updating DDO failed.')
|
||||||
Logger.error('Failed at makeMinter')
|
// LoggerInstance.error('Failed at makeMinter')
|
||||||
}
|
// }
|
||||||
return response
|
// return response
|
||||||
|
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { ConfigHelper, ConfigHelperConfig, Logger } from '@oceanprotocol/lib'
|
import { ConfigHelper, LoggerInstance, Config } from '@oceanprotocol/lib'
|
||||||
import contractAddresses from '@oceanprotocol/contracts/artifacts/address.json'
|
// import contractAddresses from '@oceanprotocol/contracts/artifacts/address.json'
|
||||||
import { AbiItem } from 'web3-utils/types'
|
import { AbiItem } from 'web3-utils/types'
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
|
|
||||||
export function getOceanConfig(network: string | number): ConfigHelperConfig {
|
export function getOceanConfig(network: string | number): Config {
|
||||||
const config = new ConfigHelper().getConfig(
|
const config = new ConfigHelper().getConfig(
|
||||||
network,
|
network,
|
||||||
network === 'polygon' ||
|
network === 'polygon' ||
|
||||||
@ -15,20 +15,20 @@ export function getOceanConfig(network: string | number): ConfigHelperConfig {
|
|||||||
network === 2021000
|
network === 2021000
|
||||||
? undefined
|
? undefined
|
||||||
: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID
|
: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID
|
||||||
) as ConfigHelperConfig
|
) as Config
|
||||||
return config as ConfigHelperConfig
|
return config as Config
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDevelopmentConfig(): Partial<ConfigHelperConfig> {
|
export function getDevelopmentConfig(): Config {
|
||||||
return {
|
return {
|
||||||
factoryAddress: contractAddresses.development?.DTFactory,
|
// factoryAddress: contractAddresses.development?.DTFactory,
|
||||||
poolFactoryAddress: contractAddresses.development?.BFactory,
|
// poolFactoryAddress: contractAddresses.development?.BFactory,
|
||||||
fixedRateExchangeAddress: contractAddresses.development?.FixedRateExchange,
|
// fixedRateExchangeAddress: contractAddresses.development?.FixedRateExchange,
|
||||||
metadataContractAddress: contractAddresses.development?.Metadata,
|
// metadataContractAddress: contractAddresses.development?.Metadata,
|
||||||
oceanTokenAddress: contractAddresses.development?.Ocean,
|
// oceanTokenAddress: contractAddresses.development?.Ocean,
|
||||||
// There is no subgraph in barge so we hardcode the Rinkeby one for now
|
// There is no subgraph in barge so we hardcode the Rinkeby one for now
|
||||||
subgraphUri: 'https://subgraph.rinkeby.oceanprotocol.com'
|
subgraphUri: 'https://subgraph.rinkeby.oceanprotocol.com'
|
||||||
}
|
} as Config
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getOceanBalance(
|
export async function getOceanBalance(
|
||||||
@ -69,6 +69,6 @@ export async function getOceanBalance(
|
|||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.error(`ERROR: Failed to get the balance: ${e.message}`)
|
LoggerInstance.error(`ERROR: Failed to get the balance: ${e.message}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ export default async function get3BoxProfile(
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
// Logger.log(`3Box profile found for ${accountId}`, response.data)
|
// LoggerInstance.log(`3Box profile found for ${accountId}`, response.data)
|
||||||
const profile = transformResponse(response.data)
|
const profile = transformResponse(response.data)
|
||||||
return profile
|
return profile
|
||||||
// eslint-disable-next-line no-empty
|
// eslint-disable-next-line no-empty
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import axios, { CancelToken, AxiosResponse } from 'axios'
|
import axios, { CancelToken, AxiosResponse } from 'axios'
|
||||||
import { DID, Logger } from '@oceanprotocol/lib'
|
import { DID, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export interface FileMetadata {
|
export interface FileMetadata {
|
||||||
index: number
|
index: number
|
||||||
@ -50,9 +50,9 @@ export async function getFileInfo(
|
|||||||
return response.data
|
return response.data
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isCancel(error)) {
|
if (axios.isCancel(error)) {
|
||||||
Logger.log(error.message)
|
LoggerInstance.log(error.message)
|
||||||
} else {
|
} else {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { gql, OperationResult, TypedDocumentNode, OperationContext } from 'urql'
|
import { gql, OperationResult, TypedDocumentNode, OperationContext } from 'urql'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { getUrqlClientInstance } from '@context/UrqlProvider'
|
import { getUrqlClientInstance } from '@context/UrqlProvider'
|
||||||
import { getOceanConfig } from './ocean'
|
import { getOceanConfig } from './ocean'
|
||||||
import {
|
import {
|
||||||
@ -702,7 +702,7 @@ export async function getUserTokenOrders(
|
|||||||
|
|
||||||
return data
|
return data
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ export async function getUserSales(
|
|||||||
}
|
}
|
||||||
return salesSum
|
return salesSum
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.log(error.message)
|
LoggerInstance.log(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { getNetworkDisplayName } from '@hooks/useNetworkMetadata'
|
import { getNetworkDisplayName } from '@hooks/useNetworkMetadata'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { getOceanConfig } from './ocean'
|
import { getOceanConfig } from './ocean'
|
||||||
|
|
||||||
export function accountTruncate(account: string): string {
|
export function accountTruncate(account: string): string {
|
||||||
@ -41,25 +41,27 @@ export async function addCustomNetwork(
|
|||||||
},
|
},
|
||||||
(err: string, added: any) => {
|
(err: string, added: any) => {
|
||||||
if (err || 'error' in added) {
|
if (err || 'error' in added) {
|
||||||
Logger.error(
|
LoggerInstance.error(
|
||||||
`Couldn't add ${network.name} (0x${
|
`Couldn't add ${network.name} (0x${
|
||||||
network.chainId
|
network.chainId
|
||||||
}) network to MetaMask, error: ${err || added.error}`
|
}) network to MetaMask, error: ${err || added.error}`
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Logger.log(
|
LoggerInstance.log(
|
||||||
`Added ${network.name} (0x${network.chainId}) network to MetaMask`
|
`Added ${network.name} (0x${network.chainId}) network to MetaMask`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Logger.error(
|
LoggerInstance.error(
|
||||||
`Couldn't add ${network.name} (0x${network.chainId}) network to MetaMask, error: ${switchError}`
|
`Couldn't add ${network.name} (0x${network.chainId}) network to MetaMask, error: ${switchError}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Logger.log(`Added ${network.name} (0x${network.chainId}) network to MetaMask`)
|
LoggerInstance.log(
|
||||||
|
`Added ${network.name} (0x${network.chainId}) network to MetaMask`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addTokenToWallet(
|
export async function addTokenToWallet(
|
||||||
@ -85,13 +87,13 @@ export async function addTokenToWallet(
|
|||||||
},
|
},
|
||||||
(err: { code: number; message: string }, added: any) => {
|
(err: { code: number; message: string }, added: any) => {
|
||||||
if (err || 'error' in added) {
|
if (err || 'error' in added) {
|
||||||
Logger.error(
|
LoggerInstance.error(
|
||||||
`Couldn't add ${tokenMetadata.options.symbol} (${
|
`Couldn't add ${tokenMetadata.options.symbol} (${
|
||||||
tokenMetadata.options.address
|
tokenMetadata.options.address
|
||||||
}) to MetaMask, error: ${err.message || added.error}`
|
}) to MetaMask, error: ${err.message || added.error}`
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Logger.log(
|
LoggerInstance.log(
|
||||||
`Added ${tokenMetadata.options.symbol} (${tokenMetadata.options.address}) to MetaMask`
|
`Added ${tokenMetadata.options.symbol} (${tokenMetadata.options.address}) to MetaMask`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import { FormikProps, connect } from 'formik'
|
|||||||
import debounce from 'lodash.debounce'
|
import debounce from 'lodash.debounce'
|
||||||
import omit from 'lodash.omit'
|
import omit from 'lodash.omit'
|
||||||
import isEqual from 'react-fast-compare'
|
import isEqual from 'react-fast-compare'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export interface PersistProps {
|
export interface PersistProps {
|
||||||
name: string
|
name: string
|
||||||
@ -23,7 +23,7 @@ class PersistImpl extends React.Component<
|
|||||||
|
|
||||||
saveForm = debounce((data: FormikProps<any>) => {
|
saveForm = debounce((data: FormikProps<any>) => {
|
||||||
const dataToSave = this.omitIgnoredFields(data)
|
const dataToSave = this.omitIgnoredFields(data)
|
||||||
Logger.log('data to save', dataToSave)
|
LoggerInstance.log('data to save', dataToSave)
|
||||||
if (this.props.isSessionStorage) {
|
if (this.props.isSessionStorage) {
|
||||||
window.sessionStorage.setItem(this.props.name, JSON.stringify(dataToSave))
|
window.sessionStorage.setItem(this.props.name, JSON.stringify(dataToSave))
|
||||||
} else {
|
} else {
|
||||||
@ -33,10 +33,10 @@ class PersistImpl extends React.Component<
|
|||||||
|
|
||||||
omitIgnoredFields = (data: FormikProps<any>) => {
|
omitIgnoredFields = (data: FormikProps<any>) => {
|
||||||
const { ignoreFields } = this.props
|
const { ignoreFields } = this.props
|
||||||
Logger.log('omitted fields', ignoreFields)
|
LoggerInstance.log('omitted fields', ignoreFields)
|
||||||
const { values, touched, errors } = data
|
const { values, touched, errors } = data
|
||||||
|
|
||||||
Logger.log('values', values, omit(values, ignoreFields))
|
LoggerInstance.log('values', values, omit(values, ignoreFields))
|
||||||
return ignoreFields
|
return ignoreFields
|
||||||
? omit(
|
? omit(
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ import { retrieveDDOListByDIDs } from '@utils/aquarius'
|
|||||||
import { CancelToken } from 'axios'
|
import { CancelToken } from 'axios'
|
||||||
import Title from './Title'
|
import Title from './Title'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useCancelToken } from '@hooks/useCancelToken'
|
import { useCancelToken } from '@hooks/useCancelToken'
|
||||||
|
|
||||||
const REFETCH_INTERVAL = 20000
|
const REFETCH_INTERVAL = 20000
|
||||||
@ -217,7 +217,10 @@ export default function PoolTransactions({
|
|||||||
}, REFETCH_INTERVAL)
|
}, REFETCH_INTERVAL)
|
||||||
setDataFetchInterval(interval)
|
setDataFetchInterval(interval)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Error fetching pool transactions: ', error.message)
|
LoggerInstance.error(
|
||||||
|
'Error fetching pool transactions: ',
|
||||||
|
error.message
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getTransactions()
|
getTransactions()
|
||||||
@ -237,7 +240,10 @@ export default function PoolTransactions({
|
|||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
await getPoolTransactions(cancelToken())
|
await getPoolTransactions(cancelToken())
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Error fetching pool transactions: ', error.message)
|
LoggerInstance.error(
|
||||||
|
'Error fetching pool transactions: ',
|
||||||
|
error.message
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
transformData()
|
transformData()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, ReactElement, useEffect, useCallback } from 'react'
|
import React, { useState, ReactElement, useEffect, useCallback } from 'react'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import Price from '@shared/Price'
|
import Price from '@shared/Price'
|
||||||
import FileIcon from '@shared/FileIcon'
|
import FileIcon from '@shared/FileIcon'
|
||||||
@ -264,13 +264,13 @@ export default function Compute({
|
|||||||
// computeService.index,
|
// computeService.index,
|
||||||
// computeAlgorithm
|
// computeAlgorithm
|
||||||
// )
|
// )
|
||||||
// Logger.log('[compute] Is data set orderable?', allowed)
|
// LoggerInstance.log('[compute] Is data set orderable?', allowed)
|
||||||
|
|
||||||
// if (!allowed) {
|
// if (!allowed) {
|
||||||
// setError(
|
// setError(
|
||||||
// 'Data set is not orderable in combination with selected algorithm.'
|
// 'Data set is not orderable in combination with selected algorithm.'
|
||||||
// )
|
// )
|
||||||
// Logger.error(
|
// LoggerInstance.error(
|
||||||
// '[compute] Error starting compute job. Dataset is not orderable in combination with selected algorithm.'
|
// '[compute] Error starting compute job. Dataset is not orderable in combination with selected algorithm.'
|
||||||
// )
|
// )
|
||||||
// return
|
// return
|
||||||
@ -280,7 +280,7 @@ export default function Compute({
|
|||||||
// const tx = await buyDT('1', price, ddo)
|
// const tx = await buyDT('1', price, ddo)
|
||||||
// if (!tx) {
|
// if (!tx) {
|
||||||
// setError('Error buying datatoken.')
|
// setError('Error buying datatoken.')
|
||||||
// Logger.error('[compute] Error buying datatoken for data set ', ddo.id)
|
// LoggerInstance.error('[compute] Error buying datatoken for data set ', ddo.id)
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
@ -289,7 +289,7 @@ export default function Compute({
|
|||||||
// const tx = await buyDT('1', algorithmPrice, selectedAlgorithmAsset)
|
// const tx = await buyDT('1', algorithmPrice, selectedAlgorithmAsset)
|
||||||
// if (!tx) {
|
// if (!tx) {
|
||||||
// setError('Error buying datatoken.')
|
// setError('Error buying datatoken.')
|
||||||
// Logger.error(
|
// LoggerInstance.error(
|
||||||
// '[compute] Error buying datatoken for algorithm ',
|
// '[compute] Error buying datatoken for algorithm ',
|
||||||
// selectedAlgorithmAsset.id
|
// selectedAlgorithmAsset.id
|
||||||
// )
|
// )
|
||||||
@ -318,7 +318,7 @@ export default function Compute({
|
|||||||
// )
|
// )
|
||||||
|
|
||||||
// assetOrderId &&
|
// assetOrderId &&
|
||||||
// Logger.log(
|
// LoggerInstance.log(
|
||||||
// `[compute] Got ${
|
// `[compute] Got ${
|
||||||
// hasPreviousDatasetOrder ? 'existing' : 'new'
|
// hasPreviousDatasetOrder ? 'existing' : 'new'
|
||||||
// } order ID for dataset: `,
|
// } order ID for dataset: `,
|
||||||
@ -339,7 +339,7 @@ export default function Compute({
|
|||||||
// )
|
// )
|
||||||
|
|
||||||
// algorithmAssetOrderId &&
|
// algorithmAssetOrderId &&
|
||||||
// Logger.log(
|
// LoggerInstance.log(
|
||||||
// `[compute] Got ${
|
// `[compute] Got ${
|
||||||
// hasPreviousAlgorithmOrder ? 'existing' : 'new'
|
// hasPreviousAlgorithmOrder ? 'existing' : 'new'
|
||||||
// } order ID for algorithm: `,
|
// } order ID for algorithm: `,
|
||||||
@ -352,7 +352,7 @@ export default function Compute({
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// computeAlgorithm.transferTxId = algorithmAssetOrderId
|
// computeAlgorithm.transferTxId = algorithmAssetOrderId
|
||||||
// Logger.log('[compute] Starting compute job.')
|
// LoggerInstance.log('[compute] Starting compute job.')
|
||||||
|
|
||||||
// const output: ComputeOutput = {
|
// const output: ComputeOutput = {
|
||||||
// publishAlgorithmLog: true,
|
// publishAlgorithmLog: true,
|
||||||
@ -374,7 +374,7 @@ export default function Compute({
|
|||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Logger.log('[compute] Starting compute job response: ', response)
|
// LoggerInstance.log('[compute] Starting compute job response: ', response)
|
||||||
|
|
||||||
// await checkPreviousOrders(selectedAlgorithmAsset)
|
// await checkPreviousOrders(selectedAlgorithmAsset)
|
||||||
// await checkPreviousOrders(ddo)
|
// await checkPreviousOrders(ddo)
|
||||||
@ -383,7 +383,7 @@ export default function Compute({
|
|||||||
// await checkPreviousOrders(selectedAlgorithmAsset)
|
// await checkPreviousOrders(selectedAlgorithmAsset)
|
||||||
// await checkPreviousOrders(ddo)
|
// await checkPreviousOrders(ddo)
|
||||||
// setError('Failed to start job!')
|
// setError('Failed to start job!')
|
||||||
// Logger.error('[compute] Failed to start job: ', error.message)
|
// LoggerInstance.error('[compute] Failed to start job: ', error.message)
|
||||||
// } finally {
|
// } finally {
|
||||||
// setIsJobStarting(false)
|
// setIsJobStarting(false)
|
||||||
// }
|
// }
|
||||||
|
@ -14,7 +14,7 @@ import { useUserPreferences } from '@context/UserPreferences'
|
|||||||
import useDarkMode from 'use-dark-mode'
|
import useDarkMode from 'use-dark-mode'
|
||||||
import { darkModeConfig } from '../../../../../app.config'
|
import { darkModeConfig } from '../../../../../app.config'
|
||||||
import Button from '@shared/atoms/Button'
|
import Button from '@shared/atoms/Button'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useAsset } from '@context/Asset'
|
import { useAsset } from '@context/Asset'
|
||||||
import { gql, OperationResult } from 'urql'
|
import { gql, OperationResult } from 'urql'
|
||||||
import { PoolHistory } from '../../../../@types/apollo/PoolHistory'
|
import { PoolHistory } from '../../../../@types/apollo/PoolHistory'
|
||||||
@ -173,7 +173,7 @@ export default function Graph(): ReactElement {
|
|||||||
}, [graphFetchInterval])
|
}, [graphFetchInterval])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Logger.log('Fired GraphOptions!')
|
LoggerInstance.log('Fired GraphOptions!')
|
||||||
const options = getOptions(locale, darkMode.value)
|
const options = getOptions(locale, darkMode.value)
|
||||||
setOptions(options)
|
setOptions(options)
|
||||||
}, [locale, darkMode.value])
|
}, [locale, darkMode.value])
|
||||||
@ -189,7 +189,7 @@ export default function Graph(): ReactElement {
|
|||||||
await getPoolHistory()
|
await getPoolHistory()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Logger.log('Fired GraphData!')
|
LoggerInstance.log('Fired GraphData!')
|
||||||
|
|
||||||
const latestTimestamps = [
|
const latestTimestamps = [
|
||||||
...timestamps,
|
...timestamps,
|
||||||
|
@ -10,7 +10,7 @@ import styles from './Remove.module.css'
|
|||||||
import Header from './Header'
|
import Header from './Header'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import Actions from './Actions'
|
import Actions from './Actions'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import Token from './Token'
|
import Token from './Token'
|
||||||
import FormHelp from '@shared/FormInput/Help'
|
import FormHelp from '@shared/FormInput/Help'
|
||||||
import Button from '@shared/atoms/Button'
|
import Button from '@shared/atoms/Button'
|
||||||
@ -79,7 +79,7 @@ export default function Remove({
|
|||||||
setTxId(result?.transactionHash)
|
setTxId(result?.transactionHash)
|
||||||
refreshInfo()
|
refreshInfo()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
toast.error(error.message)
|
toast.error(error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { ReactElement, useEffect, useState } from 'react'
|
import React, { ReactElement, useEffect, useState } from 'react'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import stylesActions from './Actions.module.css'
|
import stylesActions from './Actions.module.css'
|
||||||
import PriceUnit from '@shared/Price/PriceUnit'
|
import PriceUnit from '@shared/Price/PriceUnit'
|
||||||
@ -334,7 +334,7 @@ export default function Pool(): ReactElement {
|
|||||||
|
|
||||||
setUserLiquidity(userLiquidity)
|
setUserLiquidity(userLiquidity)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init()
|
init()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { ReactElement, useState } from 'react'
|
import React, { ReactElement, useState } from 'react'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { Formik } from 'formik'
|
import { Formik } from 'formik'
|
||||||
import Actions from '../Pool/Actions'
|
import Actions from '../Pool/Actions'
|
||||||
@ -91,7 +91,7 @@ export default function FormTrade({
|
|||||||
)
|
)
|
||||||
setTxId(tx?.transactionHash)
|
setTxId(tx?.transactionHash)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
toast.error(error.message)
|
toast.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { ReactElement, useState, useEffect } from 'react'
|
import React, { ReactElement, useState, useEffect } from 'react'
|
||||||
import Compute from './Compute'
|
import Compute from './Compute'
|
||||||
import Consume from './Consume'
|
import Consume from './Consume'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import Tabs, { TabsItem } from '@shared/atoms/Tabs'
|
import Tabs, { TabsItem } from '@shared/atoms/Tabs'
|
||||||
import { compareAsBN } from '@utils/numbers'
|
import { compareAsBN } from '@utils/numbers'
|
||||||
import Pool from './Pool'
|
import Pool from './Pool'
|
||||||
@ -79,7 +79,7 @@ export default function AssetActions({
|
|||||||
fileInfoResponse && setFileMetadata(fileInfoResponse[0])
|
fileInfoResponse && setFileMetadata(fileInfoResponse[0])
|
||||||
setFileIsLoading(false)
|
setFileIsLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initFileInfo()
|
initFileInfo()
|
||||||
@ -96,7 +96,7 @@ export default function AssetActions({
|
|||||||
)
|
)
|
||||||
setDtBalance(dtBalance)
|
setDtBalance(dtBalance)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.error(e.message)
|
LoggerInstance.error(e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init()
|
init()
|
||||||
|
@ -4,7 +4,7 @@ import { Formik } from 'formik'
|
|||||||
import React, { ReactElement, useState } from 'react'
|
import React, { ReactElement, useState } from 'react'
|
||||||
import { useAsset } from '@context/Asset'
|
import { useAsset } from '@context/Asset'
|
||||||
import FormEditComputeDataset from './FormEditComputeDataset'
|
import FormEditComputeDataset from './FormEditComputeDataset'
|
||||||
import { Logger, ServiceComputePrivacy } from '@oceanprotocol/lib'
|
import { LoggerInstance, ServiceComputePrivacy } from '@oceanprotocol/lib'
|
||||||
import { useUserPreferences } from '@context/UserPreferences'
|
import { useUserPreferences } from '@context/UserPreferences'
|
||||||
import DebugEditCompute from './DebugEditCompute'
|
import DebugEditCompute from './DebugEditCompute'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
@ -53,7 +53,7 @@ export default function EditComputeDataset({
|
|||||||
// )
|
// )
|
||||||
// if (!ddoEditedComputePrivacy) {
|
// if (!ddoEditedComputePrivacy) {
|
||||||
// setError(content.form.error)
|
// setError(content.form.error)
|
||||||
// Logger.error(content.form.error)
|
// LoggerInstance.error(content.form.error)
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
// const storedddo = await ocean.assets.updateMetadata(
|
// const storedddo = await ocean.assets.updateMetadata(
|
||||||
@ -62,7 +62,7 @@ export default function EditComputeDataset({
|
|||||||
// )
|
// )
|
||||||
// if (!storedddo) {
|
// if (!storedddo) {
|
||||||
// setError(content.form.error)
|
// setError(content.form.error)
|
||||||
// Logger.error(content.form.error)
|
// LoggerInstance.error(content.form.error)
|
||||||
// return
|
// return
|
||||||
// } else {
|
// } else {
|
||||||
// if (price.type === 'free') {
|
// if (price.type === 'free') {
|
||||||
@ -79,7 +79,7 @@ export default function EditComputeDataset({
|
|||||||
// resetForm()
|
// resetForm()
|
||||||
// }
|
// }
|
||||||
// } catch (error) {
|
// } catch (error) {
|
||||||
// Logger.error(error.message)
|
// LoggerInstance.error(error.message)
|
||||||
// setError(error.message)
|
// setError(error.message)
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import Web3Feedback from '@shared/Web3Feedback'
|
|||||||
import FormEditMetadata from './FormEditMetadata'
|
import FormEditMetadata from './FormEditMetadata'
|
||||||
import { getServiceByName, mapTimeoutStringToSeconds } from '@utils/ddo'
|
import { getServiceByName, mapTimeoutStringToSeconds } from '@utils/ddo'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useWeb3 } from '@context/Web3'
|
import { useWeb3 } from '@context/Web3'
|
||||||
import { useOcean } from '@context/Ocean'
|
import { useOcean } from '@context/Ocean'
|
||||||
import { setMinterToDispenser, setMinterToPublisher } from '@utils/freePrice'
|
import { setMinterToDispenser, setMinterToPublisher } from '@utils/freePrice'
|
||||||
@ -41,7 +41,7 @@ export default function Edit({
|
|||||||
)
|
)
|
||||||
if (!setPriceResp) {
|
if (!setPriceResp) {
|
||||||
setError(content.form.error)
|
setError(content.form.error)
|
||||||
Logger.error(content.form.error)
|
LoggerInstance.error(content.form.error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ export default function Edit({
|
|||||||
// (await updateFixedPrice(values.price))
|
// (await updateFixedPrice(values.price))
|
||||||
// if (!ddoEditedMetdata) {
|
// if (!ddoEditedMetdata) {
|
||||||
// setError(content.form.error)
|
// setError(content.form.error)
|
||||||
// Logger.error(content.form.error)
|
// LoggerInstance.error(content.form.error)
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
// let ddoEditedTimeout = ddoEditedMetdata
|
// let ddoEditedTimeout = ddoEditedMetdata
|
||||||
@ -88,7 +88,7 @@ export default function Edit({
|
|||||||
// }
|
// }
|
||||||
// if (!ddoEditedTimeout) {
|
// if (!ddoEditedTimeout) {
|
||||||
// setError(content.form.error)
|
// setError(content.form.error)
|
||||||
// Logger.error(content.form.error)
|
// LoggerInstance.error(content.form.error)
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
// const storedddo = await ocean.assets.updateMetadata(
|
// const storedddo = await ocean.assets.updateMetadata(
|
||||||
@ -97,7 +97,7 @@ export default function Edit({
|
|||||||
// )
|
// )
|
||||||
// if (!storedddo) {
|
// if (!storedddo) {
|
||||||
// setError(content.form.error)
|
// setError(content.form.error)
|
||||||
// Logger.error(content.form.error)
|
// LoggerInstance.error(content.form.error)
|
||||||
// return
|
// return
|
||||||
// } else {
|
// } else {
|
||||||
// if (price.type === 'free') {
|
// if (price.type === 'free') {
|
||||||
@ -114,7 +114,7 @@ export default function Edit({
|
|||||||
// resetForm()
|
// resetForm()
|
||||||
// }
|
// }
|
||||||
// } catch (error) {
|
// } catch (error) {
|
||||||
// Logger.error(error.message)
|
// LoggerInstance.error(error.message)
|
||||||
// setError(error.message)
|
// setError(error.message)
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
|||||||
import useNetworkMetadata, {
|
import useNetworkMetadata, {
|
||||||
filterNetworksByType
|
filterNetworksByType
|
||||||
} from '@hooks/useNetworkMetadata'
|
} from '@hooks/useNetworkMetadata'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import styles from './MarketStats.module.css'
|
import styles from './MarketStats.module.css'
|
||||||
|
|
||||||
const getTotalPoolsValues = gql`
|
const getTotalPoolsValues = gql`
|
||||||
@ -144,7 +144,7 @@ export default function MarketStats(): ReactElement {
|
|||||||
newTotalOceanLiquiditySum += parseInt(totalOceanLiquidity)
|
newTotalOceanLiquiditySum += parseInt(totalOceanLiquidity)
|
||||||
newPoolCountSum += parseInt(finalizedPoolCount)
|
newPoolCountSum += parseInt(finalizedPoolCount)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('Error fetchData: ', error.message)
|
LoggerInstance.error('Error fetchData: ', error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTotalValueLockedSum(`${newTotalValueLockedSum}`)
|
setTotalValueLockedSum(`${newTotalValueLockedSum}`)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useUserPreferences } from '@context/UserPreferences'
|
import { useUserPreferences } from '@context/UserPreferences'
|
||||||
import React, { ReactElement, useEffect, useState, useCallback } from 'react'
|
import React, { ReactElement, useEffect, useState, useCallback } from 'react'
|
||||||
import Table from '@shared/atoms/Table'
|
import Table from '@shared/atoms/Table'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import Price from '@shared/Price'
|
import Price from '@shared/Price'
|
||||||
import Tooltip from '@shared/atoms/Tooltip'
|
import Tooltip from '@shared/atoms/Tooltip'
|
||||||
import AssetTitle from '@shared/AssetList/AssetListTitle'
|
import AssetTitle from '@shared/AssetList/AssetListTitle'
|
||||||
@ -64,7 +64,7 @@ export default function Bookmarks(): ReactElement {
|
|||||||
)
|
)
|
||||||
return result
|
return result
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
@ -92,7 +92,7 @@ export default function Bookmarks(): ReactElement {
|
|||||||
)
|
)
|
||||||
setPinned(pinnedAssets)
|
setPinned(pinnedAssets)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
queryMetadata
|
queryMetadata
|
||||||
} from '@utils/aquarius'
|
} from '@utils/aquarius'
|
||||||
import { getHighestLiquidityDatatokens } from '@utils/subgraph'
|
import { getHighestLiquidityDatatokens } from '@utils/subgraph'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useUserPreferences } from '@context/UserPreferences'
|
import { useUserPreferences } from '@context/UserPreferences'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import { useIsMounted } from '@hooks/useIsMounted'
|
import { useIsMounted } from '@hooks/useIsMounted'
|
||||||
@ -82,7 +82,7 @@ function SectionQueryResult({
|
|||||||
setResult(result)
|
setResult(result)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import React, { useEffect, useState, ReactElement } from 'react'
|
import React, { useEffect, useState, ReactElement } from 'react'
|
||||||
import { useUserPreferences } from '@context/UserPreferences'
|
import { useUserPreferences } from '@context/UserPreferences'
|
||||||
import {
|
import {
|
||||||
@ -63,7 +63,7 @@ export default function Stats({
|
|||||||
)
|
)
|
||||||
setPublisherLiquidity(userLiquidity)
|
setPublisherLiquidity(userLiquidity)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getPublisherLiquidity()
|
getPublisherLiquidity()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import React, { ReactElement, useState } from 'react'
|
import React, { ReactElement, useState } from 'react'
|
||||||
import Loader from '@shared/atoms/Loader'
|
import Loader from '@shared/atoms/Loader'
|
||||||
import { ListItem } from '@shared/atoms/Lists'
|
import { ListItem } from '@shared/atoms/Lists'
|
||||||
@ -35,7 +35,7 @@ export default function Results({
|
|||||||
job.resultsUrl = jobStatus[0].resultsUrl
|
job.resultsUrl = jobStatus[0].resultsUrl
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
setHasFetched(true)
|
setHasFetched(true)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { ReactElement, useEffect, useState, useCallback } from 'react'
|
import React, { ReactElement, useEffect, useState, useCallback } from 'react'
|
||||||
import Time from '@shared/atoms/Time'
|
import Time from '@shared/atoms/Time'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import Dotdotdot from 'react-dotdotdot'
|
import Dotdotdot from 'react-dotdotdot'
|
||||||
import Table from '@shared/atoms/Table'
|
import Table from '@shared/atoms/Table'
|
||||||
import Button from '@shared/atoms/Button'
|
import Button from '@shared/atoms/Button'
|
||||||
@ -107,7 +107,7 @@ export default function ComputeJobs({
|
|||||||
isMounted() && setJobs(jobs.computeJobs)
|
isMounted() && setJobs(jobs.computeJobs)
|
||||||
setIsLoading(jobs.isLoaded)
|
setIsLoading(jobs.isLoaded)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
}
|
}
|
||||||
}, [chainIds, accountId, config, ocean, account, ddo, isMounted])
|
}, [chainIds, accountId, config, ocean, account, ddo, isMounted])
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import React, { ReactElement, useEffect, useState, useCallback } from 'react'
|
import React, { ReactElement, useEffect, useState, useCallback } from 'react'
|
||||||
import AssetList from '@shared/AssetList'
|
import AssetList from '@shared/AssetList'
|
||||||
import { getPublishedAssets } from '@utils/aquarius'
|
import { getPublishedAssets } from '@utils/aquarius'
|
||||||
@ -37,7 +37,7 @@ export default function PublishedList({
|
|||||||
)
|
)
|
||||||
setQueryResult(result)
|
setQueryResult(result)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
LoggerInstance.error(error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Logger } from '@oceanprotocol/lib'
|
import { LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import {
|
import {
|
||||||
generateBaseQuery,
|
generateBaseQuery,
|
||||||
getFilterTerm,
|
getFilterTerm,
|
||||||
@ -199,7 +199,7 @@ export async function addExistingParamsToUrl(
|
|||||||
for (const querryParam in parsed) {
|
for (const querryParam in parsed) {
|
||||||
if (!excludedParams.includes(querryParam)) {
|
if (!excludedParams.includes(querryParam)) {
|
||||||
if (querryParam === 'page' && excludedParams.includes('text')) {
|
if (querryParam === 'page' && excludedParams.includes('text')) {
|
||||||
Logger.log('remove page when starting a new search')
|
LoggerInstance.log('remove page when starting a new search')
|
||||||
} else {
|
} else {
|
||||||
const value = parsed[querryParam]
|
const value = parsed[querryParam]
|
||||||
urlLocation = `${urlLocation}${querryParam}=${value}&`
|
urlLocation = `${urlLocation}${querryParam}=${value}&`
|
||||||
|
Loading…
Reference in New Issue
Block a user