mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-10 22:05:55 +00:00
update bundle; don't double add shh option
This commit is contained in:
parent
3b4e5f5b30
commit
8c1b9b56cf
@ -43,9 +43,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
/******/ // expose the module cache
|
/******/ // expose the module cache
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
/******/
|
/******/
|
||||||
/******/ // identity function for calling harmony imports with the correct context
|
|
||||||
/******/ __webpack_require__.i = function(value) { return value; };
|
|
||||||
/******/
|
|
||||||
/******/ // define getter function for harmony exports
|
/******/ // define getter function for harmony exports
|
||||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||||
@ -100,6 +97,7 @@ EmbarkJS.isNewWeb3 = function() {
|
|||||||
EmbarkJS.Contract = function(options) {
|
EmbarkJS.Contract = function(options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var i, abiElement;
|
var i, abiElement;
|
||||||
|
var ContractClass;
|
||||||
|
|
||||||
this.abi = options.abi;
|
this.abi = options.abi;
|
||||||
this.address = options.address;
|
this.address = options.address;
|
||||||
@ -110,14 +108,12 @@ EmbarkJS.Contract = function(options) {
|
|||||||
// TODO:
|
// TODO:
|
||||||
// add default **from** address
|
// add default **from** address
|
||||||
// add gasPrice
|
// add gasPrice
|
||||||
var ContractClass = new this.web3.eth.Contract(this.abi, this.address);
|
ContractClass = new this.web3.eth.Contract(this.abi, this.address);
|
||||||
ContractClass.setProvider(this.web3.currentProvider);
|
ContractClass.setProvider(this.web3.currentProvider);
|
||||||
|
|
||||||
return ContractClass;
|
return ContractClass;
|
||||||
} else {
|
} else {
|
||||||
|
ContractClass = this.web3.eth.contract(this.abi);
|
||||||
|
|
||||||
var ContractClass = this.web3.eth.contract(this.abi);
|
|
||||||
|
|
||||||
this.eventList = [];
|
this.eventList = [];
|
||||||
|
|
||||||
@ -444,7 +440,7 @@ EmbarkJS.Messages.setProvider = function(provider, options) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var ipfs;
|
var ipfs;
|
||||||
if (provider === 'whisper') {
|
if (provider === 'whisper') {
|
||||||
this.providerName = 'whisper'
|
this.providerName = 'whisper';
|
||||||
this.currentMessages = EmbarkJS.Messages.Whisper;
|
this.currentMessages = EmbarkJS.Messages.Whisper;
|
||||||
let provider;
|
let provider;
|
||||||
if (options === undefined) {
|
if (options === undefined) {
|
||||||
@ -473,7 +469,7 @@ EmbarkJS.Messages.setProvider = function(provider, options) {
|
|||||||
self.currentMessages.whisperVersion = self.currentMessages.web3.version.whisper;
|
self.currentMessages.whisperVersion = self.currentMessages.web3.version.whisper;
|
||||||
});
|
});
|
||||||
} else if (provider === 'orbit') {
|
} else if (provider === 'orbit') {
|
||||||
this.providerName = 'orbit'
|
this.providerName = 'orbit';
|
||||||
this.currentMessages = EmbarkJS.Messages.Orbit;
|
this.currentMessages = EmbarkJS.Messages.Orbit;
|
||||||
if (options === undefined) {
|
if (options === undefined) {
|
||||||
ipfs = HaadIpfsApi('localhost', '5001');
|
ipfs = HaadIpfsApi('localhost', '5001');
|
||||||
@ -502,11 +498,12 @@ EmbarkJS.Messages.listenTo = function(options) {
|
|||||||
EmbarkJS.Messages.Whisper = {};
|
EmbarkJS.Messages.Whisper = {};
|
||||||
|
|
||||||
EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
||||||
|
var topics, data, ttl, priority, payload;
|
||||||
if (EmbarkJS.Messages.isNewWeb3()) {
|
if (EmbarkJS.Messages.isNewWeb3()) {
|
||||||
var topics = options.topic || options.topics;
|
topics = options.topic || options.topics;
|
||||||
var data = options.data || options.payload;
|
data = options.data || options.payload;
|
||||||
var ttl = options.ttl || 100;
|
ttl = options.ttl || 100;
|
||||||
var priority = options.priority || 1000;
|
priority = options.priority || 1000;
|
||||||
var powTime = options.powTime || 3;
|
var powTime = options.powTime || 3;
|
||||||
var powTarget = options.powTarget || 0.5;
|
var powTarget = options.powTarget || 0.5;
|
||||||
|
|
||||||
@ -520,7 +517,7 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
|||||||
|
|
||||||
topics = this.web3.utils.toHex(topics).slice(0, 10);
|
topics = this.web3.utils.toHex(topics).slice(0, 10);
|
||||||
|
|
||||||
var payload = JSON.stringify(data);
|
payload = JSON.stringify(data);
|
||||||
|
|
||||||
let message = {
|
let message = {
|
||||||
symKeyID: this.symKeyID, // encrypts using the sym key ID
|
symKeyID: this.symKeyID, // encrypts using the sym key ID
|
||||||
@ -534,11 +531,11 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
|||||||
|
|
||||||
this.web3.shh.post(message, function() { });
|
this.web3.shh.post(message, function() { });
|
||||||
} else {
|
} else {
|
||||||
var topics = options.topic || options.topics;
|
topics = options.topic || options.topics;
|
||||||
var data = options.data || options.payload;
|
data = options.data || options.payload;
|
||||||
|
ttl = options.ttl || 100;
|
||||||
|
priority = options.priority || 1000;
|
||||||
var identity = options.identity || this.identity || web3.shh.newIdentity();
|
var identity = options.identity || this.identity || web3.shh.newIdentity();
|
||||||
var ttl = options.ttl || 100;
|
|
||||||
var priority = options.priority || 1000;
|
|
||||||
var _topics;
|
var _topics;
|
||||||
|
|
||||||
if (topics === undefined) {
|
if (topics === undefined) {
|
||||||
@ -556,7 +553,7 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
|||||||
}
|
}
|
||||||
topics = _topics;
|
topics = _topics;
|
||||||
|
|
||||||
var payload = JSON.stringify(data);
|
payload = JSON.stringify(data);
|
||||||
|
|
||||||
var message;
|
var message;
|
||||||
message = {
|
message = {
|
||||||
@ -567,13 +564,14 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
|||||||
priority: priority
|
priority: priority
|
||||||
};
|
};
|
||||||
|
|
||||||
return EmbarkJS.Messages.currentMessages.web3.shh.post(message, function() { console.log("message sent") });
|
return EmbarkJS.Messages.currentMessages.web3.shh.post(message, function() { });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
||||||
|
var topics, _topics, messageEvents;
|
||||||
if (EmbarkJS.Messages.isNewWeb3()) {
|
if (EmbarkJS.Messages.isNewWeb3()) {
|
||||||
var messageEvents = function() {
|
messageEvents = function() {
|
||||||
this.cb = function() {};
|
this.cb = function() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -589,8 +587,8 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
|||||||
this.filter.stopWatching();
|
this.filter.stopWatching();
|
||||||
};
|
};
|
||||||
|
|
||||||
var topics = options.topic || options.topics;
|
topics = options.topic || options.topics;
|
||||||
var _topics = [];
|
_topics = [];
|
||||||
|
|
||||||
let promise = new messageEvents();
|
let promise = new messageEvents();
|
||||||
|
|
||||||
@ -621,10 +619,10 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
|||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
} else {
|
} else {
|
||||||
var topics = options.topic || options.topics;
|
topics = options.topic || options.topics;
|
||||||
var _topics = [];
|
_topics = [];
|
||||||
|
|
||||||
var messageEvents = function() {
|
messageEvents = function() {
|
||||||
this.cb = function() {};
|
this.cb = function() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -673,7 +671,7 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
|||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
EmbarkJS.Messages.Orbit = {};
|
EmbarkJS.Messages.Orbit = {};
|
||||||
|
|
||||||
|
@ -162,7 +162,9 @@ class GethCommands {
|
|||||||
function whisper(callback) {
|
function whisper(callback) {
|
||||||
if (config.whisper) {
|
if (config.whisper) {
|
||||||
rpc_api.push('shh');
|
rpc_api.push('shh');
|
||||||
|
if (ws_api.indexOf('shh') === -1) {
|
||||||
ws_api.push('shh');
|
ws_api.push('shh');
|
||||||
|
}
|
||||||
return callback(null, "--shh ");
|
return callback(null, "--shh ");
|
||||||
}
|
}
|
||||||
callback("");
|
callback("");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user