fix contracts loading; add warning for whisper version; update web3.js

This commit is contained in:
Iuri Matias 2017-06-25 12:56:14 -04:00
parent 955aab35de
commit 84f7149aaf
4 changed files with 2898 additions and 2758 deletions

View File

@ -372,6 +372,8 @@ var EmbarkJS =
web3.version.getWhisper(function(err, res) { web3.version.getWhisper(function(err, res) {
if (err) { if (err) {
console.log("whisper not available"); console.log("whisper not available");
} else if (web3.version.whisper >= 5) {
console.log("this version of whisper is not supported yet; try a version of geth bellow 1.6.1");
} else { } else {
self.currentMessages.identity = web3.shh.newIdentity(); self.currentMessages.identity = web3.shh.newIdentity();
} }

View File

@ -325,6 +325,8 @@ EmbarkJS.Messages.setProvider = function(provider, options) {
web3.version.getWhisper(function(err, res) { web3.version.getWhisper(function(err, res) {
if (err) { if (err) {
console.log("whisper not available"); console.log("whisper not available");
} else if (web3.version.whisper >= 5) {
console.log("this version of whisper is not supported yet; try a version of geth bellow 1.6.1");
} else { } else {
self.currentMessages.identity = web3.shh.newIdentity(); self.currentMessages.identity = web3.shh.newIdentity();
} }

5636
js/web3.js

File diff suppressed because it is too large Load Diff

View File

@ -19,8 +19,8 @@ class ABIGenerator {
} }
result += "\nvar whenEnvIsLoaded = function(cb) {"; result += "\nvar whenEnvIsLoaded = function(cb) {";
result += "\n if (typeof window !== 'undefined' && window !== null) {"; result += "\n if (typeof document !== 'undefined' && document !== null) {";
result += "\n window.addEventListener('load', cb);"; result += "\n document.addEventListener('DOMContentLoaded', cb);";
result += "\n } else {"; result += "\n } else {";
result += "\n cb();"; result += "\n cb();";
result += "\n }"; result += "\n }";
@ -73,11 +73,13 @@ class ABIGenerator {
let gasEstimates = JSON.stringify(contract.gasEstimates); let gasEstimates = JSON.stringify(contract.gasEstimates);
// TODO: refactor this // TODO: refactor this
result += "\nvar whenEnvIsLoaded = function(cb) {"; result += "\nif (whenEnvIsLoaded === undefined) {";
result += "\n if (typeof window !== 'undefined' && window !== null) {"; result += "\n var whenEnvIsLoaded = function(cb) {";
result += "\n window.addEventListener('load', cb);"; result += "\n if (typeof document !== 'undefined' && document !== null) {";
result += "\n } else {"; result += "\n document.addEventListener('DOMContentLoaded', cb);";
result += "\n cb();"; result += "\n } else {";
result += "\n cb();";
result += "\n }";
result += "\n }"; result += "\n }";
result += "\n}"; result += "\n}";