feat: phoenixd wallet integration (#2362)

* phoenixd integration
---------

Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
Bitkarrot 2024-04-26 01:18:38 -07:00 committed by GitHub
parent 4b4bed59cd
commit c04c13b2f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 662 additions and 9 deletions

View file

@ -40,6 +40,14 @@
"lnbits_admin_key": "f171ba022a764e679eef950b21fb1c04",
"user_agent": "LNbits/Tests"
}
},
"phoenixd": {
"wallet_class": "PhoenixdWallet",
"settings": {
"phoenixd_api_endpoint": "http://127.0.0.1:8555",
"phoenixd_api_password": "f171ba022a764e679eef950b21fb1c04f171ba022a764e679eef950b21fb1c04",
"user_agent": "LNbits/Tests"
}
}
},
"functions": {
@ -96,6 +104,16 @@
},
"method": "GET"
}
},
"phoenixd": {
"status_endpoint": {
"uri": "/getinfo",
"headers": {
"Authorization": "Basic OmYxNzFiYTAyMmE3NjRlNjc5ZWVmOTUwYjIxZmIxYzA0ZjE3MWJhMDIyYTc2NGU2NzllZWY5NTBiMjFmYjFjMDQ=",
"User-Agent": "LNbits/Tests"
},
"method": "GET"
}
}
},
"tests": [
@ -157,6 +175,20 @@
}
}
]
},
"phoenixd": {
"status_endpoint": [
{
"response_type": "json",
"response": {
"channels": [
{
"balanceSat": 55
}
]
}
}
]
}
}
},
@ -214,6 +246,14 @@
"response": "test-error"
}
]
},
"phoenixd": {
"status_endpoint": [
{
"response_type": "json",
"response": "test-error"
}
]
}
}
},
@ -264,6 +304,14 @@
"response": {}
}
]
},
"phoenixd": {
"status_endpoint": [
{
"response_type": "json",
"response": {}
}
]
}
}
},
@ -314,6 +362,14 @@
"response": "data-not-json"
}
]
},
"phoenixd": {
"status_endpoint": [
{
"response_type": "data",
"response": "data-not-json"
}
]
}
}
},
@ -379,6 +435,17 @@
}
}
]
},
"phoenixd": {
"status_endpoint": [
{
"response_type": "response",
"response": {
"response": "Not Found",
"status": 404
}
}
]
}
}
},
@ -445,6 +512,16 @@
},
"method": "POST"
}
},
"phoenixd": {
"create_invoice_endpoint": {
"uri": "/createinvoice",
"headers": {
"Authorization": "Basic OmYxNzFiYTAyMmE3NjRlNjc5ZWVmOTUwYjIxZmIxYzA0ZjE3MWJhMDIyYTc2NGU2NzllZWY5NTBiMjFmYjFjMDQ=",
"User-Agent": "LNbits/Tests"
},
"method": "POST"
}
}
},
"tests": [
@ -543,6 +620,23 @@
}
}
]
},
"phoenixd": {
"create_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"amountSat": "555000",
"description": "Test Invoice",
"externalId": ""
},
"response_type": "json",
"response": {
"paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96",
"serialized": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n"
}
}
]
}
}
},
@ -624,6 +718,22 @@
}
}
]
},
"phoenixd": {
"create_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"amountSat": "555000",
"description": "Test Invoice",
"externalId": ""
},
"response_type": "json",
"response": {
"message": "Test Error"
}
}
]
}
}
},
@ -718,6 +828,22 @@
}
}
]
},
"phoenixd": {
"create_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"amountSat": "555000",
"description": "Test Invoice",
"externalId": ""
},
"response_type": "json",
"response": {
"paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96"
}
}
]
}
}
},
@ -801,6 +927,20 @@
"response": "data-not-json"
}
]
},
"phoenixd": {
"create_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"amountSat": "555000",
"description": "Test Invoice",
"externalId": ""
},
"response_type": "data",
"response": "data-not-json"
}
]
}
}
},
@ -899,6 +1039,23 @@
}
}
]
},
"phoenixd": {
"create_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"amountSat": "555000",
"description": "Test Invoice",
"externalId": ""
},
"response_type": "response",
"response": {
"response": "Not Found",
"status": 404
}
}
]
}
}
},
@ -987,6 +1144,16 @@
},
"method": "GET"
}
},
"phoenixd": {
"pay_invoice_endpoint": {
"uri": "/payinvoice",
"headers": {
"Authorization": "Basic OmYxNzFiYTAyMmE3NjRlNjc5ZWVmOTUwYjIxZmIxYzA0ZjE3MWJhMDIyYTc2NGU2NzllZWY5NTBiMjFmYjFjMDQ=",
"User-Agent": "LNbits/Tests"
},
"method": "POST"
}
}
},
"tests": [
@ -1012,7 +1179,8 @@
"request_type": "data",
"request_body": {
"invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
"maxfee": 25000
"maxfeepercent": "119.04761905",
"exemptfee": 0
},
"response_type": "json",
"response": {
@ -1123,6 +1291,22 @@
}
}
]
},
"phoenixd": {
"pay_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"invoice": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n"
},
"response_type": "json",
"response": {
"paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96",
"routingFeeSat": -50,
"paymentPreimage": "0000000000000000000000000000000000000000000000000000000000000000"
}
}
]
}
}
},
@ -1266,7 +1450,8 @@
]
}
],
"lnbits": []
"lnbits": [],
"phoenixd": []
}
},
{
@ -1291,7 +1476,8 @@
"request_type": "data",
"request_body": {
"invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
"maxfee": 25000
"maxfeepercent": "119.04761905",
"exemptfee": 0
},
"response_type": "json",
"response": {
@ -1369,6 +1555,30 @@
}
}
]
},
"phoenixd": {
"pay_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"invoice": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n"
},
"response_type": "json",
"response": {
"message": "Test Error"
}
},
{
"request_type": "json",
"request_body": {
"invoice": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n"
},
"response_type": "json",
"response": {
"reason": "Test Error"
}
}
]
}
}
},
@ -1394,7 +1604,8 @@
"request_type": "data",
"request_body": {
"invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
"maxfee": 25000
"maxfeepercent": "119.04761905",
"exemptfee": 0
},
"response_type": "json",
"response": {}
@ -1450,7 +1661,22 @@
}
]
},
"lnbits": {}
"lnbits": {},
"phoenixd": {
"pay_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"invoice": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n"
},
"response_type": "json",
"response": {
"paymentHash": "e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96",
"routingFeeSat": -50
}
}
]
}
}
},
{
@ -1475,7 +1701,8 @@
"request_type": "data",
"request_body": {
"invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
"maxfee": 25000
"maxfeepercent": "119.04761905",
"exemptfee": 0
},
"response_type": "data",
"response": "data-not-json"
@ -1555,6 +1782,18 @@
}
}
]
},
"phoenixd": {
"pay_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"invoice": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n"
},
"response_type": "data",
"response": "data-not-json"
}
]
}
}
},
@ -1580,7 +1819,8 @@
"request_type": "data",
"request_body": {
"invoice": "lnbc210n1pjlgal5sp5xr3uwlfm7ltumdjyukhys0z2rw6grgm8me9k4w9vn05zt9svzzjspp5ud2jdfpaqn5c2k2vphatsjypfafyk8rcvkvwexnrhmwm94ex4jtqdqu24hxjapq23jhxapqf9h8vmmfvdjscqpjrzjqta942048v7qxh5x7pxwplhmtwfl0f25cq23jh87rhx7lgrwwvv86r90guqqnwgqqqqqqqqqqqqqqpsqyg9qxpqysgqylngsyg960lltngzy90e8n22v4j2hvjs4l4ttuy79qqefjv8q87q9ft7uhwdjakvnsgk44qyhalv6ust54x98whl3q635hkwgsyw8xgqjl7jwu",
"maxfee": 25000
"maxfeepercent": "119.04761905",
"exemptfee": 0
},
"response_type": "response",
"response": {
@ -1669,6 +1909,21 @@
"response": {}
}
]
},
"phoenixd": {
"pay_invoice_endpoint": [
{
"request_type": "json",
"request_body": {
"invoice": "lnbc5550n1pnq9jg3sp52rvwstvjcypjsaenzdh0h30jazvzsf8aaye0julprtth9kysxtuspp5e5s3z7felv4t9zrcc6wpn7ehvjl5yzewanzl5crljdl3jgeffyhqdq2f38xy6t5wvxqzjccqpjrzjq0yzeq76ney45hmjlnlpvu0nakzy2g35hqh0dujq8ujdpr2e42pf2rrs6vqpgcsqqqqqqqqqqqqqqeqqyg9qxpqysgqwftcx89k5pp28435pgxfl2vx3ksemzxccppw2j9yjn0ngr6ed7wj8ztc0d5kmt2mvzdlcgrludhz7jncd5l5l9w820hc4clpwhtqj3gq62g66n"
},
"response_type": "response",
"response": {
"response": "Not Found",
"status": 404
}
}
]
}
}
},
@ -1746,6 +2001,16 @@
},
"method": "GET"
}
},
"phoenixd": {
"get_invoice_status_endpoint": {
"uri": "/payments/incoming/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96",
"headers": {
"Authorization": "Basic OmYxNzFiYTAyMmE3NjRlNjc5ZWVmOTUwYjIxZmIxYzA0ZjE3MWJhMDIyYTc2NGU2NzllZWY5NTBiMjFmYjFjMDQ=",
"User-Agent": "LNbits/Tests"
},
"method": "GET"
}
}
},
"tests": [
@ -1829,6 +2094,18 @@
}
}
]
},
"phoenixd": {
"get_invoice_status_endpoint": [
{
"response_type": "json",
"response": {
"isPaid": true,
"fees": 50,
"preimage": "0000000000000000000000000000000000000000000000000000000000000000"
}
}
]
}
}
},
@ -1885,6 +2162,10 @@
"lnbits": {
"description": "lnbits.py doesn't handle the 'failed' status for `get_invoice_status`",
"get_invoice_status_endpoint": []
},
"phoenixd": {
"description": "phoenixd.py doesn't handle the 'failed' status for `get_invoice_status`",
"get_invoice_status_endpoint": []
}
}
},
@ -2064,6 +2345,42 @@
}
}
]
},
"phoenixd": {
"get_invoice_status_endpoint": [
{
"description": "no data",
"response_type": "json",
"response": {}
},
{
"description": "not paid",
"response_type": "json",
"response": {
"isPaid": false
}
},
{
"description": "paid and missing data",
"response_type": "json",
"response": {
"isPaid": true
}
},
{
"description": "bad json",
"response_type": "data",
"response": "data-not-json"
},
{
"description": "http 404",
"response_type": "response",
"response": {
"response": "Not Found",
"status": 404
}
}
]
}
}
},
@ -2136,6 +2453,16 @@
},
"method": "GET"
}
},
"phoenixd": {
"get_payment_status_endpoint": {
"uri": "/payments/outgoing/e35526a43d04e985594c0dfab848814f524b1c786598ec9a63beddb2d726ac96",
"headers": {
"Authorization": "Basic OmYxNzFiYTAyMmE3NjRlNjc5ZWVmOTUwYjIxZmIxYzA0ZjE3MWJhMDIyYTc2NGU2NzllZWY5NTBiMjFmYjFjMDQ=",
"User-Agent": "LNbits/Tests"
},
"method": "GET"
}
}
},
"tests": [
@ -2229,6 +2556,18 @@
}
}
]
},
"phoenixd": {
"get_payment_status_endpoint": [
{
"response_type": "json",
"response": {
"isPaid": true,
"fees": 1000,
"preimage": "0000000000000000000000000000000000000000000000000000000000000000"
}
}
]
}
}
},
@ -2305,6 +2644,10 @@
},
"lnbits": {
"get_payment_status_endpoint": []
},
"phoenixd": {
"description": "phoenixd.py doesn't handle the 'failed' status for `get_invoice_status`",
"get_payment_status_endpoint": []
}
}
},
@ -2535,6 +2878,42 @@
}
}
]
},
"phoenixd": {
"get_payment_status_endpoint": [
{
"description": "no data",
"response_type": "json",
"response": {}
},
{
"description": "not paid",
"response_type": "json",
"response": {
"isPaid": false
}
},
{
"description": "paid and missing data",
"response_type": "json",
"response": {
"isPaid": true
}
},
{
"description": "bad json",
"response_type": "data",
"response": "data-not-json"
},
{
"description": "http 404",
"response_type": "response",
"response": {
"response": "Not Found",
"status": 404
}
}
]
}
}
},