/ src / wallet / external_signer_scriptpubkeyman.h
external_signer_scriptpubkeyman.h
 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    public:
19    ExternalSignerScriptPubKeyMan(WalletStorage& storage, WalletDescriptor& descriptor, int64_t keypool_size)
20        :   DescriptorScriptPubKeyMan(storage, descriptor, keypool_size)
21        {}
22    ExternalSignerScriptPubKeyMan(WalletStorage& storage, int64_t keypool_size)
23        :   DescriptorScriptPubKeyMan(storage, keypool_size)
24        {}
25  
26    /** Provide a descriptor at setup time
27    * Returns false if already setup or setup fails, true if setup is successful
28    */
29    bool SetupDescriptor(WalletBatch& batch, std::unique_ptr<Descriptor>desc);
30  
31    static util::Result<ExternalSigner> GetExternalSigner();
32  
33    /**
34    * Display address on the device and verify that the returned value matches.
35    * @returns nothing or an error message
36    */
37   util::Result<void> DisplayAddress(const CTxDestination& dest, const ExternalSigner& signer) const;
38  
39    std::optional<common::PSBTError> FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, const common::PSBTFillOptions& options, int* n_signed = nullptr) const override;
40  };
41  } // namespace wallet
42  #endif // BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H