Created
September 7, 2021 06:30
-
-
Save coffeemug/b6d9821f40fb7cea872ead5b53e54fce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const trade = async () => { | |
const params = { | |
buyToken: 'UNI', | |
sellToken: 'ETH', | |
sellAmount: '100000000000000000', | |
// same failure with slippage commented out | |
slippagePercentage: 0.2, | |
} | |
const res = await axios.get(`https://api.0x.org/swap/v1/quote?${qs.stringify(params)}`); | |
// Submit proposal on chain | |
await ethers.provider.getSigner().sendTransaction(res.data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment