Added auto-instantiators to classes
This commit is contained in:
parent
ff3679a3fe
commit
7919c8cfc5
4 changed files with 6 additions and 3 deletions
6
bitcoinjs-min.js
vendored
6
bitcoinjs-min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -14,6 +14,7 @@ var p2sh_types = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var Address = function (bytes, version) {
|
var Address = function (bytes, version) {
|
||||||
|
if (!(this instanceof Address)) { return new Address(bytes, version); }
|
||||||
if (arguments[0] instanceof Address) {
|
if (arguments[0] instanceof Address) {
|
||||||
this.hash = arguments[0].hash;
|
this.hash = arguments[0].hash;
|
||||||
this.version = arguments[0].version;
|
this.version = arguments[0].version;
|
||||||
|
|
|
@ -9,6 +9,7 @@ var ECDSA = require('./ecdsa');
|
||||||
var Address = require('./address');
|
var Address = require('./address');
|
||||||
|
|
||||||
var Transaction = function (doc) {
|
var Transaction = function (doc) {
|
||||||
|
if (!(this instanceof Transaction)) { return new Transaction(doc); }
|
||||||
this.version = 1;
|
this.version = 1;
|
||||||
this.lock_time = 0;
|
this.lock_time = 0;
|
||||||
this.ins = [];
|
this.ins = [];
|
||||||
|
|
|
@ -15,6 +15,7 @@ var SecureRandom = require('./jsbn/rng');
|
||||||
var rng = new SecureRandom();
|
var rng = new SecureRandom();
|
||||||
|
|
||||||
var Wallet = function (seed) {
|
var Wallet = function (seed) {
|
||||||
|
if (!(this instanceof Wallet)) { return new Wallet(seed); }
|
||||||
|
|
||||||
// Stored in a closure to make accidental serialization less likely
|
// Stored in a closure to make accidental serialization less likely
|
||||||
var keys = [];
|
var keys = [];
|
||||||
|
|
Loading…
Add table
Reference in a new issue