mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
Remove sjcl-extended/ripple-wallet-generator. Use hash.js & sjcl-codec.
This commit is contained in:
32
npm-shrinkwrap.json
generated
32
npm-shrinkwrap.json
generated
@@ -41,6 +41,18 @@
|
|||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/extend/-/extend-1.2.1.tgz"
|
"resolved": "https://registry.npmjs.org/extend/-/extend-1.2.1.tgz"
|
||||||
},
|
},
|
||||||
|
"hash.js": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"from": "hash.js@*",
|
||||||
|
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz",
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"from": "inherits@>=2.0.1 <3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"https-proxy-agent": {
|
"https-proxy-agent": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz",
|
||||||
@@ -138,8 +150,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ripple-keypairs": {
|
"ripple-keypairs": {
|
||||||
"version": "0.7.3",
|
"version": "0.8.0",
|
||||||
"from": "ripple-keypairs@>=0.7.3 <0.8.0",
|
"from": "ripple-keypairs@>=0.8.0 <0.9.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bn.js": {
|
"bn.js": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
@@ -187,19 +199,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ripple-wallet-generator": {
|
"sjcl-codec": {
|
||||||
"version": "1.0.3",
|
"version": "0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/ripple-wallet-generator/-/ripple-wallet-generator-1.0.3.tgz"
|
"from": "sjcl-codec@*"
|
||||||
},
|
|
||||||
"sjcl-extended": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "git://github.com/ripple/sjcl-extended.git#d8cf8b22e7d97193c54e1f65113e3edcf200ca17",
|
|
||||||
"dependencies": {
|
|
||||||
"sjcl": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/sjcl/-/sjcl-1.0.3.tgz"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "0.7.2",
|
"version": "0.7.2",
|
||||||
|
|||||||
@@ -21,15 +21,15 @@
|
|||||||
"bn.js": "^3.1.1",
|
"bn.js": "^3.1.1",
|
||||||
"es6-promisify": "^2.0.0",
|
"es6-promisify": "^2.0.0",
|
||||||
"extend": "~1.2.1",
|
"extend": "~1.2.1",
|
||||||
|
"hash.js": "^1.0.3",
|
||||||
"https-proxy-agent": "^1.0.0",
|
"https-proxy-agent": "^1.0.0",
|
||||||
"is-my-json-valid": "^2.12.0",
|
"is-my-json-valid": "^2.12.0",
|
||||||
"lodash": "^3.1.0",
|
"lodash": "^3.1.0",
|
||||||
"lru-cache": "~2.5.0",
|
"lru-cache": "~2.5.0",
|
||||||
"ripple-address-codec": "^1.6.0",
|
"ripple-address-codec": "^1.6.0",
|
||||||
"ripple-keypairs": "^0.7.3",
|
"ripple-keypairs": "^0.8.0",
|
||||||
"ripple-lib-transactionparser": "^0.5.0",
|
"ripple-lib-transactionparser": "^0.5.0",
|
||||||
"ripple-wallet-generator": "^1.0.3",
|
"sjcl-codec": "0.1.0",
|
||||||
"sjcl-extended": "ripple/sjcl-extended#1.0.3",
|
|
||||||
"ws": "~0.7.1"
|
"ws": "~0.7.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ module.exports = {
|
|||||||
dropsToXrp: utils.dropsToXrp,
|
dropsToXrp: utils.dropsToXrp,
|
||||||
xrpToDrops: utils.xrpToDrops,
|
xrpToDrops: utils.xrpToDrops,
|
||||||
toRippledAmount: utils.toRippledAmount,
|
toRippledAmount: utils.toRippledAmount,
|
||||||
|
generateWallet: utils.generateWallet,
|
||||||
composeAsync: utils.composeAsync,
|
composeAsync: utils.composeAsync,
|
||||||
wrapCatch: utils.wrapCatch,
|
wrapCatch: utils.wrapCatch,
|
||||||
convertExceptions: utils.convertExceptions,
|
convertExceptions: utils.convertExceptions,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const BigNumber = require('bignumber.js');
|
|||||||
const core = require('../../core');
|
const core = require('../../core');
|
||||||
const errors = require('./errors');
|
const errors = require('./errors');
|
||||||
const es6promisify = require('es6-promisify');
|
const es6promisify = require('es6-promisify');
|
||||||
|
const keypairs = require('ripple-keypairs');
|
||||||
|
|
||||||
type Amount = {currency: string, issuer: string, value: string}
|
type Amount = {currency: string, issuer: string, value: string}
|
||||||
|
|
||||||
@@ -27,6 +28,11 @@ function toRippledAmount(amount: Amount): string|Amount {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateWallet(options?: Object): Object {
|
||||||
|
const {accountID, seed} = keypairs.generateWallet(options);
|
||||||
|
return {secret: seed, address: accountID};
|
||||||
|
}
|
||||||
|
|
||||||
type AsyncFunction = (...x: any) => void
|
type AsyncFunction = (...x: any) => void
|
||||||
|
|
||||||
function wrapCatch(asyncFunction: AsyncFunction): AsyncFunction {
|
function wrapCatch(asyncFunction: AsyncFunction): AsyncFunction {
|
||||||
@@ -95,6 +101,7 @@ module.exports = {
|
|||||||
dropsToXrp,
|
dropsToXrp,
|
||||||
xrpToDrops,
|
xrpToDrops,
|
||||||
toRippledAmount,
|
toRippledAmount,
|
||||||
|
generateWallet,
|
||||||
composeAsync,
|
composeAsync,
|
||||||
wrapCatch,
|
wrapCatch,
|
||||||
convertExceptions,
|
convertExceptions,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const sign = require('./transaction/sign');
|
|||||||
const submit = require('./transaction/submit');
|
const submit = require('./transaction/submit');
|
||||||
const errors = require('./common').errors;
|
const errors = require('./common').errors;
|
||||||
const convertExceptions = require('./common').convertExceptions;
|
const convertExceptions = require('./common').convertExceptions;
|
||||||
const generateWallet = convertExceptions(common.core.Wallet.generate);
|
const generateWallet = convertExceptions(common.generateWallet);
|
||||||
const getLedgerHeader = require('./ledger/ledger-header');
|
const getLedgerHeader = require('./ledger/ledger-header');
|
||||||
|
|
||||||
function RippleAPI(options: {}) {
|
function RippleAPI(options: {}) {
|
||||||
|
|||||||
@@ -12,13 +12,14 @@
|
|||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
const util = require('util');
|
|
||||||
const extend = require('extend');
|
const extend = require('extend');
|
||||||
const EventEmitter = require('events').EventEmitter;
|
const util = require('util');
|
||||||
const UInt160 = require('./uint160').UInt160;
|
const {createAccountID} = require('ripple-keypairs');
|
||||||
const TransactionManager = require('./transactionmanager').TransactionManager;
|
const {encodeAccountID} = require('ripple-address-codec');
|
||||||
const sjcl = require('./utils').sjcl;
|
const {EventEmitter} = require('events');
|
||||||
const Base = require('./base').Base;
|
const {hexToArray} = require('./utils');
|
||||||
|
const {TransactionManager} = require('./transactionmanager');
|
||||||
|
const {UInt160} = require('./uint160');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor Account
|
* @constructor Account
|
||||||
@@ -41,7 +42,7 @@ function Account(remote, account) {
|
|||||||
this._entry = { };
|
this._entry = { };
|
||||||
|
|
||||||
function listenerAdded(type) {
|
function listenerAdded(type) {
|
||||||
if (~Account.subscribeEvents.indexOf(type)) {
|
if (_.includes(Account.subscribeEvents, type)) {
|
||||||
if (!self._subs && self._remote._connected) {
|
if (!self._subs && self._remote._connected) {
|
||||||
self._remote.requestSubscribe()
|
self._remote.requestSubscribe()
|
||||||
.addAccount(self._account_id)
|
.addAccount(self._account_id)
|
||||||
@@ -54,7 +55,7 @@ function Account(remote, account) {
|
|||||||
this.on('newListener', listenerAdded);
|
this.on('newListener', listenerAdded);
|
||||||
|
|
||||||
function listenerRemoved(type) {
|
function listenerRemoved(type) {
|
||||||
if (~Account.subscribeEvents.indexOf(type)) {
|
if (_.includes(Account.subscribeEvents, type)) {
|
||||||
self._subs -= 1;
|
self._subs -= 1;
|
||||||
if (!self._subs && self._remote._connected) {
|
if (!self._subs && self._remote._connected) {
|
||||||
self._remote.requestUnsubscribe()
|
self._remote.requestUnsubscribe()
|
||||||
@@ -376,12 +377,7 @@ Account.prototype.publicKeyIsActive = function(public_key, callback) {
|
|||||||
Account._publicKeyToAddress = function(public_key) {
|
Account._publicKeyToAddress = function(public_key) {
|
||||||
// Based on functions in /src/js/ripple/keypair.js
|
// Based on functions in /src/js/ripple/keypair.js
|
||||||
function hexToUInt160(publicKey) {
|
function hexToUInt160(publicKey) {
|
||||||
const bits = sjcl.codec.hex.toBits(publicKey);
|
return encodeAccountID(createAccountID(hexToArray(publicKey)));
|
||||||
const hash = sjcl.hash.ripemd160.hash(sjcl.hash.sha256.hash(bits));
|
|
||||||
const address = UInt160.from_bits(hash);
|
|
||||||
address.set_version(Base.VER_ACCOUNT_ID);
|
|
||||||
|
|
||||||
return address.to_json();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UInt160.is_valid(public_key)) {
|
if (UInt160.is_valid(public_key)) {
|
||||||
|
|||||||
@@ -27,13 +27,4 @@ exports._test = {
|
|||||||
RangeSet: require('./rangeset').RangeSet
|
RangeSet: require('./rangeset').RangeSet
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
// However, for programs that are tied to a specific version of ripple.js like
|
|
||||||
// the official client, it makes sense to expose the SJCL instance so we don't
|
|
||||||
// have to include it twice.
|
|
||||||
exports.sjcl = require('./utils').sjcl;
|
|
||||||
exports.Wallet = require('ripple-wallet-generator')({sjcl: exports.sjcl});
|
|
||||||
exports.types = require('./serializedtypes');
|
exports.types = require('./serializedtypes');
|
||||||
|
|||||||
@@ -5,16 +5,15 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
const {KeyPair, KeyType} = require('ripple-keypairs');
|
const {KeyPair, KeyType} = require('ripple-keypairs');
|
||||||
const codec = require('ripple-address-codec');
|
const {decodeSeed, encodeSeed} = require('ripple-address-codec');
|
||||||
const extend = require('extend');
|
const extend = require('extend');
|
||||||
|
const sjclcodec = require('sjcl-codec');
|
||||||
const BN = require('bn.js');
|
const BN = require('bn.js');
|
||||||
const utils = require('./utils');
|
const hashjs = require('hash.js');
|
||||||
|
|
||||||
const sjcl = utils.sjcl;
|
|
||||||
const UInt = require('./uint').UInt;
|
const UInt = require('./uint').UInt;
|
||||||
|
|
||||||
const Seed = extend(function() {
|
const Seed = extend(function() {
|
||||||
this._curve = sjcl.ecc.curves.k256;
|
|
||||||
this._value = NaN;
|
this._value = NaN;
|
||||||
this._type = KeyType.secp256k1;
|
this._type = KeyType.secp256k1;
|
||||||
}, UInt);
|
}, UInt);
|
||||||
@@ -54,7 +53,7 @@ Seed.prototype.parse_base58 = function(j) {
|
|||||||
this._value = NaN;
|
this._value = NaN;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
const {bytes, type} = codec.decodeSeed(j);
|
const {bytes, type} = decodeSeed(j);
|
||||||
this._value = new BN(bytes);
|
this._value = new BN(bytes);
|
||||||
this._type = type;
|
this._type = type;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -74,10 +73,9 @@ Seed.prototype.parse_passphrase = function(j) {
|
|||||||
throw new Error('Passphrase must be a string');
|
throw new Error('Passphrase must be a string');
|
||||||
}
|
}
|
||||||
|
|
||||||
const hash = sjcl.hash.sha512.hash(sjcl.codec.utf8String.toBits(j));
|
const phraseBytes = sjclcodec.bytes.fromBits(sjclcodec.utf8String.toBits(j));
|
||||||
const bits = sjcl.bitArray.bitSlice(hash, 0, 128);
|
const hash = hashjs.sha512().update(phraseBytes).digest();
|
||||||
|
this.parse_bytes(hash.slice(0, 16));
|
||||||
this.parse_bits(bits);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@@ -86,7 +84,7 @@ Seed.prototype.to_json = function() {
|
|||||||
if (!(this.is_valid())) {
|
if (!(this.is_valid())) {
|
||||||
return NaN;
|
return NaN;
|
||||||
}
|
}
|
||||||
return codec.encodeSeed(this.to_bytes(), this._type);
|
return encodeSeed(this.to_bytes(), this._type);
|
||||||
};
|
};
|
||||||
|
|
||||||
Seed.prototype.get_key = function() {
|
Seed.prototype.get_key = function() {
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const extend = require('extend');
|
const extend = require('extend');
|
||||||
const BN = require('bn.js');
|
const BN = require('bn.js');
|
||||||
|
const hashjs = require('hash.js');
|
||||||
|
const sjclcodec = require('sjcl-codec');
|
||||||
const binformat = require('./binformat');
|
const binformat = require('./binformat');
|
||||||
const stypes = require('./serializedtypes');
|
const stypes = require('./serializedtypes');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
const UInt256 = require('./uint256').UInt256;
|
const UInt256 = require('./uint256').UInt256;
|
||||||
|
|
||||||
const sjcl = utils.sjcl;
|
|
||||||
|
|
||||||
const TRANSACTION_TYPES = { };
|
const TRANSACTION_TYPES = { };
|
||||||
|
|
||||||
Object.keys(binformat.tx).forEach(function(key) {
|
Object.keys(binformat.tx).forEach(function(key) {
|
||||||
@@ -37,7 +37,7 @@ function SerializedObject(buf) {
|
|||||||
if (Array.isArray(buf) || (Buffer && Buffer.isBuffer(buf))) {
|
if (Array.isArray(buf) || (Buffer && Buffer.isBuffer(buf))) {
|
||||||
this.buffer = buf;
|
this.buffer = buf;
|
||||||
} else if (typeof buf === 'string') {
|
} else if (typeof buf === 'string') {
|
||||||
this.buffer = sjcl.codec.bytes.fromBits(sjcl.codec.hex.toBits(buf));
|
this.buffer = sjclcodec.bytes.fromBits(sjclcodec.hex.toBits(buf));
|
||||||
} else if (!buf) {
|
} else if (!buf) {
|
||||||
this.buffer = [];
|
this.buffer = [];
|
||||||
} else {
|
} else {
|
||||||
@@ -201,11 +201,11 @@ SerializedObject.prototype.read = readOrPeek(true);
|
|||||||
SerializedObject.prototype.peek = readOrPeek(false);
|
SerializedObject.prototype.peek = readOrPeek(false);
|
||||||
|
|
||||||
SerializedObject.prototype.to_bits = function() {
|
SerializedObject.prototype.to_bits = function() {
|
||||||
return sjcl.codec.bytes.toBits(this.buffer);
|
return sjclcodec.bytes.toBits(this.buffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
SerializedObject.prototype.to_hex = function() {
|
SerializedObject.prototype.to_hex = function() {
|
||||||
return sjcl.codec.hex.fromBits(this.to_bits()).toUpperCase();
|
return sjclcodec.hex.fromBits(this.to_bits()).toUpperCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
SerializedObject.prototype.to_json = function() {
|
SerializedObject.prototype.to_json = function() {
|
||||||
@@ -302,11 +302,9 @@ SerializedObject.prototype.hash = function(prefix) {
|
|||||||
|
|
||||||
// Copy buffer to temporary buffer
|
// Copy buffer to temporary buffer
|
||||||
sign_buffer.append(this.buffer);
|
sign_buffer.append(this.buffer);
|
||||||
|
const bytes = hashjs.sha512().update(sign_buffer.buffer).digest();
|
||||||
|
|
||||||
const bits = sjcl.codec.bytes.toBits(sign_buffer.buffer);
|
return UInt256.from_bytes(bytes.slice(0, 32));
|
||||||
const sha512hex = sjcl.codec.hex.fromBits(sjcl.hash.sha512.hash(bits));
|
|
||||||
|
|
||||||
return UInt256.from_hex(sha512hex.substr(0, 64).toUpperCase());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ const assert = require('assert');
|
|||||||
const extend = require('extend');
|
const extend = require('extend');
|
||||||
const BN = require('bn.js');
|
const BN = require('bn.js');
|
||||||
const GlobalBigNumber = require('bignumber.js');
|
const GlobalBigNumber = require('bignumber.js');
|
||||||
|
const sjclcodec = require('sjcl-codec');
|
||||||
const Amount = require('./amount').Amount;
|
const Amount = require('./amount').Amount;
|
||||||
const Currency = require('./currency').Currency;
|
const Currency = require('./currency').Currency;
|
||||||
const binformat = require('./binformat');
|
const binformat = require('./binformat');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
const sjcl = utils.sjcl;
|
|
||||||
|
|
||||||
const UInt128 = require('./uint128').UInt128;
|
const UInt128 = require('./uint128').UInt128;
|
||||||
const UInt160 = require('./uint160').UInt160;
|
const UInt160 = require('./uint160').UInt160;
|
||||||
@@ -56,8 +56,8 @@ function serializeHex(so, hexData, noLength) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function convertHexToString(hexString) {
|
function convertHexToString(hexString) {
|
||||||
const bits = sjcl.codec.hex.toBits(hexString);
|
const bits = sjclcodec.hex.toBits(hexString);
|
||||||
return sjcl.codec.utf8String.fromBits(bits);
|
return sjclcodec.utf8String.fromBits(bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort_fields(keys) {
|
function sort_fields(keys) {
|
||||||
@@ -432,7 +432,7 @@ exports.Quality = new SerializedType({
|
|||||||
lo = parseInt(mantissaHex.slice(-8), 16);
|
lo = parseInt(mantissaHex.slice(-8), 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
const valueBytes = sjcl.codec.bytes.fromBits([hi, lo]);
|
const valueBytes = sjclcodec.bytes.fromBits([hi, lo]);
|
||||||
|
|
||||||
so.append(valueBytes);
|
so.append(valueBytes);
|
||||||
}
|
}
|
||||||
@@ -472,7 +472,7 @@ const STAmount = exports.Amount = new SerializedType({
|
|||||||
valueHex = '0' + valueHex;
|
valueHex = '0' + valueHex;
|
||||||
}
|
}
|
||||||
|
|
||||||
valueBytes = sjcl.codec.bytes.fromBits(sjcl.codec.hex.toBits(valueHex));
|
valueBytes = sjclcodec.bytes.fromBits(sjclcodec.hex.toBits(valueHex));
|
||||||
// Clear most significant two bits - these bits should already be 0 if
|
// Clear most significant two bits - these bits should already be 0 if
|
||||||
// Amount enforces the range correctly, but we'll clear them anyway just
|
// Amount enforces the range correctly, but we'll clear them anyway just
|
||||||
// so this code can make certain guarantees about the encoded value.
|
// so this code can make certain guarantees about the encoded value.
|
||||||
@@ -506,7 +506,7 @@ const STAmount = exports.Amount = new SerializedType({
|
|||||||
lo = parseInt(mantissaHex.slice(-8), 16);
|
lo = parseInt(mantissaHex.slice(-8), 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
valueBytes = sjcl.codec.bytes.fromBits([hi, lo]);
|
valueBytes = sjclcodec.bytes.fromBits([hi, lo]);
|
||||||
}
|
}
|
||||||
|
|
||||||
so.append(valueBytes);
|
so.append(valueBytes);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const util = require('util');
|
|||||||
const lodash = require('lodash');
|
const lodash = require('lodash');
|
||||||
const EventEmitter = require('events').EventEmitter;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
const sjcl = require('./utils').sjcl;
|
const sjclcodec = require('sjcl-codec');
|
||||||
const Amount = require('./amount').Amount;
|
const Amount = require('./amount').Amount;
|
||||||
const Currency = require('./amount').Currency;
|
const Currency = require('./amount').Currency;
|
||||||
const UInt160 = require('./amount').UInt160;
|
const UInt160 = require('./amount').UInt160;
|
||||||
@@ -779,8 +779,8 @@ Transaction.prototype.addMemo = function(options_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function convertStringToHex(string) {
|
function convertStringToHex(string) {
|
||||||
const utf8String = sjcl.codec.utf8String.toBits(string);
|
const utf8String = sjclcodec.utf8String.toBits(string);
|
||||||
return sjcl.codec.hex.fromBits(utf8String).toUpperCase();
|
return sjclcodec.hex.fromBits(utf8String).toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
const memo = {};
|
const memo = {};
|
||||||
|
|||||||
@@ -4,11 +4,10 @@
|
|||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const lodash = require('lodash');
|
const lodash = require('lodash');
|
||||||
|
const sjclcodec = require('sjcl-codec');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
const BN = require('bn.js');
|
const BN = require('bn.js');
|
||||||
|
|
||||||
const sjcl = utils.sjcl;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Abstract UInt class
|
// Abstract UInt class
|
||||||
//
|
//
|
||||||
@@ -217,16 +216,7 @@ UInt.prototype.parse_hex = function(j) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
UInt.prototype.parse_bits = function(j) {
|
UInt.prototype.parse_bits = function(j) {
|
||||||
if (sjcl.bitArray.bitLength(j) === this.constructor.width * 8) {
|
return this.parse_bytes(sjclcodec.bytes.fromBits(j));
|
||||||
const bytes = sjcl.codec.bytes.fromBits(j);
|
|
||||||
this.parse_bytes(bytes);
|
|
||||||
} else {
|
|
||||||
this._value = NaN;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._update();
|
|
||||||
|
|
||||||
return this;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UInt.prototype.parse_bytes = function(j) {
|
UInt.prototype.parse_bytes = function(j) {
|
||||||
@@ -280,7 +270,7 @@ UInt.prototype.to_bits = function() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sjcl.codec.bytes.toBits(this.to_bytes());
|
return sjclcodec.bytes.toBits(this.to_bytes());
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.UInt = UInt;
|
exports.UInt = UInt;
|
||||||
|
|||||||
@@ -166,6 +166,4 @@ exports.fromTimestamp = fromTimestamp;
|
|||||||
exports.getMantissaDecimalString = getMantissaDecimalString;
|
exports.getMantissaDecimalString = getMantissaDecimalString;
|
||||||
exports.getMantissa16FromString = getMantissa16FromString;
|
exports.getMantissa16FromString = getMantissa16FromString;
|
||||||
|
|
||||||
exports.sjcl = require('sjcl-extended');
|
|
||||||
|
|
||||||
// vim:sw=2:sts=2:ts=8:et
|
// vim:sw=2:sts=2:ts=8:et
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ const requests = fixtures.requests;
|
|||||||
const responses = fixtures.responses;
|
const responses = fixtures.responses;
|
||||||
const addresses = require('./fixtures/addresses');
|
const addresses = require('./fixtures/addresses');
|
||||||
const hashes = require('./fixtures/hashes');
|
const hashes = require('./fixtures/hashes');
|
||||||
const MockPRNG = require('./mock-prng');
|
|
||||||
const sjcl = common.core.sjcl;
|
|
||||||
const address = addresses.ACCOUNT;
|
const address = addresses.ACCOUNT;
|
||||||
const validate = common.validate;
|
const validate = common.validate;
|
||||||
const utils = RippleAPI._PRIVATE.ledgerUtils;
|
const utils = RippleAPI._PRIVATE.ledgerUtils;
|
||||||
@@ -38,13 +36,6 @@ function checkResult(expected, schemaName, response) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function withDeterministicPRNG(f) {
|
|
||||||
const prng = sjcl.random;
|
|
||||||
sjcl.random = new MockPRNG();
|
|
||||||
f();
|
|
||||||
sjcl.random = prng;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('RippleAPI', function() {
|
describe('RippleAPI', function() {
|
||||||
const instructions = {maxLedgerVersionOffset: 100};
|
const instructions = {maxLedgerVersionOffset: 100};
|
||||||
beforeEach(setupAPI.setup);
|
beforeEach(setupAPI.setup);
|
||||||
@@ -413,9 +404,11 @@ describe('RippleAPI', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('generateWallet', function() {
|
it('generateWallet', function() {
|
||||||
withDeterministicPRNG(() => {
|
function random() {
|
||||||
assert.deepEqual(this.api.generateWallet(), responses.generateWallet);
|
return _.fill(Array(16), 0);
|
||||||
});
|
}
|
||||||
|
assert.deepEqual(this.api.generateWallet({random}),
|
||||||
|
responses.generateWallet);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getSettings', function() {
|
it('getSettings', function() {
|
||||||
@@ -749,9 +742,7 @@ describe('RippleAPI - offline', function() {
|
|||||||
};
|
};
|
||||||
return api.prepareSettings(address, settings, instructions).then(txJSON => {
|
return api.prepareSettings(address, settings, instructions).then(txJSON => {
|
||||||
assert.deepEqual(txJSON, responses.prepareSettings.flags);
|
assert.deepEqual(txJSON, responses.prepareSettings.flags);
|
||||||
withDeterministicPRNG(() => {
|
assert.deepEqual(api.sign(txJSON, secret), responses.sign);
|
||||||
assert.deepEqual(api.sign(txJSON, secret), responses.sign);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"address": "ra2d1wnhDFyZGFz62wT3GSRhAEjpLuqfnj",
|
"address": "rGCkuB7PBr5tNy68tPEABEtcdno4hE6Y7f",
|
||||||
"secret": "ss4JedFMSQJa4mHQz3VZ58ZG4TYWg"
|
"secret": "sp6JS7f14BuwFY8Mw6bTtLKWauoUs"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
const _ = require('lodash');
|
|
||||||
|
|
||||||
const SEED =
|
|
||||||
'3045022100A58B0460BC5092CB4F96155C19125A4E079C870663F1D5E8BBC9BD0';
|
|
||||||
|
|
||||||
function MockPRNG(seed) {
|
|
||||||
if (seed && seed.length < 8) {
|
|
||||||
throw new Error('seed must be a hex string of at least 8 characters');
|
|
||||||
}
|
|
||||||
this.position = 0;
|
|
||||||
this.seed = seed || SEED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* eslint-disable no-unused-vars */
|
|
||||||
MockPRNG.prototype.addEntropy = function(data, estimatedEntropy, source) {};
|
|
||||||
/* eslint-enable no-unused-vars */
|
|
||||||
|
|
||||||
MockPRNG.prototype.randomWord = function() {
|
|
||||||
const i = this.position;
|
|
||||||
this.position = (i + 8) % this.seed.length;
|
|
||||||
const data = this.seed + this.seed.slice(8);
|
|
||||||
return parseInt(data.slice(i, i + 8), 16);
|
|
||||||
};
|
|
||||||
|
|
||||||
MockPRNG.prototype.randomWords = function(n) {
|
|
||||||
return _.times(n, () => this.randomWord());
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = MockPRNG;
|
|
||||||
@@ -6,11 +6,11 @@ const assert = require('assert');
|
|||||||
const lodash = require('lodash');
|
const lodash = require('lodash');
|
||||||
const SerializedObject = require('ripple-lib').SerializedObject;
|
const SerializedObject = require('ripple-lib').SerializedObject;
|
||||||
const Amount = require('ripple-lib').Amount;
|
const Amount = require('ripple-lib').Amount;
|
||||||
const sjcl = require('ripple-lib').sjcl;
|
const sjclcodec = require('sjcl-codec');
|
||||||
|
|
||||||
// Shortcuts
|
// Shortcuts
|
||||||
const hex = sjcl.codec.hex;
|
const hex = sjclcodec.hex;
|
||||||
const utf8 = sjcl.codec.utf8String;
|
const utf8 = sjclcodec.utf8String;
|
||||||
|
|
||||||
describe('Serialized object', function() {
|
describe('Serialized object', function() {
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ describe('Serialized object', function() {
|
|||||||
|
|
||||||
describe('#from_json(v).to_json() == v', function() {
|
describe('#from_json(v).to_json() == v', function() {
|
||||||
it('outputs same as passed to from_json', function() {
|
it('outputs same as passed to from_json', function() {
|
||||||
let input_json = {
|
const input_json = {
|
||||||
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
||||||
Amount: '274579388',
|
Amount: '274579388',
|
||||||
Destination: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
Destination: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
||||||
@@ -50,14 +50,14 @@ describe('Serialized object', function() {
|
|||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
TxnSignature: '30450221009DA3A42DD25E3B22EC45AD8BA8FC7A954264264A816D300B2DF69F814D7D4DD2022072C9627F97EEC6DA13DE841E06E2CD985EF06A0FBB15DDBF0800D0730C8986BF'
|
TxnSignature: '30450221009DA3A42DD25E3B22EC45AD8BA8FC7A954264264A816D300B2DF69F814D7D4DD2022072C9627F97EEC6DA13DE841E06E2CD985EF06A0FBB15DDBF0800D0730C8986BF'
|
||||||
};
|
};
|
||||||
let output_json = SerializedObject.from_json(input_json).to_json();
|
const output_json = SerializedObject.from_json(input_json).to_json();
|
||||||
assert.deepEqual(input_json, output_json);
|
assert.deepEqual(input_json, output_json);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#from_json(v).to_json() == v -- invalid amount', function() {
|
describe('#from_json(v).to_json() == v -- invalid amount', function() {
|
||||||
it('outputs same as passed to from_json', function() {
|
it('outputs same as passed to from_json', function() {
|
||||||
let input_json = {
|
const input_json = {
|
||||||
Account: 'rUR9gTCcrUY9fMkz9rwcM9urPREh3LKXoW',
|
Account: 'rUR9gTCcrUY9fMkz9rwcM9urPREh3LKXoW',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
@@ -81,7 +81,7 @@ describe('Serialized object', function() {
|
|||||||
|
|
||||||
describe('#from_json(v).to_json() == v -- invalid amount, strict_mode = false', function() {
|
describe('#from_json(v).to_json() == v -- invalid amount, strict_mode = false', function() {
|
||||||
it('outputs same as passed to from_json', function() {
|
it('outputs same as passed to from_json', function() {
|
||||||
let input_json = {
|
const input_json = {
|
||||||
Account: 'rUR9gTCcrUY9fMkz9rwcM9urPREh3LKXoW',
|
Account: 'rUR9gTCcrUY9fMkz9rwcM9urPREh3LKXoW',
|
||||||
Fee: '10',
|
Fee: '10',
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
@@ -97,9 +97,9 @@ describe('Serialized object', function() {
|
|||||||
TxnSignature: 'FFFFFF210085C6AE945643150E6D450CF796E45D74FB24B4E03E964A29CC6AFFEB346C77C80221009BE1B6678CF6C2E61F8F2696144C75AFAF66DF4FC0733DF9118EDEFEEFE33243'
|
TxnSignature: 'FFFFFF210085C6AE945643150E6D450CF796E45D74FB24B4E03E964A29CC6AFFEB346C77C80221009BE1B6678CF6C2E61F8F2696144C75AFAF66DF4FC0733DF9118EDEFEEFE33243'
|
||||||
};
|
};
|
||||||
|
|
||||||
let strictMode = Amount.strict_mode;
|
const strictMode = Amount.strict_mode;
|
||||||
Amount.strict_mode = false;
|
Amount.strict_mode = false;
|
||||||
let output_json = SerializedObject.from_json(input_json).to_json();
|
const output_json = SerializedObject.from_json(input_json).to_json();
|
||||||
assert.deepEqual(input_json, output_json);
|
assert.deepEqual(input_json, output_json);
|
||||||
Amount.strict_mode = strictMode;
|
Amount.strict_mode = strictMode;
|
||||||
});
|
});
|
||||||
@@ -107,7 +107,7 @@ describe('Serialized object', function() {
|
|||||||
|
|
||||||
describe('#from_json', function() {
|
describe('#from_json', function() {
|
||||||
it('understands TransactionType as a Number', function() {
|
it('understands TransactionType as a Number', function() {
|
||||||
let input_json = {
|
const input_json = {
|
||||||
// no non required fields
|
// no non required fields
|
||||||
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
||||||
Amount: '274579388',
|
Amount: '274579388',
|
||||||
@@ -117,14 +117,14 @@ describe('Serialized object', function() {
|
|||||||
SigningPubKey: '02',// VL field ;)
|
SigningPubKey: '02',// VL field ;)
|
||||||
TransactionType: 0 //
|
TransactionType: 0 //
|
||||||
};
|
};
|
||||||
let output_json = SerializedObject.from_json(input_json).to_json();
|
const output_json = SerializedObject.from_json(input_json).to_json();
|
||||||
|
|
||||||
assert.equal(0, input_json.TransactionType);
|
assert.equal(0, input_json.TransactionType);
|
||||||
assert.equal('Payment', output_json.TransactionType);
|
assert.equal('Payment', output_json.TransactionType);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('understands LedgerEntryType as a Number', function() {
|
it('understands LedgerEntryType as a Number', function() {
|
||||||
let input_json = {
|
const input_json = {
|
||||||
// no, non required fields
|
// no, non required fields
|
||||||
LedgerEntryType: 100,
|
LedgerEntryType: 100,
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
@@ -132,13 +132,13 @@ describe('Serialized object', function() {
|
|||||||
RootIndex: '000360186E008422E06B72D5B275E29EE3BE9D87A370F424E0E7BF613C465909'
|
RootIndex: '000360186E008422E06B72D5B275E29EE3BE9D87A370F424E0E7BF613C465909'
|
||||||
};
|
};
|
||||||
|
|
||||||
let output_json = SerializedObject.from_json(input_json).to_json();
|
const output_json = SerializedObject.from_json(input_json).to_json();
|
||||||
assert.equal(100, input_json.LedgerEntryType);
|
assert.equal(100, input_json.LedgerEntryType);
|
||||||
assert.equal('DirectoryNode', output_json.LedgerEntryType);
|
assert.equal('DirectoryNode', output_json.LedgerEntryType);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checks for missing required fields', function() {
|
it('checks for missing required fields', function() {
|
||||||
let input_json = {
|
const input_json = {
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
// no non required fields
|
// no non required fields
|
||||||
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
||||||
@@ -150,7 +150,7 @@ describe('Serialized object', function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(input_json).slice(1).forEach(function(k) {
|
Object.keys(input_json).slice(1).forEach(function(k) {
|
||||||
let bad_json = lodash.merge({}, input_json);
|
const bad_json = lodash.merge({}, input_json);
|
||||||
delete bad_json[k];
|
delete bad_json[k];
|
||||||
|
|
||||||
assert.strictEqual(bad_json[k], undefined);
|
assert.strictEqual(bad_json[k], undefined);
|
||||||
@@ -161,7 +161,7 @@ describe('Serialized object', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('checks for unknown fields', function() {
|
it('checks for unknown fields', function() {
|
||||||
let input_json = {
|
const input_json = {
|
||||||
TransactionType: 'Payment',
|
TransactionType: 'Payment',
|
||||||
// no non required fields
|
// no non required fields
|
||||||
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
||||||
@@ -173,7 +173,7 @@ describe('Serialized object', function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(input_json).slice(1).forEach(function(k) {
|
Object.keys(input_json).slice(1).forEach(function(k) {
|
||||||
let bad_json = lodash.merge({}, input_json);
|
const bad_json = lodash.merge({}, input_json);
|
||||||
bad_json[k + 'z'] = bad_json[k];
|
bad_json[k + 'z'] = bad_json[k];
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
@@ -187,7 +187,7 @@ describe('Serialized object', function() {
|
|||||||
// Peercover actually had a problem submitting transactions without a `Fee`
|
// Peercover actually had a problem submitting transactions without a `Fee`
|
||||||
// and rippled was only informing of 'transaction is invalid'
|
// and rippled was only informing of 'transaction is invalid'
|
||||||
it('should throw an Error when there is a missing field', function() {
|
it('should throw an Error when there is a missing field', function() {
|
||||||
let input_json = {
|
const input_json = {
|
||||||
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
Account: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
||||||
Amount: '274579388',
|
Amount: '274579388',
|
||||||
Destination: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
Destination: 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS',
|
||||||
@@ -234,7 +234,7 @@ describe('Serialized object', function() {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
let so = SerializedObject.from_json(input_json).to_json();
|
const so = SerializedObject.from_json(input_json).to_json();
|
||||||
input_json.Memos[0].Memo.parsed_memo_type = 'test';
|
input_json.Memos[0].Memo.parsed_memo_type = 'test';
|
||||||
input_json.Memos[0].Memo.parsed_memo_format = 'text';
|
input_json.Memos[0].Memo.parsed_memo_format = 'text';
|
||||||
input_json.Memos[0].Memo.parsed_memo_data = 'some data';
|
input_json.Memos[0].Memo.parsed_memo_data = 'some data';
|
||||||
@@ -257,7 +257,7 @@ describe('Serialized object', function() {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
let so = SerializedObject.from_json(input_json).to_json();
|
const so = SerializedObject.from_json(input_json).to_json();
|
||||||
input_json.Memos[0].Memo.parsed_memo_type = 'test';
|
input_json.Memos[0].Memo.parsed_memo_type = 'test';
|
||||||
input_json.Memos[0].Memo.parsed_memo_format = 'application/json';
|
input_json.Memos[0].Memo.parsed_memo_format = 'application/json';
|
||||||
input_json.Memos[0].Memo.MemoType = convertStringToHex('test');
|
input_json.Memos[0].Memo.MemoType = convertStringToHex('test');
|
||||||
@@ -280,7 +280,7 @@ describe('Serialized object', function() {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
let so = SerializedObject.from_json(input_json).to_json();
|
const so = SerializedObject.from_json(input_json).to_json();
|
||||||
delete input_json.Memos[0].Memo.ignored;
|
delete input_json.Memos[0].Memo.ignored;
|
||||||
input_json.Memos[0].Memo.parsed_memo_type = 'test';
|
input_json.Memos[0].Memo.parsed_memo_type = 'test';
|
||||||
input_json.Memos[0].Memo.parsed_memo_format = 'json';
|
input_json.Memos[0].Memo.parsed_memo_format = 'json';
|
||||||
@@ -338,7 +338,7 @@ describe('Serialized object', function() {
|
|||||||
TxnSignature: '304402206B53EDFA6EFCF6FE5BA76C81BABB60A3B55E9DE8A1462DEDC5F387879575E498022015AE7B59AA49E735D7F2E252802C4406CD00689BCE5057C477FE979D38D2DAC9'
|
TxnSignature: '304402206B53EDFA6EFCF6FE5BA76C81BABB60A3B55E9DE8A1462DEDC5F387879575E498022015AE7B59AA49E735D7F2E252802C4406CD00689BCE5057C477FE979D38D2DAC9'
|
||||||
};
|
};
|
||||||
|
|
||||||
let serializedHex = '12000022800000002400000126201B009EC2FF614000000000000001684000000000002EE0732103D642E6457B8AB4D140E2C66EB4C484FAFB1BF267CB578EC4815FE6CD06379C517446304402206B53EDFA6EFCF6FE5BA76C81BABB60A3B55E9DE8A1462DEDC5F387879575E498022015AE7B59AA49E735D7F2E252802C4406CD00689BCE5057C477FE979D38D2DAC9811426C4CFB3BD05A9AA23936F2E81634C66A9820C9483143DD06317D19C6110CAFF150AE528F58843BE2CA1F9EA7C05696D616765E1F1';
|
const serializedHex = '12000022800000002400000126201B009EC2FF614000000000000001684000000000002EE0732103D642E6457B8AB4D140E2C66EB4C484FAFB1BF267CB578EC4815FE6CD06379C517446304402206B53EDFA6EFCF6FE5BA76C81BABB60A3B55E9DE8A1462DEDC5F387879575E498022015AE7B59AA49E735D7F2E252802C4406CD00689BCE5057C477FE979D38D2DAC9811426C4CFB3BD05A9AA23936F2E81634C66A9820C9483143DD06317D19C6110CAFF150AE528F58843BE2CA1F9EA7C05696D616765E1F1';
|
||||||
assert.strictEqual(SerializedObject.from_json(input_json).to_hex(), serializedHex);
|
assert.strictEqual(SerializedObject.from_json(input_json).to_hex(), serializedHex);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
const ws = require('ws');
|
const ws = require('ws');
|
||||||
const lodash = require('lodash');
|
const lodash = require('lodash');
|
||||||
const assert = require('assert-diff');
|
const assert = require('assert-diff');
|
||||||
const sjcl = require('ripple-lib').sjcl;
|
|
||||||
const Remote = require('ripple-lib').Remote;
|
const Remote = require('ripple-lib').Remote;
|
||||||
const SerializedObject = require('ripple-lib').SerializedObject;
|
const SerializedObject = require('ripple-lib').SerializedObject;
|
||||||
const Transaction = require('ripple-lib').Transaction;
|
const Transaction = require('ripple-lib').Transaction;
|
||||||
@@ -48,11 +47,6 @@ describe('TransactionManager', function() {
|
|||||||
let account;
|
let account;
|
||||||
let transactionManager;
|
let transactionManager;
|
||||||
|
|
||||||
before(function() {
|
|
||||||
sjcl.random.addEntropy(
|
|
||||||
'3045022100A58B0460BC5092CB4F96155C19125A4E079C870663F1D5E8BBC9BD', 256);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
rippled = new ws.Server({port: 5763});
|
rippled = new ws.Server({port: 5763});
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ const Transaction = require('ripple-lib').Transaction;
|
|||||||
const TransactionQueue = require('ripple-lib').TransactionQueue;
|
const TransactionQueue = require('ripple-lib').TransactionQueue;
|
||||||
const Remote = require('ripple-lib').Remote;
|
const Remote = require('ripple-lib').Remote;
|
||||||
const Server = require('ripple-lib').Server;
|
const Server = require('ripple-lib').Server;
|
||||||
const sjcl = require('ripple-lib').sjcl;
|
|
||||||
|
|
||||||
const transactionResult = {
|
const transactionResult = {
|
||||||
engine_result: 'tesSUCCESS',
|
engine_result: 'tesSUCCESS',
|
||||||
@@ -54,11 +53,6 @@ for (let i = 0; i <= 127; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('Transaction', function() {
|
describe('Transaction', function() {
|
||||||
before(function() {
|
|
||||||
sjcl.random.addEntropy(
|
|
||||||
'3045022100A58B0460BC5092CB4F96155C19125A4E079C870663F1D5E8BBC9BD', 256);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Success listener', function(done) {
|
it('Success listener', function(done) {
|
||||||
const transaction = new Transaction();
|
const transaction = new Transaction();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user