Something about getting a quote.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { Web3Provider } from '@ethersproject/providers'import { OrderBookApi, SupportedChainId, OrderQuoteRequest, OrderQuoteSideKindSell } from '@cowprotocol/cow-sdk'export async function run(provider: Web3Provider): Promise<unknown> {  const chainId = +(await provider.send('eth_chainId', []));  if (chainId !== 100) {    throw new Error('Invalid chainId')}
const accounts = await provider.listAccounts();
const account = accounts[0];
const signer = provider.getSigner();
const ownerAddress = await signer.getAddress();
const sellToken = '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d'; // wxDAI
const buyToken = '0x177127622c4A00F3d409B75571e12cB3c8973d3c'; // COW
const sellAmount = '1000000000000000000'; // 1 wxDAI
  const quoteRequest: OrderQuoteRequest = {sellToken,
buyToken,
from: ownerAddress,
receiver: ownerAddress,
sellAmountBeforeFee: sellAmount,
kind: OrderQuoteSideKindSell.SELL,
}
  const orderBookApi = new OrderBookApi({ chainId: SupportedChainId.GNOSIS_CHAIN })  const { quote } = await orderBookApi.getQuote(quoteRequest)return quote
}