Electroneum
Electroneum::Wallet2CallbackImpl Struct Reference
Inheritance diagram for Electroneum::Wallet2CallbackImpl:
Collaboration diagram for Electroneum::Wallet2CallbackImpl:

Public Member Functions

 Wallet2CallbackImpl (WalletImpl *wallet)
 
 ~Wallet2CallbackImpl ()
 
void setListener (WalletListener *listener)
 
WalletListenergetListener () const
 
virtual void on_new_block (uint64_t height, const cryptonote::block &block)
 
virtual void on_etn_received (uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount, const cryptonote::subaddress_index &subaddr_index, uint64_t unlock_time)
 
virtual void on_unconfirmed_etn_received (uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount, const cryptonote::subaddress_index &subaddr_index)
 
virtual void on_etn_spent (uint64_t height, const crypto::hash &txid, const cryptonote::transaction &in_tx, uint64_t amount, const cryptonote::transaction &spend_tx, const cryptonote::subaddress_index &subaddr_index)
 
virtual void on_skip_transaction (uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
 
virtual void on_lw_new_block (uint64_t height)
 
virtual void on_lw_etn_received (uint64_t height, const crypto::hash &txid, uint64_t amount)
 
virtual void on_lw_unconfirmed_etn_received (uint64_t height, const crypto::hash &txid, uint64_t amount)
 
virtual void on_lw_etn_spent (uint64_t height, const crypto::hash &txid, uint64_t amount)
 
virtual void on_device_button_request (uint64_t code)
 
virtual void on_device_button_pressed ()
 
virtual boost::optional< epee::wipeable_stringon_device_pin_request ()
 
virtual boost::optional< epee::wipeable_stringon_device_passphrase_request (bool on_device)
 
virtual void on_device_progress (const hw::device_progress &event)
 
- Public Member Functions inherited from tools::i_wallet2_callback
virtual boost::optional< epee::wipeable_stringon_get_password (const char *reason)
 
virtual void on_pool_tx_removed (const crypto::hash &txid)
 
virtual ~i_wallet2_callback ()
 

Public Attributes

WalletListenerm_listener
 
WalletImplm_wallet
 

Detailed Description

Definition at line 124 of file wallet.cpp.

Constructor & Destructor Documentation

◆ Wallet2CallbackImpl()

Electroneum::Wallet2CallbackImpl::Wallet2CallbackImpl ( WalletImpl wallet)
inline

Definition at line 127 of file wallet.cpp.

128  : m_listener(nullptr)
129  , m_wallet(wallet)
130  {
131 
132  }
WalletListener * m_listener
Definition: wallet.cpp:290

◆ ~Wallet2CallbackImpl()

Electroneum::Wallet2CallbackImpl::~Wallet2CallbackImpl ( )
inline

Definition at line 134 of file wallet.cpp.

135  {
136 
137  }

Member Function Documentation

◆ getListener()

WalletListener* Electroneum::Wallet2CallbackImpl::getListener ( ) const
inline

Definition at line 144 of file wallet.cpp.

145  {
146  return m_listener;
147  }
WalletListener * m_listener
Definition: wallet.cpp:290

◆ on_device_button_pressed()

virtual void Electroneum::Wallet2CallbackImpl::on_device_button_pressed ( )
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 254 of file wallet.cpp.

255  {
256  if (m_listener) {
258  }
259  }
WalletListener * m_listener
Definition: wallet.cpp:290
virtual void onDeviceButtonPressed()
called by device if the button was pressed
Definition: wallet2_api.h:397

◆ on_device_button_request()

virtual void Electroneum::Wallet2CallbackImpl::on_device_button_request ( uint64_t  code)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 247 of file wallet.cpp.

248  {
249  if (m_listener) {
251  }
252  }
WalletListener * m_listener
Definition: wallet.cpp:290
virtual void onDeviceButtonRequest(uint64_t code)
called by device if the action is required
Definition: wallet2_api.h:392

◆ on_device_passphrase_request()

virtual boost::optional<epee::wipeable_string> Electroneum::Wallet2CallbackImpl::on_device_passphrase_request ( bool  on_device)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 272 of file wallet.cpp.

273  {
274  if (m_listener) {
275  auto passphrase = m_listener->onDevicePassphraseRequest(on_device);
276  if (!on_device && passphrase) {
277  return boost::make_optional(epee::wipeable_string((*passphrase).data(), (*passphrase).size()));
278  }
279  }
280  return boost::none;
281  }
WalletListener * m_listener
Definition: wallet.cpp:290
virtual optional< std::string > onDevicePassphraseRequest(bool on_device)
called by device when passphrase entry is needed
Definition: wallet2_api.h:409

◆ on_device_pin_request()

virtual boost::optional<epee::wipeable_string> Electroneum::Wallet2CallbackImpl::on_device_pin_request ( )
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 261 of file wallet.cpp.

262  {
263  if (m_listener) {
264  auto pin = m_listener->onDevicePinRequest();
265  if (pin){
266  return boost::make_optional(epee::wipeable_string((*pin).data(), (*pin).size()));
267  }
268  }
269  return boost::none;
270  }
WalletListener * m_listener
Definition: wallet.cpp:290
virtual optional< std::string > onDevicePinRequest()
called by device when PIN is needed
Definition: wallet2_api.h:402

◆ on_device_progress()

virtual void Electroneum::Wallet2CallbackImpl::on_device_progress ( const hw::device_progress event)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 283 of file wallet.cpp.

284  {
285  if (m_listener) {
286  m_listener->onDeviceProgress(DeviceProgress(event.progress(), event.indeterminate()));
287  }
288  }
WalletListener * m_listener
Definition: wallet.cpp:290
virtual double progress() const
Definition: device.hpp:73
virtual void onDeviceProgress(const DeviceProgress &event)
Signalizes device operation progress.
Definition: wallet2_api.h:417
Here is the call graph for this function:

◆ on_etn_received()

virtual void Electroneum::Wallet2CallbackImpl::on_etn_received ( uint64_t  height,
const crypto::hash txid,
const cryptonote::transaction tx,
uint64_t  amount,
const cryptonote::subaddress_index subaddr_index,
uint64_t  unlock_time 
)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 162 of file wallet.cpp.

163  {
164 
166 
167  LOG_PRINT_L3(__FUNCTION__ << ": ETN received. height: " << height
168  << ", tx: " << tx_hash
169  << ", amount: " << print_etn(amount)
170  << ", idx: " << subaddr_index);
171  // do not signal on received tx if wallet is not syncronized completely
172  if (m_listener && m_wallet->synchronized()) {
173  m_listener->etnReceived(tx_hash, amount);
174  m_listener->updated();
175  }
176  }
WalletListener * m_listener
Definition: wallet.cpp:290
::std::string string
Definition: gtest-port.h:1097
std::string print_etn(uint64_t amount, unsigned int decimal_point)
uint64_t height
Definition: blockchain.cpp:91
std::string pod_to_hex(const t_pod_type &s)
Definition: string_tools.h:317
virtual void updated()=0
updated - generic callback, called when any event (sent/received/block reveived/etc) happened with th...
#define LOG_PRINT_L3(x)
Definition: misc_log_ex.h:102
virtual void etnReceived(const std::string &txId, uint64_t amount)=0
etnReceived - called when etn received
bool synchronized() const override
synchronized - checks if wallet was ever synchronized
Definition: wallet.cpp:1072
Here is the call graph for this function:

◆ on_etn_spent()

virtual void Electroneum::Wallet2CallbackImpl::on_etn_spent ( uint64_t  height,
const crypto::hash txid,
const cryptonote::transaction in_tx,
uint64_t  amount,
const cryptonote::transaction spend_tx,
const cryptonote::subaddress_index subaddr_index 
)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 194 of file wallet.cpp.

196  {
197  // TODO;
199  LOG_PRINT_L3(__FUNCTION__ << ": ETN spent. height: " << height
200  << ", tx: " << tx_hash
201  << ", amount: " << print_etn(amount)
202  << ", idx: " << subaddr_index);
203  // do not signal on sent tx if wallet is not syncronized completely
204  if (m_listener && m_wallet->synchronized()) {
205  m_listener->etnSpent(tx_hash, amount);
206  m_listener->updated();
207  }
208  }
WalletListener * m_listener
Definition: wallet.cpp:290
::std::string string
Definition: gtest-port.h:1097
std::string print_etn(uint64_t amount, unsigned int decimal_point)
uint64_t height
Definition: blockchain.cpp:91
std::string pod_to_hex(const t_pod_type &s)
Definition: string_tools.h:317
virtual void updated()=0
updated - generic callback, called when any event (sent/received/block reveived/etc) happened with th...
#define LOG_PRINT_L3(x)
Definition: misc_log_ex.h:102
virtual void etnSpent(const std::string &txId, uint64_t amount)=0
etnSpent - called when etn spent
bool synchronized() const override
synchronized - checks if wallet was ever synchronized
Definition: wallet.cpp:1072
Here is the call graph for this function:

◆ on_lw_etn_received()

virtual void Electroneum::Wallet2CallbackImpl::on_lw_etn_received ( uint64_t  height,
const crypto::hash txid,
uint64_t  amount 
)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 223 of file wallet.cpp.

224  {
225  if (m_listener) {
227  m_listener->etnReceived(tx_hash, amount);
228  }
229  }
WalletListener * m_listener
Definition: wallet.cpp:290
::std::string string
Definition: gtest-port.h:1097
std::string pod_to_hex(const t_pod_type &s)
Definition: string_tools.h:317
virtual void etnReceived(const std::string &txId, uint64_t amount)=0
etnReceived - called when etn received
Here is the call graph for this function:

◆ on_lw_etn_spent()

virtual void Electroneum::Wallet2CallbackImpl::on_lw_etn_spent ( uint64_t  height,
const crypto::hash txid,
uint64_t  amount 
)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 239 of file wallet.cpp.

240  {
241  if (m_listener) {
243  m_listener->etnSpent(tx_hash, amount);
244  }
245  }
WalletListener * m_listener
Definition: wallet.cpp:290
::std::string string
Definition: gtest-port.h:1097
std::string pod_to_hex(const t_pod_type &s)
Definition: string_tools.h:317
virtual void etnSpent(const std::string &txId, uint64_t amount)=0
etnSpent - called when etn spent
Here is the call graph for this function:

◆ on_lw_new_block()

virtual void Electroneum::Wallet2CallbackImpl::on_lw_new_block ( uint64_t  height)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 216 of file wallet.cpp.

217  {
218  if (m_listener) {
220  }
221  }
WalletListener * m_listener
Definition: wallet.cpp:290
uint64_t height
Definition: blockchain.cpp:91
virtual void newBlock(uint64_t height)=0
newBlock - called when new block received

◆ on_lw_unconfirmed_etn_received()

virtual void Electroneum::Wallet2CallbackImpl::on_lw_unconfirmed_etn_received ( uint64_t  height,
const crypto::hash txid,
uint64_t  amount 
)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 231 of file wallet.cpp.

232  {
233  if (m_listener) {
235  m_listener->unconfirmedETNReceived(tx_hash, amount);
236  }
237  }
WalletListener * m_listener
Definition: wallet.cpp:290
::std::string string
Definition: gtest-port.h:1097
std::string pod_to_hex(const t_pod_type &s)
Definition: string_tools.h:317
virtual void unconfirmedETNReceived(const std::string &txId, uint64_t amount)=0
unconfirmedETNReceived - called when payment arrived in tx pool
Here is the call graph for this function:

◆ on_new_block()

virtual void Electroneum::Wallet2CallbackImpl::on_new_block ( uint64_t  height,
const cryptonote::block block 
)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 149 of file wallet.cpp.

150  {
151  // Don't flood the GUI with signals. On fast refresh - send signal every 1000th block
152  // get_refresh_from_block_height() returns the blockheight from when the wallet was
153  // created or the restore height specified when wallet was recovered
154  if(height >= m_wallet->m_wallet->get_refresh_from_block_height() || height % 1000 == 0) {
155  // LOG_PRINT_L3(__FUNCTION__ << ": new block. height: " << height);
156  if (m_listener) {
158  }
159  }
160  }
WalletListener * m_listener
Definition: wallet.cpp:290
uint64_t height
Definition: blockchain.cpp:91
virtual void newBlock(uint64_t height)=0
newBlock - called when new block received

◆ on_skip_transaction()

virtual void Electroneum::Wallet2CallbackImpl::on_skip_transaction ( uint64_t  height,
const crypto::hash txid,
const cryptonote::transaction tx 
)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 210 of file wallet.cpp.

211  {
212  // TODO;
213  }

◆ on_unconfirmed_etn_received()

virtual void Electroneum::Wallet2CallbackImpl::on_unconfirmed_etn_received ( uint64_t  height,
const crypto::hash txid,
const cryptonote::transaction tx,
uint64_t  amount,
const cryptonote::subaddress_index subaddr_index 
)
inlinevirtual

Reimplemented from tools::i_wallet2_callback.

Definition at line 178 of file wallet.cpp.

179  {
180 
182 
183  LOG_PRINT_L3(__FUNCTION__ << ": unconfirmed ETN received. height: " << height
184  << ", tx: " << tx_hash
185  << ", amount: " << print_etn(amount)
186  << ", idx: " << subaddr_index);
187  // do not signal on received tx if wallet is not syncronized completely
188  if (m_listener && m_wallet->synchronized()) {
189  m_listener->unconfirmedETNReceived(tx_hash, amount);
190  m_listener->updated();
191  }
192  }
WalletListener * m_listener
Definition: wallet.cpp:290
::std::string string
Definition: gtest-port.h:1097
std::string print_etn(uint64_t amount, unsigned int decimal_point)
uint64_t height
Definition: blockchain.cpp:91
std::string pod_to_hex(const t_pod_type &s)
Definition: string_tools.h:317
virtual void unconfirmedETNReceived(const std::string &txId, uint64_t amount)=0
unconfirmedETNReceived - called when payment arrived in tx pool
virtual void updated()=0
updated - generic callback, called when any event (sent/received/block reveived/etc) happened with th...
#define LOG_PRINT_L3(x)
Definition: misc_log_ex.h:102
bool synchronized() const override
synchronized - checks if wallet was ever synchronized
Definition: wallet.cpp:1072
Here is the call graph for this function:

◆ setListener()

void Electroneum::Wallet2CallbackImpl::setListener ( WalletListener listener)
inline

Definition at line 139 of file wallet.cpp.

140  {
141  m_listener = listener;
142  }
WalletListener * m_listener
Definition: wallet.cpp:290

Member Data Documentation

◆ m_listener

WalletListener* Electroneum::Wallet2CallbackImpl::m_listener

Definition at line 290 of file wallet.cpp.

◆ m_wallet

WalletImpl* Electroneum::Wallet2CallbackImpl::m_wallet

Definition at line 291 of file wallet.cpp.


The documentation for this struct was generated from the following file: