Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added getindexflags RPC command #941

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6167,6 +6167,37 @@ UniValue listnfts(const UniValue& params, bool fHelp)
return ret;
}

UniValue getindexflags(const UniValue& params, bool fHelp)
{
if (fHelp)
throw std::runtime_error(
"getindexflags\n"
"\nShows the values for index flags.\n"

+ HelpExampleCli("getindexflags", "")
);

UniValue ret(UniValue::VOBJ);

// List of flags
std::string indexNames[6] = {
"addressindex",
"nameindex",
"nftindex",
"spentindex",
"timestampindex",
"txindex",
};

for (auto i = 0; i < 6; ++i) {
bool indexValue;
pblocktree->ReadFlag(indexNames[i], indexValue);
ret.pushKV(indexNames[i], indexValue);
}

return ret;
}

UniValue gettoken(const UniValue& params, bool fHelp)
{
if (fHelp)
Expand Down Expand Up @@ -6328,6 +6359,7 @@ static const CRPCCommand commands[] =
{ "wallet", "listtokens", &listtokens, true },
{ "wallet", "listnfts", &listnfts, true },
{ "wallet", "gettoken", &gettoken, true },
{ "wallet", "getindexflags", &getindexflags, false },
{ "wallet", "getnft", &getnft, true },
{ "wallet", "getbalance", &getbalance, false },
{ "wallet", "getnewaddress", &getnewaddress, true },
Expand Down