feat: add LNBits wallet plugin integration
- Introduced LNBits as a Lightning Network wallet provider for Lamassu ATMs. - Added configuration options for LNBits in the environment variables. - Implemented core functionalities including invoice creation, payment processing, balance monitoring, and payment status tracking. - Created unit tests for the LNBits plugin to ensure functionality and error handling. - Updated development environment setup to include LNBits configuration.
This commit is contained in:
parent
2f0cc901eb
commit
fc761844b7
7 changed files with 757 additions and 28 deletions
|
|
@ -0,0 +1,36 @@
|
|||
const db = require('./db')
|
||||
|
||||
exports.up = function (next) {
|
||||
const sql = `
|
||||
INSERT INTO user_config (name, display_name, type, data_type, config_type, enabled, secret, options)
|
||||
VALUES
|
||||
('lnbitsEndpoint', 'LNBits Server URL', 'text', 'string', 'wallets', false, false, null),
|
||||
('lnbitsAdminKey', 'LNBits Admin Key', 'text', 'string', 'wallets', false, true, null)
|
||||
ON CONFLICT (name) DO NOTHING;
|
||||
|
||||
-- Add LNBits as a valid wallet option for Lightning Network
|
||||
INSERT INTO user_config (name, display_name, type, data_type, config_type, enabled, secret, options)
|
||||
VALUES
|
||||
('LN_wallet', 'Lightning Network Wallet', 'text', 'string', 'wallets', true, false,
|
||||
'[{"code": "lnbits", "display": "LNBits"}, {"code": "galoy", "display": "Galoy (Blink)"}, {"code": "bitcoind", "display": "Bitcoin Core"}]')
|
||||
ON CONFLICT (name)
|
||||
DO UPDATE SET options = EXCLUDED.options
|
||||
WHERE user_config.options NOT LIKE '%lnbits%';
|
||||
`
|
||||
|
||||
db.multi(sql, next)
|
||||
}
|
||||
|
||||
exports.down = function (next) {
|
||||
const sql = `
|
||||
DELETE FROM user_config
|
||||
WHERE name IN ('lnbitsEndpoint', 'lnbitsAdminKey');
|
||||
|
||||
-- Remove LNBits from wallet options
|
||||
UPDATE user_config
|
||||
SET options = REPLACE(options, ', {"code": "lnbits", "display": "LNBits"}', '')
|
||||
WHERE name = 'LN_wallet';
|
||||
`
|
||||
|
||||
db.multi(sql, next)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue