@cowprotocol/sdk-bridging 1.7.5 → 2.0.0
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.js +5 -7
- package/dist/index.mjs +7 -9
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -1629,9 +1629,8 @@ function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
function toAmountsAndCosts(request, slippageBps, suggestedFees) {
|
|
1631
1631
|
const { amount, sellTokenDecimals, buyTokenDecimals } = request;
|
|
1632
|
-
const
|
|
1633
|
-
const
|
|
1634
|
-
const buyAmountBeforeFee = (0, import_sdk_order_book4.getBigNumber)(sellAmountBeforeFeeBig.num, buyTokenDecimals).big;
|
|
1632
|
+
const sellAmountBeforeFee = BigInt(amount);
|
|
1633
|
+
const buyAmountBeforeFee = sellAmountBeforeFee * 10n ** BigInt(buyTokenDecimals) / 10n ** BigInt(sellTokenDecimals);
|
|
1635
1634
|
const totalRelayerFeePct = BigInt(suggestedFees.totalRelayFee.pct);
|
|
1636
1635
|
const buyAmountAfterFee = applyPctFee(buyAmountBeforeFee, totalRelayerFeePct);
|
|
1637
1636
|
const feeSellToken = sellAmountBeforeFee - applyPctFee(sellAmountBeforeFee, totalRelayerFeePct);
|
|
@@ -3945,11 +3944,10 @@ function toBridgeQuoteResult2(request, slippageBps, bungeeQuoteWithBuildTx) {
|
|
|
3945
3944
|
};
|
|
3946
3945
|
}
|
|
3947
3946
|
function toAmountsAndCosts2(request, slippageBps, bungeeQuote) {
|
|
3948
|
-
const { amount
|
|
3949
|
-
const
|
|
3950
|
-
const sellAmountBeforeFee = sellAmountBeforeFeeBig.big;
|
|
3947
|
+
const { amount } = request;
|
|
3948
|
+
const sellAmountBeforeFee = BigInt(amount);
|
|
3951
3949
|
const buyAmountFromBungeeQuote = bungeeQuote.route.output.amount;
|
|
3952
|
-
const buyAmountBeforeFee = (
|
|
3950
|
+
const buyAmountBeforeFee = BigInt(buyAmountFromBungeeQuote);
|
|
3953
3951
|
const buyAmountAfterFee = buyAmountBeforeFee;
|
|
3954
3952
|
const feeSellToken = bungeeQuote.route.routeDetails.routeFee.amount;
|
|
3955
3953
|
const feeBuyToken = sellAmountBeforeFee > 0n ? BigInt(feeSellToken) * buyAmountBeforeFee / sellAmountBeforeFee : 0n;
|
package/dist/index.mjs
CHANGED
|
@@ -1547,7 +1547,7 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
|
|
|
1547
1547
|
|
|
1548
1548
|
// src/providers/across/util.ts
|
|
1549
1549
|
import { COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS } from "@cowprotocol/sdk-config";
|
|
1550
|
-
import {
|
|
1550
|
+
import { OrderKind as OrderKind2 } from "@cowprotocol/sdk-order-book";
|
|
1551
1551
|
import { getGlobalAdapter as getGlobalAdapter5 } from "@cowprotocol/sdk-common";
|
|
1552
1552
|
import stringify from "json-stable-stringify";
|
|
1553
1553
|
var PCT_100_PERCENT = 10n ** 18n;
|
|
@@ -1572,9 +1572,8 @@ function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
|
|
|
1572
1572
|
}
|
|
1573
1573
|
function toAmountsAndCosts(request, slippageBps, suggestedFees) {
|
|
1574
1574
|
const { amount, sellTokenDecimals, buyTokenDecimals } = request;
|
|
1575
|
-
const
|
|
1576
|
-
const
|
|
1577
|
-
const buyAmountBeforeFee = getBigNumber(sellAmountBeforeFeeBig.num, buyTokenDecimals).big;
|
|
1575
|
+
const sellAmountBeforeFee = BigInt(amount);
|
|
1576
|
+
const buyAmountBeforeFee = sellAmountBeforeFee * 10n ** BigInt(buyTokenDecimals) / 10n ** BigInt(sellTokenDecimals);
|
|
1578
1577
|
const totalRelayerFeePct = BigInt(suggestedFees.totalRelayFee.pct);
|
|
1579
1578
|
const buyAmountAfterFee = applyPctFee(buyAmountBeforeFee, totalRelayerFeePct);
|
|
1580
1579
|
const feeSellToken = sellAmountBeforeFee - applyPctFee(sellAmountBeforeFee, totalRelayerFeePct);
|
|
@@ -3865,7 +3864,7 @@ var BungeeBridgeNames = {
|
|
|
3865
3864
|
};
|
|
3866
3865
|
|
|
3867
3866
|
// src/providers/bungee/util.ts
|
|
3868
|
-
import {
|
|
3867
|
+
import { OrderKind as OrderKind4 } from "@cowprotocol/sdk-order-book";
|
|
3869
3868
|
import stringify2 from "json-stable-stringify";
|
|
3870
3869
|
function toBridgeQuoteResult2(request, slippageBps, bungeeQuoteWithBuildTx) {
|
|
3871
3870
|
const { kind } = request;
|
|
@@ -3894,11 +3893,10 @@ function toBridgeQuoteResult2(request, slippageBps, bungeeQuoteWithBuildTx) {
|
|
|
3894
3893
|
};
|
|
3895
3894
|
}
|
|
3896
3895
|
function toAmountsAndCosts2(request, slippageBps, bungeeQuote) {
|
|
3897
|
-
const { amount
|
|
3898
|
-
const
|
|
3899
|
-
const sellAmountBeforeFee = sellAmountBeforeFeeBig.big;
|
|
3896
|
+
const { amount } = request;
|
|
3897
|
+
const sellAmountBeforeFee = BigInt(amount);
|
|
3900
3898
|
const buyAmountFromBungeeQuote = bungeeQuote.route.output.amount;
|
|
3901
|
-
const buyAmountBeforeFee =
|
|
3899
|
+
const buyAmountBeforeFee = BigInt(buyAmountFromBungeeQuote);
|
|
3902
3900
|
const buyAmountAfterFee = buyAmountBeforeFee;
|
|
3903
3901
|
const feeSellToken = bungeeQuote.route.routeDetails.routeFee.amount;
|
|
3904
3902
|
const feeBuyToken = sellAmountBeforeFee > 0n ? BigInt(feeSellToken) * buyAmountBeforeFee / sellAmountBeforeFee : 0n;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-bridging",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Bridging for CoW Protocol",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@defuse-protocol/one-click-sdk-typescript": "0.1.1-0.2",
|
|
18
18
|
"json-stable-stringify": "^1.3.0",
|
|
19
|
-
"@cowprotocol/sdk-app-data": "4.6.
|
|
20
|
-
"@cowprotocol/sdk-
|
|
21
|
-
"@cowprotocol/sdk-cow-shed": "0.2.
|
|
22
|
-
"@cowprotocol/sdk-
|
|
23
|
-
"@cowprotocol/sdk-
|
|
24
|
-
"@cowprotocol/sdk-
|
|
25
|
-
"@cowprotocol/sdk-trading": "0.
|
|
26
|
-
"@cowprotocol/sdk-weiroll": "0.1.
|
|
19
|
+
"@cowprotocol/sdk-app-data": "4.6.5",
|
|
20
|
+
"@cowprotocol/sdk-common": "0.6.2",
|
|
21
|
+
"@cowprotocol/sdk-cow-shed": "0.2.19",
|
|
22
|
+
"@cowprotocol/sdk-contracts-ts": "1.6.1",
|
|
23
|
+
"@cowprotocol/sdk-order-book": "1.0.0",
|
|
24
|
+
"@cowprotocol/sdk-config": "0.8.1",
|
|
25
|
+
"@cowprotocol/sdk-trading": "1.0.0",
|
|
26
|
+
"@cowprotocol/sdk-weiroll": "0.1.19"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/jest": "^29.4.0",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"tsup": "^7.2.0",
|
|
39
39
|
"typescript": "^5.2.2",
|
|
40
40
|
"viem": "^2.28.4",
|
|
41
|
-
"@cowprotocol/sdk-ethers-v5-adapter": "0.3.
|
|
41
|
+
"@cowprotocol/sdk-ethers-v5-adapter": "0.3.8",
|
|
42
42
|
"@cow-sdk/typescript-config": "0.0.0-beta.0",
|
|
43
|
-
"@cowprotocol/sdk-ethers-v6-adapter": "0.3.
|
|
44
|
-
"@cowprotocol/sdk-viem-adapter": "0.3.
|
|
45
|
-
"@cowprotocol/sdk-order-signing": "0.1.
|
|
43
|
+
"@cowprotocol/sdk-ethers-v6-adapter": "0.3.8",
|
|
44
|
+
"@cowprotocol/sdk-viem-adapter": "0.3.8",
|
|
45
|
+
"@cowprotocol/sdk-order-signing": "0.1.34"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|