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

Fetch and Process Balance Sheet data #55

Open
wants to merge 53 commits into
base: Release-0.0.6
Choose a base branch
from

Conversation

evansmj
Copy link
Contributor

@evansmj evansmj commented Apr 27, 2024

This commit uses the sql rpc command to fetch the data for the Balance Sheet.

getBalanceSheet() was added to use-http.ts as a standalone function instead of getting it via AppContext so that we can pass parameters more easily to it. TimeGranularity represents the way we should group the data e.g. Monthly, Weekly, Daily.

The sql needs to be transformed for the balance sheet, this was done in a new file bookkeeper-transform.ts since it takes some effort. Future transform functions such as for Sats Flow would go in this file. transformToBalanceSheet() is complex because we are limited in what methods we can use in the sql rpc call, so I need to do things like grouping and aggregation of credits - debits.

ShahanaFarooqui and others added 30 commits October 26, 2023 14:42
zsh has an expansion with '='.
if you run `source ./env.sh` in zsh, it will error `zsh: = not found`.
Using [[ ]] in the if statement is safer and results in`=` evaluating
properly with [[ ]] conditionals.
Fix README.md typos
This commit adds react-router so that we can route to other pages, such as the upcoming Bookkeeper Dashboard page.
It is set up so that the Header is shared among both the initial aka /home screen and the /bookkeeper screen. A redirect for '/' to '/home/' was added to support this shared header. Tests were written in App.test.tsx for this.

There is no discernible difference to a user with this change, other than if they manually navigate to /bookkeeper they will see a blank page. There is no button navigating to /bookkeeper and will not be until it is ready for production. This is so that regular pull request reviews can be done vs having to review a giant pull request with the new bookkeeper dashboard feature.

Test dependencies were updated and ts-jest + axios-mock-adapter were added so that components that import axios could be rendered in tests.
- Broke CLNHome and Bookkeeper into their own components
- Keeping App smaller with Root component and root router only
- Undo typescript downgrade from v5 to v4.
- Adding env.sh to gitignore to avoid its future commits
The "no transactions helper text" displays two different strings depending on if the node has active channels or not.  This commit fixes a bug where these two are backwards and adds tests in CLNTransactionsList.test.tsx.
…tion-channels-text

Fix empty transactions channel helper text
Adds tests for many components.  npm run test should result in all tests passing.
- Fixed DateBox test with locale
- Fixed timer and canvas warnings
- Moved mock data into utilities/test-utilities
…n-fix

Adding local env.sh and indentation fixes
Renamed the type Channels to ChannelsDomain since it has extra fields added.  ChannelsDto is the response from the network.  This was done so it is clear what comes from the network and what is calculated, and to map fields from listpeerchannels into the previous Channel domain model.  Removed some fields that are not used and not available in listpeerchannels: direction, max_htlc_value_in_flight_msat, htlc_minimum_msat, last_tx_fee_msat.  Other fields were duplicates such as spendable_msatoshi and deleted since spendable_msat exists in listpeerchannels as well as in the original Channels object.

use-http sendRequestToStore is now able to handle multiple rpc methods and it bundles the responses together.  This allows for sending 2+ rpc calls to 1 state, such as for the new channels AppContextType.

Removed the controllers/lightning.ts behavior of checking if listpeers was called and adding node.alias to the response.  This was so that the domain layer would handle setting domain data.

channels was added as an AppContextType.  It combines listpeerchannels and listnodes so that the node aliases can be set to the channels.

Added comment to isCompatibleVersion to explain what it does.

Added Channels component tests.  Update mock store to use channels instead of listChannels.
The code is written as per newer version on CLN.

For older CLN nodes, we will collect channels arrays from listPeers.peers array and convert them into newer channels type by adding id as peer_id and connected and peer_connected. Remaining data stays the same.
For eg. changed `satoshi_to_us` to `to_us_sat`, `satoshi_to_them` to `to_them_sat` etc.
…listpeerchannels

Update to listpeerchannels
…data

Updated the mock data and checks with more realistic dataset
…emoval

Remove msatoshi_received, msatoshi, msatoshi_sent from Payments and I…
…-compatble

RC version compatibility check
This commit uses the `sql` rpc command to fetch the data for the Balance Sheet.

getBalanceSheet() was added to use-http.ts as a standalone function instead of getting it via AppContext so that we can pass parameters more easily to it.  TimeGranularity represents the way we should group the data e.g. Monthly, Weekly, Daily.

The sql needs to be transformed for the balance sheet, this was done in a new file bookkeeper-transform.ts since it takes some effort.  Future transform functions such as for Sats Flow would go in this file.  transformToBalanceSheet() is complex because we are limited in what methods we can use in the `sql` rpc call, so I need to do things like grouping and aggregation of credits - debits.
@evansmj evansmj changed the base branch from Release-0.0.5 to main June 2, 2024 16:31
@evansmj evansmj changed the base branch from main to Release-0.0.5 June 2, 2024 16:31
@evansmj evansmj changed the base branch from Release-0.0.5 to main June 2, 2024 16:50
@evansmj
Copy link
Contributor Author

evansmj commented Jun 11, 2024

hey @ShahanaFarooqui no rush on this pr. but for this one i am wondering what you think of the way i handle fetching the sql data and sending it to the components. in the meantime i'll keep tweaking the design.

@evansmj evansmj changed the base branch from main to Release-0.0.6 July 16, 2024 19:42
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