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