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

Wallets refactor #718

Merged
merged 10 commits into from
Jan 17, 2024
2 changes: 1 addition & 1 deletion lib/pages/exchange_view/confirm_change_now_send.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class _ConfirmChangeNowSendViewState

try {
if (wallet is FiroWallet && widget.shouldSendPublicFiroFunds == false) {
txidFuture = wallet.confirmSendLelantus(txData: widget.txData);
txidFuture = wallet.confirmSendSpark(txData: widget.txData);
} else {
txidFuture = wallet.confirmSend(txData: widget.txData);
}
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/exchange_view/exchange_step_views/step_2_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ class _Step2ViewState extends ConsumerState<Step2View> {

_toController.text = wallet.info.name;
model.recipientAddress = (await wallet
.getCurrentReceivingAddress())!
.value;
.getCurrentReceivingAddress())
?.value ??
wallet
.info.cachedReceivingAddress;

setState(() {
enableNext =
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/exchange_view/exchange_step_views/step_4_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,8 @@ class _Step4ViewState extends ConsumerState<Step4View> {

Future<TxData> txDataFuture;

// TODO: [prio=high] Firo spark

if (wallet is FiroWallet && !firoPublicSend) {
txDataFuture = wallet.prepareSendLelantus(
txDataFuture = wallet.prepareSendSpark(
txData: TxData(
recipients: [
(
Expand Down
16 changes: 9 additions & 7 deletions lib/pages/exchange_view/send_from_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
recipients: [
(
address: address,
amount: amount, isChange: false,
amount: amount,
isChange: false,
),
],
memo: memo,
Expand All @@ -303,19 +304,21 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
recipients: [
(
address: address,
amount: amount, isChange: false,
amount: amount,
isChange: false,
),
],
feeRateType: FeeRateType.average,
),
);
} else {
txDataFuture = firoWallet.prepareSendLelantus(
txDataFuture = firoWallet.prepareSendSpark(
txData: TxData(
recipients: [
(
address: address,
amount: amount, isChange: false,
amount: amount,
isChange: false,
),
],
// feeRateType: FeeRateType.average,
Expand Down Expand Up @@ -481,7 +484,7 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
),
Text(
ref.watch(pAmountFormatter(coin)).format(ref
.watch(pWalletBalance(walletId))
.watch(pWalletBalanceTertiary(walletId))
.spendable),
style: STextStyles.itemSubtitle(context),
),
Expand Down Expand Up @@ -543,8 +546,7 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
Text(
ref.watch(pAmountFormatter(coin)).format(
ref
.watch(
pWalletBalanceSecondary(walletId))
.watch(pWalletBalance(walletId))
.spendable,
),
style: STextStyles.itemSubtitle(context),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ class _DesktopChooseFromStackState
CustomTextButton(
text: "Select wallet",
onTap: () async {
final address = wallet.info.cachedReceivingAddress;
final address =
(await wallet.getCurrentReceivingAddress())
?.value ??
wallet.info.cachedReceivingAddress;

if (mounted) {
Navigator.of(context).pop(
Expand Down
Loading
Loading