import { EthAddress } from "@joincivil/typescript-types" ; import { Dispatch } from "react-redux" ; import { AnyAction } from "redux" ; import { CivilHelper } from "../../apis/CivilHelper" ; export enum challengeActions { ADD_GRANT_APPEAL_TX = "ADD_GRANT_APPEAL_TX" , FETCH_GRANT_APPEAL_TX = "FETCH_GRANT_APPEAL_TX" } export const addGrantAppealTx = ( listingAddress , txData ) : AnyAction => { return { type : challengeActions . ADD_GRANT_APPEAL_TX , data : { listingAddress , txData } , } ; } ; export const fetchGrantAppealTx = ( listingAddress ) => { return { type : challengeActions . FETCH_GRANT_APPEAL_TX , data : { listingAddress } , } ; } ; export const fetchAndAddGrantAppealTx = ( helper , listingAddress ) : any => { return async ( dispatch ) : Promise < AnyAction > => { dispatch ( fetchGrantAppealTx ( listingAddress ) ) ; const tcr = await helper . getTCR ( ) ; const grantAppealTx = await tcr . getRawGrantAppealTxData ( listingAddress ) ; return dispatch ( addGrantAppealTx ( listingAddress , grantAppealTx ) ) ; } ; } ;