"MAX" to exit the position entirely.
Earn is currently an Early Access Product. Contact us to enable it for your organization.
Prerequisites
- The
signWithwallet holds a position in the wrapper you are withdrawing from. Get itswrapperAddressfromlist_earn_positions. - The withdrawal amount is at most the position’s
currentValue, or the literal"MAX"for a full exit. - For non-sponsored withdrawals, the
signWithwallet needs the chain’s native token for gas.
Withdrawals are never blocked by a paused wrapper, and sub-organization wallets can withdraw from wrappers deployed by their parent organization. The wrapper configuration lives on the parent, the sub-org wallet signs, and no per-sub-org deployment is needed.
Submit the withdrawal
Submit anACTIVITY_TYPE_EARN_WITHDRAW activity with:
- the
wrapperAddressholding the position, fromlist_earn_positions - the
signWithwallet account to withdraw to and sign with - the
amountValuein raw onchain units of the underlying asset (e.g."500000"for 0.50 USDC), or the literal"MAX"to withdraw the entire position - the CAIP-2 chain in
chainCaip2, and optionallysponsorfor gas sponsorship
withdrawRequestId.
Full exit with MAX
"amountValue": "MAX" redeems the wallet’s exact live share balance in the wrapper, so the position closes completely without leaving dust.
A
MAX withdrawal resets the position’s lifetime accounting: after it confirms, totalDeposited and totalWithdrawn in list_earn_positions start again from zero for that wrapper.Gas: sponsored vs self-funded
Withsponsor: true, network fees are covered through Turnkey’s Gas Station and the withdrawal executes as an EIP-7702 sponsored transaction. The signWith wallet does not need a gas token.
With sponsor: false, the signWith wallet pays gas itself, and the user initiating the withdrawal will need the relevant chain’s gas token.
Poll withdrawal status (required)
Poll with thewithdrawRequestId from the activity result. status is PENDING, COMPLETED, or FAILED; on COMPLETED the response carries the withdrawTxHash, and on FAILED it includes an error field with the reason. See Submissions for general activity semantics.
Next steps
- Track positions to verify the position after withdrawing
- Deposit into a vault to grow a position