/tmp/bitcoin/src/wallet/external_signer_scriptpubkeyman.h
Line | Count | Source |
1 | | // Copyright (c) 2019-present 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_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H |
6 | | #define BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H |
7 | | |
8 | | #include <wallet/scriptpubkeyman.h> |
9 | | |
10 | | #include <memory> |
11 | | #include <util/result.h> |
12 | | |
13 | | struct bilingual_str; |
14 | | |
15 | | namespace wallet { |
16 | | class ExternalSignerScriptPubKeyMan : public DescriptorScriptPubKeyMan |
17 | | { |
18 | | private: |
19 | | //! Create an ExternalSPKM from existing wallet data |
20 | | ExternalSignerScriptPubKeyMan(WalletStorage& storage, WalletDescriptor& descriptor, int64_t keypool_size, const KeyMap& keys, const CryptedKeyMap& ckeys) |
21 | 8 | : DescriptorScriptPubKeyMan(storage, descriptor, keypool_size, keys, ckeys) |
22 | 8 | {} |
23 | | |
24 | | ExternalSignerScriptPubKeyMan(WalletStorage& storage, int64_t keypool_size) |
25 | 16 | : DescriptorScriptPubKeyMan(storage, keypool_size) |
26 | 16 | {} |
27 | | |
28 | | public: |
29 | | static std::unique_ptr<ExternalSignerScriptPubKeyMan> LoadFromStorage(WalletStorage& storage, WalletDescriptor& descriptor, int64_t keypool_size, const KeyMap& keys, const CryptedKeyMap& ckeys); |
30 | | static std::unique_ptr<ExternalSignerScriptPubKeyMan> CreateNew(WalletStorage& storage, WalletBatch& batch, int64_t keypool_size, std::unique_ptr<Descriptor> desc); |
31 | | |
32 | | static util::Result<ExternalSigner> GetExternalSigner(); |
33 | | |
34 | | /** |
35 | | * Display address on the device and verify that the returned value matches. |
36 | | * @returns nothing or an error message |
37 | | */ |
38 | | util::Result<void> DisplayAddress(const CTxDestination& dest, const ExternalSigner& signer) const; |
39 | | |
40 | | std::optional<common::PSBTError> FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, const common::PSBTFillOptions& options, int* n_signed = nullptr) const override; |
41 | | }; |
42 | | } // namespace wallet |
43 | | #endif // BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H |