BlueWallet / LndHub

Wrapper for Lightning Network Daemon. It provides separate accounts for end-users
http://LndHub.io
MIT License
752 stars 185 forks source link

WIP: Feature/create lnurl withdraw link #324

Closed kiwiidb closed 2 years ago

kiwiidb commented 2 years ago

Once merged, resolves https://github.com/BlueWallet/LndHub/issues/119 on the server-side.

Pseudocode for the WIP stuff:

router.get(withdrawPrimaryAPIRoute + ':secret', async function (req, res) {
    //look up wd from db
    //check status
    //respond with lnurl payload (description invoice must contain secret)
});

router.get(withdrawSecondaryAPIRoute + ':secret', async function (req, res) {
    //look up wd from db
    //check amount
    //check status
    //check if invoice description matches (contains secret)
    //set status to pending in db
    //get token for user
    //use frisbee to call our own server impersonating as user and attempt to pay invoice
    //callback: set to success (== remove) or failed
    //Q: what if payment stuck?
    //respond with lnurl payload and response from frisbee (success / fail / pending)
});

Open question: what if the LN payment gets stuck?

To do:

Out of scope of this PR:

Screenshots

Schermafbeelding 2021-11-05 om 12 08 33

Schermafbeelding 2021-11-05 om 12 08 54

godSaysHODL commented 2 years ago

this is absolutely beautiful! no reviews yet?

godSaysHODL commented 2 years ago

@Overtorment @ncoelho Did you guys ever check this out? If so, any thoughts about it? Kiwi is doing some cool stuff here imo