paritytech / paritytech/dotns

[Feat]: Add @parity/dotns-bindings-ts and @parity/dotns-sdk; migrate packages/cli

Open
#120 2 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

with @parity/dotns-abi and @parity/dotns-deployments shipped (#119), the next piece is typed typescript bindings that don't depend on a framework, and a small resolver helper library on top of them. the bindings are pure viem + as const abis, no wagmi. i think avoiding wagmi at runtime matters here because the cli and any downstream backend/indexer/script shouldn't have to pull in a react-oriented runtime to call a contract.

this issue also deletes packages/cli/abis/ and migrates the cli to consume the new packages. same argument as with the ui: the duplication exists, it has already drifted once, and there is no reason to keep it.

consumers outside this repo (backends, indexers, other projects, a future dapp) get a real @parity/dotns-sdk they can bun install against. resolving a name should be ~5 lines.

depends on #119.

Proposal

New packages:

  • packages/bindings-ts published as @parity/dotns-bindings-ts
  • packages/sdk-ts published as @parity/dotns-sdk

Migration: packages/cli consumes them and drops its local abis/ folder.

Tasks, packages/bindings-ts
  • In-house codegen script reads packages/abi/artifacts/ and emits export const <Contract>Abi = [...] as const per contract. No wagmi dependency.
  • Export typed ABIs for all 10 contracts (9 concrete DotNS + Multicall3) with every function exposed. The as const ABI covers the full surface by construction; no function may be omitted.
  • Compile-time assertion tests confirm every function in every contract ABI is reachable with full viem type inference (no any, no widened unions).
  • Publish as @parity/dotns-bindings-ts.
Tasks, packages/sdk-ts
  • Every function on every contract gets one typed helper. Nothing more, nothing less. Codegen emits one function per contract function from the ABI. No bespoke flows.
    • view helpers return Promise<Output> given a PublicClient.
    • writes take a WalletClient and return Promise<Hash>.
    • address and ABI are resolved internally from @parity/dotns-abi and @parity/dotns-deployments; callers only pass the client and the function arguments.
  • Anvil-fork integration tests for every generated helper.
  • Publish as @parity/dotns-sdk.
Tasks, migrate packages/cli
  • Delete packages/cli/abis/.
  • Replace local ABI and address imports with @parity/dotns-abi, @parity/dotns-deployments, @parity/dotns-bindings-ts, @parity/dotns-sdk.
  • Regression tests for every command that touches a contract.
Tasks, examples
  • examples/resolve-ts/: a minimal Bun script that installs @parity/dotns-sdk, resolves alice.dot on Paseo, prints the address.
  • Example runs in CI on every PR.
Tasks, publishing hygiene
  • Each PR ships with a changeset.
  • Typedoc published for new packages.

Acceptance criteria

  • packages/cli/abis/ is deleted.
  • packages/cli consumes the new shared packages only.
  • bun install @parity/dotns-sdk works from a fresh project.
  • examples/resolve-ts/ resolves a name end to end.
  • CLI passes regression tests against an anvil fork.

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 confirming dependency #119, then inspect packages/abi/artifacts/ and the existing packages/cli/abis/ contents. Review the CLI command tests and the Anvil-fork integration-test requirements before splitting the work across bindings, SDK, migration, and examples. Done means the shared packages are consumable, the CLI no longer has local ABIs, resolve-ts works end to end, and the regression tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, solidity, typescript
Domain
backend-api-design, blockchain, cli, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.