Initial Vexta Core v0.1.0 release
This commit is contained in:
commit
25c454329d
2481 changed files with 689289 additions and 0 deletions
66
src/external_signer.h
Normal file
66
src/external_signer.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// Copyright (c) 2018-2021 The DigiByte Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef DIGIBYTE_EXTERNAL_SIGNER_H
|
||||
#define DIGIBYTE_EXTERNAL_SIGNER_H
|
||||
|
||||
#include <univalue.h>
|
||||
#include <util/system.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct PartiallySignedTransaction;
|
||||
|
||||
//! Enables interaction with an external signing device or service, such as
|
||||
//! a hardware wallet. See doc/external-signer.md
|
||||
class ExternalSigner
|
||||
{
|
||||
private:
|
||||
//! The command which handles interaction with the external signer.
|
||||
std::string m_command;
|
||||
|
||||
//! DigiByte mainnet, testnet, etc
|
||||
std::string m_chain;
|
||||
|
||||
const std::string NetworkArg() const;
|
||||
|
||||
public:
|
||||
//! @param[in] command the command which handles interaction with the external signer
|
||||
//! @param[in] fingerprint master key fingerprint of the signer
|
||||
//! @param[in] chain "main", "test", "regtest" or "signet"
|
||||
//! @param[in] name device name
|
||||
ExternalSigner(const std::string& command, const std::string chain, const std::string& fingerprint, const std::string name);
|
||||
|
||||
//! Master key fingerprint of the signer
|
||||
std::string m_fingerprint;
|
||||
|
||||
//! Name of signer
|
||||
std::string m_name;
|
||||
|
||||
//! Obtain a list of signers. Calls `<command> enumerate`.
|
||||
//! @param[in] command the command which handles interaction with the external signer
|
||||
//! @param[in,out] signers vector to which new signers (with a unique master key fingerprint) are added
|
||||
//! @param chain "main", "test", "regtest" or "signet"
|
||||
//! @returns success
|
||||
static bool Enumerate(const std::string& command, std::vector<ExternalSigner>& signers, const std::string chain);
|
||||
|
||||
//! Display address on the device. Calls `<command> displayaddress --desc <descriptor>`.
|
||||
//! @param[in] descriptor Descriptor specifying which address to display.
|
||||
//! Must include a public key or xpub, as well as key origin.
|
||||
UniValue DisplayAddress(const std::string& descriptor) const;
|
||||
|
||||
//! Get receive and change Descriptor(s) from device for a given account.
|
||||
//! Calls `<command> getdescriptors --account <account>`
|
||||
//! @param[in] account which BIP32 account to use (e.g. `m/44'/0'/account'`)
|
||||
//! @returns see doc/external-signer.md
|
||||
UniValue GetDescriptors(const int account);
|
||||
|
||||
//! Sign PartiallySignedTransaction on the device.
|
||||
//! Calls `<command> signtransaction` and passes the PSBT via stdin.
|
||||
//! @param[in,out] psbt PartiallySignedTransaction to be signed
|
||||
bool SignTransaction(PartiallySignedTransaction& psbt, std::string& error);
|
||||
};
|
||||
|
||||
#endif // DIGIBYTE_EXTERNAL_SIGNER_H
|
||||
Loading…
Reference in a new issue