Skip to content

Add account setup, dot update, and vitest suite#13

Merged
UtkarshBhardwaj007 merged 1 commit intomainfrom
init-account-setup
Apr 16, 2026
Merged

Add account setup, dot update, and vitest suite#13
UtkarshBhardwaj007 merged 1 commit intomainfrom
init-account-setup

Conversation

@UtkarshBhardwaj007
Copy link
Copy Markdown
Member

@UtkarshBhardwaj007 UtkarshBhardwaj007 commented Apr 16, 2026

Summary

  • dot init account setup — after QR login and toolchain install (which run concurrently), gates on both and runs a three-step setup on Paseo: fund from Alice (testnet), Revive.map_account signed by the user on the mobile app, and Alice-granted bulletin allowance (1000 txs / 100 MB).
  • dot update — self-updates from GitHub releases. Writes to dot.new, fsyncs, then renames atomically so the live binary is never half-written.
  • Session signer shim (src/utils/signer.ts) — routes transactions through signPayload rather than signRaw. The default signRaw path triggers the mobile's <Bytes>…</Bytes> wrap, producing BadProof on-chain. Delegates to polkadot-api/pjs-signer's getPolkadotSignerFromPjs so per-extension mapping stays authoritative (fixes a CheckMetadataHash encoding error that failed on-device).
  • Connection singleton (src/utils/connection.ts) — lazy getChainAPI("paseo") with a 30 s timeout; underlying errors preserved via Error.cause.
  • Explicit session lifecyclegetSessionSigner() returns a destroy() handle that callers MUST invoke. The host-papp adapter keeps the Node event loop alive; forgetting to release manifests as dot <cmd> hanging after visible work finishes.
  • install.sh preserves the exit code of the auto-run dot init so CI cannot silently pass on a failed setup.
  • Test suite introduced — vitest + 73 tests across 9 files. Intentionally does not mock polkadot-api primitives (Enum, encoders) so tautological coverage can't slip in.
  • DocsREADME.md covers commands + architecture; CLAUDE.md captures the non-obvious invariants (dep pinning, signer-shim rationale, destroy contract, extract-pure-logic-from-tsx pattern).

Test plan

  • npx tsc --noEmit clean
  • pnpm format:check clean
  • pnpm test — 73 tests across 9 files pass
  • pnpm cli:install produces a working binary
  • On-device verification: dot init completes end-to-end — QR login, dependency install, fund, map (user signs on mobile), and allowance all succeed. Previous CheckMetadataHash encoding error is resolved.
  • Reviewer: verify dot update on a machine with a previously installed dot in ~/.polkadot/bin/ (happy path + force-overwrite of the live binary).
  • Reviewer: confirm dot init -y still only runs toolchain install (no QR, no account setup).

- dot init: after QR login and toolchain install, runs a three-step
  account setup on Paseo Asset Hub / Bulletin — fund from Alice (testnet),
  Revive.map_account signed by the user, then Alice-granted bulletin
  allowance. Login + deps run concurrently; account setup gates on both.
- dot update: self-updates from GitHub releases with an atomic
  write-staging-then-rename, safe to run over the live binary.
- src/utils/signer.ts: session signer shim that routes transactions
  through signPayload rather than signRaw — the default signRaw path
  triggers the mobile's <Bytes> wrap and yields BadProof. Delegates to
  polkadot-api/pjs-signer for authoritative per-extension mapping.
- src/utils/connection.ts: lazy singleton over getChainAPI("paseo")
  with a 30s timeout; underlying errors are preserved via Error.cause.
- getSessionSigner() returns an explicit destroy() — the host-papp
  adapter keeps the event loop alive and must be released.
- install.sh now preserves the exit code of the auto-run dot init so
  CI can't silently pass on a failed setup.
- Test suite: vitest + 73 tests across 9 files. polkadot-api primitives
  (Enum, encoders) are intentionally not mocked so tautological coverage
  can't slip in.
- README + CLAUDE.md document the commands, architectural decisions,
  and the non-obvious invariants (dep pinning, signer shim rationale,
  session lifecycle, test conventions).
@github-actions
Copy link
Copy Markdown
Contributor

Dev build ready — try this branch:

curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/init-account-setup bash

@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedbulletin-deploy@​0.6.77710010096100
Addedvitest@​3.2.4961007999100

View full report

@UtkarshBhardwaj007 UtkarshBhardwaj007 merged commit 33e2cac into main Apr 16, 2026
5 checks passed
@UtkarshBhardwaj007 UtkarshBhardwaj007 deleted the init-account-setup branch April 16, 2026 19:06
UtkarshBhardwaj007 added a commit that referenced this pull request Apr 16, 2026
- Changeset cuts the release for the account-setup / dot-update / vitest
  work that merged in #13 (which shipped without a changeset, so
  release.yml exited on merge to main without cutting a release).
- CLAUDE.md now states that every user-facing PR must include a
  changeset — release.yml is a no-op otherwise.
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