96 changed files with 8119 additions and 61604 deletions
@ -0,0 +1,3 @@ |
|||||
|
{ |
||||
|
"presets": ["env"] |
||||
|
} |
@ -1,36 +0,0 @@ |
|||||
{ |
|
||||
"tags": { |
|
||||
"allowUnknownTags": true |
|
||||
}, |
|
||||
"source": { |
|
||||
"include": ["docs/README.md"], |
|
||||
"exclude": [], |
|
||||
"includePattern": "lib/.+\\.js(doc)?$", |
|
||||
"excludePattern": "(^|\\/|\\\\)_" |
|
||||
}, |
|
||||
"plugins": ["plugins/markdown"], |
|
||||
"templates": { |
|
||||
"cleverLinks": false, |
|
||||
"monospaceLinks": false |
|
||||
}, |
|
||||
"opts": { |
|
||||
"template": "node_modules/ink-docstrap/template", |
|
||||
"encoding": "utf8", |
|
||||
"destination": "./apiref/", |
|
||||
"recurse": true, |
|
||||
"query": "value", |
|
||||
"private": true, |
|
||||
"lenient": true |
|
||||
}, |
|
||||
"templates": { |
|
||||
"systemName": "bitcore", |
|
||||
"copyright": "© 2013-2015, BitPay Inc.", |
|
||||
"navType": "vertical", |
|
||||
"theme": "journal", |
|
||||
"linenums": true, |
|
||||
"collapseSymbols": false, |
|
||||
"inverseNav": false, |
|
||||
"outputSourceFiles": true |
|
||||
} |
|
||||
|
|
||||
} |
|
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -1,5 +1,71 @@ |
|||||
|
/** |
||||
|
* @file gulpfile.js |
||||
|
* |
||||
|
* Defines tasks that can be run on gulp. |
||||
|
* |
||||
|
* Summary: |
||||
|
* <ul> |
||||
|
* <li> `test` - an alias for `test:mocha` |
||||
|
* <li> `test:mocha` - runs all the tests on node (mocha) |
||||
|
* <li> `test:karma` - runs all the tests in the browser (karma) |
||||
|
* <li> `build` - generate files needed for browser (browserify) |
||||
|
* <li> `build:tests` - generate files needed for testing in the browser |
||||
|
* <li> `lint` - run `jshint` |
||||
|
* <li> `coveralls` - updates coveralls info |
||||
|
* </ul> |
||||
|
*/ |
||||
|
|
||||
|
'use strict'; |
||||
|
|
||||
var bitcoreTasks = require('bitcore-build'); |
const gulp = require('gulp'); |
||||
|
const shell = require('gulp-shell'); |
||||
|
const npmPackage = require('./package.json'); |
||||
|
|
||||
bitcoreTasks('lib'); |
gulp.task( |
||||
|
'build', |
||||
|
shell.task([[ |
||||
|
'npx browserify index.js --s bitcoinCash -t [ babelify --presets [ env ] ]', '|', |
||||
|
`npx uglifyjs --comments -c -o dist/bitcoincashjs.${npmPackage.version}.min.js`, |
||||
|
].join(' ')]) |
||||
|
); |
||||
|
|
||||
|
gulp.task( |
||||
|
'build:tests', |
||||
|
shell.task([ |
||||
|
'find test/ -type f -name "*.js" | xargs npx browserify -t brfs -o build/tests.js' |
||||
|
]) |
||||
|
); |
||||
|
|
||||
|
gulp.task( |
||||
|
'test', |
||||
|
['test:mocha'] |
||||
|
); |
||||
|
|
||||
|
gulp.task( |
||||
|
'test:mocha', |
||||
|
shell.task([ |
||||
|
'npx nyc --reporter=html --reporter=text npx mocha', |
||||
|
]) |
||||
|
); |
||||
|
|
||||
|
gulp.task( |
||||
|
'test:karma', |
||||
|
['build:tests'], |
||||
|
shell.task([ |
||||
|
'npx karma start', |
||||
|
]) |
||||
|
); |
||||
|
|
||||
|
gulp.task( |
||||
|
'lint', |
||||
|
shell.task([ |
||||
|
'find index.js gulpfile.js src/ test/ -type f -name "*.js" | xargs npx jshint', |
||||
|
]) |
||||
|
); |
||||
|
|
||||
|
gulp.task( |
||||
|
'coveralls', |
||||
|
shell.task([ |
||||
|
'npx nyc report --reporter=text-lcov | npx coveralls', |
||||
|
]) |
||||
|
); |
||||
|
@ -1,69 +1,69 @@ |
|||||
'use strict'; |
'use strict'; |
||||
|
|
||||
var bitcore = module.exports; |
const bitcoinCash = module.exports; |
||||
|
|
||||
// module information
|
// module information
|
||||
bitcore.version = 'v' + require('./package.json').version; |
bitcoinCash.version = 'v' + require('./package.json').version; |
||||
bitcore.versionGuard = function(version) { |
bitcoinCash.versionGuard = function(version) { |
||||
if (version !== undefined) { |
if (version !== undefined) { |
||||
var message = 'More than one instance of bitcore-lib found. ' + |
const message = 'More than one instance of bitcoincashjs found. ' + |
||||
'Please make sure to require bitcore-lib and check that submodules do' + |
'Please make sure to require bitcoincashjs and check that submodules do' + |
||||
' not also include their own bitcore-lib dependency.'; |
' not also include their own bitcoincashjs dependency.'; |
||||
throw new Error(message); |
throw new Error(message); |
||||
} |
} |
||||
}; |
}; |
||||
bitcore.versionGuard(global._bitcoreCash); |
bitcoinCash.versionGuard(global._bitcoinCash); |
||||
global._bitcoreCash = bitcore.version; |
global._bitcoinCash = bitcoinCash.version; |
||||
|
|
||||
// crypto
|
// crypto
|
||||
bitcore.crypto = {}; |
bitcoinCash.crypto = {}; |
||||
bitcore.crypto.BN = require('./lib/crypto/bn'); |
bitcoinCash.crypto.BN = require('./src/crypto/bn'); |
||||
bitcore.crypto.ECDSA = require('./lib/crypto/ecdsa'); |
bitcoinCash.crypto.ECDSA = require('./src/crypto/ecdsa'); |
||||
bitcore.crypto.Hash = require('./lib/crypto/hash'); |
bitcoinCash.crypto.Hash = require('./src/crypto/hash'); |
||||
bitcore.crypto.Random = require('./lib/crypto/random'); |
bitcoinCash.crypto.Random = require('./src/crypto/random'); |
||||
bitcore.crypto.Point = require('./lib/crypto/point'); |
bitcoinCash.crypto.Point = require('./src/crypto/point'); |
||||
bitcore.crypto.Signature = require('./lib/crypto/signature'); |
bitcoinCash.crypto.Signature = require('./src/crypto/signature'); |
||||
|
|
||||
// encoding
|
// encoding
|
||||
bitcore.encoding = {}; |
bitcoinCash.encoding = {}; |
||||
bitcore.encoding.Base58 = require('./lib/encoding/base58'); |
bitcoinCash.encoding.Base58 = require('./src/encoding/base58'); |
||||
bitcore.encoding.Base58Check = require('./lib/encoding/base58check'); |
bitcoinCash.encoding.Base58Check = require('./src/encoding/base58check'); |
||||
bitcore.encoding.BufferReader = require('./lib/encoding/bufferreader'); |
bitcoinCash.encoding.BufferReader = require('./src/encoding/bufferreader'); |
||||
bitcore.encoding.BufferWriter = require('./lib/encoding/bufferwriter'); |
bitcoinCash.encoding.BufferWriter = require('./src/encoding/bufferwriter'); |
||||
bitcore.encoding.Varint = require('./lib/encoding/varint'); |
bitcoinCash.encoding.Varint = require('./src/encoding/varint'); |
||||
|
|
||||
// utilities
|
// utilities
|
||||
bitcore.util = {}; |
bitcoinCash.util = {}; |
||||
bitcore.util.buffer = require('./lib/util/buffer'); |
bitcoinCash.util.buffer = require('./src/util/buffer'); |
||||
bitcore.util.js = require('./lib/util/js'); |
bitcoinCash.util.js = require('./src/util/js'); |
||||
bitcore.util.preconditions = require('./lib/util/preconditions'); |
bitcoinCash.util.preconditions = require('./src/util/preconditions'); |
||||
|
|
||||
// errors thrown by the library
|
// errors thrown by the library
|
||||
bitcore.errors = require('./lib/errors'); |
bitcoinCash.errors = require('./src/errors'); |
||||
|
|
||||
// main bitcoin library
|
// main bitcoin library
|
||||
bitcore.Address = require('./lib/address'); |
bitcoinCash.Address = require('./src/address'); |
||||
bitcore.Block = require('./lib/block'); |
bitcoinCash.Block = require('./src/block'); |
||||
bitcore.MerkleBlock = require('./lib/block/merkleblock'); |
bitcoinCash.MerkleBlock = require('./src/block/merkleblock'); |
||||
bitcore.BlockHeader = require('./lib/block/blockheader'); |
bitcoinCash.BlockHeader = require('./src/block/blockheader'); |
||||
bitcore.HDPrivateKey = require('./lib/hdprivatekey.js'); |
bitcoinCash.HDPrivateKey = require('./src/hdprivatekey.js'); |
||||
bitcore.HDPublicKey = require('./lib/hdpublickey.js'); |
bitcoinCash.HDPublicKey = require('./src/hdpublickey.js'); |
||||
bitcore.Networks = require('./lib/networks'); |
bitcoinCash.Networks = require('./src/networks'); |
||||
bitcore.Opcode = require('./lib/opcode'); |
bitcoinCash.Opcode = require('./src/opcode'); |
||||
bitcore.PrivateKey = require('./lib/privatekey'); |
bitcoinCash.PrivateKey = require('./src/privatekey'); |
||||
bitcore.PublicKey = require('./lib/publickey'); |
bitcoinCash.PublicKey = require('./src/publickey'); |
||||
bitcore.Script = require('./lib/script'); |
bitcoinCash.Script = require('./src/script'); |
||||
bitcore.Transaction = require('./lib/transaction'); |
bitcoinCash.Transaction = require('./src/transaction'); |
||||
bitcore.URI = require('./lib/uri'); |
bitcoinCash.URI = require('./src/uri'); |
||||
bitcore.Unit = require('./lib/unit'); |
bitcoinCash.Unit = require('./src/unit'); |
||||
|
|
||||
// dependencies, subject to change
|
// dependencies, subject to change
|
||||
bitcore.deps = {}; |
bitcoinCash.deps = {}; |
||||
bitcore.deps.bnjs = require('bn.js'); |
bitcoinCash.deps.bnjs = require('bn.js'); |
||||
bitcore.deps.bs58 = require('bs58'); |
bitcoinCash.deps.bs58 = require('bs58'); |
||||
bitcore.deps.Buffer = Buffer; |
bitcoinCash.deps.Buffer = Buffer; |
||||
bitcore.deps.elliptic = require('elliptic'); |
bitcoinCash.deps.elliptic = require('elliptic'); |
||||
bitcore.deps._ = require('lodash'); |
bitcoinCash.deps._ = require('lodash'); |
||||
|
|
||||
// Internal usage, exposed for testing/advanced tweaking
|
// Internal usage, exposed for testing/advanced tweaking
|
||||
bitcore.Transaction.sighash = require('./lib/transaction/sighash'); |
bitcoinCash.Transaction.sighash = require('./src/transaction/sighash'); |
||||
|
File diff suppressed because it is too large
@ -1,16 +1,16 @@ |
|||||
'use strict'; |
'use strict'; |
||||
|
|
||||
var should = require('chai').should(); |
var should = require('chai').should(); |
||||
var bitcore = require('../'); |
var bitcoinCash = require('..'); |
||||
|
|
||||
describe('#versionGuard', function() { |
describe('#versionGuard', function() { |
||||
it('global._bitcore should be defined', function() { |
it('global._bitcore should be defined', function() { |
||||
should.equal(global._bitcoreCash, bitcore.version); |
should.equal(global._bitcoinCash, bitcoinCash.version); |
||||
}); |
}); |
||||
|
|
||||
it('throw an error if version is already defined', function() { |
it('throw an error if version is already defined', function() { |
||||
(function() { |
(function() { |
||||
bitcore.versionGuard('version'); |
bitcoinCash.versionGuard('version'); |
||||
}).should.throw('More than one instance of bitcore'); |
}).should.throw('More than one instance of bitcoincashjs'); |
||||
}); |
}); |
||||
}); |
}); |
||||
|
Loading…
Reference in new issue