[Feat]: Add @parity/dotns-bindings-ts and @parity/dotns-sdk; migrate packages/cli
Nobody has claimed this yet.
- 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-tspublished as@parity/dotns-bindings-tspackages/sdk-tspublished 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 emitsexport const <Contract>Abi = [...] as constper contract. No wagmi dependency. - Export typed ABIs for all 10 contracts (9 concrete DotNS + Multicall3) with every function exposed. The
as constABI 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 aPublicClient. - writes take a
WalletClientand returnPromise<Hash>. - address and ABI are resolved internally from
@parity/dotns-abiand@parity/dotns-deployments; callers only pass the client and the function arguments.
- view helpers return
- 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, resolvesalice.doton 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/cliconsumes the new shared packages only. -
bun install @parity/dotns-sdkworks from a fresh project. -
examples/resolve-ts/resolves a name end to end. - CLI passes regression tests against an anvil fork.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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