Skip to content

Commit

Permalink
add getunusedaddress_slp, revert getunusedaddress (fix #202)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcramer committed May 6, 2021
1 parent 2aac6f9 commit dc7de42
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions electroncash/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,16 @@ def getunusedaddress(self):
"""Returns the first unused address of the wallet, or None if all addresses are used.
An address is considered as used if it has received a transaction, or if it is used in a payment request."""
fmt = Address.FMT_CASHADDR
if self.wallet.is_slp:
fmt = Address.FMT_SLPADDR
addr = self.wallet.get_unused_address()
if addr:
return addr.to_full_string(fmt)
return None

@command('w')
def getunusedaddress_slp(self):
"""Returns the first unused address of the wallet using slp format, or None if all addresses are used.
An address is considered as used if it has received a transaction, or if it is used in a payment request."""
fmt = Address.FMT_SLPADDR
addr = self.wallet.get_unused_address()
if addr:
return addr.to_full_string(fmt)
Expand Down

0 comments on commit dc7de42

Please sign in to comment.