Links
Comment on page

Getting Started with the SDK

Install the SDK:
yarn add @cowprotocol/cow-sdk
Instantiate the SDK:
import { OrderBookApi, OrderSigningUtils, SubgraphApi } from '@cowprotocol/cow-sdk'
const chainId = 100 // Gnosis chain
const orderBookApi = new OrderBookApi({ chainId })
const subgraphApi = new SubgraphApi({ chainId })
const orderSigningUtils = new OrderSigningUtils()
The SDK will expose:
  • OrderBookApi - provides the ability to retrieve orders and trades from the CowSap order-book, as well as add and cancel them
  • OrderSigningUtils - serves to sign orders and cancel them using EIP-712
  • SubgraphApi - provides statistics data about CoW protocol from Subgraph, such as trading volume, trades count and others
💡 For a quick snippet with the full process on posting an order see the Quick start example
Now you should have a ready to use SDK instance. Let's explore in the next section, how we can use it to query the CoW API.
Last modified 7mo ago