Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show First 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
"", | "", | ||||
"", | "", | ||||
{ | { | ||||
{RPCResult::Type::NUM, "sequence", | {RPCResult::Type::NUM, "sequence", | ||||
"The proof's sequential number"}, | "The proof's sequential number"}, | ||||
{RPCResult::Type::NUM, "expiration", | {RPCResult::Type::NUM, "expiration", | ||||
"A timestamp indicating when the proof expires"}, | "A timestamp indicating when the proof expires"}, | ||||
{RPCResult::Type::STR_HEX, "master", "The master public key"}, | {RPCResult::Type::STR_HEX, "master", "The master public key"}, | ||||
{RPCResult::Type::STR_HEX, "limitedid", | |||||
"A hash of the proof data excluding the master key."}, | |||||
{RPCResult::Type::STR_HEX, "proofid", | {RPCResult::Type::STR_HEX, "proofid", | ||||
"The proof's unique identifier"}, | "A hash of the limitedid and master key."}, | ||||
{RPCResult::Type::ARR, | {RPCResult::Type::ARR, | ||||
"stakes", | "stakes", | ||||
"", | "", | ||||
{ | { | ||||
{RPCResult::Type::OBJ, | {RPCResult::Type::OBJ, | ||||
"", | "", | ||||
"", | "", | ||||
{ | { | ||||
Show All 26 Lines | static UniValue decodeavalancheproof(const Config &config, | ||||
if (!avalanche::Proof::FromHex(proof, request.params[0].get_str(), error)) { | if (!avalanche::Proof::FromHex(proof, request.params[0].get_str(), error)) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, error.original); | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, error.original); | ||||
} | } | ||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
result.pushKV("sequence", proof.getSequence()); | result.pushKV("sequence", proof.getSequence()); | ||||
result.pushKV("expiration", proof.getExpirationTime()); | result.pushKV("expiration", proof.getExpirationTime()); | ||||
result.pushKV("master", HexStr(proof.getMaster())); | result.pushKV("master", HexStr(proof.getMaster())); | ||||
result.pushKV("limitedid", proof.getLimitedId().ToString()); | |||||
result.pushKV("proofid", proof.getId().ToString()); | result.pushKV("proofid", proof.getId().ToString()); | ||||
UniValue stakes(UniValue::VARR); | UniValue stakes(UniValue::VARR); | ||||
for (const avalanche::SignedStake &s : proof.getStakes()) { | for (const avalanche::SignedStake &s : proof.getStakes()) { | ||||
const COutPoint &utxo = s.getStake().getUTXO(); | const COutPoint &utxo = s.getStake().getUTXO(); | ||||
UniValue stake(UniValue::VOBJ); | UniValue stake(UniValue::VOBJ); | ||||
stake.pushKV("txid", utxo.GetTxId().ToString()); | stake.pushKV("txid", utxo.GetTxId().ToString()); | ||||
stake.pushKV("vout", uint64_t(utxo.GetN())); | stake.pushKV("vout", uint64_t(utxo.GetN())); | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |