Skip to content

Conversation

@Semisol
Copy link
Contributor

@Semisol Semisol commented Feb 11, 2023

Description

Adds the LNbits payment processor. Also includes:

  • small refactoring changes
    • BigInt -> bigint on files that I have touched
    • use utility functions to create PaymentsServices instead of manually doing it
  • migration to switch invoice IDs to TEXT
  • callback refactoring

Related Issue

Closes #163

Motivation and Context

Allowing users to receive pay to relay payments via alternative methods/to their own node.

How Has This Been Tested?

Tested on production with atlas.nostr.land. Would prefer someone else tests this too.

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • All new and existing tests passed.

note: I couldn't find any tests related to pay to relay

@coveralls
Copy link
Collaborator

coveralls commented Feb 11, 2023

Pull Request Test Coverage Report for Build 4149139594

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 34 of 159 (21.38%) changed or added relevant lines in 13 files are covered.
  • 176 unchanged lines in 17 files lost coverage.
  • Overall coverage decreased (-7.5%) to 51.485%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/controllers/invoices/post-invoice-controller.ts 1 2 50.0%
src/factories/lnbits-callback-controller-factory.ts 5 6 83.33%
src/factories/post-invoice-controller-factory.ts 2 3 66.67%
src/utils/event.ts 5 6 83.33%
src/app/app.ts 0 2 0.0%
src/factories/maintenance-worker-factory.ts 0 2 0.0%
src/handlers/request-handlers/post-lnbits-callback-request-handler.ts 2 6 33.33%
src/services/payments-service.ts 1 7 14.29%
src/factories/payments-processor-factory.ts 4 16 25.0%
src/routes/callbacks/index.ts 3 21 14.29%
Files with Coverage Reduction New Missed Lines %
src/repositories/event-repository.ts 1 97.44%
src/handlers/event-strategies/replaceable-event-strategy.ts 2 84.62%
src/routes/callbacks/index.ts 2 17.24%
src/adapters/web-server-adapter.ts 3 56.67%
src/app/worker.ts 3 34.29%
src/handlers/event-message-handler.ts 3 84.96%
src/factories/rate-limiter-factory.ts 4 45.45%
src/utils/settings.ts 4 65.82%
src/cache/client.ts 5 40.0%
src/adapters/redis-adapter.ts 6 6.38%
Totals Coverage Status
Change from base Build 4148256062: -7.5%
Covered Lines: 1087
Relevant Lines: 2054

💛 - Coveralls

@Semisol
Copy link
Contributor Author

Semisol commented Feb 15, 2023

Fixed the broken migration -- it should now work. Also merged all changes into one commit.

also adds two utility functions and ensures the SECRET environment
variable is set.
@antonleviathan
Copy link
Contributor

Hey @Semisol thanks for the PR, looks pretty good, I just added some comments/recommendations to bring it to the finish line and merge!

@Semisol
Copy link
Contributor Author

Semisol commented Feb 17, 2023

tested, works

@github-actions
Copy link

🎉 This PR is included in version 1.22.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

brandonrobinson5060 pushed a commit to VIDA-Global/nostream that referenced this pull request Feb 22, 2023
* feat: add lnbits payment processor

* fix: add lnbits error logging and add lnbits config

* feat: use HMAC instead of IP whitelist for LNbits

also adds two utility functions and ensures the SECRET environment
variable is set.

* refactor: remove unnecessary comment

* fix(pay-to-relay/lnbits): compare by msat scaled amount

* fix: scale balance addition with invoice unit on confirm_invoice
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.

[REQUEST] Pay to Relay with LNbits

4 participants