-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: Pay lightning invoice with USDP #1706
Conversation
Otherwise we are running into a rendering overflow on smaller screens (iPhone SE).
678d34e
to
05e96c0
Compare
A caveat I've noticed during testing is that subtracting the fee and a potential negative pnl, we might end up buying a little bit less sats back than what we use to pay the invoice. I guess we'll have to iterate over that a bit to find the best UX there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK, nice work!
final tradeValuesChangeNotifier = context.watch<TradeValuesChangeNotifier>(); | ||
|
||
final tradeValues = tradeValuesChangeNotifier.fromDirection(Direction.long); | ||
tradeValues.updateLeverage(Leverage(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to update the leverage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the default leverage is 2 and if I wouldn't set it to 1 we would get an incorrect sats amount from the quantity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't say much about the flutter code :)
Why did you go for composing it through flutter and not through rust?
I think it would be cleaner having one function in rust to pay an invoice using the usdp balance. I guess I did it through flutter because I was faster that way. Happy to refactor in a follow up PR. |
No worries, let's go! |
@@ -27,45 +33,110 @@ void showConfirmPaymentModal(BuildContext context, Destination destination, Amou | |||
builder: (BuildContext context) { | |||
return SingleChildScrollView( | |||
child: SizedBox( | |||
height: 320, | |||
height: 420, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course 420, it's a multiple of 42!
Amount amt = destination.amount; | ||
if (destination.amount.sats == 0) { | ||
if (payWithUsdp) { | ||
// if the destination does not specify an amount and we ar paying with the usdp balance we |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃
// if the destination does not specify an amount and we ar paying with the usdp balance we | |
// if the destination does not specify an amount and we are paying with the usdp balance we |
@@ -105,7 +105,7 @@ class WalletScreen extends StatelessWidget { | |||
size: 14, | |||
), | |||
SizedBox( | |||
width: 10, | |||
width: 7, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
man, today you have the eastereggs hidden!
3 7
changed in this file = 3 * 7
= 21
= 10101
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
goose bumps |
Not shown on the video, but ..
fixes #1683
starts some rework on #1684