core-lightning/plugins/spender/main.c
Dusty Daemon 7fd16dc493 splice: Add plugin for magic “splice all” command
The command called “splice” can take a json payload or a ‘splice script’, process it into a list of ‘actions’ and then execute those actions.

These actions include or will include everything you would want to do with a splice:
* Splice into a channel
* Splice out of a channel
* Fund from wallet
* Deposit to wallet
* Send funds to bitcoin address

Changelog-Added: A new magic “splice” command is added that can take a ‘splice script’ or json payload and perform any complex splice across multiple channels merging the result into a single transaction. Some features are disabled and will be added in time.
2024-11-12 06:42:52 +10:30

47 lines
1.4 KiB
C

#include "config.h"
#include <plugins/spender/fundchannel.h>
#include <plugins/spender/multifundchannel.h>
#include <plugins/spender/multiwithdraw.h>
#include <plugins/spender/openchannel.h>
#include <plugins/spender/splice.h>
/*~ The spender plugin contains various commands that handle
* spending from the onchain wallet. */
static
const char *spender_init(struct command *init_cmd, const char *b, const jsmntok_t *t)
{
openchannel_init(init_cmd->plugin, b, t);
/* whatever_init(p, b, t); */
return NULL;
}
int main(int argc, char **argv)
{
struct plugin_command *commands;
struct plugin_notification *notifs;
setup_locale();
commands = tal_arr(NULL, struct plugin_command, 0);
tal_expand(&commands, multiwithdraw_commands, num_multiwithdraw_commands);
tal_expand(&commands, fundchannel_commands, num_fundchannel_commands);
tal_expand(&commands, multifundchannel_commands, num_multifundchannel_commands);
tal_expand(&commands, splice_commands, num_splice_commands);
/* tal_expand(&commands, whatever_commands, num_whatever_commands); */
notifs = tal_arr(NULL, struct plugin_notification, 0);
tal_expand(&notifs, openchannel_notifs, num_openchannel_notifs);
plugin_main(argv, &spender_init, NULL, PLUGIN_STATIC, true,
NULL,
take(commands), tal_count(commands),
take(notifs), tal_count(notifs),
NULL, 0,
NULL, 0, /* Notification topics */
NULL);
return 0;
}