-
Notifications
You must be signed in to change notification settings - Fork 809
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
Fix: Get account by index instead of name #1135
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportBase: 69.53% // Head: 69.41% // Decreases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #1135 +/- ##
==========================================
- Coverage 69.53% 69.41% -0.13%
==========================================
Files 158 158
Lines 26598 26643 +45
==========================================
- Hits 18494 18493 -1
- Misses 8104 8150 +46
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I think this PR should include tests. |
Could you point me in the right direction as to which files I should look into regarding the same. |
I have created separate cli options to get account information via name and index, bot for rpc and http.
|
@pinheadmz could you please review this pull request? |
@@ -608,6 +618,7 @@ class CLI { | |||
this.log(' $ abandon [hash]: Abandon a transaction.'); | |||
this.log(' $ account create [account-name]: Create account.'); | |||
this.log(' $ account get [account-name]: Get account details.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please specify that this method gets account by name.
/** | ||
* Get wallet account. | ||
* @param {Number} id | ||
* @param {Number|String} accountIndex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The account index is supposed to be a Number, not a String.
@@ -901,6 +912,10 @@ class Wallet extends EventEmitter { | |||
return this.client.getAccount(this.id, account); | |||
} | |||
|
|||
getAccountIndex(account) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need JSDocs here.
acct = num; | ||
} | ||
|
||
const account = await req.wallet.getAccount(acct); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will have to create a new method in the wallet/wallet.js
file and name it getAccountByAccountIndex
as there is already a method named getAccountIndex
. I also ask you to name all the references of getAccountIndex
to getAccountByAccountIndex
.
const addrs = []; | ||
|
||
if (name === '') | ||
name = 'default'; | ||
let acct = valid.get(0, 'default'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right @pinheadmz could you please take a look.
Fixes #968
Applied a temporary fix regarding the issue.