feat(sdk-coin-tao): build claimRootWithHotkey extrinsic from intent - #9448
Open
bitgo-ai-agent-dev[bot] wants to merge 3 commits into
Open
feat(sdk-coin-tao): build claimRootWithHotkey extrinsic from intent#9448bitgo-ai-agent-dev[bot] wants to merge 3 commits into
bitgo-ai-agent-dev[bot] wants to merge 3 commits into
Conversation
Add SubtensorModule.claimRootWithHotkey(hotkey) Substrate extrinsic support across abstract-substrate and sdk-coin-tao. **abstract-substrate:** - Add ClaimRootWithHotkey to MethodNames const - Add ClaimRootWithHotkeyArgs interface ({ hotkey: string }) and include it in TxMethod.args union - Add ClaimRootWithHotkeyTransactionSchema (joi, valid hotkey address) **sdk-coin-tao:** - New ClaimRootBuilder: builds the extrinsic via defineMethod; hotkey() setter, buildTransaction(), fromImplementation(), validate logic - New ClaimRootTransaction: toJson() with hotkey field, loadInputsAndOutputs() populating _outputs, explainTransaction() - New ClaimRootTxData interface in iface.ts - TransactionBuilderFactory: dispatch ClaimRootWithHotkey in getBuilder(), expose getClaimRootBuilder() - Wire TaoClaimRootIntent in tao.ts end-to-end - New testnetV2.ts metadata (specVersion 443) that includes claim_root_with_hotkey; existing testnet.ts unchanged - Unit tests: unsigned/signed build, round-trip from(), factory dispatch, outputs, validation, error paths Implements TaoClaimRootIntent { hotkey, netuid: 0 } → signed, broadcastable extrinsic. P0 blocker for TAO Root Reborn claim feature (blocks SI-1172). Ticket: SI-1171 Session-Id: ab70e181-1628-4e73-9662-8ef3fe0426ba Task-Id: 091af7ce-ed42-4177-9ee0-2231917f41fa
Two correctness bugs identified by post-commit review:
1. ClaimRootTransaction.loadInputsAndOutputs() used push() without
resetting _outputs/_ inputs first. The base TransactionBuilder calls
loadInputsAndOutputs() on every build(), so repeated build() calls
accumulated duplicate entries in _outputs. Fixed by resetting both
arrays at the top of the method before delegating to super and
before any push — consistent with how the base Transaction class
handles Send/Staking paths via assignment.
2. Tao.verifyTransaction() compared txParams.type with the string
literal 'StakingClaim' using strict equality. WalletPlatform delivers
intentType as lowercase ('stakingclaim'), causing the bypass to be
skipped and execution to fall through to super.verifyTransaction()
which accesses _to/_amount (absent on ClaimRootBuilder) and throws
'missing recipients in txParams' for a valid claim transaction.
Fixed with toLowerCase() comparison.
Also strengthen tests: add case-insensitive lowercase test for
verifyTransaction and assert explanation.fee.fee value (tip=0 fallback).
Ticket: SI-1171
Session-Id: ab70e181-1628-4e73-9662-8ef3fe0426ba
Task-Id: 091af7ce-ed42-4177-9ee0-2231917f41fa
Contributor
ralph-bitgo
Bot
force-pushed
the
ashutosh/SI-1171-claim-root-with-hotkey
branch
from
August 7, 2026 07:23
ddbdb42 to
7f0f587
Compare
Prettier requires the template literal arguments to InvalidTransactionError to be on a single line when they fit within the print-width limit. The two throw statements in validateFields() and validateDecodedTransaction() were wrapped across three lines, causing the format and lint CI jobs to fail. Ticket: SI-1171 Session-Id: 82fbe26f-d2ca-43d9-9639-9c8f2b2891c2 Task-Id: 1a8e194e-1dbd-4e6e-ab11-445d93b59dbe
ralph-bitgo
Bot
force-pushed
the
ashutosh/SI-1171-claim-root-with-hotkey
branch
from
August 7, 2026 08:34
cf99084 to
c4e893b
Compare
bitgo-ai-agent-dev
Bot
force-pushed
the
ashutosh/SI-1171-claim-root-with-hotkey
branch
from
August 7, 2026 08:34
c4e893b to
8b843b8
Compare
ashutoshkumar-6
marked this pull request as ready for review
August 7, 2026 09:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ClaimRootWithHotkeytoMethodNamesconst, addClaimRootWithHotkeyArgsinterface ({ hotkey: string }) toiface.tsTxMethod.args union, addClaimRootWithHotkeyTransactionSchemajoi schemaClaimRootBuilder— buildsSubtensorModule.claimRootWithHotkey(hotkey)extrinsic viadefineMethod; implementshotkey()setter,buildTransaction(),fromImplementation(),validateTransaction(),validateDecodedTransaction()ClaimRootTransaction— overridestoJson()(addshotkeyfield),loadInputsAndOutputs()(populates_outputswith hotkey address, resets arrays before repopulating),explainTransaction()ClaimRootTxDatainterface iniface.tsTransactionBuilderFactory— registerClaimRootWithHotkeydispatch ingetBuilder()and exposegetClaimRootBuilder()Tao.verifyTransactionoverride — short-circuits forStakingClaimtype (case-insensitive) before the parent tries to access_to/_amountwhich don't exist onClaimRootBuildersrc/resources/testnetV2.ts— Bittensor testnet metadata (specVersion 443) that includesclaim_root_with_hotkey; existingtestnet.ts(specVersion 224) unchangedTaoClaimRootIntent { hotkey, netuid: 0 }end-to-end intao.tsfrom(), factory dispatch, outputs content,loadInputsAndOutputsnull-safety,explainTransaction, validation, error paths,verifyTransactionwith both PascalCase and lowercase typeWhy
sdk-coin-taoto acceptTaoClaimRootIntent { hotkey, netuid: 0 }and produce a signed, broadcastableSubtensorModule.claimRootWithHotkeyextrinsic. This is a P0 blocker for the TAO Root Reborn claim feature and directly blocks SI-1172 ([WP] RouteCLAIM_REWARDSrequest type for tao/ttao)Test plan
mocha— 93 passing, 2 pending, 1 pre-existing failure (requiresBITGOJS_TEST_PASSWORD)sdk-coin-taoandabstract-substratecompile cleanloadInputsAndOutputsresets_outputs/_inputsbefore push — idempotent on repeatedbuild()callsverifyTransactionuses case-insensitive comparison — handles WalletPlatform lowercase'stakingclaim'intentTypeTicket: SI-1171