diff options
| author | Your Name <you@example.com> | 2026-05-17 04:37:15 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-17 04:37:15 +0530 |
| commit | cb4bd7d7c10cadcb43f82c09b13ffed744e541f7 (patch) | |
| tree | 1f01c31083e9252b7f41e89ba201373d6606a47d /main/lightning_payout.h | |
| parent | 78dd599277b8e8b2ddc39a4ae710ec91d737272e (diff) | |
Phase 5: Lightning auto-payout with LNURL-pay and NUT-05 melt
- New lnurl_pay.c/h: LNURL-pay protocol (GET .well-known/lnurlp + callback)
- New lightning_payout.c/h: threshold-based auto-payout with multi-recipient split
- Extended nucula_wallet bridge with nucula_wallet_melt() (NUT-05)
- Config: payout section with multi-mint, multi-recipient, fee_tolerance
- Default: enabled, TollGate@coinos.io, min_payout=128, min_balance=64
- 18 new unit tests (all passing), 134 total
Diffstat (limited to 'main/lightning_payout.h')
| -rw-r--r-- | main/lightning_payout.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/main/lightning_payout.h b/main/lightning_payout.h new file mode 100644 index 0000000..d353902 --- /dev/null +++ b/main/lightning_payout.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | #ifndef LIGHTNING_PAYOUT_H | ||
| 2 | #define LIGHTNING_PAYOUT_H | ||
| 3 | |||
| 4 | #include "esp_err.h" | ||
| 5 | #include <stdint.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | |||
| 8 | #define PAYOUT_MAX_RECIPIENTS 4 | ||
| 9 | #define PAYOUT_MAX_MINTS 3 | ||
| 10 | #define PAYOUT_MAX_ADDR_LEN 128 | ||
| 11 | |||
| 12 | typedef struct { | ||
| 13 | char lightning_address[PAYOUT_MAX_ADDR_LEN]; | ||
| 14 | double factor; | ||
| 15 | } payout_recipient_t; | ||
| 16 | |||
| 17 | typedef struct { | ||
| 18 | char url[256]; | ||
| 19 | uint64_t min_balance; | ||
| 20 | uint64_t min_payout_amount; | ||
| 21 | } payout_mint_config_t; | ||
| 22 | |||
| 23 | typedef struct { | ||
| 24 | bool enabled; | ||
| 25 | payout_mint_config_t mints[PAYOUT_MAX_MINTS]; | ||
| 26 | int mint_count; | ||
| 27 | payout_recipient_t recipients[PAYOUT_MAX_RECIPIENTS]; | ||
| 28 | int recipient_count; | ||
| 29 | uint64_t fee_tolerance_pct; | ||
| 30 | int check_interval_s; | ||
| 31 | } payout_config_t; | ||
| 32 | |||
| 33 | esp_err_t lightning_payout_init(const payout_config_t *config); | ||
| 34 | |||
| 35 | void lightning_payout_tick(void); | ||
| 36 | |||
| 37 | #endif | ||