2015-12-13 14:51:43 +01:00
|
|
|
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
2014-12-13 05:09:33 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2014-08-01 08:39:06 +02:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#ifndef BITCOIN_CORE_IO_H
|
|
|
|
#define BITCOIN_CORE_IO_H
|
2014-06-24 05:10:24 +02:00
|
|
|
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <amount.h>
|
2021-03-22 18:10:27 +01:00
|
|
|
#include <attributes.h>
|
2017-08-08 11:27:15 +02:00
|
|
|
|
2014-06-24 05:10:24 +02:00
|
|
|
#include <string>
|
2014-08-01 08:32:41 +02:00
|
|
|
#include <vector>
|
2014-06-24 05:10:24 +02:00
|
|
|
|
2014-10-30 03:56:33 +01:00
|
|
|
class CBlock;
|
2014-06-24 05:16:33 +02:00
|
|
|
class CScript;
|
2014-06-24 05:10:24 +02:00
|
|
|
class CTransaction;
|
2016-12-05 12:54:21 +01:00
|
|
|
struct CMutableTransaction;
|
2021-07-13 18:30:17 +02:00
|
|
|
struct PartiallySignedTransaction;
|
2014-09-14 12:43:56 +02:00
|
|
|
class uint256;
|
2014-07-29 17:12:44 +02:00
|
|
|
class UniValue;
|
2014-06-24 05:10:24 +02:00
|
|
|
|
2019-06-11 13:42:17 +02:00
|
|
|
struct CSpentIndexTxInfo;
|
|
|
|
|
2014-06-24 05:10:24 +02:00
|
|
|
// core_read.cpp
|
2016-12-01 01:15:15 +01:00
|
|
|
CScript ParseScript(const std::string& s);
|
|
|
|
std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
|
2021-06-16 10:01:16 +02:00
|
|
|
[[nodiscard]] bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx);
|
|
|
|
[[nodiscard]] bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
|
2016-12-01 01:15:15 +01:00
|
|
|
uint256 ParseHashStr(const std::string&, const std::string& strName);
|
|
|
|
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
|
2021-07-13 18:30:17 +02:00
|
|
|
bool DecodePSBT(PartiallySignedTransaction& psbt, const std::string& base64_tx, std::string& error);
|
|
|
|
int ParseSighashString(const UniValue& sighash);
|
2014-06-24 05:10:24 +02:00
|
|
|
|
|
|
|
// core_write.cpp
|
2017-08-08 11:27:15 +02:00
|
|
|
UniValue ValueFromAmount(const CAmount& amount);
|
2016-12-01 01:15:15 +01:00
|
|
|
std::string FormatScript(const CScript& script);
|
|
|
|
std::string EncodeHexTx(const CTransaction& tx);
|
2021-07-13 18:30:17 +02:00
|
|
|
std::string SighashToStr(unsigned char sighash_type);
|
2016-12-01 01:15:15 +01:00
|
|
|
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
|
2021-07-13 18:30:17 +02:00
|
|
|
void ScriptToUniv(const CScript& script, UniValue& out, bool include_address);
|
2020-01-22 11:36:22 +01:00
|
|
|
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, const CSpentIndexTxInfo* ptxSpentInfo = nullptr);
|
2014-06-24 05:10:24 +02:00
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#endif // BITCOIN_CORE_IO_H
|