Skip to content
New issue

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

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

Already on GitHub? # to your account

Quality improvements for accounts_balances RPC #4228

Conversation

thsfs
Copy link
Contributor

@thsfs thsfs commented May 9, 2023

Address issue reported by nanocurrency/nano-docs#665. Related to #4223, but this applies to accounts_balances RPC.

accounts_balances

Request:

{  
  "action": "accounts_balances",  
  "accounts": ["nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3", "nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz", "nano_1hrts7hcoozxccnffoq9hqhngnn9jz783usapejm57ejtqcyz9dpso1bibuy"]  
}

Response (note the second account number is a not found account -- it returns a 0 balance):

{
    "balances": {
        "nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3": {
            "balance": "325586539664609129644855132177",
            "pending": "2309370929000000000000000000000000",
            "receivable": "2309370929000000000000000000000000"
        },
        "nano_1hrts7hcoozxccnffoq9hqhngnn9jz783usapejm57ejtqcyz9dpso1bibuy": {
            "balance": "0",
            "pending": "0",
            "receivable": "0"
        }
    },
    "errors": {
        "nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz": "Bad account number"
    }
}

Request & Response when there are no errors:

Request:

{  
  "action": "accounts_frontiers",  
  "accounts": ["nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3"]  
}

Response:

{
    "balances": {
        "nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3": {
            "balance": "325586539664609129644855132177",
            "pending": "2309370929000000000000000000000000",
            "receivable": "2309370929000000000000000000000000"
        }
    }
}

Request & Response when all entries return errors:

Request:

{  
  "action": "accounts_frontiers",  
  "accounts": ["nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz"]  
}

Response:

{
    "errors": {
        "nano_36uccgpjzhjsdbj44wm1y5hyz8gefx3wjpp1jircxt84nopxkxti5bzq1rnz": "Bad account number"
    }
}

@thsfs thsfs requested a review from pwojcikdev May 9, 2023 22:42
@thsfs thsfs added documentation This item indicates the need for or supplies updated or expanded documentation rpc Changes related to Remote Procedure Calls labels May 9, 2023
@thsfs thsfs requested a review from clemahieu May 9, 2023 22:42
@thsfs thsfs added this to the V25.0 milestone May 9, 2023
@clemahieu clemahieu merged commit 21a8fb1 into nanocurrency:develop May 15, 2023
clemahieu pushed a commit that referenced this pull request May 15, 2023
@thsfs thsfs deleted the rpc-errors-improvements-on-accounts-balances branch May 22, 2023 17:09
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation This item indicates the need for or supplies updated or expanded documentation rpc Changes related to Remote Procedure Calls
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants