Add swarmVerifiedPublish method

pull/1/head
Alex Beregszaszi 8 years ago
parent d978e2aefa
commit 57be7233d4
  1. 12
      src/app.js

@ -645,6 +645,18 @@ var run = function () {
startdebugging(txResult.transactionHash) startdebugging(txResult.transactionHash)
}) })
function swarmVerifiedPublish (content, expectedHash, cb) {
swarmgw.put(content, function (err, ret) {
if (err) {
cb(err)
} else if (ret !== expectedHash) {
cb('Hash mismatch')
} else {
cb()
}
})
}
udapp.event.register('publishContract', this, function (contract) { udapp.event.register('publishContract', this, function (contract) {
console.log('Publish contract...', contract) console.log('Publish contract...', contract)
swarmgw.put(contract.metadata, function (err, ret) { swarmgw.put(contract.metadata, function (err, ret) {

Loading…
Cancel
Save