| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
|
| 34 |
#include <string> |
| 35 |
#include <vector> |
| 36 |
#include <list> |
| 37 |
#include <set> |
| 38 |
#include <ctime> |
| 39 |
#include <iostream> |
| 40 |
#include <stdexcept> |
| 41 |
#include <cstdint> |
| 42 |
|
| 43 |
|
| 44 |
namespace Monero { |
| 45 |
|
| 46 |
enum NetworkType : uint8_t { |
| 47 |
MAINNET = 0, |
| 48 |
TESTNET, |
| 49 |
STAGENET |
| 50 |
}; |
| 51 |
|
| 52 |
namespace Utils { |
| 53 |
bool isAddressLocal(const std::string &hostaddr); |
| 54 |
void onStartup(); |
| 55 |
} |
| 56 |
|
| 57 |
template<typename T> |
| 58 |
class optional { |
| 59 |
public: |
| 60 |
optional(): set(false) {} |
| 61 |
optional(const T &t): t(t), set(true) {} |
| 62 |
const T &operator*() const { return t; } |
| 63 |
T &operator*() { return t; } |
| 64 |
operator bool() const { return set; } |
| 65 |
private: |
| 66 |
T t; |
| 67 |
bool set; |
| 68 |
}; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
struct PendingTransaction |
| 74 |
{ |
| 75 |
enum Status { |
| 76 |
Status_Ok, |
| 77 |
Status_Error, |
| 78 |
Status_Critical |
| 79 |
}; |
| 80 |
|
| 81 |
enum Priority { |
| 82 |
Priority_Default = 0, |
| 83 |
Priority_Low = 1, |
| 84 |
Priority_Medium = 2, |
| 85 |
Priority_High = 3, |
| 86 |
Priority_Last |
| 87 |
}; |
| 88 |
|
| 89 |
virtual ~PendingTransaction() = 0; |
| 90 |
virtual int status() const = 0; |
| 91 |
virtual std::string errorString() const = 0; |
| 92 |
|
| 93 |
virtual bool commit(const std::string &filename = "", bool overwrite = false) = 0; |
| 94 |
virtual uint64_t amount() const = 0; |
| 95 |
virtual uint64_t dust() const = 0; |
| 96 |
virtual uint64_t fee() const = 0; |
| 97 |
virtual std::vector<std::string> txid() const = 0; |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
virtual uint64_t txCount() const = 0; |
| 103 |
virtual std::vector<uint32_t> subaddrAccount() const = 0; |
| 104 |
virtual std::vector<std::set<uint32_t>> subaddrIndices() const = 0; |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
virtual std::string multisigSignData() = 0; |
| 123 |
virtual void signMultisigTx() = 0; |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
virtual std::vector<std::string> signersKeys() const = 0; |
| 129 |
}; |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
struct UnsignedTransaction |
| 135 |
{ |
| 136 |
enum Status { |
| 137 |
Status_Ok, |
| 138 |
Status_Error, |
| 139 |
Status_Critical |
| 140 |
}; |
| 141 |
|
| 142 |
virtual ~UnsignedTransaction() = 0; |
| 143 |
virtual int status() const = 0; |
| 144 |
virtual std::string errorString() const = 0; |
| 145 |
virtual std::vector<uint64_t> amount() const = 0; |
| 146 |
virtual std::vector<uint64_t> fee() const = 0; |
| 147 |
virtual std::vector<uint64_t> mixin() const = 0; |
| 148 |
|
| 149 |
virtual std::string confirmationMessage() const = 0; |
| 150 |
virtual std::vector<std::string> paymentId() const = 0; |
| 151 |
virtual std::vector<std::string> recipientAddress() const = 0; |
| 152 |
virtual uint64_t minMixinCount() const = 0; |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
virtual uint64_t txCount() const = 0; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
virtual bool sign(const std::string &signedFileName) = 0; |
| 164 |
}; |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
struct TransactionInfo |
| 170 |
{ |
| 171 |
enum Direction { |
| 172 |
Direction_In, |
| 173 |
Direction_Out |
| 174 |
}; |
| 175 |
|
| 176 |
struct Transfer { |
| 177 |
Transfer(uint64_t _amount, const std::string &address); |
| 178 |
const uint64_t amount; |
| 179 |
const std::string address; |
| 180 |
}; |
| 181 |
|
| 182 |
virtual ~TransactionInfo() = 0; |
| 183 |
virtual int direction() const = 0; |
| 184 |
virtual bool isPending() const = 0; |
| 185 |
virtual bool isFailed() const = 0; |
| 186 |
virtual bool isCoinbase() const = 0; |
| 187 |
virtual uint64_t amount() const = 0; |
| 188 |
virtual uint64_t fee() const = 0; |
| 189 |
virtual uint64_t blockHeight() const = 0; |
| 190 |
virtual std::string description() const = 0; |
| 191 |
virtual std::set<uint32_t> subaddrIndex() const = 0; |
| 192 |
virtual uint32_t subaddrAccount() const = 0; |
| 193 |
virtual std::string label() const = 0; |
| 194 |
virtual uint64_t confirmations() const = 0; |
| 195 |
virtual uint64_t unlockTime() const = 0; |
| 196 |
|
| 197 |
virtual std::string hash() const = 0; |
| 198 |
virtual std::time_t timestamp() const = 0; |
| 199 |
virtual std::string paymentId() const = 0; |
| 200 |
|
| 201 |
virtual const std::vector<Transfer> & transfers() const = 0; |
| 202 |
}; |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
struct TransactionHistory |
| 207 |
{ |
| 208 |
virtual ~TransactionHistory() = 0; |
| 209 |
virtual int count() const = 0; |
| 210 |
virtual TransactionInfo * transaction(int index) const = 0; |
| 211 |
virtual TransactionInfo * transaction(const std::string &id) const = 0; |
| 212 |
virtual std::vector<TransactionInfo*> getAll() const = 0; |
| 213 |
virtual void refresh() = 0; |
| 214 |
virtual void setTxNote(const std::string &txid, const std::string ¬e) = 0; |
| 215 |
}; |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
struct AddressBookRow { |
| 221 |
public: |
| 222 |
AddressBookRow(std::size_t _rowId, const std::string &_address, const std::string &_paymentId, const std::string &_description): |
| 223 |
m_rowId(_rowId), |
| 224 |
m_address(_address), |
| 225 |
m_paymentId(_paymentId), |
| 226 |
m_description(_description) {} |
| 227 |
|
| 228 |
private: |
| 229 |
std::size_t m_rowId; |
| 230 |
std::string m_address; |
| 231 |
std::string m_paymentId; |
| 232 |
std::string m_description; |
| 233 |
public: |
| 234 |
std::string extra; |
| 235 |
std::string getAddress() const {return m_address;} |
| 236 |
std::string getDescription() const {return m_description;} |
| 237 |
std::string getPaymentId() const {return m_paymentId;} |
| 238 |
std::size_t getRowId() const {return m_rowId;} |
| 239 |
}; |
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
struct AddressBook |
| 246 |
{ |
| 247 |
enum ErrorCode { |
| 248 |
Status_Ok, |
| 249 |
General_Error, |
| 250 |
Invalid_Address, |
| 251 |
Invalid_Payment_Id |
| 252 |
}; |
| 253 |
virtual ~AddressBook() = 0; |
| 254 |
virtual std::vector<AddressBookRow*> getAll() const = 0; |
| 255 |
virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0; |
| 256 |
virtual bool deleteRow(std::size_t rowId) = 0; |
| 257 |
virtual bool setDescription(std::size_t index, const std::string &description) = 0; |
| 258 |
virtual void refresh() = 0; |
| 259 |
virtual std::string errorString() const = 0; |
| 260 |
virtual int errorCode() const = 0; |
| 261 |
virtual int lookupPaymentID(const std::string &payment_id) const = 0; |
| 262 |
}; |
| 263 |
|
| 264 |
struct SubaddressRow { |
| 265 |
public: |
| 266 |
SubaddressRow(std::size_t _rowId, const std::string &_address, const std::string &_label): |
| 267 |
m_rowId(_rowId), |
| 268 |
m_address(_address), |
| 269 |
m_label(_label) {} |
| 270 |
|
| 271 |
private: |
| 272 |
std::size_t m_rowId; |
| 273 |
std::string m_address; |
| 274 |
std::string m_label; |
| 275 |
public: |
| 276 |
std::string extra; |
| 277 |
std::string getAddress() const {return m_address;} |
| 278 |
std::string getLabel() const {return m_label;} |
| 279 |
std::size_t getRowId() const {return m_rowId;} |
| 280 |
}; |
| 281 |
|
| 282 |
struct Subaddress |
| 283 |
{ |
| 284 |
virtual ~Subaddress() = 0; |
| 285 |
virtual std::vector<SubaddressRow*> getAll() const = 0; |
| 286 |
virtual void addRow(uint32_t accountIndex, const std::string &label) = 0; |
| 287 |
virtual void setLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0; |
| 288 |
virtual void refresh(uint32_t accountIndex) = 0; |
| 289 |
}; |
| 290 |
|
| 291 |
struct SubaddressAccountRow { |
| 292 |
public: |
| 293 |
SubaddressAccountRow(std::size_t _rowId, const std::string &_address, const std::string &_label, const std::string &_balance, const std::string &_unlockedBalance): |
| 294 |
m_rowId(_rowId), |
| 295 |
m_address(_address), |
| 296 |
m_label(_label), |
| 297 |
m_balance(_balance), |
| 298 |
m_unlockedBalance(_unlockedBalance) {} |
| 299 |
|
| 300 |
private: |
| 301 |
std::size_t m_rowId; |
| 302 |
std::string m_address; |
| 303 |
std::string m_label; |
| 304 |
std::string m_balance; |
| 305 |
std::string m_unlockedBalance; |
| 306 |
public: |
| 307 |
std::string extra; |
| 308 |
std::string getAddress() const {return m_address;} |
| 309 |
std::string getLabel() const {return m_label;} |
| 310 |
std::string getBalance() const {return m_balance;} |
| 311 |
std::string getUnlockedBalance() const {return m_unlockedBalance;} |
| 312 |
std::size_t getRowId() const {return m_rowId;} |
| 313 |
}; |
| 314 |
|
| 315 |
struct SubaddressAccount |
| 316 |
{ |
| 317 |
virtual ~SubaddressAccount() = 0; |
| 318 |
virtual std::vector<SubaddressAccountRow*> getAll() const = 0; |
| 319 |
virtual void addRow(const std::string &label) = 0; |
| 320 |
virtual void setLabel(uint32_t accountIndex, const std::string &label) = 0; |
| 321 |
virtual void refresh() = 0; |
| 322 |
}; |
| 323 |
|
| 324 |
struct MultisigState { |
| 325 |
MultisigState() : isMultisig(false), isReady(false), threshold(0), total(0) {} |
| 326 |
|
| 327 |
bool isMultisig; |
| 328 |
bool isReady; |
| 329 |
uint32_t threshold; |
| 330 |
uint32_t total; |
| 331 |
}; |
| 332 |
|
| 333 |
|
| 334 |
struct DeviceProgress { |
| 335 |
DeviceProgress(): m_progress(0), m_indeterminate(false) {} |
| 336 |
DeviceProgress(double progress, bool indeterminate=false): m_progress(progress), m_indeterminate(indeterminate) {} |
| 337 |
|
| 338 |
virtual double progress() const { return m_progress; } |
| 339 |
virtual bool indeterminate() const { return m_indeterminate; } |
| 340 |
|
| 341 |
protected: |
| 342 |
double m_progress; |
| 343 |
bool m_indeterminate; |
| 344 |
}; |
| 345 |
|
| 346 |
struct Wallet; |
| 347 |
struct WalletListener |
| 348 |
{ |
| 349 |
virtual ~WalletListener() = 0; |
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
virtual void moneySpent(const std::string &txId, uint64_t amount) = 0; |
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
virtual void moneyReceived(const std::string &txId, uint64_t amount) = 0; |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) = 0; |
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
virtual void newBlock(uint64_t height) = 0; |
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
virtual void updated() = 0; |
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
virtual void refreshed() = 0; |
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
virtual void onDeviceButtonRequest(uint64_t code) { (void)code; } |
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
virtual void onDeviceButtonPressed() { } |
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
virtual optional<std::string> onDevicePinRequest() { |
| 402 |
throw std::runtime_error("Not supported"); |
| 403 |
} |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
virtual optional<std::string> onDevicePassphraseRequest(bool & on_device) { |
| 409 |
on_device = true; |
| 410 |
return optional<std::string>(); |
| 411 |
} |
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
virtual void onDeviceProgress(const DeviceProgress & event) { (void)event; }; |
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
virtual void onSetWallet(Wallet * wallet) { (void)wallet; }; |
| 422 |
}; |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
struct Wallet |
| 429 |
{ |
| 430 |
enum Device { |
| 431 |
Device_Software = 0, |
| 432 |
Device_Ledger = 1, |
| 433 |
Device_Trezor = 2 |
| 434 |
}; |
| 435 |
|
| 436 |
enum Status { |
| 437 |
Status_Ok, |
| 438 |
Status_Error, |
| 439 |
Status_Critical |
| 440 |
}; |
| 441 |
|
| 442 |
enum ConnectionStatus { |
| 443 |
ConnectionStatus_Disconnected, |
| 444 |
ConnectionStatus_Connected, |
| 445 |
ConnectionStatus_WrongVersion |
| 446 |
}; |
| 447 |
|
| 448 |
enum BackgroundSyncType { |
| 449 |
BackgroundSync_Off = 0, |
| 450 |
BackgroundSync_ReusePassword = 1, |
| 451 |
BackgroundSync_CustomPassword = 2 |
| 452 |
}; |
| 453 |
|
| 454 |
virtual ~Wallet() = 0; |
| 455 |
virtual std::string seed(const std::string& seed_offset = "") const = 0; |
| 456 |
virtual std::string getSeedLanguage() const = 0; |
| 457 |
virtual void setSeedLanguage(const std::string &arg) = 0; |
| 458 |
|
| 459 |
virtual int status() const = 0; |
| 460 |
|
| 461 |
virtual std::string errorString() const = 0; |
| 462 |
|
| 463 |
virtual void statusWithErrorString(int& status, std::string& errorString) const = 0; |
| 464 |
virtual bool setPassword(const std::string &password) = 0; |
| 465 |
virtual const std::string& getPassword() const = 0; |
| 466 |
virtual bool setDevicePin(const std::string &pin) { (void)pin; return false; }; |
| 467 |
virtual bool setDevicePassphrase(const std::string &passphrase) { (void)passphrase; return false; }; |
| 468 |
virtual std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const = 0; |
| 469 |
std::string mainAddress() const { return address(0, 0); } |
| 470 |
virtual std::string path() const = 0; |
| 471 |
virtual NetworkType nettype() const = 0; |
| 472 |
bool mainnet() const { return nettype() == MAINNET; } |
| 473 |
bool testnet() const { return nettype() == TESTNET; } |
| 474 |
bool stagenet() const { return nettype() == STAGENET; } |
| 475 |
|
| 476 |
virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const = 0; |
| 477 |
|
| 478 |
virtual bool useForkRules(uint8_t version, int64_t early_blocks) const = 0; |
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
virtual std::string integratedAddress(const std::string &payment_id) const = 0; |
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
virtual std::string secretViewKey() const = 0; |
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
virtual std::string publicViewKey() const = 0; |
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
virtual std::string secretSpendKey() const = 0; |
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
virtual std::string publicSpendKey() const = 0; |
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
virtual std::string publicMultisigSignerKey() const = 0; |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
virtual void stop() = 0; |
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
virtual bool store(const std::string &path) = 0; |
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
virtual std::string filename() const = 0; |
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
virtual std::string keysFilename() const = 0; |
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
virtual 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 = "") = 0; |
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
virtual bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const = 0; |
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) = 0; |
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
virtual uint64_t getRefreshFromBlockHeight() const = 0; |
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
virtual void setRecoveringFromSeed(bool recoveringFromSeed) = 0; |
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
virtual void setRecoveringFromDevice(bool recoveringFromDevice) = 0; |
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
virtual void setSubaddressLookahead(uint32_t major, uint32_t minor) = 0; |
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
virtual bool connectToDaemon() = 0; |
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
virtual ConnectionStatus connected() const = 0; |
| 612 |
virtual void setTrustedDaemon(bool arg) = 0; |
| 613 |
virtual bool trustedDaemon() const = 0; |
| 614 |
virtual bool setProxy(const std::string &address) = 0; |
| 615 |
virtual uint64_t balance(uint32_t accountIndex = 0) const = 0; |
| 616 |
uint64_t balanceAll() const { |
| 617 |
uint64_t result = 0; |
| 618 |
for (uint32_t i = 0; i < numSubaddressAccounts(); ++i) |
| 619 |
result += balance(i); |
| 620 |
return result; |
| 621 |
} |
| 622 |
virtual uint64_t unlockedBalance(uint32_t accountIndex = 0) const = 0; |
| 623 |
uint64_t unlockedBalanceAll() const { |
| 624 |
uint64_t result = 0; |
| 625 |
for (uint32_t i = 0; i < numSubaddressAccounts(); ++i) |
| 626 |
result += unlockedBalance(i); |
| 627 |
return result; |
| 628 |
} |
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
virtual bool watchOnly() const = 0; |
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
virtual bool isDeterministic() const = 0; |
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
virtual uint64_t blockChainHeight() const = 0; |
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
virtual uint64_t approximateBlockChainHeight() const = 0; |
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
|
| 659 |
virtual uint64_t estimateBlockChainHeight() const = 0; |
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
virtual uint64_t daemonBlockChainHeight() const = 0; |
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
virtual uint64_t daemonBlockChainTargetHeight() const = 0; |
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
virtual bool synchronized() const = 0; |
| 679 |
|
| 680 |
static std::string displayAmount(uint64_t amount); |
| 681 |
static uint64_t amountFromString(const std::string &amount); |
| 682 |
static uint64_t amountFromDouble(double amount); |
| 683 |
static std::string genPaymentId(); |
| 684 |
static bool paymentIdValid(const std::string &paiment_id); |
| 685 |
static bool addressValid(const std::string &str, NetworkType nettype); |
| 686 |
static bool addressValid(const std::string &str, bool testnet) |
| 687 |
{ |
| 688 |
return addressValid(str, testnet ? TESTNET : MAINNET); |
| 689 |
} |
| 690 |
static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, NetworkType nettype, std::string &error); |
| 691 |
static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, bool testnet, std::string &error) |
| 692 |
{ |
| 693 |
return keyValid(secret_key_string, address_string, isViewKey, testnet ? TESTNET : MAINNET, error); |
| 694 |
} |
| 695 |
static std::string paymentIdFromAddress(const std::string &str, NetworkType nettype); |
| 696 |
static std::string paymentIdFromAddress(const std::string &str, bool testnet) |
| 697 |
{ |
| 698 |
return paymentIdFromAddress(str, testnet ? TESTNET : MAINNET); |
| 699 |
} |
| 700 |
static uint64_t maximumAllowedAmount(); |
| 701 |
|
| 702 |
static void init(const char *argv0, const char *default_log_base_name) { init(argv0, default_log_base_name, "", true); } |
| 703 |
static void init(const char *argv0, const char *default_log_base_name, const std::string &log_path, bool console); |
| 704 |
static void debug(const std::string &category, const std::string &str); |
| 705 |
static void info(const std::string &category, const std::string &str); |
| 706 |
static void warning(const std::string &category, const std::string &str); |
| 707 |
static void error(const std::string &category, const std::string &str); |
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
virtual void startRefresh() = 0; |
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
virtual void pauseRefresh() = 0; |
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
virtual bool refresh() = 0; |
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
virtual void refreshAsync() = 0; |
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
virtual bool rescanBlockchain() = 0; |
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
virtual void rescanBlockchainAsync() = 0; |
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
virtual void setAutoRefreshInterval(int millis) = 0; |
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
virtual int autoRefreshInterval() const = 0; |
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
virtual void addSubaddressAccount(const std::string& label) = 0; |
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
virtual size_t numSubaddressAccounts() const = 0; |
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
virtual size_t numSubaddresses(uint32_t accountIndex) const = 0; |
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
virtual void addSubaddress(uint32_t accountIndex, const std::string& label) = 0; |
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
virtual std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const = 0; |
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
virtual void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0; |
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
virtual MultisigState multisig() const = 0; |
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
virtual std::string getMultisigInfo() const = 0; |
| 796 |
|
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
|
| 802 |
virtual std::string makeMultisig(const std::vector<std::string>& info, uint32_t threshold) = 0; |
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
virtual std::string exchangeMultisigKeys(const std::vector<std::string> &info, const bool force_update_use_with_caution) = 0; |
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
virtual bool exportMultisigImages(std::string& images) = 0; |
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
virtual size_t importMultisigImages(const std::vector<std::string>& images) = 0; |
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
virtual bool hasMultisigPartialKeyImages() const = 0; |
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
virtual PendingTransaction* restoreMultisigTransaction(const std::string& signData) = 0; |
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
|
| 847 |
|
| 848 |
virtual PendingTransaction * createTransactionMultDest(const std::vector<std::string> &dst_addr, const std::string &payment_id, |
| 849 |
optional<std::vector<uint64_t>> amount, uint32_t mixin_count, |
| 850 |
PendingTransaction::Priority = PendingTransaction::Priority_Low, |
| 851 |
uint32_t subaddr_account = 0, |
| 852 |
std::set<uint32_t> subaddr_indices = {}) = 0; |
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
virtual PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id, |
| 868 |
optional<uint64_t> amount, uint32_t mixin_count, |
| 869 |
PendingTransaction::Priority = PendingTransaction::Priority_Low, |
| 870 |
uint32_t subaddr_account = 0, |
| 871 |
std::set<uint32_t> subaddr_indices = {}) = 0; |
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
virtual PendingTransaction * createSweepUnmixableTransaction() = 0; |
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0; |
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
virtual bool submitTransaction(const std::string &fileName) = 0; |
| 893 |
|
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
virtual void disposeTransaction(PendingTransaction * t) = 0; |
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
|
| 906 |
virtual uint64_t estimateTransactionFee(const std::vector<std::pair<std::string, uint64_t>> &destinations, |
| 907 |
PendingTransaction::Priority priority) const = 0; |
| 908 |
|
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
virtual bool exportKeyImages(const std::string &filename, bool all = false) = 0; |
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
virtual bool importKeyImages(const std::string &filename) = 0; |
| 923 |
|
| 924 |
|
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
virtual bool exportOutputs(const std::string &filename, bool all = false) = 0; |
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
|
| 934 |
|
| 935 |
|
| 936 |
virtual bool importOutputs(const std::string &filename) = 0; |
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
virtual bool scanTransactions(const std::vector<std::string> &txids) = 0; |
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
|
| 952 |
virtual bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional<std::string> &background_cache_password) = 0; |
| 953 |
|
| 954 |
|
| 955 |
|
| 956 |
|
| 957 |
|
| 958 |
virtual BackgroundSyncType getBackgroundSyncType() const = 0; |
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
virtual bool startBackgroundSync() = 0; |
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
virtual bool stopBackgroundSync(const std::string &wallet_password) = 0; |
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
virtual bool isBackgroundSyncing() const = 0; |
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
virtual bool isBackgroundWallet() const = 0; |
| 980 |
|
| 981 |
virtual TransactionHistory * history() = 0; |
| 982 |
virtual AddressBook * addressBook() = 0; |
| 983 |
virtual Subaddress * subaddress() = 0; |
| 984 |
virtual SubaddressAccount * subaddressAccount() = 0; |
| 985 |
virtual void setListener(WalletListener *) = 0; |
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
virtual uint32_t defaultMixin() const = 0; |
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
virtual void setDefaultMixin(uint32_t arg) = 0; |
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
virtual bool setCacheAttribute(const std::string &key, const std::string &val) = 0; |
| 1004 |
|
| 1005 |
|
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
virtual std::string getCacheAttribute(const std::string &key) const = 0; |
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
|
| 1015 |
|
| 1016 |
virtual bool setUserNote(const std::string &txid, const std::string ¬e) = 0; |
| 1017 |
|
| 1018 |
|
| 1019 |
|
| 1020 |
|
| 1021 |
|
| 1022 |
virtual std::string getUserNote(const std::string &txid) const = 0; |
| 1023 |
virtual std::string getTxKey(const std::string &txid) const = 0; |
| 1024 |
virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, uint64_t &received, bool &in_pool, uint64_t &confirmations) = 0; |
| 1025 |
virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const = 0; |
| 1026 |
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) = 0; |
| 1027 |
virtual std::string getSpendProof(const std::string &txid, const std::string &message) const = 0; |
| 1028 |
virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const = 0; |
| 1029 |
|
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const = 0; |
| 1034 |
virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const = 0; |
| 1035 |
|
| 1036 |
|
| 1037 |
|
| 1038 |
|
| 1039 |
|
| 1040 |
|
| 1041 |
virtual std::string signMessage(const std::string &message, const std::string &address = "") = 0; |
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0; |
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
virtual std::string signMultisigParticipant(const std::string &message) const = 0; |
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const = 0; |
| 1065 |
|
| 1066 |
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) = 0; |
| 1067 |
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 = 0; |
| 1068 |
|
| 1069 |
virtual std::string getDefaultDataDir() const = 0; |
| 1070 |
|
| 1071 |
|
| 1072 |
|
| 1073 |
|
| 1074 |
|
| 1075 |
virtual bool rescanSpent() = 0; |
| 1076 |
|
| 1077 |
|
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
virtual void setOffline(bool offline) = 0; |
| 1082 |
virtual bool isOffline() const = 0; |
| 1083 |
|
| 1084 |
|
| 1085 |
virtual bool blackballOutputs(const std::vector<std::string> &outputs, bool add) = 0; |
| 1086 |
|
| 1087 |
|
| 1088 |
virtual bool blackballOutput(const std::string &amount, const std::string &offset) = 0; |
| 1089 |
|
| 1090 |
|
| 1091 |
virtual bool unblackballOutput(const std::string &amount, const std::string &offset) = 0; |
| 1092 |
|
| 1093 |
|
| 1094 |
virtual bool getRing(const std::string &key_image, std::vector<uint64_t> &ring) const = 0; |
| 1095 |
|
| 1096 |
|
| 1097 |
virtual bool getRings(const std::string &txid, std::vector<std::pair<std::string, std::vector<uint64_t>>> &rings) const = 0; |
| 1098 |
|
| 1099 |
|
| 1100 |
virtual bool setRing(const std::string &key_image, const std::vector<uint64_t> &ring, bool relative) = 0; |
| 1101 |
|
| 1102 |
|
| 1103 |
virtual void segregatePreForkOutputs(bool segregate) = 0; |
| 1104 |
|
| 1105 |
|
| 1106 |
virtual void segregationHeight(uint64_t height) = 0; |
| 1107 |
|
| 1108 |
|
| 1109 |
virtual void keyReuseMitigation2(bool mitigation) = 0; |
| 1110 |
|
| 1111 |
|
| 1112 |
virtual bool lightWalletLogin(bool &isNewWallet) const = 0; |
| 1113 |
|
| 1114 |
|
| 1115 |
virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) = 0; |
| 1116 |
|
| 1117 |
|
| 1118 |
virtual bool lockKeysFile() = 0; |
| 1119 |
virtual bool unlockKeysFile() = 0; |
| 1120 |
|
| 1121 |
virtual bool isKeysFileLocked() = 0; |
| 1122 |
|
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
|
| 1127 |
virtual Device getDeviceType() const = 0; |
| 1128 |
|
| 1129 |
|
| 1130 |
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) = 0; |
| 1131 |
|
| 1132 |
|
| 1133 |
virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0; |
| 1134 |
|
| 1135 |
|
| 1136 |
virtual bool reconnectDevice() = 0; |
| 1137 |
|
| 1138 |
|
| 1139 |
virtual uint64_t getBytesReceived() = 0; |
| 1140 |
|
| 1141 |
|
| 1142 |
virtual uint64_t getBytesSent() = 0; |
| 1143 |
}; |
| 1144 |
|
| 1145 |
|
| 1146 |
|
| 1147 |
|
| 1148 |
struct WalletManager |
| 1149 |
{ |
| 1150 |
|
| 1151 |
|
| 1152 |
|
| 1153 |
|
| 1154 |
|
| 1155 |
|
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype, uint64_t kdf_rounds = 1) = 0; |
| 1161 |
Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet = false) |
| 1162 |
{ |
| 1163 |
return createWallet(path, password, language, testnet ? TESTNET : MAINNET); |
| 1164 |
} |
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
|
| 1175 |
virtual Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds = 1, WalletListener * listener = nullptr) = 0; |
| 1176 |
Wallet * openWallet(const std::string &path, const std::string &password, bool testnet = false) |
| 1177 |
{ |
| 1178 |
return openWallet(path, password, testnet ? TESTNET : MAINNET); |
| 1179 |
} |
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 1183 |
|
| 1184 |
|
| 1185 |
|
| 1186 |
|
| 1187 |
|
| 1188 |
|
| 1189 |
|
| 1190 |
|
| 1191 |
|
| 1192 |
virtual Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, |
| 1193 |
NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1, |
| 1194 |
const std::string &seed_offset = {}) = 0; |
| 1195 |
Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, |
| 1196 |
bool testnet = false, uint64_t restoreHeight = 0) |
| 1197 |
{ |
| 1198 |
return recoveryWallet(path, password, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight); |
| 1199 |
} |
| 1200 |
|
| 1201 |
|
| 1202 |
|
| 1203 |
|
| 1204 |
|
| 1205 |
|
| 1206 |
|
| 1207 |
|
| 1208 |
|
| 1209 |
|
| 1210 |
virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight = 0) = 0; |
| 1211 |
Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, bool testnet = false, uint64_t restoreHeight = 0) |
| 1212 |
{ |
| 1213 |
return recoveryWallet(path, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight); |
| 1214 |
} |
| 1215 |
|
| 1216 |
|
| 1217 |
|
| 1218 |
|
| 1219 |
|
| 1220 |
|
| 1221 |
|
| 1222 |
|
| 1223 |
|
| 1224 |
|
| 1225 |
|
| 1226 |
|
| 1227 |
|
| 1228 |
|
| 1229 |
virtual Wallet * createWalletFromKeys(const std::string &path, |
| 1230 |
const std::string &password, |
| 1231 |
const std::string &language, |
| 1232 |
NetworkType nettype, |
| 1233 |
uint64_t restoreHeight, |
| 1234 |
const std::string &addressString, |
| 1235 |
const std::string &viewKeyString, |
| 1236 |
const std::string &spendKeyString = "", |
| 1237 |
uint64_t kdf_rounds = 1) = 0; |
| 1238 |
Wallet * createWalletFromKeys(const std::string &path, |
| 1239 |
const std::string &password, |
| 1240 |
const std::string &language, |
| 1241 |
bool testnet, |
| 1242 |
uint64_t restoreHeight, |
| 1243 |
const std::string &addressString, |
| 1244 |
const std::string &viewKeyString, |
| 1245 |
const std::string &spendKeyString = "") |
| 1246 |
{ |
| 1247 |
return createWalletFromKeys(path, password, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString); |
| 1248 |
} |
| 1249 |
|
| 1250 |
|
| 1251 |
|
| 1252 |
|
| 1253 |
|
| 1254 |
|
| 1255 |
|
| 1256 |
|
| 1257 |
|
| 1258 |
|
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
virtual Wallet * createWalletFromKeys(const std::string &path, |
| 1263 |
const std::string &language, |
| 1264 |
NetworkType nettype, |
| 1265 |
uint64_t restoreHeight, |
| 1266 |
const std::string &addressString, |
| 1267 |
const std::string &viewKeyString, |
| 1268 |
const std::string &spendKeyString = "") = 0; |
| 1269 |
Wallet * createWalletFromKeys(const std::string &path, |
| 1270 |
const std::string &language, |
| 1271 |
bool testnet, |
| 1272 |
uint64_t restoreHeight, |
| 1273 |
const std::string &addressString, |
| 1274 |
const std::string &viewKeyString, |
| 1275 |
const std::string &spendKeyString = "") |
| 1276 |
{ |
| 1277 |
return createWalletFromKeys(path, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString); |
| 1278 |
} |
| 1279 |
|
| 1280 |
|
| 1281 |
|
| 1282 |
|
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
virtual Wallet * createWalletFromDevice(const std::string &path, |
| 1293 |
const std::string &password, |
| 1294 |
NetworkType nettype, |
| 1295 |
const std::string &deviceName, |
| 1296 |
uint64_t restoreHeight = 0, |
| 1297 |
const std::string &subaddressLookahead = "", |
| 1298 |
uint64_t kdf_rounds = 1, |
| 1299 |
WalletListener * listener = nullptr) = 0; |
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
virtual bool closeWallet(Wallet *wallet, bool store = true) = 0; |
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
|
| 1316 |
|
| 1317 |
virtual bool walletExists(const std::string &path) = 0; |
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
|
| 1330 |
|
| 1331 |
virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds = 1) const = 0; |
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
|
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
|
| 1343 |
virtual bool queryWalletDevice(Wallet::Device& device_type, const std::string &keys_file_name, const std::string &password, uint64_t kdf_rounds = 1) const = 0; |
| 1344 |
|
| 1345 |
|
| 1346 |
|
| 1347 |
|
| 1348 |
|
| 1349 |
|
| 1350 |
virtual std::vector<std::string> findWallets(const std::string &path) = 0; |
| 1351 |
|
| 1352 |
|
| 1353 |
virtual std::string errorString() const = 0; |
| 1354 |
|
| 1355 |
|
| 1356 |
virtual void setDaemonAddress(const std::string &address) = 0; |
| 1357 |
|
| 1358 |
|
| 1359 |
virtual bool connected(uint32_t *version = NULL) = 0; |
| 1360 |
|
| 1361 |
|
| 1362 |
virtual uint64_t blockchainHeight() = 0; |
| 1363 |
|
| 1364 |
|
| 1365 |
virtual uint64_t blockchainTargetHeight() = 0; |
| 1366 |
|
| 1367 |
|
| 1368 |
virtual uint64_t networkDifficulty() = 0; |
| 1369 |
|
| 1370 |
|
| 1371 |
virtual double miningHashRate() = 0; |
| 1372 |
|
| 1373 |
|
| 1374 |
virtual uint64_t blockTarget() = 0; |
| 1375 |
|
| 1376 |
|
| 1377 |
virtual bool isMining() = 0; |
| 1378 |
|
| 1379 |
|
| 1380 |
virtual bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true) = 0; |
| 1381 |
|
| 1382 |
|
| 1383 |
virtual bool stopMining() = 0; |
| 1384 |
|
| 1385 |
|
| 1386 |
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0; |
| 1387 |
|
| 1388 |
|
| 1389 |
static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates( |
| 1390 |
const std::string &software, |
| 1391 |
std::string subdir, |
| 1392 |
const char *buildtag = nullptr, |
| 1393 |
const char *current_version = nullptr); |
| 1394 |
|
| 1395 |
|
| 1396 |
virtual bool setProxy(const std::string &address) = 0; |
| 1397 |
}; |
| 1398 |
|
| 1399 |
|
| 1400 |
struct WalletManagerFactory |
| 1401 |
{ |
| 1402 |
|
| 1403 |
enum LogLevel { |
| 1404 |
LogLevel_Silent = -1, |
| 1405 |
LogLevel_0 = 0, |
| 1406 |
LogLevel_1 = 1, |
| 1407 |
LogLevel_2 = 2, |
| 1408 |
LogLevel_3 = 3, |
| 1409 |
LogLevel_4 = 4, |
| 1410 |
LogLevel_Min = LogLevel_Silent, |
| 1411 |
LogLevel_Max = LogLevel_4 |
| 1412 |
}; |
| 1413 |
|
| 1414 |
static WalletManager * getWalletManager(); |
| 1415 |
static void setLogLevel(int level); |
| 1416 |
static void setLogCategories(const std::string &categories); |
| 1417 |
}; |
| 1418 |
|
| 1419 |
|
| 1420 |
} |