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

feat(jellyfish-api-core): add wallet listWallets RPC #953

Merged
merged 5 commits into from
Feb 21, 2022

Conversation

kodemon
Copy link
Contributor

@kodemon kodemon commented Jan 6, 2022

What this PR does / why we need it:

/kind feature

Which issue(s) does this PR fixes?:

Add listWallets rpc as part of ongoing #48

@kodemon kodemon self-assigned this Jan 6, 2022
@codeclimate
Copy link

codeclimate bot commented Jan 6, 2022

Code Climate has analyzed commit 24bc79d and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Jan 6, 2022

Codecov Report

Merging #953 (24bc79d) into main (a0a93ca) will decrease coverage by 0.19%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #953      +/-   ##
==========================================
- Coverage   94.69%   94.50%   -0.20%     
==========================================
  Files         158      169      +11     
  Lines        4806     5037     +231     
  Branches      620      657      +37     
==========================================
+ Hits         4551     4760     +209     
- Misses        255      259       +4     
- Partials        0       18      +18     
Impacted Files Coverage Δ
packages/jellyfish-api-core/src/category/wallet.ts 100.00% <100.00%> (ø)
apps/ocean-api/src/modules/PlaygroundModule.ts 42.30% <0.00%> (-53.85%) ⬇️
packages/jellyfish-address/src/p2wsh.ts 48.27% <0.00%> (-51.73%) ⬇️
apps/ocean-api/src/modules/BlockchainCppModule.ts 50.00% <0.00%> (-38.24%) ⬇️
...s/ocean-api/src/controllers/filters/ErrorFilter.ts 6.55% <0.00%> (-37.71%) ⬇️
apps/ocean-api/src/modules/ActuatorModule.ts 66.66% <0.00%> (-33.34%) ⬇️
...ps/ocean-api/src/controllers/ActuatorController.ts 66.66% <0.00%> (-33.34%) ⬇️
packages/jellyfish-testing/src/poolpair.ts 80.95% <0.00%> (-19.05%) ⬇️
packages/jellyfish-api-core/src/category/loan.ts 92.42% <0.00%> (-7.58%) ⬇️
...ackages/jellyfish-api-core/src/category/account.ts 95.38% <0.00%> (-4.62%) ⬇️
... and 37 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0a93ca...24bc79d. Read the comment docs.

@kodemon kodemon marked this pull request as ready for review January 6, 2022 07:13
canonbrother
canonbrother previously approved these changes Jan 6, 2022
chee-chyuan
chee-chyuan previously approved these changes Jan 10, 2022
@kodemon kodemon dismissed stale reviews from chee-chyuan and canonbrother via add7b3a January 13, 2022 06:02
@netlify
Copy link

netlify bot commented Jan 13, 2022

✔️ Deploy Preview for jellyfish-defi ready!

🔨 Explore the source changes: e997a38

🔍 Inspect the deploy log: https://app.netlify.com/sites/jellyfish-defi/deploys/620fd9fe6b6e900007667439

😎 Browse the preview: https://deploy-preview-953--jellyfish-defi.netlify.app

chee-chyuan
chee-chyuan previously approved these changes Jan 13, 2022
surangap
surangap previously approved these changes Feb 17, 2022
canonbrother
canonbrother previously approved these changes Feb 17, 2022
@kodemon kodemon dismissed stale reviews from surangap and chee-chyuan via e997a38 February 18, 2022 17:40
@kodemon kodemon requested a review from fuxingloh February 18, 2022 17:40
})

it('should listWallets', async () => {
await expect(wallet.listWallets()).resolves.toEqual(['', 'test'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, what is your thoughts on https://github.com/DeFiCh/jellyfish/pull/953/files#diff-1045b44753a823e6c6779b841a5e8d54fb6286c2961837d95fb2232b711b7218R25 ?

Would you expect something more like

const master = new MasterNodeRegTestContainer()
const { container, rpc: { wallet } } = Testing.create(master)

or

const master = new MasterNodeRegTestContainer()
const container = Testing.create(master)

Personally I am more leaning towards the way its currently written, but would be good to align with expectations in Jellyfish for these sort of approaches.

Pulling out variables of objects like this was a pretty neat ES update and I find myself using it quite often in other projects for method arguments and variable assignment.

Destructuring Assignment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, destructuring is great in functional method parameters, but in tests, it's pretty counterintuitive as it introduces too much symbol memorization when one is trying to understand what is going on.

I am also towards reducing unnecessary symbols that are not part of the testing context. By only introducing symbols that are part of the testing context. Optimizing for test readability over anything else, as for writing test and writing component we should take a different approach.

E.g.

const master = new MasterNodeRegTestContainer()
const { container, rpc: { wallet } } = Testing.create(master)

For the above, you expose 2 new symbols for the reader to track and understand as they are reading the test.

Vs.

const testing = Testing.create(new MasterNodeRegTestContainer())

For the above, you only have 1 symbol which is the "testing" framework object for the reader to follow along.

Subsequently:

testing.container.generate(1)
testing.rpc.wallet.doSomething(1)

It's contextually more understandable for the user to know that you are accessing the testing - container - to generate 1 block.

That's for tests. And it only makes sense for tests, as you are trying to make it as effortless as possible for the reviewer to understand what's going on. However for non-tests, I am in favor of destructuring as it reduces non-relevant symbols by focusing on what is required for each method/function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the feedback and I agree with your views on this. Will update the tests to reflect this pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated tests, thanks again for the input on this 👍🏻

@kodemon kodemon requested a review from fuxingloh February 21, 2022 04:39
@fuxingloh fuxingloh merged commit 1a11e4a into main Feb 21, 2022
@fuxingloh fuxingloh deleted the kodemon/rpc-listwallets branch February 21, 2022 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants