import * as solc from 'solc' ; import * as Web3 from 'web3' ; import { FullText } from './sources' ; export interface MethodDevDoc { details ? : string ; params ? : { [ method ] : string ; } ; return ? : any ; } export interface DevDoc { author ? : string ; title ? : string ; name ? : string ; methods ? : { [ signature ] : MethodDevDoc ; } ; } export interface AbiDocDefinition { } export interface UserDoc { methods ? : { [ signature ] : any ; } ; } export interface ContractEntry { devdoc ? : DevDoc ; userdoc ? : UserDoc ; abi ? : Web3 . ContractAbi ; abiDocs ? : AbiDocDefinition [ ] ; } export interface CompiledResult { contracts : { [ fileName ] : { [ name ] : ContractEntry ; } ; } ; } export async function doc ( fullText ) { const standardInput = { language : 'Solidity' , sources : { } , settings : { outputSelection : { '*' : { '*' : [ 'devdoc' , 'userdoc' , 'abi' ] } } } } ; for ( let name in fullText ) { standardInput . sources [ name ] = { content : fullText [ name ] } ; } let result = solc . compileStandard ( JSON . stringify ( standardInput ) ) ; return JSON . parse ( result ) as CompiledResult ; }