core_io.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright (c) 2009-2018 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. #ifndef BITCOIN_CORE_IO_H
  5. #define BITCOIN_CORE_IO_H
  6. #include <amount.h>
  7. #include <string>
  8. #include <vector>
  9. class CBlock;
  10. class CScript;
  11. class CTransaction;
  12. struct CMutableTransaction;
  13. struct PartiallySignedTransaction;
  14. class uint256;
  15. class UniValue;
  16. // core_read.cpp
  17. CScript ParseScript(const std::string& s);
  18. std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
  19. bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness = false, bool try_witness = true);
  20. bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
  21. uint256 ParseHashStr(const std::string&, const std::string& strName);
  22. std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
  23. bool DecodePSBT(PartiallySignedTransaction& psbt, const std::string& base64_tx, std::string& error);
  24. int ParseSighashString(const UniValue& sighash);
  25. // core_write.cpp
  26. UniValue ValueFromAmount(const CAmount& amount);
  27. std::string FormatScript(const CScript& script);
  28. std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0);
  29. std::string SighashToStr(unsigned char sighash_type);
  30. void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
  31. void ScriptToUniv(const CScript& script, UniValue& out, bool include_address);
  32. void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0);
  33. #endif // BITCOIN_CORE_IO_H