Skip to content

feat(stnear): adding support for metapool withdraw_all txn builder#8199

Merged
aditya-bitgo merged 1 commit intomasterfrom
SC-5580
Feb 25, 2026
Merged

feat(stnear): adding support for metapool withdraw_all txn builder#8199
aditya-bitgo merged 1 commit intomasterfrom
SC-5580

Conversation

@aditya-bitgo
Copy link
Contributor

ticket: SC-5580

Copy link
Contributor

@Doddanna17 Doddanna17 left a comment

Choose a reason for hiding this comment

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

MetaPoolWithdrawBuilder duplicates significant portions of StakingWithdrawBuilder (constructor, initBuilder, gas, buildImplementation). Consider extending the existing builder with a validateArgs hook -- see inline suggestion.

explainStakingWithdrawTransaction returns outputAmount: '0' for withdraw_all since the amount is resolved on-chain. Acceptable trade-off, but downstream consumers should be aware.

Factory routing, transaction type mapping, and input/output handling are all correct. LIQUID_STAKING addition to stnear tokens is appropriate.

Tests are comprehensive: signed/unsigned builds, round-trips, routing verification, error case. LGTM.

Copy link
Contributor

@Doddanna17 Doddanna17 left a comment

Choose a reason for hiding this comment

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

Hey @aditya-bitgo, the refactoring looks clean -- the 17-line MetaPoolWithdrawBuilder extending StakingWithdrawBuilder with the validateArgs hook is exactly the right pattern.

One small thing: MetaPoolWithdrawBuilder inherits the public amount() method from StakingWithdrawBuilder. Since validateArgs is a no-op here, calling .amount('...') on a MetaPoolWithdrawBuilder would silently set args on a withdraw_all call without any error. Nothing calls it today, but an override that throws would prevent accidental misuse:

public amount(_amount: string): this {
  throw new BuildTransactionError('amount is not applicable for withdraw_all');
}

Rest looks solid. LGTM with that minor addition.

Copy link
Contributor

@Doddanna17 Doddanna17 left a comment

Choose a reason for hiding this comment

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

All feedback addressed -- amount() override with throw, validateArgs parameter signature, and test for the rejection case. Clean inheritance pattern, comprehensive tests. LGTM.

@aditya-bitgo aditya-bitgo merged commit 025dd39 into master Feb 25, 2026
32 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