diff --git a/src/hooks/usePublish/usePublish.ts b/src/hooks/usePublish/usePublish.ts index 7e063a8..6c520c4 100644 --- a/src/hooks/usePublish/usePublish.ts +++ b/src/hooks/usePublish/usePublish.ts @@ -57,21 +57,6 @@ function usePublish(): UsePublish { setIsLoading(true) setPublishError(undefined) try { - setStep(0) - const dtAddress = await ocean.datatokens.create( - config.metadataStoreUri, - 'Ocean Data Token', - 'Ocean-DT', - '1000', - accountId - ) - Logger.log('datatoken created', dtAddress) - - setStep(1) - await mint(dtAddress, tokensToMint) - Logger.log(`minted ${tokensToMint} tokens`) - - setStep(2) const publishedDate = new Date(Date.now()).toISOString().split('.')[0] + 'Z' const timeout = 0 @@ -139,10 +124,15 @@ function usePublish(): UsePublish { } Logger.log('services created', services) - setStep(3) - const ddo = await ocean.assets.create(asset, account, services, dtAddress) + + const ddo = await ocean.assets + .create(asset, account, services) + .next(setStep) Logger.log('ddo created', ddo) - setStep(4) + setStep(7) + await mint(ddo.dataToken, tokensToMint) + Logger.log(`minted ${tokensToMint} tokens`) + setStep(8) return ddo } catch (error) { diff --git a/src/utils/index.ts b/src/utils/index.ts index 0e7fac7..a2f76cc 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -29,10 +29,12 @@ export const feedback: { [key in number]: string } = { } export const publishFeedback: { [key in number]: string } = { - 0: '1/4 Creating datatoken ...', - 1: '2/4 Minting tokens ...', - 3: '3/4 Publishing asset ...', - 4: '4/4 Asset published succesfully' + 0: '1/6 Creating datatoken ...', + 2: '2/6 Encrypting files ...', + 4: '3/6 Generating proof ...', + 6: '4/6 Storing ddo ...', + 7: '2/6 Minting tokens ...', + 8: '4/6 Asset published succesfully' } export * from './web3'