POST
/
v1
/
uniswap
/
swap
/
buy_exactly
Python (SDK)
from compass_api_sdk import CompassAPI, models


with CompassAPI(
    api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:

    res = compass_api.uniswap_v3.uniswap_swap_buy_exactly(token_in=models.TokenEnum.WETH, token_out=models.TokenEnum.WETH, fee=models.FeeEnum.ONE_DOT_0, amount_out=1.5, max_slippage_percent=0.5, chain=models.UniswapBuyExactlyRequestChain.ARBITRUM, sender="0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B")

    # Handle response
    print(res)
{
  "transaction": {
    "chainId": 123,
    "data": "<string>",
    "from": "<string>",
    "gas": 123,
    "to": "<string>",
    "value": 123,
    "nonce": 123,
    "maxFeePerGas": 123,
    "maxPriorityFeePerGas": 123
  },
  "amount_in_quote": "<string>"
}

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Body

application/json

Request model for buying an exact amount of tokens.

Response

200
application/json

Successful Response

The response is of type object.