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

Function json_add_chain_event

plugins/bkpr/chain_event.c:8–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <plugins/bkpr/descriptions.h>
7
8void json_add_chain_event(struct json_stream *out,
9 const struct bkpr *bkpr,
10 struct chain_event *ev)
11{
12 const char *desc;
13 json_object_start(out, NULL);
14 json_add_string(out, "account", ev->acct_name);
15 if (ev->origin_acct)
16 json_add_string(out, "origin", ev->origin_acct);
17 json_add_string(out, "type", "chain");
18 json_add_string(out, "tag", ev->tag);
19 json_add_amount_msat(out, "credit_msat", ev->credit);
20 json_add_amount_msat(out, "debit_msat", ev->debit);
21 json_add_string(out, "currency", chainparams->lightning_hrp);
22 json_add_currencyrate(out, "currencyrate", bkpr, ev->timestamp);
23 json_add_outpoint(out, "outpoint", &ev->outpoint);
24 desc = chain_event_description(bkpr, ev);
25
26 if (ev->spending_txid)
27 json_add_txid(out, "txid", ev->spending_txid);
28 if (ev->payment_id) {
29 json_add_sha256(out, "payment_id", ev->payment_id);
30 }
31 json_add_u64(out, "timestamp", ev->timestamp);
32 json_add_u32(out, "blockheight", ev->blockheight);
33 if (desc)
34 json_add_string(out, "description", desc);
35 json_object_end(out);
36}

Callers 1

json_add_eventsFunction · 0.70

Calls 11

json_object_startFunction · 0.85
json_add_amount_msatFunction · 0.85
json_add_outpointFunction · 0.85
json_add_txidFunction · 0.85
json_add_sha256Function · 0.85
json_add_u64Function · 0.85
json_add_u32Function · 0.85
json_object_endFunction · 0.85
json_add_currencyrateFunction · 0.70
chain_event_descriptionFunction · 0.70
json_add_stringFunction · 0.50

Tested by

no test coverage detected