Skip to content

Commit

Permalink
User right address when paying onchain (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
roeierez authored Dec 17, 2024
1 parent 1056758 commit 25aa762
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ class SendChainSwapFormPage extends StatefulWidget {
final OnchainPaymentLimitsResponse paymentLimits;
final BitcoinAddressData? btcAddressData;
final TextEditingController amountController;
final TextEditingController addressController;

const SendChainSwapFormPage({
required this.formKey,
required this.bitcoinCurrency,
required this.paymentLimits,
required this.amountController,
required this.addressController,
super.key,
this.btcAddressData,
});
Expand All @@ -23,8 +25,7 @@ class SendChainSwapFormPage extends StatefulWidget {
State<SendChainSwapFormPage> createState() => _SendChainSwapFormPageState();
}

class _SendChainSwapFormPageState extends State<SendChainSwapFormPage> {
final TextEditingController _addressController = TextEditingController();
class _SendChainSwapFormPageState extends State<SendChainSwapFormPage> {

bool _useEntireBalance = false;

Expand All @@ -48,7 +49,7 @@ class _SendChainSwapFormPageState extends State<SendChainSwapFormPage> {
child: SendChainSwapForm(
formKey: widget.formKey,
amountController: widget.amountController,
addressController: _addressController,
addressController: widget.addressController,
useEntireBalance: _useEntireBalance,
btcAddressData: widget.btcAddressData,
bitcoinCurrency: widget.bitcoinCurrency,
Expand Down
8 changes: 7 additions & 1 deletion lib/routes/send_payment/chainswap/send_chainswap_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class _SendChainSwapPageState extends State<SendChainSwapPage> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final TextEditingController _amountController = TextEditingController();
final TextEditingController _addressController = TextEditingController();

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -75,6 +76,7 @@ class _SendChainSwapPageState extends State<SendChainSwapPage> {
return SendChainSwapFormPage(
formKey: _formKey,
amountController: _amountController,
addressController: _addressController,
bitcoinCurrency: currencyState.bitcoinCurrency,
paymentLimits: snapshot.onchainPaymentLimits!,
btcAddressData: widget.btcAddressData,
Expand Down Expand Up @@ -118,7 +120,7 @@ class _SendChainSwapPageState extends State<SendChainSwapPage> {
FadeInRoute<void>(
builder: (_) => SendChainSwapConfirmationPage(
amountSat: amount,
onchainRecipientAddress: _amountController.text,
onchainRecipientAddress: getAddress(),
isMaxValue: false,
),
),
Expand Down Expand Up @@ -156,4 +158,8 @@ class _SendChainSwapPageState extends State<SendChainSwapPage> {
}
return amount;
}

String getAddress() {
return _addressController.text;
}
}

0 comments on commit 25aa762

Please sign in to comment.