38 #include <boost/thread/mutex.hpp> 39 #include <boost/thread/thread.hpp> 40 #include <boost/thread/condition_variable.hpp> 44 class TransactionHistoryImpl;
45 class PendingTransactionImpl;
46 class UnsignedTransactionImpl;
47 class AddressBookImpl;
49 class SubaddressAccountImpl;
50 struct Wallet2CallbackImpl;
88 int status()
const override;
103 void stop()
override;
120 bool synchronized()
const override;
159 std::set<uint32_t> subaddr_indices = {})
override;
161 optional<uint64_t> amount,
uint32_t mixin_count,
164 std::set<uint32_t> subaddr_indices = {})
override;
177 virtual TransactionHistory *
history()
override;
188 virtual void setOffline(
bool offline)
override;
virtual bool lightWalletLogin(bool &isNewWallet) const override
Light wallet authenticate and login.
Definition: wallet.cpp:959
WalletImpl(NetworkType nettype=MAINNET, uint64_t kdf_rounds=1)
Definition: wallet.cpp:419
virtual Subaddress * subaddress() override
Definition: wallet.cpp:1803
uint64_t daemonBlockChainHeight() const override
daemonBlockChainHeight - returns daemon blockchain height
Definition: wallet.cpp:1036
size_t importMultisigImages(const std::vector< std::string > &images) override
importMultisigImages - imports other participants' multisig images
Definition: wallet.cpp:1433
virtual bool setCacheAttribute(const std::string &key, const std::string &val) override
setCacheAttribute - attach an arbitrary string to a wallet cache attribute
Definition: wallet.cpp:1829
bool recoverFromKeysWithPassword(const std::string &path, const std::string &password, const std::string &language, const std::string &address_string, const std::string &viewkey_string, const std::string &spendkey_string="")
Definition: wallet.cpp:580
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override
loadUnsignedTx - creates transaction from unsigned tx file
Definition: wallet.cpp:1136
std::string secretViewKey() const override
secretViewKey - returns secret view key
Definition: wallet.cpp:882
std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const override
getSubaddressLabel - gets the label of the specified subaddress
Definition: wallet.cpp:1341
virtual void segregationHeight(uint64_t height) override
sets the height where segregation should occur
Definition: wallet.cpp:2589
void refreshAsync() override
refreshAsync - refreshes wallet asynchronously.
Definition: wallet.cpp:1099
std::unique_ptr< SubaddressImpl > m_subaddress
Definition: wallet.h:260
void statusWithErrorString(int &status, std::string &errorString) const override
returns both error and error string atomically. suggested to use in instead of status() and errorStri...
Definition: wallet.cpp:823
virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const override
Definition: wallet.cpp:1947
boost::optional< epee::net_utils::http::login > m_daemon_login
Definition: wallet.h:284
virtual std::string make_uri(const std::string &address, const std::string &payment_id, uint64_t amount, const std::string &tx_description, const std::string &recipient_name, std::string &error) const override
Definition: wallet.cpp:2399
Device
Definition: wallet2_api.h:430
std::string errorString() const override
in case error status, returns error string
Definition: wallet.cpp:817
bool exportMultisigImages(std::string &images) override
exportMultisigImages - exports transfers' key images
Definition: wallet.cpp:1417
virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector< std::string > &unknown_parameters, std::string &error) override
Definition: wallet.cpp:2394
void setRecoveringFromSeed(bool recoveringFromSeed) override
setRecoveringFromSeed - set state recover form seed
Definition: wallet.cpp:994
void doRefresh()
Definition: wallet.cpp:2275
virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) override
Initiates a light wallet import wallet request.
Definition: wallet.cpp:964
::std::string string
Definition: gtest-port.h:1097
int m_status
Definition: wallet.h:254
virtual uint64_t estimateTransactionFee(const std::vector< std::pair< std::string, uint64_t >> &destinations, PendingTransaction::Priority priority) const override
Estimates transaction fee.
Definition: wallet.cpp:1771
void setRecoveringFromDevice(bool recoveringFromDevice) override
setRecoveringFromDevice - set state to recovering from device
Definition: wallet.cpp:999
void setAutoRefreshInterval(int millis) override
setAutoRefreshInterval - setup interval for automatic refresh.
Definition: wallet.cpp:1120
t
Definition: console.py:33
void refreshThreadFunc()
Definition: wallet.cpp:2244
std::atomic< bool > m_recoveringFromSeed
Definition: wallet.h:278
void setStatus(int status, const std::string &message) const
Definition: wallet.cpp:2237
std::atomic< bool > m_rebuildWalletCache
Definition: wallet.h:281
virtual bool reconnectDevice() override
attempt to reconnect to hardware device
Definition: wallet.cpp:2636
bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const override
createWatchOnly - Creates a watch only wallet
Definition: wallet.cpp:505
uint64_t estimateBlockChainHeight() const override
estimateBlockChainHeight - returns estimate blockchain height. More accurate than approximateBlockCha...
Definition: wallet.cpp:1031
void rescanBlockchainAsync() override
rescanBlockchainAsync - rescans wallet asynchronously, starting from genesys
Definition: wallet.cpp:1114
std::string publicMultisigSignerKey() const override
publicMultisigSignerKey - returns public signer key
Definition: wallet.cpp:902
std::string path() const override
Definition: wallet.cpp:912
virtual uint32_t defaultMixin() const override
defaultMixin - returns number of mixins used in transactions
Definition: wallet.cpp:1819
bool setDevicePassphrase(const std::string &password) override
Definition: wallet.cpp:857
bool recoverFromDevice(const std::string &path, const std::string &password, const std::string &device_name)
Definition: wallet.cpp:676
bool hasMultisigPartialKeyImages() const override
hasMultisigPartialKeyImages - checks if wallet needs to import multisig key images from other partici...
Definition: wallet.cpp:1461
const char * key
Definition: hmac_keccak.cpp:40
Definition: wallet2_api.h:58
bool daemonSynced() const
Definition: wallet.cpp:1077
uint64_t approximateBlockChainHeight() const override
approximateBlockChainHeight - returns approximate blockchain height calculated from date/time ...
Definition: wallet.cpp:1026
bool create(const std::string &path, const std::string &password, const std::string &language)
Definition: wallet.cpp:468
virtual bool unblackballOutput(const std::string &amount, const std::string &offset) override
unblackballs an output
Definition: wallet.cpp:2506
int status() const override
returns wallet status (Status_Ok | Status_Error)
Definition: wallet.cpp:811
std::unique_ptr< AddressBookImpl > m_addressBook
Definition: wallet.h:259
bool exportOutputs(const std::string &filename, bool all=false) override
importOutputs - exports outputs to file
Definition: wallet.cpp:1223
std::atomic< bool > m_is_connected
Definition: wallet.h:283
PendingTransaction * createTransactionMultDest(const std::vector< std::string > &dst_addr, const std::string &payment_id, optional< std::vector< uint64_t >> amount, uint32_t mixin_count, PendingTransaction::Priority priority=PendingTransaction::Priority_Low, uint32_t subaddr_account=0, std::set< uint32_t > subaddr_indices={}) override
createTransactionMultDest creates transaction with multiple destinations. if dst_addr is an integrate...
Definition: wallet.cpp:1513
virtual PendingTransaction * createSweepUnmixableTransaction() override
createSweepUnmixableTransaction creates transaction with unmixable outputs.
Definition: wallet.cpp:1684
std::string publicViewKey() const override
publicViewKey - returns public view key
Definition: wallet.cpp:887
std::tuple< uint64_t, uint64_t, std::vector< tools::wallet2::transfer_details > > outputs
Definition: cold-outputs.cpp:53
void setStatusCritical(const std::string &message) const
Definition: wallet.cpp:2232
Interface for wallet operations.
Definition: wallet2_api.h:428
virtual void pauseRefresh() override
pauseRefresh - pause refresh thread
Definition: wallet.cpp:2333
unsigned char uint8_t
Definition: stdint.h:124
virtual uint64_t getBytesReceived() override
get bytes received
Definition: wallet.cpp:2653
Definition: address_book.cpp:40
std::unique_ptr< TransactionHistoryImpl > m_history
Definition: wallet.h:257
bool watchOnly() const override
watchOnly - checks if wallet is watch only
Definition: wallet.cpp:2210
void setStatusError(const std::string &message) const
Definition: wallet.cpp:2227
boost::condition_variable m_refreshCV
Definition: wallet.h:273
Definition: wallet2_api.h:47
virtual bool verifySignedMessage(const std::string &message, const std::string &address, const std::string &signature) const override
verifySignedMessage - verify a signature matches a given message
Definition: wallet.cpp:2111
boost::thread m_refreshThread
Definition: wallet.h:274
virtual bool checkTxProof(const std::string &txid, const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &received, bool &in_pool, uint64_t &confirmations) override
Definition: wallet.cpp:1975
virtual std::string getSpendProof(const std::string &txid, const std::string &message) const override
Definition: wallet.cpp:2004
virtual SubaddressAccount * subaddressAccount() override
Definition: wallet.cpp:1808
std::string address(uint32_t accountIndex=0, uint32_t addressIndex=0) const override
Definition: wallet.cpp:868
bool setPassword(const std::string &password) override
Definition: wallet.cpp:829
std::string secretSpendKey() const override
secretSpendKey - returns secret spend key
Definition: wallet.cpp:892
bool setDevicePin(const std::string &password) override
Definition: wallet.cpp:846
bool importKeyImages(const std::string &filename) override
importKeyImages - imports key images from file
Definition: wallet.cpp:1200
virtual std::string getTxKey(const std::string &txid) const override
Definition: wallet.cpp:1863
virtual void keyReuseMitigation2(bool mitigation) override
secondary key reuse mitigation
Definition: wallet.cpp:2594
bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit=0, const std::string &daemon_username="", const std::string &daemon_password="", bool use_ssl=false, bool lightWallet=false, const std::string &proxy_address="") override
init - initializes wallet with daemon connection params. if daemon_address is local address...
Definition: wallet.cpp:950
boost::mutex m_refreshMutex2
Definition: wallet.h:272
std::unique_ptr< SubaddressAccountImpl > m_subaddressAccount
Definition: wallet.h:261
virtual void startRefresh() override
StartRefresh - Start/resume refresh thread (refresh every 10 seconds)
Definition: wallet.cpp:2312
Priority
Definition: wallet2_api.h:81
void setSeedLanguage(const std::string &arg) override
Definition: wallet.cpp:806
bool trustedDaemon() const override
Definition: wallet.cpp:2200
virtual bool isOffline() const override
Definition: wallet.cpp:2431
Device getDeviceType() const override
Queries backing device for wallet keys.
Definition: wallet.cpp:693
size_t numSubaddressAccounts() const override
numSubaddressAccounts - returns the number of existing subaddress accounts
Definition: wallet.cpp:1329
Definition: wallet2_api.h:83
virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const override
verifyMessageWithPublicKey verifies that message was signed with the given public key ...
Definition: wallet.cpp:2142
uint64_t balance(uint32_t accountIndex=0) const override
Definition: wallet.cpp:1009
MultisigState multisig() const override
multisig - returns current state of multisig wallet creation process
Definition: wallet.cpp:1367
Definition: subaddress.h:36
std::string publicSpendKey() const override
publicSpendKey - returns public spend key
Definition: wallet.cpp:897
virtual std::string signMessage(const std::string &message, const std::string &address) override
Definition: wallet.cpp:2091
virtual bool setUserNote(const std::string &txid, const std::string ¬e) override
setUserNote - attach an arbitrary string note to a txid
Definition: wallet.cpp:1842
std::atomic< int > m_refreshIntervalMillis
Definition: wallet.h:266
void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) override
setRefreshFromBlockHeight - start refresh from block height on recover
Definition: wallet.cpp:989
std::string m_password
Definition: wallet.h:256
static void add(ge_p3 &p3, const ge_cached &other)
Definition: multiexp.cc:144
std::string m_errorString
Definition: wallet.h:255
unsigned int uint32_t
Definition: stdint.h:126
int autoRefreshInterval() const override
autoRefreshInterval - returns automatic refresh interval in millis
Definition: wallet.cpp:1131
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) override
cold-device protocol key image sync
Definition: wallet.cpp:2614
const std::string & getPassword() const override
Definition: wallet.cpp:841
static void error(const std::string &category, const std::string &str)
Definition: wallet.cpp:414
ConnectionStatus
Definition: wallet2_api.h:442
bool store(const std::string &path) override
store - stores wallet to file.
Definition: wallet.cpp:922
Definition: transaction_history.h:38
virtual uint64_t getBytesSent() override
get bytes sent
Definition: wallet.cpp:2658
virtual bool getRings(const std::string &txid, std::vector< std::pair< std::string, std::vector< uint64_t >>> &rings) const override
gets the rings used for a txid, if any
Definition: wallet.cpp:2545
bool close(bool store=true)
Definition: wallet.cpp:765
bool useForkRules(uint8_t version, int64_t early_blocks) const override
check if hard fork rules should be used
Definition: wallet.cpp:2441
std::string filename() const override
filename - returns wallet filename
Definition: wallet.cpp:940
unsigned __int64 uint64_t
Definition: stdint.h:136
~WalletImpl()
Definition: wallet.cpp:449
virtual std::string signMultisigParticipant(const std::string &message) const override
signMultisigParticipant signs given message with the multisig public signer key
Definition: wallet.cpp:2121
void stop() override
stop - interrupts wallet refresh() loop once (doesn't stop background refresh thread) ...
Definition: wallet.cpp:917
virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, uint64_t &received, bool &in_pool, uint64_t &confirmations) override
Definition: wallet.cpp:1899
virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) override
shows address on device display
Definition: wallet.cpp:2619
virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const override
Definition: wallet.cpp:2064
NetworkType
Definition: wallet2_api.h:46
void setSubaddressLookahead(uint32_t major, uint32_t minor) override
setSubaddressLookahead - set size of subaddress lookahead
Definition: wallet.cpp:1004
std::string seed(const std::string &seed_offset="") const override
Definition: wallet.cpp:793
virtual bool getRing(const std::string &key_image, std::vector< uint64_t > &ring) const override
gets the ring used for a key image, if any
Definition: wallet.cpp:2528
bool importOutputs(const std::string &filename) override
importOutputs - imports outputs from file
Definition: wallet.cpp:1253
virtual std::string getCacheAttribute(const std::string &key) const override
getCacheAttribute - return an arbitrary string attached to a wallet cache attribute ...
Definition: wallet.cpp:1835
uint64_t blockChainHeight() const override
blockChainHeight - returns current blockchain height
Definition: wallet.cpp:1019
bool refresh() override
refresh - refreshes the wallet, updating transactions from daemon
Definition: wallet.cpp:1090
std::atomic< bool > m_refreshShouldRescan
Definition: wallet.h:267
version
Supported socks variants.
Definition: socks.h:57
virtual bool lockKeysFile() override
locks/unlocks the keys file; returns true on success
Definition: wallet.cpp:2599
void pendingTxPostProcess(PendingTransactionImpl *pending)
Definition: wallet.cpp:2353
boost::mutex m_statusMutex
Definition: wallet.h:253
bool open(const std::string &path, const std::string &password)
Definition: wallet.cpp:698
std::string getSeedLanguage() const override
Definition: wallet.cpp:801
bool connectToDaemon() override
connectToDaemon - connects to the daemon. TODO: check if it can be removed
Definition: wallet.cpp:2165
Definition: pending_transaction.h:41
virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const override
getReserveProof - Generates a proof that proves the reserve of unspent funds Parameters account_index...
Definition: wallet.cpp:2046
ConnectionStatus connected() const override
connected - checks if the wallet connected to the daemon
Definition: wallet.cpp:2177
virtual void disposeTransaction(PendingTransaction *t) override
disposeTransaction - destroys transaction object
Definition: wallet.cpp:1766
NetworkType nettype() const override
Definition: wallet.h:135
PendingTransaction * restoreMultisigTransaction(const std::string &signData) override
restoreMultisigTransaction creates PendingTransaction from signData
Definition: wallet.cpp:1475
std::string getMultisigInfo() const override
getMultisigInfo
Definition: wallet.cpp:1374
POD_CLASS signature
Definition: crypto.h:98
Definition: subaddress_account.h:36
virtual void setOffline(bool offline) override
Definition: wallet.cpp:2426
virtual bool blackballOutputs(const std::vector< std::string > &outputs, bool add) override
blackballs a set of outputs
Definition: wallet.cpp:2446
virtual void setListener(WalletListener *l) override
Definition: wallet.cpp:1813
bool scanTransactions(const std::vector< std::string > &txids) override
scanTransactions - scan a list of transaction ids, this operation may reveal the txids to the remote ...
Definition: wallet.cpp:1285
string daemon_address
Definition: transfers.cpp:41
std::atomic< bool > m_refreshThreadDone
Definition: wallet.h:265
std::unique_ptr< tools::wallet2 > m_wallet
Definition: wallet.h:252
virtual void setDefaultMixin(uint32_t arg) override
setDefaultMixin - setum number of mixins to be used for new transactions
Definition: wallet.cpp:1824
std::string keysFilename() const override
keysFilename - returns keys filename. usually this formed as "wallet_filename".keys ...
Definition: wallet.cpp:945
bool rescanBlockchain() override
rescanBlockchain - rescans the wallet, updating transactions from daemon
Definition: wallet.cpp:1106
POD_CLASS key_image
Definition: crypto.h:92
virtual TransactionHistory * history() override
Definition: wallet.cpp:1793
std::string exchangeMultisigKeys(const std::vector< std::string > &info, const bool force_update_use_with_caution=false) override
exchange_multisig_keys - provides additional key exchange round for arbitrary multisig schemes (like ...
Definition: wallet.cpp:1403
Definition: address_book.h:38
void addSubaddressAccount(const std::string &label) override
addSubaddressAccount - appends a new subaddress account at the end of the last major index of existin...
Definition: wallet.cpp:1325
virtual std::string getDefaultDataDir() const override
Definition: wallet.cpp:2404
virtual AddressBook * addressBook() override
Definition: wallet.cpp:1798
void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) override
setSubaddressLabel - sets the label of the specified subaddress
Definition: wallet.cpp:1354
signed __int64 int64_t
Definition: stdint.h:135
std::string integratedAddress(const std::string &payment_id) const override
integratedAddress - returns integrated address for current wallet address and given payment_id...
Definition: wallet.cpp:873
virtual bool setRing(const std::string &key_image, const std::vector< uint64_t > &ring, bool relative) override
sets the ring used for a key image
Definition: wallet.cpp:2567
uint64_t unlockedBalance(uint32_t accountIndex=0) const override
Definition: wallet.cpp:1014
void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const override
returns current hard fork info
Definition: wallet.cpp:2436
Transaction-like interface for sending money.
Definition: wallet2_api.h:73
Definition: wallet2_api.h:324
Definition: wallet.cpp:119
virtual void segregatePreForkOutputs(bool segregate) override
sets whether pre-fork outs are to be segregated
Definition: wallet.cpp:2584
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id, optional< uint64_t > amount, uint32_t mixin_count, PendingTransaction::Priority priority=PendingTransaction::Priority_Low, uint32_t subaddr_account=0, std::set< uint32_t > subaddr_indices={}) override
createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored ...
Definition: wallet.cpp:1677
uint64_t daemonBlockChainTargetHeight() const override
daemonBlockChainTargetHeight - returns daemon blockchain target height
Definition: wallet.cpp:1055
virtual bool isKeysFileLocked() override
returns true if the keys file is locked
Definition: wallet.cpp:2609
static int priority(Level level)
Definition: easylogging++.cc:2128
Definition: unsigned_transaction.h:41
static void info(const std::string &category, const std::string &str)
Definition: wallet.cpp:406
virtual bool unlockKeysFile() override
Definition: wallet.cpp:2604
bool exportKeyImages(const std::string &filename, bool all=false) override
exportKeyImages - exports key images to file
Definition: wallet.cpp:1175
bool isDeterministic() const override
isDeterministic - checks if wallet keys are deterministic
Definition: wallet.cpp:2215
friend class PendingTransactionImpl
Definition: wallet.h:244
std::unique_ptr< Wallet2CallbackImpl > m_wallet2Callback
Definition: wallet.h:258
bool recover(const std::string &path, const std::string &password, const std::string &seed, const std::string &seed_offset={})
Definition: wallet.cpp:729
virtual std::string getUserNote(const std::string &txid) const override
getUserNote - return an arbitrary string note attached to a txid
Definition: wallet.cpp:1853
std::atomic< bool > m_refreshEnabled
Definition: wallet.h:264
void clearStatus() const
Definition: wallet.cpp:2220
void stopRefresh()
Definition: wallet.cpp:2323
std::string makeMultisig(const std::vector< std::string > &info, uint32_t threshold) override
makeMultisig - switches wallet in multisig state. The one and only creation phase for N / N wallets ...
Definition: wallet.cpp:1386
std::atomic< bool > m_synchronized
Definition: wallet.h:280
tuple message
Definition: gtest_output_test.py:331
bool doInit(const std::string &daemon_address, const std::string &proxy_address, uint64_t upper_transaction_size_limit=0, bool ssl=false)
Definition: wallet.cpp:2368
bool setProxy(const std::string &address) override
Definition: wallet.cpp:2205
bool rescanSpent() override
Definition: wallet.cpp:2409
bool submitTransaction(const std::string &fileName) override
submitTransaction - submits transaction in signed tx file
Definition: wallet.cpp:1157
boost::mutex m_refreshMutex
Definition: wallet.h:269
void addSubaddress(uint32_t accountIndex, const std::string &label) override
addSubaddress - appends a new subaddress at the end of the last minor index of the specified subaddre...
Definition: wallet.cpp:1337
virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const override
Definition: wallet.cpp:2024
void setTrustedDaemon(bool arg) override
Definition: wallet.cpp:2195
bool isNewWallet() const
Definition: wallet.cpp:2343
std::atomic< bool > m_recoveringFromDevice
Definition: wallet.h:279
bool recoverFromKeys(const std::string &path, const std::string &language, const std::string &address_string, const std::string &viewkey_string, const std::string &spendkey_string="")
Definition: wallet.cpp:571
uint64_t getRefreshFromBlockHeight() const override
getRestoreHeight - get wallet creation height
Definition: wallet.h:128
virtual bool blackballOutput(const std::string &amount, const std::string &offset) override
blackballs an output
Definition: wallet.cpp:2484
size_t numSubaddresses(uint32_t accountIndex) const override
numSubaddresses - returns the number of existing subaddresses associated with the specified subaddres...
Definition: wallet.cpp:1333