|
@ -40,7 +40,7 @@ from functools import partial |
|
|
from collections import defaultdict |
|
|
from collections import defaultdict |
|
|
from numbers import Number |
|
|
from numbers import Number |
|
|
from decimal import Decimal |
|
|
from decimal import Decimal |
|
|
from typing import TYPE_CHECKING, List, Optional, Tuple, Union, NamedTuple, Sequence, Dict, Any, Set |
|
|
from typing import TYPE_CHECKING, List, Optional, Tuple, Union, NamedTuple, Sequence, Dict, Any, Set, Iterable |
|
|
from abc import ABC, abstractmethod |
|
|
from abc import ABC, abstractmethod |
|
|
import itertools |
|
|
import itertools |
|
|
import threading |
|
|
import threading |
|
@ -830,19 +830,31 @@ class Abstract_Wallet(ABC, Logger, EventListener): |
|
|
def get_addr_balance(self, address): |
|
|
def get_addr_balance(self, address): |
|
|
return self.adb.get_balance([address]) |
|
|
return self.adb.get_balance([address]) |
|
|
|
|
|
|
|
|
def get_utxos(self, **kwargs): |
|
|
def get_utxos( |
|
|
domain = self.get_addresses() |
|
|
self, |
|
|
|
|
|
domain: Optional[Iterable[str]] = None, |
|
|
|
|
|
**kwargs, |
|
|
|
|
|
): |
|
|
|
|
|
if domain is None: |
|
|
|
|
|
domain = self.get_addresses() |
|
|
return self.adb.get_utxos(domain=domain, **kwargs) |
|
|
return self.adb.get_utxos(domain=domain, **kwargs) |
|
|
|
|
|
|
|
|
def get_spendable_coins(self, domain, *, nonlocal_only=False) -> Sequence[PartialTxInput]: |
|
|
def get_spendable_coins( |
|
|
|
|
|
self, |
|
|
|
|
|
domain: Optional[Iterable[str]] = None, |
|
|
|
|
|
*, |
|
|
|
|
|
nonlocal_only: bool = False, |
|
|
|
|
|
) -> Sequence[PartialTxInput]: |
|
|
confirmed_only = self.config.get('confirmed_only', False) |
|
|
confirmed_only = self.config.get('confirmed_only', False) |
|
|
with self._freeze_lock: |
|
|
with self._freeze_lock: |
|
|
frozen_addresses = self._frozen_addresses.copy() |
|
|
frozen_addresses = self._frozen_addresses.copy() |
|
|
utxos = self.get_utxos( |
|
|
utxos = self.get_utxos( |
|
|
excluded_addresses=frozen_addresses, |
|
|
domain=domain, |
|
|
mature_only=True, |
|
|
excluded_addresses=frozen_addresses, |
|
|
confirmed_funding_only=confirmed_only, |
|
|
mature_only=True, |
|
|
nonlocal_only=nonlocal_only) |
|
|
confirmed_funding_only=confirmed_only, |
|
|
|
|
|
nonlocal_only=nonlocal_only, |
|
|
|
|
|
) |
|
|
utxos = [utxo for utxo in utxos if not self.is_frozen_coin(utxo)] |
|
|
utxos = [utxo for utxo in utxos if not self.is_frozen_coin(utxo)] |
|
|
return utxos |
|
|
return utxos |
|
|
|
|
|
|
|
|