all classes working with soop and test passing
This commit is contained in:
parent
fa1e323d39
commit
c0c325dabd
15
Address.js
15
Address.js
|
@ -1,14 +1,13 @@
|
|||
require('classtool');
|
||||
|
||||
function ClassSpec(b) {
|
||||
var superclass = b.superclass || require('./util/VersionedData').class();
|
||||
'use strict';
|
||||
var imports = require('soop').imports();
|
||||
var parent = imports.parent || require('./util/VersionedData');
|
||||
|
||||
function Address() {
|
||||
Address.super(this, arguments);
|
||||
}
|
||||
|
||||
Address.superclass = superclass;
|
||||
superclass.applyEncodingsTo(Address);
|
||||
Address.parent = parent;
|
||||
parent.applyEncodingsTo(Address);
|
||||
|
||||
Address.prototype.validate = function() {
|
||||
this.doAsBinary(function() {
|
||||
|
@ -17,6 +16,4 @@ function ClassSpec(b) {
|
|||
});
|
||||
};
|
||||
|
||||
return Address;
|
||||
}
|
||||
module.defineClass(ClassSpec);
|
||||
module.exports = require('soop')(Address);
|
||||
|
|
25
Block.js
25
Block.js
|
@ -1,18 +1,17 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function spec(b) {
|
||||
var util = b.util || require('./util/util');
|
||||
var Debug1 = b.Debug1 || function() {};
|
||||
var Script = b.Script || require('./Script').class();
|
||||
var Bignum = b.Bignum || require('bignum');
|
||||
var Binary = b.Binary || require('binary');
|
||||
var Step = b.Step || require('step');
|
||||
var buffertools = b.buffertools || require('buffertools');
|
||||
var Transaction = b.Transaction || require('./Transaction').class();
|
||||
var util = imports.util || require('./util/util');
|
||||
var Debug1 = imports.Debug1 || function() {};
|
||||
var Script = imports.Script || require('./Script');
|
||||
var Bignum = imports.Bignum || require('bignum');
|
||||
var Binary = imports.Binary || require('binary');
|
||||
var Step = imports.Step || require('step');
|
||||
var buffertools = imports.buffertools || require('buffertools');
|
||||
var Transaction = imports.Transaction || require('./Transaction');
|
||||
var TransactionIn = Transaction.In;
|
||||
var TransactionOut = Transaction.Out;
|
||||
var COINBASE_OP = Transaction.COINBASE_OP;
|
||||
var VerificationError = b.VerificationError || require('./util/error').VerificationError;
|
||||
var VerificationError = imports.VerificationError || require('./util/error').VerificationError;
|
||||
var BlockRules = {
|
||||
maxTimeOffset: 2 * 60 * 60, // How far block timestamps can be into the future
|
||||
largestHash: Bignum(2).pow(256)
|
||||
|
@ -589,6 +588,4 @@ function spec(b) {
|
|||
return block;
|
||||
};
|
||||
|
||||
return Block;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
module.exports = require('soop')(Block);
|
||||
|
|
7
Bloom.js
7
Bloom.js
|
@ -1,6 +1,3 @@
|
|||
require('classtool');
|
||||
|
||||
function ClassSpec(b) {
|
||||
var MAX_BLOOM_FILTER_SIZE = 36000; // bytes
|
||||
var MAX_HASH_FUNCS = 50;
|
||||
var LN2SQUARED = 0.4804530139182014246671025263266649717305529515945455;
|
||||
|
@ -110,7 +107,5 @@ function ClassSpec(b) {
|
|||
MAX_HASH_FUNCS);
|
||||
};
|
||||
|
||||
return Bloom;
|
||||
};
|
||||
module.defineClass(ClassSpec);
|
||||
|
||||
module.exports = require('soop')(Bloom);
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function spec(b) {
|
||||
var config = b.config || require('./config');
|
||||
var log = b.log || require('./util/log');
|
||||
var network = b.network || require('./networks')[config.network];
|
||||
var config = imports.config || require('./config');
|
||||
var log = imports.log || require('./util/log');
|
||||
var network = imports.network || require('./networks')[config.network];
|
||||
|
||||
var MAX_RECEIVE_BUFFER = 10000000;
|
||||
var PROTOCOL_VERSION = 70000;
|
||||
|
||||
var Binary = b.Binary || require('binary');
|
||||
var Put = b.Put || require('bufferput');
|
||||
var Buffers = b.Buffers || require('buffers');
|
||||
var Binary = imports.Binary || require('binary');
|
||||
var Put = imports.Put || require('bufferput');
|
||||
var Buffers = imports.Buffers || require('buffers');
|
||||
require('./Buffers.monkey').patch(Buffers);
|
||||
var noop = function() {};
|
||||
var Block = require('./Block').class();
|
||||
var Transaction = require('./Transaction').class();
|
||||
var util = b.util || require('./util/util');
|
||||
var Parser = b.Parser || require('./util/BinaryParser').class();
|
||||
var buffertools = b.buffertools || require('buffertools');
|
||||
var doubleSha256 = b.doubleSha256 || util.twoSha256;
|
||||
|
||||
var Block = require('./Block');
|
||||
var Transaction = require('./Transaction');
|
||||
var util = imports.util || require('./util/util');
|
||||
var Parser = imports.Parser || require('./util/BinaryParser');
|
||||
var buffertools = imports.buffertools || require('buffertools');
|
||||
var doubleSha256 = imports.doubleSha256 || util.twoSha256;
|
||||
var nonce = util.generateNonce();
|
||||
|
||||
var BIP0031_VERSION = 60000;
|
||||
|
@ -53,7 +52,7 @@ function spec(b) {
|
|||
|
||||
this.setupHandlers();
|
||||
}
|
||||
Connection.superclass = b.superclass || require('events').EventEmitter;
|
||||
Connection.parent = imports.parent || require('events').EventEmitter;
|
||||
|
||||
Connection.prototype.setupHandlers = function () {
|
||||
this.socket.addListener('connect', this.handleConnect.bind(this));
|
||||
|
@ -542,6 +541,4 @@ function spec(b) {
|
|||
return data;
|
||||
};
|
||||
|
||||
return Connection;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
module.exports = require('soop')(Connection);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function spec(b) {
|
||||
function Opcode(num) {
|
||||
this.code = num;
|
||||
};
|
||||
|
@ -156,6 +155,4 @@ function spec(b) {
|
|||
}
|
||||
}
|
||||
|
||||
return Opcode;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
module.exports = require('soop')(Opcode);
|
||||
|
|
13
Peer.js
13
Peer.js
|
@ -1,9 +1,8 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function spec(b) {
|
||||
var Net = b.Net || require('net');
|
||||
var Binary = b.Binary || require('binary');
|
||||
var buffertools = b.buffertools || require('buffertools');
|
||||
var Net = imports.Net || require('net');
|
||||
var Binary = imports.Binary || require('binary');
|
||||
var buffertools = imports.buffertools || require('buffertools');
|
||||
|
||||
function Peer(host, port, services) {
|
||||
if ("string" === typeof host) {
|
||||
|
@ -56,6 +55,4 @@ function spec(b) {
|
|||
return put.buffer();
|
||||
};
|
||||
|
||||
return Peer;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
module.exports = require('soop')(Peer);
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
require('classtool');
|
||||
|
||||
function spec(b) {
|
||||
var config = b.config || require('./config');
|
||||
var log = b.log || require('./util/log');
|
||||
var network = b.network || require('./networks')[config.network];
|
||||
var Connection = b.Connection || require('./Connection').createClass(
|
||||
{config: config, network: network});
|
||||
var Peer = b.Peer || require('./Peer').class();
|
||||
var noop = function() {};
|
||||
var imports = require('soop').imports();
|
||||
var config = imports.config || require('./config');
|
||||
var log = imports.log || require('./util/log');
|
||||
var network = imports.network || require('./networks')[config.network];
|
||||
var Connection = imports.Connection ||
|
||||
require('soop').load('./Connection', {config: config, network: network});
|
||||
|
||||
GetAdjustedTime = b.GetAdjustedTime || function () {
|
||||
var Peer = imports.Peer || require('./Peer');
|
||||
|
||||
GetAdjustedTime = imports.GetAdjustedTime || function () {
|
||||
// TODO: Implement actual adjustment
|
||||
return Math.floor(new Date().getTime() / 1000);
|
||||
};
|
||||
|
@ -28,8 +27,8 @@ function spec(b) {
|
|||
this.minConnections = 8;
|
||||
this.minKnownPeers = 10;
|
||||
};
|
||||
PeerManager.superclass = b.superclass || require('events').EventEmitter;
|
||||
|
||||
PeerManager.parent = imports.parent || require('events').EventEmitter;
|
||||
PeerManager.Connection = Connection;
|
||||
|
||||
PeerManager.prototype.start = function() {
|
||||
|
@ -210,6 +209,4 @@ function spec(b) {
|
|||
return this.connections.slice(0);
|
||||
};
|
||||
|
||||
return PeerManager;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
module.exports = require('soop')(PeerManager);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function ClassSpec(b) {
|
||||
var superclass = b.superclass || require('./util/VersionedData').class();
|
||||
var parent = imports.parent || require('./util/VersionedData');
|
||||
|
||||
//compressed is true if public key is compressed; false otherwise
|
||||
function PrivateKey(version, buf, compressed) {
|
||||
|
@ -10,8 +9,8 @@ function ClassSpec(b) {
|
|||
this.compressed(compressed);
|
||||
};
|
||||
|
||||
PrivateKey.superclass = superclass;
|
||||
superclass.applyEncodingsTo(PrivateKey);
|
||||
PrivateKey.parent = parent;
|
||||
parent.applyEncodingsTo(PrivateKey);
|
||||
|
||||
PrivateKey.prototype.validate = function() {
|
||||
this.doAsBinary(function() {
|
||||
|
@ -62,6 +61,4 @@ function ClassSpec(b) {
|
|||
}
|
||||
};
|
||||
|
||||
return PrivateKey;
|
||||
};
|
||||
module.defineClass(ClassSpec);
|
||||
module.exports = require('soop')(PrivateKey);
|
||||
|
|
16
RpcClient.js
16
RpcClient.js
|
@ -1,12 +1,11 @@
|
|||
// RpcClient.js
|
||||
// MIT/X11-like license. See LICENSE.txt.
|
||||
// Copyright 2013 BitPay, Inc.
|
||||
require('classtool');
|
||||
|
||||
function ClassSpec(b) {
|
||||
var http = b.http || require('http');
|
||||
var https = b.https || require('https');
|
||||
var log = b.log || require('./util/log');
|
||||
//
|
||||
var imports = require('soop').imports();
|
||||
var http = imports.http || require('http');
|
||||
var https = imports.https || require('https');
|
||||
var log = imports.log || require('./util/log');
|
||||
|
||||
function RpcClient(opts) {
|
||||
opts = opts || {};
|
||||
|
@ -204,7 +203,6 @@ function ClassSpec(b) {
|
|||
};
|
||||
|
||||
generateRPCMethods(RpcClient, callspec, rpc);
|
||||
return RpcClient;
|
||||
};
|
||||
module.defineClass(ClassSpec);
|
||||
|
||||
module.exports = require('soop')(RpcClient);
|
||||
|
||||
|
|
15
SIN.js
15
SIN.js
|
@ -1,8 +1,5 @@
|
|||
require('classtool');
|
||||
|
||||
function ClassSpec(b) {
|
||||
var superclass = b.superclass || require('./util/VersionedData').class();
|
||||
|
||||
var imports = require('soop').imports();
|
||||
var parent = imports.parent || require('./util/VersionedData');
|
||||
|
||||
function SIN(type, payload) {
|
||||
if (typeof type != 'number') {
|
||||
|
@ -15,8 +12,8 @@ function ClassSpec(b) {
|
|||
this.type(type);
|
||||
this.payload(payload);
|
||||
};
|
||||
SIN.superclass = superclass;
|
||||
superclass.applyEncodingsTo(SIN);
|
||||
SIN.parent = parent;
|
||||
parent.applyEncodingsTo(SIN);
|
||||
|
||||
SIN.SIN_PERSIST_MAINNET = 0x01; // associated with sacrifice TX
|
||||
SIN.SIN_PERSIST_TESTNET = 0x11; // associated with sacrifice TX
|
||||
|
@ -55,6 +52,4 @@ function ClassSpec(b) {
|
|||
if (this.data.length != 22) throw new Error('invalid data length');
|
||||
});
|
||||
};
|
||||
return SIN;
|
||||
};
|
||||
module.defineClass(ClassSpec);
|
||||
module.exports = require('soop')(SIN);
|
||||
|
|
10
SINKey.js
10
SINKey.js
|
@ -1,10 +1,7 @@
|
|||
require('classtool');
|
||||
|
||||
function ClassSpec(b) {
|
||||
var coinUtil = require('./util/util');
|
||||
var timeUtil = require('./util/time');
|
||||
var KeyModule = require('./Key');
|
||||
var SIN = require('./SIN').class();
|
||||
var SIN = require('./SIN');
|
||||
|
||||
function SINKey(cfg) {
|
||||
if (typeof cfg != 'object')
|
||||
|
@ -37,7 +34,4 @@ function ClassSpec(b) {
|
|||
return obj;
|
||||
};
|
||||
|
||||
return SINKey;
|
||||
};
|
||||
module.defineClass(ClassSpec);
|
||||
|
||||
module.exports = require('soop')(SINKey);
|
||||
|
|
26
Script.js
26
Script.js
|
@ -1,20 +1,17 @@
|
|||
require('classtool');
|
||||
|
||||
function spec(b) {
|
||||
var config = b.config || require('./config');
|
||||
var log = b.log || require('./util/log');
|
||||
|
||||
var Opcode = b.Opcode || require('./Opcode').class();
|
||||
var buffertools = b.buffertools || require('buffertools');
|
||||
var imports = require('soop').imports();
|
||||
var config = imports.config || require('./config');
|
||||
var log = imports.log || require('./util/log');
|
||||
var Opcode = imports.Opcode || require('./Opcode');
|
||||
var buffertools = imports.buffertools || require('buffertools');
|
||||
|
||||
// Make opcodes available as pseudo-constants
|
||||
for (var i in Opcode.map) {
|
||||
eval(i + " = " + Opcode.map[i] + ";");
|
||||
eval(i + ' = ' + Opcode.map[i] + ';');
|
||||
}
|
||||
|
||||
var util = b.util || require('./util/util');
|
||||
var Parser = b.Parser || require('./util/BinaryParser').class();
|
||||
var Put = b.Put || require('bufferput');
|
||||
var util = imports.util || require('./util/util');
|
||||
var Parser = imports.Parser || require('./util/BinaryParser');
|
||||
var Put = imports.Put || require('bufferput');
|
||||
|
||||
var TX_UNKNOWN = 0;
|
||||
var TX_PUBKEY = 1;
|
||||
|
@ -517,7 +514,4 @@ function spec(b) {
|
|||
return buf.buffer();
|
||||
};
|
||||
|
||||
return Script;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
|
||||
module.exports = require('soop')(Script);
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function spec(b) {
|
||||
var assert = require('assert');
|
||||
var config = b.config || require('./config');
|
||||
var log = b.log || require('./util/log');
|
||||
|
||||
var Opcode = b.Opcode || require('./Opcode').class();
|
||||
var buffertools = b.buffertools || require('buffertools');
|
||||
var config = imports.config || require('./config');
|
||||
var log = imports.log || require('./util/log');
|
||||
var Opcode = imports.Opcode || require('./Opcode');
|
||||
var buffertools = imports.buffertools || require('buffertools');
|
||||
|
||||
// Make opcodes available as pseudo-constants
|
||||
for (var i in Opcode.map) {
|
||||
eval(i + " = " + Opcode.map[i] + ";");
|
||||
}
|
||||
|
||||
var bignum = b.bignum || require('bignum');
|
||||
var Util = b.Util || require('./util/util');
|
||||
var Script = require('./Script').class();
|
||||
var bignum = imports.bignum || require('bignum');
|
||||
var Util = imports.Util || require('./util/util');
|
||||
var Script = require('./Script');
|
||||
|
||||
function ScriptInterpreter() {
|
||||
this.stack = [];
|
||||
|
@ -1028,6 +1026,4 @@ function spec(b) {
|
|||
}
|
||||
};
|
||||
|
||||
return ScriptInterpreter;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
module.exports = require('soop')(ScriptInterpreter);
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function spec(b) {
|
||||
var config = b.config || require('./config');
|
||||
var log = b.log || require('./util/log');
|
||||
var Address = b.Address || require('./Address').class();
|
||||
var Script = b.Script || require('./Script').class();
|
||||
var ScriptInterpreter = b.ScriptInterpreter || require('./ScriptInterpreter').class();
|
||||
var util = b.util || require('./util/util');
|
||||
var bignum = b.bignum || require('bignum');
|
||||
var Put = b.Put || require('bufferput');
|
||||
var Parser = b.Parser || require('./util/BinaryParser').class();
|
||||
var Step = b.Step || require('step');
|
||||
var buffertools = b.buffertools || require('buffertools');
|
||||
|
||||
var error = b.error || require('./util/error');
|
||||
var config = imports.config || require('./config');
|
||||
var log = imports.log || require('./util/log');
|
||||
var Address = imports.Address || require('./Address');
|
||||
var Script = imports.Script || require('./Script');
|
||||
var ScriptInterpreter = imports.ScriptInterpreter || require('./ScriptInterpreter');
|
||||
var util = imports.util || require('./util/util');
|
||||
var bignum = imports.bignum || require('bignum');
|
||||
var Put = imports.Put || require('bufferput');
|
||||
var Parser = imports.Parser || require('./util/BinaryParser');
|
||||
var Step = imports.Step || require('step');
|
||||
var buffertools = imports.buffertools || require('buffertools');
|
||||
var error = imports.error || require('./util/error');
|
||||
var VerificationError = error.VerificationError;
|
||||
var MissingSourceError = error.MissingSourceError;
|
||||
|
||||
|
@ -811,6 +809,4 @@ function spec(b) {
|
|||
}
|
||||
};
|
||||
|
||||
return Transaction;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
module.exports = require('soop')(Transaction);
|
||||
|
|
12
Wallet.js
12
Wallet.js
|
@ -1,12 +1,12 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
var hex = function(hex) {return new Buffer(hex, 'hex');};
|
||||
|
||||
function ClassSpec(b) {
|
||||
var fs = require('fs');
|
||||
var EncFile = require('./util/EncFile');
|
||||
var Address = require('./Address').class();
|
||||
var Address = require('./Address');
|
||||
var networks = require('./networks');
|
||||
var util = b.util || require('./util/util');
|
||||
var util = imports.util || require('./util/util');
|
||||
var ENC_METHOD = 'aes-256-cbc';
|
||||
|
||||
var skeleton = {
|
||||
|
@ -136,7 +136,5 @@ function ClassSpec(b) {
|
|||
return addrStr;
|
||||
};
|
||||
|
||||
return Wallet;
|
||||
};
|
||||
module.defineClass(ClassSpec);
|
||||
module.exports = require('soop')(Wallet);
|
||||
|
||||
|
|
11
WalletKey.js
11
WalletKey.js
|
@ -1,11 +1,10 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function ClassSpec(b) {
|
||||
var coinUtil = require('./util/util');
|
||||
var timeUtil = require('./util/time');
|
||||
var KeyModule = require('./Key');
|
||||
var PrivateKey = require('./PrivateKey').class();
|
||||
var Address = require('./Address').class();
|
||||
var PrivateKey = require('./PrivateKey');
|
||||
var Address = require('./Address');
|
||||
|
||||
function WalletKey(cfg) {
|
||||
if (!cfg) cfg = {};
|
||||
|
@ -50,6 +49,4 @@ function ClassSpec(b) {
|
|||
this.privKey.regenerateSync();
|
||||
};
|
||||
|
||||
return WalletKey;
|
||||
};
|
||||
module.defineClass(ClassSpec);
|
||||
module.exports = require('soop')(WalletKey);
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('Address', function() {
|
|||
should.exist(AddressModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Address = AddressModule.class();
|
||||
Address = AddressModule;
|
||||
should.exist(Address);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -12,7 +12,7 @@ describe('Block', function() {
|
|||
should.exist(BlockModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Block = BlockModule.class();
|
||||
Block = BlockModule;
|
||||
should.exist(Block);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('Bloom', function() {
|
|||
should.exist(BloomModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Bloom = BloomModule.class();
|
||||
Bloom = BloomModule;
|
||||
should.exist(Bloom);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('Connection', function() {
|
|||
should.exist(ConnectionModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Connection = ConnectionModule.class();
|
||||
Connection = ConnectionModule;
|
||||
should.exist(Connection);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('EncodedData', function() {
|
|||
should.exist(EncodedDataModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
EncodedData = EncodedDataModule.class();
|
||||
EncodedData = EncodedDataModule;
|
||||
should.exist(EncodedData);
|
||||
});
|
||||
it('should be able to create an instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('Opcode', function() {
|
|||
should.exist(OpcodeModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Opcode = OpcodeModule.class();
|
||||
Opcode = OpcodeModule;
|
||||
should.exist(Opcode);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('Peer', function() {
|
|||
should.exist(PeerModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Peer = PeerModule.class();
|
||||
Peer = PeerModule;
|
||||
should.exist(Peer);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('PeerManager', function() {
|
|||
should.exist(PeerManagerModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
PeerManager = PeerManagerModule.class();
|
||||
PeerManager = PeerManagerModule;
|
||||
should.exist(PeerManager);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -15,7 +15,7 @@ describe('PrivateKey', function() {
|
|||
should.exist(PrivateKeyModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
PrivateKey = PrivateKeyModule.class();
|
||||
PrivateKey = PrivateKeyModule;
|
||||
should.exist(PrivateKey);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -7,7 +7,7 @@ var should = chai.should();
|
|||
|
||||
var RpcClientModule = bitcore.RpcClient;
|
||||
var RpcClient;
|
||||
RpcClient = RpcClientModule.class();
|
||||
RpcClient = RpcClientModule;
|
||||
|
||||
describe('RpcClient', function() {
|
||||
it('should initialze the main object', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('SIN', function() {
|
|||
should.exist(SINModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
SIN = SINModule.class();
|
||||
SIN = SINModule;
|
||||
should.exist(SIN);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -16,7 +16,7 @@ describe('SINKey', function() {
|
|||
should.exist(SINKeyModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
SINKey = SINKeyModule.class();
|
||||
SINKey = SINKeyModule;
|
||||
should.exist(SINKey);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -6,7 +6,7 @@ var bitcore = require('../bitcore');
|
|||
var should = chai.should();
|
||||
|
||||
var ScriptModule = bitcore.Script;
|
||||
var Address = bitcore.Address.class();
|
||||
var Address = bitcore.Address;
|
||||
var networks = bitcore.networks;
|
||||
var Script;
|
||||
|
||||
|
@ -15,7 +15,7 @@ describe('Script', function() {
|
|||
should.exist(ScriptModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Script = ScriptModule.class();
|
||||
Script = ScriptModule;
|
||||
should.exist(Script);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('ScriptInterpreter', function() {
|
|||
should.exist(ScriptInterpreterModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
ScriptInterpreter = ScriptInterpreterModule.class();
|
||||
ScriptInterpreter = ScriptInterpreterModule;
|
||||
should.exist(ScriptInterpreter);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('Transaction', function() {
|
|||
should.exist(TransactionModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Transaction = TransactionModule.class();
|
||||
Transaction = TransactionModule;
|
||||
should.exist(Transaction);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('VersionedData', function() {
|
|||
should.exist(VersionedDataModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
VersionedData = VersionedDataModule.class();
|
||||
VersionedData = VersionedDataModule;
|
||||
should.exist(VersionedData);
|
||||
});
|
||||
it('should be able to create an instance', function() {
|
||||
|
|
|
@ -13,7 +13,7 @@ describe('Wallet', function() {
|
|||
should.exist(WalletModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
Wallet = WalletModule.class();
|
||||
Wallet = WalletModule;
|
||||
should.exist(Wallet);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('WalletKey', function() {
|
|||
should.exist(WalletKeyModule);
|
||||
});
|
||||
it('should be able to create class', function() {
|
||||
WalletKey = WalletKeyModule.class();
|
||||
WalletKey = WalletKeyModule;
|
||||
should.exist(WalletKey);
|
||||
});
|
||||
it('should be able to create instance', function() {
|
||||
|
|
|
@ -4,8 +4,8 @@ var chai = require('chai');
|
|||
var bitcore = require('../bitcore');
|
||||
var should = chai.should();
|
||||
|
||||
var Address = bitcore.Address.class();
|
||||
var PrivateKey = bitcore.PrivateKey.class();
|
||||
var Address = bitcore.Address;
|
||||
var PrivateKey = bitcore.PrivateKey;
|
||||
var networks = bitcore.networks;
|
||||
var KeyModule = bitcore.KeyModule;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Simple synchronous parser based on node-binary.
|
||||
*/
|
||||
|
||||
function spec(b) {
|
||||
var imports = require('soop').imports();
|
||||
function Parser(buffer)
|
||||
{
|
||||
this.subject = buffer;
|
||||
|
@ -143,6 +143,4 @@ function spec(b) {
|
|||
return this.buffer(len);
|
||||
};
|
||||
|
||||
return Parser;
|
||||
};
|
||||
module.defineClass(spec);
|
||||
module.exports = require('soop')(Parser);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require('classtool');
|
||||
var imports = require('soop').imports();
|
||||
var base58 = imports.base58 || require('base58-native').base58Check;
|
||||
|
||||
function ClassSpec(b) {
|
||||
var base58 = b.base58 || require('base58-native').base58Check;
|
||||
|
||||
// Constructor. Takes the following forms:
|
||||
// new EncodedData(<base58_address_string>)
|
||||
|
@ -154,6 +153,6 @@ function ClassSpec(b) {
|
|||
};
|
||||
|
||||
EncodedData.applyEncodingsTo(EncodedData);
|
||||
return EncodedData;
|
||||
}
|
||||
module.defineClass(ClassSpec);
|
||||
|
||||
module.exports = require('soop')(EncodedData);
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require('classtool');
|
||||
|
||||
function ClassSpec(b) {
|
||||
var superclass = b.superclass || require('./EncodedData').class();
|
||||
var imports = require('soop').imports();
|
||||
var base58 = imports.base58 || require('base58-native').base58Check;
|
||||
var superclass = imports.parent || require('./EncodedData');
|
||||
|
||||
function VersionedData(version, payload) {
|
||||
if(typeof version != 'number') {
|
||||
|
@ -13,7 +12,8 @@ function ClassSpec(b) {
|
|||
this.version(version);
|
||||
this.payload(payload);
|
||||
};
|
||||
VersionedData.superclass = superclass;
|
||||
|
||||
VersionedData.parent = superclass || require('./Person');
|
||||
superclass.applyEncodingsTo(VersionedData);
|
||||
|
||||
// get or set the version data (the first byte of the address)
|
||||
|
@ -34,6 +34,4 @@ function ClassSpec(b) {
|
|||
return this.as('binary').slice(1);
|
||||
};
|
||||
|
||||
return VersionedData;
|
||||
};
|
||||
module.defineClass(ClassSpec);
|
||||
module.exports = require('soop')(VersionedData);
|
||||
|
|
Loading…
Reference in New Issue