diff options
Diffstat (limited to 'main/wallet.h')
| -rw-r--r-- | main/wallet.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/main/wallet.h b/main/wallet.h new file mode 100644 index 0000000..5089f93 --- /dev/null +++ b/main/wallet.h | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | #ifndef WALLET_H | ||
| 2 | #define WALLET_H | ||
| 3 | |||
| 4 | #include "esp_err.h" | ||
| 5 | #include <stdint.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | |||
| 8 | #define WALLET_MAX_PROOFS 50 | ||
| 9 | #define WALLET_MAX_KEYSETS 5 | ||
| 10 | #define WALLET_KEYSET_ID_LEN 68 | ||
| 11 | #define WALLET_SECRET_LEN 65 | ||
| 12 | #define WALLET_SIG_LEN 67 | ||
| 13 | |||
| 14 | typedef struct { | ||
| 15 | uint64_t amount; | ||
| 16 | char id[WALLET_KEYSET_ID_LEN]; | ||
| 17 | char secret[WALLET_SECRET_LEN]; | ||
| 18 | char c[WALLET_SIG_LEN]; | ||
| 19 | } wallet_proof_t; | ||
| 20 | |||
| 21 | typedef struct { | ||
| 22 | char id[WALLET_KEYSET_ID_LEN]; | ||
| 23 | char public_key_33[67]; | ||
| 24 | uint64_t amount; | ||
| 25 | int input_fee_ppk; | ||
| 26 | } wallet_keyset_t; | ||
| 27 | |||
| 28 | typedef struct { | ||
| 29 | wallet_proof_t proofs[WALLET_MAX_PROOFS]; | ||
| 30 | int proof_count; | ||
| 31 | wallet_keyset_t keysets[WALLET_MAX_KEYSETS]; | ||
| 32 | int keyset_count; | ||
| 33 | uint64_t balance; | ||
| 34 | } wallet_t; | ||
| 35 | |||
| 36 | esp_err_t wallet_init(void); | ||
| 37 | wallet_t *wallet_get(void); | ||
| 38 | uint64_t wallet_balance(void); | ||
| 39 | |||
| 40 | esp_err_t wallet_add_proofs(const wallet_proof_t *proofs, int count); | ||
| 41 | esp_err_t wallet_remove_proof(int index); | ||
| 42 | void wallet_clear(void); | ||
| 43 | |||
| 44 | esp_err_t wallet_fetch_keysets(const char *mint_url); | ||
| 45 | esp_err_t wallet_swap_proofs(const char *mint_url, int start_index, int count); | ||
| 46 | |||
| 47 | esp_err_t wallet_create_token(char *out, size_t out_size, uint64_t amount, | ||
| 48 | const char *mint_url); | ||
| 49 | esp_err_t wallet_send(const char *mint_url, uint64_t amount, | ||
| 50 | char *token_out, size_t token_out_size); | ||
| 51 | |||
| 52 | void wallet_print_status(void); | ||
| 53 | #endif | ||