> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Unwrap SOL

Close the workflow wallet's canonical WSOL Associated Token Account and return its complete balance as native SOL. All-balance only; never run automatically after protocol actions.

![Unwrap SOL logo](https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png)
Catalog action Solana Onchain wallet Gas swap

Close the workflow wallet's canonical WSOL Associated Token Account and return its complete balance as native SOL. All-balance only; never run automatically after protocol actions.

**Review wallet and value movement**

This action can require a wallet connector, gas, token movement, or an external side effect. Test with simulation or a controlled amount before using it in a live workflow.

## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `unwrap-sol` |
| Category | Solana Onchain |
| Connector | `wallet` |
| Requires gas | Yes |
| Funds movement | `swap` |
| Tags | `blockchain`, `solana`, `sol`, `unwrap`, `token`, `write` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `chainId` | `number` | Yes | Solana Mainnet chain ID. |
| `amountMode` | `string` | Yes | Close the complete canonical WSOL ATA balance. Partial unwrap is not supported. |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `string` | Yes | - |
| `signature` | `string` | Yes | Solana transaction signature. |
| `transactionHash` | `string` | Yes | Solana transaction signature for workflow audit trails. |
| `txStatus` | `string` | No | - |
| `chainId` | `number` | Yes | - |
| `owner` | `string` | Yes | - |
| `wsolAta` | `string` | Yes | - |
| `wsolMint` | `string` | Yes | - |
| `rawWsolUnwrapped` | `string` | Yes | Preflight projection of the canonical ATA's complete WSOL balance before signing. External deposits can change the final close amount. |
| `formattedWsolUnwrapped` | `string` | Yes | - |
| `rawSolReceived` | `string` | Yes | Preflight projection of SOL returned by CloseAccount, including WSOL balance, rent, and observed unsynced lamports. External deposits can change the final amount. |
| `formattedSolReceived` | `string` | Yes | - |
| `decimals` | `number` | No | - |
| `rentReturnedLamports` | `string` | No | ATA rent returned to the wallet by CloseAccount. |
| `formattedRentReturned` | `string` | No | - |
| `unsyncedLamportsReturned` | `string` | No | Pre-existing unsynced lamports in the canonical ATA returned by CloseAccount. |
| `formattedUnsyncedLamportsReturned` | `string` | No | - |
| `modeledFeeLamports` | `string` | No | Modeled network fee bound used before wallet signing. |
| `formattedModeledFee` | `string` | No | - |
| `projectedSolDeltaLamports` | `string` | No | - |
| `projectedWsolDeltaLamports` | `string` | No | - |
| `actualSolDeltaLamports` | `string` | No | - |
| `actualWsolDeltaLamports` | `string` | No | - |
| `preSolLamports` | `string` | No | Observed native SOL balance before signing. |
| `postSolLamports` | `string` | No | Observed native SOL balance after confirmation. |
| `preWsolRaw` | `string` | No | Observed canonical WSOL ATA token balance before signing. |
| `postWsolRaw` | `string` | No | Observed canonical WSOL ATA token balance after confirmation. |
| `computeUnitLimit` | `number` | No | - |
| `unitsConsumed` | `number` | No | - |
| `priorityFeeMicroLamports` | `number` | No | - |
| `slot` | `number` | No | - |
| `confirmationSlot` | `number` | No | - |
| `simulationState` | `string` | Yes | - |
| `simulationLogs` | `array` | No | - |
| `simulated` | `boolean` | Yes | - |
| `observationStatus` | `string` | No | - |
| `observationError` | `string` | No | - |

## Examples

**Workflow node**

```json
{
  "type": "unwrap-sol",
  "payload": {
    "chainId": 7565164,
    "amountMode": "all"
  },
  "children": [],
  "connector": {
    "type": "wallet",
    "id": "conn_wallet"
  }
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/unwrap-sol/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "chainId": 7565164,
    "amountMode": "all"
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.