MCPcopy Create free account
hub / github.com/ElementsProject/elements / analyzepsbt

Function analyzepsbt

src/rpc/rawtransaction.cpp:2549–2696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2547#endif
2548
2549static RPCHelpMan analyzepsbt()
2550{
2551 return RPCHelpMan{"analyzepsbt",
2552 "\nAnalyzes and provides information about the current status of a PSBT and its inputs\n",
2553 {
2554 {"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "A base64 string of a PSBT"}
2555 },
2556 RPCResult {
2557 RPCResult::Type::OBJ, "", "",
2558 {
2559 {RPCResult::Type::ARR, "inputs", /*optional=*/true, "",
2560 {
2561 {RPCResult::Type::OBJ, "", "",
2562 {
2563 {RPCResult::Type::BOOL, "has_utxo", "Whether a UTXO is provided"},
2564 {RPCResult::Type::BOOL, "is_final", "Whether the input is finalized"},
2565 {RPCResult::Type::OBJ, "missing", /*optional=*/true, "Things that are missing that are required to complete this input",
2566 {
2567 {RPCResult::Type::ARR, "pubkeys", /*optional=*/true, "",
2568 {
2569 {RPCResult::Type::STR_HEX, "keyid", "Public key ID, hash160 of the public key, of a public key whose BIP 32 derivation path is missing"},
2570 }},
2571 {RPCResult::Type::ARR, "signatures", /*optional=*/true, "",
2572 {
2573 {RPCResult::Type::STR_HEX, "keyid", "Public key ID, hash160 of the public key, of a public key whose signature is missing"},
2574 }},
2575 {RPCResult::Type::STR_HEX, "redeemscript", /*optional=*/true, "Hash160 of the redeemScript that is missing"},
2576 {RPCResult::Type::STR_HEX, "witnessscript", /*optional=*/true, "SHA256 of the witnessScript that is missing"},
2577 }},
2578 {RPCResult::Type::STR, "next", /*optional=*/true, "Role of the next person that this input needs to go to"},
2579 }},
2580 }},
2581 {RPCResult::Type::ARR, "outputs", "",
2582 {
2583 {RPCResult::Type::OBJ, "", "",
2584 {
2585 {RPCResult::Type::BOOL, "blind", "whether the output should be blinded"},
2586 {RPCResult::Type::STR, "status", "to what extent the output has been blinded"},
2587 }},
2588 }},
2589 {RPCResult::Type::NUM, "estimated_vsize", /*optional=*/true, "Estimated vsize of the final signed transaction"},
2590 {RPCResult::Type::STR_AMOUNT, "estimated_feerate", /*optional=*/true, "Estimated feerate of the final signed transaction in " + CURRENCY_UNIT + "/kvB. Shown only if all UTXO slots in the PSBT have been filled"},
2591 {RPCResult::Type::STR_AMOUNT, "fee", /*optional=*/true, "The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled"},
2592 {RPCResult::Type::STR, "next", "Role of the next person that this psbt needs to go to"},
2593 {RPCResult::Type::STR, "error", /*optional=*/true, "Error message (if there is one)"},
2594 }
2595 },
2596 RPCExamples {
2597 HelpExampleCli("analyzepsbt", "\"psbt\"")
2598 },
2599 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
2600{
2601 RPCTypeCheck(request.params, {UniValue::VSTR});
2602
2603 // Unserialize the transaction
2604 PartiallySignedTransaction psbtx;
2605 std::string error;
2606 if (!DecodeBase64PSBT(psbtx, request.params[0].get_str(), error)) {

Callers

nothing calls this directly

Calls 13

HelpExampleCliFunction · 0.85
RPCTypeCheckFunction · 0.85
DecodeBase64PSBTFunction · 0.85
JSONRPCErrorFunction · 0.85
AnalyzePSBTFunction · 0.85
PSBTRoleNameFunction · 0.85
ValueFromAmountFunction · 0.85
GetFeePerKMethod · 0.80
HexStrFunction · 0.50
pushKVMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected