external_signer_scriptpubkeyman.h raw

   1  // Copyright (c) 2019-2021 The Limenka 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 LIMENKA_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
   6  #define LIMENKA_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 ExternalSigner GetExternalSigner();
  32    static util::Result<ExternalSigner> GetExternalSigner2();
  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, int sighash_type = 1 /* SIGHASH_ALL */, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const override;
  41  };
  42  } // namespace wallet
  43  #endif // LIMENKA_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
  44