Open devanoneth opened 9 months ago
Further to this, the OrderQuoteResponse
has receiver
as an optional value (may be null
), however receiver
is required for UnsignedOrder
. The cow-sdk
should adjust the UnsignedOrder
such that receiver
may also be null
, and have signOrder
inject the assumptions required.
If some one encounter this problem and struggle to find an issue you have a solution here:
from this : https://github.com/cowprotocol/cow-sdk/blob/main/examples/cra/src/pages/quickStart/index.tsx
const { quote } = await orderBookApi.getQuote(quoteRequest)
// Sign order
const orderSigningResult = await OrderSigningUtils.signOrder({ ...quote, receiver: account }, chainId, signer)
// Send order to the order-book
const orderUid = await orderBookApi.sendOrder({
...quote,
signature: orderSigningResult.signature,
signingScheme: orderSigningResult.signingScheme as string as SigningScheme,
})
SDK Version: 4.0.3
I've been following the beta docs, they're very nice but not sure if it's too early for that... https://beta.docs.cow.fi/cow-protocol/reference/sdks/cow-sdk#sign-fetch-post-and-cancel-order
I noticed a few issue which I'd like to summarize here, if you agree with them maybe some of them can be split into separate issues.
The core issue is that a
getQuote
call with the followingOrderQuoteRequest
:returns a
Bad Request
error rather than the expected quoteOrderQuoteResponse
. It seems as though the Orderbook API and this SDK are using completely different request bodies. At least that's what I notice when checking the live Orderbook swagger docs here: https://beta.docs.cow.fi/cow-protocol/reference/apis/orderbook.Further to this, there are some type mismatch issues:
getQuote
returns aOrderQuoteResponse
, butsignOrder
expects anUnsignedOrder
. The docs don't cover this conversion and you need to do an ugly typescript cast to get around it.sendOrder
expects aSigningScheme
butsignOrder
returns anEcdsaSigningScheme
, which again leads to an ugly typescript cast that the docs (linked) don't cover.