-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: trading API #98
base: main
Are you sure you want to change the base?
Conversation
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
…rading-sdk # Conflicts: # apps/twap/src/app/utils/getApiBaseUrl.ts # apps/twap/src/app/utils/getConditionalOrderId.ts # libs/repositories/src/const.ts # libs/repositories/src/datasources/viem.ts # package.json # yarn.lock
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.
I don't feel too strong, cause I also don't like my suggestions for the naming, but I tried to get rid of verbs and use a more RESTful naming convention
In our case it sucks a bit we need to use POST
for methods that would feel more semantic with GET
, but we are limited by the parameters we can pass, so I added the -request
suffix to some of them. As I said, I don't love my proposal either, maybe someone else or chat gpt can give you better inspiration.
Anyways, the relevant part of this PR is APPROVEd. I just feel this API would be extremely useful for 3rd parties. It just makes integration 10x easier!
POST /trading/quote-requests - Request a new quote for placing an order
POST /trading/sell-native-currency-requests - returns a transaction details for selling native currency
POST /trading/orders - send an order to the order-book
appDataInfo | ||
}) | ||
|
||
// ACTION NEEDED: Send <preSignTransaction> from smart-contract wallet |
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.
Why not adding the code to send the TX onhcain?
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.
It very depends on a smart-contract wallet implementation.
With Safe it requires a lot of code here.
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.
For Safe you can go to Transaction build and put the tx data there
README https://github.com/cowprotocol/bff/blob/feat/trading-sdk/apps/api/src/app/routes/trading/README.md
/trading
API provides a convenient way to use CoW Protocol.Essencially this API is a facade on top of cowprotocol/cow-sdk#213.