swarm adjustements

This commit is contained in:
Jonathan Rainville 2018-07-30 15:49:58 -04:00 committed by Iuri Matias
parent 52462dbd3c
commit 0204eb6d46
6 changed files with 24 additions and 7 deletions

View File

@ -394,7 +394,9 @@ class Embark {
engine.startService("deployment");
engine.startService("storage");
engine.startService("codeGenerator");
engine.startService("namingSystem");
if(options.ensDomain) {
engine.startService("namingSystem");
}
callback();
},
function listLoadedPlugin(callback) {
@ -434,8 +436,11 @@ class Embark {
}
], function (err) {
if (err) {
engine.logger.error(err.message);
engine.logger.debug(err.stack);
if (err.message) {
engine.logger.error(err.message);
return engine.logger.debug(err.stack);
}
engine.locale.error(err);
} else {
engine.logger.info((__("finished building DApp and deploying to") + " " + platform).underline);
}

View File

@ -20,7 +20,6 @@ class BlockchainModule {
registerBlockchainProcess() {
const self = this;
this.events.request('processes:register', 'blockchain', (cb) => {
console.dir("gonna check node connection");
self.assertNodeConnection(true, (connected) => {
if (connected) return cb();
self.startBlockchainNode(cb);

View File

@ -77,11 +77,18 @@ class ENS {
// Convert IPFS multihash to 32 byte hex string
let contentHash;
if (utils.isHex(storageHash)) {
contentHash = storageHash;
} else {
try {
contentHash = ENS.hashTo32ByteHexString(storageHash);
} catch(e) {
return cb('Invalid IPFS hash');
}
}
if (!contentHash.startsWith('0x')) {
contentHash = '0x' + contentHash;
}
// Set content
async.waterfall([
@ -128,7 +135,7 @@ class ENS {
function setContent(resolver, defaultAccount, next) {
resolver.methods.setContent(hashedName, contentHash).send({from: defaultAccount}).then((transaction) => {
if (transaction.status !== "0x1" && transaction.status !== "0x01" && transaction.status !== true) {
return next(new Error('Association failed. Status: ' + transaction.status));
return next('Association failed. Status: ' + transaction.status);
}
next();
}).catch(next);

View File

@ -31,7 +31,7 @@ class Swarm {
this.setServiceCheck();
this.addProviderToEmbarkJS();
this.startProcess(() => {});
//this.startProcess(() => {});
this.registerUploadCommand();
this._checkService((err) => {

View File

@ -24,7 +24,7 @@ class SwarmProcess extends ProcessWrapper {
`--password=${fs.dappPath(this.storageConfig.account.password)}`,
`--corsdomain=${self.cors.join(',')}`
];
console.trace('Starting swarm process with arguments: ' + args.join(' '));
console.error('Starting swarm process with arguments: ' + args.join(' '));
this.child = child_process.spawn(this.command, args);
this.child.on('error', (err) => {

View File

@ -255,6 +255,11 @@ function hexToNumber(hex){
return Web3.utils.hexToNumber(hex);
}
function isHex(hex){
const Web3 = require('web3');
return Web3.utils.isHex(hex);
}
function decodeParams(typesArray, hexString){
var Web3EthAbi = require('web3-eth-abi');
return Web3EthAbi.decodeParameters(typesArray, hexString);
@ -421,6 +426,7 @@ module.exports = {
httpsGetJson,
getJson,
hexToNumber,
isHex,
pingEndpoint,
decodeParams,
runCmd,