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

update function to api v2 #30

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

bassjobsen
Copy link
Contributor

@a1300
Copy link
Contributor

a1300 commented Sep 17, 2018

@bassjobsen

Review:

1

please use string interpolation instead of + adding strings
Example:

- getApi().get('/api/v2/accounts/' + address, null, function (err, result) {
+ getApi().get(`/api/v2/accounts/${address}`, null, function (err, result) {

2

I get an error if I call getBalance without an address. You don't need to necessary fix this. It depends upon how similar functions handle this:

bin/asch-cli getbalance

Error:

/home/a1300/test/asch-cli/plugins/api.js:50
    console.log(err || result.account.xas);
                                      ^

TypeError: Cannot read property 'xas' of undefined

3

If I call bin/asch-cli getbalance AHMCKebuL2nRYDgszf9J2KjVZzAw95WUyB and the address wasn't initated before (it has no entry in the Account table) then it throws an error:

Response:

{
  "success": true,
  "unconfirmedAccount": null,
  "latestBlock": {
    "height": -1
  },
  "version": {
    "version": "1.5.0",
    "build": "DEFAULT_BUILD_TIME",
    "net": "testnet"
  }
}

Error:

/home/a1300/test/asch-cli/plugins/api.js:51
    console.log(err || result.account.xas);
                                      ^

TypeError: Cannot read property 'xas' of undefined

Please fix the small problems. Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants