When we return a bitcoin amount, our JSON responses currently specify the unit (btc, sat, msat) in the parameter name, but it's a bit ugly and is missing in some places.
Maybe it would be better to include the unit explicitly in the response. I see two different options:
- Instead of returning a numeric value, return a string including the unit (e.g. "2500 msat", "0.45 btc", "1.5 mbtc"). The drawback is that the string must be parsed to extract the amount (but it's trivial to do).
- Instead of returning a numeric value, return an object with a
unit field (e.g. {"amount": 2500, "unit": "msat"}, {"amount": 0.45, "unit": "btc"}, {"amount": 1.5, "unit": "mbtct"})
This would also be desirable for inputs, we could use strings with a unit suffix (e.g. `fundingFeerate="2500 sat/byte").
When we return a bitcoin amount, our JSON responses currently specify the unit (btc, sat, msat) in the parameter name, but it's a bit ugly and is missing in some places.
Maybe it would be better to include the unit explicitly in the response. I see two different options:
unitfield (e.g.{"amount": 2500, "unit": "msat"},{"amount": 0.45, "unit": "btc"},{"amount": 1.5, "unit": "mbtct"})This would also be desirable for inputs, we could use strings with a unit suffix (e.g. `fundingFeerate="2500 sat/byte").