ATLBitLab / twelvecash

API for creating BIP-353 usernames
https://twelve.cash
MIT License
22 stars 5 forks source link

Fix and test createBip21FromParams function #43

Closed chdwlch closed 1 month ago

chdwlch commented 2 months ago

Added tests for createBip21FromParams and fixed a bug. Also fixed the createBip21 test that I broke with recent changes.

When the user requests a new paycode for sats, it's added to the database and set to pending status. After the user pays the invoice, we recreate the actual bip353 string from the Params stored in the database from the initial request.

From these tests I found a bug where only an on chain address was added to the bip353 txt if they had an on chain address plus any other additional parameters.

Examples of this working now

dig txt testa3.user._bitcoin-payment.regtest.12cash.dev
testa3.user._bitcoin-payment.regtest.12cash.dev. 3600 IN TXT "bitcoin:bc123?label=yeet&lno=lno123&sp=sp123&lnurl=lnurl123"

dig txt testa4.user._bitcoin-payment.regtest.12cash.dev
testa4.user._bitcoin-payment.regtest.12cash.dev. 3600 IN TXT "bitcoin:?lno=lno123&sp=sp123&lnurl=lnurl123"
netlify[bot] commented 2 months ago

Deploy Preview for 12cashdev ready!

Name Link
Latest commit 10e774954a521f7dd6483d0ed44356225b4b9e1b
Latest deploy log https://app.netlify.com/sites/12cashdev/deploys/66c3b0709797250008a8d4a3
Deploy Preview https://deploy-preview-43--12cashdev.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.