diff --git a/lightningd/json.c b/lightningd/json.c index 4a9f2b8cb..6a3cc7d76 100644 --- a/lightningd/json.c +++ b/lightningd/json.c @@ -308,6 +308,24 @@ void json_add_u64(struct json_stream *result, const char *fieldname, json_add_member(result, fieldname, "%"PRIu64, value); } +void json_add_s64(struct json_stream *result, const char *fieldname, + int64_t value) +{ + json_add_member(result, fieldname, "%"PRIi64, value); +} + +void json_add_u32(struct json_stream *result, const char *fieldname, + uint32_t value) +{ + json_add_member(result, fieldname, "%d", value); +} + +void json_add_s32(struct json_stream *result, const char *fieldname, + int32_t value) +{ + json_add_member(result, fieldname, "%d", value); +} + void json_add_literal(struct json_stream *result, const char *fieldname, const char *literal, int len) { diff --git a/lightningd/json.h b/lightningd/json.h index 78d47fb22..c30cfd9f6 100644 --- a/lightningd/json.h +++ b/lightningd/json.h @@ -127,6 +127,15 @@ void json_add_num(struct json_stream *result, const char *fieldname, /* '"fieldname" : value' or 'value' if fieldname is NULL */ void json_add_u64(struct json_stream *result, const char *fieldname, uint64_t value); +/* '"fieldname" : value' or 'value' if fieldname is NULL */ +void json_add_s64(struct json_stream *result, const char *fieldname, + int64_t value); +/* '"fieldname" : value' or 'value' if fieldname is NULL */ +void json_add_u32(struct json_stream *result, const char *fieldname, + uint32_t value); +/* '"fieldname" : value' or 'value' if fieldname is NULL */ +void json_add_s32(struct json_stream *result, const char *fieldname, + int32_t value); /* '"fieldname" : true|false' or 'true|false' if fieldname is NULL */ void json_add_bool(struct json_stream *result, const char *fieldname, bool value);