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

Issue #313: allow checking pending invoices #493

Merged

Conversation

Guilospanck
Copy link
Contributor

  • Updates deprecated datetime.utcfromtimestamp in the cashu/wallet/cli/cli.py file;
  • Adds new options to the invoices CLI command:
    • --only-paid (-op): retrieve only paid invoices;
    • --only-unpaid (-ou): retrieve only unpaid invoices;
    • --pending (-p): retrieve only pending invoices.

Pending invoice was defined as invoices with paid = False and out = False (not sure if this is right).

Closes #313 .

With these options, we are able to return:
1) all invoices (this is the default);
2) pending invoices (paid False, out False);
3) paid invoices;
4) and unpaid invoices.
@callebtc
Copy link
Collaborator

YES! Welcome and thank you.

@Guilospanck
Copy link
Contributor Author

Thanks! Noticed that the checks are not passing. Will try to fix it. I only ran the poetry run pytest and thought it was enough.

@Guilospanck
Copy link
Contributor Author

From what I saw the tests are breaking because of the datetime (the same reason why mypy check is breaking). It was "working on my machine", probably because how it sees the datetime module or something like that.

This new commit should work as mypy is also passing.

@callebtc
Copy link
Collaborator

Were you going to add the "mint tokens" part of issue #313 as well? This only displays the unpaid ones, right?

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 93.67089% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 68.38%. Comparing base (3feb023) to head (2d8e4d0).
Report is 5 commits behind head on main.

Files Patch % Lines
cashu/wallet/cli/cli.py 93.33% 4 Missing ⚠️
cashu/mint/conditions.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #493      +/-   ##
==========================================
+ Coverage   67.89%   68.38%   +0.49%     
==========================================
  Files          76       76              
  Lines        6815     6852      +37     
==========================================
+ Hits         4627     4686      +59     
+ Misses       2188     2166      -22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Guilospanck
Copy link
Contributor Author

Were you going to add the "mint tokens" part of issue #313 as well? This only displays the unpaid ones, right?

Yes, I just need more time to dive into the code and understand where and how to do it

@Guilospanck
Copy link
Contributor Author

@callebtc added the mint token part

@callebtc
Copy link
Collaborator

callebtc commented Mar 30, 2024

@callebtc added the mint token part

Awesome PR thank you! I'd like to add one more nit please, could you change the default behavior to not check (remain offline) and replace the --test flag to something like --check / --mint to do the check / mint?

We'd like to keep the client more offline by default, in case the user just wants to see the invoice requests and not check their state for example.

The default will be false, i.e., if the user does not
pass in the --mint flag, it will not try to mint
the pending invoice.
@Guilospanck
Copy link
Contributor Author

Make sense! Is this it what you meant?

@callebtc
Copy link
Collaborator

callebtc commented Apr 2, 2024

Thank you, this looks great!

I see a bunch of changes in unrelated files. I'm trying to understand why our IDEs seem to have different formatting preferences but this discrepancy doesn't seem to cause a black error in the ruff formatter. Do you have any idea?

@Guilospanck
Copy link
Contributor Author

Good question. I'm not sure. I have the Black Formatter extension installed in my vscode, and only these formatters regarding python:

"[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.codeActionsOnSave": {
      "source.unusedImports": "explicit"
    }
  },

Probably something related to this

@callebtc
Copy link
Collaborator

callebtc commented Apr 3, 2024

🫡

@callebtc callebtc merged commit 3b2f1aa into cashubtc:main Apr 3, 2024
15 checks passed
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.

[Freature request] Wallet CLI: allow checking of all pending invoices
2 participants