MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_add_recurrence

Function json_add_recurrence

plugins/offers.c:870–903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868}
869
870static void json_add_recurrence(struct json_stream *js,
871 const char *fieldname,
872 const struct recurrence *offer_recurrence,
873 const struct recurrence_paywindow *offer_recurrence_paywindow,
874 const u32 *offer_recurrence_limit,
875 const struct recurrence_base *offer_recurrence_base,
876 bool compulsory)
877{
878 const char *name;
879 json_object_start(js, fieldname);
880 json_add_bool(js, "compulsory_field", compulsory);
881 json_add_num(js, "time_unit", offer_recurrence->time_unit);
882 name = recurrence_time_unit_name(offer_recurrence->time_unit);
883 if (name)
884 json_add_string(js, "time_unit_name", name);
885 json_add_num(js, "period", offer_recurrence->period);
886 if (offer_recurrence_base) {
887 json_add_u64(js, "basetime",
888 offer_recurrence_base->basetime);
889 if (offer_recurrence_base->proportional_amount)
890 json_add_bool(js, "proportional_amount", true);
891 }
892 if (offer_recurrence_limit)
893 json_add_u32(js, "limit", *offer_recurrence_limit);
894 if (offer_recurrence_paywindow) {
895 json_object_start(js, "paywindow");
896 json_add_u32(js, "seconds_before",
897 offer_recurrence_paywindow->seconds_before);
898 json_add_u32(js, "seconds_after",
899 offer_recurrence_paywindow->seconds_after);
900 json_object_end(js);
901 }
902 json_object_end(js);
903}
904
905static bool json_add_offer_fields(struct command *cmd,
906 struct json_stream *js,

Callers 1

json_add_offer_fieldsFunction · 0.85

Calls 8

json_object_startFunction · 0.85
json_add_boolFunction · 0.85
json_add_numFunction · 0.85
json_add_u64Function · 0.85
json_add_u32Function · 0.85
json_object_endFunction · 0.85
json_add_stringFunction · 0.50

Tested by

no test coverage detected