cowprotocol / cow-sdk

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

OrderSigningUtils doesn't accept appDataHash and stringified appData #192

Open mfw78 opened 8 months ago

mfw78 commented 8 months ago

Problem

If one just passes the QuoteRequestResponse object through to the OrderSigningUtils, the following occurs:

invalid hex string (argument="value", value="{\"appCode\":\"Decentralized CoW\",\"environment\":\"prod\",\"metadata\":{\"orderClass\":{\"orderClass\":\"limit\"},\"quote\":{\"slippageBips\":\"50\"},\"referrer\":{\"address\":\"0xcA771eda0c70aA7d053aB1B25004559B918FE662\"}},\"version\":\"0.11.0\"}", code=INVALID_ARGUMENT, version=bytes/5.7.0)

Solution

OrderSigningUtils should be made aware and able to handle itself so it doesn't do this and hashes the correct parts.

mfw78 commented 8 months ago

Also, https://github.com/cowprotocol/tutorial/pull/21/files#r1442750959