Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 94 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.39.0-alpha.2",
"@davatar/react": "^1.10.4",
"@ethersproject/address": "^5.6.1",
"@ethersproject/units": "^5.7.0",
Expand Down Expand Up @@ -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",
Expand Down
19 changes: 19 additions & 0 deletions src/lib/constants/chainInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand Down
16 changes: 11 additions & 5 deletions src/lib/constants/chains.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -27,8 +24,10 @@ 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",
[ChainId.BNB]: "bnb",
[ChainId.AVALANCHE]: "avalanche",
[ChainId.BASE]: "base",
Expand All @@ -50,6 +49,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",
Expand All @@ -60,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];

Expand All @@ -80,6 +85,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 &&
Expand Down
10 changes: 0 additions & 10 deletions src/lib/constants/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
9 changes: 6 additions & 3 deletions src/lib/utils/hooks/useSwitchChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Loading