mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-18 16:44:32 +00:00
fix: receive view bug
This commit is contained in:
parent
1f0ee995b9
commit
3da57bc150
2 changed files with 19 additions and 7 deletions
|
@ -113,9 +113,15 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
|
||||||
address = await wallet.generateNextReceivingAddress(
|
address = await wallet.generateNextReceivingAddress(
|
||||||
derivePathType: type,
|
derivePathType: type,
|
||||||
);
|
);
|
||||||
await ref.read(mainDBProvider).isar.writeTxn(() async {
|
final isar = ref.read(mainDBProvider).isar;
|
||||||
await ref.read(mainDBProvider).isar.addresses.put(address!);
|
await isar.writeTxn(() async {
|
||||||
|
await isar.addresses.put(address!);
|
||||||
});
|
});
|
||||||
|
final info = ref.read(pWalletInfo(walletId));
|
||||||
|
await info.updateReceivingAddress(
|
||||||
|
newAddress: address.value,
|
||||||
|
isar: isar,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
await wallet.generateNewReceivingAddress();
|
await wallet.generateNewReceivingAddress();
|
||||||
address = null;
|
address = null;
|
||||||
|
|
|
@ -110,9 +110,15 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
||||||
address = await wallet.generateNextReceivingAddress(
|
address = await wallet.generateNextReceivingAddress(
|
||||||
derivePathType: type,
|
derivePathType: type,
|
||||||
);
|
);
|
||||||
await ref.read(mainDBProvider).isar.writeTxn(() async {
|
final isar = ref.read(mainDBProvider).isar;
|
||||||
await ref.read(mainDBProvider).isar.addresses.put(address!);
|
await isar.writeTxn(() async {
|
||||||
|
await isar.addresses.put(address!);
|
||||||
});
|
});
|
||||||
|
final info = ref.read(pWalletInfo(walletId));
|
||||||
|
await info.updateReceivingAddress(
|
||||||
|
newAddress: address.value,
|
||||||
|
isar: isar,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
await wallet.generateNewReceivingAddress();
|
await wallet.generateNewReceivingAddress();
|
||||||
address = null;
|
address = null;
|
||||||
|
@ -172,8 +178,6 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamSubscription<Address?>? _streamSub;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
walletId = widget.walletId;
|
walletId = widget.walletId;
|
||||||
|
@ -238,7 +242,9 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_streamSub?.cancel();
|
for (final subscription in _addressSubMap.values) {
|
||||||
|
subscription.cancel();
|
||||||
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue