cowprotocol / cow-sdk

CoW protocol SDK
https://docs.cow.fi/cow-protocol/reference/sdks/cow-sdk
Other
31 stars 9 forks source link

Missing type on OrderQuoteSide.kind #134

Closed arodundef closed 1 year ago

arodundef commented 1 year ago

According to your API documentation here. I could use in the getQuote function the OrderKind.SELL or OrderKind.BUY.

But, it is impossible because kind only accepts OrderQuoteSide enum, as in the following image. image

Then, I have to use OrderQuoteSide.kind instead OrderKind.

And there is the second issue

OrderQuoteSide.kind has only SELL enum, not the buy one. So, it's impossible to use OrderQuoteSide.kind.BUY. As the images below: image image

cow-sdk/dist/order-book/generated/models/OrderQuoteSide.d.ts#L2

I'm using the @cowprotocol/cow-sdk@^2.3.0-rc.7 I tried to help with a PR, but @mfw78 told me that is not the right place to change it. Feel free to refuse that.

alfetopito commented 1 year ago

Hey, thanks for reporting! Indeed, that PR is modifying an auto-generated file. It's generated based on the services repo openapi specs.

The issue you mentioned might come from this line I guess https://github.com/cowprotocol/services/blob/main/crates/orderbook/openapi.yml#L1161

It could either be that the openapi specs it incorrect or something in the auto-generation that's broken.

I'll raise this internally with the team.

alfetopito commented 1 year ago

Seems like indeed the code generation lib is to blame https://github.com/ferdikoomen/openapi-typescript-codegen/issues/1424

alfetopito commented 1 year ago

Not done yet, still pending the PR approval/merge and a new version release

alfetopito commented 1 year ago

Released on 2.3.1 https://www.npmjs.com/package/@cowprotocol/cow-sdk?activeTab=versions