Skip to content

Commit

Permalink
Merge pull request #718 from cypherstack/wallets_refactor
Browse files Browse the repository at this point in the history
Wallets refactor
  • Loading branch information
julian-CStack authored Jan 17, 2024
2 parents d3cd8d9 + 393e27b commit d521188
Show file tree
Hide file tree
Showing 30 changed files with 309 additions and 5,633 deletions.
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

0 comments on commit d521188

Please sign in to comment.