# ── ladon Config.toml ──────────────────────────────────────────────────────────
# This is the standalone config file for Ladon.  It works with:
#   ladon --config Config.toml
#
# For multi-package deployments, a merged Config.toml with shared [stores] and
# other universal sections can be used instead.  Ladon loads the [ladon]
# namespace and resolves [stores.<id>] from the shared root; it ignores
# [pano], [bria], and [oracles] sections.

# ── Ladon namespace ────────────────────────────────────────────────────────────

[ladon]
# Store id from [stores] used by pool mode (default: "ladon").
# When no [stores] section is present a SQLite store is created automatically.
store = "ladon"

# ── Derivation ──────────────────────────────────────────────────────────────────

[ladon.derive]
# Default output format: json, csv, or text.
format = "json"
# Number of mnemonic words when generating a new mnemonic: 12 or 24.
strength = 12

# How to obtain the master secret.  Supported "kind" values:
#   "env"        — mnemonic from an environment variable
#   "xpriv_env"  — raw hex xpriv from an environment variable
#   "file"       — mnemonic read from a plain-text file
[ladon.derive.secret]
kind = "env"
var  = "LADON_MNEMONIC"
# Optional: BIP-39 passphrase read from a separate env var
# passphrase_var = "LADON_PASSPHRASE"

# One [[ladon.derive.chains]] section per blockchain.
[[ladon.derive.chains]]
name    = "evm"
account = 0
change  = 0
# start_index = 1   # first generated pool index when this chain has no rows

[[ladon.derive.chains]]
name        = "solana"
account     = 0
change      = 0
# start_index = 1
solana_mode = "cold-export"   # "full" | "cold-export" | "hsm-sim" | "pda"
# program_id = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"

# [[ladon.derive.chains]]
# name    = "btc"
# account = 0
# change  = 0
# start_index = 1
# network = "bitcoin"   # "bitcoin" | "testnet" | "signet" | "regtest"

# ── Pool daemon ─────────────────────────────────────────────────────────────────

[ladon.pool]
target        = 1000   # keep this many addresses in the pool at all times
threshold     = 200    # start refilling when the count drops below this
batch         = 100    # derive this many at a time
interval_secs = 10     # poll the database every N seconds

# ── Table / column names ────────────────────────────────────────────────────────

[ladon.table]
name = "derived_addresses"

[ladon.table.columns]
id         = "id"
chain      = "chain"
address    = "address"
path       = "path"
index      = "index"
is_used    = "is_used"
created_at = "created_at"

# ── Store (database connection) ─────────────────────────────────────────────────
# When a [stores] section is present, Ladon resolves [ladon].store against it.
# Omitting [stores] defaults to SQLite at data/ladon/addresses.db.

[stores.ladon]
driver = "sqlite"
url = "sqlite://data/ladon/addresses.db"
# migrate = true           # create/update schema automatically
# connect_timeout_secs = 10
# max_connections = 1      # keep at 1 for SQLite

# ── Optional Postgres store (requires --features pg or --features postgres) ────
# Comment out the [stores.ladon] section above and uncomment below for Postgres.
#
# [stores.ladon]
# driver = "postgres"
# url = "${DATABASE_URL:-}"
# # Alternatively, set url directly:
# # url = "postgres://user:password@localhost:5432/ladon"
# migrate = true
# connect_timeout_secs = 10
# max_connections = 5
