fix connecting to correct provider
This commit is contained in:
parent
e5aab5e2ea
commit
a9e63069fb
|
@ -89,6 +89,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||||
|
|
||||||
var EmbarkJS = {};
|
var EmbarkJS = {};
|
||||||
|
|
||||||
|
EmbarkJS.isNewWeb3 = function() {
|
||||||
|
var _web3 = new Web3();
|
||||||
|
if (typeof(_web3.version) === "string") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parseInt(_web3.version.api.split('.')[0], 10) >= 1;
|
||||||
|
};
|
||||||
|
|
||||||
EmbarkJS.Contract = function(options) {
|
EmbarkJS.Contract = function(options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var i, abiElement;
|
var i, abiElement;
|
||||||
|
@ -98,6 +106,18 @@ EmbarkJS.Contract = function(options) {
|
||||||
this.code = '0x' + options.code;
|
this.code = '0x' + options.code;
|
||||||
this.web3 = options.web3 || web3;
|
this.web3 = options.web3 || web3;
|
||||||
|
|
||||||
|
if (EmbarkJS.isNewWeb3()) {
|
||||||
|
// TODO:
|
||||||
|
// add default **from** address
|
||||||
|
// add gasPrice
|
||||||
|
var ContractClass = new this.web3.eth.Contract(this.abi, this.address);
|
||||||
|
ContractClass.setProvider(this.web3.currentProvider);
|
||||||
|
|
||||||
|
return ContractClass;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
var ContractClass = this.web3.eth.contract(this.abi);
|
var ContractClass = this.web3.eth.contract(this.abi);
|
||||||
|
|
||||||
this.eventList = [];
|
this.eventList = [];
|
||||||
|
@ -186,6 +206,7 @@ EmbarkJS.Contract = function(options) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EmbarkJS.Contract.prototype.deploy = function(args, _options) {
|
EmbarkJS.Contract.prototype.deploy = function(args, _options) {
|
||||||
|
|
21
js/embark.js
21
js/embark.js
|
@ -7,6 +7,14 @@
|
||||||
|
|
||||||
var EmbarkJS = {};
|
var EmbarkJS = {};
|
||||||
|
|
||||||
|
EmbarkJS.isNewWeb3 = function() {
|
||||||
|
var _web3 = new Web3();
|
||||||
|
if (typeof(_web3.version) === "string") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parseInt(_web3.version.api.split('.')[0], 10) >= 1;
|
||||||
|
};
|
||||||
|
|
||||||
EmbarkJS.Contract = function(options) {
|
EmbarkJS.Contract = function(options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var i, abiElement;
|
var i, abiElement;
|
||||||
|
@ -16,6 +24,18 @@ EmbarkJS.Contract = function(options) {
|
||||||
this.code = '0x' + options.code;
|
this.code = '0x' + options.code;
|
||||||
this.web3 = options.web3 || web3;
|
this.web3 = options.web3 || web3;
|
||||||
|
|
||||||
|
if (EmbarkJS.isNewWeb3()) {
|
||||||
|
// TODO:
|
||||||
|
// add default **from** address
|
||||||
|
// add gasPrice
|
||||||
|
var ContractClass = new this.web3.eth.Contract(this.abi, this.address);
|
||||||
|
ContractClass.setProvider(this.web3.currentProvider);
|
||||||
|
|
||||||
|
return ContractClass;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
var ContractClass = this.web3.eth.contract(this.abi);
|
var ContractClass = this.web3.eth.contract(this.abi);
|
||||||
|
|
||||||
this.eventList = [];
|
this.eventList = [];
|
||||||
|
@ -104,6 +124,7 @@ EmbarkJS.Contract = function(options) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EmbarkJS.Contract.prototype.deploy = function(args, _options) {
|
EmbarkJS.Contract.prototype.deploy = function(args, _options) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -51,6 +51,43 @@ class CodeGenerator {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result += "\nfunction __reduce(arr, memo, iteratee, cb) {";
|
||||||
|
result += "\n if (typeof cb !== 'function') {";
|
||||||
|
result += "\n if (typeof memo === 'function' && typeof iteratee === 'function') {";
|
||||||
|
result += "\n cb = iteratee;";
|
||||||
|
result += "\n iteratee = memo;";
|
||||||
|
result += "\n memo = [];";
|
||||||
|
result += "\n } else {";
|
||||||
|
result += "\n throw new TypeError('expected callback to be a function');";
|
||||||
|
result += "\n }";
|
||||||
|
result += "\n }";
|
||||||
|
result += "\n";
|
||||||
|
result += "\n if (!Array.isArray(arr)) {";
|
||||||
|
result += "\n cb(new TypeError('expected an array'));";
|
||||||
|
result += "\n return;";
|
||||||
|
result += "\n }";
|
||||||
|
result += "\n";
|
||||||
|
result += "\n if (typeof iteratee !== 'function') {";
|
||||||
|
result += "\n cb(new TypeError('expected iteratee to be a function'));";
|
||||||
|
result += "\n return;";
|
||||||
|
result += "\n }";
|
||||||
|
result += "\n";
|
||||||
|
result += "\n (function next(i, acc) {";
|
||||||
|
result += "\n if (i === arr.length) {";
|
||||||
|
result += "\n cb(null, acc);";
|
||||||
|
result += "\n return;";
|
||||||
|
result += "\n }";
|
||||||
|
result += "\n";
|
||||||
|
result += "\n iteratee(acc, arr[i], function(err, val) {";
|
||||||
|
result += "\n if (err) {";
|
||||||
|
result += "\n cb(err);";
|
||||||
|
result += "\n return;";
|
||||||
|
result += "\n }";
|
||||||
|
result += "\n next(i + 1, val);";
|
||||||
|
result += "\n });";
|
||||||
|
result += "\n })(0, memo);";
|
||||||
|
result += "\n};";
|
||||||
|
|
||||||
result += "\nvar whenEnvIsLoaded = function(cb) {";
|
result += "\nvar whenEnvIsLoaded = function(cb) {";
|
||||||
result += "\n if (typeof document !== 'undefined' && document !== null) {";
|
result += "\n if (typeof document !== 'undefined' && document !== null) {";
|
||||||
result += "\n document.addEventListener('DOMContentLoaded', cb);";
|
result += "\n document.addEventListener('DOMContentLoaded', cb);";
|
||||||
|
@ -70,29 +107,41 @@ class CodeGenerator {
|
||||||
} else {
|
} else {
|
||||||
result += "\nwhenEnvIsLoaded(function() {\n";
|
result += "\nwhenEnvIsLoaded(function() {\n";
|
||||||
|
|
||||||
if (isDeployment) {
|
result += "\nif (typeof window !== 'undefined') { window.web3 = undefined; }";
|
||||||
|
|
||||||
|
if (isDeployment) {
|
||||||
let connection = "http://" + this.contractsConfig.deployment.host + ":" + this.contractsConfig.deployment.port;
|
let connection = "http://" + this.contractsConfig.deployment.host + ":" + this.contractsConfig.deployment.port;
|
||||||
result += '\n\tweb3 = new Web3(new Web3.providers.HttpProvider("' + connection + '"));';
|
result += '\n\tweb3 = new Web3(new Web3.providers.HttpProvider("' + connection + '"));';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let connectionCode = this.contractsConfig.dappConnection.map(function(connection) {
|
let connectionCode = "";
|
||||||
let code = "";
|
connectionCode += "\n__reduce([";
|
||||||
if (connection === '$WEB3') {
|
connectionCode += this.contractsConfig.dappConnection.map((x) => '"' + x + '"').join(',');
|
||||||
code += "if (typeof web3 !== 'undefined' && typeof Web3 !== 'undefined') {";
|
connectionCode += "], function(prev, value, next) {";
|
||||||
code += '\n\tweb3 = new Web3(web3.currentProvider);';
|
|
||||||
code += '\n}';
|
|
||||||
} else {
|
|
||||||
code += "if (typeof Web3 !== 'undefined' && ((typeof web3 === 'undefined') || (typeof web3 !== 'undefined' && !web3.isConnected()))) {";
|
|
||||||
code += '\n\tweb3 = new Web3(new Web3.providers.HttpProvider("' + connection + '"));';
|
|
||||||
code += '\n}';
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
});
|
|
||||||
|
|
||||||
result += connectionCode.join(' ');
|
connectionCode += "\nif (prev === false) {";
|
||||||
}
|
connectionCode += "\n return next(null, false);";
|
||||||
|
connectionCode += "\n}";
|
||||||
|
|
||||||
|
connectionCode += "\n if (value === '$WEB3' && (typeof web3 !== 'undefined' && typeof Web3 !== 'undefined')) {";
|
||||||
|
connectionCode += '\n\tweb3 = new Web3(web3.currentProvider);';
|
||||||
|
connectionCode += "\n } else if (value !== '$WEB3' && (typeof Web3 !== 'undefined' && ((typeof web3 === 'undefined') || (typeof web3 !== 'undefined' && (!web3.isConnected || (web3.isConnected && !web3.isConnected())))))) {";
|
||||||
|
|
||||||
|
connectionCode += "\n\tweb3 = new Web3(new Web3.providers.HttpProvider(value));"
|
||||||
|
|
||||||
|
connectionCode += "\n}";
|
||||||
|
|
||||||
|
connectionCode += "\nelse if (value === '$WEB3') {";
|
||||||
|
connectionCode += "\n\treturn next(null, '');";
|
||||||
|
connectionCode += "\n}";
|
||||||
|
|
||||||
|
connectionCode += "\nweb3.eth.getAccounts(function(err, account) { if(err) { next(null, true) } else { next(null, false) }})";
|
||||||
|
|
||||||
|
connectionCode += "\n}, function(err, _result) {";
|
||||||
|
connectionCode += "\n});";
|
||||||
|
|
||||||
|
result += connectionCode;
|
||||||
|
}
|
||||||
|
|
||||||
result += "\nweb3.eth.defaultAccount = web3.eth.accounts[0];";
|
result += "\nweb3.eth.defaultAccount = web3.eth.accounts[0];";
|
||||||
result += '\n})';
|
result += '\n})';
|
||||||
|
@ -137,8 +186,10 @@ class CodeGenerator {
|
||||||
result += "\n}";
|
result += "\n}";
|
||||||
|
|
||||||
result += "\nwhenEnvIsLoaded(function() {";
|
result += "\nwhenEnvIsLoaded(function() {";
|
||||||
|
result += "\nif (typeof window !== 'undefined') { window." + className + " = undefined; }";
|
||||||
if (useEmbarkJS) {
|
if (useEmbarkJS) {
|
||||||
result += "\n" + className + " = new EmbarkJS.Contract({abi: " + abi + ", address: '" + contract.deployedAddress + "', code: '" + contract.code + "', gasEstimates: " + gasEstimates + "});";
|
let contractAddress = contract.deployedAddress ? ("'" + contract.deployedAddress + "'") : "undefined";
|
||||||
|
result += "\n" + className + " = new EmbarkJS.Contract({abi: " + abi + ", address: " + contractAddress + ", code: '" + contract.code + "', gasEstimates: " + gasEstimates + "});";
|
||||||
} else {
|
} else {
|
||||||
result += "\n" + className + "Abi = " + abi + ";";
|
result += "\n" + className + "Abi = " + abi + ";";
|
||||||
result += "\n" + className + "Contract = web3.eth.contract(" + className + "Abi);";
|
result += "\n" + className + "Contract = web3.eth.contract(" + className + "Abi);";
|
||||||
|
@ -212,8 +263,8 @@ class CodeGenerator {
|
||||||
|
|
||||||
result += this.generateProvider(options.deployment);
|
result += this.generateProvider(options.deployment);
|
||||||
result += this.generateContracts(options.useEmbarkJS);
|
result += this.generateContracts(options.useEmbarkJS);
|
||||||
result += this.generateStorageInitialization(options.useEmbarkJS);
|
//result += this.generateStorageInitialization(options.useEmbarkJS);
|
||||||
result += this.generateCommunicationInitialization(options.useEmbarkJS);
|
//result += this.generateCommunicationInitialization(options.useEmbarkJS);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,10 +256,14 @@ Config.prototype.loadFiles = function(files) {
|
||||||
//if (false) {
|
//if (false) {
|
||||||
//readFiles.push(new File({filename: 'web3-' + web3Version + '.js', type: 'custom', resolver: function(callback) {
|
//readFiles.push(new File({filename: 'web3-' + web3Version + '.js', type: 'custom', resolver: function(callback) {
|
||||||
readFiles.push(new File({filename: 'web3.js', type: 'custom', resolver: function(callback) {
|
readFiles.push(new File({filename: 'web3.js', type: 'custom', resolver: function(callback) {
|
||||||
|
if (web3Version === "1.0.0-beta") {
|
||||||
|
callback(fs.readFileSync(fs.embarkPath('js/web3-1.0.min.js')).toString());
|
||||||
|
} else {
|
||||||
let npm = new Npm({logger: self.logger});
|
let npm = new Npm({logger: self.logger});
|
||||||
npm.getPackageVersion('web3', web3Version, 'dist/web3.min.js', true, function(web3Content) {
|
npm.getPackageVersion('web3', web3Version, 'dist/web3.min.js', true, function(web3Content) {
|
||||||
callback(web3Content);
|
callback(web3Content);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}}));
|
}}));
|
||||||
} else {
|
} else {
|
||||||
readFiles.push(new File({filename: 'web3.js', type: 'embark_internal', path: "js/web3.js"}));
|
readFiles.push(new File({filename: 'web3.js', type: 'embark_internal', path: "js/web3.js"}));
|
||||||
|
|
|
@ -45,6 +45,12 @@ class Npm {
|
||||||
if (getFromGit) {
|
if (getFromGit) {
|
||||||
let repoName = registryJSON.repository.url.replace("git+https://github.com/", "").replace(".git","");
|
let repoName = registryJSON.repository.url.replace("git+https://github.com/", "").replace(".git","");
|
||||||
let gitHead = registryJSON.gitHead;
|
let gitHead = registryJSON.gitHead;
|
||||||
|
|
||||||
|
if (!gitHead) {
|
||||||
|
console.error("Could not download " + packageName + " " + version);
|
||||||
|
return callback("error");
|
||||||
|
}
|
||||||
|
|
||||||
let fileLocation = "https://raw.githubusercontent.com/" + repoName + "/" + gitHead + "/dist/web3.min.js";
|
let fileLocation = "https://raw.githubusercontent.com/" + repoName + "/" + gitHead + "/dist/web3.min.js";
|
||||||
|
|
||||||
let packageDirectory = './.embark/versions/' + packageName + '/' + version + '/';
|
let packageDirectory = './.embark/versions/' + packageName + '/' + version + '/';
|
||||||
|
|
|
@ -31,80 +31,80 @@ $(document).ready(function() {
|
||||||
// automatic set if config/storage.json has "enabled": true and "provider": "ipfs"
|
// automatic set if config/storage.json has "enabled": true and "provider": "ipfs"
|
||||||
//EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'});
|
//EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'});
|
||||||
|
|
||||||
$("#storage .error").hide();
|
//$("#storage .error").hide();
|
||||||
EmbarkJS.Storage.setProvider('ipfs')
|
//EmbarkJS.Storage.setProvider('ipfs')
|
||||||
.then(function(){
|
// .then(function(){
|
||||||
console.log('Provider set to IPFS');
|
// console.log('Provider set to IPFS');
|
||||||
EmbarkJS.Storage.ipfsConnection.ping()
|
// EmbarkJS.Storage.ipfsConnection.ping()
|
||||||
.then(function(){
|
// .then(function(){
|
||||||
$("#status-storage").addClass('status-online');
|
// $("#status-storage").addClass('status-online');
|
||||||
$("#storage-controls").show();
|
// $("#storage-controls").show();
|
||||||
})
|
// })
|
||||||
.catch(function(err) {
|
// .catch(function(err) {
|
||||||
if(err){
|
// if(err){
|
||||||
console.log("IPFS Connection Error => " + err.message);
|
// console.log("IPFS Connection Error => " + err.message);
|
||||||
$("#storage .error").show();
|
// $("#storage .error").show();
|
||||||
$("#status-storage").addClass('status-offline');
|
// $("#status-storage").addClass('status-offline');
|
||||||
$("#storage-controls").hide();
|
// $("#storage-controls").hide();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
})
|
// })
|
||||||
.catch(function(err){
|
// .catch(function(err){
|
||||||
console.log('Failed to set IPFS as Provider:', err.message);
|
// console.log('Failed to set IPFS as Provider:', err.message);
|
||||||
$("#storage .error").show();
|
// $("#storage .error").show();
|
||||||
$("#status-storage").addClass('status-offline');
|
// $("#status-storage").addClass('status-offline');
|
||||||
$("#storage-controls").hide();
|
// $("#storage-controls").hide();
|
||||||
});
|
// });
|
||||||
|
|
||||||
$("#storage button.setIpfsText").click(function() {
|
//$("#storage button.setIpfsText").click(function() {
|
||||||
var value = $("#storage input.ipfsText").val();
|
// var value = $("#storage input.ipfsText").val();
|
||||||
EmbarkJS.Storage.saveText(value).then(function(hash) {
|
// EmbarkJS.Storage.saveText(value).then(function(hash) {
|
||||||
$("span.textHash").html(hash);
|
// $("span.textHash").html(hash);
|
||||||
$("input.textHash").val(hash);
|
// $("input.textHash").val(hash);
|
||||||
addToLog("#storage", "EmbarkJS.Storage.saveText('" + value + "').then(function(hash) { })");
|
// addToLog("#storage", "EmbarkJS.Storage.saveText('" + value + "').then(function(hash) { })");
|
||||||
})
|
// })
|
||||||
.catch(function(err) {
|
// .catch(function(err) {
|
||||||
if(err){
|
// if(err){
|
||||||
console.log("IPFS saveText Error => " + err.message);
|
// console.log("IPFS saveText Error => " + err.message);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
//});
|
||||||
|
|
||||||
$("#storage button.loadIpfsHash").click(function() {
|
//$("#storage button.loadIpfsHash").click(function() {
|
||||||
var value = $("#storage input.textHash").val();
|
// var value = $("#storage input.textHash").val();
|
||||||
EmbarkJS.Storage.get(value).then(function(content) {
|
// EmbarkJS.Storage.get(value).then(function(content) {
|
||||||
$("span.ipfsText").html(content);
|
// $("span.ipfsText").html(content);
|
||||||
addToLog("#storage", "EmbarkJS.Storage.get('" + value + "').then(function(content) { })");
|
// addToLog("#storage", "EmbarkJS.Storage.get('" + value + "').then(function(content) { })");
|
||||||
})
|
// })
|
||||||
.catch(function(err) {
|
// .catch(function(err) {
|
||||||
if(err){
|
// if(err){
|
||||||
console.log("IPFS get Error => " + err.message);
|
// console.log("IPFS get Error => " + err.message);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
//});
|
||||||
|
|
||||||
$("#storage button.uploadFile").click(function() {
|
//$("#storage button.uploadFile").click(function() {
|
||||||
var input = $("#storage input[type=file]");
|
// var input = $("#storage input[type=file]");
|
||||||
EmbarkJS.Storage.uploadFile(input).then(function(hash) {
|
// EmbarkJS.Storage.uploadFile(input).then(function(hash) {
|
||||||
$("span.fileIpfsHash").html(hash);
|
// $("span.fileIpfsHash").html(hash);
|
||||||
$("input.fileIpfsHash").val(hash);
|
// $("input.fileIpfsHash").val(hash);
|
||||||
addToLog("#storage", "EmbarkJS.Storage.uploadFile($('input[type=file]')).then(function(hash) { })");
|
// addToLog("#storage", "EmbarkJS.Storage.uploadFile($('input[type=file]')).then(function(hash) { })");
|
||||||
})
|
// })
|
||||||
.catch(function(err) {
|
// .catch(function(err) {
|
||||||
if(err){
|
// if(err){
|
||||||
console.log("IPFS uploadFile Error => " + err.message);
|
// console.log("IPFS uploadFile Error => " + err.message);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
//});
|
||||||
|
|
||||||
$("#storage button.loadIpfsFile").click(function() {
|
//$("#storage button.loadIpfsFile").click(function() {
|
||||||
var hash = $("#storage input.fileIpfsHash").val();
|
// var hash = $("#storage input.fileIpfsHash").val();
|
||||||
var url = EmbarkJS.Storage.getUrl(hash);
|
// var url = EmbarkJS.Storage.getUrl(hash);
|
||||||
var link = '<a href="' + url + '" target="_blank">' + url + '</a>';
|
// var link = '<a href="' + url + '" target="_blank">' + url + '</a>';
|
||||||
$("span.ipfsFileUrl").html(link);
|
// $("span.ipfsFileUrl").html(link);
|
||||||
$(".ipfsImage").attr('src', url);
|
// $(".ipfsImage").attr('src', url);
|
||||||
addToLog("#storage", "EmbarkJS.Storage.getUrl('" + hash + "')");
|
// addToLog("#storage", "EmbarkJS.Storage.getUrl('" + hash + "')");
|
||||||
});
|
//});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -113,37 +113,37 @@ $(document).ready(function() {
|
||||||
// ===========================
|
// ===========================
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$("#communication .error").hide();
|
//$("#communication .error").hide();
|
||||||
$("#communication .errorVersion").hide();
|
//$("#communication .errorVersion").hide();
|
||||||
web3.version.getWhisper(function(err, version) {
|
//web3.version.getWhisper(function(err, version) {
|
||||||
if (err) {
|
// if (err) {
|
||||||
$("#communication .error").show();
|
// $("#communication .error").show();
|
||||||
$("#communication-controls").hide();
|
// $("#communication-controls").hide();
|
||||||
$("#status-communication").addClass('status-offline');
|
// $("#status-communication").addClass('status-offline');
|
||||||
} else if (version >= 5) {
|
// } else if (version >= 5) {
|
||||||
$("#communication .errorVersion").show();
|
// $("#communication .errorVersion").show();
|
||||||
$("#communication-controls").hide();
|
// $("#communication-controls").hide();
|
||||||
$("#status-communication").addClass('status-offline');
|
// $("#status-communication").addClass('status-offline');
|
||||||
} else {
|
// } else {
|
||||||
EmbarkJS.Messages.setProvider('whisper');
|
// EmbarkJS.Messages.setProvider('whisper');
|
||||||
$("#status-communication").addClass('status-online');
|
// $("#status-communication").addClass('status-online');
|
||||||
}
|
// }
|
||||||
});
|
//});
|
||||||
|
|
||||||
$("#communication button.listenToChannel").click(function() {
|
//$("#communication button.listenToChannel").click(function() {
|
||||||
var channel = $("#communication .listen input.channel").val();
|
// var channel = $("#communication .listen input.channel").val();
|
||||||
$("#communication #subscribeList").append("<br> subscribed to " + channel + " now try sending a message");
|
// $("#communication #subscribeList").append("<br> subscribed to " + channel + " now try sending a message");
|
||||||
EmbarkJS.Messages.listenTo({topic: [channel]}).then(function(message) {
|
// EmbarkJS.Messages.listenTo({topic: [channel]}).then(function(message) {
|
||||||
$("#communication #messagesList").append("<br> channel: " + channel + " message: " + message);
|
// $("#communication #messagesList").append("<br> channel: " + channel + " message: " + message);
|
||||||
});
|
// });
|
||||||
addToLog("#communication", "EmbarkJS.Messages.listenTo({topic: ['" + channel + "']}).then(function(message) {})");
|
// addToLog("#communication", "EmbarkJS.Messages.listenTo({topic: ['" + channel + "']}).then(function(message) {})");
|
||||||
});
|
//});
|
||||||
|
|
||||||
$("#communication button.sendMessage").click(function() {
|
//$("#communication button.sendMessage").click(function() {
|
||||||
var channel = $("#communication .send input.channel").val();
|
// var channel = $("#communication .send input.channel").val();
|
||||||
var message = $("#communication .send input.message").val();
|
// var message = $("#communication .send input.message").val();
|
||||||
EmbarkJS.Messages.sendMessage({topic: channel, data: message});
|
// EmbarkJS.Messages.sendMessage({topic: channel, data: message});
|
||||||
addToLog("#communication", "EmbarkJS.Messages.sendMessage({topic: '" + channel + "', data: '" + message + "'})");
|
// addToLog("#communication", "EmbarkJS.Messages.sendMessage({topic: '" + channel + "', data: '" + message + "'})");
|
||||||
});
|
//});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"default": {
|
"default": {
|
||||||
"versions": {
|
"versions": {
|
||||||
"web3.js": "1.0.0-beta.18",
|
"web3.js": "1.0.0-beta",
|
||||||
"solc": "0.4.11"
|
"solc": "0.4.11"
|
||||||
},
|
},
|
||||||
"deployment": {
|
"deployment": {
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
"args": [200]
|
"args": [200]
|
||||||
},
|
},
|
||||||
"AlreadyDeployedToken": {
|
"AlreadyDeployedToken": {
|
||||||
"address": "0x123",
|
"address": "0xece374063fe5cc7efbaca0a498477cada94e5ad6",
|
||||||
"instanceOf": "Token"
|
"instanceOf": "Token"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue