Commit 57be7233 authored by Alex Beregszaszi's avatar Alex Beregszaszi

Add swarmVerifiedPublish method

parent d978e2ae
...@@ -645,6 +645,18 @@ var run = function () { ...@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment