![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@gnosis.pm/cow-sdk
Advanced tools
⚠️⚠️ THE SDK IS IN Beta ⚠️⚠️ It is being currently develop and is a work in progress, also it's API is subjected to change. If you experience any problems, please open an issue in Github trying to describe your problem.
Install the SDK:
yarn add @gnosis.pm/cow-sdk
Instantiate the SDK:
import { CowSdk } from 'cow-sdk'
const chainId = 4 // Rinkeby
const cowSdk = new CowSdk(chainId)
The SDK will expose the CoW API operations (cowSdk.cowApi
) and some convenient method that will facilitate signing orders (cowSdk.signOrder
). Future version will provide easy access to The Graph data and some other convenient utils.
// i.e. Get last 5 orders for a given trader
const trades = await cowSdk.cowApi.getOrders({
owner: '0x00000000005ef87f8ca7014309ece7260bbcdaeb', // Trader
limit: 5,
offset: 0
})
console.log(trades)
Let's see a full example on how to submit an order to CowSwap.
⚠️ Before starting, the protocol requires you to approve the sell token before the order can be considered. For more details see https://docs.cow.fi/tutorials/how-to-submit-orders-via-the-api/1.-set-allowance-for-the-sell-token
In this example, we will:
import { Wallet } from 'ethers'
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 })
// 2. Get a price/fee quote from the API
// It will return the price and fee to "Sell 1 ETH for USDC"
const quoteResponse = await cowSdk.cowApi.getQuote({
kind: OrderKind.SELL, // Sell order (could also be BUY)
sellToken: '0xc778417e063141139fce010982780140aa0cd5ab', // WETH
buyToken: '0x4dbcdf9b62e891a7cec5a2568c3f4faf9e8abe2b', // USDC
amount: '1000000000000000000', // 1 WETH
userAddress: '0x1811be0994930fe9480eaede25165608b093ad7a', // Trader
validTo: 2524608000,
})
const { sellToken, buyToken, validTo, buyAmount, sellAmount, receiver, feeAmount } = quoteResponse.quote
const order = {
kind: OrderKind.SELL,
partiallyFillable: false, // Allow partial executions of an order (true would be for a "Fill or Kill" order, which is not yet supported but will be added soon)
sellToken,
buyToken,
validTo,
buyAmount,
sellAmount,
receiver,
feeAmount,
}
// 3. Sign the order using your wallet
const signedOrder = await cowSdk.signOrder(order)
// 4. Post the signed order to the API
const orderId = await cowSdk.cowApi.sendOrder({
order: { ...order, ...signedOrder },
owner: '0x1811be0994930fe9480eaede25165608b093ad7a',
})
// We can inspect the Order details in the CoW Protocol Explorer
console.log(`https://explorer.cow.fi/rinkeby/orders/${orderId}`)
yarn
yarn build
# Build in watch mode
yarn start
yarn test
FAQs
Unknown package
The npm package @gnosis.pm/cow-sdk receives a total of 7 weekly downloads. As such, @gnosis.pm/cow-sdk popularity was classified as not popular.
We found that @gnosis.pm/cow-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 18 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.