create addresses object.
This commit is contained in:
parent
499c47aa34
commit
0c19633da9
@ -415,10 +415,10 @@ Bitcoin.prototype.getMiningInfo = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Bitcoin.prototype.getAddrTransactions = function(addr, callback) {
|
Bitcoin.prototype.getAddrTransactions = function(addr, callback) {
|
||||||
return bitcoindjs.getAddrTransactions(addr, function(err, result) {
|
return bitcoindjs.getAddrTransactions(addr, function(err, addr) {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
result._addrFlag = true;
|
addr = bitcoin.addr(addr);
|
||||||
return callback(null, result);
|
return callback(null, addr);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -710,6 +710,41 @@ Transaction.prototype.broadcast = function(options, callback) {
|
|||||||
return Transaction.broadcast(this, options, callback);
|
return Transaction.broadcast(this, options, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Addresses
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Addresses(data) {
|
||||||
|
if (!(this instanceof Addresses)) {
|
||||||
|
return new Addresses(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data instanceof Addresses) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
Object.keys(data).forEach(function(key) {
|
||||||
|
if (!self[key]) {
|
||||||
|
self[key] = data[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(Transaction.prototype, '_addrFlag', {
|
||||||
|
__proto__: null,
|
||||||
|
configurable: false,
|
||||||
|
enumerable: false,
|
||||||
|
writable: false,
|
||||||
|
value: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
Addresses.isAddresses =
|
||||||
|
Addresses.isAddr = function(addr) {
|
||||||
|
return addr._txFlag === Addresses.prototype._addrFlag;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wallet
|
* Wallet
|
||||||
* Singleton
|
* Singleton
|
||||||
@ -954,6 +989,10 @@ exports.Transaction = Transaction;
|
|||||||
exports.transaction = Transaction;
|
exports.transaction = Transaction;
|
||||||
exports.tx = Transaction;
|
exports.tx = Transaction;
|
||||||
|
|
||||||
|
exports.Addresses = Addresses;
|
||||||
|
exports.addresses = Addresses;
|
||||||
|
exports.addr = Addresses;
|
||||||
|
|
||||||
exports.Wallet = Wallet;
|
exports.Wallet = Wallet;
|
||||||
exports.wallet = Wallet;
|
exports.wallet = Wallet;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user