diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-22 04:54:51 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-22 04:54:51 +0800 |
commit | ad8e92e9c67b82b0e8156345776bafe1c3e07d51 (patch) | |
tree | 9eb59d09860f1600f4048d26580f43576cb45f1e /lib/providermanager.js | |
parent | 81ff253e68bbc700ff093adcff0a21469460b4b8 (diff) | |
parent | edfb874527160cee14cca931377e55187b874cbe (diff) | |
download | go-tangerine-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar go-tangerine-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.gz go-tangerine-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.bz2 go-tangerine-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.lz go-tangerine-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.xz go-tangerine-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.tar.zst go-tangerine-ad8e92e9c67b82b0e8156345776bafe1c3e07d51.zip |
Merge commit 'eb4984c0d036c1420e782ca136810e851e33fb37' into natspec
Diffstat (limited to 'lib/providermanager.js')
-rw-r--r-- | lib/providermanager.js | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/lib/providermanager.js b/lib/providermanager.js index f79a9b087..c3b121451 100644 --- a/lib/providermanager.js +++ b/lib/providermanager.js @@ -56,21 +56,20 @@ var ProviderManager = function() { }; /// sends outgoing requests, if provider is not available, enqueue the request -ProviderManager.prototype.send = function(data, cb) { - data._id = this.id; - if (cb) { - web3._callbacks[data._id] = cb; - } +ProviderManager.prototype.send = function(data) { data.args = data.args || []; - this.id++; + data._id = this.id++; - if(this.provider !== undefined) { - this.provider.send(data); - } else { - console.warn("provider is not set"); - this.queued.push(data); + if (this.provider === undefined) { + console.error('provider is not set'); + return undefined; } + + //TODO: handle error here? + var result = this.provider.send(data); + result = JSON.parse(result); + return result.result; }; /// setups provider, which will be used for sending messages @@ -83,14 +82,6 @@ ProviderManager.prototype.set = function(provider) { this.ready = true; }; -/// resends queued messages -ProviderManager.prototype.sendQueued = function() { - for(var i = 0; this.queued.length; i++) { - // Resend - this.send(this.queued[i]); - } -}; - /// @returns true if the provider i properly set ProviderManager.prototype.installed = function() { return this.provider !== undefined; |