1 // Copyright (c) 2018-2019 The Bitcoin Core developers 2 // Distributed under the MIT software license, see the accompanying 3 // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 5 #ifndef BITCOIN_INTERFACES_WALLET_H 6 #define BITCOIN_INTERFACES_WALLET_H 7 8 #include <amount.h> // For CAmount 9 #include <pubkey.h> // For CKeyID and CScriptID (definitions needed in CTxDestination instantiation) 10 #include <script/standard.h> // For CTxDestination 11 #include <support/allocators/secure.h> // For SecureString 12 #include <ui_interface.h> // For ChangeType 13 #include <util/message.h> 14 15 #include <functional> 16 #include <map> 17 #include <memory> 18 #include <psbt.h> 19 #include <stdint.h> 20 #include <string> 21 #include <tuple> 22 #include <utility> 23 #include <vector> 24 25 class CCoinControl; 26 class CFeeRate; 27 class CKey; 28 class CWallet; 29 enum isminetype : unsigned int; 30 enum class FeeReason; 31 typedef uint8_t isminefilter; 32 33 enum class OutputType; 34 struct CRecipient; 35 36 namespace interfaces { 37 38 class Handler; 39 struct WalletAddress; 40 struct WalletBalances; 41 struct WalletTx; 42 struct WalletTxOut; 43 struct WalletTxStatus; 44 struct TokenInfo; 45 struct TokenTx; 46 struct ContractBookData; 47 struct DelegationInfo; 48 struct DelegationDetails; 49 struct SuperStakerInfo; 50 struct DelegationStakerInfo; 51 52 53 using WalletOrderForm = std::vector<std::pair<std::string, std::string>>; 54 using WalletValueMap = std::map<std::string, std::string>; 55 56 //! Interface for accessing a wallet. 57 class Wallet 58 { 59 public: ~Wallet()60 virtual ~Wallet() {} 61 62 //! Encrypt wallet. 63 virtual bool encryptWallet(const SecureString& wallet_passphrase) = 0; 64 65 //! Return whether wallet is encrypted. 66 virtual bool isCrypted() = 0; 67 68 //! Lock wallet. 69 virtual bool lock() = 0; 70 71 //! Unlock wallet. 72 virtual bool unlock(const SecureString& wallet_passphrase) = 0; 73 74 //! Return whether wallet is locked. 75 virtual bool isLocked() = 0; 76 77 //! Change wallet passphrase. 78 virtual bool changeWalletPassphrase(const SecureString& old_wallet_passphrase, 79 const SecureString& new_wallet_passphrase) = 0; 80 81 //! Abort a rescan. 82 virtual void abortRescan() = 0; 83 84 //! Back up wallet. 85 virtual bool backupWallet(const std::string& filename) = 0; 86 87 //! Get wallet name. 88 virtual std::string getWalletName() = 0; 89 90 // Get a new address. 91 virtual bool getNewDestination(const OutputType type, const std::string label, CTxDestination& dest) = 0; 92 93 //! Get public key. 94 virtual bool getPubKey(const CScript& script, const CKeyID& address, CPubKey& pub_key) = 0; 95 96 //! Sign message 97 virtual SigningResult signMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) = 0; 98 99 //! Return whether wallet has private key. 100 virtual bool isSpendable(const CTxDestination& dest) = 0; 101 102 //! Return whether wallet has watch only keys. 103 virtual bool haveWatchOnly() = 0; 104 105 //! Add or update address. 106 virtual bool setAddressBook(const CTxDestination& dest, const std::string& name, const std::string& purpose) = 0; 107 108 // Remove address. 109 virtual bool delAddressBook(const CTxDestination& dest) = 0; 110 111 //! Look up address in wallet, return whether exists. 112 virtual bool getAddress(const CTxDestination& dest, 113 std::string* name, 114 isminetype* is_mine, 115 std::string* purpose) = 0; 116 117 //! Get wallet address list. 118 virtual std::vector<WalletAddress> getAddresses() = 0; 119 120 //! Add dest data. 121 virtual bool addDestData(const CTxDestination& dest, const std::string& key, const std::string& value) = 0; 122 123 //! Erase dest data. 124 virtual bool eraseDestData(const CTxDestination& dest, const std::string& key) = 0; 125 126 //! Get dest values with prefix. 127 virtual std::vector<std::string> getDestValues(const std::string& prefix) = 0; 128 129 //! Lock coin. 130 virtual void lockCoin(const COutPoint& output) = 0; 131 132 //! Unlock coin. 133 virtual void unlockCoin(const COutPoint& output) = 0; 134 135 //! Return whether coin is locked. 136 virtual bool isLockedCoin(const COutPoint& output) = 0; 137 138 //! List locked coins. 139 virtual void listLockedCoins(std::vector<COutPoint>& outputs) = 0; 140 141 //! Create transaction. 142 virtual CTransactionRef createTransaction(const std::vector<CRecipient>& recipients, 143 const CCoinControl& coin_control, 144 bool sign, 145 int& change_pos, 146 CAmount& fee, 147 std::string& fail_reason) = 0; 148 149 //! Commit transaction. 150 virtual void commitTransaction(CTransactionRef tx, 151 WalletValueMap value_map, 152 WalletOrderForm order_form) = 0; 153 154 //! Return whether transaction can be abandoned. 155 virtual bool transactionCanBeAbandoned(const uint256& txid) = 0; 156 157 //! Abandon transaction. 158 virtual bool abandonTransaction(const uint256& txid) = 0; 159 160 //! Return whether transaction can be bumped. 161 virtual bool transactionCanBeBumped(const uint256& txid) = 0; 162 163 //! Create bump transaction. 164 virtual bool createBumpTransaction(const uint256& txid, 165 const CCoinControl& coin_control, 166 std::vector<std::string>& errors, 167 CAmount& old_fee, 168 CAmount& new_fee, 169 CMutableTransaction& mtx) = 0; 170 171 //! Sign bump transaction. 172 virtual bool signBumpTransaction(CMutableTransaction& mtx) = 0; 173 174 //! Commit bump transaction. 175 virtual bool commitBumpTransaction(const uint256& txid, 176 CMutableTransaction&& mtx, 177 std::vector<std::string>& errors, 178 uint256& bumped_txid) = 0; 179 180 //! Get a transaction. 181 virtual CTransactionRef getTx(const uint256& txid) = 0; 182 183 //! Get transaction information. 184 virtual WalletTx getWalletTx(const uint256& txid) = 0; 185 186 //! Get list of all wallet transactions. 187 virtual std::vector<WalletTx> getWalletTxs() = 0; 188 189 //! Try to get updated status for a particular transaction, if possible without blocking. 190 virtual bool tryGetTxStatus(const uint256& txid, 191 WalletTxStatus& tx_status, 192 int& num_blocks, 193 int64_t& block_time) = 0; 194 195 //! Get transaction details. 196 virtual WalletTx getWalletTxDetails(const uint256& txid, 197 WalletTxStatus& tx_status, 198 WalletOrderForm& order_form, 199 bool& in_mempool, 200 int& num_blocks) = 0; 201 202 //! Fill PSBT. 203 virtual TransactionError fillPSBT(int sighash_type, 204 bool sign, 205 bool bip32derivs, 206 PartiallySignedTransaction& psbtx, 207 bool& complete) = 0; 208 209 //! Get balances. 210 virtual WalletBalances getBalances() = 0; 211 212 //! Get balances if possible without waiting for chain and wallet locks. 213 virtual bool tryGetBalances(WalletBalances& balances, 214 int& num_blocks, 215 bool force, 216 int cached_num_blocks) = 0; 217 218 //! Get balance. 219 virtual CAmount getBalance() = 0; 220 221 //! Get available balance. 222 virtual CAmount getAvailableBalance(const CCoinControl& coin_control) = 0; 223 224 //! Return whether transaction input belongs to wallet. 225 virtual isminetype txinIsMine(const CTxIn& txin) = 0; 226 227 //! Return whether transaction output belongs to wallet. 228 virtual isminetype txoutIsMine(const CTxOut& txout) = 0; 229 230 //! Return debit amount if transaction input belongs to wallet. 231 virtual CAmount getDebit(const CTxIn& txin, isminefilter filter) = 0; 232 233 //! Return credit amount if transaction input belongs to wallet. 234 virtual CAmount getCredit(const CTxOut& txout, isminefilter filter) = 0; 235 236 //! Check if address have unspent coins 237 virtual bool isUnspentAddress(const std::string& address) = 0; 238 239 //! Check if address is mine 240 virtual bool isMineAddress(const std::string &strAddress) = 0; 241 242 //! Try get available coins addresses 243 virtual bool tryGetAvailableAddresses(std::vector<std::string> &spendableAddresses, std::vector<std::string> &allAddresses, bool &includeZeroValue) = 0; 244 245 //! Return AvailableCoins + LockedCoins grouped by wallet address. 246 //! (put change in one group with wallet address) 247 using CoinsList = std::map<CTxDestination, std::vector<std::tuple<COutPoint, WalletTxOut>>>; 248 virtual CoinsList listCoins() = 0; 249 250 //! Return wallet transaction output information. 251 virtual std::vector<WalletTxOut> getCoins(const std::vector<COutPoint>& outputs) = 0; 252 253 //! Get required fee. 254 virtual CAmount getRequiredFee(unsigned int tx_bytes) = 0; 255 256 //! Get minimum fee. 257 virtual CAmount getMinimumFee(unsigned int tx_bytes, 258 const CCoinControl& coin_control, 259 int* returned_target, 260 FeeReason* reason) = 0; 261 262 //! Get tx confirm target. 263 virtual unsigned int getConfirmTarget() = 0; 264 265 // Return whether HD enabled. 266 virtual bool hdEnabled() = 0; 267 268 // Return whether the wallet is blank. 269 virtual bool canGetAddresses() = 0; 270 271 // Return whether private keys enabled. 272 virtual bool privateKeysDisabled() = 0; 273 274 // Get default address type. 275 virtual OutputType getDefaultAddressType() = 0; 276 277 // Get default change type. 278 virtual OutputType getDefaultChangeType() = 0; 279 280 //! Get max tx fee. 281 virtual CAmount getDefaultMaxTxFee() = 0; 282 283 // Remove wallet. 284 virtual void remove() = 0; 285 286 //! Add wallet token entry. 287 virtual bool addTokenEntry(const TokenInfo &token) = 0; 288 289 //! Add wallet token transaction entry. 290 virtual bool addTokenTxEntry(const TokenTx& tokenTx, bool fFlushOnClose=true) = 0; 291 292 //! Check if exist wallet token entry. 293 virtual bool existTokenEntry(const TokenInfo &token) = 0; 294 295 //! Remove wallet token entry. 296 virtual bool removeTokenEntry(const std::string &sHash) = 0; 297 298 //! Get invalid wallet tokens 299 virtual std::vector<TokenInfo> getInvalidTokens() = 0; 300 301 //! Get token transaction information. 302 virtual TokenTx getTokenTx(const uint256& txid) = 0; 303 304 //! Get list of all wallet token transactions. 305 virtual std::vector<TokenTx> getTokenTxs() = 0; 306 307 //! Get token information. 308 virtual TokenInfo getToken(const uint256& id) = 0; 309 310 //! Get list of all tokens. 311 virtual std::vector<TokenInfo> getTokens() = 0; 312 313 //! Try to get updated status for a particular token transaction, if possible without blocking. 314 virtual bool tryGetTokenTxStatus(const uint256& txid, int& block_number, bool& in_mempool, int& num_blocks) = 0; 315 316 //! Get updated status for a particular token transaction. 317 virtual bool getTokenTxStatus(const uint256& txid, int& block_number, bool& in_mempool, int& num_blocks) = 0; 318 319 //! Get token transaction details 320 virtual bool getTokenTxDetails(const TokenTx &wtx, uint256& credit, uint256& debit, std::string& tokenSymbol, uint8_t& decimals) = 0; 321 322 //! Clean token transaction entries in the wallet 323 virtual bool cleanTokenTxEntries() = 0; 324 325 //! Check if token transaction is mine 326 virtual bool isTokenTxMine(const TokenTx &wtx) = 0; 327 328 //! Get contract book data. 329 virtual ContractBookData getContractBook(const std::string& address) = 0; 330 331 //! Get list of all contract book data. 332 virtual std::vector<ContractBookData> getContractBooks() = 0; 333 334 //! Check if exist contract book. 335 virtual bool existContractBook(const std::string& address) = 0; 336 337 //! Delete contract book data. 338 virtual bool delContractBook(const std::string& address) = 0; 339 340 //! Set contract book data. 341 virtual bool setContractBook(const std::string& address, const std::string& name, const std::string& abi) = 0; 342 343 //! Restore wallet delegations. 344 virtual uint32_t restoreDelegations() = 0; 345 346 //! Add wallet delegation entry. 347 virtual bool addDelegationEntry(const DelegationInfo &delegation) = 0; 348 349 //! Check if exist wallet delegation entry. 350 virtual bool existDelegationEntry(const DelegationInfo &delegation) = 0; 351 352 //! Get delegation information. 353 virtual DelegationInfo getDelegation(const uint256& id) = 0; 354 355 //! Get delegation information from contract. 356 virtual DelegationInfo getDelegationContract(const std::string &sHash, bool& validated, bool& contractRet) = 0; 357 358 //! Get delegation details for address. 359 virtual DelegationDetails getDelegationDetails(const std::string &sAddress) = 0; 360 361 //! Get list of all delegations. 362 virtual std::vector<DelegationInfo> getDelegations() = 0; 363 364 //! Remove wallet delegation entry. 365 virtual bool removeDelegationEntry(const std::string &sHash) = 0; 366 367 //! Set delegation entry removed. 368 virtual bool setDelegationRemoved(const std::string &sHash, const std::string &sTxid) = 0; 369 370 //! Restore wallet super stakers. 371 virtual uint32_t restoreSuperStakers() = 0; 372 373 //! Exist super staker. 374 virtual bool existSuperStaker(const std::string &sAddress) = 0; 375 376 //! Get super staker information. 377 virtual SuperStakerInfo getSuperStaker(const uint256& id) = 0; 378 379 //! Get super staker recommended config. 380 virtual SuperStakerInfo getSuperStakerRecommendedConfig() = 0; 381 382 //! Get list of all super stakers. 383 virtual std::vector<SuperStakerInfo> getSuperStakers() = 0; 384 385 //! Add wallet super staker entry. 386 virtual bool addSuperStakerEntry(const SuperStakerInfo &superStaker) = 0; 387 388 //! Remove wallet super staker entry. 389 virtual bool removeSuperStakerEntry(const std::string &sHash) = 0; 390 391 //! Get the super staker weight 392 virtual uint64_t getSuperStakerWeight(const uint256& id) = 0; 393 394 //! Is super staker staking 395 virtual bool isSuperStakerStaking(const uint256& id, CAmount& delegationsWeight) = 0; 396 397 //! Try get the stake weight 398 virtual bool tryGetStakeWeight(uint64_t& nWeight) = 0; 399 400 //! Get the stake weight 401 virtual uint64_t getStakeWeight() = 0; 402 403 //! Get last coin stake search interval 404 virtual int64_t getLastCoinStakeSearchInterval() = 0; 405 406 //! Get wallet unlock for staking only 407 virtual bool getWalletUnlockStakingOnly() = 0; 408 409 //! Set wallet unlock for staking only 410 virtual void setWalletUnlockStakingOnly(bool unlock) = 0; 411 412 //! Set wallet enabled for staking 413 virtual void setEnabledStaking(bool enabled) = 0; 414 415 //! Get wallet enabled for staking 416 virtual bool getEnabledStaking() = 0; 417 418 //! Get wallet enabled for super staking 419 virtual bool getEnabledSuperStaking() = 0; 420 421 //! Get a delegation from super staker. 422 virtual DelegationStakerInfo getDelegationStaker(const uint160& id) = 0; 423 424 //! Get list of all delegations for super stakers. 425 virtual std::vector<DelegationStakerInfo> getDelegationsStakers() = 0; 426 427 //! Get staker address balance. 428 virtual bool getStakerAddressBalance(const std::string& staker, CAmount& balance, CAmount& stake, CAmount& weight) = 0; 429 430 //! Register handler for unload message. 431 using UnloadFn = std::function<void()>; 432 virtual std::unique_ptr<Handler> handleUnload(UnloadFn fn) = 0; 433 434 //! Register handler for show progress messages. 435 using ShowProgressFn = std::function<void(const std::string& title, int progress)>; 436 virtual std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) = 0; 437 438 //! Register handler for status changed messages. 439 using StatusChangedFn = std::function<void()>; 440 virtual std::unique_ptr<Handler> handleStatusChanged(StatusChangedFn fn) = 0; 441 442 //! Register handler for address book changed messages. 443 using AddressBookChangedFn = std::function<void(const CTxDestination& address, 444 const std::string& label, 445 bool is_mine, 446 const std::string& purpose, 447 ChangeType status)>; 448 virtual std::unique_ptr<Handler> handleAddressBookChanged(AddressBookChangedFn fn) = 0; 449 450 //! Register handler for transaction changed messages. 451 using TransactionChangedFn = std::function<void(const uint256& txid, ChangeType status)>; 452 virtual std::unique_ptr<Handler> handleTransactionChanged(TransactionChangedFn fn) = 0; 453 454 //! Register handler for token transaction changed messages. 455 using TokenTransactionChangedFn = std::function<void(const uint256& id, ChangeType status)>; 456 virtual std::unique_ptr<Handler> handleTokenTransactionChanged(TokenTransactionChangedFn fn) = 0; 457 458 //! Register handler for token changed messages. 459 using TokenChangedFn = std::function<void(const uint256& id, ChangeType status)>; 460 virtual std::unique_ptr<Handler> handleTokenChanged(TokenChangedFn fn) = 0; 461 462 //! Register handler for watchonly changed messages. 463 using WatchOnlyChangedFn = std::function<void(bool have_watch_only)>; 464 virtual std::unique_ptr<Handler> handleWatchOnlyChanged(WatchOnlyChangedFn fn) = 0; 465 466 //! Register handler for keypool changed messages. 467 using CanGetAddressesChangedFn = std::function<void()>; 468 virtual std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0; 469 470 //! Register handler for contract book changed messages. 471 using ContractBookChangedFn = std::function<void( const std::string& address, 472 const std::string& label, 473 const std::string& abi, 474 ChangeType status)>; 475 virtual std::unique_ptr<Handler> handleContractBookChanged(ContractBookChangedFn fn) = 0; 476 477 //! Register handler for delegation changed messages. 478 using DelegationChangedFn = std::function<void(const uint256& id, ChangeType status)>; 479 virtual std::unique_ptr<Handler> handleDelegationChanged(DelegationChangedFn fn) = 0; 480 481 //! Register handler for super staker changed messages. 482 using SuperStakerChangedFn = std::function<void(const uint256& id, ChangeType status)>; 483 virtual std::unique_ptr<Handler> handleSuperStakerChanged(SuperStakerChangedFn fn) = 0; 484 485 //! Register handler for delegations staker changed messages. 486 using DelegationsStakerChangedFn = std::function<void(const uint160& id, ChangeType status)>; 487 virtual std::unique_ptr<Handler> handleDelegationsStakerChanged(DelegationsStakerChangedFn fn) = 0; 488 }; 489 490 //! Information about one wallet address. 491 struct WalletAddress 492 { 493 CTxDestination dest; 494 isminetype is_mine; 495 std::string name; 496 std::string purpose; 497 WalletAddressWalletAddress498 WalletAddress(CTxDestination dest, isminetype is_mine, std::string name, std::string purpose) 499 : dest(std::move(dest)), is_mine(is_mine), name(std::move(name)), purpose(std::move(purpose)) 500 { 501 } 502 }; 503 504 //! Collection of wallet balances. 505 struct WalletBalances 506 { 507 CAmount balance = 0; 508 CAmount unconfirmed_balance = 0; 509 CAmount immature_balance = 0; 510 CAmount stake = 0; 511 bool have_watch_only = false; 512 CAmount watch_only_balance = 0; 513 CAmount unconfirmed_watch_only_balance = 0; 514 CAmount immature_watch_only_balance = 0; 515 CAmount watch_only_stake = 0; 516 balanceChangedWalletBalances517 bool balanceChanged(const WalletBalances& prev) const 518 { 519 return balance != prev.balance || unconfirmed_balance != prev.unconfirmed_balance || 520 immature_balance != prev.immature_balance || stake != prev.stake || watch_only_balance != prev.watch_only_balance || 521 unconfirmed_watch_only_balance != prev.unconfirmed_watch_only_balance || 522 immature_watch_only_balance != prev.immature_watch_only_balance || watch_only_stake != prev.watch_only_stake; 523 } 524 }; 525 526 //! Wallet transaction information. 527 struct WalletTx 528 { 529 CTransactionRef tx; 530 std::vector<isminetype> txin_is_mine; 531 std::vector<isminetype> txout_is_mine; 532 std::vector<CTxDestination> txout_address; 533 std::vector<isminetype> txout_address_is_mine; 534 CAmount credit; 535 CAmount debit; 536 CAmount change; 537 int64_t time; 538 std::map<std::string, std::string> value_map; 539 bool is_coinbase; 540 bool is_coinstake; 541 bool is_in_main_chain; 542 543 // Contract tx params 544 bool has_create_or_call; 545 CKeyID tx_sender_key; 546 std::vector<CKeyID> txout_keys; 547 }; 548 549 //! Updated transaction status. 550 struct WalletTxStatus 551 { 552 int block_height; 553 int blocks_to_maturity; 554 int depth_in_main_chain; 555 unsigned int time_received; 556 uint32_t lock_time; 557 bool is_final; 558 bool is_trusted; 559 bool is_abandoned; 560 bool is_coinbase; 561 bool is_coinstake; 562 bool is_in_main_chain; 563 }; 564 565 //! Wallet transaction output. 566 struct WalletTxOut 567 { 568 CTxOut txout; 569 int64_t time; 570 int depth_in_main_chain = -1; 571 bool is_spent = false; 572 }; 573 574 // Wallet token information. 575 struct TokenInfo 576 { 577 std::string contract_address; 578 std::string token_name; 579 std::string token_symbol; 580 uint8_t decimals = 0; 581 std::string sender_address; 582 int64_t time = 0; 583 uint256 block_hash; 584 int64_t block_number = -1; 585 uint256 hash; 586 }; 587 588 // Wallet token transaction 589 struct TokenTx 590 { 591 std::string contract_address; 592 std::string sender_address; 593 std::string receiver_address; 594 uint256 value; 595 uint256 tx_hash; 596 int64_t time = 0; 597 uint256 block_hash; 598 int64_t block_number = -1; 599 std::string label; 600 uint256 hash; 601 }; 602 603 // Wallet contract book data */ 604 struct ContractBookData 605 { 606 std::string address; 607 std::string name; 608 std::string abi; 609 }; 610 611 // Wallet delegation information. 612 struct DelegationInfo 613 { 614 std::string delegate_address; 615 std::string staker_address; 616 std::string staker_name; 617 uint8_t fee = 0; 618 int64_t time = 0; 619 int64_t block_number = -1; 620 uint256 hash; 621 uint256 create_tx_hash; 622 uint256 remove_tx_hash; 623 }; 624 625 // Delegation details. 626 struct DelegationDetails 627 { 628 // Wallet delegation details 629 bool w_entry_exist = false; 630 std::string w_delegate_address; 631 std::string w_staker_address; 632 std::string w_staker_name; 633 uint8_t w_fee = 0; 634 int64_t w_time = 0; 635 int64_t w_block_number = -1; 636 uint256 w_hash; 637 uint256 w_create_tx_hash; 638 uint256 w_remove_tx_hash; 639 640 // Wallet create tx details 641 bool w_create_exist = false; 642 bool w_create_in_main_chain = false; 643 bool w_create_in_mempool = false; 644 bool w_create_abandoned = false; 645 646 // Wallet remove tx details 647 bool w_remove_exist = false; 648 bool w_remove_in_main_chain = false; 649 bool w_remove_in_mempool = false; 650 bool w_remove_abandoned = false; 651 652 // Delegation contract details 653 std::string c_delegate_address; 654 std::string c_staker_address; 655 uint8_t c_fee = 0; 656 int64_t c_block_number = -1; 657 bool c_entry_exist = false; 658 bool c_contract_return = false; 659 660 // To delegation info 661 DelegationInfo toInfo(bool fromWallet = true) 662 { 663 interfaces::DelegationInfo info; 664 info.delegate_address = fromWallet ? w_delegate_address : c_delegate_address; 665 info.staker_address = fromWallet ? w_staker_address : c_staker_address; 666 info.fee = fromWallet ? w_fee : c_fee; 667 info.block_number = fromWallet ? w_block_number : c_block_number; 668 info.hash = w_hash; 669 info.time = w_time; 670 info.create_tx_hash = w_create_tx_hash; 671 info.remove_tx_hash = w_remove_tx_hash; 672 info.staker_name = w_staker_name; 673 return info; 674 } 675 }; 676 677 // Super staker address list 678 enum SuperStakerAddressList 679 { 680 AcceptAll = 0, 681 AllowList = 1, 682 ExcludeList = 2 683 }; 684 685 // Wallet super staker information. 686 struct SuperStakerInfo 687 { 688 uint256 hash; 689 std::string staker_address; 690 std::string staker_name; 691 int64_t time = 0; 692 bool custom_config = false; 693 uint8_t min_fee = 0; 694 CAmount min_delegate_utxo = 0; 695 std::vector<std::string> delegate_address_list; 696 int delegate_address_type = 0; 697 }; 698 699 // Wallet delegation staker information. 700 struct DelegationStakerInfo 701 { 702 std::string delegate_address; 703 std::string staker_address; 704 std::string PoD; 705 uint8_t fee = 0; 706 int64_t time = 0; 707 int64_t block_number = -1; 708 CAmount weight = 0; 709 uint160 hash; 710 }; 711 712 //! Return implementation of Wallet interface. This function is defined in 713 //! dummywallet.cpp and throws if the wallet component is not compiled. 714 std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet); 715 716 } // namespace interfaces 717 718 #endif // BITCOIN_INTERFACES_WALLET_H 719