Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into chore/enable-zap-fee
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMasayoshi committed Jan 28, 2025
2 parents 9ca8244 + f9340b9 commit 2b96ff7
Show file tree
Hide file tree
Showing 219 changed files with 2,173 additions and 660 deletions.
2 changes: 1 addition & 1 deletion apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"class-variance-authority": "0.7.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"sushi": "4.1.23"
"sushi": "5.0.4"
},
"devDependencies": {
"@storybook/addon-a11y": "8.4.7",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"react-window": "1.8.7",
"sharp": "^0.33.5",
"strapi-sdk-js": "2.3.3",
"sushi": "4.1.23",
"sushi": "5.0.4",
"swr": "2.1.5",
"tiny-invariant": "1.3.1",
"tronweb": "5.3.2",
Expand Down
20 changes: 10 additions & 10 deletions apps/web/src/app/(landing)/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Currency } from '@sushiswap/ui'
import { SkeletonCircle, SkeletonText } from '@sushiswap/ui'
import { NetworkIcon } from '@sushiswap/ui/icons/NetworkIcon'
import { FC, useEffect, useMemo, useRef, useState } from 'react'
import chains, { ChainId, chainShortName } from 'sushi/chain'
import { EvmChainId, evmChainShortName, evmChains } from 'sushi/chain'
import { Native, Token, Type } from 'sushi/currency'
import { type TokenList } from 'sushi/token-list'
import { isAddress } from 'viem'
Expand All @@ -20,28 +20,28 @@ import { SUPPORTED_CHAIN_IDS } from '../../../config'

