diff --git a/.github/workflows/3_e2e.yml b/.github/workflows/3_e2e.yml index 151377e9..8c390abb 100644 --- a/.github/workflows/3_e2e.yml +++ b/.github/workflows/3_e2e.yml @@ -1,28 +1,28 @@ -name: End-to-End Tests(Playwright) -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] +# name: End-to-End Tests(Playwright) +# on: +# push: +# branches: [main, master] +# pull_request: +# branches: [main, master] -jobs: - test: - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install dependencies - run: yarn install - - name: Install Playwright Browsers - run: yarn playwright install --with-deps - - name: Run Playwright tests - run: yarn test:e2e - - uses: actions/upload-artifact@v4 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 +# jobs: +# test: +# timeout-minutes: 60 +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-node@v4 +# with: +# node-version: lts/* +# - name: Install dependencies +# run: yarn install +# - name: Install Playwright Browsers +# run: yarn playwright install --with-deps +# - name: Run Playwright tests +# run: yarn test:e2e +# - uses: actions/upload-artifact@v4 +# if: always() +# with: +# name: playwright-report +# path: playwright-report/ +# retention-days: 30 diff --git a/package.json b/package.json index 67eb6593..6a314b3e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@astrojs/tailwind": "^5.0.2", "@astrojs/vercel": "^5.1.0", "@nanostores/react": "^0.7.1", - "@stabilitydao/stability": "=0.24.19", + "@stabilitydao/stability": "=0.24.20", "@tanstack/query-sync-storage-persister": "^5.22.2", "@tanstack/react-query": "^5.22.2", "@tanstack/react-query-persist-client": "^5.22.2", diff --git a/src/layouts/AppStore.tsx b/src/layouts/AppStore.tsx index 8afdf191..8c40556e 100644 --- a/src/layouts/AppStore.tsx +++ b/src/layouts/AppStore.tsx @@ -2,7 +2,7 @@ import type React from "react"; import { useEffect } from "react"; -import {createPublicClient, formatUnits, http} from "viem"; +import { createPublicClient, formatUnits, http } from "viem"; import axios from "axios"; @@ -42,7 +42,7 @@ import { vaultData, } from "@store"; -import { wagmiConfig, platforms, PlatformABI, IVaultManagerABI } from "@web3"; +import { wagmiConfig, platforms, PlatformABI } from "@web3"; import { calculateAPY, @@ -79,7 +79,7 @@ import type { } from "@types"; import type { Vaults, Vault } from "@stabilitydao/stability/out/api.types"; -import {sonic} from "viem/chains"; +import { sonic } from "viem/chains"; const AppStore = (props: React.PropsWithChildren): JSX.Element => { const { address, isConnected } = useAccount(); @@ -108,7 +108,9 @@ const AppStore = (props: React.PropsWithChildren): JSX.Element => { });*/ const sonicClient = createPublicClient({ chain: sonic, - transport: http(import.meta.env.PUBLIC_SONIC_RPC || "https://sonic.drpc.org"), + transport: http( + import.meta.env.PUBLIC_SONIC_RPC || "https://sonic.drpc.org" + ), }); const $lastTx = useStore(lastTx); @@ -681,12 +683,8 @@ const AppStore = (props: React.PropsWithChildren): JSX.Element => { args: [address as TAddress], })) as TPlatformGetBalance; - const contractVaults = (await localClient?.readContract({ - address: contractBalance[6][1] as TAddress, - abi: IVaultManagerABI, - functionName: "vaults", - - })) as string[]; + const vaultsAddresses = contractBalance[3]; + const vaultsBalances = contractBalance[5]; if (contractBalance) { const buildingPayPerVaultTokenBalance: bigint = @@ -723,20 +721,18 @@ const AppStore = (props: React.PropsWithChildren): JSX.Element => { balances.set(contractBalance); } - if (Array.isArray(contractVaults[0])) { + if (Array.isArray(vaultsAddresses)) { const vaultsPromise = await Promise.all( - contractVaults[0].map( - async (vault: string, index: number) => { - if (localVaults[chain.id][vault.toLowerCase()]) { - return { - [vault.toLowerCase()]: { - ...localVaults[chain.id][vault.toLowerCase()], - balance: contractBalance[5][index], - }, - }; - } + vaultsAddresses.map(async (vault: string, index: number) => { + if (localVaults[chain.id][vault.toLowerCase()]) { + return { + [vault.toLowerCase()]: { + ...localVaults[chain.id][vault.toLowerCase()], + balance: vaultsBalances[index], + }, + }; } - ) + }) ); localVaults[chain.id] = vaultsPromise.reduce( diff --git a/src/modules/SonicVaults/components/Pagination.tsx b/src/modules/SonicVaults/components/Pagination.tsx index 1aa93115..3436064d 100644 --- a/src/modules/SonicVaults/components/Pagination.tsx +++ b/src/modules/SonicVaults/components/Pagination.tsx @@ -23,6 +23,22 @@ const Pagination: React.FC = memo(({ vaults, tab, setTab }) => { ? vaults.length : PAGINATION_VAULTS * tab, }; + + // useEffect(() => { + // ///// For vaults URL filters + // const newUrl = new URL(window.location.href); + // const params = new URLSearchParams(newUrl.search); + // ///// + + // if (tab === 1) { + // params.delete("page"); + // } else { + // params.set("page", String(tab)); + // } + + // newUrl.search = `?${params.toString()}`; + // window.history.pushState({}, "", newUrl.toString()); + // }, [tab]); return ( paginationNumbers.length > 1 && (
diff --git a/src/modules/SonicVaults/index.tsx b/src/modules/SonicVaults/index.tsx index 31cda531..f122367f 100644 --- a/src/modules/SonicVaults/index.tsx +++ b/src/modules/SonicVaults/index.tsx @@ -109,6 +109,7 @@ const SonicVaults = (): JSX.Element => { const $visible = useStore(visible); const $publicClient = useStore(publicClient); const $platformVersions = useStore(platformVersions); + const $currentChainID = "146"; // const $currentChainID = useStore(currentChainID); // const $assetsPrices = useStore(assetsPrices); @@ -216,8 +217,6 @@ const SonicVaults = (): JSX.Element => { setActiveNetworks(updatedNetworks); }; - const $currentChainID = "146"; - const fetchPlatformUpdates = async () => { try { const pendingPlatformUpgrade: any = await $publicClient?.readContract({ diff --git a/src/modules/Vault/components/InvestForm/index.tsx b/src/modules/Vault/components/InvestForm/index.tsx index 6dc086ed..7930db5c 100644 --- a/src/modules/Vault/components/InvestForm/index.tsx +++ b/src/modules/Vault/components/InvestForm/index.tsx @@ -610,7 +610,9 @@ const InvestForm: React.FC = ({ network, vault }) => { } else { setLoader(false); } - + if (tab === "Withdraw" && option[0] === underlyingToken?.address) { + return; + } //@ts-ignore debouncedZap(amount, asset); }; @@ -920,6 +922,7 @@ const InvestForm: React.FC = ({ network, vault }) => { depositCCF(amount); return; } + try { const decimals = Number(getTokenData(option[0])?.decimals); @@ -1656,6 +1659,7 @@ const InvestForm: React.FC = ({ network, vault }) => { amount: formatUnits(result[0], 18), }, ]); + setLoader(false); setButton("withdraw"); } else { let assetsLength = defaultOption?.assetsArray.map( @@ -2028,10 +2032,10 @@ const InvestForm: React.FC = ({ network, vault }) => { useEffect(() => { setUnderlyingShares(false); setZapShares(false); - if (option[0] === underlyingToken?.address) { - setIsRefresh(false); - return; - } + // if (option[0] === underlyingToken?.address) { + // setIsRefresh(false); + // return; + // } setIsRefresh(true); }, [option, inputs]); @@ -2355,7 +2359,7 @@ const InvestForm: React.FC = ({ network, vault }) => { > {loader && !transactionInProgress ? (
ichi === true) ? "h-[64px]" : "h-[116px] flex items-end justify-end"}`} + className={`text-[18px] w-[320px] ${ichiAllow.every((ichi) => ichi === true) ? "h-[64px]" : "h-[116px] flex items-end justify-end"}`} >
diff --git a/src/modules/Vault/components/YieldRates/index.tsx b/src/modules/Vault/components/YieldRates/index.tsx index 6627dea9..08ad3828 100644 --- a/src/modules/Vault/components/YieldRates/index.tsx +++ b/src/modules/Vault/components/YieldRates/index.tsx @@ -3,7 +3,7 @@ import { useStore } from "@nanostores/react"; import { HoldTable, VSHoldTableCell, YieldTableCell } from "./table"; -import { HoldModal, HeadingText } from "@ui"; +import { TextModal, HeadingText } from "@ui"; import { connected } from "@store"; @@ -255,11 +255,9 @@ const YieldRates: React.FC = memo(({ vault }) => { )}
{modal && ( - - } + text="VS HODL APR compares depositing tokens into a vault vs holding them in a wallet with it's ratio and timeline." /> )} diff --git a/src/ui/Toast/HoldModal.tsx b/src/ui/Modals/TextModal.tsx similarity index 95% rename from src/ui/Toast/HoldModal.tsx rename to src/ui/Modals/TextModal.tsx index 54acbf89..504d8d65 100644 --- a/src/ui/Toast/HoldModal.tsx +++ b/src/ui/Modals/TextModal.tsx @@ -2,10 +2,10 @@ import { useEffect, useRef } from "react"; interface IProps { setModalState: React.Dispatch>; - table: JSX.Element; + text: String; } -const HoldModal: React.FC = ({ setModalState, table }) => { +const TextModal: React.FC = ({ setModalState, text }) => { const modalRef = useRef(null); const handleClickOutside = (event: React.MouseEvent | MouseEvent) => { @@ -15,7 +15,7 @@ const HoldModal: React.FC = ({ setModalState, table }) => { }; useEffect(() => { - document.body.style.overflow = "hidden"; + document.body.style.overflowY = "hidden"; document.addEventListener("mousedown", handleClickOutside); return () => { @@ -23,6 +23,7 @@ const HoldModal: React.FC = ({ setModalState, table }) => { document.removeEventListener("mousedown", handleClickOutside); }; }, []); + return (
@@ -94,10 +95,10 @@ const HoldModal: React.FC = ({ setModalState, table }) => {
- {table} + {text}
); }; -export { HoldModal }; +export { TextModal }; diff --git a/src/ui/Skeletons/ShareSkeleton.tsx b/src/ui/Skeletons/ShareSkeleton.tsx index 021c74c8..65f5b899 100644 --- a/src/ui/Skeletons/ShareSkeleton.tsx +++ b/src/ui/Skeletons/ShareSkeleton.tsx @@ -1,9 +1,9 @@ const ShareSkeleton = (props: React.SVGProps): JSX.Element => { return ( diff --git a/src/ui/index.ts b/src/ui/index.ts index cd973ab5..09e3bbf2 100644 --- a/src/ui/index.ts +++ b/src/ui/index.ts @@ -1,5 +1,5 @@ import { Toast } from "./Toast"; -import { HoldModal } from "./Toast/HoldModal"; +import { TextModal } from "./Modals/TextModal"; import { APRtimeSwitcher } from "./APRtimeSwitcher"; import { ErrorMessage } from "./ErrorMessage"; import { FeeAPRModal } from "./FeeAPRModal"; @@ -27,7 +27,7 @@ import { Skeleton } from "./Skeletons/Skeleton"; export { Toast, - HoldModal, + TextModal, APRtimeSwitcher, AssetsSkeleton, ChartSkeleton, diff --git a/yarn.lock b/yarn.lock index 45af1f8a..85cd4e93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10922,4 +10922,4 @@ zustand@4.4.1: zwitch@^2.0.0, zwitch@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-2.0.4.tgz#c827d4b0acb76fc3e685a4c6ec2902d51070e9d7" - integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A== + integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A== \ No newline at end of file