Skip to content

Commit

Permalink
fix(app): getSigner in Contract page
Browse files Browse the repository at this point in the history
  • Loading branch information
johnson86tw committed Apr 18, 2024
1 parent cb5d584 commit 4f22c84
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions app/components/content/Contract.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ const contract = new ethers.Contract(contractAddress, iface, defaultProvider)
// ======================== Wallet ========================
const { isConnected, chainId, error: ConnectError, onConnected } = useVueDapp()
const { isConnected, wallet, chainId, error: ConnectError } = useVueDapp()
let signer: ethers.Signer | null = null
onConnected(async (wallet: ConnWallet) => {
const provider = new ethers.BrowserProvider(wallet.provider)
signer = await provider.getSigner()
})
watch(
isConnected,
async () => {
if (isConnected.value) {
const provider = new ethers.BrowserProvider(wallet.provider!)
signer = await provider.getSigner()
}
},
{
immediate: true,
},
)
onMounted(() => {
fetchData()
Expand Down

0 comments on commit 4f22c84

Please sign in to comment.