From cb4f6e37a84e6f3b5ead1c113538d053a406834a Mon Sep 17 00:00:00 2001 From: Chris Clark Date: Wed, 13 May 2015 15:03:32 -0700 Subject: [PATCH] Remove src/cpp and clean up files --- .npmignore | 1 - Gulpfile.js | 14 +- deploy/start rippled.bat | 3 - package.json | 10 +- {bench => scripts}/modpow.js | 0 src/{js/ripple => }/account.js | 0 src/{js/ripple => }/amount.js | 0 src/{js/ripple => }/autobridgecalculator.js | 0 src/{js/ripple => }/base.js | 0 src/{js/ripple => }/baseconverter.js | 0 src/{js/ripple => }/binformat.js | 0 src/cpp/TransactionErr.cpp | 126 --------------- src/cpp/TransactionErr.h | 153 ------------------ src/{js/ripple => }/currency.js | 0 src/{js/ripple => }/hashprefixes.js | 0 src/{js/ripple => }/ieee754.js | 0 src/{js/ripple => }/index.js | 5 + src/{js/ripple => }/keypair.js | 0 src/{js/ripple => }/ledger.js | 0 src/{js/ripple => }/ledgerspaces.js | 0 src/{js/ripple => }/log.js | 0 src/{js/ripple => }/message.js | 0 src/{js/ripple => }/meta.js | 0 src/{js/ripple => }/orderbook.js | 0 src/{js/ripple => }/orderbookutils.js | 0 src/{js/ripple => }/pathfind.js | 0 src/{js/ripple => }/rangeset.js | 0 src/{js/ripple => }/remote.js | 0 src/{js/ripple => }/request.js | 0 src/{js/ripple => }/rippleerror.js | 0 src/{js/ripple => }/seed.js | 0 src/{js/ripple => }/serializedobject.js | 0 src/{js/ripple => }/serializedtypes.js | 0 src/{js/ripple => }/server.js | 0 src/{js/ripple => }/shamap.js | 0 src/{js => }/sjcl-custom/index.js | 0 .../sjcl-custom/sjcl-ecc-pointextras.js | 0 .../sjcl-custom/sjcl-ecdsa-canonical.js | 0 src/{js => }/sjcl-custom/sjcl-ecdsa-der.js | 0 .../sjcl-ecdsa-recoverablepublickey.js | 0 src/{js => }/sjcl-custom/sjcl-extramath.js | 0 src/{js => }/sjcl-custom/sjcl-jacobi.js | 0 src/{js => }/sjcl-custom/sjcl-montgomery.js | 0 src/{js => }/sjcl-custom/sjcl-ripemd160.js | 0 src/{js => }/sjcl-custom/sjcl-secp256k1.js | 0 src/{js => }/sjcl-custom/sjcl-validecc.js | 0 src/{js/ripple => }/transaction.js | 0 src/{js/ripple => }/transactionmanager.js | 0 src/{js/ripple => }/transactionqueue.js | 0 src/{js/ripple => }/uint.js | 0 src/{js/ripple => }/uint128.js | 0 src/{js/ripple => }/uint160.js | 0 src/{js/ripple => }/uint256.js | 0 src/{js/ripple => }/utils.js | 2 +- test/mocha.opts | 1 + test/node_modules/ripple-lib | 2 +- test/remote-test.js | 2 +- test/transaction-manager-test.js | 3 +- 58 files changed, 22 insertions(+), 300 deletions(-) delete mode 100644 deploy/start rippled.bat rename {bench => scripts}/modpow.js (100%) rename src/{js/ripple => }/account.js (100%) rename src/{js/ripple => }/amount.js (100%) rename src/{js/ripple => }/autobridgecalculator.js (100%) rename src/{js/ripple => }/base.js (100%) rename src/{js/ripple => }/baseconverter.js (100%) rename src/{js/ripple => }/binformat.js (100%) delete mode 100644 src/cpp/TransactionErr.cpp delete mode 100644 src/cpp/TransactionErr.h rename src/{js/ripple => }/currency.js (100%) rename src/{js/ripple => }/hashprefixes.js (100%) rename src/{js/ripple => }/ieee754.js (100%) rename src/{js/ripple => }/index.js (93%) rename src/{js/ripple => }/keypair.js (100%) rename src/{js/ripple => }/ledger.js (100%) rename src/{js/ripple => }/ledgerspaces.js (100%) rename src/{js/ripple => }/log.js (100%) rename src/{js/ripple => }/message.js (100%) rename src/{js/ripple => }/meta.js (100%) rename src/{js/ripple => }/orderbook.js (100%) rename src/{js/ripple => }/orderbookutils.js (100%) rename src/{js/ripple => }/pathfind.js (100%) rename src/{js/ripple => }/rangeset.js (100%) rename src/{js/ripple => }/remote.js (100%) rename src/{js/ripple => }/request.js (100%) rename src/{js/ripple => }/rippleerror.js (100%) rename src/{js/ripple => }/seed.js (100%) rename src/{js/ripple => }/serializedobject.js (100%) rename src/{js/ripple => }/serializedtypes.js (100%) rename src/{js/ripple => }/server.js (100%) rename src/{js/ripple => }/shamap.js (100%) rename src/{js => }/sjcl-custom/index.js (100%) rename src/{js => }/sjcl-custom/sjcl-ecc-pointextras.js (100%) rename src/{js => }/sjcl-custom/sjcl-ecdsa-canonical.js (100%) rename src/{js => }/sjcl-custom/sjcl-ecdsa-der.js (100%) rename src/{js => }/sjcl-custom/sjcl-ecdsa-recoverablepublickey.js (100%) rename src/{js => }/sjcl-custom/sjcl-extramath.js (100%) rename src/{js => }/sjcl-custom/sjcl-jacobi.js (100%) rename src/{js => }/sjcl-custom/sjcl-montgomery.js (100%) rename src/{js => }/sjcl-custom/sjcl-ripemd160.js (100%) rename src/{js => }/sjcl-custom/sjcl-secp256k1.js (100%) rename src/{js => }/sjcl-custom/sjcl-validecc.js (100%) rename src/{js/ripple => }/transaction.js (100%) rename src/{js/ripple => }/transactionmanager.js (100%) rename src/{js/ripple => }/transactionqueue.js (100%) rename src/{js/ripple => }/uint.js (100%) rename src/{js/ripple => }/uint128.js (100%) rename src/{js/ripple => }/uint160.js (100%) rename src/{js/ripple => }/uint256.js (100%) rename src/{js/ripple => }/utils.js (99%) create mode 100644 test/mocha.opts diff --git a/.npmignore b/.npmignore index ffb92eb1..928256a8 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,2 @@ -deploy lib-cov coverage.html diff --git a/Gulpfile.js b/Gulpfile.js index d1d649b0..0a694422 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -22,7 +22,7 @@ function logPluginError(error) { gulp.task('build', function(callback) { webpack({ cache: true, - entry: './src/js/ripple/index.js', + entry: './src/index.js', output: { library: 'ripple', path: './build/', @@ -41,7 +41,7 @@ gulp.task('build-min', ['build'], function() { gulp.task('build-debug', function(callback) { webpack({ cache: true, - entry: './src/js/ripple/index.js', + entry: './src/index.js', output: { library: 'ripple', path: './build/', @@ -66,7 +66,7 @@ function buildUseError(cons) { gulp.task('build-core', function(callback) { webpack({ entry: [ - './src/js/ripple/remote.js' + './src/remote.js' ], externals: [ { @@ -115,12 +115,12 @@ gulp.task('bower', ['bower-build', 'bower-build-min', 'bower-build-debug', 'bower-version']); gulp.task('watch', function() { - gulp.watch('src/js/ripple/*', ['build-debug']); + gulp.watch('src/*', ['build-debug']); }); // To use this, each javascript file must have /* @flow */ on the first line gulp.task('typecheck', function() { - return gulp.src('src/js/ripple/*.js') + return gulp.src('src/*.js') .pipe(flow({ // note: do not set the 'all' option, it is broken weak: true, // remove this after all errors are addressed killFlow: true @@ -128,8 +128,8 @@ gulp.task('typecheck', function() { }); gulp.task('strip', function() { - return gulp.src('src/js/ripple/*.js') - .pipe(watch('src/js/ripple/*.js')) + return gulp.src('src/*.js') + .pipe(watch('src/*.js')) .pipe(cleanDest('out')) // delete outdated output file before stripping .pipe(plumber()) // prevent an error in one file from ending build .pipe(react({stripTypes: true}).on('error', logPluginError)) diff --git a/deploy/start rippled.bat b/deploy/start rippled.bat deleted file mode 100644 index b23c09ad..00000000 --- a/deploy/start rippled.bat +++ /dev/null @@ -1,3 +0,0 @@ -start newcoin -sleep 4 -start index.html \ No newline at end of file diff --git a/package.json b/package.json index 50e92678..8c18cb4b 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "Makefile", "Gulpfile.js" ], - "main": "src/js/ripple", + "main": "src/", "directories": { "test": "test" }, @@ -47,11 +47,11 @@ "yargs": "~1.3.1" }, "scripts": { - "build": "node_modules/.bin/gulp", + "build": "gulp", "postinstall": "cd node_modules/sjcl; ./configure --with-all --compress=none; make", - "test": "./node_modules/.bin/istanbul test -x build/sjcl.js -x src/js/jsbn/* ./node_modules/mocha/bin/_mocha -- --reporter ${MOCHA_REPORTER:=spec} --timeout 10000 --slow 500 test/*-test.js", - "coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls", - "lint": "if ! [ -f eslintrc ]; then curl -o eslintrc 'https://raw.githubusercontent.com/ripple/javascript-style-guide/master/eslintrc'; fi; eslint --reset -c eslintrc src/js/ripple/*.js", + "test": "istanbul test _mocha", + "coveralls": "cat ./coverage/lcov.info | coveralls", + "lint": "if ! [ -f eslintrc ]; then curl -o eslintrc 'https://raw.githubusercontent.com/ripple/javascript-style-guide/master/eslintrc'; fi; eslint --reset -c eslintrc src/*.js", "perf": "./scripts/perf_test.sh" }, "repository": { diff --git a/bench/modpow.js b/scripts/modpow.js similarity index 100% rename from bench/modpow.js rename to scripts/modpow.js diff --git a/src/js/ripple/account.js b/src/account.js similarity index 100% rename from src/js/ripple/account.js rename to src/account.js diff --git a/src/js/ripple/amount.js b/src/amount.js similarity index 100% rename from src/js/ripple/amount.js rename to src/amount.js diff --git a/src/js/ripple/autobridgecalculator.js b/src/autobridgecalculator.js similarity index 100% rename from src/js/ripple/autobridgecalculator.js rename to src/autobridgecalculator.js diff --git a/src/js/ripple/base.js b/src/base.js similarity index 100% rename from src/js/ripple/base.js rename to src/base.js diff --git a/src/js/ripple/baseconverter.js b/src/baseconverter.js similarity index 100% rename from src/js/ripple/baseconverter.js rename to src/baseconverter.js diff --git a/src/js/ripple/binformat.js b/src/binformat.js similarity index 100% rename from src/js/ripple/binformat.js rename to src/binformat.js diff --git a/src/cpp/TransactionErr.cpp b/src/cpp/TransactionErr.cpp deleted file mode 100644 index 1e03226f..00000000 --- a/src/cpp/TransactionErr.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "TransactionErr.h" -#include "utils.h" - -bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman) -{ - static struct { - TER terCode; - const char* cpToken; - const char* cpHuman; - } transResultInfoA[] = { - { tecCLAIM, "tecCLAIM", "Fee claimed. Sequence used. No action." }, - { tecDIR_FULL, "tecDIR_FULL", "Can not add entry to full directory." }, - { tecFAILED_PROCESSING, "tecFAILED_PROCESSING", "Failed to correctly process transaction." }, - { tecINSUF_RESERVE_LINE, "tecINSUF_RESERVE_LINE", "Insufficient reserve to add trust line." }, - { tecINSUF_RESERVE_OFFER, "tecINSUF_RESERVE_OFFER", "Insufficient reserve to create offer." }, - { tecNO_DST, "tecNO_DST", "Destination does not exist. Send XRP to create it." }, - { tecNO_DST_INSUF_XRP, "tecNO_DST_INSUF_XRP", "Destination does not exist. Too little XRP sent to create it." }, - { tecNO_LINE_INSUF_RESERVE, "tecNO_LINE_INSUF_RESERVE", "No such line. Too little reserve to create it." }, - { tecNO_LINE_REDUNDANT, "tecNO_LINE_REDUNDANT", "Can't set non-existant line to default." }, - { tecPATH_DRY, "tecPATH_DRY", "Path could not send partial amount." }, - { tecPATH_PARTIAL, "tecPATH_PARTIAL", "Path could not send full amount." }, - - { tecUNFUNDED, "tecUNFUNDED", "One of _ADD, _OFFER, or _SEND. Deprecated." }, - { tecUNFUNDED_ADD, "tecUNFUNDED_ADD", "Insufficient XRP balance for WalletAdd." }, - { tecUNFUNDED_OFFER, "tecUNFUNDED_OFFER", "Insufficient balance to fund created offer." }, - { tecUNFUNDED_PAYMENT, "tecUNFUNDED_PAYMENT", "Insufficient XRP balance to send." }, - - { tefFAILURE, "tefFAILURE", "Failed to apply." }, - { tefALREADY, "tefALREADY", "The exact transaction was already in this ledger." }, - { tefBAD_ADD_AUTH, "tefBAD_ADD_AUTH", "Not authorized to add account." }, - { tefBAD_AUTH, "tefBAD_AUTH", "Transaction's public key is not authorized." }, - { tefBAD_CLAIM_ID, "tefBAD_CLAIM_ID", "Malformed: Bad claim id." }, - { tefBAD_GEN_AUTH, "tefBAD_GEN_AUTH", "Not authorized to claim generator." }, - { tefBAD_LEDGER, "tefBAD_LEDGER", "Ledger in unexpected state." }, - { tefCLAIMED, "tefCLAIMED", "Can not claim a previously claimed account." }, - { tefCREATED, "tefCREATED", "Can't add an already created account." }, - { tefDST_TAG_NEEDED, "tefDST_TAG_NEEDED", "Destination tag required." }, - { tefEXCEPTION, "tefEXCEPTION", "Unexpected program state." }, - { tefGEN_IN_USE, "tefGEN_IN_USE", "Generator already in use." }, - { tefINTERNAL, "tefINTERNAL", "Internal error." }, - { tefNO_AUTH_REQUIRED, "tefNO_AUTH_REQUIRED", "Auth is not required." }, - { tefPAST_SEQ, "tefPAST_SEQ", "This sequence number has already past." }, - - { telLOCAL_ERROR, "telLOCAL_ERROR", "Local failure." }, - { telBAD_DOMAIN, "telBAD_DOMAIN", "Domain too long." }, - { telBAD_PATH_COUNT, "telBAD_PATH_COUNT", "Malformed: Too many paths." }, - { telBAD_PUBLIC_KEY, "telBAD_PUBLIC_KEY", "Public key too long." }, - { telFAILED_PROCESSING, "telFAILED_PROCESSING", "Failed to correctly process transaction." }, - { telINSUF_FEE_P, "telINSUF_FEE_P", "Fee insufficient." }, - { telNO_DST_PARTIAL, "telNO_DST_PARTIAL", "Partial payment to create account not allowed." }, - - { temMALFORMED, "temMALFORMED", "Malformed transaction." }, - { temBAD_AMOUNT, "temBAD_AMOUNT", "Can only send positive amounts." }, - { temBAD_AUTH_MASTER, "temBAD_AUTH_MASTER", "Auth for unclaimed account needs correct master key." }, - { temBAD_CURRENCY, "temBAD_CURRENCY", "Malformed: Bad currency." }, - { temBAD_FEE, "temBAD_FEE", "Invalid fee, negative or not XRP." }, - { temBAD_EXPIRATION, "temBAD_EXPIRATION", "Malformed: Bad expiration." }, - { temBAD_ISSUER, "temBAD_ISSUER", "Malformed: Bad issuer." }, - { temBAD_LIMIT, "temBAD_LIMIT", "Limits must be non-negative." }, - { temBAD_OFFER, "temBAD_OFFER", "Malformed: Bad offer." }, - { temBAD_PATH, "temBAD_PATH", "Malformed: Bad path." }, - { temBAD_PATH_LOOP, "temBAD_PATH_LOOP", "Malformed: Loop in path." }, - { temBAD_PUBLISH, "temBAD_PUBLISH", "Malformed: Bad publish." }, - { temBAD_SIGNATURE, "temBAD_SIGNATURE", "Malformed: Bad signature." }, - { temBAD_SRC_ACCOUNT, "temBAD_SRC_ACCOUNT", "Malformed: Bad source account." }, - { temBAD_TRANSFER_RATE, "temBAD_TRANSFER_RATE", "Malformed: Transfer rate must be >= 1.0" }, - { temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence is not in the past." }, - { temBAD_SEND_XRP_LIMIT, "temBAD_SEND_XRP_LIMIT", "Malformed: Limit quality is not allowed for XRP to XRP." }, - { temBAD_SEND_XRP_MAX, "temBAD_SEND_XRP_MAX", "Malformed: Send max is not allowed for XRP to XRP." }, - { temBAD_SEND_XRP_NO_DIRECT, "temBAD_SEND_XRP_NO_DIRECT", "Malformed: No Ripple direct is not allowed for XRP to XRP." }, - { temBAD_SEND_XRP_PARTIAL, "temBAD_SEND_XRP_PARTIAL", "Malformed: Partial payment is not allowed for XRP to XRP." }, - { temBAD_SEND_XRP_PATHS, "temBAD_SEND_XRP_PATHS", "Malformed: Paths are not allowed for XRP to XRP." }, - { temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." }, - { temDST_NEEDED, "temDST_NEEDED", "Destination not specified." }, - { temINVALID, "temINVALID", "The transaction is ill-formed." }, - { temINVALID_FLAG, "temINVALID_FLAG", "The transaction has an invalid flag." }, - { temREDUNDANT, "temREDUNDANT", "Sends same currency to self." }, - { temREDUNDANT_SEND_MAX, "temREDUNDANT_SEND_MAX", "Send max is redundant." }, - { temRIPPLE_EMPTY, "temRIPPLE_EMPTY", "PathSet with no paths." }, - { temUNCERTAIN, "temUNCERTAIN", "In process of determining result. Never returned." }, - { temUNKNOWN, "temUNKNOWN", "The transactions requires logic not implemented yet." }, - - { terRETRY, "terRETRY", "Retry transaction." }, - { terFUNDS_SPENT, "terFUNDS_SPENT", "Can't set password, password set funds already spent." }, - { terINSUF_FEE_B, "terINSUF_FEE_B", "Account balance can't pay fee." }, - { terLAST, "terLAST", "Process last." }, - { terNO_ACCOUNT, "terNO_ACCOUNT", "The source account does not exist." }, - { terNO_AUTH, "terNO_AUTH", "Not authorized to hold IOUs." }, - { terNO_LINE, "terNO_LINE", "No such line." }, - { terPRE_SEQ, "terPRE_SEQ", "Missing/inapplicable prior transaction." }, - { terOWNERS, "terOWNERS", "Non-zero owner count." }, - - { tesSUCCESS, "tesSUCCESS", "The transaction was applied." }, - }; - - int iIndex = NUMBER(transResultInfoA); - - while (iIndex-- && transResultInfoA[iIndex].terCode != terCode) - ; - - if (iIndex >= 0) - { - strToken = transResultInfoA[iIndex].cpToken; - strHuman = transResultInfoA[iIndex].cpHuman; - } - - return iIndex >= 0; -} - -std::string transToken(TER terCode) -{ - std::string strToken; - std::string strHuman; - - return transResultInfo(terCode, strToken, strHuman) ? strToken : "-"; -} - -std::string transHuman(TER terCode) -{ - std::string strToken; - std::string strHuman; - - return transResultInfo(terCode, strToken, strHuman) ? strHuman : "-"; -} - -// vim:ts=4 diff --git a/src/cpp/TransactionErr.h b/src/cpp/TransactionErr.h deleted file mode 100644 index 2e18d5f1..00000000 --- a/src/cpp/TransactionErr.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef _TRANSACTION_ERR_ -#define _TRANSACTION_ERR_ - -#include - -enum TER // aka TransactionEngineResult -{ - // Note: Range is stable. Exact numbers are currently unstable. Use tokens. - - // -399 .. -300: L Local error (transaction fee inadequate, exceeds local limit) - // Only valid during non-consensus processing. - // Implications: - // - Not forwarded - // - No fee check - telLOCAL_ERROR = -399, - telBAD_DOMAIN, - telBAD_PATH_COUNT, - telBAD_PUBLIC_KEY, - telFAILED_PROCESSING, - telINSUF_FEE_P, - telNO_DST_PARTIAL, - - // -299 .. -200: M Malformed (bad signature) - // Causes: - // - Transaction corrupt. - // Implications: - // - Not applied - // - Not forwarded - // - Reject - // - Can not succeed in any imagined ledger. - temMALFORMED = -299, - temBAD_AMOUNT, - temBAD_AUTH_MASTER, - temBAD_CURRENCY, - temBAD_FEE, - temBAD_EXPIRATION, - temBAD_ISSUER, - temBAD_LIMIT, - temBAD_OFFER, - temBAD_PATH, - temBAD_PATH_LOOP, - temBAD_PUBLISH, - temBAD_TRANSFER_RATE, - temBAD_SEND_XRP_LIMIT, - temBAD_SEND_XRP_MAX, - temBAD_SEND_XRP_NO_DIRECT, - temBAD_SEND_XRP_PARTIAL, - temBAD_SEND_XRP_PATHS, - temBAD_SIGNATURE, - temBAD_SRC_ACCOUNT, - temBAD_SEQUENCE, - temDST_IS_SRC, - temDST_NEEDED, - temINVALID, - temINVALID_FLAG, - temREDUNDANT, - temREDUNDANT_SEND_MAX, - temRIPPLE_EMPTY, - temUNCERTAIN, // An intermediate result used internally, should never be returned. - temUNKNOWN, - - // -199 .. -100: F Failure (sequence number previously used) - // Causes: - // - Transaction cannot succeed because of ledger state. - // - Unexpected ledger state. - // - C++ exception. - // Implications: - // - Not applied - // - Not forwarded - // - Could succeed in an imagined ledger. - tefFAILURE = -199, - tefALREADY, - tefBAD_ADD_AUTH, - tefBAD_AUTH, - tefBAD_CLAIM_ID, - tefBAD_GEN_AUTH, - tefBAD_LEDGER, - tefCLAIMED, - tefCREATED, - tefDST_TAG_NEEDED, - tefEXCEPTION, - tefGEN_IN_USE, - tefINTERNAL, - tefNO_AUTH_REQUIRED, // Can't set auth if auth is not required. - tefPAST_SEQ, - - // -99 .. -1: R Retry (sequence too high, no funds for txn fee, originating account non-existent) - // Causes: - // - Prior application of another, possibly non-existant, another transaction could allow this transaction to succeed. - // Implications: - // - Not applied - // - Not forwarded - // - Might succeed later - // - Hold - // - Makes hole in sequence which jams transactions. - terRETRY = -99, - terFUNDS_SPENT, // This is a free transaction, therefore don't burden network. - terINSUF_FEE_B, // Can't pay fee, therefore don't burden network. - terNO_ACCOUNT, // Can't pay fee, therefore don't burden network. - terNO_AUTH, // Not authorized to hold IOUs. - terNO_LINE, // Internal flag. - terOWNERS, // Can't succeed with non-zero owner count. - terPRE_SEQ, // Can't pay fee, no point in forwarding, therefore don't burden network. - terLAST, // Process after all other transactions - - // 0: S Success (success) - // Causes: - // - Success. - // Implications: - // - Applied - // - Forwarded - tesSUCCESS = 0, - - // 100 .. 129 C Claim fee only (ripple transaction with no good paths, pay to non-existent account, no path) - // Causes: - // - Success, but does not achieve optimal result. - // - Invalid transaction or no effect, but claim fee to use the sequence number. - // Implications: - // - Applied - // - Forwarded - // Only allowed as a return code of appliedTransaction when !tapRetry. Otherwise, treated as terRETRY. - // - // DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data. - tecCLAIM = 100, - tecPATH_PARTIAL = 101, - tecUNFUNDED_ADD = 102, - tecUNFUNDED_OFFER = 103, - tecUNFUNDED_PAYMENT = 104, - tecFAILED_PROCESSING = 105, - tecDIR_FULL = 121, - tecINSUF_RESERVE_LINE = 122, - tecINSUF_RESERVE_OFFER = 123, - tecNO_DST = 124, - tecNO_DST_INSUF_XRP = 125, - tecNO_LINE_INSUF_RESERVE = 126, - tecNO_LINE_REDUNDANT = 127, - tecPATH_DRY = 128, - tecUNFUNDED = 129, // Deprecated, old ambiguous unfunded. -}; - -#define isTelLocal(x) ((x) >= telLOCAL_ERROR && (x) < temMALFORMED) -#define isTemMalformed(x) ((x) >= temMALFORMED && (x) < tefFAILURE) -#define isTefFailure(x) ((x) >= tefFAILURE && (x) < terRETRY) -#define isTerRetry(x) ((x) >= terRETRY && (x) < tesSUCCESS) -#define isTesSuccess(x) ((x) == tesSUCCESS) -#define isTecClaim(x) ((x) >= tecCLAIM) - -bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman); -std::string transToken(TER terCode); -std::string transHuman(TER terCode); - -#endif -// vim:ts=4 diff --git a/src/js/ripple/currency.js b/src/currency.js similarity index 100% rename from src/js/ripple/currency.js rename to src/currency.js diff --git a/src/js/ripple/hashprefixes.js b/src/hashprefixes.js similarity index 100% rename from src/js/ripple/hashprefixes.js rename to src/hashprefixes.js diff --git a/src/js/ripple/ieee754.js b/src/ieee754.js similarity index 100% rename from src/js/ripple/ieee754.js rename to src/ieee754.js diff --git a/src/js/ripple/index.js b/src/index.js similarity index 93% rename from src/js/ripple/index.js rename to src/index.js index 1c0b5fad..9c52fad5 100644 --- a/src/js/ripple/index.js +++ b/src/index.js @@ -22,6 +22,11 @@ exports.TransactionQueue = require('./transactionqueue').TransactionQueue; exports.RangeSet = require('./rangeset').RangeSet; exports.convertBase = require('./baseconverter'); +exports._test = { + PathFind: require('./pathfind').PathFind, + TransactionManager: require('./transactionmanager').TransactionManager +}; + // Important: We do not guarantee any specific version of SJCL or for any // specific features to be included. The version and configuration may change at // any time without warning. diff --git a/src/js/ripple/keypair.js b/src/keypair.js similarity index 100% rename from src/js/ripple/keypair.js rename to src/keypair.js diff --git a/src/js/ripple/ledger.js b/src/ledger.js similarity index 100% rename from src/js/ripple/ledger.js rename to src/ledger.js diff --git a/src/js/ripple/ledgerspaces.js b/src/ledgerspaces.js similarity index 100% rename from src/js/ripple/ledgerspaces.js rename to src/ledgerspaces.js diff --git a/src/js/ripple/log.js b/src/log.js similarity index 100% rename from src/js/ripple/log.js rename to src/log.js diff --git a/src/js/ripple/message.js b/src/message.js similarity index 100% rename from src/js/ripple/message.js rename to src/message.js diff --git a/src/js/ripple/meta.js b/src/meta.js similarity index 100% rename from src/js/ripple/meta.js rename to src/meta.js diff --git a/src/js/ripple/orderbook.js b/src/orderbook.js similarity index 100% rename from src/js/ripple/orderbook.js rename to src/orderbook.js diff --git a/src/js/ripple/orderbookutils.js b/src/orderbookutils.js similarity index 100% rename from src/js/ripple/orderbookutils.js rename to src/orderbookutils.js diff --git a/src/js/ripple/pathfind.js b/src/pathfind.js similarity index 100% rename from src/js/ripple/pathfind.js rename to src/pathfind.js diff --git a/src/js/ripple/rangeset.js b/src/rangeset.js similarity index 100% rename from src/js/ripple/rangeset.js rename to src/rangeset.js diff --git a/src/js/ripple/remote.js b/src/remote.js similarity index 100% rename from src/js/ripple/remote.js rename to src/remote.js diff --git a/src/js/ripple/request.js b/src/request.js similarity index 100% rename from src/js/ripple/request.js rename to src/request.js diff --git a/src/js/ripple/rippleerror.js b/src/rippleerror.js similarity index 100% rename from src/js/ripple/rippleerror.js rename to src/rippleerror.js diff --git a/src/js/ripple/seed.js b/src/seed.js similarity index 100% rename from src/js/ripple/seed.js rename to src/seed.js diff --git a/src/js/ripple/serializedobject.js b/src/serializedobject.js similarity index 100% rename from src/js/ripple/serializedobject.js rename to src/serializedobject.js diff --git a/src/js/ripple/serializedtypes.js b/src/serializedtypes.js similarity index 100% rename from src/js/ripple/serializedtypes.js rename to src/serializedtypes.js diff --git a/src/js/ripple/server.js b/src/server.js similarity index 100% rename from src/js/ripple/server.js rename to src/server.js diff --git a/src/js/ripple/shamap.js b/src/shamap.js similarity index 100% rename from src/js/ripple/shamap.js rename to src/shamap.js diff --git a/src/js/sjcl-custom/index.js b/src/sjcl-custom/index.js similarity index 100% rename from src/js/sjcl-custom/index.js rename to src/sjcl-custom/index.js diff --git a/src/js/sjcl-custom/sjcl-ecc-pointextras.js b/src/sjcl-custom/sjcl-ecc-pointextras.js similarity index 100% rename from src/js/sjcl-custom/sjcl-ecc-pointextras.js rename to src/sjcl-custom/sjcl-ecc-pointextras.js diff --git a/src/js/sjcl-custom/sjcl-ecdsa-canonical.js b/src/sjcl-custom/sjcl-ecdsa-canonical.js similarity index 100% rename from src/js/sjcl-custom/sjcl-ecdsa-canonical.js rename to src/sjcl-custom/sjcl-ecdsa-canonical.js diff --git a/src/js/sjcl-custom/sjcl-ecdsa-der.js b/src/sjcl-custom/sjcl-ecdsa-der.js similarity index 100% rename from src/js/sjcl-custom/sjcl-ecdsa-der.js rename to src/sjcl-custom/sjcl-ecdsa-der.js diff --git a/src/js/sjcl-custom/sjcl-ecdsa-recoverablepublickey.js b/src/sjcl-custom/sjcl-ecdsa-recoverablepublickey.js similarity index 100% rename from src/js/sjcl-custom/sjcl-ecdsa-recoverablepublickey.js rename to src/sjcl-custom/sjcl-ecdsa-recoverablepublickey.js diff --git a/src/js/sjcl-custom/sjcl-extramath.js b/src/sjcl-custom/sjcl-extramath.js similarity index 100% rename from src/js/sjcl-custom/sjcl-extramath.js rename to src/sjcl-custom/sjcl-extramath.js diff --git a/src/js/sjcl-custom/sjcl-jacobi.js b/src/sjcl-custom/sjcl-jacobi.js similarity index 100% rename from src/js/sjcl-custom/sjcl-jacobi.js rename to src/sjcl-custom/sjcl-jacobi.js diff --git a/src/js/sjcl-custom/sjcl-montgomery.js b/src/sjcl-custom/sjcl-montgomery.js similarity index 100% rename from src/js/sjcl-custom/sjcl-montgomery.js rename to src/sjcl-custom/sjcl-montgomery.js diff --git a/src/js/sjcl-custom/sjcl-ripemd160.js b/src/sjcl-custom/sjcl-ripemd160.js similarity index 100% rename from src/js/sjcl-custom/sjcl-ripemd160.js rename to src/sjcl-custom/sjcl-ripemd160.js diff --git a/src/js/sjcl-custom/sjcl-secp256k1.js b/src/sjcl-custom/sjcl-secp256k1.js similarity index 100% rename from src/js/sjcl-custom/sjcl-secp256k1.js rename to src/sjcl-custom/sjcl-secp256k1.js diff --git a/src/js/sjcl-custom/sjcl-validecc.js b/src/sjcl-custom/sjcl-validecc.js similarity index 100% rename from src/js/sjcl-custom/sjcl-validecc.js rename to src/sjcl-custom/sjcl-validecc.js diff --git a/src/js/ripple/transaction.js b/src/transaction.js similarity index 100% rename from src/js/ripple/transaction.js rename to src/transaction.js diff --git a/src/js/ripple/transactionmanager.js b/src/transactionmanager.js similarity index 100% rename from src/js/ripple/transactionmanager.js rename to src/transactionmanager.js diff --git a/src/js/ripple/transactionqueue.js b/src/transactionqueue.js similarity index 100% rename from src/js/ripple/transactionqueue.js rename to src/transactionqueue.js diff --git a/src/js/ripple/uint.js b/src/uint.js similarity index 100% rename from src/js/ripple/uint.js rename to src/uint.js diff --git a/src/js/ripple/uint128.js b/src/uint128.js similarity index 100% rename from src/js/ripple/uint128.js rename to src/uint128.js diff --git a/src/js/ripple/uint160.js b/src/uint160.js similarity index 100% rename from src/js/ripple/uint160.js rename to src/uint160.js diff --git a/src/js/ripple/uint256.js b/src/uint256.js similarity index 100% rename from src/js/ripple/uint256.js rename to src/uint256.js diff --git a/src/js/ripple/utils.js b/src/utils.js similarity index 99% rename from src/js/ripple/utils.js rename to src/utils.js index 620d5594..b371f032 100644 --- a/src/js/ripple/utils.js +++ b/src/utils.js @@ -158,6 +158,6 @@ exports.fromTimestamp = fromTimestamp; exports.getMantissaDecimalString = getMantissaDecimalString; exports.sjcl = require('sjcl'); -require('../sjcl-custom'); +require('./sjcl-custom'); // vim:sw=2:sts=2:ts=8:et diff --git a/test/mocha.opts b/test/mocha.opts new file mode 100644 index 00000000..ccd434ec --- /dev/null +++ b/test/mocha.opts @@ -0,0 +1 @@ +--reporter spec --timeout 10000 --slow 500 diff --git a/test/node_modules/ripple-lib b/test/node_modules/ripple-lib index 3db6ddeb..a8d2a675 120000 --- a/test/node_modules/ripple-lib +++ b/test/node_modules/ripple-lib @@ -1 +1 @@ -../../src/js/ripple/ \ No newline at end of file +../../src/ \ No newline at end of file diff --git a/test/remote-test.js b/test/remote-test.js index a9d9e4c0..a637b70e 100644 --- a/test/remote-test.js +++ b/test/remote-test.js @@ -6,7 +6,7 @@ var Transaction = require('ripple-lib').Transaction; var UInt160 = require('ripple-lib').UInt160; var Currency = require('ripple-lib').Currency; var Amount = require('ripple-lib').Amount; -var PathFind = require('../src/js/ripple/pathfind').PathFind; +var PathFind = require('ripple-lib')._test.PathFind; var options, remote, callback, database, tx; diff --git a/test/transaction-manager-test.js b/test/transaction-manager-test.js index 7bd39079..2c92c7a4 100644 --- a/test/transaction-manager-test.js +++ b/test/transaction-manager-test.js @@ -7,8 +7,7 @@ var sjcl = require('ripple-lib').sjcl; var Remote = require('ripple-lib').Remote; var SerializedObject = require('ripple-lib').SerializedObject; var Transaction = require('ripple-lib').Transaction; -var TransactionManager = require('../src/js/ripple/transactionmanager') -.TransactionManager; +var TransactionManager = require('ripple-lib')._test.TransactionManager; var LEDGER = require('./fixtures/transactionmanager').LEDGER; var ACCOUNT = require('./fixtures/transactionmanager').ACCOUNT;