import AbiFunction from './abiFunction' ; import { Parameter } from './parameter' ; /**
 * Decribes the Abi info.
 */ export default class AbiInfo { static parseJson ( json ) { const a = new AbiInfo ( ) ; const obj = JSON . parse ( json ) ; a . hash = obj . hash ; a . entrypoint = obj . entrypoint ; a . functions = obj . functions ; return a ; } hash : string ; entrypoint : string ; functions : AbiFunction [ ] = [ ] ; getHash ( ) { return this . hash ; } getEntryPoint ( ) { return this . entrypoint ; } getFunction ( name ) { for ( const v of this . functions ) { if ( v . name === name ) { const parameters = v . parameters . map ( ( p ) => new Parameter ( p . name , p . type , '' ) ) ; return new AbiFunction ( v . name , v . returntype , parameters ) ; } } throw Error ( 'not found' ) ; } }