import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const GetBlock = gql` query GetBlock($date: AWSDate) { getBlock(date: $date) { first { number epoch_number slot_number epoch_slot_number size transaction_count time } last { number epoch_number slot_number epoch_slot_number size transaction_count time } } }` const GetBlock = gql` query GetBlock($blockNumber: Int) { getBlock(blockNumber: $blockNumber) { number epoch_number slot_number epoch_slot_number size transaction_count time } }` const withAppSyncBlock = compose( graphql(GetBlock, { name: 'getBlock', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { date: ownProps.date } }), props: (props) => { if (props.getBlock.error) console.log(props.getBlock.error) return props } }) ) export { GetBlock, GetBlock, withAppSyncBlock }