diff options
| author | Your Name <you@example.com> | 2026-05-17 04:50:07 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-17 04:50:07 +0530 |
| commit | edd125d0e3fe5fe7c0edf30c429723f3b0120c68 (patch) | |
| tree | 5b1134ad7a6cfce7adeb46f5069e33b509ce9751 /main/cashu.h | |
| parent | cb4bd7d7c10cadcb43f82c09b13ffed744e541f7 (diff) | |
feat(phase6): bytes-based billing - dual metric support
- session_create_bytes() + session_add_bytes() for bytes-metric sessions
- session_is_expired() dispatches on config metric (bytes vs milliseconds)
- cashu_calculate_allotment() unified dispatcher for both metrics
- tollgate_api discovery/usage/session_event use configured metric
- config: metric field defaults to 'bytes', step_size_bytes=22020096 (21MB)
- 14 new unit tests (148 total passing)
- ASSERT_EQ_UINT64 macro added to test framework
Diffstat (limited to 'main/cashu.h')
| -rw-r--r-- | main/cashu.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/main/cashu.h b/main/cashu.h index 4c3d43b..76ad2eb 100644 --- a/main/cashu.h +++ b/main/cashu.h | |||
| @@ -37,6 +37,9 @@ esp_err_t cashu_check_proof_states(const char *mint_url, const cashu_token_t *to | |||
| 37 | uint64_t cashu_calculate_allotment_ms(uint64_t token_amount, uint64_t price_per_step, | 37 | uint64_t cashu_calculate_allotment_ms(uint64_t token_amount, uint64_t price_per_step, |
| 38 | uint64_t step_size_ms); | 38 | uint64_t step_size_ms); |
| 39 | 39 | ||
| 40 | uint64_t cashu_calculate_allotment(uint64_t token_amount, uint64_t price_per_step, | ||
| 41 | const char *metric, uint64_t step_size); | ||
| 42 | |||
| 40 | bool cashu_is_mint_accepted(const char *mint_url); | 43 | bool cashu_is_mint_accepted(const char *mint_url); |
| 41 | 44 | ||
| 42 | #endif | 45 | #endif |