import { ab2hexstring , hex2VarBytes , hexstring2ab , StringReader } from '../utils' ; const UINT160SIZE = 20 ; export default class Uint160 { static deserialize ( sr ) { const result = new Uint160 ( ) ; const hex = sr . readNextBytes ( ) ; let v = hexstring2ab ( hex ) ; v = v . reverse ( ) ; const value = new Uint8Array ( v ) ; result . value = value ; return result ; } value : Uint8Array ; compareTo ( o ) { const x = this . value ; const y = o . value ; for ( let i = UINT160SIZE - 1 ; i >= 0 ; i -- ) { if ( x [ i ] > y [ i ] ) { return 1 ; } if ( x [ i ] < y [ i ] ) { return - 1 ; } } return 0 ; } serialize ( ) { const hex = ab2hexstring ( this . value ) ; return hex2VarBytes ( hex ) ; } }