Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
johnson86tw committed Apr 16, 2024
1 parent 2f89fd6 commit 41d6eb4
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ npm install pinia @vue-dapp/core @vue-dapp/modal @vue-dapp/walletconnect @vue-da

```vue
<script lang="ts" setup>
import { BrowserWalletConnector, VueDappProvider, type ConnWallet } from '@vue-dapp/core'
import {
useVueDapp,
BrowserWalletConnector,
VueDappProvider,
type ConnWallet,
} from '@vue-dapp/core'
import { VueDappModal } from '@vue-dapp/modal'
import '@vue-dapp/modal/dist/style.css'
import '@vue-dapp/modal/dist/style.css' // make sure to add css for the modal
const { status, isConnected, address, chainId, error, disconnect, addConnector } = useVueDapp()
Expand All @@ -86,10 +91,23 @@ if (process.client) { // only when using Nuxt 3
function handleConnect(wallet: ConnWallet) {
console.log('handleConnect', wallet)
// example with ethers v6
const ethersProvider = new ethers.providers.Web3Provider(provider)
const signer = await ethersProvider.getSigner()
dappStore.setUser({
address,
signer: markRaw(signer),
chainId,
})
}
function handleDisconnect() {
console.log('handleDisconnect')
// example
dappStore.resetUser()
}
</script>
Expand Down

0 comments on commit 41d6eb4

Please sign in to comment.