import { AbiParameter , EventDeclaration , FunctionDeclaration } from '../parser/abiParser' ; import { ArrayType , TupleType } from '../parser/parseEvmType' ; export function getFullSignatureAsSymbolForEvent ( event ) { return `${ event . name }_${ event . inputs . map ( ( e ) => { if ( e . type . type === 'array' ) { return e . type . itemType . originalType + '_array' ; } else { return e . type . originalType ; } } ) . join ( '_' ) }` ; } export function getFullSignatureForEvent ( event ) { return `${ event . name }(${ event . inputs . map ( ( e ) => e . type . originalType ) . join ( ',' ) })` ; } export function getIndexedSignatureForEvent ( event ) { const indexedType = event . inputs . filter ( ( e ) => e . isIndexed ) ; return `${ event . name }(${ indexedType . map ( ( e ) => e . type . originalType ) . join ( ',' ) })` ; } export function getArgumentForSignature ( argument ) { if ( argument . type . originalType === 'tuple' ) { return `(${ ( argument . type as TupleType ) . components . map ( ( i ) => getArgumentForSignature ( i ) ) . join ( ',' ) })` ; } else if ( argument . type . originalType === 'tuple[]' ) { return getArgumentForSignature ( { name : '' , type : ( argument . type as ArrayType ) . itemType } ) + '[]' ; } else { return argument . type . originalType ; } } export function getSignatureForFn ( fn ) { return `${ fn . name }(${ fn . inputs . map ( ( i ) => getArgumentForSignature ( i ) ) . join ( ',' ) })` ; }