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", 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) => { 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/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[] = [ 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", 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];