Skip to content

feat(sdk-coin-vet): add FlushCoins transaction support for VeChain#9172

Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
coins-611-vet-flush-coins-main-address
Draft

feat(sdk-coin-vet): add FlushCoins transaction support for VeChain#9172
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
coins-611-vet-flush-coins-main-address

Conversation

@bitgo-ai-agent-dev

Copy link
Copy Markdown

What

  • Add FlushCoinsTransaction class to sdk-coin-vet — handles the flush() (selector 0x6b9f96ea) contract call that sweeps native VET from a v4 forwarder to the wallet's main address
  • Add FlushCoinsTransactionBuilder that encodes flushCoinsData() (the parameterless flush() ABI call) and validates the resulting clause
  • Extend getTransactionTypeFromClause() in utils.ts to recognize the 0x6b9f96ea selector as TransactionType.FlushCoins
  • Wire FlushCoins into TransactionBuilderFactory.from() so signed flush-coins transactions can be deserialized
  • Export both new classes from lib/index.ts
  • Add tests covering builder construction, toJson, signable payload, raw-tx serialization, clause-type detection, and invalid-input rejection

Why

  • The VeChain module (sdk-coin-vet) was unable to flush native VET funds from forwarder addresses to the main wallet address. The consolidation path calls the parameterless flush() function (ABI selector 0x6b9f96ea) on v4 forwarder contracts, but the module had no FlushCoins transaction class, no corresponding builder, and getTransactionTypeFromClause() did not recognize the selector — causing the build and validation path to fail entirely.
  • FlushTokens (ERC-20 token flush) was already supported; this adds the parallel native-coin flush capability.

Test plan

  • npx mocha --require tsx test/transactionBuilder/flushCoinsTransactionBuilder.ts — 6 new FlushCoins tests pass
  • npx mocha --require tsx test/unit/utils.tsgetTransactionTypeFromClause correctly returns FlushCoins for a 0x6b9f96ea clause
  • All 39 pre-existing transaction builder tests continue to pass
  • npx tsc --noEmit --skipLibCheck — no TypeScript errors in the module

Ticket: COINS-611

Add missing FlushCoins transaction type to the sdk-coin-vet module.
Flushing native VET coins from a forwarder to the main wallet address
was broken because the VeChain module had no FlushCoins transaction
class, no corresponding builder, and getTransactionTypeFromClause()
did not recognize the flush() method selector (0x6b9f96ea).

The platform's consolidation path calls the parameterless flush()
ABI function on v4 forwarder contracts, which encodes to selector
0x6b9f96ea. Without this support, those transactions could not be
built, validated, or round-tripped through the factory, making it
impossible to flush VET funds to the main wallet address.

- Add FlushCoinsTransaction class mirroring FlushTokenTransaction
- Add FlushCoinsTransactionBuilder that encodes flushCoinsData()
- Recognize 0x6b9f96ea selector in getTransactionTypeFromClause()
- Wire FlushCoins case into TransactionBuilderFactory.from()
- Export new classes from lib/index.ts
- Add unit tests for clause detection and builder behavior

Ticket: COINS-611
Session-Id: 3ad67a90-935c-4b38-9c6b-d7bc96ac7cc9
Task-Id: 3183f576-f5f6-4490-8be2-7a612f7e86df
@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the coins-611-vet-flush-coins-main-address branch from e09ffcf to c2798af Compare July 2, 2026 14:42
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.

0 participants