BREAKING CHANGE: Use ripple-binary-codec

This commit is contained in:
Chris Clark
2015-10-06 12:45:05 -07:00
parent 57ecbc58f8
commit 91a64137fe
12 changed files with 111 additions and 64 deletions

View File

@@ -1,6 +1,6 @@
[
{
"hash": "f8f337dee5d5b238a10af4a4d56926ba26c83ee7af5a5a6474340c56f9252df3",
"hash": "F8F337DEE5D5B238A10AF4A4D56926BA26C83EE7AF5A5A6474340C56F9252DF3",
"date": "2015-08-12T01:01:10+00:00",
"ledger_index": 15202439,
"tx": {
@@ -60,7 +60,7 @@
}
},
{
"hash": "f8d5de632b1d8b64e577c46912cce483d6df4fd4e2cf4a3d586a099de3b27021",
"hash": "F8D5DE632B1D8B64E577C46912CCE483D6DF4FD4E2CF4A3D586A099DE3B27021",
"date": "2015-08-12T01:01:10+00:00",
"ledger_index": 15202439,
"tx": {
@@ -120,7 +120,7 @@
}
},
{
"hash": "e9004490a92413e92dacd621ac73fd434a8950c350f7572ffeaf4d6aaf8fc288",
"hash": "E9004490A92413E92DACD621AC73FD434A8950C350F7572FFEAF4D6AAF8FC288",
"date": "2015-08-12T01:01:10+00:00",
"ledger_index": 15202439,
"tx": {
@@ -180,7 +180,7 @@
}
},
{
"hash": "d44bff924d23211b82b8f604af6d92f260f8dd13103a96f03e48825c4a978fd6",
"hash": "D44BFF924D23211B82B8F604AF6D92F260F8DD13103A96F03E48825C4A978FD6",
"date": "2015-08-12T01:01:10+00:00",
"ledger_index": 15202439,
"tx": {
@@ -240,7 +240,7 @@
}
},
{
"hash": "c978d915bfb17687335cbfc4b207d9e7213bcee35b468c2eee016cdce4edb6e4",
"hash": "C978D915BFB17687335CBFC4B207D9E7213BCEE35B468C2EEE016CDCE4EDB6E4",
"date": "2015-08-12T01:01:10+00:00",
"ledger_index": 15202439,
"tx": {
@@ -372,7 +372,7 @@
}
},
{
"hash": "31b34fd7c90cdc6cf680a814debc6f616c69275c0e99711f904de088a8ed4b28",
"hash": "31B34FD7C90CDC6CF680A814DEBC6F616C69275C0E99711F904DE088A8ED4B28",
"date": "2015-08-12T01:01:10+00:00",
"ledger_index": 15202439,
"tx": {
@@ -412,7 +412,7 @@
}
},
{
"hash": "260bc2964ffe6d81cb25c152f8054ffb2ce6ed04ff89d8d0d0559bc14bef0e46",
"hash": "260BC2964FFE6D81CB25C152F8054FFB2CE6ED04FF89D8D0D0559BC14BEF0E46",
"date": "2015-08-12T01:01:10+00:00",
"ledger_index": 15202439,
"tx": {

View File

@@ -6,6 +6,7 @@ const _ = require('lodash');
const assert = require('assert-diff');
const Remote = require('ripple-lib').Remote;
const Currency = require('ripple-lib').Currency;
const OrderbookUtils = require('ripple-lib')._test.OrderbookUtils;
const addresses = require('./fixtures/addresses');
const fixtures = require('./fixtures/orderbook');
const IOUValue = require('ripple-lib-value').IOUValue;
@@ -843,4 +844,14 @@ describe('OrderBook Autobridging', function() {
});
});
it('convertOfferQualityToHexFromText', function() {
const bookDirectory =
'4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F4C3362FE1D0';
const quality = '195796912.5171664';
assert.strictEqual(
OrderbookUtils.convertOfferQualityToHexFromText(quality),
bookDirectory.slice(-16)
);
});
});

View File

