@cowprotocol/sdk-trading 2.0.0 → 2.0.2
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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -11
- package/dist/index.mjs +13 -15
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -312,7 +312,7 @@ function adjustEthFlowOrderParams(chainId, params) {
|
|
|
312
312
|
var import_sdk_common2 = require("@cowprotocol/sdk-common");
|
|
313
313
|
async function getEthFlowTransaction(appDataKeccak256, _params, chainId, additionalParams = {}, paramSigner) {
|
|
314
314
|
const signer = paramSigner ? (0, import_sdk_common2.getGlobalAdapter)().createSigner(paramSigner) : (0, import_sdk_common2.getGlobalAdapter)().signer;
|
|
315
|
-
const { networkCostsAmount = "0", checkEthFlowOrderExists } = additionalParams;
|
|
315
|
+
const { networkCostsAmount = "0", checkEthFlowOrderExists, protocolFeeBps } = additionalParams;
|
|
316
316
|
const from = await signer.getAddress();
|
|
317
317
|
const slippageBps = _params.slippageBps ?? getDefaultSlippageBps(chainId, true);
|
|
318
318
|
const params = {
|
|
@@ -331,7 +331,8 @@ async function getEthFlowTransaction(appDataKeccak256, _params, chainId, additio
|
|
|
331
331
|
chainId,
|
|
332
332
|
isEthFlow: true,
|
|
333
333
|
from,
|
|
334
|
-
networkCostsAmount
|
|
334
|
+
networkCostsAmount,
|
|
335
|
+
protocolFeeBps
|
|
335
336
|
},
|
|
336
337
|
params,
|
|
337
338
|
appDataKeccak256
|
|
@@ -413,7 +414,8 @@ async function postCoWProtocolTrade(orderBookApi, appData, params, additionalPar
|
|
|
413
414
|
networkCostsAmount = "0",
|
|
414
415
|
signingScheme: _signingScheme = import_sdk_order_book4.SigningScheme.EIP712,
|
|
415
416
|
customEIP1271Signature,
|
|
416
|
-
applyCostsSlippageAndFees
|
|
417
|
+
applyCostsSlippageAndFees,
|
|
418
|
+
protocolFeeBps
|
|
417
419
|
} = additionalParams;
|
|
418
420
|
const isEthFlow = getIsEthFlowOrder(params);
|
|
419
421
|
if (isEthFlow) {
|
|
@@ -431,7 +433,7 @@ async function postCoWProtocolTrade(orderBookApi, appData, params, additionalPar
|
|
|
431
433
|
const chainId = orderBookApi.context.chainId;
|
|
432
434
|
const from = owner || await signer.getAddress();
|
|
433
435
|
const orderToSign = getOrderToSign(
|
|
434
|
-
{ chainId, from, networkCostsAmount, isEthFlow, applyCostsSlippageAndFees },
|
|
436
|
+
{ chainId, from, networkCostsAmount, isEthFlow, applyCostsSlippageAndFees, protocolFeeBps },
|
|
435
437
|
params,
|
|
436
438
|
appData.appDataKeccak256
|
|
437
439
|
);
|
|
@@ -449,12 +451,10 @@ async function postCoWProtocolTrade(orderBookApi, appData, params, additionalPar
|
|
|
449
451
|
signingScheme: _signingScheme
|
|
450
452
|
};
|
|
451
453
|
}
|
|
452
|
-
const signingResult = await import_sdk_order_signing2.OrderSigningUtils.signOrder(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
{ env, settlementContractOverride }
|
|
457
|
-
);
|
|
454
|
+
const signingResult = await import_sdk_order_signing2.OrderSigningUtils.signOrder(orderToSign, chainId, signer, {
|
|
455
|
+
env,
|
|
456
|
+
settlementContractOverride
|
|
457
|
+
});
|
|
458
458
|
if (isEip1271) {
|
|
459
459
|
return {
|
|
460
460
|
signature: import_sdk_order_signing2.OrderSigningUtils.getEip1271Signature(orderToSign, signingResult.signature),
|
|
@@ -491,7 +491,7 @@ var import_deepmerge = __toESM(require("deepmerge"));
|
|
|
491
491
|
// ../sdk/package.json
|
|
492
492
|
var package_default = {
|
|
493
493
|
name: "@cowprotocol/cow-sdk",
|
|
494
|
-
version: "9.0.
|
|
494
|
+
version: "9.0.2",
|
|
495
495
|
license: "(MIT OR Apache-2.0)",
|
|
496
496
|
description: "CoW Protocol SDK - get quote, configure your order, and trade",
|
|
497
497
|
repository: {
|
|
@@ -1004,6 +1004,7 @@ async function postSwapOrderFromQuote({
|
|
|
1004
1004
|
{
|
|
1005
1005
|
signingScheme: advancedSettings?.quoteRequest?.signingScheme,
|
|
1006
1006
|
networkCostsAmount: quoteResponse.quote.feeAmount,
|
|
1007
|
+
protocolFeeBps: advancedSettings?.additionalParams?.protocolFeeBps ?? (quoteResponse.protocolFeeBps ? Number(quoteResponse.protocolFeeBps) : void 0),
|
|
1007
1008
|
...advancedSettings?.additionalParams
|
|
1008
1009
|
},
|
|
1009
1010
|
signer
|
package/dist/index.mjs
CHANGED
|
@@ -188,10 +188,7 @@ function adjustAmounts(order) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// src/getEthFlowTransaction.ts
|
|
191
|
-
import {
|
|
192
|
-
BARN_ETH_FLOW_ADDRESSES as BARN_ETH_FLOW_ADDRESSES2,
|
|
193
|
-
ETH_FLOW_ADDRESSES as ETH_FLOW_ADDRESSES2
|
|
194
|
-
} from "@cowprotocol/sdk-config";
|
|
191
|
+
import { BARN_ETH_FLOW_ADDRESSES as BARN_ETH_FLOW_ADDRESSES2, ETH_FLOW_ADDRESSES as ETH_FLOW_ADDRESSES2 } from "@cowprotocol/sdk-config";
|
|
195
192
|
|
|
196
193
|
// src/utils/misc.ts
|
|
197
194
|
import { ETH_ADDRESS, WRAPPED_NATIVE_CURRENCIES as WRAPPED_NATIVE_CURRENCIES2 } from "@cowprotocol/sdk-config";
|
|
@@ -269,7 +266,7 @@ import {
|
|
|
269
266
|
} from "@cowprotocol/sdk-common";
|
|
270
267
|
async function getEthFlowTransaction(appDataKeccak256, _params, chainId, additionalParams = {}, paramSigner) {
|
|
271
268
|
const signer = paramSigner ? getGlobalAdapter().createSigner(paramSigner) : getGlobalAdapter().signer;
|
|
272
|
-
const { networkCostsAmount = "0", checkEthFlowOrderExists } = additionalParams;
|
|
269
|
+
const { networkCostsAmount = "0", checkEthFlowOrderExists, protocolFeeBps } = additionalParams;
|
|
273
270
|
const from = await signer.getAddress();
|
|
274
271
|
const slippageBps = _params.slippageBps ?? getDefaultSlippageBps(chainId, true);
|
|
275
272
|
const params = {
|
|
@@ -288,7 +285,8 @@ async function getEthFlowTransaction(appDataKeccak256, _params, chainId, additio
|
|
|
288
285
|
chainId,
|
|
289
286
|
isEthFlow: true,
|
|
290
287
|
from,
|
|
291
|
-
networkCostsAmount
|
|
288
|
+
networkCostsAmount,
|
|
289
|
+
protocolFeeBps
|
|
292
290
|
},
|
|
293
291
|
params,
|
|
294
292
|
appDataKeccak256
|
|
@@ -370,7 +368,8 @@ async function postCoWProtocolTrade(orderBookApi, appData, params, additionalPar
|
|
|
370
368
|
networkCostsAmount = "0",
|
|
371
369
|
signingScheme: _signingScheme = SigningScheme3.EIP712,
|
|
372
370
|
customEIP1271Signature,
|
|
373
|
-
applyCostsSlippageAndFees
|
|
371
|
+
applyCostsSlippageAndFees,
|
|
372
|
+
protocolFeeBps
|
|
374
373
|
} = additionalParams;
|
|
375
374
|
const isEthFlow = getIsEthFlowOrder(params);
|
|
376
375
|
if (isEthFlow) {
|
|
@@ -388,7 +387,7 @@ async function postCoWProtocolTrade(orderBookApi, appData, params, additionalPar
|
|
|
388
387
|
const chainId = orderBookApi.context.chainId;
|
|
389
388
|
const from = owner || await signer.getAddress();
|
|
390
389
|
const orderToSign = getOrderToSign(
|
|
391
|
-
{ chainId, from, networkCostsAmount, isEthFlow, applyCostsSlippageAndFees },
|
|
390
|
+
{ chainId, from, networkCostsAmount, isEthFlow, applyCostsSlippageAndFees, protocolFeeBps },
|
|
392
391
|
params,
|
|
393
392
|
appData.appDataKeccak256
|
|
394
393
|
);
|
|
@@ -406,12 +405,10 @@ async function postCoWProtocolTrade(orderBookApi, appData, params, additionalPar
|
|
|
406
405
|
signingScheme: _signingScheme
|
|
407
406
|
};
|
|
408
407
|
}
|
|
409
|
-
const signingResult = await OrderSigningUtils2.signOrder(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
{ env, settlementContractOverride }
|
|
414
|
-
);
|
|
408
|
+
const signingResult = await OrderSigningUtils2.signOrder(orderToSign, chainId, signer, {
|
|
409
|
+
env,
|
|
410
|
+
settlementContractOverride
|
|
411
|
+
});
|
|
415
412
|
if (isEip1271) {
|
|
416
413
|
return {
|
|
417
414
|
signature: OrderSigningUtils2.getEip1271Signature(orderToSign, signingResult.signature),
|
|
@@ -458,7 +455,7 @@ import deepmerge from "deepmerge";
|
|
|
458
455
|
// ../sdk/package.json
|
|
459
456
|
var package_default = {
|
|
460
457
|
name: "@cowprotocol/cow-sdk",
|
|
461
|
-
version: "9.0.
|
|
458
|
+
version: "9.0.2",
|
|
462
459
|
license: "(MIT OR Apache-2.0)",
|
|
463
460
|
description: "CoW Protocol SDK - get quote, configure your order, and trade",
|
|
464
461
|
repository: {
|
|
@@ -971,6 +968,7 @@ async function postSwapOrderFromQuote({
|
|
|
971
968
|
{
|
|
972
969
|
signingScheme: advancedSettings?.quoteRequest?.signingScheme,
|
|
973
970
|
networkCostsAmount: quoteResponse.quote.feeAmount,
|
|
971
|
+
protocolFeeBps: advancedSettings?.additionalParams?.protocolFeeBps ?? (quoteResponse.protocolFeeBps ? Number(quoteResponse.protocolFeeBps) : void 0),
|
|
974
972
|
...advancedSettings?.additionalParams
|
|
975
973
|
},
|
|
976
974
|
signer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-trading",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "CowProtocol trading",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"ts-jest": "^29.0.0",
|
|
35
35
|
"tsx": "^4.19.4",
|
|
36
36
|
"@cow-sdk/typescript-config": "0.0.0-beta.0",
|
|
37
|
+
"@cowprotocol/sdk-ethers-v5-adapter": "0.4.4",
|
|
37
38
|
"@cowprotocol/sdk-ethers-v6-adapter": "0.4.4",
|
|
38
|
-
"@cowprotocol/sdk-viem-adapter": "0.3.18"
|
|
39
|
-
"@cowprotocol/sdk-ethers-v5-adapter": "0.4.4"
|
|
39
|
+
"@cowprotocol/sdk-viem-adapter": "0.3.18"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"deepmerge": "^4.3.1",
|
|
43
43
|
"@cowprotocol/sdk-common": "0.10.2",
|
|
44
|
-
"@cowprotocol/sdk-app-data": "5.0.0",
|
|
45
|
-
"@cowprotocol/sdk-order-signing": "1.0.0",
|
|
46
44
|
"@cowprotocol/sdk-config": "2.0.0",
|
|
45
|
+
"@cowprotocol/sdk-order-signing": "1.0.1",
|
|
46
|
+
"@cowprotocol/sdk-app-data": "5.0.0",
|
|
47
47
|
"@cowprotocol/sdk-order-book": "3.0.0",
|
|
48
|
-
"@cowprotocol/sdk-contracts-ts": "3.0.
|
|
48
|
+
"@cowprotocol/sdk-contracts-ts": "3.0.1"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|