HathorNetwork / hathor-wallet-service-old

MIT License
4 stars 4 forks source link

feat: added getAddressAtIndex method and API #425

Closed andreabadesso closed 1 year ago

andreabadesso commented 1 year ago

Motivation

Currently the getAddressAtIndex method in the wallet service facade is broken since it expects this.seed to have the seed loaded and we don't keep it in memory, so it derives an address from an empty Mnemonic:

https://github.com/HathorNetwork/hathor-wallet-lib/blob/652b94e72021dd11cd0372d3a5b750d9d83f0e29/src/wallet/wallet.ts#L991

We could ask for the user's PIN and use his seed to derive the address at an index, but that would also force us to also ask the PIN on the fullnode facade, which is something we don't want to do.

Acceptance Criteria

Security Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #425 (a3a71a4) into master (196e53f) will increase coverage by 0.03%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #425      +/-   ##
==========================================
+ Coverage   95.56%   95.60%   +0.03%     
==========================================
  Files          40       40              
  Lines        2436     2458      +22     
  Branches      274      278       +4     
==========================================
+ Hits         2328     2350      +22     
  Misses        108      108              
Impacted Files Coverage Δ
src/api/utils.ts 96.66% <ø> (ø)
src/types.ts 98.65% <ø> (ø)
src/api/addresses.ts 98.24% <100.00%> (+0.62%) :arrow_up:
src/api/errors.ts 100.00% <100.00%> (ø)
src/db/index.ts 99.67% <100.00%> (+<0.01%) :arrow_up: