#ifndef LIGHTNING_PLUGINS_BKPR_ONCHAIN_FEE_H
#define LIGHTNING_PLUGINS_BKPR_ONCHAIN_FEE_H
#include "config.h"
#include <bitcoin/tx.h>
#include <ccan/short_types/short_types.h>
#include <plugins/bkpr/bookkeeper.h>
struct account;
struct amount_msat;
struct bitcoin_txid;
struct db;
struct onchain_fees;
struct onchain_fee {
const char *acct_name;
struct bitcoin_txid txid;
struct amount_msat credit;
struct amount_msat debit;
u64 timestamp;
u32 update_count;
};
void json_add_onchain_fee(struct json_stream *out,
const struct bkpr *bkpr,
const struct onchain_fee *fee);
struct onchain_fee **list_chain_fees(const tal_t *ctx, const struct bkpr *bkpr);
struct onchain_fee **list_chain_fees_timebox(const tal_t *ctx,
const struct bkpr *bkpr,
u64 start_time, u64 end_time);
struct onchain_fee **get_chain_fees_by_txid(const tal_t *ctx,
const struct bkpr *bkpr,
const struct bitcoin_txid *txid);
struct onchain_fee **account_get_chain_fees(const tal_t *ctx,
const struct bkpr *bkpr,
const char *acct_name);
struct fee_sum **find_account_onchain_fees(const tal_t *ctx,
const struct bkpr *bkpr,
const struct account *acct);
struct fee_sum **calculate_onchain_fee_sums(const tal_t *ctx,
const struct bkpr *bkpr,
u64 start_time,
u64 end_time);
char *maybe_update_onchain_fees(const tal_t *ctx,
struct command *cmd,
struct bkpr *bkpr,
struct bitcoin_txid *txid);
char *update_channel_onchain_fees(const tal_t *ctx,
struct command *cmd,
struct bkpr *bkpr,
struct account *acct);
struct onchain_fees *init_onchain_fees(const tal_t *ctx,
struct command *init_cmd);
#endif