Align fromHex in AbstractInt with toHex (and with actual BE JSON) (#571)
* Align fromHex in AbstractInt with toHex (and with actual BE JSON) * Update test (hex input in BE)
This commit is contained in:
@@ -39,7 +39,7 @@ export default abstract class AbstractInt extends BN implements Codec {
|
||||
// constructor. It would be ideal to actually return a BN, but there's a
|
||||
// bug: https://github.com/indutny/bn.js/issues/206.
|
||||
if (isHex(value)) {
|
||||
return hexToBn(value, { isLe: true, isNegative }).toString();
|
||||
return hexToBn(value, { isLe: false, isNegative }).toString();
|
||||
} else if (isU8a(value)) {
|
||||
try {
|
||||
// NOTE When passing u8a in (typically from decoded data), it is always LE
|
||||
|
||||
@@ -63,7 +63,7 @@ describe('Compact', () => {
|
||||
|
||||
it('encondes a large balance', () => {
|
||||
expect(
|
||||
Compact.encodeU8a(new Balance('0x00407a10f35a'))
|
||||
Compact.encodeU8a(new Balance('0x5af3107a4000'))
|
||||
).toEqual(
|
||||
new Uint8Array([
|
||||
3 + ((6 - 4) << 2),
|
||||
|
||||
Reference in New Issue
Block a user