|
|
@ -1,5 +1,26 @@ |
|
|
|
var bitcore = module.exports; |
|
|
|
|
|
|
|
// module information
|
|
|
|
bitcore.version = 'v'+require('./package.json').version; |
|
|
|
|
|
|
|
var inBrowser = typeof process === 'undefined' || typeof process.versions === 'undefined'; |
|
|
|
if ((inBrowser && window._bitcore) || (!inBrowser && global._bitcore)) { |
|
|
|
var versions = bitcore.version + ' and ' + inBrowser ? window._bitcore : global._bitcore; |
|
|
|
var message = 'More than one instance of bitcore found with different versions: ' + versions; |
|
|
|
if (inBrowser) { |
|
|
|
message += '. Make sure any scripts included don\'t contain their own bitcore bundle.'; |
|
|
|
} else { |
|
|
|
message += '. Make sure there are no version conflicts between package.json files of your ' |
|
|
|
+ 'dependencies. This could also happen when a package depends on a git repository.'; |
|
|
|
} |
|
|
|
|
|
|
|
throw new Error(message); |
|
|
|
} |
|
|
|
if (inBrowser) { |
|
|
|
window._bitcore = bitcore.version; |
|
|
|
} else { |
|
|
|
global._bitcore = bitcore.version; |
|
|
|
} |
|
|
|
|
|
|
|
// crypto
|
|
|
|
bitcore.crypto = {}; |
|
|
@ -54,6 +75,3 @@ bitcore.deps._ = require('lodash'); |
|
|
|
// Internal usage, exposed for testing/advanced tweaking
|
|
|
|
bitcore._HDKeyCache = require('./lib/hdkeycache'); |
|
|
|
bitcore.Transaction.sighash = require('./lib/transaction/sighash'); |
|
|
|
|
|
|
|
// module information
|
|
|
|
bitcore.version = 'v'+require('./package.json').version; |
|
|
|