-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support soop with browser all test passing
- Loading branch information
Showing
32 changed files
with
228 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require('bignum').config({ | ||
EXPONENTIAL_AT: 9999999, | ||
DECIMAL_PLACES: 0, | ||
ROUNDING_MODE: 1, | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
'use strict'; | ||
|
||
/* | ||
* Example for usage of browserify with soop | ||
* | ||
* The key parameter 'pack' | ||
* The supplied 'custom_prelude.js' file is needed for | ||
* .load function of soop. | ||
*/ | ||
|
||
var fs = require('fs'); | ||
var browserify = require('browserify'); | ||
var browserPack = require('browser-pack'); | ||
var opts = {}; | ||
|
||
|
||
var preludePath = 'node_modules/soop/example/custom_prelude.js'; | ||
|
||
var pack = function (params) { | ||
params.raw = true; | ||
params.sourceMapPrefix = '//#'; | ||
params.prelude= fs.readFileSync(preludePath, 'utf8'); | ||
params.preludePath= preludePath; | ||
return browserPack(params); | ||
}; | ||
|
||
opts.pack = pack; | ||
opts.debug = true; | ||
|
||
var modules = [ | ||
'Address', | ||
'Block', | ||
'Bloom', | ||
'Buffers.monkey', | ||
'Connection', | ||
'Deserialize', | ||
'Gruntfile', | ||
'Number.monkey', | ||
'Opcode', | ||
'Peer', | ||
'PeerManager', | ||
'PrivateKey', | ||
'RpcClient', | ||
'SIN', | ||
'SINKey', | ||
'Script', | ||
'ScriptInterpreter', | ||
'Sign', | ||
'Transaction', | ||
'Wallet', | ||
'WalletKey', | ||
'config', | ||
'const', | ||
'networks', | ||
'bitcore', | ||
]; | ||
|
||
var b = browserify(opts); | ||
b.require('browserify-bignum/bignumber.js', {expose: 'bignum'} ); | ||
b.require('browserify-buffertools/buffertools.js', {expose:'buffertools'}); | ||
b.require('buffer', {expose: 'buffer'}); | ||
b.require('base58-native'); | ||
b.require('./Key.js', {expose: 'KeyModule'}); | ||
b.require('./util/log'); | ||
b.require('./util/util'); | ||
b.require('./util/EncodedData'); | ||
b.require('./util/VersionedData'); | ||
b.add('./browser/bignum_config.js'); | ||
|
||
modules.forEach(function(m) { | ||
b.require('./' + m + '.js' ,{expose:m} ); | ||
}); | ||
|
||
var bopts = { | ||
// detectGlobals: true, | ||
// insertGlobals: 'Buffer', | ||
// insertGlobalVars: { | ||
// Buffer: function () { | ||
// return 'require("buffer").Buffer'; | ||
// }, | ||
// }, | ||
}; | ||
|
||
b.bundle(bopts).pipe(process.stdout); | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.