diff --git a/cow-sdk/advanced/cross-chain-bridging.mdx b/cow-sdk/advanced/cross-chain-bridging.mdx index d30c5eb..5abec63 100644 --- a/cow-sdk/advanced/cross-chain-bridging.mdx +++ b/cow-sdk/advanced/cross-chain-bridging.mdx @@ -17,6 +17,10 @@ npm install @cowprotocol/sdk-bridging ### Initialize the BridgingSdk + +The `CowSdk` class shown in the "With CoW SDK" tab below has been removed in v8. Use [`TradingSdk`](/cow-sdk/api/trading-sdk) or the standalone `BridgingSdk` instead. See the [quickstart guide](/cow-sdk/quickstart) for updated usage patterns. + + ```typescript Standalone import { diff --git a/cow-sdk/advanced/hooks.mdx b/cow-sdk/advanced/hooks.mdx index 363364f..561d810 100644 --- a/cow-sdk/advanced/hooks.mdx +++ b/cow-sdk/advanced/hooks.mdx @@ -80,6 +80,10 @@ const orderParams = { ### Using TradingSdk with Hooks + +The `CowSdk` class shown below has been removed in v8. Use [`TradingSdk`](/cow-sdk/api/trading-sdk) instead. See the [quickstart guide](/cow-sdk/quickstart) for updated usage patterns. + + ```typescript import { CowSdk } from '@cowprotocol/cow-sdk' import { encodeFunctionData } from 'viem' @@ -245,6 +249,10 @@ const unwrapHook = { ## Complete Example + +The `CowSdk` class shown below has been removed in v8. Use [`TradingSdk`](/cow-sdk/api/trading-sdk) instead. See the [quickstart guide](/cow-sdk/quickstart) for updated usage patterns. + + Here's a complete example with pre and post hooks: ```typescript diff --git a/cow-sdk/advanced/partner-fee.mdx b/cow-sdk/advanced/partner-fee.mdx index 05ed8ba..50a15b5 100644 --- a/cow-sdk/advanced/partner-fee.mdx +++ b/cow-sdk/advanced/partner-fee.mdx @@ -59,6 +59,10 @@ const partnerFee = { ## Configuration + +The `CowSdk` class shown in examples below has been removed in v8. Use [`TradingSdk`](/cow-sdk/api/trading-sdk) instead. See the [quickstart guide](/cow-sdk/quickstart) for updated usage patterns. + + ### Single Fee Structure ```typescript diff --git a/cow-sdk/advanced/programmatic-orders.mdx b/cow-sdk/advanced/programmatic-orders.mdx index 45387fa..c7cd803 100644 --- a/cow-sdk/advanced/programmatic-orders.mdx +++ b/cow-sdk/advanced/programmatic-orders.mdx @@ -103,6 +103,10 @@ const proofs = multiplexer.dumpProofsAndParams() ### With CoW SDK + +The `CowSdk` class shown below has been removed in v8. Use [`TradingSdk`](/cow-sdk/api/trading-sdk) instead. See the [quickstart guide](/cow-sdk/quickstart) for updated usage patterns. + + ```typescript import { CowSdk, diff --git a/cow-sdk/api/adapters/ethers-v5.mdx b/cow-sdk/api/adapters/ethers-v5.mdx index 1a44dfa..b1b0a71 100644 --- a/cow-sdk/api/adapters/ethers-v5.mdx +++ b/cow-sdk/api/adapters/ethers-v5.mdx @@ -252,6 +252,10 @@ const adapter = new EthersV5Adapter({ ### With CoW SDK + +The `CowSdk` class shown below has been removed in v8. Use [`TradingSdk`](/cow-sdk/api/trading-sdk) instead. See the [quickstart guide](/cow-sdk/quickstart) for updated usage patterns. + + ```typescript import { CowSdk, SupportedChainId } from '@cowprotocol/cow-sdk' import { EthersV5Adapter } from '@cowprotocol/sdk-ethers-v5-adapter' diff --git a/cow-sdk/api/adapters/ethers-v6.mdx b/cow-sdk/api/adapters/ethers-v6.mdx index a075c0e..17ae4d9 100644 --- a/cow-sdk/api/adapters/ethers-v6.mdx +++ b/cow-sdk/api/adapters/ethers-v6.mdx @@ -76,6 +76,10 @@ const adapter = new EthersV6Adapter({ ### Integration with CoW SDK + +The `CowSdk` class shown below has been removed in v8. Use [`TradingSdk`](/cow-sdk/api/trading-sdk) instead. See the [quickstart guide](/cow-sdk/quickstart) for updated usage patterns. + + ```typescript import { CowSdk, SupportedChainId } from '@cowprotocol/cow-sdk' import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter' diff --git a/cow-sdk/api/adapters/viem.mdx b/cow-sdk/api/adapters/viem.mdx index 4f9186a..634e321 100644 --- a/cow-sdk/api/adapters/viem.mdx +++ b/cow-sdk/api/adapters/viem.mdx @@ -270,6 +270,10 @@ const adapter = new ViemAdapter({ provider, signer: account }) ### With CoW SDK + +The `CowSdk` class shown below has been removed in v8. Use [`TradingSdk`](/cow-sdk/api/trading-sdk) instead. See the [quickstart guide](/cow-sdk/quickstart) for updated usage patterns. + + ```typescript import { CowSdk, SupportedChainId } from '@cowprotocol/cow-sdk' import { ViemAdapter } from '@cowprotocol/sdk-viem-adapter' diff --git a/cow-sdk/installation.mdx b/cow-sdk/installation.mdx index b40b05b..c8dc688 100644 --- a/cow-sdk/installation.mdx +++ b/cow-sdk/installation.mdx @@ -39,10 +39,10 @@ The SDK requires `cross-fetch` (^3.x). Optional packages include `ipfs-only-hash ## Environment Requirements -Node.js 16+ is mandatory. TypeScript support includes built-in type definitions with standard `tsconfig.json` settings (moduleResolution: "node", esModuleInterop: true). +Node.js 22+ is mandatory. TypeScript support includes built-in type definitions with standard `tsconfig.json` settings (moduleResolution: "node", esModuleInterop: true). ## Framework Integration React/Next.js users typically integrate via wagmi, while Node.js backends use direct Viem initialization with environment variables for sensitive credentials. -The current SDK version is **v7.4.1**, with migration guidance available for v6 upgrades. +The current SDK version is **v8.0.4**, with migration guidance available for prior version upgrades. diff --git a/cow-swap/hooks/hook-dapp.mdx b/cow-swap/hooks/hook-dapp.mdx index a9ade83..b7c655b 100644 --- a/cow-swap/hooks/hook-dapp.mdx +++ b/cow-swap/hooks/hook-dapp.mdx @@ -170,7 +170,7 @@ As stated at the beginning of this document, in the CoW Swap interface you can a "image": "http://your-cow-hook.dapp/logo.png", "conditions": { "position": "pre", - "smartContractWalletSupported": false, + "walletCompatibility": ["EOA"], "supportedNetworks": [1, 100, 42161] } } diff --git a/cow-swap/hooks/hook-store.mdx b/cow-swap/hooks/hook-store.mdx index a6d8632..bd59329 100644 --- a/cow-swap/hooks/hook-store.mdx +++ b/cow-swap/hooks/hook-store.mdx @@ -75,7 +75,7 @@ Your dApp must serve a `manifest.json` file that describes its capabilities: "image": "https://my-hook-dapp.example.com/logo.png", "conditions": { "position": "pre", - "smartContractWalletSupported": false, + "walletCompatibility": ["EOA"], "supportedNetworks": [1, 100, 42161] } } diff --git a/cow-swap/tutorials/twap.mdx b/cow-swap/tutorials/twap.mdx index e1ac4ec..aa4cf0f 100644 --- a/cow-swap/tutorials/twap.mdx +++ b/cow-swap/tutorials/twap.mdx @@ -40,7 +40,7 @@ This is a *critical* step where you'll define how your order will be executed ov 1. **Price Protection**: This is a measure to prevent your order from being executed at a price that's too far from the market price when the order was placed. Set the percentage of price protection to define the acceptable price range for your trades. For instance, a 10% price protection means that your order will not execute if the price moves unfavorably by more than 10% from the price at the time the order was made. -2. **Number of Parts**: Decide how many discrete parts you want to divide your order into. This choice will determine the granularity of your TWAP strategy. For example, if you choose to split your order into 2 parts and you are selling a total of 2 WETH, each part will involve selling 1 WETH. The parts have a minimum size of `$5k` on Mainnet or `$5` on Gnosis Chain because each part will need to be executed on-chain, meaning there's a cost associated with each execution. +2. **Number of Parts**: Decide how many discrete parts you want to divide your order into. This choice will determine the granularity of your TWAP strategy. For example, if you choose to split your order into 2 parts and you are selling a total of 2 WETH, each part will involve selling 1 WETH. The parts have a minimum size of `$1,000` on Mainnet or `$1` on other supported chains because each part will need to be executed on-chain, meaning there's a cost associated with each execution. 3. **Total Duration**: Choose the total time frame over which your order should be executed. The TWAP strategy will distribute your trades evenly across this duration. Select from predefined durations like 1 hour, or set a custom duration based on your trading strategy. diff --git a/cow-swap/widget/params.mdx b/cow-swap/widget/params.mdx index 01dd1a1..57d8e42 100644 --- a/cow-swap/widget/params.mdx +++ b/cow-swap/widget/params.mdx @@ -163,13 +163,12 @@ import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-li | `provider` | `EthereumProvider` | --- | The Ethereum provider to be used for interacting with a wallet. To connect, for example, to Rabby Wallet or Metamask, just set `window.ethereum`. You also might like to use [https://web3modal.com](https://web3modal.com). | | `chainId` | `number` | 1 | The blockchain ID on which the trade will take place. Supported chains: 1 (Ethereum), 100 (Gnosis Chain), 42161 (Arbitrum One), 8453 (Base), 137 (Polygon), 43114 (Avalanche), 56 (BNB), 59144 (Linea), 9745 (Plasma), 57073 (Ink), 11155111 (Sepolia). See [supported networks](/snippets/supported-networks) for the full list. | | `tradeType` | `TradeType` | 'swap' | The type of trade. Can be `swap` or `limit` or `advanced`. | -| `env` | `CowSwapWidgetEnv` | 'prod' | The environment of the widget (`local` , `prod` , `dev` , `pr`). See [`COWSWAP_URLS`](https://github.com/cowprotocol/cowswap/blob/develop/libs/widget-lib/src/consts.ts) const value for urls. | +| `baseUrl` | `string` | 'https://swap.cow.fi' | The base URL of the widget implementation. Defaults to the production environment (`https://swap.cow.fi`). | | `sell` | `TradeAsset` | Same as in swap.cow\.fi | An object containing information about the sell asset. Example: `{ asset: 'WBTC', amount: 12 }` or `{ asset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' }`. | | `buy` | `TradeAsset` | --- | An object containing information about the buy asset. Example: `{ asset: 'WBTC', amount: 12 }` or `{ asset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' }`. | | `theme` | `CowSwapTheme` | 'light' | The theme of the widget (`'dark'` for dark theme or `'light'` for light theme). It is also possible to set your own colors (`CowSwapWidgetPalette`). See [Custom theme](#custom-theme) section for more details. | | `sounds` | `CowSwapWidgetSounds` | --- | The famous MOOO! sound can be changed to something else, just provide a link to a media file (mp3 or any other audio format supported by your browser). You can also specify a value of `null` to disable the sound. | | `images` | `CowSwapWidgetImages` | --- | To make your widget unique, you can replace some of the images. For example, a stub image when there are no limit orders. | -| `banners` | `CowSwapWidgetBanners` | --- | With this option you can control the display of some banners in the CoW Swap interface. | | `tokenLists` | `string[]` | --- | CoW Swap uses the [token lists standard](https://tokenlists.org), which allows flexible and decentralized management of assets for trading. Using this option you can set any token list you want. You also might want to use `customTokens` option for more flexible configuration. | | `customTokens` | `TokenInfo[]` | --- | In the case when you want to use tokens that are not included in the default token lists, you can add them programmatically by simply passing an array of ERC-20 tokens info. There is also `tokenLists` option to set a ready-made list of tokens. | | `disableToastMessages` | `boolean` | false | CoW Swap displays a pop-up notification when certain events occur, for example: an order has been filled. You may want to handle these events yourself and disable the display of notifications in the widget, to do this you need to enable this option. See [Events handling](#events-handling) section for more details. | @@ -250,7 +249,7 @@ import { createCowSwapWidget, CowSwapWidgetParams, CowEventListeners, CowEvents You can change all possible widget options on the fly: ``` -import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { appCode: 'NAME-OF-YOU-APP', // Add here the name of your app. e.g. "Pig Swap" logoUrl: 'YOUR_LOGO_URL',}const updateWidget = createCowSwapWidget(container, { params })// Update the widgetupdateWidget({ ...params, theme: 'dark', // <- Change theme to dark hideNetworkSelector: true, // <- Hide the network selector}) +import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { appCode: 'NAME-OF-YOU-APP', // Add here the name of your app. e.g. "Pig Swap"}const updateWidget = createCowSwapWidget(container, { params })// Update the widgetupdateWidget({ ...params, theme: 'dark', // <- Change theme to dark hideNetworkSelector: true, // <- Hide the network selector}) ``` ## Widget URL @@ -279,15 +278,5 @@ import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-li ![Custom image](/images/cow-protocol/tutorials/assets/images/widget-custom-img-7dbd8236292401203767488f8583d4c9.png) -### Banners -In some cases, you may want to hide some banners in the CoW Swap interface. To do this, you need to specify the `banners` parameter in the widget configuration. - -``` -import { createCowSwapWidget, CowSwapWidgetParams } from '@cowprotocol/widget-lib'const container = document.getElementById('cowswap-widget')const params: CowSwapWidgetParams = { banners: { hideSafeWebAppBanner: true } }createCowSwapWidget(container, { params }) -``` - -This banner will be hidden: - -![Hidden banner](/images/cow-protocol/tutorials/assets/images/widget-hidden-banner-9eecdcc1ebbcde86d089eef5d5d7c9e1.png)