# Pair

## Transaction

### Provide liquidity

Send user's assets to SecretSwap contract and provide liquidity.

Assets can be both SNIP20 and native tokens. It can be distinguished with the key under `info.token` or `info.native_token`.&#x20;

```javascript
{
  "provide_liquidity": {
    "assets": [
      {
        "info": {
          "token": {
            "contract_addr": "<HumanAddr>",
            "token_code_hash": "<HASH>",
            "viewing_key": "" // empty
          }
        },
        "amount": "10"
      },
      {
        "info": {
          "native_token": {
            "denom": "uscrt"
          }
        },
        "amount": "10"
      }
    ],
    "slippage_tolerance": 0.1 // optinonal
  }
}
```

{% hint style="info" %}
For SNIP20 assets, you first have to set an allowance for the pair to spend the token.
{% endhint %}

{% hint style="info" %}
For SCRT, you have to send the SCRT amount to the `provide_liquidity` contract call.&#x20;
{% endhint %}

### Swap

Swap between the given two tokens. `offer_asset` is your source asset and `to` is your destination token contract.

```javascript
{
  "swap": {
    "offer_asset": {
      "info": {
        "native_token": {
          "denom": "uluna"
        }
      },
      "amount": "10"
    },
    "expected_return": "13", // optional
    "belief_price": 0.1, // optional
    "max_spread": 0.1, // optional
    "to": "<HumanAddr>" // optional
  }
}
```

```javascript
{
  "swap": {
    "offer_asset": {
      "info": {
        "token": {
          "contract_addr": "<HumanAddr>",
          "token_code_hash": "<HASH>",
          "viewing_key": "" // empty
        }
      },
      "amount": "10"
    },
    "expected_return": "13", // optional
    "belief_price": 0.1, // optional
    "max_spread": 0.1, // optional
    "to": "<HumanAddr>" // optional
  }
}
```

## Query

### Pool

```javascript
{
  "pool": {}
}
```

### Simulation

```javascript
{
  "simulation": {
    "offer_asset": {
      "info": {
        "token": {
          "contract_addr": "<HumanAddr>",
          "token_code_hash": "<HASH>",
          "viewing_key": "" // empty
        }
      },
      "amount": "10"
    }
  }
}
```

### Reverse Simulation

```javascript
{
  "reverse_simulation": {
    "ask_asset": {
      "info": {
        "token": {
          "contract_addr": "<HumanAddr>",
          "token_code_hash": "<HASH>",
          "viewing_key": "" // empty
        }
      },
      "amount": "10"
    }
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.secretswap.net/developer-guide/pair.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
