1 // Copyright (c) 2019-2020 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 
12 class ExternalSignerScriptPubKeyMan : public DescriptorScriptPubKeyMan
13 {
14   public:
15   ExternalSignerScriptPubKeyMan(WalletStorage& storage, WalletDescriptor& descriptor)
SetupDescriptor(std::unique_ptr<Descriptor> desc)16       :   DescriptorScriptPubKeyMan(storage, descriptor)
17       {}
18   ExternalSignerScriptPubKeyMan(WalletStorage& storage)
19       :   DescriptorScriptPubKeyMan(storage)
20       {}
21 
22   /** Provide a descriptor at setup time
23   * Returns false if already setup or setup fails, true if setup is successful
24   */
25   bool SetupDescriptor(std::unique_ptr<Descriptor>desc);
26 
27   static ExternalSigner GetExternalSigner();
28 
29   bool DisplayAddress(const CScript scriptPubKey, const ExternalSigner &signer) const;
30 
31   TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = 1 /* SIGHASH_ALL */, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr) const override;
32 };
33 #endif // BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
34