import { QueryResult } from '@aragon/connect-thegraph' ; import { DisputableAppData } from '../../types' ; import DisputableApp from '../../models/DisputableApp' ; function buildDisputableApp ( disputableApp , connector ) { const { id , address , agreement , currentCollateralRequirement , activated , } = disputableApp ; const disputableAppData = { id , address , activated , agreementId : agreement . id , currentCollateralRequirementId : currentCollateralRequirement . id , } ; return new DisputableApp ( disputableAppData , connector ) ; } export function parseDisputableApps ( result , connector ) { const disputables = result . data . disputables ; if ( ! disputables ) { throw new Error ( 'Unable to parse disputable apps.' ) ; } return disputables . map ( ( disputableApp ) => buildDisputableApp ( disputableApp , connector ) ) ; }