Skip to content

Commit

Permalink
Add LN support
Browse files Browse the repository at this point in the history
  • Loading branch information
223880 committed Aug 7, 2024
1 parent e33ed8c commit 1443495
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
## Roadmap

- [ ] Release PY packages
- [ ] Lightning compatibility
- [x] Lightning compatibility
- [ ] Add more tests
- [ ] Mainnet
12 changes: 12 additions & 0 deletions qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from electrum.bitcoin import TYPE_ADDRESS, is_address
from electrum.wallet import Wallet
from electrum.network import Network
from electrum.lnutil import LnFeatures
from electrum.lnaddr import lndecode
from electrum.lnwallet import LNWallet, LNWorker
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import pad, unpad
Expand Down Expand Up @@ -107,6 +110,15 @@ async def _create_and_sign_coinjoin_transaction(self, wallet: Wallet):

return result is not None

async def create_ln_invoice(self, amount_sat: int, memo: str = ''):
ln_wallet: LNWallet = self.wallet.lnworker
if ln_wallet:
invoice = await ln_wallet.add_request(amount_sat, memo, expiry=3600)
return invoice
else:
print("LNWallet not initialized")
return None

# Dictionary to track request counts and time windows
request_counts = {}
time_window = timedelta(seconds=60) # Time window for rate limiting
Expand Down

0 comments on commit 1443495

Please sign in to comment.