diff --git a/src/wallet.js b/src/wallet.js index e29409d..22e3c73 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -84,17 +84,6 @@ function Wallet(seed, options) { this.outputs = outputs } - this.setUnspentOutputsAsync = function(utxo, callback) { - var error = null - try { - this.setUnspentOutputs(utxo) - } catch(err) { - error = err - } finally { - process.nextTick(function(){ callback(error) }) - } - } - function outputToUnspentOutput(output){ var hashAndIndex = output.receive.split(":") @@ -216,22 +205,6 @@ function Wallet(seed, options) { return tx } - this.createTxAsync = function(to, value, fixedFee, callback){ - if(fixedFee instanceof Function) { - callback = fixedFee - fixedFee = undefined - } - var tx = null - var error = null - - try { - tx = this.createTx(to, value, fixedFee) - } catch(err) { - error = err - } finally { - process.nextTick(function(){ callback(error, tx) }) - } - } this.dustThreshold = 5430 function isDust(amount) { diff --git a/test/wallet.js b/test/wallet.js index c91e422..64ddb8f 100644 --- a/test/wallet.js +++ b/test/wallet.js @@ -277,38 +277,6 @@ describe('Wallet', function() { assert.equal(output.address, utxo[0].address) } }) - - describe('setUnspentOutputsAsync', function(){ - var utxo - beforeEach(function(){ - utxo = cloneObject([expectedUtxo]) - }) - - afterEach(function(){ - wallet.setUnspentOutputs.restore() - }) - - it('calls setUnspentOutputs', function(done){ - sinon.stub(wallet, "setUnspentOutputs") - - var callback = function(){ - assert(wallet.setUnspentOutputs.calledWith(utxo)) - done() - } - - wallet.setUnspentOutputsAsync(utxo, callback) - }) - - it('when setUnspentOutputs throws an error, it invokes callback with error', function(done){ - sinon.stub(wallet, "setUnspentOutputs").throws() - - var callback = function(err){ - assert(err instanceof Error) - done() - } - wallet.setUnspentOutputsAsync(utxo, callback) - }) - }) }) describe('processTx', function(){ @@ -620,57 +588,6 @@ describe('Wallet', function() { }) }) - describe('createTxAsync', function(){ - var to, value, fee - - beforeEach(function(){ - to = '15mMHKL96tWAUtqF3tbVf99Z8arcmnJrr3' - value = 500000 - fee = 10000 - }) - - afterEach(function(){ - wallet.createTx.restore() - }) - - it('calls createTx', function(done){ - sinon.stub(wallet, "createTx").returns("fakeTx") - - var callback = function(err, tx){ - assert(wallet.createTx.calledWith(to, value)) - assert.equal(err, null) - assert.equal(tx, "fakeTx") - done() - } - - wallet.createTxAsync(to, value, callback) - }) - - it('calls createTx correctly when fee is specified', function(done){ - sinon.stub(wallet, "createTx").returns("fakeTx") - - var callback = function(err, tx){ - assert(wallet.createTx.calledWith(to, value, fee)) - assert.equal(err, null) - assert.equal(tx, "fakeTx") - done() - } - - wallet.createTxAsync(to, value, fee, callback) - }) - - it('when createTx throws an error, it invokes callback with error', function(done){ - sinon.stub(wallet, "createTx").throws() - - var callback = function(err, tx){ - assert(err instanceof Error) - done() - } - - wallet.createTxAsync(to, value, callback) - }) - }) - function assertEqual(obj1, obj2){ assert.equal(obj1.toString(), obj2.toString()) }