Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add support for displaying in satoshis #74

Closed
kaloudis opened this issue Apr 21, 2020 · 3 comments
Closed

Feature request: Add support for displaying in satoshis #74

kaloudis opened this issue Apr 21, 2020 · 3 comments

Comments

@kaloudis
Copy link

mBTC isn't very commonly used and sats are becoming somewhat of a standard. It would be awesome if lightning-charge displayed units in satoshis, especially when used on a paywall like wordpress-lightning-publisher

@kaloudis kaloudis changed the title Add support for displaying in satoshis Feature request: Add support for displaying in satoshis Apr 21, 2020
@kaloudis
Copy link
Author

I'm happy to implement this myself, but would like to get some discussion going first on how this should function.

@shesek
Copy link
Contributor

shesek commented Apr 23, 2020

Implementing this was pretty straightforward so I went ahead and made the BTC display unit configurable using a new metadata.checkout.display_unit field. It can be set to one of msat, sat, bit, milli or btc. For example:

$ curl $CHARGE/invoice -d msatoshi=150000 -d metadata[checkout][display_unit]=bit

Or with json:

$ curl $CHARGE/invoice -H 'Content-Type: application/json' -d '{"msatoshi":150000,"metadata":{"checkout":{"display_unit":"bit"}}}'

I also changed the default display unit to satoshis.

Cheers!

@kaloudis
Copy link
Author

Great job! Closing this out and opening ElementsProject/wordpress-lightning-publisher#8 to track in Wordpress Lightning Publisher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants