1
0
mirror of https://github.com/oceanprotocol/react.git synced 2025-02-14 21:10:38 +01:00
This commit is contained in:
alexcos20 2020-10-21 08:00:33 -07:00
parent 824a7c2feb
commit 658f432873
2 changed files with 8 additions and 7 deletions
src
hooks/usePublish
utils

View File

@ -8,7 +8,7 @@ import { useState } from 'react'
import { DataTokenOptions } from './DataTokenOptions' import { DataTokenOptions } from './DataTokenOptions'
import { useOcean } from 'providers' import { useOcean } from 'providers'
import ProviderStatus from 'providers/OceanProvider/ProviderStatus' import ProviderStatus from 'providers/OceanProvider/ProviderStatus'
import { publishFeedback } from 'utils' import { publishFeedback , sleep } from 'utils'
interface UsePublish { interface UsePublish {
publish: ( publish: (
@ -35,11 +35,6 @@ function usePublish(): UsePublish {
setPublishStep(index) setPublishStep(index)
index && setPublishStepText(publishFeedback[index]) index && setPublishStepText(publishFeedback[index])
} }
function sleep(ms: number) {
return new Promise((resolve) => {
setTimeout(resolve, ms)
})
}
/** /**
* Publish an asset.It also creates the datatoken, mints tokens and gives the market allowance * Publish an asset.It also creates the datatoken, mints tokens and gives the market allowance
* @param {Metadata} asset The metadata of the asset. * @param {Metadata} asset The metadata of the asset.
@ -146,7 +141,7 @@ function usePublish(): UsePublish {
) )
.next(setStep) .next(setStep)
Logger.log('ddo created', ddo) Logger.log('ddo created', ddo)
await sleep(20000) await sleep(15000)
setStep(7) setStep(7)
return ddo return ddo
} catch (error) { } catch (error) {

View File

@ -39,3 +39,9 @@ export const publishFeedback: { [key in number]: string } = {
} }
export * from './web3' export * from './web3'
export function sleep(ms: number) {
return new Promise((resolve) => {
setTimeout(resolve, ms)
})
}