Skip to main content

Withdraw

Withdraw assets from a DeFi yield position back to the sub-account’s wallet.

Steps

1. Create the withdraw plan

const plan = await client.plan.withdraw(account.external_id, {
  amount: "500000",    // 0.5 USDC
  asset: "USDC",
  network: "base",
  protocol: "compound",
});

2. Sign and execute

The flow is identical to earn — sign the digest and call execute. See Plan-Sign-Execute.

3. Monitor

The resulting activity will have action_type: "COMET_WITHDRAW" (for Compound) in its metadata.