onionwire-sdk: expose the on-device Cuprate chain source (choice, lifecycle, node status) #111
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_48f0f8b6-onionwire-sdk-expose-the-on-device-cupra"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
Part 2 of "cuprated built in": makes the in-process Cuprate chain source reachable from Kotlin. Stacked on #110 (
onionwire/t_04975420-..., basemain) — retarget tomainwhen #110 merges.Three things, all in
crates/onionwire-sdk/:ChainChoice.InProcessCuprate(KotlinChainChoice.IN_PROCESS_CUPRATE) — the core variant the parent card landed, with the SDK's feature passthrough (cuprate-daemon = ["onionwire/cuprate-daemon"]). Selecting it needs no binary path on either side.monerod_datadirfor that kind defaults to$ONIONWIRE_HOME/chainwhen the string is empty (the per-identity chain directorydocs/WALLET.mdalready pins). A Kotlin caller that does not know a path passes""and gets the same directory a spawnedmonerodwould use. An explicit path is taken as given.None/Local/Remotebehave exactly as before.wallet_status()now carries, beside the core's own five words and thein-process nodelabel:chain_in_process— the configured source is this app's node, not a spawned/monitored daemon;node_available— this build hascuprate-daemon(grey the option out rather than start-and-catch);node_state—off/starting/syncing/ready/exitedfor the in-process source, empty for every other source.The lifecycle stays the core's:
start_wallet_child()is one call (the core launches the node and the wallet child in it),stop_wallet_child()shuts both down, both idempotent. The SDK is a pass-through, not a second state machine.Honesty notes
node_stateis a projection of the core's real child state (connecting -> starting), never a timer, env var, file, or outbox row.syncing, neverready— it cannot be reportedexited. Documented onnode_stateitself.in-process node, testnet only, pre-production (the doc comments carry it; the core'sChainSource::label()is the string rendered).Evidence (this tree, commit
64a1f29)cargo test --locked(feature off)cargo clippy --locked --all-targets -- -D warnings(feature off)cargo test --locked --features cuprate-daemoncargo clippy --locked --all-targets --features cuprate-daemon -- -D warningscargo check --locked --release --target aarch64-linux-android --features cuprate-daemonrandomx-rs+cupratedcompiled)cargo test --locked --target x86_64-unknown-linux-gnucrates/onionwire-sdk/Cargo.lockNew tests (6): datadir default / explicit passthrough, all four choices round-tripping through the SDK mapping, the five-state node projection, empty
node_statefor non-in-process sources, andnode_availablematchingonionwire::cuprate::available().Not proven here: a real node launch through the SDK.
Wireis only constructible viaopen_wire(Arti bootstrap, network), so the SDK's own tests cannot drivestart_wallet_child()end to end; the launch path is the parent card's, already proven in the core (tests/wallet.rs). SDK-sidestart/stopare pass-throughs to that.Scope deviations
docs/WALLET.md: SDK-facing lines only (the chain-source label list, the "Selecting it" paragraph, and the UniFFI bullet).src/**, root manifests,android/**, or the workflows was touched.Kotlin-visible names
Generated with
uniffi-bindgen --library libonionwire_sdk.so --language kotlinagainst this branch's cdylib.PR #110 must merge first; this branch already contains it.