UInt160 can be an account or a plain hash.

The UInt160 class used to be hardcoded to be an Account. This commit changes it
so it can be used as an account or a plain hash. It will try to automatically
self-classify based on how it is initialized.

In the future we may want to have some dedicated classes rather than a
single configurable UInt160.
This commit is contained in:
Stefan Thomas
2013-11-12 15:51:50 -08:00
parent ae68e3a1a6
commit 05f3a97042
5 changed files with 135 additions and 20 deletions

View File

@@ -36,7 +36,7 @@ describe('Amount', function() {
assert.deepEqual(new BigInteger(), UInt160.from_generic('0')._value);
});
it('Parse 0 export', function () {
assert.strictEqual(UInt160.ACCOUNT_ZERO, UInt160.from_generic('0').to_json());
assert.strictEqual(UInt160.ACCOUNT_ZERO, UInt160.from_generic('0').set_version(0).to_json());
});
it('Parse 1', function () {
assert.deepEqual(new BigInteger([1]), UInt160.from_generic('1')._value);