Skip to content

Commit 8a84e96

Browse files
authored
feat: support bnb widget swaps via cow (#2672)
1 parent 9b99869 commit 8a84e96

File tree

5 files changed

+26
-109
lines changed

5 files changed

+26
-109
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@amplitude/analytics-browser": "^2.13.0",
3838
"@bgd-labs/aave-address-book": "^4.31.0",
3939
"@cowprotocol/app-data": "^3.1.0",
40-
"@cowprotocol/cow-sdk": "6.0.0-RC.47",
40+
"@cowprotocol/cow-sdk": "6.3.3",
4141
"@emotion/cache": "11.10.3",
4242
"@emotion/react": "11.10.4",
4343
"@emotion/server": "latest",
@@ -157,4 +157,4 @@
157157
"budgetPercentIncreaseRed": 20,
158158
"showDetails": true
159159
}
160-
}
160+
}

src/components/transactions/Switch/cowprotocol/cowprotocol.constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const COW_UNSUPPORTED_ASSETS: Partial<
77
[ModalType.CollateralSwap]: {
88
[SupportedChainId.POLYGON]: 'ALL', // Polygon not supported for collateral swap, waiting better solvers support
99
[SupportedChainId.AVALANCHE]: 'ALL', // Disabled until we have better solvers liquidity
10+
[SupportedChainId.BNB]: 'ALL', // Disabled until we have better solvers liquidity
1011
[SupportedChainId.GNOSIS_CHAIN]: [
1112
'0xedbc7449a9b594ca4e053d9737ec5dc4cbccbfb2'.toLowerCase(), // EURe USD Price not supported
1213
],

src/components/transactions/Switch/cowprotocol/cowprotocol.helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ export const generateCoWExplorerLink = (chainId: SupportedChainId, orderId?: str
337337
return `${base}/avax/orders/${orderId}`;
338338
case SupportedChainId.POLYGON:
339339
return `${base}/pol/orders/${orderId}`;
340+
case SupportedChainId.BNB:
341+
return `${base}/bnb/orders/${orderId}`;
340342
default:
341343
throw new Error('Define explorer link for chainId: ' + chainId);
342344
}

src/components/transactions/Switch/switch.constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const CoWProtocolSupportedNetworks = [
2626
SupportedChainId.SEPOLIA,
2727
SupportedChainId.AVALANCHE,
2828
SupportedChainId.POLYGON,
29+
SupportedChainId.BNB,
2930
] as const;
3031

3132
export const isChainIdSupportedByCoWProtocol = (chainId: number): chainId is SupportedChainId => {

yarn.lock

Lines changed: 20 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,27 +1391,37 @@
13911391
json-stringify-deterministic "^1.0.8"
13921392
multiformats "^9.6.4"
13931393

1394+
"@cowprotocol/app-data@^3.3.0":
1395+
version "3.3.0"
1396+
resolved "https://registry.yarnpkg.com/@cowprotocol/app-data/-/app-data-3.3.0.tgz#644e7473a00eb5e6694a34d34b4359c6d7ef1060"
1397+
integrity sha512-3lfknouwg+j/xSyL5u5FI8rAlGPkzi+QsmXQvPS0O0ETaikx9v9pt5t3pZOv6jtsAmafFBFPtAUp/cdPrDSUaA==
1398+
dependencies:
1399+
ajv "^8.11.0"
1400+
cross-fetch "^3.1.5"
1401+
ipfs-only-hash "^4.0.0"
1402+
json-stringify-deterministic "^1.0.8"
1403+
multiformats "^9.6.4"
1404+
13941405
"@cowprotocol/contracts@^1.8.0":
13951406
version "1.8.0"
13961407
resolved "https://registry.yarnpkg.com/@cowprotocol/contracts/-/contracts-1.8.0.tgz#daffbd9846231c11a74b15a186bb754627e420b0"
13971408
integrity sha512-rMEHo1UBB6k4kRoWejHZNGggg6IBVt7vAd8x0FhEvjxhbq3zlAex61f9HpAcDExJNuvfwwDjsOc/7UGztCzhSw==
13981409

1399-
"@cowprotocol/cow-sdk@6.0.0-RC.47":
1400-
version "6.0.0-RC.47"
1401-
resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-6.0.0-RC.47.tgz#45e993e2d96c49de375d948ad5d51c2623734afd"
1402-
integrity sha512-ilatk1z2MGa50huTezzknWXpxISQHE2XTsv5C08l529q7ZzPVlnbBpdVuilJrDp8hbBEFD4fuLy+tCESZLRk3w==
1410+
"@cowprotocol/cow-sdk@6.3.3":
1411+
version "6.3.3"
1412+
resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-6.3.3.tgz#a299d5596c58771a33c7298f61a555d5cdbd1297"
1413+
integrity sha512-34fy9xdmWn2/4LBEP7vPYG5WBMBHdc45ajaETt2RnpNIJYxHt/0IYjBKIdDw4QT73JVEo6+1TMSBUha1eSMn+A==
14031414
dependencies:
1404-
"@cowprotocol/app-data" "^3.1.0"
1415+
"@cowprotocol/app-data" "^3.3.0"
14051416
"@cowprotocol/contracts" "^1.8.0"
14061417
"@ethersproject/abstract-signer" "^5.8.0"
14071418
"@openzeppelin/merkle-tree" "^1.0.8"
14081419
"@weiroll/weiroll.js" "^0.3.0"
14091420
cross-fetch "^3.2.0"
14101421
deepmerge "^4.3.1"
1411-
ethers "^5.8.0"
14121422
exponential-backoff "^3.1.2"
14131423
graphql "^16.11.0"
1414-
graphql-request "^4.3.0"
1424+
graphql-request "^6.1.0"
14151425
limiter "^3.0.0"
14161426

14171427
"@cspotcode/source-map-support@^0.8.0":
@@ -5828,14 +5838,6 @@ cachedir@^2.3.0:
58285838
resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-2.4.0.tgz#7fef9cf7367233d7c88068fe6e34ed0d355a610d"
58295839
integrity sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==
58305840

5831-
call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2:
5832-
version "1.0.2"
5833-
resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6"
5834-
integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==
5835-
dependencies:
5836-
es-errors "^1.3.0"
5837-
function-bind "^1.1.2"
5838-
58395841
call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7:
58405842
version "1.0.7"
58415843
resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9"
@@ -6933,15 +6935,6 @@ dotenv@^16.0.3:
69336935
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.6.tgz#fc88e8a664087abf3e19d61e21f7feee1849bbb1"
69346936
integrity sha512-JhcR/+KIjkkjiU8yEpaB/USlzVi3i5whwOjpIRNGi9svKEXZSe+Qp6IWAjFjv+2GViAoDRCUv/QLNziQxsLqDg==
69356937

6936-
dunder-proto@^1.0.1:
6937-
version "1.0.1"
6938-
resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a"
6939-
integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==
6940-
dependencies:
6941-
call-bind-apply-helpers "^1.0.1"
6942-
es-errors "^1.3.0"
6943-
gopd "^1.2.0"
6944-
69456938
duplexer2@^0.1.2:
69466939
version "0.1.4"
69476940
resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1"
@@ -7158,11 +7151,6 @@ es-define-property@^1.0.0:
71587151
dependencies:
71597152
get-intrinsic "^1.2.4"
71607153

7161-
es-define-property@^1.0.1:
7162-
version "1.0.1"
7163-
resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa"
7164-
integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==
7165-
71667154
es-errors@^1.2.1, es-errors@^1.3.0:
71677155
version "1.3.0"
71687156
resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f"
@@ -7211,13 +7199,6 @@ es-object-atoms@^1.0.0:
72117199
dependencies:
72127200
es-errors "^1.3.0"
72137201

7214-
es-object-atoms@^1.1.1:
7215-
version "1.1.1"
7216-
resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1"
7217-
integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==
7218-
dependencies:
7219-
es-errors "^1.3.0"
7220-
72217202
es-set-tostringtag@^2.0.3:
72227203
version "2.0.3"
72237204
resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz#8bb60f0a440c2e4281962428438d58545af39777"
@@ -7227,16 +7208,6 @@ es-set-tostringtag@^2.0.3:
72277208
has-tostringtag "^1.0.2"
72287209
hasown "^2.0.1"
72297210

7230-
es-set-tostringtag@^2.1.0:
7231-
version "2.1.0"
7232-
resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d"
7233-
integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==
7234-
dependencies:
7235-
es-errors "^1.3.0"
7236-
get-intrinsic "^1.2.6"
7237-
has-tostringtag "^1.0.2"
7238-
hasown "^2.0.2"
7239-
72407211
es-shim-unscopables@^1.0.0, es-shim-unscopables@^1.0.2:
72417212
version "1.0.2"
72427213
resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz#1f6942e71ecc7835ed1c8a83006d8771a63a3763"
@@ -7687,7 +7658,7 @@ ethers@^5.0.15, ethers@^5.5.4, ethers@^5.7.0:
76877658
"@ethersproject/web" "5.7.1"
76887659
"@ethersproject/wordlists" "5.7.0"
76897660

7690-
ethers@^5.3.1, ethers@^5.8.0:
7661+
ethers@^5.3.1:
76917662
version "5.8.0"
76927663
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.8.0.tgz#97858dc4d4c74afce83ea7562fe9493cedb4d377"
76937664
integrity sha512-DUq+7fHrCg1aPDFCHx6UIPb3nmt2XMpM7Y/g2gLhsl3lIBqeAfOJIl1qEvRf2uq3BiKxmh6Fh5pfp2ieyek7Kg==
@@ -7865,11 +7836,6 @@ external-editor@^3.0.3:
78657836
iconv-lite "^0.4.24"
78667837
tmp "^0.0.33"
78677838

7868-
extract-files@^9.0.0:
7869-
version "9.0.0"
7870-
resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a"
7871-
integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==
7872-
78737839
78747840
version "2.0.1"
78757841
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a"
@@ -8048,16 +8014,6 @@ forever-agent@~0.6.1:
80488014
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
80498015
integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==
80508016

8051-
form-data@^3.0.0:
8052-
version "3.0.3"
8053-
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.3.tgz#349c8f2c9d8f8f0c879ee0eb7cc0d300018d6b09"
8054-
integrity sha512-q5YBMeWy6E2Un0nMGWMgI65MAKtaylxfNJGJxpGh45YDciZB4epbWpaAfImil6CPAPTYB4sh0URQNDRIZG5F2w==
8055-
dependencies:
8056-
asynckit "^0.4.0"
8057-
combined-stream "^1.0.8"
8058-
es-set-tostringtag "^2.1.0"
8059-
mime-types "^2.1.35"
8060-
80618017
form-data@^4.0.0:
80628018
version "4.0.1"
80638019
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48"
@@ -8167,22 +8123,6 @@ get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2, get-intrinsic@
81678123
has-symbols "^1.0.3"
81688124
hasown "^2.0.0"
81698125

8170-
get-intrinsic@^1.2.6:
8171-
version "1.3.0"
8172-
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01"
8173-
integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==
8174-
dependencies:
8175-
call-bind-apply-helpers "^1.0.2"
8176-
es-define-property "^1.0.1"
8177-
es-errors "^1.3.0"
8178-
es-object-atoms "^1.1.1"
8179-
function-bind "^1.1.2"
8180-
get-proto "^1.0.1"
8181-
gopd "^1.2.0"
8182-
has-symbols "^1.1.0"
8183-
hasown "^2.0.2"
8184-
math-intrinsics "^1.1.0"
8185-
81868126
get-package-type@^0.1.0:
81878127
version "0.1.0"
81888128
resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a"
@@ -8193,14 +8133,6 @@ get-port-please@^3.1.2:
81938133
resolved "https://registry.yarnpkg.com/get-port-please/-/get-port-please-3.1.2.tgz#502795e56217128e4183025c89a48c71652f4e49"
81948134
integrity sha512-Gxc29eLs1fbn6LQ4jSU4vXjlwyZhF5HsGuMAa7gqBP4Rw4yxxltyDUuF5MBclFzDTXO+ACchGQoeela4DSfzdQ==
81958135

8196-
get-proto@^1.0.1:
8197-
version "1.0.1"
8198-
resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1"
8199-
integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==
8200-
dependencies:
8201-
dunder-proto "^1.0.1"
8202-
es-object-atoms "^1.0.0"
8203-
82048136
get-stream@^5.0.0, get-stream@^5.1.0:
82058137
version "5.2.0"
82068138
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
@@ -8350,11 +8282,6 @@ gopd@^1.0.1, gopd@^1.1.0:
83508282
dependencies:
83518283
get-intrinsic "^1.2.4"
83528284

8353-
gopd@^1.2.0:
8354-
version "1.2.0"
8355-
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1"
8356-
integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==
8357-
83588285
gql.tada@^1.8.13:
83598286
version "1.8.13"
83608287
resolved "https://registry.yarnpkg.com/gql.tada/-/gql.tada-1.8.13.tgz#a724bbdaebe1d851d80bf59c5e8614956914b883"
@@ -8375,15 +8302,6 @@ graphemer@^1.4.0:
83758302
resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6"
83768303
integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==
83778304

8378-
graphql-request@^4.3.0:
8379-
version "4.3.0"
8380-
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-4.3.0.tgz#b934e08fcae764aa2cdc697d3c821f046cb5dbf2"
8381-
integrity sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow==
8382-
dependencies:
8383-
cross-fetch "^3.1.5"
8384-
extract-files "^9.0.0"
8385-
form-data "^3.0.0"
8386-
83878305
graphql-request@^6.1.0:
83888306
version "6.1.0"
83898307
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-6.1.0.tgz#f4eb2107967af3c7a5907eb3131c671eac89be4f"
@@ -8477,7 +8395,7 @@ has-proto@^1.0.1, has-proto@^1.0.3:
84778395
dependencies:
84788396
call-bind "^1.0.7"
84798397

8480-
has-symbols@^1.0.3, has-symbols@^1.1.0:
8398+
has-symbols@^1.0.3:
84818399
version "1.1.0"
84828400
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338"
84838401
integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==
@@ -10206,11 +10124,6 @@ math-expression-evaluator@^1.2.14:
1020610124
resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.4.0.tgz#3d66031117fbb7b9715ea6c9c68c2cd2eebd37e2"
1020710125
integrity sha512-4vRUvPyxdO8cWULGTh9dZWL2tZK6LDBvj+OGHBER7poH9Qdt7kXEoj20wiz4lQUbUXQZFjPbe5mVDo9nutizCw==
1020810126

10209-
math-intrinsics@^1.1.0:
10210-
version "1.1.0"
10211-
resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9"
10212-
integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==
10213-
1021410127
mdast-util-definitions@^5.0.0:
1021510128
version "5.1.2"
1021610129
resolved "https://registry.yarnpkg.com/mdast-util-definitions/-/mdast-util-definitions-5.1.2.tgz#9910abb60ac5d7115d6819b57ae0bcef07a3f7a7"
@@ -10710,7 +10623,7 @@ [email protected]:
1071010623
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
1071110624
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
1071210625

10713-
mime-types@^2.1.12, mime-types@^2.1.35, mime-types@~2.1.19:
10626+
mime-types@^2.1.12, mime-types@~2.1.19:
1071410627
version "2.1.35"
1071510628
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
1071610629
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==

0 commit comments

Comments
 (0)