Currently, lnbits's lndhub extension allows existing lnbits wallets to be accessed from BlueWallet. However, this extension does not appear to allow creating wallets directly from BlueWallet.
When BlueWallet attempts to create a new wallet, it issues a POST request to /create under the LndHub server path (which for lnbits is /lndhub/ext). Currently this returns a 404 not found because the route is not implemented. Instead, would it be possible to create a new lnbits wallet and return the connection information?
Here is the current /create implementation from LndHub:
router.post('/create', postLimiter, async function (req, res) {
logger.log('/create', [req.id]);
// Valid if the partnerid isn't there or is a string (same with accounttype)
if (! (
(!req.body.partnerid || (typeof req.body.partnerid === 'string' || req.body.partnerid instanceof String))
&& (!req.body.accounttype || (typeof req.body.accounttype === 'string' || req.body.accounttype instanceof String))
) ) return errorBadArguments(res);
if (config.sunset) return errorSunset(res);
let u = new User(redis, bitcoinclient, lightning);
await u.create();
await u.saveMetadata({ partnerid: req.body.partnerid, accounttype: req.body.accounttype, created_at: new Date().toISOString() });
res.send({ login: u.getLogin(), password: u.getPassword() });
});
https://github.com/BlueWallet/LndHub/blob/master/controllers/api.js#L142
Currently, lnbits's lndhub extension allows existing lnbits wallets to be accessed from BlueWallet. However, this extension does not appear to allow creating wallets directly from BlueWallet.
When BlueWallet attempts to create a new wallet, it issues a
POSTrequest to/createunder the LndHub server path (which for lnbits is/lndhub/ext). Currently this returns a 404 not found because the route is not implemented. Instead, would it be possible to create a new lnbits wallet and return the connection information?Here is the current
/createimplementation from LndHub:https://github.com/BlueWallet/LndHub/blob/master/controllers/api.js#L142