mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 11:29:23 +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(
|
||||
derivePathType: type,
|
||||
);
|
||||
await ref.read(mainDBProvider).isar.writeTxn(() async {
|
||||
await ref.read(mainDBProvider).isar.addresses.put(address!);
|
||||
final isar = ref.read(mainDBProvider).isar;
|
||||
await isar.writeTxn(() async {
|
||||
await isar.addresses.put(address!);
|
||||
});
|
||||
final info = ref.read(pWalletInfo(walletId));
|
||||
await info.updateReceivingAddress(
|
||||
newAddress: address.value,
|
||||
isar: isar,
|
||||
);
|
||||
} else {
|
||||
await wallet.generateNewReceivingAddress();
|
||||
address = null;
|
||||
|
|
|
@ -110,9 +110,15 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
|||
address = await wallet.generateNextReceivingAddress(
|
||||
derivePathType: type,
|
||||
);
|
||||
await ref.read(mainDBProvider).isar.writeTxn(() async {
|
||||
await ref.read(mainDBProvider).isar.addresses.put(address!);
|
||||
final isar = ref.read(mainDBProvider).isar;
|
||||
await isar.writeTxn(() async {
|
||||
await isar.addresses.put(address!);
|
||||
});
|
||||
final info = ref.read(pWalletInfo(walletId));
|
||||
await info.updateReceivingAddress(
|
||||
newAddress: address.value,
|
||||
isar: isar,
|
||||
);
|
||||
} else {
|
||||
await wallet.generateNewReceivingAddress();
|
||||
address = null;
|
||||
|
@ -172,8 +178,6 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
|||
}
|
||||
}
|
||||
|
||||
StreamSubscription<Address?>? _streamSub;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
walletId = widget.walletId;
|
||||
|
@ -238,7 +242,9 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
_streamSub?.cancel();
|
||||
for (final subscription in _addressSubMap.values) {
|
||||
subscription.cancel();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue