v0.1.14 - Use wallet state for default mint resolution instead of config mint_count guards

This commit is contained in:
Your Name
2026-03-21 07:00:46 -04:00
parent c6f0a07aee
commit 94565e365a
5 changed files with 29 additions and 12 deletions
+2 -2
View File
@@ -55,11 +55,11 @@ Skills compose by adoption-list order (`10123`) and trigger tags carry runtime e
Didactyl will support local inference, which is very privacy preserving. Remote inference does however have it's advantages, and in those cases Didactyl supports using Bitcoin Lightning and eCash inference providers.
## Current Status — v0.1.13
## Current Status — v0.1.14
**Active build — this project is barely working. Experiment at your own risk.**
> Last release update: v0.1.13 — Expose cashu_wallet_mints_get in tool schema so configured mints can be queried
> Last release update: v0.1.14 — Use wallet state for default mint resolution instead of config mint_count guards
- Connects to configured relays with auto-reconnect and relay state transition logging
- Publishes configured startup events per relay as each relay becomes connected
+16
View File
@@ -465,6 +465,22 @@ static int ensure_wallet_ready(void) {
return rc;
}
int cashu_wallet_has_default_mint(void) {
if (!g_wallet.initialized || !g_wallet.cfg) return 0;
if (ensure_wallet_ready() != 0) return 0;
int has_default = 0;
pthread_mutex_lock(&g_wallet.mutex);
has_default = (g_wallet.wallet_loaded &&
g_wallet.wallet.mint_count > 0 &&
g_wallet.wallet.mint_urls &&
g_wallet.wallet.mint_urls[0] &&
g_wallet.wallet.mint_urls[0][0] != '\0');
pthread_mutex_unlock(&g_wallet.mutex);
return has_default;
}
int cashu_wallet_create_new_from_config(void) {
if (!g_wallet.initialized || !g_wallet.cfg) return -1;
+1
View File
@@ -11,6 +11,7 @@ void cashu_wallet_cleanup(void);
int cashu_wallet_load_from_relays(void);
int cashu_wallet_create_new_from_config(void);
int cashu_wallet_has_default_mint(void);
int cashu_wallet_balance(cJSON** out_json);
int cashu_wallet_info(const char* mint_url, cJSON** out_json);
+2 -2
View File
@@ -12,8 +12,8 @@
// Using DIDACTYL_ prefix to avoid conflicts with nostr_core_lib VERSION macros
#define DIDACTYL_VERSION_MAJOR 0
#define DIDACTYL_VERSION_MINOR 1
#define DIDACTYL_VERSION_PATCH 13
#define DIDACTYL_VERSION "v0.1.13"
#define DIDACTYL_VERSION_PATCH 14
#define DIDACTYL_VERSION "v0.1.14"
// Agent metadata
#define DIDACTYL_NAME "Didactyl"
+8 -8
View File
@@ -73,7 +73,7 @@ char* execute_cashu_wallet_info(tools_context_t* ctx, const char* args_json) {
cJSON* mint = cJSON_GetObjectItemCaseSensitive(args, "mint_url");
const char* mint_url = (mint && cJSON_IsString(mint) && mint->valuestring) ? mint->valuestring : NULL;
if ((!mint_url || mint_url[0] == '\0') && ctx->cfg->cashu_wallet.mint_count <= 0) {
if ((!mint_url || mint_url[0] == '\0') && !cashu_wallet_has_default_mint()) {
cJSON_Delete(args);
return json_error_local("cashu_wallet_info requires mint_url when no cashu_wallet.mint_urls are configured");
}
@@ -100,7 +100,7 @@ char* execute_cashu_wallet_mint_quote(tools_context_t* ctx, const char* args_jso
cJSON* unit = cJSON_GetObjectItemCaseSensitive(args, "unit");
const char* mint_url = (mint && cJSON_IsString(mint) && mint->valuestring) ? mint->valuestring : NULL;
const char* unit_s = (unit && cJSON_IsString(unit) && unit->valuestring) ? unit->valuestring : NULL;
if ((!mint_url || mint_url[0] == '\0') && ctx->cfg->cashu_wallet.mint_count <= 0) {
if ((!mint_url || mint_url[0] == '\0') && !cashu_wallet_has_default_mint()) {
cJSON_Delete(args);
return json_error_local("cashu_wallet_mint_quote requires mint_url when no cashu_wallet.mint_urls are configured");
}
@@ -125,7 +125,7 @@ char* execute_cashu_wallet_mint_check(tools_context_t* ctx, const char* args_jso
cJSON* mint = cJSON_GetObjectItemCaseSensitive(args, "mint_url");
const char* mint_url = (mint && cJSON_IsString(mint) && mint->valuestring) ? mint->valuestring : NULL;
if ((!mint_url || mint_url[0] == '\0') && ctx->cfg->cashu_wallet.mint_count <= 0) {
if ((!mint_url || mint_url[0] == '\0') && !cashu_wallet_has_default_mint()) {
cJSON_Delete(args);
return json_error_local("cashu_wallet_mint_check requires mint_url when no cashu_wallet.mint_urls are configured");
}
@@ -160,7 +160,7 @@ char* execute_cashu_wallet_mint_claim(tools_context_t* ctx, const char* args_jso
cJSON* mint = cJSON_GetObjectItemCaseSensitive(args, "mint_url");
const char* mint_url = (mint && cJSON_IsString(mint) && mint->valuestring) ? mint->valuestring : NULL;
if ((!mint_url || mint_url[0] == '\0') && ctx->cfg->cashu_wallet.mint_count <= 0) {
if ((!mint_url || mint_url[0] == '\0') && !cashu_wallet_has_default_mint()) {
cJSON_Delete(args);
return json_error_local("cashu_wallet_mint_claim requires mint_url when no cashu_wallet.mint_urls are configured");
}
@@ -187,7 +187,7 @@ char* execute_cashu_wallet_melt_quote(tools_context_t* ctx, const char* args_jso
cJSON* unit = cJSON_GetObjectItemCaseSensitive(args, "unit");
const char* mint_url = (mint && cJSON_IsString(mint) && mint->valuestring) ? mint->valuestring : NULL;
const char* unit_s = (unit && cJSON_IsString(unit) && unit->valuestring) ? unit->valuestring : NULL;
if ((!mint_url || mint_url[0] == '\0') && ctx->cfg->cashu_wallet.mint_count <= 0) {
if ((!mint_url || mint_url[0] == '\0') && !cashu_wallet_has_default_mint()) {
cJSON_Delete(args);
return json_error_local("cashu_wallet_melt_quote requires mint_url when no cashu_wallet.mint_urls are configured");
}
@@ -212,7 +212,7 @@ char* execute_cashu_wallet_melt_pay(tools_context_t* ctx, const char* args_json)
cJSON* mint = cJSON_GetObjectItemCaseSensitive(args, "mint_url");
const char* mint_url = (mint && cJSON_IsString(mint) && mint->valuestring) ? mint->valuestring : NULL;
if ((!mint_url || mint_url[0] == '\0') && ctx->cfg->cashu_wallet.mint_count <= 0) {
if ((!mint_url || mint_url[0] == '\0') && !cashu_wallet_has_default_mint()) {
cJSON_Delete(args);
return json_error_local("cashu_wallet_melt_pay requires mint_url when no cashu_wallet.mint_urls are configured");
}
@@ -231,7 +231,7 @@ char* execute_cashu_wallet_check_proofs(tools_context_t* ctx, const char* args_j
cJSON* mint = cJSON_GetObjectItemCaseSensitive(args, "mint_url");
const char* mint_url = (mint && cJSON_IsString(mint) && mint->valuestring) ? mint->valuestring : NULL;
if ((!mint_url || mint_url[0] == '\0') && ctx->cfg->cashu_wallet.mint_count <= 0) {
if ((!mint_url || mint_url[0] == '\0') && !cashu_wallet_has_default_mint()) {
cJSON_Delete(args);
return json_error_local("cashu_wallet_check_proofs requires mint_url when no cashu_wallet.mint_urls are configured");
}
@@ -277,7 +277,7 @@ char* execute_cashu_wallet_send_token(tools_context_t* ctx, const char* args_jso
cJSON* mint = cJSON_GetObjectItemCaseSensitive(args, "mint_url");
const char* mint_url = (mint && cJSON_IsString(mint) && mint->valuestring) ? mint->valuestring : NULL;
if ((!mint_url || mint_url[0] == '\0') && ctx->cfg->cashu_wallet.mint_count <= 0) {
if ((!mint_url || mint_url[0] == '\0') && !cashu_wallet_has_default_mint()) {
cJSON_Delete(args);
return json_error_local("cashu_wallet_send_token requires mint_url when no cashu_wallet.mint_urls are configured");
}