update all lib version
This commit is contained in:
parent
313dc1dfe3
commit
ca03213534
13
package.json
13
package.json
@ -8,13 +8,14 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@wagmi/core": "^1.4.2",
|
"@wagmi/connectors": "^4.1.14",
|
||||||
"@web3modal/wagmi": "^3.0.1",
|
"@wagmi/core": "^2.6.5",
|
||||||
"viem": "^1.12.2",
|
"@web3modal/wagmi": "^4.0.10",
|
||||||
"vue": "^3.3.4"
|
"viem": "^2.7.15",
|
||||||
|
"vue": "^3.4.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^4.3.4",
|
"@vitejs/plugin-vue": "^5.0.4",
|
||||||
"vite": "^4.4.9"
|
"vite": "^5.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,54 +1,40 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { walletConnectProvider } from '@web3modal/wagmi';
|
import { createWeb3Modal, defaultWagmiConfig } from '@web3modal/wagmi'
|
||||||
import { publicProvider } from '@wagmi/core/providers/public';
|
|
||||||
import { createWeb3Modal, defaultWagmiConfig, useWeb3Modal } from '@web3modal/wagmi/vue';
|
import { mainnet, arbitrum } from 'viem/chains'
|
||||||
import { arbitrumGoerli, arbitrum, mainnet } from '@wagmi/core/chains';
|
import { reconnect } from '@wagmi/core'
|
||||||
import {
|
|
||||||
getAccount,
|
|
||||||
fetchToken,
|
|
||||||
writeContract,
|
|
||||||
disconnect,
|
|
||||||
watchAccount,
|
|
||||||
configureChains,
|
|
||||||
createConfig,
|
|
||||||
fetchBalance,
|
|
||||||
} from '@wagmi/core';
|
|
||||||
import { InjectedConnector } from '@wagmi/core';
|
|
||||||
import { WalletConnectConnector } from '@wagmi/core/connectors/walletConnect';
|
|
||||||
|
|
||||||
import { EthereumProvider } from '@walletconnect/ethereum-provider';
|
|
||||||
// import Web3 from 'web3';
|
|
||||||
|
|
||||||
// 1. Get projectId
|
// 1. Get projectId
|
||||||
const projectId = 'e7743d46923911fa8850619b7a7f6d9d';
|
const projectId = 'e7743d46923911fa8850619b7a7f6d9d';
|
||||||
|
|
||||||
// 2. Configure wagmi client
|
// 2. Create wagmiConfig
|
||||||
const { chains, publicClient } = configureChains(
|
|
||||||
[arbitrumGoerli, arbitrum, mainnet],
|
|
||||||
[walletConnectProvider({ projectId }), publicProvider()]
|
|
||||||
);
|
|
||||||
|
|
||||||
const metadata = {
|
const metadata = {
|
||||||
name: 'Web3Modal',
|
name: 'Web3Modal',
|
||||||
description: 'Web3Modal Example',
|
description: 'Web3Modal Example',
|
||||||
url: 'https://web3modal.com',
|
url: 'https://web3modal.com', // origin must match your domain & subdomain
|
||||||
icons: ['https://avatars.githubusercontent.com/u/37784886'],
|
icons: ['https://avatars.githubusercontent.com/u/37784886']
|
||||||
};
|
}
|
||||||
|
|
||||||
const wagmiConfig = createConfig({
|
const chains = [mainnet]
|
||||||
autoConnect: true,
|
const config = defaultWagmiConfig({
|
||||||
connectors: [
|
chains, // required
|
||||||
new WalletConnectConnector({ chains, options: { projectId, showQrModal: false, metadata } }),
|
projectId, // required
|
||||||
new InjectedConnector({ chains, options: { shimDisconnect: true } }),
|
metadata, // required
|
||||||
// new CoinbaseWalletConnector({ chains, options: { appName: metadata.name } }),
|
enableWalletConnect: true, // Optional - true by default
|
||||||
],
|
enableInjected: true, // Optional - true by default
|
||||||
publicClient,
|
enableEIP6963: true, // Optional - true by default
|
||||||
});
|
enableCoinbase: false // Optional - true by default
|
||||||
// const wagmiConfig = defaultWagmiConfig({ chains, projectId, metadata });
|
})
|
||||||
|
|
||||||
|
reconnect(config)
|
||||||
// 3. Create modal
|
// 3. Create modal
|
||||||
createWeb3Modal({ wagmiConfig, projectId, chains });
|
let modal = createWeb3Modal({
|
||||||
const modal = useWeb3Modal();
|
wagmiConfig: config,
|
||||||
|
projectId,
|
||||||
|
enableAnalytics: true // Optional - defaults to your Cloud configuration
|
||||||
|
})
|
||||||
|
|
||||||
async function connectWc() {
|
async function connectWc() {
|
||||||
modal.open();
|
modal.open();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user