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

removed console logs and added one new check

This commit is contained in:
Bogdan Fazakas 2022-06-01 17:25:51 +03:00
parent 9ff04d3c04
commit c25ab289fd
2 changed files with 14 additions and 12 deletions

View File

@ -8,6 +8,7 @@ import {
ProviderComputeInitializeResults,
ProviderInstance
} from '@oceanprotocol/lib'
import { toast } from 'react-toastify'
import { AssetExtended } from 'src/@types/AssetExtended'
import Web3 from 'web3'
import { getValidUntilTime } from './compute'
@ -35,14 +36,19 @@ export async function initializeProviderForCompute(
algorithm.services[0].timeout
)
return await ProviderInstance.initializeCompute(
[computeAsset],
computeAlgo,
computeEnv?.id,
validUntil,
dataset.services[0].serviceEndpoint,
accountId
)
try {
return await ProviderInstance.initializeCompute(
[computeAsset],
computeAlgo,
computeEnv?.id,
validUntil,
dataset.services[0].serviceEndpoint,
accountId
)
} catch (error) {
toast(`Error initializing provider for the compute job!`)
return null
}
}
// TODO: Why do we have these one line functions ?!?!?!

View File

@ -126,7 +126,6 @@ export default function Compute({
async function initPriceAndFees() {
const computeEnv = await getComputeEnviroment(asset)
console.log('computeEnv', computeEnv)
if (!computeEnv || !computeEnv.id) {
setError(`Error getting compute environments!`)
return
@ -137,7 +136,6 @@ export default function Compute({
accountId,
computeEnv
)
console.log('initializedProvider', initializedProvider)
if (
!initializedProvider ||
!initializedProvider.datasets ||
@ -184,7 +182,6 @@ export default function Compute({
)
if (!datasetPriceAndFees) {
setError('Error setting dataset price and fees!')
toast.error('Error setting dataset price and fees!')
return
}
setDatasetOrderPriceAndFees(datasetPriceAndFees)
@ -232,7 +229,6 @@ export default function Compute({
)
if (!algorithmOrderPriceAndFees) {
setError('Error setting algorithm price and fees!')
toast.error('Error setting algorithm price and fees!')
return
}
setAlgoOrderPriceAndFees(algorithmOrderPriceAndFees)