import { BytesReader , CompactInt } from ".." ; import { DecodedData } from "../interfaces/DecodedData" ; import { Bool } from "../Bool" ; import { AbstractArray } from "./AbstractArray" ; export class BoolArray extends AbstractArray < Bool , bool > { description public decodeElement ( value ) { const scaleBool = Bool . fromU8a ( [ value [ 0 ] ] ) ; return new DecodedData < bool > ( scaleBool . unwrap ( ) , scaleBool . encodedLength ( ) ) ; } description public encodedLength ( ) { return ( new CompactInt ( changetype < i64 > ( this . values . length ) ) . encodedLength ( ) ) + super . values . length ; } description param bytes param index populateFromBytes ( bytes , index = 0 ) { const bytesReader = new BytesReader ( bytes . slice ( index ) ) ; const data = bytesReader . readInto < CompactInt > ( ) ; for ( let i = 0 ; i < data . unwrap ( ) - index ; i ++ ) { const element = bytesReader . readInto < Bool > ( ) ; this . values . push ( element . unwrap ( ) ) ; } } description static fromU8a ( input ) { return AbstractArray . fromU8a < BoolArray > ( input ) ; } @ inline @ operator ( "==" ) static eq ( a , b ) { return a . eq ( b ) ; } @ inline @ operator ( "!=" ) static notEq ( a , b ) { return a . notEq ( b ) ; } }