import { ErrorUnexpectedResult } from '@aragon/connect-core' ; import { QueryResult } from '@aragon/connect-thegraph' ; import Transaction from '../../models/Transaction' ; import { TransactionData } from '../../types' ; export function parseTransactions ( result ) { const transactions = result . data . transactions ; if ( ! transactions ) { throw new ErrorUnexpectedResult ( 'Unable to parse transactions.' ) ; } const datas = transactions . map ( ( tx ) : TransactionData => { return tx ; } ) ; return datas . map ( ( data ) => { return new Transaction ( data ) ; } ) ; }