Electroneum
Loading...
Searching...
No Matches
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 }

◆ ~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 }

◆ 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) {
257 m_listener->onDeviceButtonPressed();
258 }
259 }

◆ 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) {
250 m_listener->onDeviceButtonRequest(code);
251 }
252 }

◆ 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 }

◆ 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 }

◆ 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 }
virtual bool indeterminate() const
Definition device.hpp:74
virtual double progress() const
Definition device.hpp:73
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
165 std::string tx_hash = epee::string_tools::pod_to_hex(txid);
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 }
uint64_t height
#define LOG_PRINT_L3(x)
std::string print_etn(uint64_t amount, unsigned int decimal_point)
std::string pod_to_hex(const t_pod_type &s)
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;
198 std::string tx_hash = epee::string_tools::pod_to_hex(txid);
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 }
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) {
226 std::string tx_hash = epee::string_tools::pod_to_hex(txid);
227 m_listener->etnReceived(tx_hash, amount);
228 }
229 }
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) {
242 std::string tx_hash = epee::string_tools::pod_to_hex(txid);
243 m_listener->etnSpent(tx_hash, amount);
244 }
245 }
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) {
219 m_listener->newBlock(height);
220 }
221 }

◆ 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) {
234 std::string tx_hash = epee::string_tools::pod_to_hex(txid);
235 m_listener->unconfirmedETNReceived(tx_hash, amount);
236 }
237 }
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) {
157 m_listener->newBlock(height);
158 }
159 }
160 }

◆ 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
181 std::string tx_hash = epee::string_tools::pod_to_hex(txid);
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 }
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 }

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:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/wallet/api/wallet.cpp