Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
matextrem committed Jun 28, 2022
1 parent 702cd97 commit d7ed975
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import { CowSdk, OrderKind } from 'cow-sdk'
// 1. Instantiate wallet and SDK
const mnemonic = 'fall dirt bread cactus...'
const wallet = Wallet.fromMnemonic(mnemonic)
const cowSdk = new CowSdk(4, { signer: wallet })
const cowSdk = new CowSdk(4, { signer: wallet }) // Leaving chainId empty will default to MAINNET

// 2. Get a price/fee quote from the API
// It will return the price and fee to "Sell 1 ETH for USDC"
Expand Down Expand Up @@ -96,6 +96,15 @@ const orderId = await cowSdk.cowApi.sendOrder({

// We can inspect the Order details in the CoW Protocol Explorer
console.log(`https://explorer.cow.fi/rinkeby/orders/${orderId}`)

// You can also override defaults params when using CowApi methods
const orderId = await cowSdk.cowApi.sendOrder(
{
order: { ...order, ...signedOrder },
owner: '0x1811be0994930fe9480eaede25165608b093ad7a',
},
{ chainId: 1, isDevEnvironment: false }
)
```

SDK also includes a Metadata API to interact with AppData documents and IPFS CIDs
Expand Down Expand Up @@ -188,10 +197,11 @@ const chainId = 1 // Mainnet
const cowSdk = new CowSdk(chainId)

// Get Cow Protocol totals
const { tokens, orders, traders, settlements, volumeUsd, volumeEth, feesUsd, feesEth } = await cowSdk.cowSubgraphApi.getTotals()
const { tokens, orders, traders, settlements, volumeUsd, volumeEth, feesUsd, feesEth } =
await cowSdk.cowSubgraphApi.getTotals()
console.log({ tokens, orders, traders, settlements, volumeUsd, volumeEth, feesUsd, feesEth })

// Get last 24 hours volume in usd
// Get last 24 hours volume in usd
const { hourlyTotals } = await cowSdk.cowSubgraphApi.getLastHoursVolume(24)
console.log(hourlyTotals)

Expand Down

0 comments on commit d7ed975

Please sign in to comment.