-
Notifications
You must be signed in to change notification settings - Fork 54
feat: cowswap executeTrade and getTradeTxs methods #868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few early comments, will give another pass to this after shapeshift/hdwallet#546 is published
packages/swapper/src/swappers/cow/cowBuildTrade/cowBuildTrade.ts
Outdated
Show resolved
Hide resolved
packages/swapper/src/swappers/cow/cowGetTradeTxs/cowGetTradeTxs.ts
Outdated
Show resolved
Hide resolved
packages/swapper/src/swappers/cow/cowGetTradeTxs/cowGetTradeTxs.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested out locally with MM and managed to succesfully trade ERC-20s using the CowSwap swapper 🎉 . Tx is properly populated in Transaction History components on your web branch.
Note that on this branch, accounts without enough ETH for ZRX swaps will error because of hasEnoughBalanceForGas
being false, and I had to use an account with enough ETH for fees, despite Cowswap Txs being gasless.
Irrelevant since the web PR is just for demo purposes, but when making the web PR for this, we'll have to make sure not to get regular ZRX fees estimation / not to handle them in <TradeInput />
in the case of moo swaps
🥛
@gomesalexandre interesting finding, thank you ! |
@gomesalexandre your finding led me to fix an issue related to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after we have cowswap, osmo, thorchain, zrx across eth and avalanche we can revisit and tidy abstractions, but this is good for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tested again with your latest changes and I was able to make a moo swap with your latest changes and I was able to get cowswaps working both with an account that has enough ETH for gas, and an account that doesn't have enough ETH for regular swaps
🐮
# [@shapeshiftoss/chain-adapters-v7.10.0](https://github.com/shapeshift/lib/compare/@shapeshiftoss/chain-adapters-v7.9.0...@shapeshiftoss/chain-adapters-v7.10.0) (2022-07-22) ### Features * cowswap executeTrade and getTradeTxs methods ([#868](#868)) ([b9ce707](b9ce707))
🎉 This PR is included in version @shapeshiftoss/chain-adapters-v7.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [@shapeshiftoss/swapper-v8.6.0](https://github.com/shapeshift/lib/compare/@shapeshiftoss/swapper-v8.5.3...@shapeshiftoss/swapper-v8.6.0) (2022-07-22) ### Features * cowswap executeTrade and getTradeTxs methods ([#868](#868)) ([b9ce707](b9ce707))
🎉 This PR is included in version @shapeshiftoss/swapper-v8.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This implements both methods for
CowSwapper
.This has been tested in web to successfully perform a swap with native wallet, metamask and metamask + ledger
Steps to test :
Swap with native wallet :
Linked TX : https://etherscan.io/tx/0xf7d251e527c19db3ef68063f99c5cd98cb4d86959382e8043303743d23cfb9cf
Swap with metamask :
Linked TX : https://etherscan.io/tx/0xcec287df80d98ce1d42b26f97260d9aea89e7daa551f388622bb4ca02978a049