Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #53 from axic/patch/ethtx-clean
Browse files Browse the repository at this point in the history
Use super call for cleaner code in hooked-wallet-ethtx
  • Loading branch information
kumavis committed Mar 30, 2016
2 parents 0025a83 + 5c25356 commit e8d3eef
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions subproviders/hooked-wallet-ethtx.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* The two callbacks a user needs to implement are:
* - getAccounts() -- array of addresses supported
* - getPrivateKey(address) -- return private key for a given address
*
* Optionally approveTransaction() can be supplied too.
*/

const inherits = require('util').inherits
Expand All @@ -15,13 +17,6 @@ module.exports = HookedWalletEthTxSubprovider
inherits(HookedWalletEthTxSubprovider, HookedWalletProvider)

function HookedWalletEthTxSubprovider(opts) {
// FIXME: moving to ES6 could give us classes properly
var self = this
self.getAccounts = opts.getAccounts
// default to auto-approve
self.approveTransaction = opts.approveTransaction || function(txParams, cb){ cb(null, true) }
self.signTransaction = opts.signTransaction

self.signTransaction = function(txData, cb) {
if (txData.gas !== undefined)
txData.gasLimit = txData.gas
Expand All @@ -35,4 +30,6 @@ function HookedWalletEthTxSubprovider(opts) {
cb(null, '0x' + tx.serialize().toString('hex'))
})
}

HookedWallethEthTxSubprovider.super_.call(this, opts)
}

0 comments on commit e8d3eef

Please sign in to comment.