paritytech / paritytech/dotns

[Feat]: Add @parity/dotns-abi, @parity/dotns-deployments, and @parity/dotns-sdk-vue; migrate packages/ui

Open
#119 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotns-sdk triage type: feature
Dominant language
Solidity
Stars
4
Forks
2
Avg merge
1d 18h
Merged PRs (30d)
24

Description

Component: Other
Priority: P1

Summary

both packages/ui and packages/cli currently ship their own abis/ folder containing the same 10 JSON files (9 dotns contracts + multicall3). any contract upgrade has to be applied to both in sync. there is already a casing inconsistency between them (Multicall3.json vs MultiCall3.json), which tells you something about how well the sync has worked in practice.

i think the right move is to make the abis one shared package consumed by everything downstream, and build the ui-layer composables on top. concretely: @parity/dotns-abi (raw typed artifacts), @parity/dotns-deployments (addresses per network), and @parity/dotns-sdk-vue (composables). then migrate packages/ui to consume them and delete packages/ui/abis/.

vue first because it's the most-actively-developed surface in this repo, and because the ts and rust non-ui bindings (#120 and #121) depend on the same @parity/dotns-abi + @parity/dotns-deployments foundation, so you want that part shipped before anything else builds on it.

depends on paritytech/dotns#118 for deployments.json as a first-class artifact. until that lands, @parity/dotns-deployments reads addresses from the readme via a scraping script as a stopgap. not great, but fine as a bridge.

Proposal

New packages:

  • packages/abi published as @parity/dotns-abi
  • packages/deployments published as @parity/dotns-deployments
  • packages/sdk-vue published as @parity/dotns-sdk-vue

Migration: packages/ui consumes the three new packages and drops its local abis/ folder.

Tasks, packages/abi
  • scripts/sync-abi.ts downloads dotns-abis-${TAG}.zip from a pinned dotns release and unpacks into packages/abi/artifacts/.
  • Pin the release version in packages/abi/package.json ("dotnsRelease": "v0.4.0").
  • Publish as @parity/dotns-abi.
Tasks, packages/deployments
  • Consume deployments.json from the artifact, re-export as a typed deployments object keyed by network.
  • Publish as @parity/dotns-deployments. Mirrors the @safe-global/safe-deployments pattern.
Tasks, packages/sdk-vue
  • Pinia store useDotnsClientStore owning PublicClient and WalletClient.
  • Every function on every contract gets one composable. Nothing more, nothing less. Codegen script reads packages/abi/artifacts/ and emits one composable per function per contract. No curated or higher-level flows.
    • views return { data, error, isPending, refetch } using @vueuse/core (computedAsync, watchDebounced, AbortController).
    • writes return { hash, error, isPending, call } action-style via WalletClient.
  • Preserve viem ABI type inference through composable return types. No any.
  • Publish as @parity/dotns-sdk-vue.
Tasks, migrate packages/ui
  • Delete packages/ui/abis/.
  • Replace local ABI and address imports with @parity/dotns-abi, @parity/dotns-deployments, @parity/dotns-sdk-vue.
  • Route all contract reads through composables. All writes through action composables.
  • Regression pass on every screen that reads or writes to a contract, against an anvil fork.
Tasks, examples
  • examples/resolve-vue/: a minimal Vite + Vue 3 app that installs @parity/dotns-sdk-vue + @parity/dotns-abi + @parity/dotns-deployments, resolves alice.dot on Paseo, and displays the resolved address.
  • Example runs in CI on every PR.
Tasks, publishing hygiene
  • Adopt @changesets/cli at repo root. Each PR ships with a changeset.
  • Typedoc per package, published to GitHub Pages on release.

Acceptance criteria

  • packages/ui/abis/ is deleted.
  • packages/ui consumes @parity/dotns-abi, @parity/dotns-deployments, @parity/dotns-sdk-vue only.
  • bun create vite@latest my-app -- --template vue-ts && bun add @parity/dotns-sdk-vue works from a fresh project.
  • examples/resolve-vue/ resolves a name end to end.
  • Every UI screen that touches a contract passes an anvil-fork regression.
  • Changesets adopted; Typedoc published for every new package.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading packages/ui, its local abis/ folder, and dependency issue #118 for the deployments artifact. Then map the proposed packages/abi, packages/deployments, packages/sdk-vue, and examples/resolve-vue work against the existing package and build setup. Done means the UI uses the published packages, the example resolves a name, and the stated anvil-fork, CI, changeset, and Typedoc checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, solidity, typescript, vite
Domain
blockchain, build-system, developer-experience, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.