0

I can get quote from ethereum mainnet using this GET api call, the token are WETH and DAI

https://api.0x.org/swap/v1/quote?sellToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&buyToken=0x6b175474e89094c44da98b954eedeac495271d0f&sellAmount=100000000000000000

If I modify the contract addresses for WETH and DAI on Polygon chain

https://api.0x.org/swap/v1/quote?sellToken=0x7ceb23fd6bc0add59e62ac25578270cff1b9f619&buyToken=0x8f3cf7ad23cd3cadbd9735aff958023239c6a063&sellAmount=100000000000000000

I get an error, I have played around with sellAmount, it does not help

{
    "code": 100,
    "reason": "Validation Failed",
    "validationErrors": [
        {
            "field": "sellAmount",
            "code": 1004,
            "reason": "INSUFFICIENT_ASSET_LIQUIDITY"
        }
    ]
}

This blogpost also confirms that 0x does support Polygon. So what am I missing from the API call?

1 Answer 1

1

Found it

Prefix the chain name to the domain, in this case https://polygon.api.0x.org/

So this query will become

https://polygon.api.0x.org/swap/v1/quote?sellToken=0x7ceb23fd6bc0add59e62ac25578270cff1b9f619&buyToken=0x8f3cf7ad23cd3cadbd9735aff958023239c6a063&sellAmount=10000000000000000000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.