Skip to content

feat(sdk-coin-tao): add ClaimRootWithHotkey extrinsic builder - #9444

Closed
bitgo-ai-agent-dev[bot] wants to merge 4 commits into
ashutosh/SI-1171-claim-root-with-hotkey-pt1from
ashutosh/SI-1171-claim-root-with-hotkey-pt2
Closed

feat(sdk-coin-tao): add ClaimRootWithHotkey extrinsic builder#9444
bitgo-ai-agent-dev[bot] wants to merge 4 commits into
ashutosh/SI-1171-claim-root-with-hotkey-pt1from
ashutosh/SI-1171-claim-root-with-hotkey-pt2

Conversation

@bitgo-ai-agent-dev

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What

  • New ClaimRootBuilder (sdk-coin-tao/src/lib/claimRootBuilder.ts): builds SubtensorModule.claimRootWithHotkey(hotkey) via defineMethod; implements hotkey() setter, buildTransaction(), fromImplementation(), validateTransaction(), validateDecodedTransaction()
  • New ClaimRootTransaction (claimRootTransaction.ts): overrides toJson() (adds hotkey field), loadInputsAndOutputs() (populates _outputs with hotkey address), explainTransaction() (returns hotkey in outputs[])
  • New ClaimRootTxData interface in sdk-coin-tao/src/lib/iface.ts
  • TransactionBuilderFactory: register ClaimRootWithHotkey method dispatch in getBuilder() and expose getClaimRootBuilder()
  • Export ClaimRootBuilder and ClaimRootTransaction from src/lib/index.ts
  • New src/resources/testnetV2.ts: updated Bittensor testnet metadata (specVersion 443, fetched from test.finney.opentensor.ai) that includes claim_root_with_hotkey. The existing testnet.ts (specVersion 224) is kept unchanged to avoid breaking existing transaction fixtures
  • Unit tests: unsigned build, signed build, round-trip from() on unsigned hex, round-trip from() on signed hex, factory dispatch, tx.outputs content, loadInputsAndOutputs null-safety, explainTransaction.outputs[0].address, validation, error paths

Why

  • SI-1171: the Staking-India team needs sdk-coin-tao to accept TaoClaimRootIntent { hotkey, netuid: 0 } and produce a signed, broadcastable SubtensorModule.claimRootWithHotkey extrinsic
  • This is a P0 blocker for the TAO Root Reborn claim feature and for SI-1172 which routes CLAIM_REWARDS requests through WalletPlatform

Test plan

  • nix develop . --command bash -c "cd modules/sdk-coin-tao && ../../node_modules/.bin/mocha" — 93 passing, 2 pending, 1 pre-existing failure (requires BITGOJS_TEST_PASSWORD)
  • TypeScript build clean: cd modules/sdk-coin-tao && ../../node_modules/.bin/tsc --build --incremental --verbose . — no errors
  • Integration test on testnet after feature is wired end-to-end

Stack

This PR is part 2 of 2 in a stack. Review and merge in order:

  1. feat(abstract-substrate): add ClaimRootWithHotkey method name, args, and schema #9443 — abstract-substrate: types + schema (base: master)
  2. feat(sdk-coin-tao): add ClaimRootWithHotkey extrinsic builder #9444 — sdk-coin-tao: ClaimRootBuilder, ClaimRootTransaction, tests, metadata (base: pt1) ← you are here

Ticket: SI-1171

…and schema

Add the foundation types needed to build and validate the
SubtensorModule.claimRootWithHotkey Substrate extrinsic for TAO
root network reward claiming (SI-1171).

What changed:
- MethodNames: add ClaimRootWithHotkey: 'claimRootWithHotkey' constant
- iface.ts: add ClaimRootWithHotkeyArgs interface { hotkey: string }
- iface.ts: include ClaimRootWithHotkeyArgs in TxMethod.args union
- txnSchema.ts: add ClaimRootWithHotkeyTransactionSchema requiring
  a valid hotkey address

