Currency: Add support for complex currencies. (UInt160)

This patch might regress the performance of the Currency class and by extension
the Amount class. Since Amount is on a lot of hot paths in the client we should
make sure this isn't a major problem.

As for compatibility, this patch is a major change, but it should maintain the
public interface very well, which the exception of some strange edge cases (e.g.
Currency.from_json(1337)), which weren't well-defined before anyway. Any code
that accesses _value directly (shame on you!) will need to be fixed. There
aren't any such references in ripple-client or the rippled test suite, so I
think we're looking pretty good.
This commit is contained in:
Stefan Thomas
2014-01-24 05:24:46 -08:00
parent 4e67167394
commit 9f76907f51
6 changed files with 124 additions and 64 deletions

View File

@@ -19,8 +19,8 @@ describe('Currency', function() {
});
it('from_json("XRP").to_json() == "XRP"', function() {
var r = currency.from_json('XRP');
assert.strictEqual(0, r._value);
assert(r.is_valid());
assert(r.is_native());
assert.strictEqual('XRP', r.to_json());
});
});