SecretSwap
Search…
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.
1
{
2
"provide_liquidity": {
3
"assets": [
4
{
5
"info": {
6
"token": {
7
"contract_addr": "<HumanAddr>",
8
"token_code_hash": "<HASH>",
9
"viewing_key": "" // empty
10
}
11
},
12
"amount": "10"
13
},
14
{
15
"info": {
16
"native_token": {
17
"denom": "uscrt"
18
}
19
},
20
"amount": "10"
21
}
22
],
23
"slippage_tolerance": 0.1 // optinonal
24
}
25
}
Copied!
For SNIP20 assets, you first have to set an allowance for the pair to spend the token.
For SCRT, you have to send the SCRT amount to the provide_liquidity contract call.

Swap

Swap between the given two tokens. offer_asset is your source asset and to is your destination token contract.
1
{
2
"swap": {
3
"offer_asset": {
4
"info": {
5
"native_token": {
6
"denom": "uluna"
7
}
8
},
9
"amount": "10"
10
},
11
"expected_return": "13", // optional
12
"belief_price": 0.1, // optional
13
"max_spread": 0.1, // optional
14
"to": "<HumanAddr>" // optional
15
}
16
}
Copied!
1
{
2
"swap": {
3
"offer_asset": {
4
"info": {
5
"token": {
6
"contract_addr": "<HumanAddr>",
7
"token_code_hash": "<HASH>",
8
"viewing_key": "" // empty
9
}
10
},
11
"amount": "10"
12
},
13
"expected_return": "13", // optional
14
"belief_price": 0.1, // optional
15
"max_spread": 0.1, // optional
16
"to": "<HumanAddr>" // optional
17
}
18
}
Copied!

Query

Pool

1
{
2
"pool": {}
3
}
Copied!

Simulation

1
{
2
"simulation": {
3
"offer_asset": {
4
"info": {
5
"token": {
6
"contract_addr": "<HumanAddr>",
7
"token_code_hash": "<HASH>",
8
"viewing_key": "" // empty
9
}
10
},
11
"amount": "10"
12
}
13
}
14
}
Copied!

Reverse Simulation

1
{
2
"reverse_simulation": {
3
"ask_asset": {
4
"info": {
5
"token": {
6
"contract_addr": "<HumanAddr>",
7
"token_code_hash": "<HASH>",
8
"viewing_key": "" // empty
9
}
10
},
11
"amount": "10"
12
}
13
}
14
}
Copied!
Last modified 6mo ago