import { AbiEncodable , Range } from '../../types' ; import { abi } from '../index' ; import { BigNumber } from '../number' ; import { hexStringify } from '../misc' ; param encoded returns const fromEncoded = ( encoded ) : AbiRange => { const decoded = abi . decode ( AbiRange . abiTypes , encoded ) ; return new AbiRange ( new BigNumber ( decoded [ 0 ] . toString ( ) ) , new BigNumber ( decoded [ 1 ] . toString ( ) ) ) ; } ; /**
 * Represents a basic abi encodable AbiRange
 */ export class AbiRange implements Range , AbiEncodable { public static abiTypes = [ 'uint256' , 'uint256' ] ; constructor ( readonly start , readonly end ) { } returns get encoded ( ) : string { return abi . encode ( AbiRange . abiTypes , [ hexStringify ( this . start ) , hexStringify ( this . end ) , ] ) ; } returns get jsonified ( ) : any { return { start : hexStringify ( this . start ) , end : hexStringify ( this . end ) , } ; } param value returns public static from ( value ) { if ( typeof value === 'string' ) { return fromEncoded ( value ) ; } throw new Error ( 'Got invalid argument type when casting to AbiStateUpdate.' ) ; } param other returns public equals ( other ) { return this . encoded === other . encoded ; } }