wownero-python/monero/backends/offline.py
2019-01-03 16:36:26 +00:00

72 lines
1.6 KiB
Python

from .. import exceptions
from ..account import Account
from ..address import Address
from ..seed import Seed
class WalletIsOffline(exceptions.BackendException):
pass
class OfflineWallet(object):
"""
Offline backend for Monero wallet. Provides support for address generation.
"""
_address = None
_svk = None
_ssk = None
def __init__(self, address, view_key=None, spend_key=None):
self._address = Address(address)
self._svk = view_key or self._svk
self._ssk = spend_key or self._ssk
def height(self):
raise WalletIsOffline()
def spend_key(self):
return self._ssk
def view_key(self):
return self._svk
def seed(self):
return Seed(self._ssk)
def accounts(self):
return [Account(self, 0)]
def new_account(self, label=None):
raise WalletIsOffline()
def addresses(self, account=0):
if account == 0:
return [self._address]
raise WalletIsOffline()
def new_address(self, account=0, label=None):
raise WalletIsOffline()
def balances(self, account=0):
raise WalletIsOffline()
def transfers_in(self, account, pmtfilter):
raise WalletIsOffline()
def transfers_out(self, account, pmtfilter):
raise WalletIsOffline()
def export_outputs(self):
raise WalletIsOffline()
def import_outputs(self, outputs_hex):
raise WalletIsOffline()
def export_key_images(self):
raise WalletIsOffline()
def import_key_images(self, key_images):
raise WalletIsOffline()
def transfer(self, *args, **kwargs):
raise WalletIsOffline()