> For the complete documentation index, see [llms.txt](https://docs.oswap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oswap.io/protocol/pair/swap.md).

# Swap

Exchange an asset to another.

### **Arguments**

* **Send one paired asset** `output` *required*
* **to** `data` *optional*\
  Define the receiver address.
* **to\_aa** `data` *optional*

  Define the address of an AA to send it to after swap (used to do multiple swap in a single request).
* **amount\_out\_in** `data` *optional*

  Define an amount minimum to receive from the swap, if the amount to receive is lower than the amount set the unit will be bounced.
* **deadline** `data` *optional*

  Define a timestamp, the request will be bounced if deadline expired.

### **Example**

```javascript
{
  trigger: {
    outputs: {
      base: 10000,
      'WhsD5Y/1NeKROgQojGwfe9EBC7NH4KnAk4CorCrVRhs=': 200000
    }
  }
}
```

### Retur**ns**

```javascript
{
  responseVars: {
    type: 'swap',
    asset0_amount: 42000
  }
}
```
