Skip to content

Commit

Permalink
Merge pull request #61 from AdMetaNetwork/kmy-dev
Browse files Browse the repository at this point in the history
feat: optimize wallet connection
  • Loading branch information
wxd56987 authored Sep 21, 2023
2 parents aa1b9c7 + 41ce81e commit de084a2
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
/.pnp
.pnp.js

# env
.env

# webstorm
.idea/

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@metamask/detect-provider": "^2.0.0",
"antd": "^4.22.3",
"axios": "^0.27.2",
"connectkit": "^1.4.0",
"connectkit": "^1.5.2",
"ethers": "^5.7.1",
"events": "^3.3.0",
"mongodb": "^4.10.0",
Expand All @@ -26,8 +26,8 @@
"react-player": "^2.10.1",
"request-ip": "^3.3.0",
"sass": "^1.54.0",
"viem": "^1.3.0",
"wagmi": "^1.3.9"
"viem": "^1.10.3",
"wagmi": "1.4.1"
},
"devDependencies": {
"@types/node": "16.11.9",
Expand Down
27 changes: 18 additions & 9 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { WagmiConfig, createConfig } from 'wagmi';
import { WagmiConfig, createConfig, configureChains } from 'wagmi';
import { publicProvider } from 'wagmi/providers/public'
import { alchemyProvider } from 'wagmi/providers/alchemy'
import { MetaMaskConnector } from 'wagmi/connectors/metaMask'
import { sepolia } from 'wagmi/chains';
import { ConnectKitProvider, getDefaultConfig } from 'connectkit';
import { ConnectKitProvider } from 'connectkit';

const config = createConfig(
getDefaultConfig({
appName: 'AdMeta App',
chains: [sepolia],
walletConnectProjectId: process.env.PUBLIC_WALLETCONNECT_PROJECT_ID || '',
})
);
const { chains, publicClient, webSocketPublicClient } = configureChains(
[sepolia],
[alchemyProvider({ apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY || 'yourAlchemyApiKey' }), publicProvider()],
)

const config = createConfig({
autoConnect: false,
connectors: [
new MetaMaskConnector({ chains })
],
publicClient,
webSocketPublicClient,
})

function MyApp({ Component, pageProps }: AppProps) {

Expand Down
Loading

0 comments on commit de084a2

Please sign in to comment.