Fix: Get account by index instead of name#1135
Conversation
Codecov Report❌ Patch coverage is
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 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
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.
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.
The account index is supposed to be a Number, not a String.
| return this.client.getAccount(this.id, account); | ||
| } | ||
|
|
||
| getAccountIndex(account) { |
| acct = num; | ||
| } | ||
|
|
||
| const account = await req.wallet.getAccount(acct); |
There was a problem hiding this comment.
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.
|
|
||
| if (name === '') | ||
| name = 'default'; | ||
| let acct = valid.get(0, 'default'); |
There was a problem hiding this comment.
This doesn't seem right @pinheadmz could you please take a look.



Fixes #968
Applied a temporary fix regarding the issue.