Skip to content

feat(sdk-coin-tao): build claimRootWithHotkey extrinsic from intent - #9447

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

feat(sdk-coin-tao): build claimRootWithHotkey extrinsic from intent#9447
bitgo-ai-agent-dev[bot] wants to merge 4 commits into
masterfrom
ashutosh/SI-1171-claim-root-with-hotkey-pt2

Conversation

@bitgo-ai-agent-dev

Copy link
Copy Markdown
Contributor

What

  • Add ClaimRootWithHotkey method name, args interface, and Joi validation schema to @bitgo/abstract-substrate
  • Implement ClaimRootBuilder in sdk-coin-tao that builds a SubtensorModule.claimRootWithHotkey(hotkey) Substrate extrinsic
  • Implement ClaimRootTransaction with toJson(), loadInputsAndOutputs(), and explainTransaction()
  • Wire ClaimRootBuilder into TransactionBuilderFactory (dispatch via getClaimRootBuilder() and from() routing)
  • Override verifyTransaction in Tao to short-circuit recipient validation for StakingClaim type (claim carries no transfer recipient)
  • Export ClaimRootTxData interface from the lib index for downstream consumers
  • Add full unit test suite for ClaimRootBuilder (validation, round-trip, factory dispatch, explanation)
  • Add verifyTransaction tests covering the StakingClaim bypass path

Why

  • Unblocks the claim root feature for TAO staking (P0 blocker per SI-1172)
  • Customers using the staking-service claim flow send TaoClaimRootIntent { hotkey, netuid: 0 }; WalletPlatform must call getClaimRootBuilder() to build and sign the extrinsic before broadcasting
  • The intent type string 'StakingClaim' aligns with the WalletPlatform enum and staking-service contract so the full TSS signing path works end-to-end

Test plan

  • ClaimRootBuilder unit tests: setter validation, unsigned/signed build, round-trip, transaction explanation, factory dispatch, invalid type rejection
  • verifyTransaction tests: StakingClaim type bypasses recipient check, transfer tx with no recipients passes

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
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
@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 a658723 to d93153f Compare August 7, 2026 05:55
@bitgo-ai-agent-dev

Copy link
Copy Markdown
Contributor Author

Closing in favor of PR #9448 which consolidates all changes 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