const EXAMPLE_CURRENCIES = [
new Token({
chainId: ChainId.ETHEREUM,
chainId: EvmChainId.ETHEREUM,
address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
decimals: 18,
symbol: 'ETH',
name: 'Ether',
}),
new Token({
chainId: ChainId.ETHEREUM,
chainId: EvmChainId.ETHEREUM,
address: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
decimals: 18,
symbol: 'WBTC',
name: 'Wrapped BTC',
}),
new Token({
chainId: ChainId.ETHEREUM,
chainId: EvmChainId.ETHEREUM,
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
decimals: 18,
symbol: 'USDT',
name: 'Tether USD',
}),
new Token({
chainId: ChainId.BSC,
chainId: EvmChainId.BSC,
address: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
decimals: 18,
symbol: 'BNB',
Expand All @@ -52,7 +52,7 @@ const EXAMPLE_CURRENCIES = [
export const Search: FC = () => {
const ref = useRef<HTMLDivElement>(null)
const [query, setQuery] = useState<string>('')
const [chainId, setChainId] = useState<ChainId>(ChainId.ETHEREUM)
const [chainId, setChainId] = useState<EvmChainId>(EvmChainId.ETHEREUM)
const debouncedQuery = useDebounce(query, 500)
const [selectNetwork, setSelectNetwork] = useState(false)
const [open, setOpen] = useState(false)
Expand Down Expand Up @@ -147,7 +147,7 @@ export const Search: FC = () => {
onKeyDown={() => setSelectNetwork((prev) => !prev)}
className="font-semibold text-sm flex items-center gap-1 py-2 pl-3 pr-2 rounded-lg cursor-pointer bg-neutral-700 hover:bg-neutral-600 text-neutral-300 hover:text-neutral-200"
>
{chainShortName[chainId].toUpperCase()}{' '}
{evmChainShortName[chainId].toUpperCase()}{' '}
<ChevronDownIcon width={16} height={16} />
</p>
</div>
Expand Down Expand Up @@ -188,7 +188,7 @@ export const Search: FC = () => {
address: web3Token.address,
name: web3Token.name,
symbol: web3Token.symbol,
chainId: ChainId.ETHEREUM,
chainId: EvmChainId.ETHEREUM,
decimals: web3Token.decimals,
})
}
Expand All @@ -206,7 +206,7 @@ export const Search: FC = () => {
address,
name,
symbol,
chainId,
chainId: chainId as EvmChainId,
decimals,
})
}
Expand Down Expand Up @@ -261,7 +261,7 @@ const Row: FC<{ currency: Type; onClick?(): void; isNetwork?: boolean }> = ({
</div>
<div className="flex flex-col">
<p className="font-semibold">
{isNetwork ? chains[currency.chainId].name : currency.name}
{isNetwork ? evmChains[currency.chainId].name : currency.name}
</p>
<p className="text-sm font-semibold text-left text-neutral-400">
{currency.symbol}
Expand Down
14 changes: 6 additions & 8 deletions apps/web/src/app/(networks)/(evm)/[chainId]/(positions)/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import {
SelectIcon,
} from '@sushiswap/ui'
import { FC } from 'react'
import { ChainId, ChainKey } from 'sushi/chain'
import { ChainKey, EvmChainId } from 'sushi/chain'
import {
SushiSwapV3ChainId,
isSushiSwapV2ChainId,
isSushiSwapV3ChainId,
} from 'sushi/config'

export const Hero: FC<{ chainId: ChainId }> = ({ chainId }) => {
export const Hero: FC<{ chainId: EvmChainId }> = ({ chainId }) => {
return (
<section className="flex flex-col gap-6">
<span className="text-5xl font-bold">Manage Liquidity Positions</span>
Expand All @@ -41,7 +41,7 @@ export const Hero: FC<{ chainId: ChainId }> = ({ chainId }) => {
? `/${ChainKey[chainId]}/pool/v3/add`
: isSushiSwapV2ChainId(chainId as SushiSwapV3ChainId)
? `/${ChainKey[chainId]}/pool/v2/add`
: `/${ChainKey[ChainId.ETHEREUM]}/pool/v3/add`
: `/${ChainKey[EvmChainId.ETHEREUM]}/pool/v3/add`
}
>
I want to create a position
Expand All @@ -56,9 +56,7 @@ export const Hero: FC<{ chainId: ChainId }> = ({ chainId }) => {
<DropdownMenuContent className="w-80">
<DropdownMenuGroup>
<DropdownMenuItem
disabled={
!isSushiSwapV3ChainId(chainId as SushiSwapV3ChainId)
}
disabled={!isSushiSwapV3ChainId(chainId)}
asChild
>
<LinkInternal
Expand All @@ -68,7 +66,7 @@ export const Hero: FC<{ chainId: ChainId }> = ({ chainId }) => {
<div className="flex items-center gap-1 font-medium leading-none">
V3 Position
<Chip variant="secondary">
{isSushiSwapV3ChainId(chainId as SushiSwapV3ChainId)
{isSushiSwapV3ChainId(chainId)
? 'New 🔥'
: 'Unavailable'}
</Chip>
Expand All @@ -78,7 +76,7 @@ export const Hero: FC<{ chainId: ChainId }> = ({ chainId }) => {
</p>
</LinkInternal>
</DropdownMenuItem>
{isSushiSwapV2ChainId(chainId as ChainId) ? (
{isSushiSwapV2ChainId(chainId) ? (
<DropdownMenuItem asChild>
<LinkInternal
href={`/${ChainKey[chainId]}/pool/v2/add`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { notFound } from 'next/navigation'
import React from 'react'

import { MigrateTabContent } from 'src/ui/pool/MigrateTabContent'
import { ChainId } from 'sushi'
import { EvmChainId } from 'sushi'
import { isSushiSwapV2ChainId } from 'sushi/config'

export const metadata: Metadata = {
Expand All @@ -15,7 +15,7 @@ export default async function MigratePage(props: {
params: Promise<{ chainId: string }>
}) {
const params = await props.params
const chainId = +params.chainId as ChainId
const chainId = +params.chainId as EvmChainId

if (!isSushiSwapV2ChainId(chainId)) {
return notFound()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { PositionsTab } from 'src/ui/pool/PositionsTab'
import { TableFiltersNetwork } from 'src/ui/pool/TableFiltersNetwork'
import { TableFiltersResetButton } from 'src/ui/pool/TableFiltersResetButton'
import { TableFiltersSearchToken } from 'src/ui/pool/TableFiltersSearchToken'
import { ChainId } from 'sushi/chain'
import { EvmChainId } from 'sushi/chain'
import { isSushiSwapChainId } from 'sushi/config'

export default function MyPositionsPage(props: {
params: Promise<{ chainId: string }>
}) {
const params = use(props.params)
const chainId = +params.chainId as ChainId
const chainId = +params.chainId as EvmChainId

if (!isSushiSwapChainId(chainId)) {
return notFound()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Metadata } from 'next'
import { notFound } from 'next/navigation'
import { XSWAP_SUPPORTED_CHAIN_IDS, isXSwapSupportedChainId } from 'src/config'
import { ChainId } from 'sushi/chain'
import { EvmChainId } from 'sushi/chain'
import { SidebarContainer } from '~evm/_common/ui/sidebar'
import { Providers } from './providers'

Expand All @@ -19,7 +19,7 @@ export default async function CrossChainSwapLayout(props: {

const { children } = props

const chainId = +params.chainId as ChainId
const chainId = +params.chainId as EvmChainId

if (!isXSwapSupportedChainId(chainId)) {
return notFound()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { getCrossChainSwapEdgeConfig } from './get-cross-chain-swap-edge-config'

import { EdgeProvider } from 'src/providers/edge-config-provider'
import { DerivedstateCrossChainSwapProvider } from 'src/ui/swap/cross-chain/derivedstate-cross-chain-swap-provider'
import { ChainId } from 'sushi/chain'
import { EvmChainId } from 'sushi/chain'

export async function Providers({
children,
chainId,
}: { children: React.ReactNode; chainId: ChainId }) {
}: { children: React.ReactNode; chainId: EvmChainId }) {
const config = await getCrossChainSwapEdgeConfig()

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Container, typographyVariants } from '@sushiswap/ui'
import { Metadata } from 'next'
import { notFound } from 'next/navigation'
import { BackButton } from 'src/ui/pool/BackButton'
import { ChainId } from 'sushi/chain'
import { EvmChainId } from 'sushi/chain'
import { isMerklChainId } from 'sushi/config'

export const metadata: Metadata = {
Expand All @@ -19,7 +19,7 @@ export default async function Layout(props: {

const { children } = props

const chainId = +params.chainId as ChainId
const chainId = +params.chainId as EvmChainId
if (!isMerklChainId(chainId)) {
return notFound()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
import { SelectFeeConcentratedWidget } from 'src/ui/pool/SelectFeeConcentratedWidget'
import { SelectNetworkWidget } from 'src/ui/pool/SelectNetworkWidget'
import { SelectTokensWidget } from 'src/ui/pool/SelectTokensWidget'
import { Chain, ChainId, ChainKey } from 'sushi/chain'
import { ChainKey, EvmChain, EvmChainId } from 'sushi/chain'
import {
MERKL_SUPPORTED_CHAIN_IDS,
SushiSwapV3ChainId,
Expand All @@ -66,10 +66,10 @@ const APPROVE_TAG = 'approve-incentivize'

export default function Page(props: { params: Promise<{ chainId: string }> }) {
const params = use(props.params)
const chainId = +params.chainId as ChainId
const chainId = +params.chainId as EvmChainId
return (
<ConcentratedLiquidityURLStateProvider
chainId={isMerklChainId(chainId) ? chainId : ChainId.ETHEREUM}
chainId={isMerklChainId(chainId) ? chainId : EvmChainId.ETHEREUM}
supportedNetworks={MERKL_SUPPORTED_CHAIN_IDS}
>
<ConcentratedLiquidityProvider>
Expand Down Expand Up @@ -583,7 +583,10 @@ const Incentivize = withCheckerRoot(() => {
flex
title="Network"
>
{Chain.from(pool.chainId)?.name}
{
EvmChain.from(pool.chainId)
?.name
}
</List.KeyValue>
) : null}
{feeAmount && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { headers } from 'next/headers'
import { notFound } from 'next/navigation'
import React from 'react'
import { PoolHeader } from 'src/ui/pool/PoolHeader'
import { ChainId, ChainKey } from 'sushi'
import { ChainKey, EvmChainId } from 'sushi'
import { isSushiSwapV2ChainId } from 'sushi/config'
import { isAddress } from 'viem'

Expand All @@ -22,7 +22,7 @@ export default async function Layout(props: {
const { children } = props

const { chainId: _chainId, address } = params
const chainId = +_chainId as ChainId
const chainId = +_chainId as EvmChainId

if (
!isSushiSwapV2ChainId(chainId) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { unstable_cache } from 'next/cache'
import { notFound } from 'next/navigation'

import { PoolPageV2 } from 'src/ui/pool/PoolPageV2'
import type { ChainId } from 'sushi'
import type { EvmChainId } from 'sushi'
import { isSushiSwapV2ChainId } from 'sushi/config'
import { isAddress } from 'viem'

Expand All @@ -13,7 +13,7 @@ export default async function PoolPage(props: {
const params = await props.params
const { chainId: _chainId, address } = params

const chainId = +_chainId as ChainId
const chainId = +_chainId as EvmChainId

if (
!isSushiSwapV2ChainId(chainId) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { notFound } from 'next/navigation'
import { PoolPositionProvider } from 'src/ui/pool'
import { ManageV2LiquidityCard } from 'src/ui/pool/ManageV2LiquidityCard'
import { PoolPosition } from 'src/ui/pool/PoolPosition'
import { ChainId } from 'sushi/chain'
import { EvmChainId } from 'sushi/chain'
import { isSushiSwapV2ChainId } from 'sushi/config'
import { isAddress } from 'viem'

Expand All @@ -13,7 +13,7 @@ export default async function ManageV2PoolPage(props: {
}) {
const params = await props.params
const { chainId: _chainId, address } = params
const chainId = +_chainId as ChainId
const chainId = +_chainId as EvmChainId

if (
!isSushiSwapV2ChainId(chainId) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { headers } from 'next/headers'
import { notFound } from 'next/navigation'
import React from 'react'
import { PoolHeader } from 'src/ui/pool/PoolHeader'
import { ChainId, ChainKey } from 'sushi/chain'
import { ChainKey, EvmChainId } from 'sushi/chain'
import { isSushiSwapV2ChainId } from 'sushi/config'
import { isAddress } from 'viem'

Expand All @@ -18,7 +18,7 @@ export default async function Layout(props: {
const { children } = props

const { chainId: _chainId, address } = params
const chainId = +_chainId as ChainId
const chainId = +_chainId as EvmChainId

if (
!isSushiSwapV2ChainId(chainId) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { notFound } from 'next/navigation'
import { PoolPositionProvider } from 'src/ui/pool'
import { ManageV2LiquidityCard } from 'src/ui/pool/ManageV2LiquidityCard'
import { PoolPosition } from 'src/ui/pool/PoolPosition'
import { ChainId } from 'sushi/chain'
import { EvmChainId } from 'sushi/chain'
import { isSushiSwapV2ChainId } from 'sushi/config'
import { isAddress } from 'viem'

Expand All @@ -13,7 +13,7 @@ export default async function ManageV2PoolPage(props: {
}) {
const params = await props.params
const { chainId: _chainId, address } = params
const chainId = +_chainId as ChainId
const chainId = +_chainId as EvmChainId

if (
!isSushiSwapV2ChainId(chainId) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getV2Pool } from '@sushiswap/graph-client/data-api'
import { Metadata } from 'next'
import { unstable_cache } from 'next/cache'
import { notFound } from 'next/navigation'
import { ChainId } from 'sushi'
import { EvmChainId } from 'sushi'
import { isSushiSwapV2ChainId } from 'sushi/config'
import { isAddress } from 'viem'

Expand All @@ -19,7 +19,7 @@ export default async function Layout(props: {
const { children } = props

const { chainId: _chainId, address } = params
const chainId = +_chainId as ChainId
const chainId = +_chainId as EvmChainId

if (
!isSushiSwapV2ChainId(chainId) ||
Expand Down
Loading

0 comments on commit 2b96ff7

Please sign in to comment.