mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
jsonrpc: Add a category field to commands.
A new string field is added to the command structure and is specified at the creation of each native command, and in the JSON created by 'json_add_help_command()'.
This commit is contained in:
@@ -527,6 +527,7 @@ static struct command_result *json_feerates(struct command *cmd,
|
||||
|
||||
static const struct json_command feerates_command = {
|
||||
"feerates",
|
||||
"bitcoin",
|
||||
json_feerates,
|
||||
"Return feerate estimates, either satoshi-per-kw ({style} perkw) or satoshi-per-kb ({style} perkb)."
|
||||
};
|
||||
|
||||
@@ -175,6 +175,7 @@ static struct command_result *json_connect(struct command *cmd,
|
||||
|
||||
static const struct json_command connect_command = {
|
||||
"connect",
|
||||
"network",
|
||||
json_connect,
|
||||
"Connect to {id} at {host} (which can end in ':port' if not default). "
|
||||
"{id} can also be of the form id@host"
|
||||
|
||||
@@ -253,6 +253,7 @@ static struct command_result *json_listnodes(struct command *cmd,
|
||||
|
||||
static const struct json_command listnodes_command = {
|
||||
"listnodes",
|
||||
"network",
|
||||
json_listnodes,
|
||||
"Show node {id} (or all, if no {id}), in our local network view"
|
||||
};
|
||||
@@ -352,6 +353,7 @@ static struct command_result *json_getroute(struct command *cmd,
|
||||
|
||||
static const struct json_command getroute_command = {
|
||||
"getroute",
|
||||
"channels",
|
||||
json_getroute,
|
||||
"Show route to {id} for {msatoshi}, using {riskfactor} and optional {cltv} (default 9). "
|
||||
"If specified search from {fromid} otherwise use this node as source. "
|
||||
@@ -471,6 +473,7 @@ static struct command_result *json_listchannels(struct command *cmd,
|
||||
|
||||
static const struct json_command listchannels_command = {
|
||||
"listchannels",
|
||||
"channels",
|
||||
json_listchannels,
|
||||
"Show channel {short_channel_id} or {source} (or all known channels, if not specified)"
|
||||
};
|
||||
@@ -540,6 +543,7 @@ static struct command_result *json_dev_query_scids(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_query_scids_command = {
|
||||
"dev-query-scids",
|
||||
"developer",
|
||||
json_dev_query_scids,
|
||||
"Query peer {id} for [scids]"
|
||||
};
|
||||
@@ -572,6 +576,7 @@ json_dev_send_timestamp_filter(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_send_timestamp_filter = {
|
||||
"dev-send-timestamp-filter",
|
||||
"developer",
|
||||
json_dev_send_timestamp_filter,
|
||||
"Send peer {id} the timestamp filter {first} {range}"
|
||||
};
|
||||
@@ -641,6 +646,7 @@ static struct command_result *json_dev_query_channel_range(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_query_channel_range_command = {
|
||||
"dev-query-channel-range",
|
||||
"developer",
|
||||
json_dev_query_channel_range,
|
||||
"Query peer {id} for short_channel_ids for {first} block + {num} blocks"
|
||||
};
|
||||
@@ -668,6 +674,7 @@ json_dev_set_max_scids_encode_size(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_set_max_scids_encode_size = {
|
||||
"dev-set-max-scids-encode-size",
|
||||
"developer",
|
||||
json_dev_set_max_scids_encode_size,
|
||||
"Set {max} bytes of short_channel_ids per reply_channel_range"
|
||||
};
|
||||
@@ -688,6 +695,7 @@ static struct command_result *json_dev_suppress_gossip(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_suppress_gossip = {
|
||||
"dev-suppress-gossip",
|
||||
"developer",
|
||||
json_dev_suppress_gossip,
|
||||
"Stop this node from sending any more gossip."
|
||||
};
|
||||
@@ -730,6 +738,7 @@ static struct command_result *json_dev_compact_gossip_store(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_compact_gossip_store = {
|
||||
"dev-compact-gossip-store",
|
||||
"developer",
|
||||
json_dev_compact_gossip_store,
|
||||
"Ask gossipd to rewrite the gossip store."
|
||||
};
|
||||
|
||||
@@ -786,11 +786,14 @@ static struct command_result *json_invoice(struct command *cmd,
|
||||
}
|
||||
|
||||
static const struct json_command invoice_command = {
|
||||
"invoice", json_invoice, "Create an invoice for {msatoshi} with {label} "
|
||||
"and {description} with optional {expiry} seconds "
|
||||
"(default 1 hour), optional {fallbacks} address list"
|
||||
"(default empty list) and optional {preimage} "
|
||||
"(default autogenerated)"};
|
||||
"invoice",
|
||||
"payment",
|
||||
json_invoice,
|
||||
"Create an invoice for {msatoshi} with {label} "
|
||||
"and {description} with optional {expiry} seconds "
|
||||
"(default 1 hour), optional {fallbacks} address list"
|
||||
"(default empty list) and optional {preimage} "
|
||||
"(default autogenerated)"};
|
||||
AUTODATA(json_command, &invoice_command);
|
||||
|
||||
static void json_add_invoices(struct json_stream *response,
|
||||
@@ -840,6 +843,7 @@ static struct command_result *json_listinvoices(struct command *cmd,
|
||||
|
||||
static const struct json_command listinvoices_command = {
|
||||
"listinvoices",
|
||||
"payment",
|
||||
json_listinvoices,
|
||||
"Show invoice {label} (or all, if no {label})"
|
||||
};
|
||||
@@ -892,6 +896,7 @@ static struct command_result *json_delinvoice(struct command *cmd,
|
||||
|
||||
static const struct json_command delinvoice_command = {
|
||||
"delinvoice",
|
||||
"payment",
|
||||
json_delinvoice,
|
||||
"Delete unpaid invoice {label} with {status}",
|
||||
};
|
||||
@@ -916,6 +921,7 @@ static struct command_result *json_delexpiredinvoice(struct command *cmd,
|
||||
}
|
||||
static const struct json_command delexpiredinvoice_command = {
|
||||
"delexpiredinvoice",
|
||||
"payment",
|
||||
json_delexpiredinvoice,
|
||||
"Delete all expired invoices that expired as of given {maxexpirytime} (a UNIX epoch time), or all expired invoices if not specified"
|
||||
};
|
||||
@@ -951,6 +957,7 @@ static struct command_result *json_waitanyinvoice(struct command *cmd,
|
||||
|
||||
static const struct json_command waitanyinvoice_command = {
|
||||
"waitanyinvoice",
|
||||
"payment",
|
||||
json_waitanyinvoice,
|
||||
"Wait for the next invoice to be paid, after {lastpay_index} (if supplied)"
|
||||
};
|
||||
@@ -997,6 +1004,7 @@ static struct command_result *json_waitinvoice(struct command *cmd,
|
||||
|
||||
static const struct json_command waitinvoice_command = {
|
||||
"waitinvoice",
|
||||
"payment",
|
||||
json_waitinvoice,
|
||||
"Wait for an incoming payment matching the invoice with {label}, or if the invoice expires"
|
||||
};
|
||||
@@ -1148,6 +1156,7 @@ static struct command_result *json_decodepay(struct command *cmd,
|
||||
|
||||
static const struct json_command decodepay_command = {
|
||||
"decodepay",
|
||||
"payment",
|
||||
json_decodepay,
|
||||
"Decode {bolt11}, using {description} if necessary"
|
||||
};
|
||||
|
||||
@@ -165,9 +165,9 @@ static struct command_result *json_help(struct command *cmd,
|
||||
|
||||
static const struct json_command help_command = {
|
||||
"help",
|
||||
"utility",
|
||||
json_help,
|
||||
"List available commands, or give verbose help on one {command}.",
|
||||
|
||||
.verbose = "help [command]\n"
|
||||
"Without [command]:\n"
|
||||
" Outputs an array of objects with 'command' and 'description'\n"
|
||||
@@ -196,6 +196,7 @@ static struct command_result *json_stop(struct command *cmd,
|
||||
|
||||
static const struct json_command stop_command = {
|
||||
"stop",
|
||||
"utility",
|
||||
json_stop,
|
||||
"Shut down the lightningd process"
|
||||
};
|
||||
@@ -226,6 +227,7 @@ static struct command_result *json_rhash(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_rhash_command = {
|
||||
"dev-rhash",
|
||||
"developer",
|
||||
json_rhash,
|
||||
"Show SHA256 of {secret}"
|
||||
};
|
||||
@@ -271,6 +273,7 @@ static struct command_result *json_slowcmd(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_slowcmd_command = {
|
||||
"dev-slowcmd",
|
||||
"developer",
|
||||
json_slowcmd,
|
||||
"Torture test for slow commands, optional {msec}"
|
||||
};
|
||||
@@ -289,6 +292,7 @@ static struct command_result *json_crash(struct command *cmd UNUSED,
|
||||
|
||||
static const struct json_command dev_crash_command = {
|
||||
"dev-crash",
|
||||
"developer",
|
||||
json_crash,
|
||||
"Crash lightningd by calling fatal()"
|
||||
};
|
||||
@@ -319,6 +323,7 @@ static void json_add_help_command(struct command *cmd,
|
||||
json_object_start(response, NULL);
|
||||
|
||||
json_add_string(response, "command", usage);
|
||||
json_add_string(response, "category", json_command->category);
|
||||
json_add_string(response, "description", json_command->description);
|
||||
|
||||
if (!json_command->verbose) {
|
||||
@@ -1172,6 +1177,7 @@ static struct command_result *json_check(struct command *cmd,
|
||||
|
||||
static const struct json_command check_command = {
|
||||
"check",
|
||||
"utility",
|
||||
json_check,
|
||||
"Don't run {command_to_check}, just verify parameters.",
|
||||
.verbose = "check command_to_check [parameters...]\n"
|
||||
|
||||
@@ -49,6 +49,7 @@ struct command_result;
|
||||
|
||||
struct json_command {
|
||||
const char *name;
|
||||
const char *category;
|
||||
struct command_result *(*dispatch)(struct command *,
|
||||
const char *buffer,
|
||||
const jsmntok_t *obj,
|
||||
|
||||
@@ -779,6 +779,7 @@ static struct command_result *json_getlog(struct command *cmd,
|
||||
|
||||
static const struct json_command getlog_command = {
|
||||
"getlog",
|
||||
"utility",
|
||||
json_getlog,
|
||||
"Show logs, with optional log {level} (info|unusual|debug|io)"
|
||||
};
|
||||
|
||||
@@ -81,6 +81,7 @@ static struct command_result *json_memdump(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_memdump_command = {
|
||||
"dev-memdump",
|
||||
"developer",
|
||||
json_memdump,
|
||||
"Show memory objects currently in use"
|
||||
};
|
||||
@@ -327,6 +328,7 @@ static struct command_result *json_memleak(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_memleak_command = {
|
||||
"dev-memleak",
|
||||
"developer",
|
||||
json_memleak,
|
||||
"Show unreferenced memory objects"
|
||||
};
|
||||
|
||||
@@ -1086,9 +1086,11 @@ static struct command_result *json_fund_channel(struct command *cmd,
|
||||
}
|
||||
|
||||
static const struct json_command fund_channel_command = {
|
||||
"fundchannel", json_fund_channel,
|
||||
"Fund channel with {id} using {satoshi} (or 'all') satoshis, at optional "
|
||||
"{feerate}. Only use outputs that have {minconf} confirmations."
|
||||
"fundchannel",
|
||||
"channels",
|
||||
json_fund_channel,
|
||||
"Fund channel with {id} using {satoshi} (or 'all') satoshis, at optional "
|
||||
"{feerate}. Only use outputs that have {minconf} confirmations."
|
||||
};
|
||||
AUTODATA(json_command, &fund_channel_command);
|
||||
|
||||
|
||||
@@ -1112,9 +1112,9 @@ static struct command_result *json_listconfigs(struct command *cmd,
|
||||
|
||||
static const struct json_command listconfigs_command = {
|
||||
"listconfigs",
|
||||
"utility",
|
||||
json_listconfigs,
|
||||
"List all configuration options, or with [config], just that one.",
|
||||
|
||||
.verbose = "listconfigs [config]\n"
|
||||
"Outputs an object, with each field a config options\n"
|
||||
"(Option names which start with # are comments)\n"
|
||||
|
||||
@@ -894,6 +894,7 @@ static struct command_result *json_sendpay(struct command *cmd,
|
||||
|
||||
static const struct json_command sendpay_command = {
|
||||
"sendpay",
|
||||
"payment",
|
||||
json_sendpay,
|
||||
"Send along {route} in return for preimage of {payment_hash}"
|
||||
};
|
||||
@@ -932,6 +933,7 @@ static struct command_result *json_waitsendpay(struct command *cmd,
|
||||
|
||||
static const struct json_command waitsendpay_command = {
|
||||
"waitsendpay",
|
||||
"payment",
|
||||
json_waitsendpay,
|
||||
"Wait for payment attempt on {payment_hash} to succeed or fail, "
|
||||
"but only up to {timeout} seconds."
|
||||
@@ -991,6 +993,7 @@ static struct command_result *json_listsendpays(struct command *cmd,
|
||||
|
||||
static const struct json_command listpayments_command = {
|
||||
"listpayments",
|
||||
"payment",
|
||||
json_listsendpays,
|
||||
"Show outgoing payments",
|
||||
true /* deprecated, use new name */
|
||||
@@ -999,6 +1002,7 @@ AUTODATA(json_command, &listpayments_command);
|
||||
|
||||
static const struct json_command listsendpays_command = {
|
||||
"listsendpays",
|
||||
"payment",
|
||||
json_listsendpays,
|
||||
"Show sendpay, old and current, optionally limiting to {bolt11} or {payment_hash}."
|
||||
};
|
||||
|
||||
@@ -1007,6 +1007,7 @@ static struct command_result *json_listpeers(struct command *cmd,
|
||||
|
||||
static const struct json_command listpeers_command = {
|
||||
"listpeers",
|
||||
"network",
|
||||
json_listpeers,
|
||||
"Show current peers, if {level} is set, include logs for {id}"
|
||||
};
|
||||
@@ -1137,6 +1138,7 @@ static struct command_result *json_close(struct command *cmd,
|
||||
|
||||
static const struct json_command close_command = {
|
||||
"close",
|
||||
"channels",
|
||||
json_close,
|
||||
"Close the channel with {id} "
|
||||
"(either peer ID, channel ID, or short channel ID). "
|
||||
@@ -1244,6 +1246,7 @@ static struct command_result *json_disconnect(struct command *cmd,
|
||||
|
||||
static const struct json_command disconnect_command = {
|
||||
"disconnect",
|
||||
"network",
|
||||
json_disconnect,
|
||||
"Disconnect from {id} that has previously been connected to using connect; with {force} set, even if it has a current channel"
|
||||
};
|
||||
@@ -1316,6 +1319,7 @@ static struct command_result *json_getinfo(struct command *cmd,
|
||||
|
||||
static const struct json_command getinfo_command = {
|
||||
"getinfo",
|
||||
"utility",
|
||||
json_getinfo,
|
||||
"Show information about this node"
|
||||
};
|
||||
@@ -1472,6 +1476,7 @@ static struct command_result *json_setchannelfee(struct command *cmd,
|
||||
|
||||
static const struct json_command setchannelfee_command = {
|
||||
"setchannelfee",
|
||||
"channels",
|
||||
json_setchannelfee,
|
||||
"Sets specific routing fees for channel with {id} "
|
||||
"(either peer ID, channel ID, short channel ID or 'all'). "
|
||||
@@ -1526,6 +1531,7 @@ static struct command_result *json_sign_last_tx(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_sign_last_tx = {
|
||||
"dev-sign-last-tx",
|
||||
"developer",
|
||||
json_sign_last_tx,
|
||||
"Sign and show the last commitment transaction with peer {id}"
|
||||
};
|
||||
@@ -1563,6 +1569,7 @@ static struct command_result *json_dev_fail(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_fail_command = {
|
||||
"dev-fail",
|
||||
"developer",
|
||||
json_dev_fail,
|
||||
"Fail with peer {id}"
|
||||
};
|
||||
@@ -1620,6 +1627,7 @@ static struct command_result *json_dev_reenable_commit(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_reenable_commit = {
|
||||
"dev-reenable-commit",
|
||||
"developer",
|
||||
json_dev_reenable_commit,
|
||||
"Re-enable the commit timer on peer {id}"
|
||||
};
|
||||
@@ -1728,7 +1736,9 @@ static struct command_result *json_dev_forget_channel(struct command *cmd,
|
||||
}
|
||||
|
||||
static const struct json_command dev_forget_channel_command = {
|
||||
"dev-forget-channel", json_dev_forget_channel,
|
||||
"dev-forget-channel",
|
||||
"developer",
|
||||
json_dev_forget_channel,
|
||||
"Forget the channel with peer {id}, ignore UTXO check with {force}='true'.", false,
|
||||
"Forget the channel with peer {id}. Checks if the channel is still active by checking its funding transaction. Check can be ignored by setting {force} to 'true'"
|
||||
};
|
||||
|
||||
@@ -1885,7 +1885,9 @@ static struct command_result *json_dev_ignore_htlcs(struct command *cmd,
|
||||
}
|
||||
|
||||
static const struct json_command dev_ignore_htlcs = {
|
||||
"dev-ignore-htlcs", json_dev_ignore_htlcs,
|
||||
"dev-ignore-htlcs",
|
||||
"developer",
|
||||
json_dev_ignore_htlcs,
|
||||
"Set ignoring incoming HTLCs for peer {id} to {ignore}", false,
|
||||
"Set/unset ignoring of all incoming HTLCs. For testing only."
|
||||
};
|
||||
@@ -1960,7 +1962,9 @@ static struct command_result *json_listforwards(struct command *cmd,
|
||||
}
|
||||
|
||||
static const struct json_command listforwards_command = {
|
||||
"listforwards", json_listforwards,
|
||||
"listforwards",
|
||||
"channels",
|
||||
json_listforwards,
|
||||
"List all forwarded payments and their information", false,
|
||||
"List all forwarded payments and their information"
|
||||
};
|
||||
|
||||
@@ -132,6 +132,7 @@ static struct command_result *json_ping(struct command *cmd,
|
||||
|
||||
static const struct json_command ping_command = {
|
||||
"ping",
|
||||
"network",
|
||||
json_ping,
|
||||
"Send peer {id} a ping of length {len} (default 128) asking for {pongbytes} (default 128)"
|
||||
};
|
||||
|
||||
@@ -184,14 +184,16 @@ static struct command_result *json_withdraw(struct command *cmd,
|
||||
}
|
||||
|
||||
static const struct json_command withdraw_command = {
|
||||
"withdraw", json_withdraw,
|
||||
"Send to {destination} address {satoshi} (or 'all') amount via Bitcoin "
|
||||
"transaction, at optional {feerate}",
|
||||
false,
|
||||
"Send funds from the internal wallet to the specified address. Either "
|
||||
"specify a number of satoshis to send or 'all' to sweep all funds in the "
|
||||
"internal wallet to the address. Only use outputs that have at least "
|
||||
"{minconf} confirmations."
|
||||
"withdraw",
|
||||
"bitcoin",
|
||||
json_withdraw,
|
||||
"Send to {destination} address {satoshi} (or 'all') amount via Bitcoin "
|
||||
"transaction, at optional {feerate}",
|
||||
false,
|
||||
"Send funds from the internal wallet to the specified address. Either "
|
||||
"specify a number of satoshis to send or 'all' to sweep all funds in the "
|
||||
"internal wallet to the address. Only use outputs that have at least "
|
||||
"{minconf} confirmations."
|
||||
};
|
||||
AUTODATA(json_command, &withdraw_command);
|
||||
|
||||
@@ -349,6 +351,7 @@ static struct command_result *json_newaddr(struct command *cmd,
|
||||
|
||||
static const struct json_command newaddr_command = {
|
||||
"newaddr",
|
||||
"bitcoin",
|
||||
json_newaddr,
|
||||
"Get a new {bech32, p2sh-segwit} (or all) address to fund a channel (default is bech32)", false,
|
||||
"Generates a new address (or both) that belongs to the internal wallet. Funds sent to these addresses will be managed by lightningd. Use `withdraw` to withdraw funds to an external wallet."
|
||||
@@ -431,6 +434,7 @@ static struct command_result *json_listaddrs(struct command *cmd,
|
||||
|
||||
static const struct json_command listaddrs_command = {
|
||||
"dev-listaddrs",
|
||||
"developer",
|
||||
json_listaddrs,
|
||||
"Show addresses list up to derivation {index} (default is the last bip32 index)",
|
||||
false,
|
||||
@@ -526,6 +530,7 @@ static struct command_result *json_listfunds(struct command *cmd,
|
||||
|
||||
static const struct json_command listfunds_command = {
|
||||
"listfunds",
|
||||
"utility",
|
||||
json_listfunds,
|
||||
"Show available funds from the internal wallet",
|
||||
false,
|
||||
@@ -604,6 +609,7 @@ static struct command_result *json_dev_rescan_outputs(struct command *cmd,
|
||||
|
||||
static const struct json_command dev_rescan_output_command = {
|
||||
"dev-rescan-outputs",
|
||||
"developer",
|
||||
json_dev_rescan_outputs,
|
||||
"Synchronize the state of our funds with bitcoind",
|
||||
false,
|
||||
|
||||
Reference in New Issue
Block a user