import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const GetDelegation = gql` query GetDelegation($stakingAddress: String) { getDelegation(stakingAddress: $stakingAddress) { } }` const GetDelegation = gql` query GetDelegation($stakingAddress: String) { getDelegation(stakingAddress: $stakingAddress) { staking_address delegations { stakepool { id pool_id_bech32 metadata { name ticker homepage description extended } cost margin pledge active_stake saturation retiring_at_epoch } epoch } } }` const withAppSyncDelegation = compose( graphql(GetDelegation, { name: 'getDelegation', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { stakingAddress: ownProps.stakingAddress } }), props: (props) => { if (props.getDelegation.error) console.log(props.getDelegation.error) return props } }) ) export { GetDelegation, GetDelegation, withAppSyncDelegation }