feat(sdk-coin-vet): add FlushCoins transaction support for VeChain#9172
Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Draft
feat(sdk-coin-vet): add FlushCoins transaction support for VeChain#9172bitgo-ai-agent-dev[bot] wants to merge 1 commit into
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Conversation
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
e09ffcf to
c2798af
Compare
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
FlushCoinsTransactionclass tosdk-coin-vet— handles theflush()(selector0x6b9f96ea) contract call that sweeps native VET from a v4 forwarder to the wallet's main addressFlushCoinsTransactionBuilderthat encodesflushCoinsData()(the parameterlessflush()ABI call) and validates the resulting clausegetTransactionTypeFromClause()inutils.tsto recognize the0x6b9f96easelector asTransactionType.FlushCoinsFlushCoinsintoTransactionBuilderFactory.from()so signed flush-coins transactions can be deserializedlib/index.tstoJson, signable payload, raw-tx serialization, clause-type detection, and invalid-input rejectionWhy
sdk-coin-vet) was unable to flush native VET funds from forwarder addresses to the main wallet address. The consolidation path calls the parameterlessflush()function (ABI selector0x6b9f96ea) on v4 forwarder contracts, but the module had noFlushCoinstransaction class, no corresponding builder, andgetTransactionTypeFromClause()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 passnpx mocha --require tsx test/unit/utils.ts—getTransactionTypeFromClausecorrectly returnsFlushCoinsfor a0x6b9f96eaclausenpx tsc --noEmit --skipLibCheck— no TypeScript errors in the moduleTicket: COINS-611