Skip to content

Commit

Permalink
fix: update claim URL and refactor (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimalmadhur authored Aug 19, 2024
1 parent f211fc7 commit 09ed873
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/rewards/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const (
All ClaimType = "all"
Unclaimed ClaimType = "unclaimed"
Claimed ClaimType = "claimed"

GetClaimableRewardsEndpoint = "grpc/eigenlayer.RewardsService/GetClaimableRewards"
GetEarnedTokensForStrategyEndpoint = "grpc/eigenlayer.RewardsService/GetEarnedTokensForStrategy"
)

type ShowConfig struct {
Expand Down Expand Up @@ -93,7 +96,7 @@ func ShowRewards(cCtx *cli.Context) error {
cCtx.App.Metadata["network"] = config.ChainID.String()

url := testnetUrl
if config.Environment == "prod" {
if config.Environment == "mainnet" {
url = mainnetUrl
} else if config.Environment == "preprod" {
url = preprodUrl
Expand All @@ -105,7 +108,7 @@ func ShowRewards(cCtx *cli.Context) error {
"days": fmt.Sprintf("%d", absInt64(config.NumberOfDays)),
}
resp, err := post(
fmt.Sprintf("%s/%s", url, "grpc/eigenlayer.RewardsService/GetEarnedTokensForStrategy"),
fmt.Sprintf("%s/%s", url, GetEarnedTokensForStrategyEndpoint),
requestBody,
)
if err != nil {
Expand Down Expand Up @@ -133,7 +136,8 @@ func ShowRewards(cCtx *cli.Context) error {
requestBody := map[string]string{
"earnerAddress": config.EarnerAddress.String(),
}
resp, err := post(fmt.Sprintf("%s/%s", url, "grpc/eigenlayer.RewardsService/GetUpcomingRewardDetails"), requestBody)
claimableRewardsUrl := fmt.Sprintf("%s/%s", url, GetClaimableRewardsEndpoint)
resp, err := post(claimableRewardsUrl, requestBody)
if err != nil {
return err
}
Expand Down

0 comments on commit 09ed873

Please sign in to comment.