cpu_withdraw
Convert a cell's wCPU into on-chain $CPU at 1:1, sending tokens to your wallet. Handles partial withdrawals when the emission budget is limited; sell the cell only after withdrawing.
Instructions
Cash out a cell’s wCPU (resource id 1, the CPU Forge output) to the on-chain $CPU token in your wallet, 1:1 (needs a session — cpu_authenticate first; you must own the cell). Pass the amount in whole wCPU units up to the cell’s wCPU balance; it debits the cell and mints $CPU to your wallet (no approve needed). If the on-chain $CPU emission budget cannot cover the full amount, only a partial tranche executes — up to what remains — and the rest stays in the cell; the result reports the requested and executed amounts separately. Waits for confirmation and returns the tx hash — check the result with cpu_get_balance. wCPU lives on the cell, so selling or transferring the cell takes it along: withdraw before you sell.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | How much wCPU (resource id 1) to convert to on-chain $CPU, 1:1, in whole units (e.g. "100"). Must be greater than 0 and at most the cell’s wCPU balance. See it with get_cell. | |
| tokenId | Yes | The tokenId of a cell you own holding wCPU to cash out. |