From 2c93e1dfbc1550c3e45daa0e69032b5fe84db2b5 Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Fri, 21 Mar 2025 15:28:46 +0000 Subject: [PATCH 1/7] chore: upgrade CC to support Optimism chains --- package-lock.json | 55 ++++++++++++++++++++-------------- package.json | 4 +-- src/lib/constants/chainInfo.ts | 19 ++++++++++++ src/lib/constants/chains.ts | 3 ++ 4 files changed, 56 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec7830b84..3f160c817 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.37.0", + "@bosonprotocol/react-kit": "^0.38.0", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.7.0", @@ -38,7 +38,7 @@ "@uniswap/permit2-sdk": "^1.2.0", "@uniswap/redux-multicall": "^1.1.8", "@uniswap/router-sdk": "^1.6.0", - "@uniswap/sdk-core": "^4.0.6", + "@uniswap/sdk-core": "^4.2.1", "@uniswap/smart-order-router": "^3.15.14", "@uniswap/token-lists": "^1.0.0-beta.33", "@uniswap/uniswapx-sdk": "^1.4.0", @@ -3423,9 +3423,9 @@ } }, "node_modules/@bosonprotocol/common": { - "version": "1.30.3", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.3.tgz", - "integrity": "sha512-R/AvlXYPTLafzUB/ywSxnoeL61L0yNjVZldeWSnh6bxYX906cTsb3IB/QkuyjXUTzVrRGqShqbgKOeDIJtemVg==", + "version": "1.30.4", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.4.tgz", + "integrity": "sha512-7Qpxuy+8JEqvx+6GX4ozSD3YzmwUVMoF4rj2ULyfxxZA2SJOlqUMOoJh23gkQ/IutBw+yMCrRKezEmM6gZUYQg==", "dependencies": { "@bosonprotocol/metadata": "^1.16.3", "@ethersproject/abi": "^5.5.0", @@ -3436,11 +3436,11 @@ } }, "node_modules/@bosonprotocol/core-sdk": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.43.0.tgz", - "integrity": "sha512-9mCMi92nsKKDHPvaZ493pUCElVRVN4p3iAaE2OtfE2L0j9qLWN9iyGiQkYqabZAUOh8bq4AwkCQX3rzDb+Wpbg==", + "version": "1.43.1", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.43.1.tgz", + "integrity": "sha512-QptwUrJ2wLBJfSz0zGQZgeOqg6qlSr42tf5s/i1/VwIxZJMByw6+ZzMTbFRpGeh4bWQo6qKRU1Xv3PUFy673lQ==", "dependencies": { - "@bosonprotocol/common": "^1.30.3", + "@bosonprotocol/common": "^1.30.4", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -3456,11 +3456,11 @@ } }, "node_modules/@bosonprotocol/ethers-sdk": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.15.4.tgz", - "integrity": "sha512-10NQIpCcOv3s5HbT7U1cni2ugbFcVQ7eAG5V93gZIabRHFnFQxtEYLdiYMfAv5cvKctxUqIPj7FaPal4uoYy7A==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.15.5.tgz", + "integrity": "sha512-92L4mv4XHrrriFWyIA9ek//7+oEdkY05b4phbO7Tm7jbtod14BE0a+vpdw21x0C34sIyGirrpKae6Rx1nrk5TA==", "dependencies": { - "@bosonprotocol/common": "^1.30.3" + "@bosonprotocol/common": "^1.30.4" }, "peerDependencies": { "ethers": "^5.5.0" @@ -3493,13 +3493,13 @@ "integrity": "sha512-f2W2SQAvY5IKD6L9JwaiNye7gGRIIPd/HOB0i+otWLzMPBlwQtbN4JeWSuKeJvuaqu8tyMy7CHzN8EkhrJDB+A==" }, "node_modules/@bosonprotocol/react-kit": { - "version": "0.37.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.37.0.tgz", - "integrity": "sha512-NfsqpZAIucCScGSd2e6Q+zGMgAb6hzWmHUv9pgFiPlYBqI8WGcxdmaWr6qeTv7APHZCYoyH1Xso0hg2iJpB35A==", + "version": "0.38.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.38.0.tgz", + "integrity": "sha512-LBKO6snL27Rp+XvaOoHPBZQblfGBmKVSs9hyIR69xlLKS+f0tFmrD46G4KItIHiHKTNoLst6Owf4ne6gtLlZig==", "dependencies": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.43.0", - "@bosonprotocol/ethers-sdk": "^1.15.4", + "@bosonprotocol/core-sdk": "^1.43.1", + "@bosonprotocol/ethers-sdk": "^1.15.5", "@bosonprotocol/ipfs-storage": "^1.12.0", "@bosonprotocol/roblox-sdk": "^1.0.0-alpha.16", "@davatar/react": "1.11.1", @@ -3526,7 +3526,7 @@ "cids": "^1.1.9", "dayjs": "1.11.7", "eth-revert-reason": "^1.0.3", - "formik": "2.2.9", + "formik": "^2.4.6", "graphql-request": "5.2.0", "i": "^0.3.7", "jotai": "^1.13.1", @@ -16059,7 +16059,9 @@ } }, "node_modules/@uniswap/sdk-core": { - "version": "4.0.7", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-4.2.1.tgz", + "integrity": "sha512-hr7vwYrXScg+V8/rRc2UL/Ixc/p0P7yqe4D/OxzUdMRYr8RZd+8z5Iu9+WembjZT/DCdbTjde6lsph4Og0n1BQ==", "license": "MIT", "dependencies": { "@ethersproject/address": "^5.0.2", @@ -24812,22 +24814,24 @@ } }, "node_modules/formik": { - "version": "2.2.9", + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/formik/-/formik-2.4.6.tgz", + "integrity": "sha512-A+2EI7U7aG296q2TLGvNapDNTZp1khVt5Vk0Q/fyfSROss0V/V6+txt2aJnwEos44IxTCW/LYAi/zgWzlevj+g==", "funding": [ { "type": "individual", "url": "https://opencollective.com/formik" } ], - "license": "Apache-2.0", "dependencies": { + "@types/hoist-non-react-statics": "^3.3.1", "deepmerge": "^2.1.1", "hoist-non-react-statics": "^3.3.0", "lodash": "^4.17.21", "lodash-es": "^4.17.21", "react-fast-compare": "^2.0.1", "tiny-warning": "^1.0.2", - "tslib": "^1.10.0" + "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" @@ -24840,6 +24844,11 @@ "node": ">=0.10.0" } }, + "node_modules/formik/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, "node_modules/forwarded": { "version": "0.2.0", "license": "MIT", diff --git a/package.json b/package.json index 11339944b..8de4642a8 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.37.0", + "@bosonprotocol/react-kit": "^0.38.0", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.7.0", @@ -74,7 +74,7 @@ "@uniswap/permit2-sdk": "^1.2.0", "@uniswap/redux-multicall": "^1.1.8", "@uniswap/router-sdk": "^1.6.0", - "@uniswap/sdk-core": "^4.0.6", + "@uniswap/sdk-core": "^4.2.1", "@uniswap/smart-order-router": "^3.15.14", "@uniswap/token-lists": "^1.0.0-beta.33", "@uniswap/uniswapx-sdk": "^1.4.0", diff --git a/src/lib/constants/chainInfo.ts b/src/lib/constants/chainInfo.ts index edd0328d2..451d10484 100644 --- a/src/lib/constants/chainInfo.ts +++ b/src/lib/constants/chainInfo.ts @@ -150,6 +150,25 @@ const CHAIN_INFO: ChainInfoMap = { decimals: 18 } }, + [ChainId.OPTIMISM_SEPOLIA]: { + networkType: NetworkType.L2, + blockWaitMsBeforeWarning: ms(`25m`), + defaultListUrl: OPTIMISM_LIST, + bridge: "https://testnets.superbridge.app/optimism-sepolia", + docs: "https://docs.optimism.io", + explorer: "https://sepolia-optimistic.etherscan.io/", + infoLink: "https://info.uniswap.org/#/optimism-sepolia/", + label: "Optimism Sepolia", + logoUrl: optimismLogoUrl, + statusPage: "https://optimism.io/status", + helpCenterUrl: + "https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ", + nativeCurrency: { + name: "Ether", + symbol: "OpETH", + decimals: 18 + } + }, [ChainId.ARBITRUM_ONE]: { networkType: NetworkType.L2, blockWaitMsBeforeWarning: ms(`10m`), diff --git a/src/lib/constants/chains.ts b/src/lib/constants/chains.ts index db3840233..a45d15faf 100644 --- a/src/lib/constants/chains.ts +++ b/src/lib/constants/chains.ts @@ -29,6 +29,7 @@ export const CHAIN_IDS_TO_NAMES = { [ChainId.ARBITRUM_GOERLI]: "arbitrum_goerli", [ChainId.OPTIMISM]: "optimism", [ChainId.OPTIMISM_GOERLI]: "optimism_goerli", + [ChainId.OPTIMISM_SEPOLIA]: "optimism_sepolia", [ChainId.BNB]: "bnb", [ChainId.AVALANCHE]: "avalanche", [ChainId.BASE]: "base", @@ -50,6 +51,7 @@ export const CHAIN_IDS_TO_FRIENDLY_NAMES = { [ChainId.ARBITRUM_GOERLI]: "Arbitrum Goerli", [ChainId.OPTIMISM]: "Optimism", [ChainId.OPTIMISM_GOERLI]: "Optimism Goerli", + [ChainId.OPTIMISM_SEPOLIA]: "OP-Sepolia", [ChainId.BNB]: "Bnb", [ChainId.AVALANCHE]: "Avalanche", [ChainId.BASE]: "Base", @@ -80,6 +82,7 @@ export function isSupportedChain( if (featureFlags && chainId && chainId in featureFlags) { return featureFlags[chainId]; } + // TODO: add Optimism chains return ( !!chainId && ACTUALLY_SUPPORTED_CHAINS.indexOf(chainId) !== -1 && From 4815cf053df51b2ae4cc36d8712dd02baab5f5cd Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Fri, 21 Mar 2025 16:23:45 +0000 Subject: [PATCH 2/7] upgrade cc deps --- package-lock.json | 83 +++++++++++++++++++++++---- package.json | 2 +- src/lib/constants/chains.ts | 13 +++-- src/lib/constants/providers.ts | 10 ---- src/lib/utils/hooks/useSwitchChain.ts | 9 ++- 5 files changed, 87 insertions(+), 30 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3f160c817..ef03aec25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.38.0", + "@bosonprotocol/react-kit": "^0.39.0-alpha.2", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.7.0", @@ -3426,6 +3426,7 @@ "version": "1.30.4", "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.4.tgz", "integrity": "sha512-7Qpxuy+8JEqvx+6GX4ozSD3YzmwUVMoF4rj2ULyfxxZA2SJOlqUMOoJh23gkQ/IutBw+yMCrRKezEmM6gZUYQg==", + "peer": true, "dependencies": { "@bosonprotocol/metadata": "^1.16.3", "@ethersproject/abi": "^5.5.0", @@ -3439,6 +3440,7 @@ "version": "1.43.1", "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.43.1.tgz", "integrity": "sha512-QptwUrJ2wLBJfSz0zGQZgeOqg6qlSr42tf5s/i1/VwIxZJMByw6+ZzMTbFRpGeh4bWQo6qKRU1Xv3PUFy673lQ==", + "peer": true, "dependencies": { "@bosonprotocol/common": "^1.30.4", "@ethersproject/abi": "^5.5.0", @@ -3456,16 +3458,29 @@ } }, "node_modules/@bosonprotocol/ethers-sdk": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.15.5.tgz", - "integrity": "sha512-92L4mv4XHrrriFWyIA9ek//7+oEdkY05b4phbO7Tm7jbtod14BE0a+vpdw21x0C34sIyGirrpKae6Rx1nrk5TA==", + "version": "1.15.6-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.15.6-alpha.0.tgz", + "integrity": "sha512-Om99Ys1WylRuKXvj8kyhQ7fmm/BgWLZJmnBqH7gdrl4UoCAbZUfxRplgskmmBXS2loFXM5kbKVrqJOdqpGMTvg==", "dependencies": { - "@bosonprotocol/common": "^1.30.4" + "@bosonprotocol/common": "^1.30.5-alpha.0" }, "peerDependencies": { "ethers": "^5.5.0" } }, + "node_modules/@bosonprotocol/ethers-sdk/node_modules/@bosonprotocol/common": { + "version": "1.30.5-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.5-alpha.0.tgz", + "integrity": "sha512-hUVs2nKyfOnkz5UB6Na7O/65BzaZgvLk0w9wGP9comD2zAX9/oa2pAkP+53wbOg8aFi90GDNez+2mIUF4upyCA==", + "dependencies": { + "@bosonprotocol/metadata": "^1.16.3", + "@ethersproject/abi": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/units": "^5.5.0" + } + }, "node_modules/@bosonprotocol/ipfs-storage": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.12.0.tgz", @@ -3493,13 +3508,13 @@ "integrity": "sha512-f2W2SQAvY5IKD6L9JwaiNye7gGRIIPd/HOB0i+otWLzMPBlwQtbN4JeWSuKeJvuaqu8tyMy7CHzN8EkhrJDB+A==" }, "node_modules/@bosonprotocol/react-kit": { - "version": "0.38.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.38.0.tgz", - "integrity": "sha512-LBKO6snL27Rp+XvaOoHPBZQblfGBmKVSs9hyIR69xlLKS+f0tFmrD46G4KItIHiHKTNoLst6Owf4ne6gtLlZig==", + "version": "0.39.0-alpha.2", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.39.0-alpha.2.tgz", + "integrity": "sha512-8//Y1R9j8REK6/DJN+8DOeu95+KcZ0EY3C0B1OlnAMi31NJo4xtNndT303C8cF0NQpjBoyd8paW6/yR4dHCbkg==", "dependencies": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.43.1", - "@bosonprotocol/ethers-sdk": "^1.15.5", + "@bosonprotocol/core-sdk": "^1.43.2-alpha.0", + "@bosonprotocol/ethers-sdk": "^1.15.6-alpha.0", "@bosonprotocol/ipfs-storage": "^1.12.0", "@bosonprotocol/roblox-sdk": "^1.0.0-alpha.16", "@davatar/react": "1.11.1", @@ -3510,7 +3525,7 @@ "@svgr/webpack": "^8.1.0", "@tippyjs/react": "4.2.6", "@uniswap/redux-multicall": "^1.1.8", - "@uniswap/sdk-core": "^4.0.7", + "@uniswap/sdk-core": "^4.2.1", "@uniswap/token-lists": "^1.0.0-beta.33", "@uniswap/v2-sdk": "^3.3.0", "@uniswap/v3-periphery": "^1.4.4", @@ -3578,6 +3593,52 @@ "yup": "^1.5.0" } }, + "node_modules/@bosonprotocol/react-kit/node_modules/@bosonprotocol/common": { + "version": "1.30.5-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.5-alpha.0.tgz", + "integrity": "sha512-hUVs2nKyfOnkz5UB6Na7O/65BzaZgvLk0w9wGP9comD2zAX9/oa2pAkP+53wbOg8aFi90GDNez+2mIUF4upyCA==", + "dependencies": { + "@bosonprotocol/metadata": "^1.16.3", + "@ethersproject/abi": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/units": "^5.5.0" + } + }, + "node_modules/@bosonprotocol/react-kit/node_modules/@bosonprotocol/core-sdk": { + "version": "1.43.2-alpha.0", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.43.2-alpha.0.tgz", + "integrity": "sha512-OHTR5EWdOCJy9Y3KAitR72hnR8SaaKc6JealXGyJqfriIUVXok/tjWCUP954UiIFsR2usSp6kGH586rO/LyitA==", + "dependencies": { + "@bosonprotocol/common": "^1.30.5-alpha.0", + "@ethersproject/abi": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/units": "^5.5.0", + "cross-fetch": "^3.1.5", + "graphql": "^16.5.0", + "graphql-request": "^4.3.0", + "mustache": "^4.2.0", + "opensea-js": "^7.1.13", + "schema-to-yup": "^1.11.11" + } + }, + "node_modules/@bosonprotocol/react-kit/node_modules/@bosonprotocol/core-sdk/node_modules/graphql-request": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-4.3.0.tgz", + "integrity": "sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow==", + "dependencies": { + "cross-fetch": "^3.1.5", + "extract-files": "^9.0.0", + "form-data": "^3.0.0" + }, + "peerDependencies": { + "graphql": "14 - 16" + } + }, "node_modules/@bosonprotocol/react-kit/node_modules/@ethersproject/units": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.0.tgz", diff --git a/package.json b/package.json index 8de4642a8..0b636df0e 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.38.0", + "@bosonprotocol/react-kit": "^0.39.0-alpha.2", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.7.0", diff --git a/src/lib/constants/chains.ts b/src/lib/constants/chains.ts index a45d15faf..c2cb6f4a9 100644 --- a/src/lib/constants/chains.ts +++ b/src/lib/constants/chains.ts @@ -1,7 +1,4 @@ -import { - ChainId, - SUPPORTED_CHAINS as _SUPPORTED_CHAINS -} from "@uniswap/sdk-core"; +import { ChainId } from "@uniswap/sdk-core"; import { envChainIds } from "lib/config"; export const LocalChainId = 31337; @@ -27,6 +24,7 @@ export const CHAIN_IDS_TO_NAMES = { [ChainId.CELO_ALFAJORES]: "celo_alfajores", [ChainId.ARBITRUM_ONE]: "arbitrum", [ChainId.ARBITRUM_GOERLI]: "arbitrum_goerli", + [ChainId.ARBITRUM_SEPOLIA]: "arbitrum_sepolia", [ChainId.OPTIMISM]: "optimism", [ChainId.OPTIMISM_GOERLI]: "optimism_goerli", [ChainId.OPTIMISM_SEPOLIA]: "optimism_sepolia", @@ -62,9 +60,14 @@ export const CHAIN_IDS_TO_FRIENDLY_NAMES = { const SUPPORTED_CHAINS = [ LocalChainId, + ChainId.MAINNET, + ChainId.POLYGON, + ChainId.OPTIMISM, + ChainId.BASE, + ChainId.SEPOLIA, ChainId_POLYGON_AMOY, ChainId_BASE_SEPOLIA, - ..._SUPPORTED_CHAINS + ChainId.OPTIMISM_SEPOLIA ] as const; export declare type SupportedChainsType = (typeof SUPPORTED_CHAINS)[number]; diff --git a/src/lib/constants/providers.ts b/src/lib/constants/providers.ts index 07a0684c9..7888c1ac8 100644 --- a/src/lib/constants/providers.ts +++ b/src/lib/constants/providers.ts @@ -72,20 +72,10 @@ export const RPC_PROVIDERS: { [key: number]: StaticJsonRpcProvider; } = { [ChainId.MAINNET]: new AppJsonRpcProvider(ChainId.MAINNET), - [ChainId.GOERLI]: new AppJsonRpcProvider(ChainId.GOERLI), [ChainId.SEPOLIA]: new AppJsonRpcProvider(ChainId.SEPOLIA), [ChainId.OPTIMISM]: new AppJsonRpcProvider(ChainId.OPTIMISM), - [ChainId.OPTIMISM_GOERLI]: new AppJsonRpcProvider(ChainId.OPTIMISM_GOERLI), - [ChainId.ARBITRUM_ONE]: new AppJsonRpcProvider(ChainId.ARBITRUM_ONE), - [ChainId.ARBITRUM_GOERLI]: new AppJsonRpcProvider(ChainId.ARBITRUM_GOERLI), [ChainId.POLYGON]: new AppJsonRpcProvider(ChainId.POLYGON), - [ChainId.POLYGON_MUMBAI]: new AppJsonRpcProvider(ChainId.POLYGON_MUMBAI), [ChainId_POLYGON_AMOY]: new AppJsonRpcProvider(ChainId_POLYGON_AMOY), - [ChainId.CELO]: new AppJsonRpcProvider(ChainId.CELO), - [ChainId.CELO_ALFAJORES]: new AppJsonRpcProvider(ChainId.CELO_ALFAJORES), - [ChainId.BNB]: new AppJsonRpcProvider(ChainId.BNB), - [ChainId.AVALANCHE]: new AppJsonRpcProvider(ChainId.AVALANCHE), [ChainId.BASE]: new AppJsonRpcProvider(ChainId.BASE), - [ChainId.BASE_GOERLI]: new AppJsonRpcProvider(ChainId.BASE_GOERLI), [ChainId_BASE_SEPOLIA]: new AppJsonRpcProvider(ChainId_BASE_SEPOLIA) }; diff --git a/src/lib/utils/hooks/useSwitchChain.ts b/src/lib/utils/hooks/useSwitchChain.ts index 4a1e4b9f7..188c8ceb1 100644 --- a/src/lib/utils/hooks/useSwitchChain.ts +++ b/src/lib/utils/hooks/useSwitchChain.ts @@ -12,7 +12,11 @@ import { walletConnectV2Connection } from "../../connection"; import { getChainInfo } from "../../constants/chainInfo"; -import { isSupportedChain, SupportedChainsType } from "../../constants/chains"; +import { + ChainId_POLYGON_AMOY, + isSupportedChain, + SupportedChainsType +} from "../../constants/chains"; import { useChainId } from "./connection/connection"; const RPC_URLS = CONFIG.rpcUrls; const localChainId = 31337; @@ -22,9 +26,8 @@ const localRpcUrl = getEnvConfigs("local").find( function getRpcUrl(chainId: SupportedChainsType): string { switch (chainId) { case ChainId.MAINNET: - case ChainId.GOERLI: case ChainId.SEPOLIA: - case 80002: + case ChainId_POLYGON_AMOY: return RPC_URLS[chainId][0]; case localChainId: { if (localRpcUrl) { From 882bff9ce940640ccc72c010e39bd785d788c0c9 Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Tue, 25 Mar 2025 16:29:16 +0000 Subject: [PATCH 3/7] chore: resolve warnings [DEPRECATED]: use `useSetAtom/useAtomValue` from `jotai` instead --- src/components/header/accountDrawer/index.tsx | 9 ++++----- src/lib/connection/activate.ts | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/header/accountDrawer/index.tsx b/src/components/header/accountDrawer/index.tsx index 036cc2c20..b5e19fbbe 100644 --- a/src/components/header/accountDrawer/index.tsx +++ b/src/components/header/accountDrawer/index.tsx @@ -1,5 +1,4 @@ -import { atom } from "jotai"; -import { useAtomValue, useUpdateAtom } from "jotai/utils"; +import { atom, useAtomValue, useSetAtom } from "jotai"; import { colors } from "lib/styles/colors"; import { CaretDoubleRight } from "phosphor-react"; import { memo, useCallback, useEffect, useRef, useState } from "react"; @@ -23,14 +22,14 @@ const DRAWER_TOP_MARGIN_MOBILE_WEB = "72px"; const accountDrawerOpenAtom = atom(false); export function useToggleAccountDrawer() { - const updateAccountDrawerOpen = useUpdateAtom(accountDrawerOpenAtom); + const updateAccountDrawerOpen = useSetAtom(accountDrawerOpenAtom); return useCallback(() => { updateAccountDrawerOpen((open) => !open); }, [updateAccountDrawerOpen]); } export function useCloseAccountDrawer() { - const updateAccountDrawerOpen = useUpdateAtom(accountDrawerOpenAtom); + const updateAccountDrawerOpen = useSetAtom(accountDrawerOpenAtom); return useCallback( () => updateAccountDrawerOpen(false), [updateAccountDrawerOpen] @@ -44,7 +43,7 @@ export function useAccountDrawer(): [boolean, () => void] { export function useOpenAccountDrawer(): [boolean, () => void] { const accountDrawerOpen = useAtomValue(accountDrawerOpenAtom); - const updateAccountDrawerOpen = useUpdateAtom(accountDrawerOpenAtom); + const updateAccountDrawerOpen = useSetAtom(accountDrawerOpenAtom); return [ accountDrawerOpen, useCallback(() => updateAccountDrawerOpen(true), [updateAccountDrawerOpen]) diff --git a/src/lib/connection/activate.ts b/src/lib/connection/activate.ts index 7205ff572..afcf57fe3 100644 --- a/src/lib/connection/activate.ts +++ b/src/lib/connection/activate.ts @@ -1,6 +1,5 @@ import { ChainId } from "@uniswap/sdk-core"; -import { atom } from "jotai"; -import { useAtomValue, useUpdateAtom } from "jotai/utils"; +import { atom, useAtomValue, useSetAtom } from "jotai"; import { useCallback } from "react"; import { useAppDispatch } from "state/hooks"; import { updateSelectedWallet } from "state/user/reducer"; @@ -34,7 +33,7 @@ const activationStateAtom = atom(IDLE_ACTIVATION_STATE); function useTryActivation() { const dispatch = useAppDispatch(); - const setActivationState = useUpdateAtom(activationStateAtom); + const setActivationState = useSetAtom(activationStateAtom); return useCallback( async ( @@ -83,7 +82,7 @@ function useTryActivation() { } function useCancelActivation() { - const setActivationState = useUpdateAtom(activationStateAtom); + const setActivationState = useSetAtom(activationStateAtom); return useCallback( () => setActivationState((activationState) => { From fb300824382e357b0d1db83f4fedb8ad6aa6edaf Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Tue, 25 Mar 2025 16:30:19 +0000 Subject: [PATCH 4/7] add missing constants for OPTIMISM_SEPOLIA chain --- src/lib/constants/chains.ts | 15 ++++++++------- src/lib/constants/providers.ts | 3 ++- src/lib/constants/routing.ts | 7 ++++++- src/lib/constants/tokens.ts | 7 +++++++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/lib/constants/chains.ts b/src/lib/constants/chains.ts index c2cb6f4a9..4b0169cff 100644 --- a/src/lib/constants/chains.ts +++ b/src/lib/constants/chains.ts @@ -109,7 +109,7 @@ export const SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [ ChainId.MAINNET, ChainId.POLYGON, // ChainId.CELO, - // ChainId.OPTIMISM, + ChainId.OPTIMISM, // ChainId.ARBITRUM_ONE // ChainId.BNB, // ChainId.AVALANCHE, @@ -122,6 +122,7 @@ export const TESTNET_CHAIN_IDS = [ ChainId.POLYGON_MUMBAI, ChainId_POLYGON_AMOY, ChainId_BASE_SEPOLIA, + ChainId.OPTIMISM_SEPOLIA, LocalChainId // ChainId.ARBITRUM_GOERLI, // ChainId.OPTIMISM_GOERLI, @@ -155,8 +156,8 @@ export type SupportedL1ChainId = (typeof L1_CHAIN_IDS)[number]; export const L2_CHAIN_IDS = [ // ChainId.ARBITRUM_ONE, // ChainId.ARBITRUM_GOERLI, - // ChainId.OPTIMISM, - // ChainId.OPTIMISM_GOERLI + ChainId.OPTIMISM, + ChainId.OPTIMISM_SEPOLIA, ChainId.BASE, ChainId_BASE_SEPOLIA // ChainId.BASE_GOERLI @@ -183,10 +184,10 @@ export function getChainPriority(chainId: number): number { return 1; // case ChainId.ARBITRUM_ONE: // case ChainId.ARBITRUM_GOERLI: - // return 2; - // case ChainId.OPTIMISM: - // case ChainId.OPTIMISM_GOERLI: - // return 3; + // return 2; + case ChainId.OPTIMISM: + case ChainId.OPTIMISM_SEPOLIA: + return 3; // case ChainId.BNB: // return 4; // case ChainId.AVALANCHE: diff --git a/src/lib/constants/providers.ts b/src/lib/constants/providers.ts index 7888c1ac8..31358dea3 100644 --- a/src/lib/constants/providers.ts +++ b/src/lib/constants/providers.ts @@ -77,5 +77,6 @@ export const RPC_PROVIDERS: { [ChainId.POLYGON]: new AppJsonRpcProvider(ChainId.POLYGON), [ChainId_POLYGON_AMOY]: new AppJsonRpcProvider(ChainId_POLYGON_AMOY), [ChainId.BASE]: new AppJsonRpcProvider(ChainId.BASE), - [ChainId_BASE_SEPOLIA]: new AppJsonRpcProvider(ChainId_BASE_SEPOLIA) + [ChainId_BASE_SEPOLIA]: new AppJsonRpcProvider(ChainId_BASE_SEPOLIA), + [ChainId.OPTIMISM_SEPOLIA]: new AppJsonRpcProvider(ChainId.OPTIMISM_SEPOLIA) }; diff --git a/src/lib/constants/routing.ts b/src/lib/constants/routing.ts index b9c572a29..3ee93625f 100644 --- a/src/lib/constants/routing.ts +++ b/src/lib/constants/routing.ts @@ -101,9 +101,14 @@ export const COMMON_BASES: ChainCurrencyList = { DAI_OPTIMISM, USDC_OPTIMISM, USDT_OPTIMISM, - WBTC_OPTIMISM + WBTC_OPTIMISM, + WRAPPED_NATIVE_CURRENCY[ChainId.OPTIMISM] as Token ], [ChainId.OPTIMISM_GOERLI]: [nativeOnChain(ChainId.OPTIMISM_GOERLI)], + [ChainId.OPTIMISM_SEPOLIA]: [ + nativeOnChain(ChainId.OPTIMISM_SEPOLIA), + WRAPPED_NATIVE_CURRENCY[ChainId.OPTIMISM_SEPOLIA] as Token + ], [ChainId.BASE]: [ nativeOnChain(ChainId.BASE), WRAPPED_NATIVE_CURRENCY[ChainId.BASE] as Token, diff --git a/src/lib/constants/tokens.ts b/src/lib/constants/tokens.ts index ae3bcae29..99f234dd3 100644 --- a/src/lib/constants/tokens.ts +++ b/src/lib/constants/tokens.ts @@ -376,6 +376,13 @@ export const WRAPPED_NATIVE_CURRENCY: { [chainId: number]: Token | undefined } = "WETH", "Wrapped Ether" ), + [ChainId.OPTIMISM_SEPOLIA]: new Token( + ChainId.OPTIMISM_SEPOLIA, + "0x4200000000000000000000000000000000000006", + 18, + "WETH", + "Wrapped Ether" + ), [ChainId.BASE]: new Token( ChainId.BASE, "0x4200000000000000000000000000000000000006", From d8c656f6a183fbfe4ac53c55cbf7110340b6ef79 Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Tue, 25 Mar 2025 16:31:29 +0000 Subject: [PATCH 5/7] remove cloudflare ipfs url (no longer valid) --- src/lib/utils/uriToHttp.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/lib/utils/uriToHttp.ts b/src/lib/utils/uriToHttp.ts index d0ea6da8d..80dfbc92b 100644 --- a/src/lib/utils/uriToHttp.ts +++ b/src/lib/utils/uriToHttp.ts @@ -13,17 +13,11 @@ export default function uriToHttp(uri: string): string[] { return ["https" + uri.substr(4), uri]; case "ipfs": { const hash = uri.match(/^ipfs:(\/\/)?(.*)$/i)?.[2]; - return [ - `https://cloudflare-ipfs.com/ipfs/${hash}/`, - `https://ipfs.io/ipfs/${hash}/` - ]; + return [`https://ipfs.io/ipfs/${hash}/`]; } case "ipns": { const name = uri.match(/^ipns:(\/\/)?(.*)$/i)?.[2]; - return [ - `https://cloudflare-ipfs.com/ipns/${name}/`, - `https://ipfs.io/ipns/${name}/` - ]; + return [`https://ipfs.io/ipns/${name}/`]; } case "ar": { const tx = uri.match(/^ar:(\/\/)?(.*)$/i)?.[2]; From 3a16660479b99943e88c694a46164304ebfea84c Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Tue, 25 Mar 2025 16:52:09 +0000 Subject: [PATCH 6/7] comment not existing token list urls --- src/lib/constants/lists.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/constants/lists.ts b/src/lib/constants/lists.ts index 3c42789d4..941fb5af6 100644 --- a/src/lib/constants/lists.ts +++ b/src/lib/constants/lists.ts @@ -63,9 +63,9 @@ export const DEFAULT_INACTIVE_LIST_URLS: string[] = [ OPTIMISM_LIST, // CELO_LIST, // PLASMA_BNB_LIST, - AVALANCHE_LIST, - BASE_LIST, - ...UNSUPPORTED_LIST_URLS + // AVALANCHE_LIST, + BASE_LIST + // ...UNSUPPORTED_LIST_URLS ]; export const DEFAULT_LIST_OF_LISTS: string[] = [ From c891bfbc21b7e0dd826b42eadd13253acd2ee1e1 Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Wed, 26 Mar 2025 13:32:10 +0000 Subject: [PATCH 7/7] upgrade core-components --- package-lock.json | 40 ++++++++++++++++++++-------------------- package.json | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index ef03aec25..b7216afa4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.39.0-alpha.2", + "@bosonprotocol/react-kit": "^0.39.0-alpha.4", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.7.0", @@ -3458,20 +3458,20 @@ } }, "node_modules/@bosonprotocol/ethers-sdk": { - "version": "1.15.6-alpha.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.15.6-alpha.0.tgz", - "integrity": "sha512-Om99Ys1WylRuKXvj8kyhQ7fmm/BgWLZJmnBqH7gdrl4UoCAbZUfxRplgskmmBXS2loFXM5kbKVrqJOdqpGMTvg==", + "version": "1.15.6-alpha.2", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.15.6-alpha.2.tgz", + "integrity": "sha512-C+r4adUjYxNvuUHSbDTNeHqJXCti1HEsyrU/hZ7z1fzxtqhidKJWGApncS7ekXcR5eBV21CBNlPdBeq98u92DA==", "dependencies": { - "@bosonprotocol/common": "^1.30.5-alpha.0" + "@bosonprotocol/common": "^1.30.5-alpha.2" }, "peerDependencies": { "ethers": "^5.5.0" } }, "node_modules/@bosonprotocol/ethers-sdk/node_modules/@bosonprotocol/common": { - "version": "1.30.5-alpha.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.5-alpha.0.tgz", - "integrity": "sha512-hUVs2nKyfOnkz5UB6Na7O/65BzaZgvLk0w9wGP9comD2zAX9/oa2pAkP+53wbOg8aFi90GDNez+2mIUF4upyCA==", + "version": "1.30.5-alpha.2", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.5-alpha.2.tgz", + "integrity": "sha512-uCNiUnun0dQufIw3EMhM/Dz7kooctFZJKGNPngI/NH4H3UdAui/Nv88S36d9X8dx3A5EdR+r3paf8A46vQ9GWg==", "dependencies": { "@bosonprotocol/metadata": "^1.16.3", "@ethersproject/abi": "^5.5.0", @@ -3508,13 +3508,13 @@ "integrity": "sha512-f2W2SQAvY5IKD6L9JwaiNye7gGRIIPd/HOB0i+otWLzMPBlwQtbN4JeWSuKeJvuaqu8tyMy7CHzN8EkhrJDB+A==" }, "node_modules/@bosonprotocol/react-kit": { - "version": "0.39.0-alpha.2", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.39.0-alpha.2.tgz", - "integrity": "sha512-8//Y1R9j8REK6/DJN+8DOeu95+KcZ0EY3C0B1OlnAMi31NJo4xtNndT303C8cF0NQpjBoyd8paW6/yR4dHCbkg==", + "version": "0.39.0-alpha.4", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.39.0-alpha.4.tgz", + "integrity": "sha512-NIPA/BTpYMoPpIouSUMpZSG9aSdFh6yAhYuwA0tEU8irwv7w97ScJAurc5DjZS/OFyqU7+rwtFBlkQPqdKMCaw==", "dependencies": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.43.2-alpha.0", - "@bosonprotocol/ethers-sdk": "^1.15.6-alpha.0", + "@bosonprotocol/core-sdk": "^1.43.2-alpha.2", + "@bosonprotocol/ethers-sdk": "^1.15.6-alpha.2", "@bosonprotocol/ipfs-storage": "^1.12.0", "@bosonprotocol/roblox-sdk": "^1.0.0-alpha.16", "@davatar/react": "1.11.1", @@ -3594,9 +3594,9 @@ } }, "node_modules/@bosonprotocol/react-kit/node_modules/@bosonprotocol/common": { - "version": "1.30.5-alpha.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.5-alpha.0.tgz", - "integrity": "sha512-hUVs2nKyfOnkz5UB6Na7O/65BzaZgvLk0w9wGP9comD2zAX9/oa2pAkP+53wbOg8aFi90GDNez+2mIUF4upyCA==", + "version": "1.30.5-alpha.2", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.30.5-alpha.2.tgz", + "integrity": "sha512-uCNiUnun0dQufIw3EMhM/Dz7kooctFZJKGNPngI/NH4H3UdAui/Nv88S36d9X8dx3A5EdR+r3paf8A46vQ9GWg==", "dependencies": { "@bosonprotocol/metadata": "^1.16.3", "@ethersproject/abi": "^5.5.0", @@ -3607,11 +3607,11 @@ } }, "node_modules/@bosonprotocol/react-kit/node_modules/@bosonprotocol/core-sdk": { - "version": "1.43.2-alpha.0", - "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.43.2-alpha.0.tgz", - "integrity": "sha512-OHTR5EWdOCJy9Y3KAitR72hnR8SaaKc6JealXGyJqfriIUVXok/tjWCUP954UiIFsR2usSp6kGH586rO/LyitA==", + "version": "1.43.2-alpha.2", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.43.2-alpha.2.tgz", + "integrity": "sha512-06d7BGFC+kcYrk8qT/zgPkeQ85pWYoH25yyToOPUNQRTwoo3kB3EAukO3GwaVh6BN/UhuLR5yDdPQDdj3AQuKg==", "dependencies": { - "@bosonprotocol/common": "^1.30.5-alpha.0", + "@bosonprotocol/common": "^1.30.5-alpha.2", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", diff --git a/package.json b/package.json index 0b636df0e..450bd9a7c 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.39.0-alpha.2", + "@bosonprotocol/react-kit": "^0.39.0-alpha.4", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.7.0",