add async version of createTx

This commit is contained in:
Wei Lu 2014-03-25 13:39:27 +08:00
parent f7d4895b74
commit 68b08b638a
2 changed files with 60 additions and 0 deletions

View file

@ -200,6 +200,22 @@ var Wallet = function (seed, options) {
return tx
}
this.createTxAsync = function(to, value, fixedFee, callback){
if(fixedFee instanceof Function) {
callback = fixedFee
fixedFee = undefined
}
var tx = null
try {
tx = this.createTx(to, value, fixedFee)
} catch(err) {
return callback(err)
}
callback(null, tx)
}
this.dustThreshold = 5430
function isDust(amount) {
return amount <= me.dustThreshold