@cowprotocol/cow-sdk 7.2.9 → 7.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -8
- package/dist/CHANGELOG.md +27 -0
- package/dist/README.md +26 -8
- package/dist/package.json +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -25,8 +25,8 @@ The SDK supports all CoW Protocol enabled networks:
|
|
|
25
25
|
- **Avalanche** (43114) - `SupportedChainId.AVALANCHE`
|
|
26
26
|
- **Lens** (232) - `SupportedChainId.LENS`
|
|
27
27
|
- **BNB** (56) - `SupportedChainId.BNB`
|
|
28
|
-
- **Linea** (59144) - `SupportedChainId.LINEA`
|
|
29
|
-
- **Plasma** (9745) - `SupportedChainId.PLASMA`
|
|
28
|
+
- **Linea** (59144) - `SupportedChainId.LINEA`
|
|
29
|
+
- **Plasma** (9745) - `SupportedChainId.PLASMA`
|
|
30
30
|
- **Sepolia** (11155111) - `SupportedChainId.SEPOLIA` (Testnet)
|
|
31
31
|
|
|
32
32
|
## 🔗 **Related Resources**
|
|
@@ -353,8 +353,10 @@ We will perform the following operations:
|
|
|
353
353
|
5. Get trades for the order
|
|
354
354
|
6. Cancel the order (signing + sending)
|
|
355
355
|
|
|
356
|
+
> Try it live: https://codesandbox.io/p/devbox/cow-sdk-example-forked-x63k52
|
|
357
|
+
|
|
356
358
|
```typescript
|
|
357
|
-
import { OrderBookApi, OrderSigningUtils, SupportedChainId,
|
|
359
|
+
import { OrderBookApi, OrderSigningUtils, SupportedChainId, OrderQuoteSideKindSell, SigningScheme, setGlobalAdapter } from '@cowprotocol/cow-sdk'
|
|
358
360
|
import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'
|
|
359
361
|
import { JsonRpcProvider, Wallet } from 'ethers'
|
|
360
362
|
|
|
@@ -364,13 +366,17 @@ const provider = new JsonRpcProvider('YOUR_RPC_URL')
|
|
|
364
366
|
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
|
|
365
367
|
const adapter = new EthersV6Adapter({ provider, signer: wallet })
|
|
366
368
|
|
|
369
|
+
setGlobalAdapter(adapter)
|
|
370
|
+
|
|
371
|
+
const receiver = account
|
|
372
|
+
|
|
367
373
|
const quoteRequest = {
|
|
368
374
|
sellToken: '0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1', // WETH on Gnosis Chain
|
|
369
375
|
buyToken: '0x9c58bacc331c9aa871afd802db6379a98e80cedb', // GNO on Gnosis Chain
|
|
370
376
|
from: account,
|
|
371
|
-
receiver
|
|
377
|
+
receiver,
|
|
372
378
|
sellAmountBeforeFee: (0.4 * 10 ** 18).toString(), // 0.4 WETH
|
|
373
|
-
kind:
|
|
379
|
+
kind: OrderQuoteSideKindSell.SELL,
|
|
374
380
|
}
|
|
375
381
|
|
|
376
382
|
const orderBookApi = new OrderBookApi({ chainId: SupportedChainId.GNOSIS_CHAIN })
|
|
@@ -378,15 +384,27 @@ const orderBookApi = new OrderBookApi({ chainId: SupportedChainId.GNOSIS_CHAIN }
|
|
|
378
384
|
async function main() {
|
|
379
385
|
const { quote } = await orderBookApi.getQuote(quoteRequest)
|
|
380
386
|
|
|
381
|
-
const
|
|
387
|
+
const orderData = {
|
|
388
|
+
...quote,
|
|
389
|
+
// Add fee to sellAmount for sell orders
|
|
390
|
+
sellAmount: (BigInt(quote.sellAmount) + BigInt(quote.feeAmount)).toString(),
|
|
391
|
+
receiver,
|
|
392
|
+
feeAmount: "0",
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const orderSigningResult = await OrderSigningUtils.signOrder(orderData, chainId, adapter.signer)
|
|
382
396
|
|
|
383
|
-
const orderId = await orderBookApi.sendOrder({
|
|
397
|
+
const orderId = await orderBookApi.sendOrder({
|
|
398
|
+
...orderData,
|
|
399
|
+
...orderSigningResult,
|
|
400
|
+
signingScheme: SigningScheme.EIP712,
|
|
401
|
+
})
|
|
384
402
|
|
|
385
403
|
const order = await orderBookApi.getOrder(orderId)
|
|
386
404
|
|
|
387
405
|
const trades = await orderBookApi.getTrades({ orderId })
|
|
388
406
|
|
|
389
|
-
const orderCancellationSigningResult = await OrderSigningUtils.signOrderCancellations([orderId], chainId, adapter)
|
|
407
|
+
const orderCancellationSigningResult = await OrderSigningUtils.signOrderCancellations([orderId], chainId, adapter.signer)
|
|
390
408
|
|
|
391
409
|
const cancellationResult = await orderBookApi.sendSignedOrderCancellations({
|
|
392
410
|
...orderCancellationSigningResult,
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [7.2.11](https://github.com/cowprotocol/cow-sdk/compare/cow-sdk-v7.2.10...cow-sdk-v7.2.11) (2026-01-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### 🔧 Miscellaneous
|
|
7
|
+
|
|
8
|
+
* remove `under development` comment from Linea and Plasma ([#770](https://github.com/cowprotocol/cow-sdk/issues/770)) ([cbb5361](https://github.com/cowprotocol/cow-sdk/commit/cbb53611674553e40d42ffcb3d0f599f49ec2fa1))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @cowprotocol/sdk-app-data bumped to 4.5.1
|
|
16
|
+
* @cowprotocol/sdk-common bumped to 0.5.0
|
|
17
|
+
* @cowprotocol/sdk-config bumped to 0.6.3
|
|
18
|
+
* @cowprotocol/sdk-contracts-ts bumped to 1.1.0
|
|
19
|
+
* @cowprotocol/sdk-order-book bumped to 0.5.1
|
|
20
|
+
* @cowprotocol/sdk-order-signing bumped to 0.1.24
|
|
21
|
+
* @cowprotocol/sdk-trading bumped to 0.8.1
|
|
22
|
+
|
|
23
|
+
## [7.2.10](https://github.com/cowprotocol/cow-sdk/compare/cow-sdk-v7.2.9...cow-sdk-v7.2.10) (2026-01-15)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### 📚 Documentation
|
|
27
|
+
|
|
28
|
+
* update Low-Level SDK Usage Example ([#766](https://github.com/cowprotocol/cow-sdk/issues/766)) ([0b6949c](https://github.com/cowprotocol/cow-sdk/commit/0b6949cff628d390c17db8661cd917e486c75af3))
|
|
29
|
+
|
|
3
30
|
## [7.2.9](https://github.com/cowprotocol/cow-sdk/compare/cow-sdk-v7.2.8...cow-sdk-v7.2.9) (2025-12-25)
|
|
4
31
|
|
|
5
32
|
|
package/dist/README.md
CHANGED
|
@@ -25,8 +25,8 @@ The SDK supports all CoW Protocol enabled networks:
|
|
|
25
25
|
- **Avalanche** (43114) - `SupportedChainId.AVALANCHE`
|
|
26
26
|
- **Lens** (232) - `SupportedChainId.LENS`
|
|
27
27
|
- **BNB** (56) - `SupportedChainId.BNB`
|
|
28
|
-
- **Linea** (59144) - `SupportedChainId.LINEA`
|
|
29
|
-
- **Plasma** (9745) - `SupportedChainId.PLASMA`
|
|
28
|
+
- **Linea** (59144) - `SupportedChainId.LINEA`
|
|
29
|
+
- **Plasma** (9745) - `SupportedChainId.PLASMA`
|
|
30
30
|
- **Sepolia** (11155111) - `SupportedChainId.SEPOLIA` (Testnet)
|
|
31
31
|
|
|
32
32
|
## 🔗 **Related Resources**
|
|
@@ -353,8 +353,10 @@ We will perform the following operations:
|
|
|
353
353
|
5. Get trades for the order
|
|
354
354
|
6. Cancel the order (signing + sending)
|
|
355
355
|
|
|
356
|
+
> Try it live: https://codesandbox.io/p/devbox/cow-sdk-example-forked-x63k52
|
|
357
|
+
|
|
356
358
|
```typescript
|
|
357
|
-
import { OrderBookApi, OrderSigningUtils, SupportedChainId,
|
|
359
|
+
import { OrderBookApi, OrderSigningUtils, SupportedChainId, OrderQuoteSideKindSell, SigningScheme, setGlobalAdapter } from '@cowprotocol/cow-sdk'
|
|
358
360
|
import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'
|
|
359
361
|
import { JsonRpcProvider, Wallet } from 'ethers'
|
|
360
362
|
|
|
@@ -364,13 +366,17 @@ const provider = new JsonRpcProvider('YOUR_RPC_URL')
|
|
|
364
366
|
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
|
|
365
367
|
const adapter = new EthersV6Adapter({ provider, signer: wallet })
|
|
366
368
|
|
|
369
|
+
setGlobalAdapter(adapter)
|
|
370
|
+
|
|
371
|
+
const receiver = account
|
|
372
|
+
|
|
367
373
|
const quoteRequest = {
|
|
368
374
|
sellToken: '0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1', // WETH on Gnosis Chain
|
|
369
375
|
buyToken: '0x9c58bacc331c9aa871afd802db6379a98e80cedb', // GNO on Gnosis Chain
|
|
370
376
|
from: account,
|
|
371
|
-
receiver
|
|
377
|
+
receiver,
|
|
372
378
|
sellAmountBeforeFee: (0.4 * 10 ** 18).toString(), // 0.4 WETH
|
|
373
|
-
kind:
|
|
379
|
+
kind: OrderQuoteSideKindSell.SELL,
|
|
374
380
|
}
|
|
375
381
|
|
|
376
382
|
const orderBookApi = new OrderBookApi({ chainId: SupportedChainId.GNOSIS_CHAIN })
|
|
@@ -378,15 +384,27 @@ const orderBookApi = new OrderBookApi({ chainId: SupportedChainId.GNOSIS_CHAIN }
|
|
|
378
384
|
async function main() {
|
|
379
385
|
const { quote } = await orderBookApi.getQuote(quoteRequest)
|
|
380
386
|
|
|
381
|
-
const
|
|
387
|
+
const orderData = {
|
|
388
|
+
...quote,
|
|
389
|
+
// Add fee to sellAmount for sell orders
|
|
390
|
+
sellAmount: (BigInt(quote.sellAmount) + BigInt(quote.feeAmount)).toString(),
|
|
391
|
+
receiver,
|
|
392
|
+
feeAmount: "0",
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const orderSigningResult = await OrderSigningUtils.signOrder(orderData, chainId, adapter.signer)
|
|
382
396
|
|
|
383
|
-
const orderId = await orderBookApi.sendOrder({
|
|
397
|
+
const orderId = await orderBookApi.sendOrder({
|
|
398
|
+
...orderData,
|
|
399
|
+
...orderSigningResult,
|
|
400
|
+
signingScheme: SigningScheme.EIP712,
|
|
401
|
+
})
|
|
384
402
|
|
|
385
403
|
const order = await orderBookApi.getOrder(orderId)
|
|
386
404
|
|
|
387
405
|
const trades = await orderBookApi.getTrades({ orderId })
|
|
388
406
|
|
|
389
|
-
const orderCancellationSigningResult = await OrderSigningUtils.signOrderCancellations([orderId], chainId, adapter)
|
|
407
|
+
const orderCancellationSigningResult = await OrderSigningUtils.signOrderCancellations([orderId], chainId, adapter.signer)
|
|
390
408
|
|
|
391
409
|
const cancellationResult = await orderBookApi.sendSignedOrderCancellations({
|
|
392
410
|
...orderCancellationSigningResult,
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/cow-sdk",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.11",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"description": "CoW Protocol SDK - get quote, configure your order, and trade",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"@cow-sdk/typescript-config": "0.0.0-beta.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@cowprotocol/sdk-
|
|
34
|
-
"@cowprotocol/sdk-
|
|
35
|
-
"@cowprotocol/sdk-
|
|
36
|
-
"@cowprotocol/sdk-
|
|
37
|
-
"@cowprotocol/sdk-
|
|
38
|
-
"@cowprotocol/sdk-order-signing": "0.1.
|
|
39
|
-
"@cowprotocol/sdk-trading": "0.8.
|
|
33
|
+
"@cowprotocol/sdk-common": "0.5.0",
|
|
34
|
+
"@cowprotocol/sdk-app-data": "4.5.1",
|
|
35
|
+
"@cowprotocol/sdk-config": "0.6.3",
|
|
36
|
+
"@cowprotocol/sdk-contracts-ts": "1.1.0",
|
|
37
|
+
"@cowprotocol/sdk-order-book": "0.5.1",
|
|
38
|
+
"@cowprotocol/sdk-order-signing": "0.1.24",
|
|
39
|
+
"@cowprotocol/sdk-trading": "0.8.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@openzeppelin/merkle-tree": "^1.x",
|