Update C/C++ demos for latest upstream API
[ldk-c-bindings] / lightning-c-bindings / demo.c
index a9556303fa3d1a0e826fbcff69625a38f8124b03..be8e674c2fbf9e56d94f2906cfec85ef0e08a241 100644 (file)
@@ -4,8 +4,12 @@
 #include <stdio.h>
 #include <string.h>
 
-void print_log(const void *this_arg, const char *record) {
-       printf("%s", record);
+void print_log(const void *this_arg, const LDKRecord *record) {
+       LDKStr mod = Record_get_module_path(record);
+       LDKStr str = Record_get_args(record);
+       printf("%.*s:%d - %.*s\n", (int)mod.len, mod.chars, Record_get_line(record), (int)str.len, str.chars);
+       Str_free(str);
+       Str_free(mod);
 }
 
 uint32_t get_fee(const void *this_arg, LDKConfirmationTarget target) {
@@ -21,21 +25,21 @@ void broadcast_tx(const void *this_arg, LDKTransaction tx) {
        Transaction_free(tx);
 }
 
-LDKCResult_NoneChannelMonitorUpdateErrZ add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
-       return CResult_NoneChannelMonitorUpdateErrZ_ok();
+LDKChannelMonitorUpdateStatus add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
+       return ChannelMonitorUpdateStatus_completed();
 }
-LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate monitor) {
-       return CResult_NoneChannelMonitorUpdateErrZ_ok();
+LDKChannelMonitorUpdateStatus update_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate monitor) {
+       return ChannelMonitorUpdateStatus_completed();
 }
-LDKCVec_MonitorEventZ monitors_pending_monitor_events(const void *this_arg) {
-       LDKCVec_MonitorEventZ empty_htlc_vec = {
+LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ monitors_pending_monitor_events(const void *this_arg) {
+       LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ empty_htlc_vec = {
                .data = NULL,
                .datalen = 0,
        };
        return empty_htlc_vec;
 }
 
-void never_handle_event(const void *this_arg, struct LDKEvent event) {
+void never_handle_event(const void *this_arg, const struct LDKEvent* event) {
        // Note that we never actually generate any events to handle in the code below.
        assert(false);
 }