Skip to content

fix(tfchain-client-js): remove static types.json, use metadata v14/v15 for type resolution#1078

Open
sameh-farouk wants to merge 1 commit intodevelopmentfrom
fix/remove-tfchain-client-types-json
Open

fix(tfchain-client-js): remove static types.json, use metadata v14/v15 for type resolution#1078
sameh-farouk wants to merge 1 commit intodevelopmentfrom
fix/remove-tfchain-client-types-json

Conversation

@sameh-farouk
Copy link
Member

Closes #1077

What changed

  • Removed types.json import and usage from clients/tfchain-client-js/lib/client.js
  • Deleted clients/tfchain-client-js/types.json (38 type definitions)
  • Updated docs/misc/create_farm.md to remove the obsolete "copy types" step

Why

ApiPromise.create({ provider }) without custom type overrides lets @polkadot/api derive all type information directly from on-chain metadata (v14/v15). This means the client always stays in sync with the current runtime — no restart needed after upgrades.

Tested

Against mainnet (wss://tfchain.grid.tf) and devnet (wss://tfchain.dev.grid.tf):

  • specVersion: 157, metadata v14
  • tfgridModule.twins(1) and tfgridModule.farms(1) decode correctly
  • Transaction signing unaffected

…5 for type resolution

TFChain runtime exposes metadata v14 and v15, which embed all SCALE
codec type information directly in on-chain metadata. The static
types.json was a legacy override from pre-v14 days and is no longer
needed — @polkadot/api (^10.9.1) derives all types automatically.

Removing this eliminates the need to restart activation-service (and
other consumers) after runtime upgrades, since type definitions are
now always in sync with the on-chain runtime.

Changes:
- Remove types.json import and usage from client.js
- Delete clients/tfchain-client-js/types.json (38 type definitions)
- Update docs/misc/create_farm.md to remove obsolete "copy types" step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sameh-farouk sameh-farouk requested a review from LeeSmet as a code owner March 5, 2026 22:57
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.

activation-service requires restart after every runtime upgrade

1 participant