@@ -345,7 +345,7 @@ describe('Transaction', function() {
remote.setSecret(src, addresses.SECRET);
assert(transaction.complete());
const json = transaction.serialize().to_json();
const json = transaction.serialize();
assert.notStrictEqual(json.Fee, '66500000', 'Fee == 66500000, i.e. 66.5 XRP!');
});
@@ -584,7 +584,7 @@ describe('Transaction', function() {
SigningPubKey: '021FED5FD081CE5C4356431267D04C6E2167E4112C897D5E10335D4E22B4DA49ED',
Account: 'rMWwx3Ma16HnqSd4H6saPisihX9aKpXxHJ',
Flags: 0,
Fee: 10,
Fee: '10',
Sequence: 1,
TransactionType: 'AccountSet'
};
@@ -602,10 +602,9 @@ describe('Transaction', function() {
const tx = Transaction.from_json(tx_json);
const data = tx.signingData();
assert.strictEqual(data.hash().to_json(),
expectedSigningHash);
assert.strictEqual(tx.signingHash(), expectedSigningHash);
assert.strictEqual(data.to_hex(),
assert.strictEqual(data,
('535458001200032200000000240000000168400000000000000' +
'A7321021FED5FD081CE5C4356431267D04C6E2167E4112C897D' +
'5E10335D4E22B4DA49ED8114E0E6E281CA324AEE034B2BB8AC9' +
@@ -619,7 +618,7 @@ describe('Transaction', function() {
transaction.tx_json.SigningPubKey = '021FED5FD081CE5C4356431267D04C6E2167E4112C897D5E10335D4E22B4DA49ED';
transaction.tx_json.Account = 'rMWwx3Ma16HnqSd4H6saPisihX9aKpXxHJ';
transaction.tx_json.Flags = 0;
transaction.tx_json.Fee = 10;
transaction.tx_json.Fee = '10';
transaction.tx_json.Sequence = 1;
transaction.tx_json.TransactionType = 'AccountSet';
@@ -634,7 +633,7 @@ describe('Transaction', function() {
transaction.tx_json.SigningPubKey = '021FED5FD081CE5C4356431267D04C6E2167E4112C897D5E10335D4E22B4DA49ED';
transaction.tx_json.Account = 'rMWwx3Ma16HnqSd4H6saPisihX9aKpXxHJ';
transaction.tx_json.Flags = 0;
transaction.tx_json.Fee = 10;
transaction.tx_json.Fee = '10';
transaction.tx_json.Sequence = 1;
transaction.tx_json.TransactionType = 'AccountSet';
@@ -650,7 +649,7 @@ describe('Transaction', function() {
transaction.tx_json.SigningPubKey = '021FED5FD081CE5C4356431267D04C6E2167E4112C897D5E10335D4E22B4DA49ED';
transaction.tx_json.Account = 'rMWwx3Ma16HnqSd4H6saPisihX9aKpXxHJ';
transaction.tx_json.Flags = 0;
transaction.tx_json.Fee = 10;
transaction.tx_json.Fee = '10';
transaction.tx_json.Sequence = 1;
transaction.tx_json.TransactionType = 'AccountSet';
@@ -840,7 +839,7 @@ describe('Transaction', function() {
const transaction = Transaction.from_json(input_json);
assert.deepEqual(transaction.serialize().to_hex(), expected_hex);
assert.deepEqual(transaction.serialize(), expected_hex);
});
it('Sign transaction', function(done) {
@@ -849,7 +848,7 @@ describe('Transaction', function() {
transaction.tx_json.SigningPubKey = '021FED5FD081CE5C4356431267D04C6E2167E4112C897D5E10335D4E22B4DA49ED';
transaction.tx_json.Account = 'rMWwx3Ma16HnqSd4H6saPisihX9aKpXxHJ';
transaction.tx_json.Flags = 0;
transaction.tx_json.Fee = 10;
transaction.tx_json.Fee = '10';
transaction.tx_json.Sequence = 1;
transaction.tx_json.TransactionType = 'AccountSet';
@@ -2261,7 +2260,8 @@ describe('Transaction', function() {
const abytes = decodeAddress(a1);
const prefix = require('ripple-lib')._test.HashPrefixes.HASH_TX_MULTISIGN_BYTES;
assert.deepEqual(d1.buffer, prefix.concat(tbytes, abytes));
assert.deepEqual(new Buffer(d1, 'hex'),
new Buffer(prefix.concat(tbytes, abytes)));
});
it('Multisign', function() {