Skip to content

feat(hbar): add stakedAccountId support to AccountUpdateBuilder#8948

Merged
Doddanna17 merged 1 commit into
masterfrom
SI-768-hbar-staked-account-id
Jun 5, 2026
Merged

feat(hbar): add stakedAccountId support to AccountUpdateBuilder#8948
Doddanna17 merged 1 commit into
masterfrom
SI-768-hbar-staked-account-id

Conversation

@Doddanna17

Copy link
Copy Markdown
Contributor

Summary

  • Add stakedAccountId support to HBAR AccountUpdateBuilder for account-level indirect staking (Phase 2)
  • Leverages protobuf oneof staked_id field -- setting stakedAccountId auto-clears stakedNodeId and vice versa
  • Validates mutual exclusivity: exactly one of stakedNodeId or stakedAccountId must be set
  • Sentinel value 0.0.0 clears account staking (parallels -1 for node unstaking)

Changes

  • accountUpdateBuilder.ts: New stakedAccountId() method, updated initBuilder/buildImplementation/validateMandatoryFields
  • iface.ts: Added stakedAccountId to AccountUpdateInstruction interface
  • transaction.ts: Updated getAccountUpdateData() to extract stakedAccountId using oneOf discriminator
  • accountUpdateBuilder.ts (test): 7 new tests covering stake-to-account, unstake sentinel, mutual exclusivity, round-trip

Test plan

  • All 21 account update builder tests pass (14 existing + 7 new)
  • Full unit test suite passes (153 passing)
  • Lint and prettier checks pass via pre-commit hooks
  • CI pipeline passes

Ticket: SI-768

@linear-code

linear-code Bot commented Jun 5, 2026

Copy link
Copy Markdown

SI-768

@Doddanna17 Doddanna17 force-pushed the SI-768-hbar-staked-account-id branch 2 times, most recently from 8aba978 to a91c175 Compare June 5, 2026 02:53
Add account-level indirect staking support to the HBAR
AccountUpdateBuilder. This enables staking to another account
(not just consensus nodes) via the CryptoUpdateTransactionBody
protobuf's oneof staked_id field.

Changes:
- Add stakedAccountId field and method to AccountUpdateBuilder
- Update initBuilder to read stakedAccountId from proto using
  oneOf discriminator
- Update buildImplementation to set stakedAccountId on proto
- Update validateMandatoryFields to require either stakedNodeId
  OR stakedAccountId (mutually exclusive)
- Update transaction getAccountUpdateData to extract
  stakedAccountId from proto
- Add stakedAccountId to AccountUpdateInstruction interface
- Add tests for stake-to-account, unstake sentinel (0.0.0),
  mutual exclusivity, round-trip serialization

Ticket: SI-768
@Doddanna17 Doddanna17 force-pushed the SI-768-hbar-staked-account-id branch from a91c175 to 0c292c3 Compare June 5, 2026 03:35
@Doddanna17 Doddanna17 marked this pull request as ready for review June 5, 2026 04:55
@Doddanna17 Doddanna17 requested a review from a team as a code owner June 5, 2026 04:55
@Doddanna17 Doddanna17 merged commit 142d72d into master Jun 5, 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