From 8883d138a3c9baeb38f7fe9535cf2d5b2be54aa7 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 8 Aug 2024 14:44:52 +0500 Subject: [PATCH] v12 --- web/next.config.js | 1 + web/package.json | 4 ++-- web/src/app/page.tsx | 7 +++--- web/src/app/providers.tsx | 45 +++++++++++++++++++++++++++++++++------ web/yarn.lock | 28 +++++++++++++++--------- 5 files changed, 63 insertions(+), 22 deletions(-) diff --git a/web/next.config.js b/web/next.config.js index 0c0f3bf..ebc615e 100644 --- a/web/next.config.js +++ b/web/next.config.js @@ -2,6 +2,7 @@ const nextConfig = { reactStrictMode: true, webpack: (config, { dev }) => { + config.optimization.minimize = false; config.externals.push("pino-pretty", "lokijs", "encoding"); return config; }, diff --git a/web/package.json b/web/package.json index 094dd70..6ffe44d 100644 --- a/web/package.json +++ b/web/package.json @@ -10,7 +10,7 @@ "dependencies": { "@rainbow-me/rainbowkit": "^2.1.3", "@tanstack/react-query": "^5.28.4", - "@zetachain/universalkit": "^1.0.0", + "@zetachain/universalkit": "^2.0.0", "autoprefixer": "^10.4.19", "next": "^14.2.3", "next-themes": "^0.3.0", @@ -29,4 +29,4 @@ "node": ">=18.0.0" }, "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72" -} \ No newline at end of file +} diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx index 909790c..964e48f 100644 --- a/web/src/app/page.tsx +++ b/web/src/app/page.tsx @@ -1,7 +1,7 @@ "use client"; import { ConnectButton } from "@rainbow-me/rainbowkit"; -import { ConnectBitcoin } from "@zetachain/universalkit"; +import { ConnectBitcoin, Balances } from "@zetachain/universalkit"; import { Welcome } from "./welcome"; const Page = () => { @@ -11,9 +11,10 @@ const Page = () => { -
-
{/* Add components here */}
+
+ +
); diff --git a/web/src/app/providers.tsx b/web/src/app/providers.tsx index 10d97e6..d8b07c1 100644 --- a/web/src/app/providers.tsx +++ b/web/src/app/providers.tsx @@ -2,13 +2,13 @@ import { useState, useEffect } from "react"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { WagmiProvider } from "wagmi"; +import { WagmiProvider, useChainId, useWalletClient } from "wagmi"; import { RainbowKitProvider, darkTheme, lightTheme, } from "@rainbow-me/rainbowkit"; -import { UniversalKitProvider } from "@zetachain/universalkit"; +import { UniversalKitProvider, useEthersSigner } from "@zetachain/universalkit"; import { config } from "../wagmi"; import { useTheme, ThemeProvider as NextThemesProvider } from "next-themes"; @@ -23,6 +23,39 @@ const ThemeProvider = ({ children }: { children: React.ReactNode }) => { ); }; +const WagmiWrapper = ({ children }: { children: React.ReactNode }) => { + const chainId = useChainId(); + const { data: walletClient } = useWalletClient({ chainId }); + const signer = useEthersSigner({ walletClient }); + + if (!signer) null; + + const zetaConfig = { + network: "testnet", + signer, + chains: { + zeta_testnet: { + api: [ + { + url: "https://zetachain-athens.g.allthatnode.com/archive/evm", + type: "evm", + }, + ], + }, + }, + }; + + return ( + + {children} + + ); +}; + export const Providers = ({ children }: { children: React.ReactNode }) => { const [mounted, setMounted] = useState(false); @@ -41,11 +74,9 @@ export const Providers = ({ children }: { children: React.ReactNode }) => { enableSystem disableTransitionOnChange > - - - {children} - - + + {children} + diff --git a/web/yarn.lock b/web/yarn.lock index b8d38ae..6a98bab 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -3067,6 +3067,13 @@ dependencies: dotenv "^16.1.4" +"@zetachain/networks@^9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-9.0.0.tgz#59eddb02578d784a1d76299ead600dffce87f48c" + integrity sha512-vCSkzyiubgYHK0NAJFFCv9gQziGrB+BT9q6DEu29owWxHcGLHPbI4VJ5PbkWH+z8pExVSDe2wKxGN5l2ZAcbGA== + dependencies: + dotenv "^16.1.4" + "@zetachain/protocol-contracts@8.0.0-rc1": version "8.0.0-rc1" resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-8.0.0-rc1.tgz#34df589c1b56df77f2695b37bd8a4b79df1787b1" @@ -3077,10 +3084,10 @@ resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-7.0.0.tgz#20eb6c62d805d7470408ccdff0e3614684bca174" integrity sha512-8JTNFZxVZYmDtAXJIEr+tkakuML12X42Fya4bJ1NkfWiVMkcSej92BSTl/35qYtHdjY7vXy9uMrfXEqfw5rsPw== -"@zetachain/toolkit@^11.0.0": - version "11.0.0" - resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-11.0.0.tgz#3e6138082b1b8d2cbab7124d28204090c99555a2" - integrity sha512-gKQAHOcBPMRBnkn7mhshWTj5JRBJ5Y+TAiM2aCUmPpdEDgcxsnBcKbKsSVziop6QQjRwcjrG+6YM6GLnmLOJ3w== +"@zetachain/toolkit@^12.0.0": + version "12.0.0" + resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-12.0.0.tgz#383b0ea165ca417ede01beb7617aa04aee7d82d4" + integrity sha512-3ZIXHaI3OMf7bAp91bryalmq6HEvYFjG8wTNjCGqyBYaK6oQafgH8+zkgrVotm6LmO9EDOZd2E1L4sPOyFS7Mw== dependencies: "@inquirer/prompts" "^2.1.1" "@inquirer/select" "1.1.3" @@ -3088,7 +3095,7 @@ "@openzeppelin/contracts" "^4.9.6" "@uniswap/v2-periphery" "^1.1.0-beta.0" "@zetachain/faucet-cli" "^4.0.1" - "@zetachain/networks" "^8.0.0" + "@zetachain/networks" "^9.0.0" "@zetachain/protocol-contracts" "8.0.0-rc1" axios "^1.4.0" bech32 "^2.0.0" @@ -3110,10 +3117,10 @@ tiny-secp256k1 "^2.2.3" ws "^8.13.0" -"@zetachain/universalkit@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@zetachain/universalkit/-/universalkit-1.0.0.tgz#e10094cbadba9e5edcaf4cf5341f9316f023d280" - integrity sha512-cLqaxwg3jXLektmLtxtmjAzc3UKbSV6ToeP/H9K4H+ep3kUnVHoDM7gZbazEKevO4/aRIKyzbjmZagOWeG4eZg== +"@zetachain/universalkit@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@zetachain/universalkit/-/universalkit-2.0.0.tgz#cb49036403181c7dcd30bef64de195646bc1425a" + integrity sha512-80WNBZJfOn8x3z9N+bCmsdNCb6+JWTCXJ1c0OuATZVBEAg1UHgNgooBo76gadjJtGwqxPU80LKMEpF6muOntXA== dependencies: "@evmos/provider" "0.3.1" "@evmos/transactions" "0.2.10" @@ -3130,7 +3137,7 @@ "@web3-name-sdk/core" "^0.2.0" "@zetachain/networks" "^8.0.0" "@zetachain/protocol-contracts" "^7.0.0" - "@zetachain/toolkit" "^11.0.0" + "@zetachain/toolkit" "^12.0.0" autoprefixer "^10.4.19" bech32 "^2.0.0" class-variance-authority "^0.7.0" @@ -7404,6 +7411,7 @@ workerpool@^6.5.1: integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: + name wrap-ansi-cjs version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==