diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 86a458e7f2..86580ff14a 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -312,52 +312,6 @@ class CompileTab extends ViewPlugin { this.selectedContract = contractName } - publish (storage) { - if (this.selectedContract) { - var contract = this.data.contractsDetails[this.selectedContract] - - if (contract.metadata === undefined || contract.metadata.length === 0) { - modalDialogCustom.alert('This contract may be abstract, may not implement an abstract parent\'s methods completely or not invoke an inherited contract\'s constructor correctly.') - } else { - if (storage === 'swarm') { - publishOnSwarm(contract, this.fileManager, function (err, uploaded) { - if (err) { - try { - err = JSON.stringify(err) - } catch (e) {} - modalDialogCustom.alert(yo`Failed to publish metadata file to swarm, please check the Swarm gateways is available ( swarm-gateways.net ).
- ${err}
`) - } else { - var result = yo`
${uploaded.map((value) => { - return yo`
${value.filename} :
${value.output.url}
` - })}
` - modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`Metadata of "${contract.name.toLowerCase()}" was published successfully.
${result}
`) - } - }, (item) => { // triggered each time there's a new verified publish (means hash correspond) - this.fileProvider.addExternal('swarm/' + item.hash, item.content) - }) - } else { - publishOnIpfs(contract, this.fileManager, function (err, uploaded) { - if (err) { - try { - err = JSON.stringify(err) - } catch (e) {} - modalDialogCustom.alert(yo`Failed to publish metadata file to ${storage}, please check the ${storage} gateways is available.
- ${err}
`) - } else { - var result = yo`
${uploaded.map((value) => { - return yo`
${value.filename} :
${value.output.url}
` - })}
` - modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`Metadata of "${contract.name.toLowerCase()}" was published successfully.
${result}
`) - } - }, (item) => { // triggered each time there's a new verified publish (means hash correspond) - this.fileProvider.addExternal('ipfs/' + item.hash, item.content) - }) - } - } - } - } - details () { const help = { 'Assembly': 'Assembly opcodes describing the contract including corresponding solidity source code', diff --git a/src/publishToStorage.js b/src/publishToStorage.js index fde84fa415..f3c1ed5b6f 100644 --- a/src/publishToStorage.js +++ b/src/publishToStorage.js @@ -19,29 +19,29 @@ export default function publish (storage, fileProvider, fileManager, contract) { var result = yo`
${uploaded.map((value) => { return yo`
${value.filename} :
${value.output.url}
` })}
` - modalDialogCustom.alert(yo`Metadata published successfully.
${result}
`) + modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`Metadata of "${contract.name.toLowerCase()}" was published successfully.
${result}
`) } }, (item) => { // triggered each time there's a new verified publish (means hash correspond) fileProvider.addExternal('swarm/' + item.hash, item.content) }) } else { - publishOnIpfs(contract, fileManager, function (err, uploaded) { - if (err) { - try { - err = JSON.stringify(err) - } catch (e) {} - modalDialogCustom.alert(yo`Failed to publish metadata file to ${storage}, please check the ${storage} gateways is available.
- ${err}
`) - } else { - var result = yo`
${uploaded.map((value) => { - return yo`
${value.filename} :
${value.output.url}
` - })}
` - modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`Metadata of "${contract.name.toLowerCase()}" was published successfully.
${result}
`) - } - }, (item) => { // triggered each time there's a new verified publish (means hash correspond) - fileProvider.addExternal('ipfs/' + item.hash, item.content) - }) - } + publishOnIpfs(contract, fileManager, function (err, uploaded) { + if (err) { + try { + err = JSON.stringify(err) + } catch (e) {} + modalDialogCustom.alert(yo`Failed to publish metadata file to ${storage}, please check the ${storage} gateways is available.
+ ${err}
`) + } else { + var result = yo`
${uploaded.map((value) => { + return yo`
${value.filename} :
${value.output.url}
` + })}
` + modalDialogCustom.alert(`Published ${contract.name}'s Metadata`, yo`Metadata of "${contract.name.toLowerCase()}" was published successfully.
${result}
`) + } + }, (item) => { // triggered each time there's a new verified publish (means hash correspond) + fileProvider.addExternal('ipfs/' + item.hash, item.content) + }) } } } +}