You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey everyone, this has been annoying us all since forever and as the node is not going to change its behaviour about this, we should do in the SDK at least.
Currently, an error is thrown when getting the balance for an account not yet known to the chain. Tis is wrong for a syntactical reason and for the matters of good software engineering:
Getting a balance for an empty account is a perfectly fine thing to do and the answer needs to be 0 instead of an error
Errors should be only thrown if something goes bad / unexpected happens actually, which is not the case here.
I therefore suggest to return simply 0 and end this mess once and for all. Something cool like
{
balance: 0,
message: account not known to chain
}
would have been cool, but that would break with the current return format. Anyway, 99,99999% of all balance requests are the actually check the balance, not whether the account is known to the chain yet, so let's maybe have a separate method for that ?
The text was updated successfully, but these errors were encountered:
Hey everyone, this has been annoying us all since forever and as the node is not going to change its behaviour about this, we should do in the SDK at least.
Currently, an error is thrown when getting the balance for an account not yet known to the chain. Tis is wrong for a syntactical reason and for the matters of good software engineering:
0
instead of an errorI therefore suggest to return simply
0
and end this mess once and for all. Something cool likewould have been cool, but that would break with the current return format. Anyway, 99,99999% of all balance requests are the actually check the balance, not whether the account is known to the chain yet, so let's maybe have a separate method for that ?
The text was updated successfully, but these errors were encountered: