Skip to content

fix(sdk-core): populate recipients in buildTokenEnablements for TSS wallets#8979

Merged
nvrakesh06 merged 1 commit into
masterfrom
fix/near-tss-token-enablement-missing-recipients
Jun 10, 2026
Merged

fix(sdk-core): populate recipients in buildTokenEnablements for TSS wallets#8979
nvrakesh06 merged 1 commit into
masterfrom
fix/near-tss-token-enablement-missing-recipients

Conversation

@nvrakesh06

@nvrakesh06 nvrakesh06 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bug: Enabling a NEAR token on a TSS/MPC hot wallet failed with "Error on token enablements: missing token name in transaction parameters"
  • Root cause: buildTokenEnablements in wallet.ts had two paths — the non-TSS path correctly mapped enableTokens → recipients (with tokenName) before calling prebuildTransaction, but the TSS path skipped this and called prebuildTransaction directly. When verifyTransaction later ran with txParams = { ...txPrebuild.buildParams, ...params }, txParams.recipients was undefined, causing near.ts:validateRawReceiver to throw
  • Fix: The TSS path now also maps enableTokens → recipients before calling prebuildTransaction. Unlike non-TSS, enableTokens is kept (not deleted) since the server needs it to build the enableToken intent
  • History: Gap introduced in dde3a952b4 (Aug 2022, "add enable token support for sol") and lay dormant until 21500242aa (Sep 2025, "token enablement transaction validation") added validation that read txParams.recipients[0].tokenName. The existing TSS tests passed because they manually hardcoded recipients in txParams instead of using txPrebuild.buildParams

Linear

CECHO-1296

Files changed

  • modules/sdk-core/src/bitgo/wallet/wallet.ts — populate recipients in the TSS branch of buildTokenEnablements
  • modules/sdk-coin-near/test/unit/tokenEnablementValidation.ts — regression test that exercises the real production path (txParams = { ...txPrebuild.buildParams }) rather than manually constructing txParams with recipients

Test plan

  • New regression test: should populate recipients from enableTokens in buildParams for TSS wallets — verifies txPrebuild.buildParams.recipients[0].tokenName is set, then calls verifyTransaction using buildParams as txParams (mirroring the production flow)
  • Existing TSS token enablement tests continue to pass
  • Existing non-TSS token enablement tests unaffected (no changes to the else branch)

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Jun 10, 2026

Copy link
Copy Markdown

CECHO-1296

…allets

TSS wallets were missing `buildParams.recipients` after `buildTokenEnablements`
because the TSS branch only called `prebuildTransaction(buildParams)` without
first mapping `enableTokens → recipients`. The non-TSS branch correctly did this
mapping. When `verifyTransaction` runs (`txParams = { ...txPrebuild.buildParams,
...params }`), `txParams.recipients` was undefined, causing `validateRawReceiver`
in near.ts to throw "missing token name in transaction parameters".

Unlike the non-TSS path, `enableTokens` is kept on `buildParams` for TSS since
the server needs it to build the enableToken intent.

Adds a regression test that exercises the real production call path —
using `txPrebuild.buildParams` as `txParams` — which is what the existing
TSS tests failed to do.

TICKET: WP-5782

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@nvrakesh06 nvrakesh06 force-pushed the fix/near-tss-token-enablement-missing-recipients branch from ee4051e to 6fc31f6 Compare June 10, 2026 03:33
@nvrakesh06 nvrakesh06 marked this pull request as ready for review June 10, 2026 04:01
@nvrakesh06 nvrakesh06 requested review from a team as code owners June 10, 2026 04:01
@nvrakesh06 nvrakesh06 merged commit b7ff4c7 into master Jun 10, 2026
22 checks passed
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.

2 participants