Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update claim URL and refactor #196

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading