From 5d4bd5623a324fa973681e35f88277ba033b742b Mon Sep 17 00:00:00 2001 From: viet-nv Date: Mon, 1 Apr 2024 15:13:14 +0700 Subject: [PATCH 01/36] widget test --- package.json | 3 +- src/hooks/useBasicChartData.ts | 2 +- src/pages/App.tsx | 2 + src/pages/LiquidityWidget.tsx | 89 ++++++++++++++++++++++++++++++++ yarn.lock | 93 +++++++++++++++++++++++++++++++++- 5 files changed, 185 insertions(+), 4 deletions(-) create mode 100644 src/pages/LiquidityWidget.tsx diff --git a/package.json b/package.json index 54d4cb6ec9..a7ee778ac3 100644 --- a/package.json +++ b/package.json @@ -49,11 +49,12 @@ "@coinbase/wallet-sdk": "^3.0.4", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@holdstation/paymaster-helper": "^2.0.20", - "@kyberswap/oauth2": "1.0.2", "@kyberswap/krystal-walletconnect-v2": "0.0.1", "@kyberswap/ks-sdk-classic": "^1.0.3", "@kyberswap/ks-sdk-core": "1.1.3", "@kyberswap/ks-sdk-elastic": "^1.1.2", + "@kyberswap/liquidity-widgets": "^0.0.1-rc5", + "@kyberswap/oauth2": "1.0.2", "@lingui/macro": "^4.6.0", "@lingui/react": "^4.6.0", "@popperjs/core": "^2.11.6", diff --git a/src/hooks/useBasicChartData.ts b/src/hooks/useBasicChartData.ts index 427b6cef22..0dd7c8c24a 100644 --- a/src/hooks/useBasicChartData.ts +++ b/src/hooks/useBasicChartData.ts @@ -1,5 +1,5 @@ -import { KyberOauth2Api } from '@kyberswap/oauth2' import { ChainId, Token, WETH } from '@kyberswap/ks-sdk-core' +import { KyberOauth2Api } from '@kyberswap/oauth2' import { AxiosResponse } from 'axios' import { getUnixTime, subHours } from 'date-fns' import { useMemo } from 'react' diff --git a/src/pages/App.tsx b/src/pages/App.tsx index aee23262ec..b2cb951bea 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -30,6 +30,7 @@ import { RedirectPathToSwapV3Network } from 'pages/SwapV3/redirects' import { useHolidayMode } from 'state/user/hooks' import { isSupportLimitOrder } from 'utils' +import LiquidityWidget from './LiquidityWidget' import VerifyAuth from './Verify/VerifyAuth' const Login = lazy(() => import('./Oauth/Login')) @@ -325,6 +326,7 @@ export default function App() { } /> } /> + } /> } /> diff --git a/src/pages/LiquidityWidget.tsx b/src/pages/LiquidityWidget.tsx new file mode 100644 index 0000000000..2d81636dfc --- /dev/null +++ b/src/pages/LiquidityWidget.tsx @@ -0,0 +1,89 @@ +import { ChainId } from '@kyberswap/ks-sdk-core' +import { LiquidityWidget as KsLiquidityWidget, PoolType } from '@kyberswap/liquidity-widgets' +import '@kyberswap/liquidity-widgets/dist/style.css' +import { useEffect, useState } from 'react' +import { Box } from 'rebass' +import styled from 'styled-components' + +import { ButtonPrimary } from 'components/Button' +import Input from 'components/Input' +import Modal from 'components/Modal' +import { NetworkSelector } from 'components/NetworkSelector' +import { useActiveWeb3React, useWeb3React } from 'hooks' +import { useChangeNetwork } from 'hooks/web3/useChangeNetwork' + +const StyledModal = styled(Modal)` + transition: all 0.2s; +` + +export default function LiquidityWidget() { + const [selectedChainId, setSelectedChainId] = useState(ChainId.MATIC) + const [poolAddress, setPoolAddress] = useState('') + const [openModal, setOpenModal] = useState(false) + const { changeNetwork } = useChangeNetwork() + const [autoAfterChange, setAutoAfterChange] = useState(false) + + const { chainId } = useActiveWeb3React() + const { library } = useWeb3React() + + useEffect(() => { + if (autoAfterChange && chainId === selectedChainId) { + setOpenModal(true) + setAutoAfterChange(false) + } + }, [autoAfterChange, chainId, selectedChainId]) + + const [maxWidth, setMaxWidth] = useState('680px') + + return ( + <> + setOpenModal(false)} width="100%" maxWidth={maxWidth}> + setOpenModal(false)} + onTogglePreview={show => { + if (show) setMaxWidth('500px') + else setMaxWidth('680px') + }} + /> + + + setSelectedChainId(chain)} /> + setPoolAddress(e.target.value)} /> + { + if (selectedChainId !== chainId) { + changeNetwork(selectedChainId) + setAutoAfterChange(true) + } else { + setOpenModal(true) + } + }} + > + Launch + + + + ) +} diff --git a/yarn.lock b/yarn.lock index d0b8220367..b4aff35b87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3751,6 +3751,15 @@ tiny-invariant "^1.1.0" tiny-warning "^1.0.3" +"@kyberswap/liquidity-widgets@^0.0.1-rc5": + version "0.0.1-rc5" + resolved "https://registry.yarnpkg.com/@kyberswap/liquidity-widgets/-/liquidity-widgets-0.0.1-rc5.tgz#a969e2249ba64e875146c08f8edae42472b20af0" + integrity sha512-ZOgTlT1AcXYgGYHeLn01AdTxd+t3mZ2LIw8CwmezdQf5uQ9tjTNZG1rK10gIk6z3d1Wv9xfZQyrYfe1xk8y96w== + dependencies: + "@uniswap/sdk-core" "^4.1.4" + "@uniswap/v3-sdk" "^3.10.2" + ethers "^5.7.0" + "@kyberswap/oauth2@1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@kyberswap/oauth2/-/oauth2-1.0.2.tgz#4e0fdfa9722ba2f185a104293b85b6ca58be775b" @@ -4065,6 +4074,11 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@openzeppelin/contracts@3.4.1-solc-0.7-2": + version "3.4.1-solc-0.7-2" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.4.1-solc-0.7-2.tgz#371c67ebffe50f551c3146a9eec5fe6ffe862e92" + integrity sha512-tAG9LWg8+M2CMu7hIsqHPaTyG4uDzjr6mhvH96LvOpLZZj6tgzTluBt+LsCf1/QaYrlis6pITvpIaIhE+iZB+Q== + "@openzeppelin/contracts@3.4.2-solc-0.7": version "3.4.2-solc-0.7" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz#38f4dbab672631034076ccdf2f3201fab1726635" @@ -7252,7 +7266,31 @@ resolved "https://registry.yarnpkg.com/@uniswap/lib/-/lib-4.0.1-alpha.tgz#2881008e55f075344675b3bca93f020b028fbd02" integrity sha512-f6UIliwBbRsgVLxIaBANF6w09tYqc6Y/qXdsrbEmXHyFA7ILiKrIwRFXe1yOg8M3cksgVsO9N7yuL2DdCGQKBA== -"@uniswap/v2-core@1.0.1": +"@uniswap/sdk-core@^4.1.4", "@uniswap/sdk-core@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@uniswap/sdk-core/-/sdk-core-4.2.0.tgz#9930f133baec9c1118d891ebf8fcba7f7efc153d" + integrity sha512-yXAMLHZRYYuh6KpN2nOlLTYBjGiopmI9WUB4Z0tyNkW4ZZub54cUt22eibpGbZAhRAMxclox9IPIs6wwrM3soQ== + dependencies: + "@ethersproject/address" "^5.0.2" + big.js "^5.2.2" + decimal.js-light "^2.5.0" + jsbi "^3.1.4" + tiny-invariant "^1.1.0" + toformat "^2.0.0" + +"@uniswap/swap-router-contracts@^1.2.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@uniswap/swap-router-contracts/-/swap-router-contracts-1.3.1.tgz#0ebbb93eb578625618ed9489872de381f9c66fb4" + integrity sha512-mh/YNbwKb7Mut96VuEtL+Z5bRe0xVIbjjiryn+iMMrK2sFKhR4duk/86mEz0UO5gSx4pQIw9G5276P5heY/7Rg== + dependencies: + "@openzeppelin/contracts" "3.4.2-solc-0.7" + "@uniswap/v2-core" "^1.0.1" + "@uniswap/v3-core" "^1.0.0" + "@uniswap/v3-periphery" "^1.4.4" + dotenv "^14.2.0" + hardhat-watcher "^2.1.1" + +"@uniswap/v2-core@1.0.1", "@uniswap/v2-core@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@uniswap/v2-core/-/v2-core-1.0.1.tgz#af8f508bf183204779938969e2e54043e147d425" integrity sha512-MtybtkUPSyysqLY2U210NBDeCHX+ltHt3oADGdjqoThZaFRDKwM6k1Nb3F0A3hk5hwuQvytFWhrWHOEq6nVJ8Q== @@ -7262,6 +7300,22 @@ resolved "https://registry.yarnpkg.com/@uniswap/v3-core/-/v3-core-1.0.0.tgz#6c24adacc4c25dceee0ba3ca142b35adbd7e359d" integrity sha512-kSC4djMGKMHj7sLMYVnn61k9nu+lHjMIxgg9CDQT+s2QYLoA56GbSK9Oxr+qJXzzygbkrmuY6cwgP6cW2JXPFA== +"@uniswap/v3-core@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@uniswap/v3-core/-/v3-core-1.0.1.tgz#b6d2bdc6ba3c3fbd610bdc502395d86cd35264a0" + integrity sha512-7pVk4hEm00j9tc71Y9+ssYpO6ytkeI0y7WE9P6UcmNzhxPePwyAxImuhVsTqWK9YFvzgtvzJHi64pBl4jUzKMQ== + +"@uniswap/v3-periphery@^1.0.1", "@uniswap/v3-periphery@^1.1.1", "@uniswap/v3-periphery@^1.4.4": + version "1.4.4" + resolved "https://registry.yarnpkg.com/@uniswap/v3-periphery/-/v3-periphery-1.4.4.tgz#d2756c23b69718173c5874f37fd4ad57d2f021b7" + integrity sha512-S4+m+wh8HbWSO3DKk4LwUCPZJTpCugIsHrWR86m/OrUyvSqGDTXKFfc2sMuGXCZrD1ZqO3rhQsKgdWg3Hbb2Kw== + dependencies: + "@openzeppelin/contracts" "3.4.2-solc-0.7" + "@uniswap/lib" "^4.0.1-alpha" + "@uniswap/v2-core" "^1.0.1" + "@uniswap/v3-core" "^1.0.0" + base64-sol "1.0.1" + "@uniswap/v3-periphery@^1.3.0": version "1.4.3" resolved "https://registry.yarnpkg.com/@uniswap/v3-periphery/-/v3-periphery-1.4.3.tgz#a6da4632dbd46b139cc13a410e4ec09ad22bd19f" @@ -7273,6 +7327,29 @@ "@uniswap/v3-core" "1.0.0" base64-sol "1.0.1" +"@uniswap/v3-sdk@^3.10.2": + version "3.11.0" + resolved "https://registry.yarnpkg.com/@uniswap/v3-sdk/-/v3-sdk-3.11.0.tgz#328309fbafddd8c618b7b6850bb99cacf6733a79" + integrity sha512-gz6Q6SlN34AXvxhyz181F90D4OuIkxLnzBAucEzB9Fv3Z+3orHZY/SpGaD02nP1VsNQVu/DQvOsdkPUDGn1Y9Q== + dependencies: + "@ethersproject/abi" "^5.0.12" + "@ethersproject/solidity" "^5.0.9" + "@uniswap/sdk-core" "^4.2.0" + "@uniswap/swap-router-contracts" "^1.2.1" + "@uniswap/v3-periphery" "^1.1.1" + "@uniswap/v3-staker" "1.0.0" + tiny-invariant "^1.1.0" + tiny-warning "^1.0.3" + +"@uniswap/v3-staker@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@uniswap/v3-staker/-/v3-staker-1.0.0.tgz#9a6915ec980852479dfc903f50baf822ff8fa66e" + integrity sha512-JV0Qc46Px5alvg6YWd+UIaGH9lDuYG/Js7ngxPit1SPaIP30AlVer1UYB7BRYeUVVxE+byUyIeN5jeQ7LLDjIw== + dependencies: + "@openzeppelin/contracts" "3.4.1-solc-0.7-2" + "@uniswap/v3-core" "1.0.0" + "@uniswap/v3-periphery" "^1.0.1" + "@use-gesture/core@10.2.27": version "10.2.27" resolved "https://registry.yarnpkg.com/@use-gesture/core/-/core-10.2.27.tgz#0f24b17c036cd828ba07e3451ff45e2df959c6f5" @@ -10427,6 +10504,11 @@ dotenv@10.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== +dotenv@^14.2.0: + version "14.3.2" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-14.3.2.tgz#7c30b3a5f777c79a3429cb2db358eef6751e8369" + integrity sha512-vwEppIphpFdvaMCaHfCEv9IgwcxMljMw2TnAQBB4VWPvzXQLTb82jwmdOKzlEVUL3gNFT4l4TPKO+Bn+sqcrVQ== + dotenv@^16.0.0, dotenv@^16.3.1: version "16.3.1" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" @@ -11155,7 +11237,7 @@ ethers@6.7.1: tslib "2.4.0" ws "8.5.0" -ethers@^5.4.6, ethers@^5.6.9, ethers@^5.7.2: +ethers@^5.4.6, ethers@^5.6.9, ethers@^5.7.0, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -12308,6 +12390,13 @@ handlebars@^4.7.7: optionalDependencies: uglify-js "^3.1.4" +hardhat-watcher@^2.1.1: + version "2.5.0" + resolved "https://registry.yarnpkg.com/hardhat-watcher/-/hardhat-watcher-2.5.0.tgz#3ee76c3cb5b99f2875b78d176207745aa484ed4a" + integrity sha512-Su2qcSMIo2YO2PrmJ0/tdkf+6pSt8zf9+4URR5edMVti6+ShI8T3xhPrwugdyTOFuyj8lKHrcTZNKUFYowYiyA== + dependencies: + chokidar "^3.5.3" + has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" From d6e94c07fc64ea838ac29739be99b867af0620b0 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Fri, 7 Jun 2024 11:18:44 +0700 Subject: [PATCH 02/36] feat: pancake test --- package.json | 2 +- src/pages/LiquidityWidget.tsx | 64 ++++++++-------- tsconfig.json | 24 ++++-- yarn.lock | 135 ++++++++++++++++++++++++++++++++-- 4 files changed, 185 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index ba1e8762f1..69b2489a2a 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@kyberswap/ks-sdk-classic": "^1.0.3", "@kyberswap/ks-sdk-core": "1.1.5", "@kyberswap/ks-sdk-elastic": "^1.1.2", - "@kyberswap/liquidity-widgets": "^0.0.1-rc5", + "@kyberswap/liquidity-widgets": "^0.0.1-rc7", "@kyberswap/oauth2": "1.0.2", "@lingui/macro": "^4.6.0", "@lingui/react": "^4.6.0", diff --git a/src/pages/LiquidityWidget.tsx b/src/pages/LiquidityWidget.tsx index 2d81636dfc..0438d75dc0 100644 --- a/src/pages/LiquidityWidget.tsx +++ b/src/pages/LiquidityWidget.tsx @@ -1,7 +1,7 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { LiquidityWidget as KsLiquidityWidget, PoolType } from '@kyberswap/liquidity-widgets' import '@kyberswap/liquidity-widgets/dist/style.css' -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { Box } from 'rebass' import styled from 'styled-components' @@ -15,13 +15,14 @@ import { useChangeNetwork } from 'hooks/web3/useChangeNetwork' const StyledModal = styled(Modal)` transition: all 0.2s; ` - export default function LiquidityWidget() { - const [selectedChainId, setSelectedChainId] = useState(ChainId.MATIC) - const [poolAddress, setPoolAddress] = useState('') + const [selectedChainId, setSelectedChainId] = useState(ChainId.ARBITRUM) + const [poolAddress, setPoolAddress] = useState('0x0bacc7a9717e70ea0da5ac075889bd87d4c81197') + const [positionId, setPositionId] = useState('24654') const [openModal, setOpenModal] = useState(false) const { changeNetwork } = useChangeNetwork() const [autoAfterChange, setAutoAfterChange] = useState(false) + console.log(positionId) const { chainId } = useActiveWeb3React() const { library } = useWeb3React() @@ -33,44 +34,49 @@ export default function LiquidityWidget() { } }, [autoAfterChange, chainId, selectedChainId]) - const [maxWidth, setMaxWidth] = useState('680px') + const pancakeTheme = useMemo( + () => ({ + text: '#FFFFFF', + subText: '#B6AECF', + icons: '#a9a9a9', + layer1: '#27262C', + dialog: '#27262C', + layer2: '#363046', + stroke: '#363046', + chartRange: '#5DC5D2', + chartArea: '#457F89', + accent: '#5DC5D2', + warning: '#F4B452', + error: '#FF5353', + success: '#189470', + fontFamily: 'Kanit, Sans-serif', + borderRadius: '20px', + buttonRadius: '16px', + boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.04)', + }), + [], + ) return ( <> - setOpenModal(false)} width="100%" maxWidth={maxWidth}> + setOpenModal(false)} width="100%" maxWidth="680px"> setOpenModal(false)} - onTogglePreview={show => { - if (show) setMaxWidth('500px') - else setMaxWidth('680px') + onTogglePreview={() => { + // }} /> setSelectedChainId(chain)} /> setPoolAddress(e.target.value)} /> + setPositionId(e.target.value)} /> { if (selectedChainId !== chainId) { diff --git a/tsconfig.json b/tsconfig.json index 1868cc282c..27d7316ac3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "ESNext", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": false, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, @@ -22,13 +26,23 @@ "jsx": "react-jsx", "downlevelIteration": true, "allowSyntheticDefaultImports": true, - "typeRoots": ["./types"], + "typeRoots": [ + "./types" + ], "baseUrl": "src", "useUnknownInCatchVariables": false, "paths": { - "@/*": ["./src/*"] + "@/*": [ + "./src/*" + ] } }, - "exclude": ["node_modules", "cypress"], - "include": ["./src/**/*.ts", "./src/**/*.tsx"] + "exclude": [ + "node_modules", + "cypress" + ], + "include": [ + "./src/**/*.ts", + "./src/**/*.tsx" + ] } diff --git a/yarn.lock b/yarn.lock index 6ecfc749fd..2c95ef277c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3750,14 +3750,19 @@ tiny-invariant "^1.1.0" tiny-warning "^1.0.3" -"@kyberswap/liquidity-widgets@^0.0.1-rc5": - version "0.0.1-rc5" - resolved "https://registry.yarnpkg.com/@kyberswap/liquidity-widgets/-/liquidity-widgets-0.0.1-rc5.tgz#a969e2249ba64e875146c08f8edae42472b20af0" - integrity sha512-ZOgTlT1AcXYgGYHeLn01AdTxd+t3mZ2LIw8CwmezdQf5uQ9tjTNZG1rK10gIk6z3d1Wv9xfZQyrYfe1xk8y96w== - dependencies: +"@kyberswap/liquidity-widgets@^0.0.1-rc7": + version "0.0.1-rc7" + resolved "https://registry.yarnpkg.com/@kyberswap/liquidity-widgets/-/liquidity-widgets-0.0.1-rc7.tgz#b876bedda287f963ce9b4773215808d8ab7c8729" + integrity sha512-Xx3zhAnWecCDS/bn8nmDIvpJJYdg9yn4nw4eBqMoQC87TFesLU9CUdb9ThGa2Vf8NyzXXyZh3KbhufJpNe7y5A== + dependencies: + "@pancakeswap/sdk" "^5.8.2" + "@pancakeswap/v3-sdk" "^3.8.3" + "@popperjs/core" "^2.11.8" + "@reach/portal" "^0.18.0" "@uniswap/sdk-core" "^4.1.4" "@uniswap/v3-sdk" "^3.10.2" ethers "^5.7.0" + typescript "^5.2.2" "@kyberswap/oauth2@1.0.2": version "1.0.2" @@ -4083,6 +4088,75 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz#38f4dbab672631034076ccdf2f3201fab1726635" integrity sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA== +"@pancakeswap/chains@0.4.4", "@pancakeswap/chains@^0.4.4": + version "0.4.4" + resolved "https://registry.yarnpkg.com/@pancakeswap/chains/-/chains-0.4.4.tgz#f15069cdcbbcb3325775f164d62dae9942fa1331" + integrity sha512-jFvJghSMVVb3ZuaxkY9blslaJnukt6QYO/RvXDGg8JXNToGwLGXyK80UxLVaSh6LnrviGDpCIv7q8s/E0352yQ== + +"@pancakeswap/sdk@5.8.5", "@pancakeswap/sdk@^5.8.2": + version "5.8.5" + resolved "https://registry.yarnpkg.com/@pancakeswap/sdk/-/sdk-5.8.5.tgz#4bf95625504d776a718dbc014a918f5527d2bded" + integrity sha512-lZs53sVNUc7SQOlvICqDhsi5LC+DP+bJYSf8uCT9TKL/JTIFaaHMhPGSRD+IN9ORt7S4BGXMe49txIywvXbJ2w== + dependencies: + "@pancakeswap/chains" "^0.4.4" + "@pancakeswap/swap-sdk-core" "1.1.0" + "@pancakeswap/swap-sdk-evm" "1.0.2" + "@pancakeswap/v2-sdk" "1.0.2" + big.js "^5.2.2" + decimal.js-light "^2.5.0" + tiny-invariant "^1.3.0" + tiny-warning "^1.0.3" + toformat "^2.0.0" + viem "2.13.3" + +"@pancakeswap/swap-sdk-core@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@pancakeswap/swap-sdk-core/-/swap-sdk-core-1.1.0.tgz#4edc1ef77db9188a1f90153b1983c72326a942e4" + integrity sha512-RBl7M8NoViUeRJuISvkYXCwzeNRjGyMPhZTenJyHVrrkV0Wb37S8RCPirYzVt/63YtU0ZxXHcqCxD64XogtE/Q== + dependencies: + big.js "^5.2.2" + decimal.js-light "^2.5.0" + tiny-invariant "^1.3.0" + tiny-warning "^1.0.3" + toformat "^2.0.0" + +"@pancakeswap/swap-sdk-evm@1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@pancakeswap/swap-sdk-evm/-/swap-sdk-evm-1.0.2.tgz#4188190b21f32c3cbb5441043fcafa63dedce46f" + integrity sha512-Xv9WHVCqBWssHwguF+gm9qIH/mNDRL4126zn5rH0XwMlwZxr1M4IblnKmseVTLq/eVwZQgBet7auRGi9bXQMhw== + dependencies: + "@pancakeswap/chains" "0.4.4" + "@pancakeswap/swap-sdk-core" "1.1.0" + tiny-invariant "^1.3.0" + tiny-warning "^1.0.3" + viem "2.13.3" + +"@pancakeswap/v2-sdk@1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@pancakeswap/v2-sdk/-/v2-sdk-1.0.2.tgz#ba7b3faf54085b8f14a9e480f8c9a495851a7c77" + integrity sha512-kqwRTeY7z9pVvUpypmX27JmyW2FgvXvLUrAV6kPLalvTXg7GUkCht3NRCZlx4JWf/urDeuwK5KgyrPGkBLmH6w== + dependencies: + "@pancakeswap/chains" "0.4.4" + "@pancakeswap/swap-sdk-core" "1.1.0" + "@pancakeswap/swap-sdk-evm" "1.0.2" + tiny-invariant "^1.3.0" + viem "2.13.3" + +"@pancakeswap/v3-sdk@^3.8.3": + version "3.8.6" + resolved "https://registry.yarnpkg.com/@pancakeswap/v3-sdk/-/v3-sdk-3.8.6.tgz#75d298bbb07515d652af7f0ba2e8db6f59347c41" + integrity sha512-JSdmASNlAJeyJK1opiZmcjH8r/YerZ6Xm9isJKo7OQn2I5KnnPbYYqgGgk3MqSiWEMwbx9PZt1eFTXxE1krDsQ== + dependencies: + "@pancakeswap/chains" "0.4.4" + "@pancakeswap/sdk" "5.8.5" + "@pancakeswap/swap-sdk-core" "1.1.0" + big.js "^5.2.2" + decimal.js-light "^2.5.0" + tiny-invariant "^1.3.0" + tiny-warning "^1.0.3" + toformat "^2.0.0" + viem "2.13.3" + "@pedrouid/environment@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@pedrouid/environment/-/environment-1.0.1.tgz#858f0f8a057340e0b250398b75ead77d6f4342ec" @@ -4108,6 +4182,11 @@ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.6.tgz#cee20bd55e68a1720bdab363ecf0c821ded4cd45" integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw== +"@popperjs/core@^2.11.8": + version "2.11.8" + resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" + integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A== + "@project-serum/anchor@^0.11.1": version "0.11.1" resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.11.1.tgz#155bff2c70652eafdcfd5559c81a83bb19cec9ff" @@ -4532,6 +4611,13 @@ tiny-warning "^1.0.3" tslib "^2.3.0" +"@reach/portal@^0.18.0": + version "0.18.0" + resolved "https://registry.yarnpkg.com/@reach/portal/-/portal-0.18.0.tgz#dd466f5110689d14a0e7491b3aa8a449e8cefb40" + integrity sha512-TImozRapd576ofRk30Le2L3lRTFXF1p47B182wnp5eMTdZa74JX138BtNGEPJFOyrMaVmguVF8SSwZ6a0fon1Q== + dependencies: + "@reach/utils" "0.18.0" + "@reach/utils@0.17.0": version "0.17.0" resolved "https://registry.yarnpkg.com/@reach/utils/-/utils-0.17.0.tgz#3d1d2ec56d857f04fe092710d8faee2b2b121303" @@ -4540,6 +4626,11 @@ tiny-warning "^1.0.3" tslib "^2.3.0" +"@reach/utils@0.18.0": + version "0.18.0" + resolved "https://registry.yarnpkg.com/@reach/utils/-/utils-0.18.0.tgz#4f3cebe093dd436eeaff633809bf0f68f4f9d2ee" + integrity sha512-KdVMdpTgDyK8FzdKO9SCpiibuy/kbv3pwgfXshTI6tEcQT1OOwj7BAksnzGC0rPz0UholwC+AgkqEl3EJX3M1A== + "@reduxjs/toolkit@1.9.3": version "1.9.3" resolved "https://registry.yarnpkg.com/@reduxjs/toolkit/-/toolkit-1.9.3.tgz#27e1a33072b5a312e4f7fa19247fec160bbb2df9" @@ -7895,6 +7986,11 @@ abitype@0.9.8: resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.8.tgz#1f120b6b717459deafd213dfbf3a3dd1bf10ae8c" integrity sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ== +abitype@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.0.tgz#237176dace81d90d018bebf3a45cb42f2a2d9e97" + integrity sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ== + accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -13270,6 +13366,11 @@ isomorphic-ws@^4.0.1: resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== +isows@1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.4.tgz#810cd0d90cc4995c26395d2aa4cfa4037ebdf061" + integrity sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ== + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -18153,6 +18254,11 @@ tiny-invariant@^1.1.0, tiny-invariant@^1.3.1: resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.1.tgz#8560808c916ef02ecfd55e66090df23a4b7aa642" integrity sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw== +tiny-invariant@^1.3.0: + version "1.3.3" + resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.3.tgz#46680b7a873a0d5d10005995eb90a70d74d60127" + integrity sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg== + tiny-warning@^1.0.0, tiny-warning@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" @@ -18476,6 +18582,11 @@ typescript@^4.7.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@^5.2.2: + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== + ua-parser-js@^0.7.24: version "0.7.35" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.35.tgz#8bda4827be4f0b1dda91699a29499575a1f1d307" @@ -18913,6 +19024,20 @@ victory-vendor@^36.6.8: d3-time "^3.0.0" d3-timer "^3.0.1" +viem@2.13.3: + version "2.13.3" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.13.3.tgz#950426e4cacf5e12fab2c202a339371901712481" + integrity sha512-3tlwDRKHSelupFjbFMdUxF41f79ktyH2F9PAQ9Dltbs1DpdDlR1x+Ksa0th6qkyjjAbpDZP3F5nMTJv/1GVPdQ== + dependencies: + "@adraffy/ens-normalize" "1.10.0" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@scure/bip32" "1.3.2" + "@scure/bip39" "1.2.1" + abitype "1.0.0" + isows "1.0.4" + ws "8.13.0" + viem@^1.6.0: version "1.10.7" resolved "https://registry.yarnpkg.com/viem/-/viem-1.10.7.tgz#6ac6cae980237bbbc8f2a2b15b6fb15aa893fc79" From a3523bef2337fb8a9ebed321752bf9c8de39d1c1 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Fri, 7 Jun 2024 11:33:32 +0700 Subject: [PATCH 03/36] update ts to 5.2.2 --- package.json | 2 +- src/components/LiveChart/index.tsx | 2 +- src/components/Pagination/index.tsx | 2 +- src/constants/tokens.ts | 1 - yarn.lock | 8 ++++---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 69b2489a2a..54cba6f638 100644 --- a/package.json +++ b/package.json @@ -204,7 +204,7 @@ "prom-client": "^14.2.0", "storybook": "^7.6.2", "ts-node": "^10.9.1", - "typescript": "4.8.4", + "typescript": "5.2.2", "vite": "^4.3.9", "vite-plugin-checker": "^0.5.6", "vite-plugin-svgr": "^2.4.0", diff --git a/src/components/LiveChart/index.tsx b/src/components/LiveChart/index.tsx index 6403d4d448..c981c19bce 100644 --- a/src/components/LiveChart/index.tsx +++ b/src/components/LiveChart/index.tsx @@ -348,7 +348,7 @@ function LiveChart({ ) : ( <> - = 0 ? '#31CB9E' : '#FF537B'} marginRight="5px"> + = 0 ? '#31CB9E' : '#FF537B'} marginRight="5px"> {different} ({differentPercent}%) {!hoverValue && ( diff --git a/src/components/Pagination/index.tsx b/src/components/Pagination/index.tsx index b345836148..5ae4c694cc 100644 --- a/src/components/Pagination/index.tsx +++ b/src/components/Pagination/index.tsx @@ -55,7 +55,7 @@ export default function Pagination({ } const onNext = () => { - if (currentPage < paginationRange[paginationRange.length - 1]) { + if (currentPage < +paginationRange[paginationRange.length - 1]) { onPageChange(currentPage + 1) } } diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts index 8583bab2f3..95d72cafba 100644 --- a/src/constants/tokens.ts +++ b/src/constants/tokens.ts @@ -139,7 +139,6 @@ export const SUPER_STABLE_COINS_ADDRESS: { [chainId in ChainId]: string[] } = { ], [ChainId.LINEA]: [], [ChainId.SCROLL]: [], - [ChainId.SCROLL]: [], [ChainId.BLAST]: [], [ChainId.MANTLE]: [], [ChainId.XLAYER]: [], diff --git a/yarn.lock b/yarn.lock index 2c95ef277c..64c552a668 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18572,10 +18572,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== +typescript@5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== typescript@^4.7.4: version "4.9.5" From 64a2249a79a5de0d6f2a0782ed8f0c9fbe18514a Mon Sep 17 00:00:00 2001 From: viet-nv Date: Fri, 7 Jun 2024 12:47:25 +0700 Subject: [PATCH 04/36] fix: modal --- src/pages/LiquidityWidget.tsx | 39 ++++++++++++++++++----------------- src/theme/index.tsx | 4 ++++ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/pages/LiquidityWidget.tsx b/src/pages/LiquidityWidget.tsx index 0438d75dc0..4d4b1a3607 100644 --- a/src/pages/LiquidityWidget.tsx +++ b/src/pages/LiquidityWidget.tsx @@ -59,7 +59,7 @@ export default function LiquidityWidget() { return ( <> - setOpenModal(false)} width="100%" maxWidth="680px"> + {openModal ? ( - - - setSelectedChainId(chain)} /> - setPoolAddress(e.target.value)} /> - setPositionId(e.target.value)} /> - { - if (selectedChainId !== chainId) { - changeNetwork(selectedChainId) - setAutoAfterChange(true) - } else { - setOpenModal(true) - } - }} - > - Launch - - + ) : ( + + setSelectedChainId(chain)} /> + setPoolAddress(e.target.value)} /> + setPositionId(e.target.value)} /> + { + if (selectedChainId !== chainId) { + changeNetwork(selectedChainId) + setAutoAfterChange(true) + } else { + setOpenModal(true) + } + }} + > + Load + + + )} ) } diff --git a/src/theme/index.tsx b/src/theme/index.tsx index 9a951c6607..967ba87c68 100644 --- a/src/theme/index.tsx +++ b/src/theme/index.tsx @@ -261,4 +261,8 @@ export const ThemedGlobalStyle = createGlobalStyle` padding-right: 1.5rem; } + .ks-lw-modal-overlay { + z-index: 9999 + } + ` From 05f5113d24c5f723324f18f77b7578d3f0662a42 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Mon, 10 Jun 2024 10:13:08 +0700 Subject: [PATCH 05/36] chore: update version --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 54cba6f638..567003f56b 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@kyberswap/ks-sdk-classic": "^1.0.3", "@kyberswap/ks-sdk-core": "1.1.5", "@kyberswap/ks-sdk-elastic": "^1.1.2", - "@kyberswap/liquidity-widgets": "^0.0.1-rc7", + "@kyberswap/liquidity-widgets": "^0.0.1-rc8", "@kyberswap/oauth2": "1.0.2", "@lingui/macro": "^4.6.0", "@lingui/react": "^4.6.0", diff --git a/yarn.lock b/yarn.lock index 64c552a668..5115dfb14f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3750,10 +3750,10 @@ tiny-invariant "^1.1.0" tiny-warning "^1.0.3" -"@kyberswap/liquidity-widgets@^0.0.1-rc7": - version "0.0.1-rc7" - resolved "https://registry.yarnpkg.com/@kyberswap/liquidity-widgets/-/liquidity-widgets-0.0.1-rc7.tgz#b876bedda287f963ce9b4773215808d8ab7c8729" - integrity sha512-Xx3zhAnWecCDS/bn8nmDIvpJJYdg9yn4nw4eBqMoQC87TFesLU9CUdb9ThGa2Vf8NyzXXyZh3KbhufJpNe7y5A== +"@kyberswap/liquidity-widgets@^0.0.1-rc8": + version "0.0.1-rc8" + resolved "https://registry.yarnpkg.com/@kyberswap/liquidity-widgets/-/liquidity-widgets-0.0.1-rc8.tgz#439d33ef7b694dc3f5d05fb524ef1bb07aa828f8" + integrity sha512-JGBkzu0GEpID1wIfI7ADfdprQLtvmEpYxo6rU3thZeMmEsVfuYd5spgUC3qmjGX4kwNC7i1JyYWpNwQzdOAHqg== dependencies: "@pancakeswap/sdk" "^5.8.2" "@pancakeswap/v3-sdk" "^3.8.3" From bc18717e98f75ba687e492af35d5288575108ec4 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Mon, 10 Jun 2024 12:05:22 +0700 Subject: [PATCH 06/36] pump widget ver --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 567003f56b..0d2df25aad 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@kyberswap/ks-sdk-classic": "^1.0.3", "@kyberswap/ks-sdk-core": "1.1.5", "@kyberswap/ks-sdk-elastic": "^1.1.2", - "@kyberswap/liquidity-widgets": "^0.0.1-rc8", + "@kyberswap/liquidity-widgets": "^0.0.1-rc10", "@kyberswap/oauth2": "1.0.2", "@lingui/macro": "^4.6.0", "@lingui/react": "^4.6.0", diff --git a/yarn.lock b/yarn.lock index 5115dfb14f..512d90e6eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3750,10 +3750,10 @@ tiny-invariant "^1.1.0" tiny-warning "^1.0.3" -"@kyberswap/liquidity-widgets@^0.0.1-rc8": - version "0.0.1-rc8" - resolved "https://registry.yarnpkg.com/@kyberswap/liquidity-widgets/-/liquidity-widgets-0.0.1-rc8.tgz#439d33ef7b694dc3f5d05fb524ef1bb07aa828f8" - integrity sha512-JGBkzu0GEpID1wIfI7ADfdprQLtvmEpYxo6rU3thZeMmEsVfuYd5spgUC3qmjGX4kwNC7i1JyYWpNwQzdOAHqg== +"@kyberswap/liquidity-widgets@^0.0.1-rc10": + version "0.0.1-rc10" + resolved "https://registry.yarnpkg.com/@kyberswap/liquidity-widgets/-/liquidity-widgets-0.0.1-rc10.tgz#f9f70be878f17408bbf673cbedff40fdf9477cdf" + integrity sha512-Jv5X/m+AH18OFXr6vo6Brj6DgB0ImJ3Uf3Lw7vQtYDYKjPk/PGlX71BGKMCr0w3Nsl1AoqoP3IIJDfUwKYrVcA== dependencies: "@pancakeswap/sdk" "^5.8.2" "@pancakeswap/v3-sdk" "^3.8.3" From 31b01b2fe1d9667ca5ac1eb7d851d3b024e281a9 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Mon, 10 Jun 2024 16:24:18 +0700 Subject: [PATCH 07/36] pump widget version --- index.html | 1 + package.json | 2 +- src/pages/LiquidityWidget.tsx | 34 ++++++++++++++++++++++++++-------- src/theme/index.tsx | 4 ++++ yarn.lock | 8 ++++---- 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index fc957827ad..dc5d46cbba 100644 --- a/index.html +++ b/index.html @@ -37,6 +37,7 @@ href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400;500;600&display=swap" rel="stylesheet" /> + KyberSwap - Limitless Access To DeFi