diff --git a/jest.setup.js b/jest.setup.js index a5a74366..dc71628a 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -1,3 +1,6 @@ import "@testing-library/jest-dom/extend-expect"; global.ResizeObserver = require("resize-observer-polyfill"); + +// eslint-disable-next-line @typescript-eslint/no-var-requires +global.TextEncoder = require("util").TextEncoder; diff --git a/next.config.js b/next.config.js index 471c27b5..7616a354 100644 --- a/next.config.js +++ b/next.config.js @@ -21,6 +21,16 @@ const nextConfig = { "@buf/cosmos_cosmos-sdk.bufbuild_es", "@buf/evmos_evmos.bufbuild_es", "@buf/cosmos_ibc.bufbuild_es", + "wagmi", + "@tanstack/query-sync-storage-persister", + "@tanstack/react-query", + "@tanstack/query-core", + "@tanstack/react-query-persist-client", + "@tanstack/query-persist-client-core", + "@wagmi/core", + "@wagmi/connectors", + "viem", + "abitype", ] : [], }; diff --git a/src/components/__tests__/SwapWidget.test.tsx b/src/components/__tests__/SwapWidget.test.tsx index 6b2dc20f..f76121a3 100644 --- a/src/components/__tests__/SwapWidget.test.tsx +++ b/src/components/__tests__/SwapWidget.test.tsx @@ -8,14 +8,16 @@ import { CHAINS_RESPONSE } from "../../../fixtures/chains"; import { SwapWidget } from "../SwapWidget"; import { LAST_SOURCE_CHAIN_KEY } from "../SwapWidget/useSwapWidget"; +const API_URL = "https://solve-dev.skip.money"; + const handlers = [ - rest.get("https://api.skip.money/v1/info/chains", (_, res, ctx) => { + rest.get(`${API_URL}/v1/info/chains`, (_, res, ctx) => { return res(ctx.status(200), ctx.json(CHAINS_RESPONSE)); }), - rest.get("https://api.skip.money/v1/fungible/assets", (_, res, ctx) => { + rest.get(`${API_URL}/v1/fungible/assets`, (_, res, ctx) => { return res(ctx.status(200), ctx.json(ASSETS_RESPONSE)); }), - rest.post("https://api.skip.money/v1/fungible/route", (_, res, ctx) => { + rest.post(`${API_URL}/v1/fungible/route`, (_, res, ctx) => { return res( ctx.status(200), ctx.json({ diff --git a/src/test/index.tsx b/src/test/index.tsx index 6e631275..1a436782 100644 --- a/src/test/index.tsx +++ b/src/test/index.tsx @@ -9,6 +9,8 @@ import { } from "@testing-library/react"; import { assets, chains } from "chain-registry"; import React, { FC, Fragment, PropsWithChildren } from "react"; +import { configureChains, createConfig, mainnet, WagmiConfig } from "wagmi"; +import { publicProvider } from "wagmi/providers/public"; import { WalletModalProvider } from "@/components/WalletModal"; import { AssetsProvider } from "@/context/assets"; @@ -16,6 +18,14 @@ import { ChainsProvider } from "@/context/chains"; import { SkipProvider } from "@/solve"; import { queryClient } from "@/utils/query"; +const { publicClient } = configureChains([mainnet], [publicProvider()]); + +export const wagmiConfig = createConfig({ + autoConnect: true, + connectors: [], + publicClient, +}); + const AllTheProviders: FC = ({ children }) => { return ( @@ -28,13 +38,15 @@ const AllTheProviders: FC = ({ children }) => { logLevel="NONE" walletModal={() =>
} > - - - - {children} - - - + + + + + {children} + + + +