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

Implement Balance method and corresponding tests #12

Closed
wants to merge 0 commits into from

Conversation

Regis-Caelum
Copy link

Signed-off-by: Regis-Caelum [email protected]

Issues/PR

Fix Issue #8

Changes

  • Added Balance struct according to celestia documentation on balance response.
  • Implemented Balance method.
  • Added Tests for Balance method.

Changes can be viewed in the files client.go, client_test.go, and type.go.

@liamsi liamsi requested a review from tzdybal May 31, 2022 16:48
client_test.go Outdated
@@ -53,3 +53,9 @@ func TestSubmitPDF(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, txRes)
}

func TestBalance(t *testing.T) {
//t.Skip()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//t.Skip()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: #4 needs to be merged to enable tests.

client_test.go Outdated

func TestBalance(t *testing.T) {
//t.Skip()
_, err := NewClient("http://localhost:26658", WithTimeout(30*time.Second))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the timeout really need to be that long?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not. I used 30 seconds value because of SubmitPFD tests (it waits for celestia block).

Copy link
Member

@tzdybal tzdybal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your submission!

I left suggestions to rename balanceRequest as it's not a request.

I'll merge this PR after #4 is done, so tests can run automatically in CI.

client_test.go Outdated
@@ -53,3 +53,9 @@ func TestSubmitPDF(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, txRes)
}

func TestBalance(t *testing.T) {
//t.Skip()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: #4 needs to be merged to enable tests.

client_test.go Outdated

func TestBalance(t *testing.T) {
//t.Skip()
_, err := NewClient("http://localhost:26658", WithTimeout(30*time.Second))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not. I used 30 seconds value because of SubmitPFD tests (it waits for celestia block).

types.go Outdated Show resolved Hide resolved
client.go Outdated
@@ -35,8 +35,23 @@ func (c *Client) Header(ctx context.Context, height uint64) /* Header */ error {
}

func (c *Client) Balance(ctx context.Context) error {
_ = balanceEndpoint
return errors.New("method Balance not implemented")
var result balanceRequest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var result balanceRequest
var result balanceResponse

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed balance type

@adlerjohn adlerjohn linked an issue Jun 1, 2022 that may be closed by this pull request
@adlerjohn adlerjohn added the enhancement New feature or request label Jun 1, 2022
@tzdybal
Copy link
Member

tzdybal commented Jun 6, 2022

@Regis-Caelum please rebase or merge with main.

@Regis-Caelum
Copy link
Author

merged the changes with main

@tzdybal tzdybal requested review from a team and nashqueue and removed request for a team January 18, 2023 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Balance method
4 participants