Skip to content

Sidechain spends are opt-in; cached chain state; 0.0.10 - #31

Merged
jjohare merged 2 commits into
JavaScriptSolidServer:mainfrom
jjohare:feat/sidestr-opt-in
Sep 25, 2026
Merged

jjohare merged 2 commits into
JavaScriptSolidServer:mainfrom
jjohare:feat/sidestr-opt-in

Conversation

@jjohare

@jjohare jjohare commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Sidechain spends become opt-in, and each chain's validated state is cached so spends open quickly. 0.0.10.

Opt-in

  • Spends are off until the person turns them on, either in settings or in the spend window the first time a site asks: "Turn on and review", or "Not now", which answers the site with code: 'unsupported'.
  • Settings list the chains in use, each with its pinned signer and a Forget button. Turning spends off forgets every chain. Signer pins from 0.0.9 carry over and count as turned on.
  • New: window.nostr.sidestr.enabled, read live from <html data-podkey-sidestr>, which the content script mirrors from the setting. signTransaction is present either way, so a site never hits a dead end. A page that forges the attribute only misleads itself.

Cache

  • The explorer resumes from its saved state, and the holders' asset view resumes from its own. Both are keyed to the block hash at the saved height; if either doesn't match, both are dropped and every block is checked again. The spend window says which it did ("N new blocks checked, M from your last visit").
  • On the live sidestr:dreamlab, a full check of all 545 blocks took 5.9 s and a resumed check 0.3 s, with an identical asset view. The saved state is 47 KB.

Checks

  • npm test passes 228/228, with new tests covering the settings, migration, forget and off, and an asset-view resume that must equal a full replay and refuse a mismatched save. Lint is clean.
  • Both screens were rendered in Chrome: the opt-in step and the settings switch with its chain list. Turning spends on saved the setting, validated the live chain and wrote both caches.

Spec text: sidestr/spec (PR to follow) adds enabled and the opt-in behaviour to the browser-signer proposal.

🤖 Generated by Claude Code

…s cached; 0.0.10

- off until turned on, in settings or in the spend window when a site first
  asks (declining answers 'unsupported'); settings list the chains in use with
  their pinned signer and a Forget button; turning spends off forgets every
  chain; 0.0.9 pins carry over as turned on (src/sidestr/settings.js)
- window.nostr.sidestr.enabled, read live from <html data-podkey-sidestr>
  which the content script mirrors from the setting
- the explorer resumes from its saved state and the holders' asset view from
  its own, both keyed to the block hash at the saved height; a mismatch drops
  both and every block is checked again. sidestr:dreamlab: 5.9 s -> 0.3 s,
  identical view, 47 KB saved; the window says what it checked

Co-Authored-By: jjohare <github@thedreamlab.uk>
…as focus

Turning spends on signs nothing, so it takes the primary style rather than the
danger-toned approve style Sign uses; the safe choice keeps the focus.

Co-Authored-By: jjohare <github@thedreamlab.uk>
@jjohare
jjohare merged commit bbca664 into JavaScriptSolidServer:main Sep 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant