|
|
|
@ -5,7 +5,7 @@ import { publishToIPFS } from './publishToIPFS' |
|
|
|
|
import { publishToSwarm } from './publishOnSwarm' |
|
|
|
|
|
|
|
|
|
export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { |
|
|
|
|
const { storage, fileProvider, fileManager, contract, resetStorage } = props |
|
|
|
|
const { api, storage, fileManager, contract, resetStorage } = props |
|
|
|
|
const [state, setState] = useState({ |
|
|
|
|
modal: { |
|
|
|
|
title: '', |
|
|
|
@ -29,7 +29,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { |
|
|
|
|
|
|
|
|
|
modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded)) |
|
|
|
|
// triggered each time there's a new verified publish (means hash correspond)
|
|
|
|
|
fileProvider.addExternal('swarm/' + result.item.hash, result.item.content) |
|
|
|
|
api.addExternalFile('swarm/' + result.item.hash, result.item.content) |
|
|
|
|
} catch (err) { |
|
|
|
|
let parseError = err |
|
|
|
|
try { |
|
|
|
@ -43,7 +43,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { |
|
|
|
|
|
|
|
|
|
modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded)) |
|
|
|
|
// triggered each time there's a new verified publish (means hash correspond)
|
|
|
|
|
fileProvider.addExternal('ipfs/' + result.item.hash, result.item.content) |
|
|
|
|
api.addExternalFile('ipfs/' + result.item.hash, result.item.content) |
|
|
|
|
} catch (err) { |
|
|
|
|
modal('IPFS Publish Failed', publishMessageFailed(storage, err)) |
|
|
|
|
} |
|
|
|
|