Skip to content

Instantly share code, notes, and snippets.

@jmcph4
Created August 4, 2023 00:33
Show Gist options
  • Select an option

  • Save jmcph4/28c561336cbdbc9968a128cdc320ab37 to your computer and use it in GitHub Desktop.

Select an option

Save jmcph4/28c561336cbdbc9968a128cdc320ab37 to your computer and use it in GitHub Desktop.
curl -H "0x-api-key: 5377b882-05cf-4814-a66d-102a86974012" "https://api.0x.org/swap/v1/quote?sellAmount=1000000000&buyToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&sellToken=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" | jq
{
"chainId": 1,
"price": "2000",
"guaranteedPrice": "2000",
"estimatedPriceImpact": "0",
"to": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"data": "0x415565b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000006a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000039aa39c021dfbae8fac545936693ac917d5e75630000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000442616c616e6365720000000000000000000000000000000000000000000000000000000000000000000000003b9aca000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002aa3041fe813cfe572969216c6843c33f14f91940000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000039aa39c021dfbae8fac545936693ac917d5e7563000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000240ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000003556e6973776170000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c0a47dfe034b400b47bdad5fecda2621de6c4d95000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000039aa39c021dfbae8fac545936693ac917d5e7563000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000000869584cd00000000000000000000000010000000000000000000000000000000000000110000000000000000000000000000000000000000000000c58be1fd5f64cc3ed3",
"value": "0",
"gas": "286000",
"estimatedGas": "286000",
"gasPrice": "24500000000",
"protocolFee": "0",
"minimumProtocolFee": "0",
"buyTokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"sellTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"buyAmount": "2",
"sellAmount": "1000000000",
"sources": [
{
"name": "0x",
"proportion": "0"
},
{
"name": "Uniswap",
"proportion": "0"
},
{
"name": "Uniswap_V2",
"proportion": "0"
},
{
"name": "Curve",
"proportion": "0"
},
{
"name": "Balancer",
"proportion": "0"
},
{
"name": "Balancer_V2",
"proportion": "0"
},
{
"name": "BancorV3",
"proportion": "0"
},
{
"name": "SushiSwap",
"proportion": "0"
},
{
"name": "DODO",
"proportion": "0"
},
{
"name": "DODO_V2",
"proportion": "0"
},
{
"name": "CryptoCom",
"proportion": "0"
},
{
"name": "Lido",
"proportion": "0"
},
{
"name": "MakerPsm",
"proportion": "0"
},
{
"name": "KyberDMM",
"proportion": "0"
},
{
"name": "Saddle",
"proportion": "0"
},
{
"name": "Uniswap_V3",
"proportion": "0"
},
{
"name": "Curve_V2",
"proportion": "0"
},
{
"name": "ShibaSwap",
"proportion": "0"
},
{
"name": "Synapse",
"proportion": "0"
},
{
"name": "Synthetix",
"proportion": "0"
},
{
"name": "Aave_V2",
"proportion": "0"
},
{
"name": "Compound",
"proportion": "0"
},
{
"name": "KyberElastic",
"proportion": "0"
},
{
"name": "MultiHop",
"proportion": "1",
"intermediateToken": "0x39aa39c021dfbae8fac545936693ac917d5e7563",
"hops": [
"Balancer",
"Uniswap"
]
}
],
"orders": [
{
"type": 0,
"source": "Balancer",
"makerToken": "0x39aa39c021dfbae8fac545936693ac917d5e7563",
"takerToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"makerAmount": "0",
"takerAmount": "1000000000",
"fillData": {
"poolAddress": "0x2aa3041fe813cfe572969216c6843c33f14f9194"
},
"fill": {
"input": "1000000000",
"output": "0",
"adjustedOutput": "0",
"gas": 1
}
},
{
"type": 0,
"source": "Uniswap",
"makerToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"takerToken": "0x39aa39c021dfbae8fac545936693ac917d5e7563",
"makerAmount": "2",
"takerAmount": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
"fillData": {
"router": "0xc0a47dfe034b400b47bdad5fecda2621de6c4d95"
},
"fill": {
"input": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
"output": "2",
"adjustedOutput": "2",
"gas": 1
}
}
],
"allowanceTarget": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"decodedUniqueId": "c58be1fd5f-1691107027",
"sellTokenToEthRate": "1",
"buyTokenToEthRate": "1834.15664",
"fees": {
"zeroExFee": null
},
"grossPrice": "2000",
"grossBuyAmount": "2",
"grossSellAmount": "1000000000",
"auxiliaryChainData": {},
"expectedSlippage": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment