| 6 | #include <plugins/bkpr/descriptions.h> |
| 7 | |
| 8 | void 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 | } |
no test coverage detected