Seedelf-Wallet

Chunk 10 plan: withdraw (sweep and remove)

Branch: web-wallet/withdraw, taken from seedelf-web-wallet after #254 (chunk 9) merged. It ends with a PR back into seedelf-web-wallet.

Withdraw takes money out of the Seedelf balance: to any address (the CLI’s sweep), or by removing a Seedelf and freeing the ADA locked with it (the CLI’s remove). Both are Seedelf script spends, so the machinery is there:

What’s new: change that goes to an address instead of back into the contract (Max, and a removal’s ADA), the destination checks, the ADA Handle lookup, and two screens.

Start here (new session)

  1. Sync the branch:
    git checkout web-wallet/withdraw && git pull
    git fetch origin && git merge origin/seedelf-web-wallet   # if it moved since
    git log --oneline HEAD..origin/main                       # merge main first if this lists anything
    
  2. Read:
  3. Read the code this chunk extracts and copies:
    • seedelf-cli/src/commands/sweep.rs and remove.rs: still building inline.
    • seedelf-core/src/build.rs: ScriptSpend, transfer, select_script_inputs, change_outputs.
    • seedelf-web-wallet/wasm/src/lib.rs: transfer_spend, check_spendable, draft_of, finishing.
    • extension/src/background/{script-spend,transfer}.ts and extension/src/ui/screens/Transfer.tsx.

Decisions (confirmed with the user, 2026-09-24)

Decision Decided Notes
Where a removed Seedelf’s ADA goes The user picks: the Cardano account (0/0, the default) or the Seedelf balance, each with a note on what it links Returning it to whatever paid for the mint links nothing new. An account-paid Seedelf’s ADA put into the Seedelf balance ties the name to that new UTxO, and to whatever it’s later spent with. The Seedelf balance is right for a stealth-minted Seedelf.
Withdraw destinations Any key address on this network, or an ADA Handle. Script addresses are refused, as in the CLI (the output carries no datum). A warning when it’s your own Cardano account Withdrawing to your own account re-links the money (privacy.md Exit). The handle is resolved through Koios, which then sees it.
Max Max sends every Seedelf UTxO that fits one transaction, up to 20 (the CLI’s MAXIMUM_WALLET_UTXOS), with all their tokens, and the review says what’s left The form notes that spending everything at once ties those UTxOs together (co-spending).
What an amount sends An ADA amount (the AdaInput rules) plus optional tokens, each with an amount, as in transfer The destination output needs its address minimum, about 1 ₳, more with tokens.

Work items

1. Core (seedelf-core/src/build.rs)

2. WebAssembly

3. Service worker

4. UI

5. Tests

6. Docs

Risks and things to check

Out of scope