flocore/bitcore.js
Ryan X. Charles 05f6e28642 update interface, bitcore.KeyModule.Key -> bitcore.Key
It's annoying and easy to forget to type in bitcore.KeyModule.Key. I have
updated this so that now you can just do bitcore.Key. Tests pass in node and
the browser. This is a backwards-incompatible change so all software that
depends on the old style key generation will need to be updated.
2014-03-13 13:31:02 -04:00

48 lines
1.9 KiB
JavaScript

/*
One way to require files is this simple way:
module.exports.Address = require('./Address');
However, that will load all classes in memory even if they are not used.
Instead, we can set the 'get' property of each class to only require them when
they are accessed, saving memory if they are not used in a given project.
*/
var requireWhenAccessed = function(name, file) {
Object.defineProperty(module.exports, name, {get: function() {return require(file)}});
};
requireWhenAccessed('bignum', 'bignum');
requireWhenAccessed('base58', 'base58-native');
requireWhenAccessed('buffertools', 'buffertools');
requireWhenAccessed('config', './config');
requireWhenAccessed('const', './const');
requireWhenAccessed('Deserialize', './Deserialize');
requireWhenAccessed('log', './util/log');
requireWhenAccessed('networks', './networks');
requireWhenAccessed('util', './util/util');
requireWhenAccessed('EncodedData', './util/EncodedData');
requireWhenAccessed('VersionedData', './util/VersionedData');
requireWhenAccessed('Address', './Address');
requireWhenAccessed('Opcode', './Opcode');
requireWhenAccessed('Script', './Script');
requireWhenAccessed('Transaction', './Transaction');
requireWhenAccessed('Connection', './Connection');
requireWhenAccessed('Peer', './Peer');
requireWhenAccessed('Block', './Block');
requireWhenAccessed('ScriptInterpreter', './ScriptInterpreter');
requireWhenAccessed('Bloom', './Bloom');
requireWhenAccessed('Key', './Key');
requireWhenAccessed('SINKey', './SINKey');
requireWhenAccessed('SIN', './SIN');
requireWhenAccessed('PrivateKey', './PrivateKey');
requireWhenAccessed('RpcClient', './RpcClient');
requireWhenAccessed('Wallet', './Wallet');
requireWhenAccessed('WalletKey', './WalletKey');
requireWhenAccessed('PeerManager', './PeerManager');
module.exports.Buffer = Buffer;
if (typeof process.versions === 'undefined') {
// Browser specific
module.exports.bignum.config({EXPONENTIAL_AT: 9999999, DECIMAL_PLACES: 0, ROUNDING_MODE: 1});
}