mirror of
https://github.com/oceanprotocol/react.git
synced 2024-11-23 02:00:27 +01:00
publish refactor
This commit is contained in:
parent
6283c0b15f
commit
d22c14e19e
@ -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) {
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user