author liangqin.fan gmail import { Codec , Hash , Int32 } from "as-scale-codec" ; export class MapEntry implements Codec { entries : Hash ; size : Int32 ; constructor ( entries = new Hash ( ) , size = 0 ) { this . entries = entries ; this . size = new Int32 ( size ) ; } toU8a ( ) { let arr = new Array < u8 > ( ) ; arr = arr . concat ( this . entries . toU8a ( ) ) ; arr = arr . concat ( this . size . toU8a ( ) ) ; return arr ; } encodedLength ( ) { return this . entries . encodedLength ( ) + this . size . encodedLength ( ) ; } populateFromBytes ( bytes , index = 0 ) { this . entries . populateFromBytes ( bytes , index ) ; let startIndex = index + this . entries . encodedLength ( ) ; this . size . populateFromBytes ( bytes , startIndex ) ; } eq ( other ) { return this . entries . eq ( other . entries ) && this . size . unwrap ( ) == other . size . unwrap ( ) ; } notEq ( other ) { return ! this . eq ( other ) ; } }