Ticket: SI-1171
Session-Id: ab70e181-1628-4e73-9662-8ef3fe0426ba
Task-Id: 091af7ce-ed42-4177-9ee0-2231917f41fa
Add support for building SubtensorModule.claimRootWithHotkey(hotkey)
Substrate extrinsic in sdk-coin-tao. This implements SI-1171, the P0
blocker for the TAO Root Reborn claim feature.

Changes:
- abstract-substrate: add ClaimRootWithHotkey to MethodNames,
  ClaimRootWithHotkeyArgs interface, and
  ClaimRootWithHotkeyTransactionSchema
- sdk-coin-tao: add ClaimRootBuilder (builds the extrinsic via
  defineMethod against subtensorModule pallet), ClaimRootTransaction
  (toJson/loadInputsAndOutputs/explainTransaction), ClaimRootTxData
  interface
- Register ClaimRootWithHotkey in TransactionBuilderFactory.getBuilder
  for round-trip decode support
- Add testnetV2.ts with updated Bittensor testnet metadata (specVersion
  443) that includes claim_root_with_hotkey; existing testnet.ts
  (specVersion 224) is unchanged to avoid breaking other fixtures
- Unit tests covering unsigned build, signed build, round-trip
  from/build, validation, explanation, and rejection of wrong tx type

Ticket: SI-1171
Session-Id: ab70e181-1628-4e73-9662-8ef3fe0426ba
Task-Id: 091af7ce-ed42-4177-9ee0-2231917f41fa
…action

After review agents flagged a CRITICAL issue: ClaimRootTransaction.
loadInputsAndOutputs() called decode() on potentially-null
_substrateTransaction after super.loadInputsAndOutputs() returns
early — causing TypeError instead of clean no-op.

Also add null guard per the same pattern as toJson() (line 10), and
strengthen test coverage:
- Assert explanation.outputs[0].address equals hotkey
- Add factory.from() dispatch test (ClaimRootBuilder routing)
- Add signed hex round-trip via from()
- Add tx.outputs content assertion
- Add loadInputsAndOutputs null-safety test
- Add validateDecodedTransaction non-matching method test

Ticket: SI-1171
Session-Id: ab70e181-1628-4e73-9662-8ef3fe0426ba
Task-Id: 091af7ce-ed42-4177-9ee0-2231917f41fa
@linear-code

linear-code Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

SI-1171

@ralph-bitgo
ralph-bitgo Bot force-pushed the ashutosh/SI-1171-claim-root-with-hotkey-pt2 branch from 8c68245 to 758b097 Compare August 7, 2026 02:03
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the ashutosh/SI-1171-claim-root-with-hotkey-pt2 branch from 758b097 to e5e44da Compare August 7, 2026 02:03
Export ClaimRootTxData from the lib index so downstream consumers
(wallet-platform) can type the claim transaction payload. Add a
verifyTransaction override in Tao that short-circuits recipient
validation when txParams.type is 'StakingClaim', mirroring the
no-recipient bypass already used for enabletoken. Add unit tests
covering both the StakingClaim bypass and the no-recipients path.

ClaimRootBuilder, ClaimRootTransaction, TransactionBuilderFactory
routing, and the ClaimRootWithHotkeyTransactionSchema were added in
the previous commits; this commit completes the integration by:
- exporting ClaimRootTxData for WP to reference
- guarding verifyTransaction against unnecessary tx decoding for
  claim-type intents that carry no transfer recipient
- exercising both paths in the Tao verifyTransaction test suite

Ticket: SI-1171
Session-Id: ab70e181-1628-4e73-9662-8ef3fe0426ba
Task-Id: 091af7ce-ed42-4177-9ee0-2231917f41fa
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the ashutosh/SI-1171-claim-root-with-hotkey-pt2 branch from d80b50d to a658723 Compare August 7, 2026 05:55
@ralph-bitgo
ralph-bitgo Bot force-pushed the ashutosh/SI-1171-claim-root-with-hotkey-pt2 branch from a658723 to d93153f Compare August 7, 2026 05:55
@bitgo-ai-agent-dev

Copy link
Copy Markdown
Contributor Author

Superseded by #9448 — all changes merged into a single PR as requested.

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