Skip to content

feat(sdk-core): bulk TRX resource delegation SDK + Express layer#8572

Merged
bhavidhingra merged 1 commit intomasterfrom
chalo-287-bulk-trx-resource-delegation-sdk
May 7, 2026
Merged

feat(sdk-core): bulk TRX resource delegation SDK + Express layer#8572
bhavidhingra merged 1 commit intomasterfrom
chalo-287-bulk-trx-resource-delegation-sdk

Conversation

@bhavidhingra
Copy link
Copy Markdown
Contributor

@bhavidhingra bhavidhingra commented Apr 20, 2026

Summary

Resource Delegation

  • Adds buildResourceDelegations, sendResourceDelegation, sendResourceDelegations to Wallet and IWallet
  • buildResourceDelegations: POSTs to /:coin/wallet/:id/delegateResources/build, post-processes prebuilds
  • sendResourceDelegation: dispatches per wallet type — TSS → sendManyTxRequests, custodial → initiateTransaction, hot → prebuildAndSignTransaction + submitTransaction
  • sendResourceDelegations: validates passphrase, builds all, sends sequentially, collects { success, failure }
  • Adds typed Express route (PostDelegateResources) and handleV2DelegateResources handler with partial-success 202/400 response logic

Resource Undelegation

  • Adds buildResourceUndelegations, sendResourceUndelegation, sendResourceUndelegations to Wallet and IWallet — mirrors delegation API exactly
  • buildResourceUndelegations: POSTs to /:coin/wallet/:id/undelegateResources/build
  • Adds typed Express route (PostUndelegateResources) and handleV2UndelegateResources handler
  • Delegation and undelegation share private helpers (buildResourceManagements, sendResourceManagement, sendResourceManagements) to eliminate code duplication

stakingParams relay

  • Adds stakingParams?: unknown to PrebuildTransactionResult so staking metadata flows from the build response through to submitTransaction, enabling the indexer to identify resource management transfers correctly

Test plan

  • Unit test: buildResourceDelegations / buildResourceUndelegations call the right endpoints and post-process prebuilds
  • Unit test: sendResourceDelegation / sendResourceUndelegation route correctly per wallet type
  • Express: POST /api/v2/ttrx/wallet/:id/delegateResources returns 200/202/400 as appropriate
  • Express: POST /api/v2/ttrx/wallet/:id/undelegateResources returns 200/202/400 as appropriate

Linear: CHALO-287

@bhavidhingra bhavidhingra requested review from a team as code owners April 20, 2026 09:06
@linear
Copy link
Copy Markdown

linear Bot commented Apr 20, 2026

@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch from 496a288 to 5bc64a4 Compare April 20, 2026 10:01
@bhavidhingra
Copy link
Copy Markdown
Contributor Author

@claude review

@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch from 5bc64a4 to 42b5824 Compare April 20, 2026 10:52
@bhavidhingra bhavidhingra marked this pull request as draft April 20, 2026 10:54
@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch 6 times, most recently from 15b4e19 to 5019af4 Compare April 22, 2026 15:09
@pranavjain97
Copy link
Copy Markdown
Contributor

Flush, please request re-review when ready for review.

@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch 3 times, most recently from 982359a to b22a03a Compare April 23, 2026 13:28
@bhavidhingra bhavidhingra marked this pull request as ready for review April 25, 2026 12:20
Copy link
Copy Markdown
Contributor

@pranavjain97 pranavjain97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TSS detection uses coin-level check instead of wallet-level, receiverAddress never populated, and no tests included

Comment thread modules/express/src/clientRoutes.ts
Comment thread modules/express/src/clientRoutes.ts
Comment thread modules/express/src/typedRoutes/api/v2/delegateResources.ts
Comment thread modules/sdk-core/src/bitgo/wallet/wallet.ts Outdated
Comment thread modules/sdk-core/src/bitgo/wallet/wallet.ts
Comment thread modules/sdk-core/src/bitgo/wallet/iWallet.ts
Comment thread modules/sdk-core/src/bitgo/wallet/iWallet.ts
@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch 4 times, most recently from 8d953a5 to bbb4f2e Compare May 4, 2026 07:40
@bhavidhingra bhavidhingra requested a review from a team as a code owner May 4, 2026 07:40
@bhavidhingra bhavidhingra requested a review from pranavjain97 May 4, 2026 08:24
@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch 3 times, most recently from 8494bff to cf7602d Compare May 4, 2026 13:52
@bhavidhingra bhavidhingra dismissed pranavjain97’s stale review May 5, 2026 06:12

Changes done as requested

Copy link
Copy Markdown
Contributor

@MohammedRyaan786 MohammedRyaan786 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

ravibitgo
ravibitgo previously approved these changes May 6, 2026
Comment thread yarn.lock
@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch from cf7602d to b35de40 Compare May 6, 2026 06:16
Comment thread modules/express/src/typedRoutes/api/v2/delegateResources.ts
Adds buildAccountDelegations, sendAccountDelegation, sendAccountDelegations
to the Wallet class and IWallet interface, mirroring the consolidation API.
Adds Express typed route schema and handler for
POST /api/v2/:coin/wallet/:id/delegateResources with TSS/custodial/hot wallet
branching and partial-success (202) response handling.

CHALO-287

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bhavidhingra bhavidhingra dismissed stale reviews from MohammedRyaan786 and ravibitgo via 0819ce1 May 7, 2026 06:47
@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch from b35de40 to 0819ce1 Compare May 7, 2026 06:47
@bhavidhingra bhavidhingra requested a review from a team as a code owner May 7, 2026 06:47
@bhavidhingra bhavidhingra merged commit 18f9f86 into master May 7, 2026
42 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.

7 participants