algorand / go-algorand-sdk

Algorand Golang SDK

Home Page:https://pkg.go.dev/github.com/algorand/go-algorand-sdk/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose `min-balance` field in **Account Info**

tzaffi opened this issue · comments

Problem

min-balance is available in algod but not in the go SDK.

Solution

algorand/go-algorand#3287 has introduced min-balance to the response of algod's /v2/accounts/{{ACCOUNT}} as well as to the goal account info.

  • When querying the REST API avove, expose the min-balance field
  • Pass appropriate cucumber tests

Dependencies

Urgency

Low

Should the JSON tag omitempty?

Since the response is always expected to provide min-balance we should always provide it. If for some reason it's not provided by algod this is an error situation and should be handled accordingly (and I don't have a simple answer for that).

I believe that level of validation would need to happen after marshaling has occurred. What I'm asking is when the min-balance field is zero, should we marshal to "min-balance": 0 or exclude the field all together with emitemtpy.

I believe every account (even accounts with 0 balance) has a minimum balance of 100,000 microAlgos, so we should never expect the response to contain a 0.

This has bitten me recently and I had to hack around it in a semi-awkward way in my backend code. Isn't this just adding a single field to the models.Account structure? SDKs should be in-sync with the APIs, so I'm curious why these SDK changes have remained opened for over a year in every SDK.

I'd PR it myself but I can't build or run the tests on my M1 (I've had longstanding issue open for that as well).

Is anyone fixing this soon?

Addressed by #641