| 4 | #include <plugins/bkpr/chain_event.h> |
| 5 | |
| 6 | void json_add_chain_event(struct json_stream *out, struct chain_event *ev) |
| 7 | { |
| 8 | json_object_start(out, NULL); |
| 9 | json_add_string(out, "account", ev->acct_name); |
| 10 | if (ev->origin_acct) |
| 11 | json_add_string(out, "origin", ev->origin_acct); |
| 12 | json_add_string(out, "type", "chain"); |
| 13 | json_add_string(out, "tag", ev->tag); |
| 14 | json_add_amount_msat_only(out, "credit_msat", ev->credit); |
| 15 | json_add_amount_msat_only(out, "debit_msat", ev->debit); |
| 16 | json_add_string(out, "currency", ev->currency); |
| 17 | json_add_outpoint(out, "outpoint", &ev->outpoint); |
| 18 | |
| 19 | if (ev->spending_txid) |
| 20 | json_add_txid(out, "txid", ev->spending_txid); |
| 21 | if (ev->payment_id) |
| 22 | json_add_sha256(out, "payment_id", ev->payment_id); |
| 23 | json_add_u64(out, "timestamp", ev->timestamp); |
| 24 | json_add_u32(out, "blockheight", ev->blockheight); |
| 25 | if (ev->desc) |
| 26 | json_add_string(out, "description", ev->desc); |
| 27 | json_object_end(out); |
| 28 | } |
no test coverage detected