import { abi , AbiEncodable } from '@pigi/core-utils' ; import { StateObject } from '../../types' ; param encoded returns const fromEncoded = ( encoded ) : AbiStateObject => { const decoded = abi . decode ( AbiStateObject . abiTypes , encoded ) ; return new AbiStateObject ( decoded [ 0 ] , decoded [ 1 ] ) ; } ; /**
 * Represents a basic abi encodable StateObject
 */ export class AbiStateObject implements StateObject , AbiEncodable { public static abiTypes = [ 'address' , 'bytes' ] ; constructor ( readonly predicateAddress , readonly data ) { } returns get encoded ( ) : string { return abi . encode ( AbiStateObject . abiTypes , [ this . predicateAddress , this . data , ] ) ; } returns get jsonified ( ) : any { return { predicateAddress : this . predicateAddress , data : this . data , } ; } param value returns public static from ( value ) { if ( typeof value === 'string' ) { return fromEncoded ( value ) ; } throw new Error ( 'Got invalid argument type when casting to StateObject.' ) ; } }