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: logic for appending api returned validators #20

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

drohit-cb
Copy link
Contributor

What changed? Why?

This PR helps fix the logic for handling validators returned from the backend.

Testing

  1. Tested with this example script
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/coinbase/coinbase-sdk-go/pkg/coinbase"
)

func main() {
	ctx := context.Background()
	client, err := coinbase.NewClient(
		coinbase.WithAPIKeyFromJSON("api-key.json"),
	)
	if err != nil {
		log.Fatalf("error creating coinbase client: %v", err)
	}

	validators, err := client.ListValidators(ctx, "ethereum-holesky", coinbase.Eth)
	if err != nil {
		log.Fatalf("error listing rewards: %v", err)
	}

	for _, validator := range validators {
		fmt.Println(validator.ToString())
	}

	validator, err := client.GetValidator(ctx, "ethereum-holesky", coinbase.Eth, "my-validator")
	if err != nil {
		log.Fatalf("error getting validator: %v", err)
	}

	fmt.Printf("\nValidator id [%s] has state: %s", validator.ID(), validator.Status())
}
  1. Added unit tests to cover 100% of validator.go

Qualified Impact

@cb-heimdall
Copy link

cb-heimdall commented Aug 27, 2024

✅ Heimdall Review Status

Requirement Status More Info
Reviews 2/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@drohit-cb drohit-cb force-pushed the fix_validators_api branch 2 times, most recently from d165729 to 3eba717 Compare August 27, 2024 18:30
@drohit-cb drohit-cb requested a review from marcin-cb August 27, 2024 18:33
@drohit-cb drohit-cb marked this pull request as ready for review August 27, 2024 18:33
marcin-cb
marcin-cb previously approved these changes Aug 27, 2024
@deangalvin-cb
Copy link
Contributor

@drohit-cb you can update the changelog with the version 0.0.2, and cut a tag for this! :D

@drohit-cb drohit-cb merged commit ab753df into master Aug 27, 2024
3 checks passed
@drohit-cb drohit-cb deleted the fix_validators_api branch August 27, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants