Skip to content

Commit

Permalink
subprovider - rename web3 to provider
Browse files Browse the repository at this point in the history
  • Loading branch information
kumavis committed Apr 10, 2018
1 parent 3db420e commit f7b5a5d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
20 changes: 20 additions & 0 deletions subproviders/provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const inherits = require('util').inherits
const Subprovider = require('./subprovider.js')

// wraps a provider in a subprovider interface

module.exports = ProviderSubprovider

inherits(ProviderSubprovider, Subprovider)

function ProviderSubprovider(provider){
this.provider = provider
}

ProviderSubprovider.prototype.handleRequest = function(payload, next, end){
this.provider.sendAsync(payload, function(err, response) {
if (err) return end(err)
if (response.error) return end(new Error(response.error.message))
end(null, response.result)
})
}
18 changes: 0 additions & 18 deletions subproviders/web3.js

This file was deleted.

0 comments on commit f7b5a5d

Please sign in to comment.