mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
fix incentive rewards query REST res (#802)
This commit is contained in:
parent
c60365f12e
commit
44d4d19565
@ -128,6 +128,8 @@ func executeBothRewardQueries(w http.ResponseWriter, cliCtx context.CLIContext,
|
|||||||
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var hardClaims types.HardLiquidityProviderClaims
|
||||||
|
cliCtx.Codec.MustUnmarshalJSON(hardRes, &hardClaims)
|
||||||
|
|
||||||
usdxMintingBz, err := cliCtx.Codec.MarshalJSON(usdxMintingParams)
|
usdxMintingBz, err := cliCtx.Codec.MarshalJSON(usdxMintingParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -140,7 +142,26 @@ func executeBothRewardQueries(w http.ResponseWriter, cliCtx context.CLIContext,
|
|||||||
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var usdxMintingClaims types.USDXMintingClaims
|
||||||
|
cliCtx.Codec.MustUnmarshalJSON(usdxMintingRes, &usdxMintingClaims)
|
||||||
|
|
||||||
cliCtx = cliCtx.WithHeight(height)
|
cliCtx = cliCtx.WithHeight(height)
|
||||||
rest.PostProcessResponse(w, cliCtx, append(hardRes, usdxMintingRes...))
|
|
||||||
|
type rewardResult struct {
|
||||||
|
HardClaims types.HardLiquidityProviderClaims `json:"hard_claims" yaml:"hard_claims"`
|
||||||
|
UsdxMintingClaims types.USDXMintingClaims `json:"usdx_minting_claims" yaml:"usdx_minting_claims"`
|
||||||
|
}
|
||||||
|
|
||||||
|
res := rewardResult{
|
||||||
|
HardClaims: hardClaims,
|
||||||
|
UsdxMintingClaims: usdxMintingClaims,
|
||||||
|
}
|
||||||
|
|
||||||
|
resBz, err := cliCtx.Codec.MarshalJSON(res)
|
||||||
|
if err != nil {
|
||||||
|
rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to marshal result: %s", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rest.PostProcessResponse(w, cliCtx, resBz)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user